14c0cf773f514788aca6b935298fa186890eecc1,test.py,,,#,16

Before Change


        target = Variable(ToTensor()(target))
        if torch.cuda.is_available():
            image = image.unsqueeze(0).cuda()
            target = target.unsqueeze(0).cuda()

        out = model(image)
        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)

After Change


            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 = structural_similarity(out.data.cpu().numpy(), target.data.cpu().numpy())
        out_img = ToPILImage()(out.data)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


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


Project Name: AIRLab-POLIMI/mushroom
Commit Name: ff55647673a7279b47d1268699839b92aca3e953
Time: 2021-02-10
Author: carlo.deramo@gmail.com
File Name: mushroom_rl/algorithms/value/dqn/rainbow.py
Class Name: RainbowNetwork
Method Name: forward


Project Name: mozilla/TTS
Commit Name: c8a4c771a883774cc5195cb71f0be279f5d64013
Time: 2020-10-29
Author: erogol@hotmail.com
File Name: TTS/bin/train_wavegrad.py
Class Name:
Method Name: format_test_data