segmentation_models icon indicating copy to clipboard operation
segmentation_models copied to clipboard

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type uint8 of argument 'x'.

Open alqurri77 opened this issue 2 years ago • 3 comments

Hi;

When I tried to use Dice lose. I got below message:

File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 878, in train_function * return step_function(self, iterator) File "/usr/local/lib/python3.7/dist-packages/segmentation_models/losses.py", line 97, in call * pr, File "/usr/local/lib/python3.7/dist-packages/segmentation_models/base/functional.py", line 145, in f_score * tp = backend.sum(gt * pr, axis=axes)

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type uint8 of argument 'x'.

alqurri77 avatar Jan 01 '22 06:01 alqurri77

Have you found a solution to this problem, please I have the same problem

Theedon avatar Jan 08 '22 09:01 Theedon

Had the same issue ==> in the getitem of the Dataset class, I added 'image = image.astype(np.float32)', same thing for the mask and it worked! Still having other issues though, but this one doesn't appear anymore :-)

JennifDyb avatar Jan 08 '22 14:01 JennifDyb

Yes. I also added image.astype(np.float32)', and it works. Thank you!

Get Outlook for iOShttps://aka.ms/o0ukef


From: JennifDyb @.> Sent: Saturday, January 8, 2022 9:52:02 AM To: qubvel/segmentation_models @.> Cc: Al Qurri, Ahmed Masaaod Abdallah @.>; Author @.> Subject: Re: [qubvel/segmentation_models] TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type uint8 of argument 'x'. (Issue #509)

Had the same issue ==> in the getitem of the Dataset class, I added 'image = image.astype(np.float32)', same thing for the mask and it worked! Still having other issues though, but this one doesn't appear anymore :-)

— Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fqubvel%2Fsegmentation_models%2Fissues%2F509%23issuecomment-1008012942&data=04%7C01%7Caqa6122%40psu.edu%7C2ff34e0f148a4be7e80b08d9d2b66e94%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637772503251886864%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=z86%2B0ICrnlu59ymcqI6JRUKQG9RrO83S%2Bljw%2BPeQwUQ%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASAAOTY2X7YII422A3SSSHLUVBFRFANCNFSM5LCFBJZA&data=04%7C01%7Caqa6122%40psu.edu%7C2ff34e0f148a4be7e80b08d9d2b66e94%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637772503251886864%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=2La%2BH8tctlUZIwOpb6nliU9k5EJZDEbPRLAPAv7D6F0%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Caqa6122%40psu.edu%7C2ff34e0f148a4be7e80b08d9d2b66e94%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637772503251886864%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=4%2BuSsYc1Kayw8q%2BO0wEl%2FcJaxOWFlv6EGBn8eEsI3Bk%3D&reserved=0 or Androidhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Caqa6122%40psu.edu%7C2ff34e0f148a4be7e80b08d9d2b66e94%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637772503251886864%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HuOll%2BlfyoFxtBmXQUB1osYZkkCWyKZQ3LZFf8pYHdE%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

alqurri77 avatar Jan 10 '22 13:01 alqurri77