コード例 #1
0
                 output_path + 'images/test_real_image.png')
tmp = next(iter(sirfs_normal))
utils.save_image(torchvision.utils.make_grid(utils.denorm(tmp), padding=1),
                 output_path + 'images/test_sirf_normal.png')
real_image_mask_test, _ = next(iter(real_image_mask))
utils.save_image(torchvision.utils.make_grid(real_image_mask_test, padding=1),
                 output_path + 'images/MASK_TEST.png')
tmp = next(iter(sirfs_shading_val))
tmp = utils.denorm(tmp)
tmp = applyMask(var(tmp).type(torch.DoubleTensor), real_image_mask_test)
tmp = tmp.data
utils.save_image(torchvision.utils.make_grid(tmp, padding=1),
                 output_path + 'images/Validation_SIRFS_SHADING.png')

# featureNet = ResNet(BasicBlock, [2, 2, 2, 2], 27)
featureNet = models.BaseSimpleFeatureNet()
lightingNet = models.LightingNet()
D = models.Discriminator()
# R = models.ResNet(models.BasicBlock, [2, 2, 2, 2], 27) #
R = models.BaseSimpleFeatureNet()

print(featureNet)
print(lightingNet)
featureNet = featureNet.cuda()
lightingNet = lightingNet.cuda()
D = D.cuda()
R = R.cuda()

dtype = torch.FloatTensor
dtype = torch.cuda.FloatTensor  ## UNCOMMENT THIS LINE IF YOU'RE ON A GPU!
# Training
コード例 #2
0
tmp = applyMask(tmp, syn_image_mask_test)
utils.save_image(torchvision.utils.make_grid(tmp.data*255, padding=1), output_path+'images/test_syn_shading.png')
'''

## TRUE SHADING

'''
tmp = next(iter(sirfs_shading_val))
tmp = utils.denorm(tmp)
tmp = applyMask(var(tmp).type(torch.DoubleTensor), syn_image_mask_test)
tmp = tmp.data
utils.save_image(torchvision.utils.make_grid(tmp, padding=1), output_path+'images/Validation_SIRFS_SHADING.png')
'''

# featureNet = ResNet(BasicBlock, [2, 2, 2, 2], 27)
featureNet = models.BaseSimpleFeatureNet()
lightingNet = models.LightingNet()
featureNet_real = models.BaseSimpleFeatureNet()
lightingNet_real = models.LightingNet()
vae = models.VAutoEncoder()

print(featureNet)
print(lightingNet)
featureNet = featureNet.cuda()
lightingNet = lightingNet.cuda()
featureNet_real = featureNet_real.cuda()
lightingNet_real = lightingNet_real.cuda()
vae = vae.cuda()

dtype = torch.FloatTensor
dtype = torch.cuda.FloatTensor ## UNCOMMENT THIS LINE IF YOU'RE ON A GPU!