cuiziteng / Illumination-Adaptive-Transformer

[BMVC 2022] You Only Need 90K Parameters to Adapt Light: A Light Weight Transformer for Image Enhancement and Exposure Correction. SOTA for low light enhancement, 0.004 seconds try this for pre-processing.
Apache License 2.0
441 stars 43 forks source link

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

Open Galgaddott opened 5 months ago

Galgaddott commented 5 months ago

# 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

`