def evaluate(): gt_e, adv_e, nl_e = get_batch(batch_size=BATCH_SIZE, noise_levels=EVAL_NOISE_LEVELS, methods=EVAL_METHODS, data_dict=EVAL_DICT, eval_data=True) gt_t, adv_t, nl_t = get_batch(batch_size=BATCH_SIZE, noise_levels=TRAIN_NOISE_LEVELS, methods=TRAIN_METHODS, data_dict=TRAIN_DICT, eval_data=False) # noise_lvl_e = int(nl_e) / 100 # noise_lvl_t = int(nl_t) / 100 denoiser.test(groundTruth=gt_e, noisy=adv_e, writer='test') #, noise_lvl=noise_lvl_e) denoiser.test(groundTruth=gt_t, noisy=adv_t, writer='train') #, noise_lvl=noise_lvl_t)
def train(steps): for k in range(steps): gt, adv = get_batch(eval_data=False) regularizer.train(groundTruth=gt, adversarial=adv, learning_rate=LEARNING_RATE) if k % 50 == 0: evaluate() regularizer.save()
def train(steps): for k in range(steps): gt, adv = get_batch(batch_size=BATCH_SIZE, noise_levels=TRAIN_NOISE_LEVELS, methods=TRAIN_METHODS, data_dict=TRAIN_DICT) regularizer.train(groundTruth=gt, adversarial=adv, learning_rate=LEARNING_RATE) if k % 50 == 0: evaluate() regularizer.save()
def train(steps): for k in range(steps): gt, adv, nl = get_batch(batch_size=BATCH_SIZE, noise_levels=TRAIN_NOISE_LEVELS, methods=TRAIN_METHODS, data_dict=TRAIN_DICT, eval_data=False) rot_id = random.randint(0, 24) assert BATCH_SIZE == 1 gt = gt.squeeze() adv = adv.squeeze() gt = grid_rot90(gt, rot_id) adv = grid_rot90(gt, rot_id) # noise_lvl = int(nl) / 100 regularizer.train(groundTruth=gt, adversarial=adv, learning_rate=LEARNING_RATE)#, # noise_lvl=noise_lvl) if k % 50 == 0: evaluate() regularizer.save()
def evaluate(): gt, adv = get_batch(eval_data=True, noise_levels=['01', '016'], methods=['EM', 'SGD']) regularizer.test(groundTruth=gt, adversarial=adv)
def evaluate(): gt, adv, nl = get_batch(batch_size=BATCH_SIZE, noise_levels=EVAL_NOISE_LEVELS, methods=EVAL_METHODS, data_dict=EVAL_DICT, eval_data=True) # noise_lvl = int(nl) / 100 regularizer.test(groundTruth=gt, adversarial=adv)#, noise_lvl=noise_lvl)
def evaluate(): gt, adv = get_batch(batch_size=BATCH_SIZE, noise_levels=EVAL_NOISE_LEVELS, methods=EVAL_METHODS, data_dict=EVAL_DICT) regularizer.test(groundTruth=gt, adversarial=adv)