Home > Back-end >  Using pretrained models for mnist dataset
Using pretrained models for mnist dataset

Time:04-17

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

CodePudding user response:

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)
  • Related