1433d4c435a253e891009b08a9280bc452087db0,test.py,,,#,16

Before Change


        target = Image.open(target_path + image_name)
        target = Variable(ToTensor()(target))
        if torch.cuda.is_available():
            image = image.cuda()
            target = target.cuda()

        out = model(image.unsqueeze(0))[0]
        mse = ((target - out) ** 2).mean()
        psnr = 10 * log10(1 / mse.data.cpu().numpy())
        ssim = compare_ssim(out.data.cpu().numpy(), target.data.cpu().numpy(), multichannel=True)
        out_img = ToPILImage()(out.data)
        out_img.save(out_path + "psnr_%.4f_ssim_%.4f_" % (psnr, ssim) + image_name)

After Change


        mse = ((target - out) ** 2).mean()
        psnr = 10 * log10(1 / mse.data.cpu().numpy())
        ssim = pytorch_ssim.ssim(out, target)
        out_img = ToPILImage()(out[0].data)
        out_img.save(out_path + "psnr_%.4f_ssim_%.4f_" % (psnr, ssim) + image_name)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: leftthomas/SRGAN
Commit Name: 1433d4c435a253e891009b08a9280bc452087db0
Time: 2017-11-21
Author: leftthomas@qq.com
File Name: test.py
Class Name:
Method Name:


Project Name: dmlc/dgl
Commit Name: 117dd25204611382acc7c9f460aeeb3a023ef721
Time: 2021-02-08
Author: coin2028@hotmail.com
File Name: new-tutorial/L4_message_passing.py
Class Name:
Method Name:


Project Name: leftthomas/SRGAN
Commit Name: d6d411e49df0e130acf30d6ec21ce5c583c6a44e
Time: 2017-11-21
Author: leftthomas@qq.com
File Name: test.py
Class Name:
Method Name:


Project Name: dmlc/dgl
Commit Name: 117dd25204611382acc7c9f460aeeb3a023ef721
Time: 2021-02-08
Author: coin2028@hotmail.com
File Name: new-tutorial/L1_large_node_classification.py
Class Name:
Method Name: