net.to(DEVICE) if args.p is None and args.b is None and args.k is None: dl_name = 'raw' dl = create_test_dataset(32) if args.b is not None and args.p is None: dl_name = 'bright' dl = create_brighness_test_dataset(batch_size=32, root='./', bright_level=args.b) if args.p is not None and args.b is None: dl_name = 'sat{}'.format(args.p) dl = create_saturation_test_dataset(32, root='./', saturation_level=args.p) if args.k is not None: dl_name = 'p{}'.format(args.k) print('Creating path data') dl = create_patch_test_dataset(32, './', args.k) # style #dl = create_style_test_dataset(32) dl_name = 'adv' #xz_test(dl, 1,net, DEVICE) #test_model(net, dl) #test_model_adv_genera(net, dl, DEVICE) #l1_for_without_smooth(net, dl, DEVICE) #l1_for_with_smooth(net, dl, DEVICE)
labels = np.array(labels) labels = labels.reshape(-1) np.savetxt(os.path.join(p, 'label.txt'), labels) if __name__ == '__main__': root = '../../data/benchmark/' names = [ 'val', 'style', 'sat1024', 'sat1', 'sat64', 'sat16', 'sat8', 'sat4', 'p2', 'p4', 'p8' ] dl_val = create_test_dataset(batch_size=64) dl_style = create_style_test_dataset(batch_size=64) dl_sat1024 = create_saturation_test_dataset(batch_size=64, saturation_level=1024) dl_sat02 = create_saturation_test_dataset(batch_size=64, saturation_level=1) dl_sat64 = create_saturation_test_dataset(batch_size=64, saturation_level=64) dl_sat16 = create_saturation_test_dataset(batch_size=64, saturation_level=16) dl_sat8 = create_saturation_test_dataset(batch_size=64, saturation_level=8) dl_sat4 = create_saturation_test_dataset(batch_size=64, saturation_level=4) dl_p2 = create_patch_test_dataset(64, k=2) dl_p4 = create_patch_test_dataset(64, k=4) dl_p8 = create_patch_test_dataset(64, k=8) dls = [ dl_val, dl_style, dl_sat1024, dl_sat02, dl_sat64, dl_sat16, dl_sat8, dl_sat4, dl_p2, dl_p4, dl_p8