Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

train_lol_v2.py中validation函数返回值顺序错误 #70

Open
Galgaddott opened this issue Jan 16, 2024 · 0 comments
Open

train_lol_v2.py中validation函数返回值顺序错误 #70

Galgaddott opened this issue Jan 16, 2024 · 0 comments

Comments

@Galgaddott
Copy link

# Evaluation Model model.eval() PSNR_mean, SSIM_mean = validation(model, val_loader)

`def validation(model, val_loader):

ssim = SSIM()
psnr = PSNR()
ssim_list = []
psnr_list = []
for i, imgs in enumerate(val_loader):
    with torch.no_grad():
        low_img, high_img = imgs[0].cuda(), imgs[1].cuda()
        _, _, enhanced_img = model(low_img)
        # print(enhanced_img.shape)
    ssim_value = ssim(enhanced_img, high_img, as_loss=False).item()
    #ssim_value = ssim(enhanced_img, high_img).item()
    psnr_value = psnr(enhanced_img, high_img).item()
    # print('The %d image SSIM value is %d:' %(i, ssim_value))
    ssim_list.append(ssim_value)
    psnr_list.append(psnr_value)

SSIM_mean = np.mean(ssim_list)
PSNR_mean = np.mean(psnr_list)
print('The SSIM Value is:', SSIM_mean)
print('The PSNR Value is:', PSNR_mean)
return SSIM_mean, PSNR_mean

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant