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

IoU smooth parameters incompatible with input being np.uint8 #42

Open
maxpv opened this issue Dec 9, 2020 · 1 comment
Open

IoU smooth parameters incompatible with input being np.uint8 #42

maxpv opened this issue Dec 9, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@maxpv
Copy link

maxpv commented Dec 9, 2020

Thanks again for this nice package.

JFYI, I've noticed an issue while using metrics.iou when the input is np.uint8 and the smooth parameter is a float -by default:

import numpy as np
from keras_unet.metrics import iou

tshape = (30, 50)

input = np.zeros(tshape, dtype=np.uint8)

iou(input, input, smooth=1.).numpy()
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in raise_from_not_ok_status(e, name)
   6841   message = e.message + (" name: " + name if name is not None else "")
   6842   # pylint: disable=protected-access
-> 6843   six.raise_from(core._status_to_exception(e.code, message), None)
   6844   # pylint: enable=protected-access
   6845 

/usr/local/lib/python3.6/dist-packages/six.py in raise_from(value, from_value)

InvalidArgumentError: cannot compute AddV2 as input #1(zero-based) was expected to be a uint8 tensor but is a float tensor [Op:AddV2]iou

To sum up:

  • Input np.uint8 with smooth type float generates an error
  • Input np.uint8 with smooth type np.uint8 generates works
  • Input np.float32 with smooth type float/np.uint8 works
@karolzak
Copy link
Owner

Hi @maxpv
Good catch! Seems to be a mistake indeed.

@karolzak karolzak added the bug Something isn't working label Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants