ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_1/MaxPool' (op

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/L_0000/article/details/80649507

错误原因:图片通道顺序不相符

修改两种方式:
1、在文件开头加入下面两行即可

from keras import backend as K  
K.set_image_dim_ordering('th') 

2、检查 ~/.keras/keras.json文件

if "image_dim_ordering": is "th" and "backend": "theano", your input_shape must be (channels, height, width)
if "image_dim_ordering": is "tf" and "backend": "tensorflow", your input_shape must be (height, width, channels)

猜你喜欢

转载自blog.csdn.net/L_0000/article/details/80649507