Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Keras预测新形象_Python_Tensorflow_Keras_Deep Learning - Fatal编程技术网

Python Keras预测新形象

Python Keras预测新形象,python,tensorflow,keras,deep-learning,Python,Tensorflow,Keras,Deep Learning,我正在使用 当运行all as untouched时,一切正常,但现在我想对单个文件进行测试, 我正在以这种方式进行: image = encode_img('new_image/x3fwf.png') image = image['image'] image.shape // TensorShape([200, 50, 1]) prediction_model.predict(image) 所以我回来了: ValueError:从1中减去2导致尺寸标注大小为负 {{node functio

我正在使用

当运行all as untouched时,一切正常,但现在我想对单个文件进行测试, 我正在以这种方式进行:

image = encode_img('new_image/x3fwf.png')
image = image['image']
image.shape 
// TensorShape([200, 50, 1])
prediction_model.predict(image)
所以我回来了:

ValueError:从1中减去2导致尺寸标注大小为负 {{node functional_13/pool1/MaxPool}=MaxPoolT=DT_FLOAT, data_format=“NHWC”,ksize=[1,2,2,1],padding=“VALID”,strips=[1, 2,2,1]'和输入形状:[?,50,1,32]


我知道我做错了什么,但不明白是什么

尝试向其添加维度,以便可以在批处理模式下调用它
([1200,50,1])

您可以使用

image = np.expand_dims(image, axis=0) 

尝试向其添加维度,以便可以在批处理模式下调用它
([1200,50,1])

您可以使用

image = np.expand_dims(image, axis=0)