A_DIR = '/hdd/cs599/spectro/testA/*' B_DIR = '/hdd/cs599/spectro/testB/*' RESULT_A_DIR = '/hdd/cs599/spectro/results/resultA/' RESULT_B_DIR = '/hdd/cs599/spectro/results/resultB/' if not os.path.exists(RESULT_A_DIR): os.makedirs(RESULT_A_DIR) if not os.path.exists(RESULT_B_DIR): os.makedirs(RESULT_B_DIR) # Remove files in the output for removeFile in chain(glob.glob(RESULT_A_DIR + '*'), glob.glob(RESULT_B_DIR + '*')): os.remove(removeFile) #############################################3 # Define Network ############################################# f_a, a = dataset.get_image_batch(A_DIR, BATCH_SIZE, train=False) f_b, b = dataset.get_image_batch(B_DIR, BATCH_SIZE, train=False) with tf.variable_scope('gen_a_to_b') as a_to_b_scope: b_gen = build_enc_dec(a) with tf.variable_scope('gen_b_to_a') as b_to_a_scope: a_gen = build_enc_dec(b) with tf.variable_scope('gen_b_to_a', reuse=True): a_identity = build_enc_dec(b_gen, True) with tf.variable_scope('gen_a_to_b', reuse=True): b_identity = build_enc_dec(a_gen, True) ################################# # Miscellaneous(summary, init, etc.) #################################
LAMBDA = 10 LAMBDA_CYCLE = 10 BATCH_SIZE = 8 MAX_ITERATION = 1000000 SAVE_PERIOD = 10000 SUMMARY_PERIOD = 50 NUM_CRITIC_TRAIN = 4 #############################################3 # Define Network #############################################3 _, a = dataset.get_image_batch(A_DIR, BATCH_SIZE) _, b = dataset.get_image_batch(B_DIR, BATCH_SIZE) with tf.variable_scope('gen_a_to_b') as a_to_b_scope: b_gen = build_enc_dec(a) with tf.variable_scope('gen_b_to_a') as b_to_a_scope: a_gen = build_enc_dec(b) with tf.variable_scope('gen_b_to_a', reuse=True): a_identity = build_enc_dec(b_gen, True) with tf.variable_scope('gen_a_to_b', reuse=True): b_identity = build_enc_dec(a_gen, True) with tf.variable_scope('c_a') as scope: alpha = tf.random_uniform(shape=[BATCH_SIZE, 1, 1, 1], minval=0.,
BATCH_SIZE = 1 A_DIR = '/hdd/cs599/spectro/testA/*' B_DIR = '/hdd/cs599/spectro/testB/*' RESULT_A_DIR = '/hdd/cs599/spectro/results/resultA/' RESULT_B_DIR = '/hdd/cs599/spectro/results/resultB/' if not os.path.exists(RESULT_A_DIR): os.makedirs(RESULT_A_DIR) if not os.path.exists(RESULT_B_DIR): os.makedirs(RESULT_B_DIR) # Remove files in the output for removeFile in chain(glob.glob(RESULT_A_DIR + '*'), glob.glob(RESULT_B_DIR + '*')): os.remove(removeFile) #############################################3 # Define Network ############################################# f_a, a = dataset.get_image_batch(A_DIR, BATCH_SIZE, train=False) f_b, b = dataset.get_image_batch(B_DIR, BATCH_SIZE, train=False) with tf.variable_scope('gen_a_to_b') as a_to_b_scope : b_gen = build_enc_dec(a) with tf.variable_scope('gen_b_to_a') as b_to_a_scope : a_gen = build_enc_dec(b) with tf.variable_scope('gen_b_to_a',reuse=True) : a_identity = build_enc_dec(b_gen,True) with tf.variable_scope('gen_a_to_b',reuse=True) : b_identity = build_enc_dec(a_gen,True) ################################# # Miscellaneous(summary, init, etc.) #################################
LAMBDA = 10 LAMBDA_CYCLE = 10 BATCH_SIZE = 8 MAX_ITERATION = 1000000 SAVE_PERIOD = 10000 SUMMARY_PERIOD = 50 NUM_CRITIC_TRAIN = 4 #############################################3 # Define Network #############################################3 _, a = dataset.get_image_batch(A_DIR, BATCH_SIZE) _, b = dataset.get_image_batch(B_DIR, BATCH_SIZE) with tf.variable_scope('gen_a_to_b') as a_to_b_scope : b_gen = build_enc_dec(a) with tf.variable_scope('gen_b_to_a') as b_to_a_scope : a_gen = build_enc_dec(b) with tf.variable_scope('gen_b_to_a',reuse=True) : a_identity = build_enc_dec(b_gen,True) with tf.variable_scope('gen_a_to_b',reuse=True) : b_identity = build_enc_dec(a_gen,True) with tf.variable_scope('c_a') as scope: alpha = tf.random_uniform(shape=[BATCH_SIZE,1,1,1], minval=0.,maxval=1.) a_hat = alpha * a + (1.0 - alpha) * a_gen