The Affine transform currently does not have an affine matrix parameter
See original GitHub issueIs your feature request related to a problem? Please describe.
The Affine
transform forwards its parameters to the AffineGrid
class.
But it currently does not provide the “affine” parameter which the AffineGrid
class also has.
This allows to directly define a affine transformation matrix instead of individual parameters for transformations like rotation. If computations are directly done with affine transformation matrices, this parameter is really helpful (necessary).
Describe the solution you’d like
The only change necessary, is to add the affine
parameter and to forward it to the AffineGrid
class.
class Affine(Transform):
...
def __init__(
...
affine: Optional[NdarrayOrTensor] = None,
...
) -> None:
...
self.affine_grid = AffineGrid(
...
affine=affine,
...
)
Describe alternatives you’ve considered We patched the affine transform locally.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
trying to understand the Affine Transform - Stack Overflow
Bonus: 'e' parameter is actually not a transformation. It can have values 1,-1. If it is 1 then nothing happens, but if it...
Read more >Get Affine Transformation Matrix from TransformParameters
Yes, fixed parameters (usually center of rotation) matter. They are usually initialized to all zeroes, but that might not be true in your...
Read more >Affine transformations - Washington
Two-dimensional transformations. Here's all you get with a 2 x 2 transformation matrix. M: So: We will develop some intimacy with the elements...
Read more >Affine Transformations
The affine transforms scale, rotate and shear are actually linear transforms and can be represented by a matrix multiplication of a point represented...
Read more >What is affine transformation in regard to neural networks?
It is a linear transformation. For example, lines that were parallel before the transformation are still parallel. Scaling, rotation, reflection etcetera.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Spenhouet ,
Thanks for your feedback. @wyli @ericspod I think this feature request can help improve the user experience, if you guys don’t have other concerns, I will try to add it based on the suggestion here.
Thanks in advance.
@wyli Maybe I misunderstood. We are not using the method to apply a static Affine in the pipeline. We are in fact using it like mentioned above.
I get where you are coming from, but I wonder if this is the right case to focus on this. The if-else branches already exist. The suggestion simply exposes the affine parameter to the Affine transform to not need to implement it like you suggested.
I don’t think it will make the Affine transform any more complicated.
EDIT: But it will make other methods which use this Affine transform simpler. So we save on complexity there.
EDIT2: Or how would you rate the code complexity on these two code snippets:
vs.
EDIT3: Also the first one will also output the resulting affine while the second will not and will need additional code (further increasing code complexity and boilerplate).