Skip to content
Advertisement

How to fix failed assertion `output channels should be divisible by group’ when trying to fit the model in Keras?

I’m trying to use ImageDataGenerator() for my image datasets. Here is my image augmentation code:

JavaScript

Then use that plug into my model:

JavaScript

Use EarlyStopping:

JavaScript

Compile and Fit the model:

JavaScript

That is when the code crash, and gives this error message.

JavaScript

I try to change the output neurons but that doesn’t work. I don’t know what to do anymore. Please help me. Thank you so much.

Advertisement

Answer

Got it. Because I use grayscale images. So I have to add color_mode keyword argument in both flow_from_dataframe() and set it equal to “grayscale”

JavaScript
Advertisement