Skip to content

Make image_size the longer side of the torchvision model input - #1515

Open
mh-masum6875 wants to merge 1 commit into
obss:mainfrom
mh-masum6875:fix/torchvision-image-size
Open

mh-masum6875 wants to merge 1 commit into
obss:mainfrom
mh-masum6875:fix/torchvision-image-size

Conversation

@mh-masum6875

Copy link
Copy Markdown
Contributor

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 instead of 320x173.

Sets max_size to image_size so the longer side lands on it. Square images are unaffected.

One new test. With the change tests/test_torchvision.py gives 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).

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

No deployments
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.

1 participant