zzr-idam / 4KDehazing

77 stars 15 forks source link

Could you put the eval code for calculating psnr or other metrics? #2

Open gezhaoDL opened 2 years ago

zzr-idam commented 2 years ago

We used the evaluation code provided by kornia.

gezhaoDL commented 2 years ago

We used the evaluation code provided by kornia.

`device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") tfs_full = transforms.Compose([ transforms.ToTensor() ]) image_in = Image.open('0_0000014.jpg').convert('RGB') full = tfs_full(image_in).unsqueeze(0).to(device) print(full.shape)

expected = Image.open('0_0000018.jpg').convert('RGB') expected_full = tfs_full(expected).unsqueeze(0).to(device) print(expected_full.shape)

psnr = kornia.losses.psnr(full, expected_full, 1) print('psnr =', psnr)

ssim = kornia.losses.ssim(full, expected_full, 5) print('mssim =', torch.mean(ssim))`

is this right?

zzr-idam commented 2 years ago

psnr is right, but the ssim is 4 or 5.     ------------------ Original ------------------ From: @.>; Date:  Wed, Sep 29, 2021 03:46 PM To: @.>; Cc: @.>; @.>; Subject:  Re: [zzr-idam/4KDehazing] Could you put the eval code for calculating psnr or other metrics? (#2)

 

We used the evaluation code provided by kornia.

`device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") tfs_full = transforms.Compose([ transforms.ToTensor() ]) image_in = Image.open('0_0000014.jpg').convert('RGB') full = tfs_full(image_in).unsqueeze(0).to(device) print(full.shape)

expected = Image.open('0_0000018.jpg').convert('RGB') expected_full = tfs_full(expected).unsqueeze(0).to(device) print(expected_full.shape)

psnr = kornia.losses.psnr(full, expected_full, 1) print('psnr =', psnr)

ssim = kornia.losses.ssim(full, expected_full, 5) print('mssim =', torch.mean(ssim))`

is this right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.