keras-team / keras-applications

Reference implementations of popular deep learning models.
Other
2k stars 913 forks source link

Difficulty in finding the name of category and respective probabilities of an image #112

Closed csitaula closed 4 years ago

csitaula commented 5 years ago

Hi, I am working on probability features for my research. I am trying to extract the label and probability for all 1000 category for the input image. How to do that? decode_predictions only returns the top probabilities. I don't need top probabilities. Just list of categories in a natural way. HOw to solve my problem? Thanks

taehoonlee commented 5 years ago

@csitaula, You can load information of all the 1000 classes as follows:

import json
with open('~/.keras/models/imagenet_class_index.json') as f:
    classes = json.load(f)