I'm using transfer learning to build an image recognition model using a pre-trained VGG network in Keras and excluding the final fully-connected layer to get the output weights. I'm then using these output weights to feed into my new model which has a few layers along with a new fully-connected layer of my own that I'm training. The fully-connected layer maps to the number of output classes that I'm trying to predict.
Everything is working fine. However, when I run:
results = model.predict(img_tensor)
I get output probabilities corresponding to each class, similar to the below:
print(results) [[0.1426621 0.6193871 0.23795079] [0.11187755 0.6208466 0.2672758 ] [0.10050113 0.3768951 0.52260375] [0.1338948 0.59470254 0.27140263] [0.06612041 0.69726 0.2366195 ] [0.12080433 0.495977 0.38321865]]
My question is: How can I find out what class each of the columns in the probabilities output correspond to?
Does Keras have anything built-in to identify which column of the output probabilities corresponds to which class? I would be shocked if nothing is provided...
What have others done to create a work-around?