ValueError: Exception encountered when calling layer "max_pooling2d_27" (type MaxPooling2D).

Negative dimension size caused by subtracting 3 from 2 for '{{node max_pooling2d_27/MaxPool}} = MaxPool[T=DT_FLOAT, data_format="NHWC", explicit_paddings=[], ksize=[1, 3, 3, 1], padding="VALID", strides=[1, 2, 2, 1]](Placeholder)' with input shapes: [?,2,2,256].

 我找了半天原因 开始以为是这篇文章的错误 (网上搜这个错误几乎都是让改channel_first或者last) https://blog.csdn.net/weixin_41449637/article/details/90479501 例如此篇文章

但是最后改了半天发现没用

我的模型是在池化层3报错的

应该是输入通道问题 但是不是上文链接那种 

解决方案:将padding改为same  这样用0填充通道边缘

padding= 'same'

就可以通过了

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐