Error: `logits` and `labels` must have the same shape, received ((None, 256, 256, 1) vs (None, 256, 256, 3))

Viewed 26

I'm trying to train a U-net model for semantic segmentation. I have two arrays of images that have a shape of (1044, 256, 256, 3).

However, when I attempt to train my model it gives me the following error:

logits and labels must have the same shape, received ((None, 256, 256, 1) vs (None, 256, 256, 3))`

Printing my x_train.shape and y_train.shape give me these sizes: (1044, 256, 256, 3) (1044, 256, 256, 3).

Here is the code I'm using the train the model:

model = sm.Unet(BACKBONE, encoder_weights='imagenet')
model.compile(optimizer='adam', loss=bce_jaccard_loss,
metrics=['accuracy'])
 
model.fit(
    x_train,
    y_train,
    batch_size=16,
    epochs=100,
    verbose=1,
    validation_data=(x_val, y_val)
)
0 Answers
Related