对 mnist 数据集使用预训练模型
Using pretrained models for mnist dataset
当我想使用预训练的 VGG16 时出现的问题是期望形状 =(None, 224, 224, 3),但发现形状 =(32, 28, 28)。
我该怎么做才能使用该模型?或者我不应该对 244 x 244 像素以下的图像使用 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)
当我想使用预训练的 VGG16 时出现的问题是期望形状 =(None, 224, 224, 3),但发现形状 =(32, 28, 28)。 我该怎么做才能使用该模型?或者我不应该对 244 x 244 像素以下的图像使用 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)