GKalliatakis / Keras-VGG16-places365

Keras code and weights files for the VGG16-places365 and VGG16-hybrid1365 CNNs for scene classification
MIT License
194 stars 76 forks source link

How to have similar predictions as Places365 Demo #15

Closed northtree closed 4 years ago

northtree commented 4 years ago

Please make sure that the boxes below are checked before you submit your issue.

Thank you!


From the official demo website: http://places2.csail.mit.edu/demo.html It will return below results from test image: http://places2.csail.mit.edu/imgs/demo/6.jpg

How could we have the confidence from scene categories, such as food_court (0.690)

Predictions: Type of environment: indoor Scene categories: food_court (0.690), cafeteria (0.163) Scene attributes: no horizon, enclosed area, man-made, socializing, indoor lighting, cloth, congregating, eating, working

The current vgg16_places_365 just return categories without confidence (also return different ranking).

PREDICTED SCENE CATEGORIES: cafeteria food_court restaurant_patio banquet_hall restaurant

northtree commented 4 years ago

@GKalliatakis It seems that the official demo used ResNet instead of VGG16

albertobeto commented 4 years ago

Different network architecture and training will lead to different prediction score. But you can print the confidence with something like:

  predictions_to_return = 5
  preds = model.predict(image)[0]
  top_preds = np.argsort(preds)[::-1][0:predictions_to_return]
  top_preds_score = np.sort(preds)[::-1][0:predictions_to_return]

  for i in range(0, 5):
      print("{:.2f}".format(top_preds_score[i]*100)+'% ' +
            classes[top_preds[i]])