You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When training, I receive this error:
ValueError: Cannot squeeze axis=-1, because the dimension is not 1.
I've set class_mode='categorical' in the ImageDataGenerator flow:
train_generator = train_datagen.flow_from_directory(train_dir, target_size=(224, 224),
color_mode='grayscale', batch_size=64, class_mode='categorical')
I am using this model to classify an image dataset into 2 classes. Please help!
The text was updated successfully, but these errors were encountered:
This can happen if the network output does not have the expected shape for binary classification.
The model output needs to have two final activation units for each class. It would be possible to add a dense layer with softmax activation at the end of the network to ensure an output compatible with class_mode='categorical' of the ImageDataGenerator.
The error can also arise from the margin_loss loss function. It would have the loss for two classes and that y_true and y_pred have the same shape.
I'm building a capsule network in TensorFlow for binary classification using a custom CapsuleLayer. My model and associated components are as follows:
When training, I receive this error:
ValueError: Cannot squeeze axis=-1, because the dimension is not 1.
I've set class_mode='categorical' in the ImageDataGenerator flow:
train_generator = train_datagen.flow_from_directory(train_dir, target_size=(224, 224),
color_mode='grayscale', batch_size=64, class_mode='categorical')
I am using this model to classify an image dataset into 2 classes. Please help!
The text was updated successfully, but these errors were encountered: