fchollet / deep-learning-models

Keras code and weights files for popular deep learning models.
MIT License
7.31k stars 2.46k forks source link

Labels picked up from imagenet_class_index.json #44

Open tswapnil opened 7 years ago

tswapnil commented 7 years ago

I have imagenet 2014 val data with me and the index predicted by the model does not match the ground truth. I can see that the label (text ) suits the image well but the index does not. How is this indexing done in json file ?

Any pointers would be appreciated .

gugarosa commented 7 years ago

It's based on this format: {"0": ["n01440764", "tench"], "1": ["n01443537", "goldfish"], "2": ["n01484850", "great_white_shark"], "3": ["n01491361", "tiger_shark"], ..., }, where it stands for "class id": ["imagenet_reference_number", "real_class_name"].

To solve your problem, you could rewrite the decode_predictions function and allow it to pass your own .json ground truth path.