Code Monkey home page Code Monkey logo

Comments (13)

aselle avatar aselle commented on June 30, 2024

Could you give an example of how this would be used? Also, how would you imagine implementing this. It seems to be it would be difficult, because you'd have to introspect a general tensor to make it work like you suggest.

from addons.

cancan101 avatar cancan101 commented on June 30, 2024

Not sure what you mean about introspecting tensor. I would think this would just convert the transform, represented as a tensor of shape (num_images, 8), to the standard matrix representation of an affine transform: num_images x 3 x 3, and then doing a standard matrix inverse.

For some more info:

This would be used in the case where you want to take an input image, transform it, run that transformed image through a network, get a result (may be coordinates or an output image) and then transform the results back to the original space.

from addons.

martinwicke avatar martinwicke commented on June 30, 2024

I don't think this is feasible in general. I'll close this issue. If someone can come up with a workable design, please file a new issue.

from addons.

cancan101 avatar cancan101 commented on June 30, 2024

Maybe I confused matters. This should just be a matter of reshaping the 8 values to 9 and then calling tf.matrix_inverse.

from addons.

cancan101 avatar cancan101 commented on June 30, 2024

In fact that reshaping method exists: _flat_transforms_to_matrices it just isn't exported.

from addons.

ringw avatar ringw commented on June 30, 2024

This also seems feasible to me.

from addons.

cancan101 avatar cancan101 commented on June 30, 2024

@ringw what do you think about exposing _flat_transforms_to_matrices ?

from addons.

ringw avatar ringw commented on June 30, 2024

That's fine with me, if we also expose _transform_matrices_to_flat for consistency.

from addons.

aselle avatar aselle commented on June 30, 2024

This sounds fine. @cancan101, I was confused that you meant "Transforms" in the general sense ... where contrast and brightness are a type of "transform" and you wanted to be able to create an op that undoes things. Would you be willing to submit a pull request @cancan101.

from addons.

3rd3 avatar 3rd3 commented on June 30, 2024

I've run into numerical instabilities inverting transformation matrices before, though for data augmentation it should suffice. Usually, one can construct the inverses using the inverse primitive affine transformations (shear, rotation etc.) in reverse order to achieve better numerical stability. Perhaps a function would be helpful that either constructs the mapping or the inverse like this tf.image.affine_transform(shear_x, shear_y, rotation, scale, translation_before, translation_after, inverse=False). Not entirely sure how useful that is. Just an idea.

from addons.

ringw avatar ringw commented on June 30, 2024

from addons.

dynamicwebpaige avatar dynamicwebpaige commented on June 30, 2024

Though supporting tf.image inversions is outside of the scope of TensorFlow Core, it might be a welcome contribution to image processing in TensorFlow Addons.

Transferring this issue to the tensorflow/addons repo; @seanpmorgan for visibility.

from addons.

seanpmorgan avatar seanpmorgan commented on June 30, 2024

My initial thought is that this could be difficult to maintain if it applied to all of the transforms in tfa.image. Seeing as the last comments were in 2017 I'm going to close this issue but happy to re-open and discuss if there is still a desire for this.

from addons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.