Repository navigation
Make image_size the longer side of the torchvision model input - #1515
Open
mh-masum6875 wants to merge 1 commit into
Open
mh-masum6875 wants to merge 1 commit into
mh-masum6875 wants to merge 1 commit into
Conversation
perform_inference set both min_size and max_size to image_size * shorter / longer. torchvision then caps the longer side at that value, so a non-square image was resized well below what was asked for: image_size=320 on a 1068x580 image gave a 173x94 input. Set max_size to image_size so the longer side lands on it. Square images are unaffected. Three tests had detections from the smaller input written into them and now expect the results at the requested size.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
perform_inferenceset bothmin_sizeandmax_sizetoimage_size * shorter / longer. torchvision then caps the longer side at that value, so a non-square image was resized well below what was asked for:image_size=320on a 1068x580 image gave a 173x94 input instead of 320x173.Sets
max_sizetoimage_sizeso the longer side lands on it. Square images are unaffected.One new test. With the change
tests/test_torchvision.pygives 10 passed; with the source change reverted, 4 fail.Three existing test expectations change. They had detections from the smaller input written into them (counts 7, 8 and 7) and now expect the results at the requested size (13, 23 and 13, plus the first boxes).