Keras: ValueError: decode_predictions expects a batch of predictions

前端 未结 2 1602
礼貌的吻别
礼貌的吻别 2021-01-12 05:32

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         


        
相关标签:
2条回答
  • 2021-01-12 06:12

    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")
    
    0 讨论(0)
  • 2021-01-12 06:16

    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.

    0 讨论(0)
提交回复
热议问题