Skip to content

Add translate and RandomTranslate #806

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

Closed
wants to merge 10 commits into from
Closed

Add translate and RandomTranslate #806

wants to merge 10 commits into from

Conversation

ekagra-ranjan
Copy link
Contributor

This PR adds translate and RandomTranslate as a separate transformation like the rotation transformation.

@codecov-io
Copy link

codecov-io commented Mar 19, 2019

Codecov Report

Merging #806 into master will decrease coverage by 22.04%.
The diff coverage is 88.57%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #806       +/-   ##
===========================================
- Coverage   60.03%   37.98%   -22.05%     
===========================================
  Files          64       33       -31     
  Lines        5054     3296     -1758     
  Branches      754      526      -228     
===========================================
- Hits         3034     1252     -1782     
- Misses       1817     1964      +147     
+ Partials      203       80      -123
Impacted Files Coverage Δ
torchvision/transforms/functional.py 71.2% <100%> (+0.08%) ⬆️
torchvision/transforms/transforms.py 83.51% <85.18%> (+0.97%) ⬆️
torchvision/models/inception.py 14.41% <0%> (-71.87%) ⬇️
torchvision/models/vgg.py 18.18% <0%> (-71.38%) ⬇️
torchvision/models/resnet.py 17.29% <0%> (-70.53%) ⬇️
torchvision/models/densenet.py 18.8% <0%> (-66.43%) ⬇️
torchvision/models/squeezenet.py 27.45% <0%> (-59.09%) ⬇️
torchvision/models/googlenet.py 15.87% <0%> (-57.51%) ⬇️
torchvision/models/alexnet.py 38.09% <0%> (-48.27%) ⬇️
torchvision/datasets/utils.py 35.1% <0%> (-13.32%) ⬇️
... and 54 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b3a1b6...7cc6149. Read the comment docs.

@surgan12
Copy link
Contributor

@ekagra-ranjan would be nice if you add some tests.

@ekagra-ranjan
Copy link
Contributor Author

@surgan12 Yup! Will add them.

@ekagra-ranjan
Copy link
Contributor Author

@fmassa Please have a look at the PR.

@fmassa
Copy link
Member

fmassa commented Mar 26, 2019

Hi,

What's the difference between translate and a random crop?

@ekagra-ranjan
Copy link
Contributor Author

If the user needs to randomly translate the image by some pixels then I think using RandomTranslate with its parameters will be more intuitive for the users (due to the straight forward naming of function and its parameter) rather than using RandomCrop. I agree that RandomCrop can get the same results but it is just that RandomCrop's main function is cropping and not translate. Being able to give translated image as well is a sort of extension with the padding argument.

@fmassa Your views on this?

@fmassa
Copy link
Member

fmassa commented Mar 26, 2019

So, there was a PR in the past that already added a similar functionality #363

I was not convinced by then, because both performed the same thing in the end.

@ekagra-ranjan
Copy link
Contributor Author

ekagra-ranjan commented Mar 26, 2019

I think it is the connotation of RandomCrop that can get people confused about its application.

Maybe we can add translation as a use case in the docs of RandomCrop just like there is a mention about whitening in the LinearTransformation (now AffineTransformation)?

@ekagra-ranjan
Copy link
Contributor Author

@fmassa What are your views on addition of translation as a use case in RandomCrop?

@malfet malfet deleted the branch pytorch:master September 20, 2021 14:34
@malfet malfet closed this Sep 20, 2021
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

Successfully merging this pull request may close these issues.

5 participants