resize_network_cv
resize_network_cv copied to clipboard
Suggestion: Handle Input Image of Any Aspect Ratio
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
Thank you for the suggestion. I will try to complete this in the next few days.