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] Random Spatial Transforms #287

Open
esube opened this issue Oct 10, 2017 · 6 comments
Open

[Feature Request] Random Spatial Transforms #287

esube opened this issue Oct 10, 2017 · 6 comments

Comments

@esube
Copy link

esube commented Oct 10, 2017

I just saw the refactored transform and it looks much better. I had issues with the PIL backend of the previous transform and used to completely avoid the torchvision transform and implement the transforms I want locally using mostly opencv.

I also saw that color transforms are added in #275. These are all great! Is there a plan to add spatial transforms such as translation, rotation, shear etc.. (in general warping) augmentations. They are crucial in case of limited dataset training such as in attribute prediction, person re-id, extreme classification, etc...

@alykhantejani
Copy link
Contributor

Hi @esube, this is something we could potentially do and, as PyTorch now has support for spatial transformers, this could be implemented as just sampling an affine transformation matrix.

I'll try and put something together for this in the next week or so

@esube
Copy link
Author

esube commented Oct 10, 2017

@alykhantejani Thanks for your fast response as always. Yeah, the easiest way to implement this is using a generic affine transform matrix just like opencv's warp function. Better yet, you might even want to make the affine matrix as user input with some default behavior for the specific specializations: i.e. translation, rotation, shear etc...

@alykhantejani
Copy link
Contributor

I think this functionality will be added as part of #303

@daavoo
Copy link
Contributor

daavoo commented Nov 8, 2017

I have code somewhere that implements this functionallity using PIL.Image.transform and Image.AFFINE. I need to find some time to work on adapting the code to the current transforms API but I'm a little busy right now. Maybe next week

@daavoo
Copy link
Contributor

daavoo commented Dec 7, 2017

Opened PR with random translation #363 .

@esube @alykhantejani Question: Do we want a "generic" RandomAffine transform that let's the user specify the 6 parameters of the affine matrix or it's better to have specific transforms like RandomRotation, RandomTranslation, etc. or .. both?

@alykhantejani
Copy link
Contributor

I think both would be good, i.e. RandomRotate + RandomTranslate are useful and often clearer if you just want traslation for example. However, the power of the full affine matrix is good too (which can underneath just call the rotation + translation functions)

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

3 participants