DeformableGenerator icon indicating copy to clipboard operation
DeformableGenerator copied to clipboard

Problem with clipping in warping function

Open krishnaw14 opened this issue 5 years ago • 0 comments

Hi,

I tried running your code on Python 3.7.1 with tensorflow==1.14.0. But the code runs into error. The error is in the clipping done in _interpolate() function in custom_ops.py.

Error seems to be in the following lines:

x = tf.clip_by_value(x, zero1 + 0.000001, max_x1 - 0.000001) x0 = tf.cast(tf.floor(x), 'int32') x1 = x0 + 1

The value 0.000001 seems to be too small for clipping to max_x1 and hence the maximum value of x1 turns out to be equal to max_x1 +1 which is equal to the image height and is not a valid index for an image height dimension.

The error is solved by changing the first line that I have mentioned above to:

x = tf.clip_by_value(x, zero1 + 0.000001, max_x1 - 0.00001)

krishnaw14 avatar Nov 07 '19 10:11 krishnaw14