Better Pre-processing
Hi, thanks for your great work. While inspecting the image preprocessing code I notice the below image resize function, and I think by moving it to Pytorch it would be a lot faster (it appear this function would be called multiple times).
The original codeHere
def imresize_to_shape(im,output_shape,opt):
#s = im.shape
im = torch2uint8(im) # This would be time-consuming I think
im = imresize_in(im, output_shape=output_shape)
im = np2torch(im,opt)
#im = im[:, :, 0:int(scale * s[2]), 0:int(scale * s[3])]
return im
Do you think it would be better to perform interpolation in Pytorch on cuda tensors?
from torch.nn import functional as F
def imresize_to_shape(im, output_shape,opt):
return F.interpolate(im, output_shape)
I notice that you designed a fairly complex interpolation function with multiple kernels. I'm just wondering if using built-in torch interpolation method would seriously degrate the performance? Hope to hear from you. Thanks!
Hi, The built-in torch interpolation function does not perform any anti-aliasing filtering when down-sampling the image, and this is the reason for using this function. This is especially important when solving the super-resolution task. For the generation task it might degrade the performances as well, but maybe worth training (maybe additional hyper parameters adjustment will be needed). The best solution will probably be implementing a torch anti-aliasing process to add to the built-in interpolation function.
got it, thanks!
Another easy option to try is maybe downsampling with the current image resize function and then upsampling with the build in torch function.