How do I know in what order are the Keras classes? I mean, how do I know class 1 is associated with dogs, and class 2 with cats?
With only 2 classes, in the lecture I think Jeremy just made a hand-wave, as it’s pretty easy to tell which class is which, just by showing the test image (and assuming the classification got it right). But what if there are a lot more than just 2 classes, say, 200 classes – I’m not going to look at 200 images to determine which number is which class, right? Or what if as a human I can’t tell which class is which from the image (e.g. in cancer detection, lacking expertise I’d not be able to tell which class it is just by looking at an image.)
If you’re using an ImageDataGenerator and the flow_from_directory() method – which you are, currently – then the batches returned from the generator have a .classes attribute that lists all of the class labels in the order Keras is using them.
If it’s a classification problem,then what the model outputs will corresponds to what you trained it on.
If you do flow from directory, then the classes will be in alphabetical order.