-
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
tf.image.resize_* gives negative results #19880
Comments
Hi @Luonic -- I'm having trouble interpreting what exactly the problem is here. bicubic_resize would be expected to change the values in the input tensor, as the same image is represented in fewer pixels. Can you provide a minimal example, using just the resize_* method you think has a bug, to demonstrate the problem? |
@karmel when we resizing image that have no negative values we expect result resized image to not have them too because linear interpolation just interpolates values beetween two non-negative values in source tensor. In my example we see that after resize we have negative values in result tensor but in source tensor all values were positive.
And output is:
Why do we have -47.5840836 in our resized image? |
@cwhipkey - any thoughts on whether this is an expected output for resize_bicubic? |
I'm not an expert, but I think that this can happen because of overshooting
as described on the wikipedia page for bicubic interpolation:
https://en.wikipedia.org/wiki/Bicubic_interpolation#Use_in_computer_graphics
.
…On Wed, Jun 27, 2018 at 2:56 PM Karmel Allison ***@***.***> wrote:
@cwhipkey <https://github.com/cwhipkey> - any thoughts on whether this is
an expected output for resize_bicubic?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19880 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQw4wamlUWlKViuLxhm8dDhVsTTzQf2Vks5uA_96gaJpZM4UhaSV>
.
|
@shlens -- any chance you have some insight on the expected output of bicubic interpolation in this case? |
I agree with @cwhipkey. This is potentially expected behavior with bicubic interpolation and a known limitation. This could be verified by running the same minimal test in OpenCV which has a well-tested version of bicubic interpolation and see if you observe the same result. |
Great-- @Luonic , have you checked the results with OpenCV? |
We are closing this issue for now due to lack of activity. Please comment if this is still an issue for you. Thanks! |
Hi, how do you fix this annoying problem? my image is between [0-255] (min 5, max 248), when interpole bicubic, it change between [no idea, to no idea] (and my min become -3 and max 260), |
System information
Describe the problem
I am trying to segment images using Pascal VOC 2012. I converted indexed pngs to grayscale, replaced pixels with value 255 with 0 and written them to tfrecord. Then when reading image with tf.data.Dataset i want to resize all images to constant scale at min dim and then randomly crop to square. Problem is that when i am resizing label tensor with tf.image.resize_bicubic some values are negative but in input tensor threre is no negative values.
UPD: Bicubc not only gives negative values but also changes it where it should not
Look at the right image:
Source code / logs
Here is run log:
The text was updated successfully, but these errors were encountered: