示例#1
0
loss_alpha = 1  # amplitude
loss_beta = 1  # phase
# threshold is useless when normalization is None
loss_type = {'threshold': 'origin', 'normalization': None}
loss_threshold = 1

# training
mark = 'rcf-gan'
if adversarial_training_param['adv_t_sigma_num'] > 0:
    model_label = target_source + '_t_net_' + generator_training_param['net_type'] + '_' + mark
else:
    model_label = target_source + '_t_normal_' + generator_training_param['net_type'] + '_' + mark

model = Model(model_label,
              target_source, target_dim, target_size, target_batch_size,
              adversarial_training_param, generator_training_param,
              loss_type, loss_alpha, loss_beta, loss_threshold, ae_loss_reg,
              epoch)

if load >= 0:
    model.train(load)

# parameters for testing
num_white_noise_test = 100

# testing
model.test(num_white_noise_test)
model.test_rec()
model.save_for_scores()
# model.save_for_scores_per_epoc()
model.interpolated_imgs(8)
示例#2
0
        'activations_a': [('lrelu', 0.2), ('tanh', None)],
        'weight_decay': 0,
        'lr_step_size_decay': 0,
        'lr_decay_gamma': 0.5,
        # activations for the t_net, only valid when t_net = True
        'activations_t': [('lrelu', 0.2), ('tanh', None)]
    }

    if adversarial_training_param['adv_t_sigma_num'] > 0:
        model_label = target_source + '_t_net_' + generator_training_param[
            'net_type'] + '_' + args.mark
    else:
        model_label = target_source + '_t_normal_' + generator_training_param[
            'net_type'] + '_' + args.mark

    # training
    model = Model(model_label, target_source, target_dim, target_size,
                  target_batch_size, adversarial_training_param,
                  generator_training_param, loss_type, loss_alpha, loss_beta,
                  loss_threshold, ae_loss_reg, args.epochs)

    if args.resume_training >= 0:
        model.train(args.resume_training, args.save_period)

    # testing
    model.test()
    model.test_rec()
    model.save_for_scores()
    # model.save_for_scores_per_epoc()
    model.interpolated_imgs(8)