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

Fix cropping to include last column and last row #2384

Merged
merged 2 commits into from
Jun 2, 2023
Merged

Conversation

arunppsg
Copy link
Contributor

@arunppsg arunppsg commented Jun 1, 2023

Fixes #876

Description

I have updated image cropping lines to include last row and column. Earlier the top index was from [0, h - new_h) where h is the height of the image and new_h is the height of the cropped image.

Consider a case where new_h = 3 and h = 4. In this case, top index can only be 0 and hence the last row will never get started. To fix this, I have updated np.random.randint to sample from [0, h - new_h + 1) for choosing last row and for chosing last column, I have update the func to sample from [0, w - new_w + 1)

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnessessary issues are included into this pull request.

@netlify
Copy link

netlify bot commented Jun 1, 2023

Deploy Preview for pytorch-tutorials-preview ready!

Name Link
🔨 Latest commit fbc1e08
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-tutorials-preview/deploys/6479fe4ea2b724000807af04
😎 Deploy Preview https://deploy-preview-2384--pytorch-tutorials-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added data loading Issues relating to the data loading tutorial docathon-h1-2023 A label for the docathon in H1 2023 medium and removed cla signed labels Jun 1, 2023
Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @arunppsg

@svekars svekars merged commit 5b804b8 into pytorch:main Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data loading Issues relating to the data loading tutorial docathon-h1-2023 A label for the docathon in H1 2023 medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing last row and column of image in result of RandomCrop in data_loading_tutorial
4 participants