resize_network_cv icon indicating copy to clipboard operation
resize_network_cv copied to clipboard

Suggestion: Handle Input Image of Any Aspect Ratio

Open bilzard opened this issue 3 years ago • 1 comments

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

bilzard avatar Aug 16 '21 04:08 bilzard

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

KushajveerSingh avatar Aug 16 '21 16:08 KushajveerSingh