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

Suggestion: Handle Input Image of Any Aspect Ratio #3

Open
bilzard opened this issue Aug 16, 2021 · 1 comment
Open

Suggestion: Handle Input Image of Any Aspect Ratio #3

bilzard opened this issue Aug 16, 2021 · 1 comment

Comments

@bilzard
Copy link
Contributor

bilzard commented Aug 16, 2021

The original paper says:

... the proposed architecture allows for resizing an image to any target size and aspect ratio.

So the Resizer should handle input image with any aspect ratio.
In spite of that, the Resizer implementation (interpolation) seems to assume the input image is square (or, only handle uniform-scale resize: e.g. (512, 256) -> (256, 128)).

The current implementation interpolates by specifying scale_factor, though I think it's more useful to specify the output image size and calculate scale factor automatically.

The reference code:

# current implementation
self.interpolate = partial(F.interpolate,
                           scale_factor=self.scale_factor,
                           mode=self.interpolate_mode,
                           align_corners=False,
                           recompute_scale_factor=False)
# suggestion
self.interpolate = partial(F.interpolate,
                           size=output_size,
                           mode=self.interpolate_mode,
                           align_corners=False)

c.f. https://github.com/KushajveerSingh/resize_network_cv/blob/main/src/models/resizer.py#L56-L60

@KushajveerSingh
Copy link
Owner

Thank you for the suggestion. I will try to complete this in the next few days.

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