Do you have any ideas to proceed custom size image using MobileNet?

66 views Asked by At

I have 600x800 RGB image, and I want to classify it using Transfer Learning method based on MobileNet model. I've tried following this instruction :

from keras.applications.mobilenet import MobileNet

feature_model = MobileNet(include_top=False, weights=None, input_shape=(600, 800, 3), alpha=1.0, depth_multiplier=1)

feature_model.load_weights('mobilenet_1_0_224_tf.h5') # give the path for downloaded weights

But I have error message like this : You are trying to load a weight file containing 55 layers into a model with 54 layers.

How could I solve that issue? Thanks for your help

1

There are 1 answers

0
Aniket Bote On

The error is self-explanatory. The number of layers in the model and weight file don't match. Judging from the name of the weight file. The weights are for 224 * 224 * 3 input.

Try this:

from keras.applications.mobilenet import MobileNet
feature_model = MobileNet(include_top=True, weights=None, input_shape=(224, 224, 3), alpha=1.0, depth_multiplier=1)
feature_model.load_weights('mobilenet_1_0_224_tf.h5')