Exemple #1
0
# Helper routines
IS_CUDA = False
if torch.cuda.is_available():
    IS_CUDA = True


def var(x):
    if IS_CUDA:
        x = x.cuda()
    return Variable(x)


# End of Helper routines

# Load synthetic dataset
syn_image1, syn_image2, syn_label = dataLoading.load_synthetic_ldan_data(
    synthetic_image_dataset_path)
real_image, sirfs_normal, sirfs_SH, sirfs_shading, real_image_val, sirfs_sh_val, sirfs_normal_val, sirfs_shading_val = dataLoading.load_real_images_celebA(
    real_image_dataset_path, validation=True)
real_image_mask = dataLoading.getMask(real_image_mask, global_batch_size)

# Transforms being used
#if SHOW_IMAGES:
tmp = next(iter(syn_image1))
utils.save_image(torchvision.utils.make_grid(tmp, padding=1),
                 output_path + 'images/test_synthetic_img.png')
tmp = next(iter(real_image))
utils.save_image(torchvision.utils.make_grid(tmp, padding=1),
                 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')
Exemple #2
0
    hf.create_dataset('expected_sh', data=tfSH)
    hf.create_dataset('predicted_sh', data=fSH)
    hf.create_dataset('mask', data=to_numpy(var(mask)))
    hf.close()


def var(x):
    if IS_CUDA:
        x = x.cuda()
    return Variable(x)


# End of Helper routines

# Load synthetic dataset
syn_image1, syn_image2, syn_label = dataLoading.load_synthetic_ldan_data(
    synthetic_image_dataset_path, batch_size=global_batch_size)
#real_image, sirfs_normal, sirfs_SH, sirfs_shading, real_image_val, sirfs_sh_val, sirfs_normal_val, sirfs_shading_val = dataLoading.load_real_images_celebA(real_image_dataset_path, validation = True)
#real_image_mask = dataLoading.getMask(real_image_mask, global_batch_size)
#real_image, sirfs_normal, sirfs_SH, sirfs_shading, tNormal, real_image_mask, tSH, real_image_val, sirfs_sh_val, sirfs_normal_val, sirfs_shading_val, true_normal_val, mask_val, true_lighting_val = dataLoading.load_SfSNet_data(sfs_net_path, validation = True, twoLevel = True)

real_image, real_normal, real_sh, real_shading, mask, sirfs_shading, sirfs_normal, sirfs_sh, _, _, _, _, _, _, _, _ = dataLoading.load_SfSNet_data(
    sfs_net_path, twoLevel=True, batch_size=global_batch_size)

real_image_val, real_normal_val, real_lighting_val, real_albedo_val, mask_val, sirfs_shading_val, sirfs_normal_val, sirfs_sh_val, _, _, _, _, _, _, _, _ = dataLoading.load_SfSNet_Albedo_data(
    sfs_net_val_path, twoLevel=True, batch_size=global_batch_size)

# Transforms being used
#if SHOW_IMAGES:

real_image_mask_test = next(iter(mask_val))
#utils.save_image(torchvision.utils.make_grid(real_image_mask_test*255, padding=1), output_path+'val/MASK_TEST.png')