#output_path = join('output', args.experiment_name, 'anongroup_reshape_10_13_' + imgfolder + '_' + str(iteration)) output_path = join('output', args.experiment_name, 'testanonymizer_' + imgfolder + '_' + str(iteration)) names = [] distances = [] iterations = [] attValues = [] distanceDelta = [] #output_path = join('output', args.experiment_name, 'sample_testing_single_tmp' + str(args.test_atts)) #output_path = join('output', args.experiment_name, 'attrib_revert_customdata_wider_handshake_2' + str(args.test_atts)) from data import Custom test_dataset = Custom(args.custom_data, args.custom_attr, args.img_size, args.attrs) #from data import CelebA #test_dataset = CelebA(args.data_path, args.attr_path, args.img_size, 'test', args.attrs) os.makedirs(output_path, exist_ok=True) test_dataloader = data.DataLoader(test_dataset, batch_size=1, num_workers=args.num_workers, shuffle=False, drop_last=False) if args.num_test is None: print('Testing images:', len(test_dataset)) else: print('Testing images:', min(len(test_dataset), args.num_test))
args.gpu = args_.gpu args.by_levels = args_.by_levels args.load_epoch = args_.load_epoch args.custom_img = args_.custom_img args.custom_data = args_.custom_data args.custom_attr = args_.custom_attr args.n_attrs = len(args.attrs) args.betas = (args.beta1, args.beta2) print(args) if args.custom_img: output_path = join('output', args.experiment_name, 'custom_testing') from data import Custom test_dataset = Custom(args.custom_data, args.custom_attr, args.img_size, 'test', args.attrs) else: output_path = join('output', args.experiment_name, 'sample_testing') if args.data == 'CelebA': from data import CelebA test_dataset = CelebA(args.data_path, args.attr_path, args.img_size, 'test', args.attrs) if args.data == 'CelebA-HQ': from data import CelebA_HQ test_dataset = CelebA_HQ(args.data_path, args.attr_path, args.image_list_path, args.img_size, 'test', args.attrs) os.makedirs(output_path, exist_ok=True) test_dataloader = data.DataLoader( test_dataset, batch_size=1, num_workers=args.num_workers, shuffle=False, drop_last=False ) if args.num_test is None: print('Testing images:', len(test_dataset))
from data import CelebA train_dataset = CelebA(args.data_path, args.attr_path, args.img_size, 'train', args.attrs) valid_dataset = CelebA(args.data_path, args.attr_path, args.img_size, 'valid', args.attrs) if args.data == 'CelebA-HQ': from data import CelebA_HQ train_dataset = CelebA_HQ(args.data_path, args.attr_path, args.image_list_path, args.img_size, 'train', args.attrs) valid_dataset = CelebA_HQ(args.data_path, args.attr_path, args.image_list_path, args.img_size, 'valid', args.attrs) if args.data == 'Custom': from data import Custom train_dataset = Custom(args.data_path, args.attr_path, args.img_size, 'train', attrs_custom_default) valid_dataset = Custom(args.data_path, args.attr_path, args.img_size, 'valid', attrs_custom_default) train_dataloader = data.DataLoader(train_dataset, batch_size=args.batch_size, num_workers=args.num_workers, shuffle=True, drop_last=True) valid_dataloader = data.DataLoader(valid_dataset, batch_size=args.n_samples, num_workers=args.num_workers, shuffle=False, drop_last=False) print('Training images:', len(train_dataset), '/', 'Validating images:', len(valid_dataset))