def main(config): prepare_dirs_and_logger(config) save_config(config) if config.is_train: from trainer import Trainer if config.dataset == 'line': from data_line import BatchManager elif config.dataset == 'ch': from data_ch import BatchManager elif config.dataset == 'kanji': from data_kanji import BatchManager elif config.dataset == 'baseball' or\ config.dataset == 'cat': from data_qdraw import BatchManager batch_manager = BatchManager(config) trainer = Trainer(config, batch_manager) trainer.train() else: from tester import Tester if config.dataset == 'line': from data_line import BatchManager elif config.dataset == 'ch': from data_ch import BatchManager elif config.dataset == 'kanji': from data_kanji import BatchManager elif config.dataset == 'baseball' or\ config.dataset == 'cat': from data_qdraw import BatchManager batch_manager = BatchManager(config) tester = Tester(config, batch_manager) tester.test()
def main(*args): config, unparsed = get_config() prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) trainer = Trainer(config) trained_model = "/home/exx/Documents/Hope/BEGAN-tensorflow-regressor-20170811-GED-eclipse-ptx-traffic-z3/models/GAN/GAN_2017_11_15_16_52_17/experiment_41293.ckpt" aa = np.load( '/home/exx/Documents/Hope/BEGAN-tensorflow-regressor-20170811-GED-eclipse-ptx-traffic/attack_data_new/eps150_[1101]->[1110]_FGSM_and_feat_squeeze_data.npz' ) valid_x = np.asarray(aa['FGSM_features'], 'float32') valid_y = aa['orig_target'][:, 1:] # aa = np.load( # '/home/exx/Documents/Hope/BEGAN-tensorflow-regressor-20170811-GED-eclipse-ptx-traffic/traffic_sign_dataset2.npz') # valid_x = aa['data'] # valid_y = (aa['label'][1:]).tolist()*len(aa['data']) testing_paralist = [[[0.25], [0.6], [0.7], [0.001], [7.0], [-5.0]]] for para_list in testing_paralist: para_list[2][0] = para_list[2][0] - para_list[1][0] log_err = trainer.test(np.expand_dims(valid_x, 1), valid_y, trained_model, para_list, 'eps-150', 1) print('done')
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 1) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False data_loader = get_loader(data_path, config.batch_size, config.input_scale_size, config.data_format, config.split) mask_loader = get_mask_loader(config.mask_dir, config.batch_size, config.mask_scale_size) trainer = Trainer(config, data_loader, mask_loader) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test_context_encoder()
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False trainer = Trainer(config) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test()
def main(config): prepare_dirs_and_logger(config) tf.set_random_seed(config.random_seed) train_data_loader, train_label_loader_list = get_loader( config.dataset, config.data_path, config.batch_size, 0, 'train', True) ''' if config.is_train: test_data_loader, test_label_loader_list = get_loader( config.dataset, config.data_path, config.batch_size_test, config.testset_start_index, 'test', False) else: test_data_loader, test_label_loader_list = get_loader( config.dataset, config.data_path, config.batch_size_test, 0, config.split, False) ''' test_data_loader = None test_label_loader_list = [] trainer = Trainer(config, train_data_loader, train_label_loader_list, test_data_loader, test_label_loader_list) if config.is_train: save_config(config) results = trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) #trainer.test() save_result(results, config) #results = load_result('2018_11_17_13_53_10') plot_result(results, config)
def main(config): prepare_dirs_and_logger(config) loader = get_loader(config.data_dir, config.dataset, config.batch_size) loader_3d = get_3d_loader(config.batch_size) trainer = Trainer(config, loader) save_config(config) trainer.train()
def main(config): prepare_dirs_and_logger(config) torch.manual_seed(config.random_seed) if config.num_gpu > 0: torch.cuda.manual_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size else: if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image a_data_loader, b_data_loader = get_loader( data_path, batch_size, config.input_scale_size, config.num_worker, config.skip_pix2pix_processing) trainer = Trainer(config, a_data_loader, b_data_loader) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test()
def main(config): with open("data/DF_test_data/p_pairs_test.p", 'rb') as f: pn_pairs = pickle.load(f) prepare_dirs_and_logger(config) if config.gpu > -1: os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"] = str(config.gpu) config.data_format = 'NHWC' if 1 == config.model: trainer = PG2(config) trainer.init_net() elif 11 == config.model: trainer = PG2_256(config) trainer.init_net() if config.is_train: save_config(config) trainer.train() else: # if not config.load_path: # raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test()
def main(*args): config, unparsed = get_config() prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) trainer = Trainer(config) trained_model = "/home/exx/Documents/Hope/BEGAN-tensorflow-regressor-20170811-GED-eclipse-ptx-traffic/models/GAN/GAN_2017_11_01_15_04_47/experiment_185390.ckpt" testing_dataset_path = '' testing_dataset = '/home/exx/Documents/Hope/BEGAN-tensorflow-regressor-20170811-GED-eclipse-ptx-traffic/traffic_sign_dataset2.npz' aa = np.load( './attack_data/TrafficSign_FGSM_and_CPPN_Datasets/eps150_FGSM_and_feat_squeeze_data.npz' ) valid_x = np.asarray(aa['FGSM_features'], 'float32') valid_y = aa['orig_target'] para_list = [[0.25], [0.5, 0.65, 0.8], [0.1, 0.2, 0.3], [0.001, 0.01, 0.02], [3., 5., 7.], [-3., -4., -5., -6., -7.]] para_list[1] = [para_list[1][args[1]]] para_list[2] = [para_list[2][args[2]]] para_list[3] = [para_list[3][args[0]]] log_err = trainer.valid(np.expand_dims(valid_x, 1), valid_y, trained_model, para_list, args[0] + 1)
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False config.pct = [20, 80] print('\n\nUsing thinning factor according to {}:{} ratio.\n\n'.format( config.pct[0], config.pct[1])) trainer = Trainer(config) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(_): """ The main process of train and test :param _: :return: """ prepare_dirs_and_logger(config) if not config.task.lower().startswith('binpacking'): raise Exception("[!] Task should starts with binpacking") if config.max_enc_length is None: config.max_enc_length = config.max_data_length if config.max_dec_length is None: config.max_dec_length = config.max_data_length tf.set_random_seed(config.random_seed) # A jar is used to calculate the objective function value, so start the JVM first. path = os.getcwd() jar_path = path + "/idad-solver-binpacking/idad-solver-binpacking_least_area.jar" start_jvm(jar_path) trainer = Trainer(config) save_config(config.model_dir, config) if config.is_train: trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test() tf.logging.info("Run finished.") shutdown_jvm()
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False dir_source = 'blahblahblah' data_path = config.data_dir #+ '/' + config.dataset # (root, batch_size, source_mix, classes, split_name, data_format = 'NHWC', seed = None) images_train = get_loader(data_path, config.batch_size, config.source_mix, config.data_classes) trainer = Trainer(config, images_train) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(_): prepare_dirs_and_logger(config) if not config.task.lower().startswith('tsp'): raise Exception("[!] Task should starts with TSP") if config.max_enc_length is None: config.max_enc_length = config.max_data_length if config.max_dec_length is None: config.max_dec_length = config.max_data_length rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) trainer = Trainer(config, rng) save_config(config.model_dir, config) if config.is_train: trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test() tf.logging.info("Run finished.")
def main(config, model): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) train_data_loader, train_label_loader = get_loader(config.data_path, config.batch_size, config, 'train', True) if config.is_train: test_data_loader, test_label_loader = get_loader( config.data_path, config.batch_size_test, config, 'test', False) else: test_data_loader, test_label_loader = get_loader( config.data_path, config.batch_size_test, config, config.split, False) trainer = Trainer(config, train_data_loader, train_label_loader, test_data_loader, test_label_loader, model) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(config): prepare_dirs_and_logger(config) if config.gpu>-1: os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"]=str(config.gpu) config.data_format = 'NHWC' if 1==config.model: trainer = PG2(config) trainer.init_net() elif 11==config.model: trainer = PG2_256(config) trainer.init_net() if config.is_train: save_config(config) trainer.train() else: # if not config.load_path: # raise Exception("[!] You should specify `load_path` to load a pretrained model") input_path = './hunter_test/df002.png' pose_path = './hunter_test/ultraman1.npy' x = cv2.imread(input_path) p = np.load(pose_path) #pp = p[0:18,:,:] trainer.generate_hunter(x, p)
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) load() train_data_loader, train_label_loader, train_loc_loader, train_mask_loader = get_loader( config.data_path, config.batch_size, 0, 'train', True) test_data_loader, test_label_loader, test_loc_loader, test_mask_loader = get_loader( config.data_path, config.batch_size_test, 5, 'train', True) trainer = Trainer(config, train_data_loader, train_label_loader, train_loc_loader, train_mask_loader, test_data_loader, test_label_loader, test_loc_loader, test_mask_loader) print("loaded trainer") if config.is_train: save_config(config) trainer.train() print("finished train") else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(_): prepare_dirs_and_logger(config) if not config.task.lower().startswith('tsp'): raise Exception("[!] Task should starts with TSP") if config.max_enc_length is None: config.max_enc_length = config.max_data_length if config.max_dec_length is None: config.max_dec_length = config.max_data_len rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) trainer = Trainer(config, rng) save_config(config.model_dir, config) if config.is_train: trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pre-trained model") trainer.test() tf.logging.info("Run finished.")
def main(config): # NOTE: Run this in shell first. print( 'NOTE: FIRST RUN:\n"source ~/began/BEGAN-tensorflow/tf1.1/bin/activate"' ) prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False dir_loader = 'train8020' #dir_loader = 'train6040' #dir_loader = 'train4060' #dir_loader = 'train2080' #dir_loader = 'train1090' #dir_loader = 'train0510' #dir_loader = 'trainBig0510' #dir_loader = 'train_all_1090' #dir_loader = 'train_small_5050' config.pct = [int(dir_loader[-4:][:2]), int(dir_loader[-4:][2:])] dir_target = 'train5050' data_loader = get_loader(data_path, config.batch_size, config.scale_size, config.data_format, config.split, target=dir_loader) data_loader_target = get_loader(data_path, config.batch_size, config.scale_size, config.data_format, config.split, target=dir_target) trainer = Trainer(config, data_loader, data_loader_target) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(config): prepare_dirs_and_logger(config) torch.manual_seed(config.random_seed) if len(config.gpu_ids) > 0: torch.cuda.manual_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False if config.src_names is not None: config.src_names = config.src_names.split(",") if config.load_attributes is not None: config.load_attributes = config.load_attributes.split(",") if config.filter_by_pop is not None: fn_filter = lambda fnames: fn_filter_contains( fnames, any_of=config.filter_by_pop) else: fn_filter = None normalize = config.normalize if not config.normalize_channels else normalize_channels data_loader = get_loader(data_path, config.split, batch_size, config.input_scale_size, num_workers=config.num_worker, shuffle=do_shuffle, load_attributes=config.load_attributes, flips=config.flips, rotate_angle=config.rotate_angle, take_log=config.take_log, normalize=normalize, use_channels=config.use_channels, fn_filter=fn_filter) trainer = Trainer(config, data_loader) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(config): # NOTE: Run this in shell first. #if tf.__version__[:3] != '1.1': # sys.exit('***NOTE!***: FIRST RUN:\n"source ~/began/BEGAN-tensorflow/tf1.1/bin/activate"') # NOTE: Other setup requirements. print('\nREQUIREMENTS:\n 1. The file "user_weights.npy" should ' 'contain the user-provided labels for images in /user_images.\n') #print('Press "c" to continue.\n\n') #pdb.set_trace() prepare_dirs_and_logger(config) # Alert if config.log_dir already contains files. if len(os.listdir(config.log_dir)) > 0: print('log_dir contains files, continue? (c)') pdb.set_trace() rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False data_loader = get_loader(data_path, config.batch_size, config.scale_size, config.data_format, split_name='train', grayscale=config.grayscale) images_user, images_user_weights = load_user(config.dataset, data_path, config.scale_size, config.data_format, grayscale=config.grayscale) trainer = Trainer(config, data_loader, images_user, images_user_weights) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(config): # NOTE: Run this in shell first. if np.float(tf.__version__[:3]) < 1.7: sys.exit('***NOTE!***: FIRST RUN:\n"source ~/virtualenvironment/tf1.7/bin/activate"') prepare_dirs_and_logger(config) # Alert if config.log_dir already contains files. if not config.load_existing: if len(os.listdir(config.log_dir)) > 1: print(('log dir ({}) contains files besides checkpoints dir, ' 'continue? (c)').format(config.log_dir)) pdb.set_trace() rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False if config.dataset == 'mnist': #directory_to_load = '7s_train' #directory_to_load = '8s_train' directory_to_load = '1to9_train' elif config.dataset == 'birds': directory_to_load = 'images_preprocessed' elif config.dataset == 'celeba': directory_to_load = 'train' inputs = get_loader( data_path, config.batch_size, config.scale_size, config.data_format, split_name=directory_to_load, ) trainer = Trainer(config, inputs) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test()
def main(_): prepare_dirs_and_logger(config) if not config.task.lower().startswith('tsp'): raise Exception("[!] Task should starts with TSP") if config.max_enc_length is None: config.max_enc_length = config.max_data_length if config.max_dec_length is None: config.max_dec_length = config.max_data_length rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) model = Model(config) batch_size = config.batch_size train_enc_seq, train_target_seq, train_enc_seq_length, train_target_seq_length = gen_data('data/tsp10.txt') eval_enc_seq,eval_target_seq,eval_enc_seq_length,eval_target_seq_length = train_enc_seq[-batch_size:], \ train_target_seq[-batch_size:], \ train_enc_seq_length[-batch_size:], \ train_target_seq_length[-batch_size:] train_enc_seq, train_target_seq, train_enc_seq_length, train_target_seq_length= train_enc_seq[: -batch_size], \ train_target_seq[:-batch_size], \ train_enc_seq_length[:-batch_size], \ train_target_seq_length[:-batch_size] test_enc_seq, test_target_seq, test_enc_seq_length, test_target_seq_length = gen_data('data/tsp10_test.txt') with tf.Session() as sess: sess.run(tf.global_variables_initializer()) for step in range(min(config.max_step,len(train_enc_seq)//batch_size)): train_batch={ 'enc_seq': train_enc_seq[step * batch_size:(step + 1) * batch_size], 'enc_seq_length': train_enc_seq_length[step * batch_size:(step + 1) * batch_size], 'target_seq': train_target_seq[step * batch_size:(step + 1) * batch_size], 'target_seq_length': train_target_seq_length[step * batch_size:(step + 1) * batch_size] } loss = model.train(sess,train_batch) print(str(step) + " train loss : " + str(loss)) if step > 0 and step % config.eval_step == 0: eval_batch = { 'enc_seq': eval_enc_seq, 'enc_seq_length': eval_enc_seq_length, 'target_seq': eval_target_seq, 'target_seq_length': eval_target_seq_length } eval_loss = model.eval(sess,eval_batch) print(str(step) + " eval loss : " + str(eval_loss))
def get_trainer(): print('tf: resetting default graph!') tf.reset_default_graph()#for repeated calls in ipython ####GET CONFIGURATION#### #TODO:load configurations from previous model when loading previous model ##if load_path: #load config files from dir #except if pt_load_path, get cc_config from before #overwrite is_train, is_pretrain with current args--sort of a mess ##else: config,_=get_config() cc_config,_=get_cc_config() dcgan_config,_=get_dcgan_config() began_config,_=get_began_config() ###SEEDS### np.random.seed(config.seed) #tf.set_random_seed(config.seed) # Not working right now. prepare_dirs_and_logger(config) if not config.load_path: print('saving config because load path not given') save_configs(config,cc_config,dcgan_config,began_config) #Resolve model differences and batch_size if config.model_type: if config.model_type=='dcgan': config.batch_size=dcgan_config.batch_size cc_config.batch_size=dcgan_config.batch_size # make sure the batch size of cc is the same as the image model config.Model=CausalGAN.CausalGAN model_config=dcgan_config if config.model_type=='began': config.batch_size=began_config.batch_size cc_config.batch_size=began_config.batch_size # make sure the batch size of cc is the same as the image model config.Model=CausalBEGAN.CausalBEGAN model_config=began_config else:#no image model model_config=None config.batch_size=cc_config.batch_size if began_config.is_train or dcgan_config.is_train: raise ValueError('need to specify model_type for is_train=True') #Interpret causal_model keyword cc_config.graph=get_causal_graph(config.causal_model) #Builds and loads specified models: trainer=Trainer(config,cc_config,model_config) return trainer
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path #print('\n data_path ',data_path,'\n') else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False data_path_real = './img_real/' data_path_gen = './img_gen/' data_loader = get_loader(data_path, config.batch_size, config.input_scale_size, config.data_format, config.split) data_loader_real = get_loader( # change paths ! data_path_real, config.batch_size, config.input_scale_size, config.data_format, config.split) data_loader_gen = get_loader( # change paths ! data_path_gen, config.batch_size, config.input_scale_size, config.data_format, config.split) trainer = Trainer(config, data_loader, data_loader_real, data_loader_gen) if config.is_train: save_config(config) trainer.train() return None else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test() img_real = imread(config.img_real) img_gen = imread(config.img_gen) d_loss = trainer.d_loss_out(img_real, img_gen) print("d_loss : ", d_loss) return d_loss
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) loader = get_loader(config.data_dir, config.batch_size) trainer = Trainer(config, loader) if config.is_train: save_config(config) trainer.train() else: trainer = Trainer(config, loader) if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(config): prepare_dirs_and_logger(config) #pdb.set_trace() torch.manual_seed(config.random_seed) if config.num_gpu > 0: torch.cuda.manual_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size else: if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image data_path = './NUS-WIDE/' data_loader = get_loader(data_path, batch_size, config.input_scale_size, config.num_worker, ifshuffle=True, TEST=False, FEA=True) test_data_loader = get_loader(data_path, batch_size, config.input_scale_size, config.num_worker, ifshuffle=False, TEST=True, FEA=True) torch.cuda.set_device(5) trainer = Trainer(config, data_loader, test_data_loader) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception( "[!] You should specify `load_path` to load a pretrained model" ) trainer.test()
def main(config): prepare_dirs_and_logger(config) batch_manager = BatchManager(config) preprocess_path('data/qdraw/baseball/train/4503641325043712.svg', 128, 128, batch_manager.rng) preprocess_overlap('data/qdraw/baseball/train/4503641325043712.svg', 128, 128, batch_manager.rng) # thread test sess_config = tf.ConfigProto() sess_config.gpu_options.allow_growth = True sess_config.allow_soft_placement = True sess_config.log_device_placement = False sess = tf.Session(config=sess_config) batch_manager.start_thread(sess) x, y = batch_manager.batch() if config.data_format == 'NCHW': x = nhwc_to_nchw(x) x_, y_ = sess.run([x, y]) batch_manager.stop_thread() if config.data_format == 'NCHW': x_ = x_.transpose([0, 2, 3, 1]) if config.archi == 'path': b_ch = np.zeros([config.batch_size, config.height, config.width, 1]) x_ = np.concatenate((x_ * 255, b_ch), axis=-1) else: x_ = x_ * 255 y_ = y_ * 255 save_image(x_, '{}/x_fixed.png'.format(config.model_dir)) save_image(y_, '{}/y_fixed.png'.format(config.model_dir)) # random pick from parameter space x_samples, x_gt, y_gt, sample_list = batch_manager.random_list(8) save_image(x_gt, '{}/x_gt.png'.format(config.model_dir)) save_image(y_gt, '{}/y_gt.png'.format(config.model_dir)) with open('{}/sample_list.txt'.format(config.model_dir), 'w') as f: for sample in sample_list: f.write(sample + '\n') print('batch manager test done')
def written2all(written): print(written) STANDARD_L = [0, '', '', '', 'B204', 'BD90', '', '', '', ''] TARGETS = [0, '', '', '', 'D1A0', 'D3F0', '', '', '', ''] output = {} for code, path in written.items(): config, _ = get_config() config.data_path = path config.dataset = hex(int(code)).split('x')[1].upper() config.sample_per_image = 1 uniclass = UnicodeToKoreanClass(code) # pth 없으면 넘김 if STANDARD_L[uniclass] == '': continue print('./pths/%s' % (STANDARD_L[uniclass])) config.load_path = './pths/%s' % (STANDARD_L[uniclass]) target = TARGETS[uniclass] name_pth = '%s_%s' % (STANDARD_L[uniclass], target) prepare_dirs_and_logger(config) torch.manual_seed(config.random_seed) if config.num_gpu > 0: torch.cuda.manual_seed(config.random_seed) data_path = config.data_path batch_size = config.sample_per_image a_data_loader = get_loader_a(data_path, batch_size, config.input_scale_size, config.num_worker, config.skip_pix2pix_processing) tester = Tester(config, a_data_loader, name_pth) img_AB = tester.test() dir = './output' if not os.path.exists(dir): os.makedirs(dir) vutils.save_image(img_AB, './output/{}.png'.format(code)) with open('./output/{}.png'.format(code), "rb") as image_file: b64Image = base64.b64encode(image_file.read()).decode('utf-8') output[code] = b64Image return output
def main(config): prepare_dirs_and_logger(config) batch_manager = BatchManager(config) preprocess_path('data/kanji/train/0f9a8.svg_pre', 64, 64, batch_manager.rng) preprocess_overlap('data/kanji/train/0f9a8.svg_pre', 64, 64, batch_manager.rng) # thread test sess_config = tf.ConfigProto() sess_config.gpu_options.allow_growth = True sess_config.allow_soft_placement = True sess_config.log_device_placement = False sess = tf.Session(config=sess_config) batch_manager.start_thread(sess) x, y = batch_manager.batch() if config.data_format == 'NCHW': x = nhwc_to_nchw(x) x_, y_ = sess.run([x, y]) batch_manager.stop_thread() if config.data_format == 'NCHW': x_ = x_.transpose([0, 2, 3, 1]) if config.archi == 'path': b_ch = np.zeros([config.batch_size,config.height,config.width,1]) x_ = np.concatenate((x_*255, b_ch), axis=-1) else: x_ = x_*255 y_ = y_*255 save_image(x_, '{}/x_fixed.png'.format(config.model_dir)) save_image(y_, '{}/y_fixed.png'.format(config.model_dir)) # random pick from parameter space x_samples, x_gt, y_gt, sample_list = batch_manager.random_list(8) save_image(x_gt, '{}/x_gt.png'.format(config.model_dir)) save_image(y_gt, '{}/y_gt.png'.format(config.model_dir)) with open('{}/sample_list.txt'.format(config.model_dir), 'w') as f: for sample in sample_list: f.write(sample+'\n') print('batch manager test done')
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: setattr(config, 'batch_size', 64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False config.pct = [20, 80] print('\n\nUsing thinning factor according to {}:{} ratio.\n\n'.format( config.pct[0], config.pct[1])) data_loader_user = get_loader( data_path, config.batch_size, config.scale_size, config.data_format, split_name=config.split, target='user', n=500) data_loader_train = get_loader( data_path, config.batch_size, config.scale_size, config.data_format, split_name=config.split, target='train', mix='2080') data_loader_test = get_loader( data_path, config.batch_size, config.scale_size, config.data_format, split_name=config.split, target='test') trainer = Trainer(config, data_loader_user, data_loader_train, data_loader_test) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test()
def main(config): prepare_dirs_and_logger(config) if config.gpu > -1: os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"] = str(config.gpu) config.data_format = 'NHWC' if 1 == config.model: ################### original model_idx=223 Works Best ##################### trainer = PG2(config) trainer.init_net() elif 11 == config.model: ################### original model_idx=10208 ##################### trainer = PG2_256(config) trainer.init_net() if config.is_train: save_config(config) trainer.train() else: # if not config.load_path: # raise Exception("[!] You should specify `load_path` to load a pretrained model") trainer.test()
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle=True else: setattr(config,'batch_size',64) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle=False if config.dataset == 'mnist' : mnist = tf.keras.datasets.mnist (x_train,y_train),(x_test,y_test) = mnist.load_data() data_loader = batch_generator(x_train, config.batch_size, config.data_format) elif config.dataset == 'cifar10': cifar = tf.keras.datasets.cifar10 (x_train,y_train),(x_test,y_test) = cifar.load_data() data_loader = batch_generator(x_train, config.batch_size, config.data_format) else: data_loader = get_loader( data_path, config.batch_size,config.scale_size, config.data_format) trainer = Trainer(config,data_loader) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception("[!] You should specify load_path to load a pretrained model") trainer.test()
def main(config): """ config参数:Namespace(D_arch='DCGAN', batch_size=1, beta1=0.5, beta2=0.999, ckpt_path=None, conv_hidden_num=128, d_lr=2e-05, data_dir='data', data_format='NCHW', dataset='DF_train_data', g_lr=2e-05, gamma=0.5, gpu=0, grayscale=False, img_H=256, img_W=256, is_train=True, lambda_k=0.001, load_path='', log_dir='logs', log_level='INFO', log_step=200, lr_update_step=50000, max_step=80, model=11, model_dir='path_to_directory_of_model', num_log_samples=3, num_worker=4, optimizer='adam', pretrained_path=None, random_seed=123, sample_per_image=64, save_model_secs=1000, split='train', start_step=0, test_data_path=None, test_one_by_one=False, use_gpu=True, z_num=2) """ prepare_dirs_and_logger(config) if config.gpu > -1: os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"] = str(config.gpu) config.data_format = 'NHWC' trainer = None if 1 == config.model: print("使用PG2(),即Market-1501 数据库,并初始化") trainer = PG2(config) trainer.init_net() elif 11 == config.model: print("使用PG2_256(),即DeepFashion数据库,并初始化") trainer = PG2_256(config) trainer.init_net() if config.is_train: print("开始训练") save_config(config) # 存储参数到json文件 trainer.train() # 开始训练 else: print("开始测试") if not config.load_path: raise Exception("[!] 没有指定 `load_path` 用于读取预训练的模型") trainer.test()
def main(config): prepare_dirs_and_logger(config) rng = np.random.RandomState(config.random_seed) tf.set_random_seed(config.random_seed) if config.is_train: data_path = config.data_path batch_size = config.batch_size do_shuffle = True else: #setattr(config, 'batch_size', 1) if config.test_data_path is None: data_path = config.data_path else: data_path = config.test_data_path batch_size = config.sample_per_image do_shuffle = False print(data_path) data_loader = get_loader( data_path, config.batch_size, config.input_scale_size, config.data_format, config.split) trainer = Trainer(config, data_loader) if config.is_train: save_config(config) trainer.train() else: if not config.load_path: raise Exception("[!] You should specify `load_path` to load a pretrained model") imagestring0="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAEAANsDASIAAhEBAxEB/8QAHgABAAIBBQEBAAAAAAAAAAAAAAgJBwECBAUGAwr/xABFEAABAwMCBAMECAIIAwkAAAABAAIDBAURBhIHCCExQVFhCROBkRQVIjJxobHBI1IXM0JicoKy0RYkohg0RXODkqPC8P/EABoBAQACAwEAAAAAAAAAAAAAAAAFBgIDBAH/xAAqEQEAAgEDBAAFBQEBAAAAAAAAAQIDBAUREiExQRMiJVFSBhRxgbFiwf/aAAwDAQACEQMRAD8AtTREQEREBERAREQEREBEW0uABJQNzCMhwwPFdXUai09R1jLdVXqhgqpfuQSVDGyP/BpOSo587nNG7gBoyG16Zqo/+LL+x7KIP6/RoR0dOR5jqG+vXrhVJXLW+q7/AHmTUVfqa7Vt4mlD21G975XSE9XdyfzA9AtV8sU8t+LTTl7w/QTFLHJh0bg4eYK+oOVTtyv853EXhLquns+s77U3LTz6gU9wo6qVxlja4ge9j3ElpGc4HQq3exXi23q1Ul2tVUypo6+JtTTzRu3NkjeAWuBHTrnK9pki/hhkxThniXZotA4O7LVbGsREQEREBERAREQEREBERAREQEREBERAREQF835DT0z0W8HK8Vxj1mNA8MNU6wLgw2i1VFS13k5rDj/qIXkzERy9iOZ4U/8APRxNdxI5kNW1UFZ7yhs9VHYqENduaI4Bskc3/FJ7wn4LK3KJoawSaU+sa20QVEs0hcZXQhxAB6DJHQKDd1ulXeL3PcaiQmaomkq5HP6lziepPqVLjg1wyvVj09Sa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5TmYe889pXAeyvvFq/ojvelaZjRV0VbDXTuB+82aMhufw9yfmput8VWD7Iutr36115TNdIaJtopXEOPZwncGZA6A4L/krPmEFvTzI/NP5eNyIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgLZK0ujc1pwSO/kt6IID833s34uJtTcNfcHK+Cg1BcJHT11pq3BtNWPd958Tz/AFcnjh32SfEL1vLzyB6Z0ny6XPhDxgoqG912p6g3G5GN24UVSGBkZp5MZa9jQDvHdxPgpkuYHdwPRGtDewA/BBHTlC5QqLlVotT08OqPr+a/VUPuqh1IIHxUkLXCKJw3ODnZe4lwwCfAKRbAQ3BGFuRAREQEREBERAREQEREBERB/9k=" ###string1=base64.encodestring(imagestring0) imagestring1=imagestring0 #trainer.test2(imagestring0,imagestring1) trainer.test3( imagestring0, 128, 40)