Tensorflow ImageNet weight、ValueError的自定义输入形状:输入必须具有静态方形形状(128、128、(160、160)、(192、192)或(224、224)之一)

Tensorflow ImageNet weight、ValueError的自定义输入形状:输入必须具有静态方形形状(128、128、(160、160)、(192、192)或(224、224)之一),tensorflow,keras,deep-learning,transfer-learning,imagenet,Tensorflow,Keras,Deep Learning,Transfer Learning,Imagenet,产生错误的代码段: base = MobileNet(input_shape=(150,150,3), include_top=False, weights='imagenet') 案例1:当我在tensorflow版本(tf.\uuuuuu版本)的PC系统中尝试上述代码时,=“1.14.0” 我没有收到任何错误,只是收到一个小小的警告说 C:\Users\Hp\

产生错误的代码段:

base = MobileNet(input_shape=(150,150,3),
                                 include_top=False,
                                 weights='imagenet')
案例1:当我在tensorflow版本(
tf.\uuuuuu版本
)的PC系统中尝试上述代码时,=“
1.14.0
” 我没有收到任何错误,只是收到一个小小的警告说

C:\Users\Hp\anaconda3\lib\site-packages\keras_applications\mobilenet.py:207: UserWarning: `input_shape` is undefined or non-square, or `rows` is not in [128, 160, 192, 224]. 
Weights for input shape (224, 224) will be loaded as the default.
  warnings.warn('`input_shape` is undefined or non-square, '
但它是有效的,证明:-
base.summary()
提供输出:-

_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         [(None, 150, 150, 3)]     0
_________________________________________________________________
conv1_pad (ZeroPadding2D)    (None, 151, 151, 3)       0
_________________________________________________________________
conv1 (Conv2D)               (None, 75, 75, 32)        864
_________________________________________________________________
conv1_bn (BatchNormalization (None, 75, 75, 32)        128
_________________________________________________________________
conv1_relu (ReLU)            (None, 75, 75, 32)        0
_________________________________________________________________
conv_dw_1 (DepthwiseConv2D)  (None, 75, 75, 32)        288
_________________________________________________________________
conv_dw_1_bn (BatchNormaliza (None, 75, 75, 32)        128
_________________________________________________________________
conv_dw_1_relu (ReLU)        (None, 75, 75, 32)        0
_________________________________________________________________
conv_pw_1 (Conv2D)           (None, 75, 75, 64)        2048
_________________________________________________________________
conv_pw_1_bn (BatchNormaliza (None, 75, 75, 64)        256
_________________________________________________________________
conv_pw_1_relu (ReLU)        (None, 75, 75, 64)        0
_________________________________________________________________
......and so on....
一切都很完美

案例2:运行
tf的服务器机器出现问题。\uuuuu版本\uuuuu='1.12.0'
当我运行相同的代码段时,即

base = MobileNet(input_shape=(150,150,3),
                                 include_top=False,
                                 weights='imagenet')
它显示了上述错误,即:

ValueError: If imagenet weights are being loaded, input must have a static square shape (one of (128, 128), (160, 160), (192, 192), or (224, 224)). 
Input shape provided = (150, 150, 3)
如果这是1.12.0版本中如何修复的问题。 如果不起作用,为什么还要费心给include\u top=True/False? 请解释一下