当我想使用预训练的VGG16的问题是,它期望形状=(None, 224,224,3),但发现形状=(32,28,28)。我要怎么做才能使用这个模型?或者我不应该为244x244像素以下的图像使用convnets ?
使用tensorflow调整大小:
(x_train, y_train), (_, _) = tf.keras.datasets.mnist.load_data()
print(x_trian.shape) # (60000, 28, 28)
# train set / data
x_train = np.expand_dims(x_train, axis=-1)
x_train = tf.image.resize(x_train, [224,224])
print(x_train.shape) # (60000, 224, 224, 1)