Exemple #1
0
    print "loading", discriminator_sequence_filename
    with open(discriminator_sequence_filename, "r") as f:
        try:
            params = json.load(f)
        except Exception as e:
            raise Exception(
                "could not load {}".format(discriminator_sequence_filename))
else:
    config = DiscriminatorParams()
    config.weight_init_std = 0.001
    config.weight_initializer = "Normal"
    config.use_weightnorm = False
    config.nonlinearity = "elu"
    config.optimizer = "Adam"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 10
    config.weight_decay = 0
    config.use_feature_matching = False
    config.use_minibatch_discrimination = False

    discriminator = Sequential(weight_initializer=config.weight_initializer,
                               weight_init_std=config.weight_init_std)
    discriminator.add(gaussian_noise(std=0.3))
    discriminator.add(
        Convolution2D(3,
                      32,
                      ksize=4,
                      stride=2,
                      pad=1,
                      use_weightnorm=config.use_weightnorm))
Exemple #2
0
        try:
            discriminator_params = json.load(f)
        except Exception as e:
            raise Exception(
                "could not load {}".format(discriminator_sequence_filename))
else:
    config = DiscriminatorParams()
    config.a = 0
    config.b = 1
    config.c = 1
    config.weight_std = 0.001
    config.weight_initializer = "Normal"
    config.nonlinearity = "leaky_relu"
    config.optimizer = "adam"
    config.learning_rate = 0.0001
    config.momentum = 0.1
    config.gradient_clipping = 1
    config.weight_decay = 0

    discriminator = Sequential()
    discriminator.add(Linear(None, 500))
    # discriminator.add(gaussian_noise(std=0.5))
    discriminator.add(Activation(config.nonlinearity))
    # discriminator.add(BatchNormalization(500))
    discriminator.add(Linear(None, 500))
    discriminator.add(Activation(config.nonlinearity))
    # discriminator.add(BatchNormalization(500))
    discriminator.add(Linear(None, 1))

    discriminator_params = {
        "config": config.to_dict(),