I\'m using keras\' pre-trained model VGG16, following this link: Keras VGG16 I\'m trying to decode the prediction output into word of what\'s in the image:
m
Just to add on the correct answer by @Marcin Możejko
The same applies to the other available models, so you must always include the top three layers:
vgg19 <- application_vgg19(include_top = TRUE, weights = "imagenet")
model_resnet50 <- application_resnet50(include_top = TRUE, weights = "imagenet")
model_inception_v3 <- application_inception_v3(include_top = TRUE, weights = "imagenet")
model_xception <- application_xception(include_top = TRUE, weights = "imagenet")
You should change a first line to:
model = VGG16(weights='imagenet', include_top=True)
Without this line your model is producing a 512 feature maps with size of 7 x 7 pixels. This the reason behind your error.