Some details -
- I have done one hot encoding of labels. I can see the expected output does not match for: train_val_generators.
My Output-
Images of training generator have shape: (27455, 28, 28, 1)
Labels of training generator have shape: (27455, 26)
Images of validation generator have shape: (7172, 28, 28, 1)
Labels of validation generator have shape: (7172, 26)
Expected Output
Images of training generator have shape: (27455, 28, 28, 1)*
Labels of training generator have shape: (27455,)*
Images of validation generator have shape: (7172, 28, 28, 1)*
Labels of validation generator have shape: (7172,)*
Though model compiles fine. I used categorical_crossentropy for loss function & softmax in the output layer. Last layer looks like -
dense_19 (Dense) (None, 26) 3354
The grader gives below error -
File "/opt/conda/lib/python3.7/site-packages/keras/backend.py", line 4994, in categorical_crossentropy
target.shape.assert_is_compatible_with(output.shape)
ValueError: Shapes (None, 1) and (None, 26) are incompatible
I understand the error. i.e. it’s expecting an output of shape[1]. But in a multiclassifier, how do we get the Model to give one label in the output layer?
My understanding was that the model would give a probability & we would do argmax to find the index with highest probablility?