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

Asked By: kukelia

||

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)
Answered By: Ayalew Mohammed

There is a code of using Torchvision pre-trained model. 99.75% test accuracy.

https://github.com/dipuk0506/SpinalNet/blob/master/Jupyter%20Notebooks/transfer-learning-on-mnist-with-vgg.ipynb

Answered By: H M Dipu Kabir
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.