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') tmp = var(next(iter(syn_image1))) tmp = denorm(tmp).data utils.save_image(torchvision.utils.make_grid(tmp, padding=1), output_path + 'val/test_synthetic_img.png')
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) #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, real_image_val, real_normal_val, real_lighting_val, real_shading_val, mask_val, sirfs_shading_val, sirfs_normal_val, sirfs_sh_val = dataLoading.load_SfSNet_data( sfs_net_path, validation=True, twoLevel=True) # 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 + 'images/MASK_TEST.png') tmp = next(iter(syn_image1)) utils.save_image(torchvision.utils.make_grid(tmp, padding=1), output_path + 'images/test_synthetic_img.png') tmp = var(next(iter(real_image_val))) tmp = denorm(tmp)
save_image(outShadingB[0], path + name+'_0.png') 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) #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) syn_image, syn_normal, syn_sh, syn_shading, syn_mask, syn_sirfs_shading, syn_sirfs_normal, syn_sirfs_sh, syn_image_val, syn_normal_val, syn_lighting_val, syn_shading_val, syn_mask_val, syn_sirfs_shading_val, syn_sirfs_normal_val, syn_sirfs_sh_val = dataLoading.load_SfSNet_data(synthetic_data_path, twoLevel = True) real_image, real_normal, real_sh, real_shading, real_mask, real_sirfs_shading, real_sirfs_normal, real_sirfs_sh, real_image_val, real_normal_val, real_lighting_val, real_shading_val, real_mask_val, real_sirfs_shading_val, real_sirfs_normal_val, real_sirfs_sh_val = dataLoading.load_SfSNet_data(real_data_path, validation = True, twoLevel = True) # Transforms being used # if SHOW_IMAGES: ''' syn_image_mask_test = next(iter(mask_val)) utils.save_image(torchvision.utils.make_grid(syn_image_mask_test*255, padding=1), output_path+'images/MASK_TEST.png') tmp = next(iter(syn_image1)) utils.save_image(torchvision.utils.make_grid(tmp, padding=1), output_path+'images/test_synthetic_img.png') tmp = var(next(iter(syn_image_val))) tmp = denorm(tmp) print(tmp.data.shape)
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) #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) syn_image, syn_normal, syn_sh, syn_shading, syn_mask, syn_sirfs_shading, syn_sirfs_normal, syn_sirfs_sh, syn_image_val, syn_normal_val, syn_lighting_val, syn_shading_val, syn_mask_val, syn_sirfs_shading_val, syn_sirfs_normal_val, syn_sirfs_sh_val = dataLoading.load_SfSNet_data( synthetic_data_path, twoLevel=True) #real_image, real_normal, real_sh, real_shading, real_mask, real_sirfs_shading, real_sirfs_normal, real_sirfs_sh, real_image_val, real_normal_val, real_lighting_val, real_shading_val, real_mask_val, real_sirfs_shading_val, real_sirfs_normal_val, real_sirfs_sh_val = dataLoading.load_SfSNet_data(real_data_path, validation = True, twoLevel = True) real_image, real_sirfs_normal, real_sirfs_sh, real_sirfs_shading, real_mask, real_image_val, real_sirfs_sh_val, real_sirfs_normal_val, real_sirfs_shading_val, real_mask_val = dataLoading.load_real_images_celebA( real_data_path) real_image_val, real_sirfs_normal_val, real_sirfs_sh_val, real_sirfs_shading_val, real_mask_val, _, _, _, _, _ = dataLoading.load_real_images_celebA( real_val_data_path, load_mask=True) # Transforms being used # if SHOW_IMAGES: real_image_mask_test = next(iter(real_mask_val)) utils.save_image( torchvision.utils.make_grid(real_image_mask_test * 255, padding=1), output_path + 'images/MASK_TEST.png')