I have my own dataset of images, and labels of objects per image, each label is described as a set of (x,y) points forming a convex polygon.
I want to implement my own augmentation.
Specifically, I want to rotate using
However I also need the transformation function, so I can apply it on my labels and get the new set of points defining the polygon of the object.
Is there a way, after calling
rotate, to have the transformation map from old pixels to new pixels?
@M_S would suggest instead of using the torch.utils for transforms, you can design your own utils.py with self designed transformations. You can import it and use it accordingly and should be able to help you out with you problem, ill add a link as an example -
Give it a look, Using your own file gives you more freedom to mess around with things.
Thanks for the answer,
That will require me to calculate the mapping function of a rotation with expanding by myself - my question was if such implementation already exists in the library (doesn’t have to be PyTorch native code but preferred as the rest of my augmentations are such)
Its very simple you just have to create a rotation matrix :
or you can check this post for suggested codes:
Yes, but as I mentioned that I require expansion, there is a translation followed after the rotation.
A solution I had in mind is to first pad the original images alot, which will then allow me to drop out expanding, and then indeed an easy calculation with a rotation matrix.
However I am still looking for an existing solution for this problem. If there’s no such, then I’ll implement…