Closed juanmed closed 5 years ago
Juan, Thats a great question. The answer is : keras gives the labels based on alphanumeric ordering of the folder names, so norust is assigned 0 and rust is assigned 1 (since n comes before r in alphabetic order). Ref : https://keras.io/preprocessing/image/ "classes: Optional list of class subdirectories (e.g. ['dogs', 'cats']). Default: None. If not provided, the list of classes will be automatically inferred from the subdirectory names/structure under directory, where each subdirectory will be treated as a different class (and the order of the classes, which will map to the label indices, will be alphanumeric). The dictionary containing the mapping from class names to class indices can be obtained via the attribute class_indices."
Thanks so much for the answer! This makes it completely clear now.
Hello!
Thanks a lot for releasing your code and the blog post at Floyhub. I have been learning new tricks with Tensorflow.
I have one question for you though, in short, in the code below for rust image classification, how do you know that if output > 0.5 the image corresponds to class RUST, and if output < 0.5 it corresponds to NORUST class?
To me it seems it could also be the other way around (if output < 0.5 class is RUST, else class is NORUST) because we (the user) never defined this. I have looked throughout the documentation but I have not find an answer for this.
When doing binary classification and the ImageDataGenerator, the training details for the loss function are hidden from the user. In other words, how do we know for which class from the ImageDataGenerator the network was trained to output a probability > 0.5.
A more general question, but not related to your tutorial, for multiclass classification, if for example the last layer has N neurons corresponding to N classes, how do we know to which neuron the network assigns which class?
Again, thank you very much for your tutorial, it has been very useful and I have learned several new things!
Juan