I am using ubuntu with python 3 and keras over tensorflow, I am trying to create a model using transfer learning from a pre trained keras model as explained here:
I am using the following code
import numpy as np
from keras.applications import vgg16, inception_v3, resnet50, mobilenet
from keras import Model
a = np.random.rand(1, 224, 224, 3) + 0.001
a = mobilenet.preprocess_input(a)
mobilenet_model = mobilenet.MobileNet(weights='imagenet')
mobilenet_model.summary()
inputLayer = mobilenet_model.input
m = Model(input=inputLayer, outputs=mobilenet_model.get_layer("conv_pw_13_relu")(inputLayer))
m.set_weights(mobilenet_model.get_weights()[:len(m.get_weights())])
p = m.predict(a)
print(np.std(p), np.mean(p))
print(p.shape)
The output of the layer I am using is always an array of zeros, Should I load the weight to p that i am creating in order for the pre trained model to actually work?