Closed Shaw95 closed 3 years ago
I think that you miss the .byte()
to change dtype from float to uint. For example, print(LR_plot.max(), HR_plot.max())
says 255.0, 255
which can cause color shift of LR_plot
since float type of image has to be in range [0.0, 1.0].
LR_plot = F.interpolate(LR_tensor, scale_factor=4, mode="nearest")[0].byte().numpy().transpose(1,2,0)
will work.
Hi, in your code, you seem to use F.interpolate to upsample the LR image to match the resolution of HR in order to apply Cutblur. But have you checked the upsampled image? Cause when I do it in your way, I will get an image with server color shift, and that should not be the case in your paper.
Due to some unkown reasons, I cannot upload the images, but I can share with you my testing code.
HR = io.imread('data/DIV2K/DIV2K_train_HR/0159.png') LR = io.imread('data/DIV2K/DIV2K_train_LR_bicubic/X4/0159x4.png') HR_plot = HR[0:400, 200:600] LR_plot = LR[0:100, 50:150] LR_tensor = im2tensor(LR_plot).unsqueeze(0) LR_plot = F.interpolate(LR_tensor, scale_factor=4, mode="nearest")[0].numpy().transpose(1,2,0)
f, axarr = plt.subplots(1, 2, figsize=(10, 5)) axarr[0].imshow(LR_plot) axarr[1].imshow(HR_plot)
Hope you can try this, and tell me where I did wrong.
Thank you so much!