keras-unet-collection icon indicating copy to clipboard operation
keras-unet-collection copied to clipboard

I have a question about the shapes incompatible error.

Open cslee99 opened this issue 3 years ago • 2 comments

I downloaded the COCO dataset and tested it as in the example. I create a dataset and an error occurs in the train code.

...
record = np.mean(keras.losses.categorical_crossentropy(valid_label, y_pred))
...
loss_ = model.train_on_batch([train_input,], [train_label,])

Error : Shapes (2069, 128, 128, 2) and (2069, 128, 128, 3) are incompatible.

How do I solve it?

cslee99 avatar Jan 27 '22 05:01 cslee99

Have you configured your model to accept two input channels and test it with data that has three channels?

yingkaisha avatar Jan 27 '22 07:01 yingkaisha

Have you configured your model to accept two input channels and test it with data that has three channels?

I tested the same as "Human-seg_atten-unetbackbone_coco.ipynb" source code. The source code is as below.

valid_input = input_data_process(utils.image_to_array(valid_input_names, size=128, channel=3))
valid_label = target_data_process(utils.image_to_array(valid_label_names, size=128, channel=1))

cslee99 avatar Jan 27 '22 09:01 cslee99