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

tfa.image.transform interpolates pixels that are outside image boundary (instead of using fill_value) #2357

Closed
eli-osherovich opened this issue Jan 21, 2021 · 2 comments

Comments

@eli-osherovich
Copy link
Contributor

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Debian testing
  • TensorFlow version and how it was installed (source or binary): 2.4.0 (binary)
  • TensorFlow-Addons version and how it was installed (source or binary): 0.12.0 (binary)
  • Python version: 3.8
  • Is GPU used? (yes/no): no

Describe the bug

tfa.image.transform interpolates pixels that are outside image boundary (instead of using fill_value)
In the example below, the corner pixels are mapped from coordinates that lie outside the image. Hence, they must be set to fill_value (like, for example, scipy.ndimage.affine_transform and skimage.transform.AffineTransform). However, they are interpolated.

Code to reproduce the issue

import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa

a = np.ones((3,3))
tfa.image.rotate(a, np.deg2rad(45), interpolation="bilinear")

<tf.Tensor: shape=(3, 3), dtype=float64, numpy=
array([[0.58578646, 1.        , 0.58578634],
       [1.        , 1.        , 1.        ],
       [0.58578646, 1.        , 0.58578634]])>

Other info / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

@WindQAQ
Copy link
Member

WindQAQ commented Jan 22, 2021

We invoke tf.raw_ops.ImageProjectiveTransformV3 so it's better to post the feature request in core TensorFlow.

@WindQAQ WindQAQ closed this as completed Jan 22, 2021
@eli-osherovich
Copy link
Contributor Author

Opened the issue in tensorflow: tensorflow/tensorflow#46637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants