mlverse / torchvision

R interface to torchvision
https://torchvision.mlverse.org
Other
62 stars 15 forks source link

Dimension Mismatch regarding Image_size #79

Open MOOnLyer opened 2 years ago

MOOnLyer commented 2 years ago

I am using the latest version of torchvision. And I find the function transform_center_crop and transform_random_resized_crop are not working as expected (i.e., wrong output size or Input and output sizes should be greater than 0 error).

After a little digging, it seems that the problem is related to the issue #45 #44. The fix #46 back then, size <- get_image_size(img) image_width <- size[2] image_height <- size[1] is corresponding to an earlier version of get_image_size (without rev), where it has been changed in commit. In this case, I would recommend a simple fix - fallback wrt fix #46 in commit to comply with function get_image_size.magick-image (i.e., 1 - width, 2 - height).

cregouby commented 1 month ago

Hello @MOOnLyer,

Could you create a pull-request here from your patch ?

Thanks !