zejinwang / Blind2Unblind

This is an official implementation of the CVPR2022 paper "Blind2Unblind: Self-Supervised Image Denoising with Visible Blind Spots".
https://arxiv.org/abs/2203.06967
118 stars 13 forks source link

Data processing in train_b2u.py #16

Closed PyoJunCode closed 1 year ago

PyoJunCode commented 1 year ago

In train_b2u.py, train logic using DataLoader_Imagenet_val class. I think there is issue about scaling image value range.

At line 363-364

transformer = transforms.Compose([transforms.ToTensor()])
im = transformer(im)

im transformed into range [0.0, 1.0] by transforms.ToTensor().

But in train loop (line 587), img devided by 255 again.

clean = clean / 255.0

Is it intended or not?

I don't know it's related to this issue, my trained model outputs gray-scale image when using naive code.

zejinwang commented 1 year ago

Could you please print the maximum value of clean before line 587 to verify your intuition whether tranforms.ToTensor() has transformed clean into the range [0.0.1.0].

PyoJunCode commented 1 year ago

I double checked my code, I found that ToTensor() code change the range in to [0.0, 1.0] if input type is not float

That happened because I opened image with cv2.imread and deleted im = np.array(im, dtype=np.float32), so the input type was uint8.

Sorry for confusion, and thank you for fast comment. I'm gonna close this issue.