Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data type error in UNet_Segmentation.py #3

Open
Shailendra-IISc opened this issue Jul 28, 2022 · 2 comments
Open

Data type error in UNet_Segmentation.py #3

Shailendra-IISc opened this issue Jul 28, 2022 · 2 comments

Comments

@Shailendra-IISc
Copy link

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

@bruehle
Copy link
Collaborator

bruehle commented Jul 28, 2022

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

@Shailendra-IISc
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants