Skip to content

over padding in RandomCrop when pad_if_needed #576

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
YHRen opened this issue Aug 15, 2018 · 2 comments
Closed

over padding in RandomCrop when pad_if_needed #576

YHRen opened this issue Aug 15, 2018 · 2 comments

Comments

@YHRen
Copy link

YHRen commented Aug 15, 2018

in random_crop, pad_if_needed, this seems over padded the image with 2* delta_w

img = F.pad(img, (self.size[1] - img.size[0], 0), self.fill, self.padding_mode)

@YHRen YHRen changed the title over padding? over padding in RandomCrop when pad_if_needed Aug 15, 2018
@fmassa
Copy link
Member

fmassa commented Aug 16, 2018

This has been recently merged in #564

The logic is that if the original image is smaller than the requested crop size, there are multiple possible ways of filling it with the padding value so that the full original image is inside the crop.

By adding such padding value, we guarantee that the whole image will be inside the crop, but we give the possibility of random crops, which effectively acts as data augmentation.

I'm closing the issue, but let me know if you disagree with this reasoning.

@fmassa fmassa closed this as completed Aug 16, 2018
@YHRen
Copy link
Author

YHRen commented Aug 16, 2018 via email

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

2 participants