I’m still a bit confused about the difference between torchvision.transforms.Resize and torch.functional.interpolate for masks (assuming masks have uint8 format and contains only integers, obviosuly).
The problem is, I kept getting suspicious results using Mask R-CNN:
mask = np.array(PILImage.open(mask_name).resize(self.img_size, resample=PILImage.NEAREST))
It seems that transforms.Resize is identical to PIL.Image.Resize. On the other hand, functional.interpolate(mode=NEAREST, align_corners=True) uses opencv or some other solution, and in fact seems to give the correct resizing. I think so because torchvision.detection.transforms uses this method both for the image (mode=bilinear, align_corners=False) and masks (mode=nearest, align_corneres=True).
So I don’t quite understand either the difference, nor the correct use of transforms.Resize for masks, apart from the fact that transforms.Resize is applied to PIL.Image and functional.interpolate to tensors…