Using pretrained models for mnist dataset
Question:
The problem when I want to use pre-trained VGG16 is that is expects shape=(None, 224, 224, 3), but found shape=(32, 28, 28).
What can I do in order to use the model? or should I not use convnets for images under 244 x 244 pixels?
Thanks
Answers:
resize using tensorflow as follows:
(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)
There is a code of using Torchvision pre-trained model. 99.75% test accuracy.
The problem when I want to use pre-trained VGG16 is that is expects shape=(None, 224, 224, 3), but found shape=(32, 28, 28).
What can I do in order to use the model? or should I not use convnets for images under 244 x 244 pixels?
Thanks
resize using tensorflow as follows:
(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)
There is a code of using Torchvision pre-trained model. 99.75% test accuracy.