I have been trying to figure out how to extract the "name" of the object detected on the picture. I have come across the following issue:
When I run the simple Convnets code using the VGG_16 model with an image of a horse of size (4650x3260), I get an array "out(1, 1000)". I assumed that each index of the array represents an object (e.g. 85 = French Bulldog), and that each value of the array represents the probability of the image showing the class assigned to that index (e.g. 0.143~ 14.3% probability of Image containing a French Bulldog).
However, when I run the code and find out the highest value of the array "out", I get and index/id of 349. When I transform that index/id into synset, I get 'n02415577'. This all looked good until I checked the ImageNet classes here and found out that:
a) Index/ID 349 does not correspond to synset n02415577, and
b) neither the ID nor the synset are assigned to "horse" on ImageNet.
The code I have used to find out the Index ID is:
import numpymax_index = numpy.argmax(out)
and to find the synset:
from convnetskeras.imagenet_tool import id_to_synsetwnid = id_to_synset(max_index)
Does anyone know why does it work fine for the given examples but performs so poorly with other images? Am I perhaps interpreting the prediction "out" completely wrong? Or does the image size play a significant role that could be causing problems?
Hello,
I have been trying to figure out how to extract the "name" of the object detected on the picture. I have come across the following issue:
When I run the simple Convnets code using the VGG_16 model with an image of a horse of size (4650x3260), I get an array "out(1, 1000)". I assumed that each index of the array represents an object (e.g. 85 = French Bulldog), and that each value of the array represents the probability of the image showing the class assigned to that index (e.g. 0.143~ 14.3% probability of Image containing a French Bulldog).
However, when I run the code and find out the highest value of the array "out", I get and index/id of 349. When I transform that index/id into synset, I get 'n02415577'. This all looked good until I checked the ImageNet classes here and found out that: a) Index/ID 349 does not correspond to synset n02415577, and b) neither the ID nor the synset are assigned to "horse" on ImageNet.
The code I have used to find out the Index ID is:
import numpy
max_index = numpy.argmax(out)
and to find the synset:
from convnetskeras.imagenet_tool import id_to_synset
wnid = id_to_synset(max_index)
Does anyone know why does it work fine for the given examples but performs so poorly with other images? Am I perhaps interpreting the prediction "out" completely wrong? Or does the image size play a significant role that could be causing problems?
Thanks