-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Function used in many augmentations (convert_image_dtype) has an issue #48701
Comments
Was able to reproduce the issue in TF 2.4 and Nightly version as well. Please find the gist here. |
Thanks for reporting the issue! |
Hi, Can I take this issue? |
Yes, please feel free to do so. |
@kkimdev thank you. I did changes and try to check it by unit test, but have one small problem. Could you please tell me or send the link where I can find how to start the exact unit test? e.g ConvertImageTest.testNoConvert. |
@pointhex I think you can put unit test here https://github.com/tensorflow/tensorflow/blob/85c8b2a817f95a3e979ecd1ed95bff1dc1335cff/tensorflow/python/ops/image_ops_test.py and once you open a Github PR, it will kick off pre-submit testings. Thanks! |
The issue is still not resolved in TF master branch. It seems that PR #49868 was not merged. |
Here is a commit where this issue fix was removed 56ab230#diff-a5a22434f0c18768fc2e10c0e0420ac6f111a5802f67e3df54f155bfefc7094f |
Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template
System information
Describe the current behavior
There is a function convert_image_dtype that used in many augmentation ops like tf.image.stateless_random_brightness and etc.
That function has a rounding issue here
tensorflow/tensorflow/python/ops/image_ops_impl.py
Line 2290 in 85c8b2a
Maybe other cases also have this bug (not checked).
When we casting float to int, we should use rounding. In convert_image_dtype rounding implemented as shift by 0.5 which is correct for max value, but is not correct for 0.
See example by link below.
Describe the expected behavior
Every time convert_image_dtype changes value scale following casting to int, it should use rounding before casting.
Standalone code to reproduce the issue
https://colab.research.google.com/drive/1xZqyuAlZu_xkDZZHNsr7K8g6MyapcNPi?usp=sharing
The text was updated successfully, but these errors were encountered: