Comments (13)
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.
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:
- http://scikit-image.org/docs/dev/api/skimage.transform.html#affinetransform
- https://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2D_computer_graphics
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.
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.
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.
In fact that reshaping method exists: _flat_transforms_to_matrices
it just isn't exported.
from addons.
This also seems feasible to me.
from addons.
@ringw what do you think about exposing _flat_transforms_to_matrices
?
from addons.
That's fine with me, if we also expose _transform_matrices_to_flat
for consistency.
from addons.
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.
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.
from addons.
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.
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)
- Tensorflow-models-official call problem HOT 1
- Build failure with Tensorflow addons 0.20 HOT 7
- tfa.optimizers.MultiOptimizer does not work on TPU
- Create a TensorFlow Addons Release to work with TF Nightly HOT 2
- mutable default <class 'official.modeling.optimization.configs.optimizer_config.SGDConfig'> for field sgd is not allowed: use default_factory HOT 1
- Using TensorFlow to implement the Lion optimizer, only the latest head TF11 can be used, not supporting the use of TF old versions
- *Wrongfully Posted, Please Delete*
- Eager execution mode is disable in newer tf-gpu version
- `tfa.optimizers.MovingAverage` & `tfa.optimizers.SWA` future HOT 1
- `tfa.image.rotate` and `tfa.image.gaussian_filter2d` HOT 2
- `tfa.losses.GIoULoss` docs not clear about input format HOT 2
- Set permissions to GITHUB_TOKEN HOT 1
- Cannot build tensorflow addons with TF 2.14 HOT 2
- Any alternative library for tfa.losses.TripletSemiHardLoss() ? HOT 1
- Build failure against TF r2.16: third_party/eigen3/unsupported/Eigen/CXX11/Tensor: No such file or directory HOT 1
- ModuleNotFoundError: No module named 'keras.src.engine' HOT 1
- tensorflow-addons 0.23 wheel for windows
- Python 3.12 wheels on PyPI? HOT 1
- What will happen with layers which are in tfa, but not in other keras frameworks and which do not work with Keras 3 (I'm intrested in WeightNormalization layer) HOT 3
- AttributeError: 'ResourceVariable' object has no attribute 'overwrite_with_gradient' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from addons.