Dear DeapLearning.ai tem,
The final assignment of the course requires to classify among 25(or 26) classes, representing Englsh alphabet.
- ImageDataGenerator. It was suggested to use the flow() method of ImageDataGenerator class.
In the examples in the course, we used other method - flow_from_directory() with parameter ‘class_mode’ one can set to ‘categorical’. The flow() method however does not have such a parameter. - create_model(). Because of 25 classes, the last layer shall be tf.keras.layers.Dense(25, activation=‘softmax’)
This threw ValueError: Shapes (None, 1) and (None, 25) are incompatible.
I was able to overcome the problem by using one-hot-encoding (tf.keras.utils.to_categorical()) of both training_labels and validation_labels when creating ImageDataGenerator.
This solution however diverted from the expected outocme of generators
My result “Labels of training generator have shape: (27455, 25)” - instead of expected “Labels of training generator have shape: (27455,)”
What other approach exist to fix the ValueError shown above?
Thank you in advance for your explanation,
Sergey