AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Pytorch image resize1/31/2024 def _resize_image_and_masks(image, self_min_size, self_max_size, target): Warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed "ĭeep down in GeneralizedRCNNTransform PyTorch makes the decidion if an image needs to be resized. See the documentation of nn.Upsample for details. If you wish to restore the old behavior, please set recompute_scale_factor=True. UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. P.S.: this call to interpolate with a float scale_factor creates a very annoying warning that should be addressed : What do the pro’s in this formum think about this? (sorry for bad formatting, the post interface removed all indentations, so I replaced that spaces with _) _if min_size self_max_size: # avoid rescaling if not required I believe the algorithm should be changed to: I debugged this and set the scale_factor to 1.0 in line 44 and it worked perfectly like a charm without resizing anything. If I now come in with an image that fits perfectly well, like for example 832 x 1333, this algorithm will set scale_factor=800/832=0.96153… So the image gets resized even though it fits perfectly well into the backbone. Self_min_size and self_max_size which are defined during initialization of the backbone and are by default set to 8. Min_size and max_size which are the min and max dimensions of the image There are 4 parameters used here to decide about the scale_factor: ![]() _image, scale_factor=scale_factor, mode=‘bilinear’, recompute_scale_factor=True, _image = torch.nn.functional.interpolate( _if max_size * scale_factor > self_max_size: _# type: (Tensor, float, float, Optional]) → Tuple]] I work since 21 years as software dev and I think I found an issue during PyTorch Faster/Mask RCNN usage.ĭeep down in GeneralizedRCNNTransform PyTorch makes the decidion if an image needs to be resized.ĭef _resize_image_and_masks(image, self_min_size, self_max_size, target):
0 Comments
Read More
Leave a Reply. |