automatic-sem-image-segmentation icon indicating copy to clipboard operation
automatic-sem-image-segmentation copied to clipboard

Data type error in UNet_Segmentation.py

Open Shailendra-IISc opened this issue 3 years ago • 2 comments

Hello sir,

I am getting a data type error while using UNet_Segmentation.py.

In line number 258: weights = (y_true *( weighting - 1)) + 1 TypeError: Expected uint8 passed to parameter 'y' of op 'Mul', got float instead.

Regards, Shailendra

Shailendra-IISc avatar Jul 28 '22 08:07 Shailendra-IISc

Hello @Shailendra-IISc ,

are you using the correct Tensorflow version? When I tested the code with the specified version it ran fine for me, but I remember getting this error later when I upgraded to a newer Tensorflow version.

In any case, please try casting the masks to float by changing line 155 in the file UNet_segmentation.py from return mask to return mask.astype('float32')

Best,

Bastian

bruehle avatar Jul 28 '22 09:07 bruehle

Thank you, Bastian sir for the help. I am using Tensorflow 2.8.2 in Google CoLab GPUs. It is working now after implementing the suggested corrections.

Regards, Shailendra

Shailendra-IISc avatar Jul 28 '22 10:07 Shailendra-IISc