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

feature request: A transform that maps the input to the output in tf.contrib.image #22178

Closed
fclof opened this issue Sep 10, 2018 · 3 comments
Closed
Assignees

Comments

@fclof
Copy link

fclof commented Sep 10, 2018

feature request:
A transform that map the input to the output in tf.contrib.image

In current tf.contrib.image.transform, it says "The transforms are inverted compared to the transform mapping input points to output points".
This is counter-intuitive to me. Why would you define a function that applies a transform converting the output to the input? Isn't input -> transform matrix -> output more straight forward?

Update:

I believe this should be easy to implement.

You can check the the source code here.

Under def transform, it says:

" it maps the output point (x, y) to a transformed input point"

To make the inverted transform work, people have to use it with tf.linalg.inv.

My request is to change it to a normal transform, which maps the input point to the output point, so that we don't have to bother with tf.linalg.inv.

System information

  • Have I written custom code: NO
  • OS Platform and Distribution: Linux Ubuntu 16.04
  • Mobile device: N/A
  • TensorFlow installed from:
  • TensorFlow version: 1.10.0
  • Python version: 2.7.12
  • Bazel version:N/A
  • GCC/Compiler version : 5.4.0
  • CUDA/cuDNN version: 9.0
  • GPU model and memory: GTX 1070 8G
  • Exact command to reproduce: N/A
@Harshini-Gadige
Copy link

@cy89 Hi, could you please clarify if this can be implemented or open for contributions ?

@ringw ringw assigned ringw and unassigned cy89 Nov 7, 2018
@ringw
Copy link
Contributor

ringw commented Nov 7, 2018

We don't want to invert the transformation in the normal code path, since it adds extra complexity (the matrix could not be invertible). Internally, we need to loop over each output pixel and determine the transformed input pixel, so we do need the reverse transformation.

Normally, I think rotate() is used more often, which is negated compared to the usual transformation matrix to avoid needing to use the linalg ops. We also expose the rotation matrix through another function for the user to compose other transformations, and that matrix should be consistent with the one used internally (it should be a reverse transform).

We could add an option to transform(), maybe "forward" that defaults to False, but will invert the matrix if True.

@ringw
Copy link
Contributor

ringw commented Mar 15, 2019

Image transformations are moving to tensorflow_addons with TF 2.0: https://github.com/tensorflow/addons

Please open an issue there, and feel free to link to my comment as a possible way to handle this. Thanks!

@ringw ringw closed this as completed Mar 15, 2019
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

4 participants