I need to use VGG pretrained model for feature extraction from an image. Also I need to get the output from the 1st and 5th layer of the VGG pretrained model. Is it really possible to do so?
If yes, can anyone provide the working code?
Edit: I downloaded the pretrained model as
model = VGG16()
Then I predicted it with an image as:
model.predict(image)
Now I want to get the output of the intermediate layers(The 1st convolutional and 5th convolutional layer) as:
x=model.layers[5].output
but it yields a empty matrix when I convert the tensor. What is the problem in the code?
N.B: I need an output matrix not a tensor