Exemple #1
0
image_height = image_width
ndim_z = 50

# specify discriminator
discriminator_sequence_filename = args.model_dir + "/discriminator.json"

if os.path.isfile(discriminator_sequence_filename):
    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))
Exemple #2
0
except:
    pass

# specify discriminator
discriminator_sequence_filename = args.model_dir + "/discriminator.json"

if os.path.isfile(discriminator_sequence_filename):
    print "loading", discriminator_sequence_filename
    with open(discriminator_sequence_filename, "r") as f:
        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.01
    config.weight_initializer = "Normal"
    config.use_weightnorm = False
    config.nonlinearity = "leaky_relu"
    config.optimizer = "adam"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 1
    config.weight_decay = 0

    discriminator = Sequential()
    discriminator.add(Linear(None, 128, use_weightnorm=config.use_weightnorm))
Exemple #3
0
image_height = image_width
ndim_latent_code = 50

# specify discriminator
discriminator_sequence_filename = args.model_dir + "/discriminator.json"

if os.path.isfile(discriminator_sequence_filename):
    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.ndim_input = image_width * image_height
    config.clamp_lower = -0.01
    config.clamp_upper = 0.01
    config.num_critic = 5
    config.weight_init_std = 0.001
    config.weight_initializer = "Normal"
    config.use_weightnorm = False
    config.nonlinearity = "leaky_relu"
    config.optimizer = "rmsprop"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 1
    config.weight_decay = 0
    config.use_feature_matching = False
    config.use_minibatch_discrimination = False
Exemple #4
0
ndim_z = 50

# specify discriminator
discriminator_sequence_filename = args.model_dir + "/discriminator.json"

if os.path.isfile(discriminator_sequence_filename):
    print "loading", discriminator_sequence_filename
    with open(discriminator_sequence_filename, "r") as f:
        try:
            params = json.load(f)
            chainer.global_config.discriminator = to_object(params["config"])
        except Exception as e:
            raise Exception(
                "could not load {}".format(discriminator_sequence_filename))
else:
    config = DiscriminatorParams()
    config.clamp_lower = -0.01
    config.clamp_upper = 0.01
    config.num_critic = 1
    config.weight_std = 0.001
    config.weight_initializer = "Normal"
    config.nonlinearity = "leaky_relu"
    config.optimizer = "rmsprop"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 10
    config.weight_decay = 0

    chainer.global_config.discriminator = config

    discriminator = Sequential()
image_height = image_width
ndim_latent_code = 50

# specify discriminator
discriminator_sequence_filename = args.model_dir + "/discriminator.json"

if os.path.isfile(discriminator_sequence_filename):
    print "loading", discriminator_sequence_filename
    with open(discriminator_sequence_filename, "r") as f:
        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.01
    config.weight_initializer = "Normal"
    config.use_weightnorm = False
    config.nonlinearity = "leaky_relu"
    config.optimizer = "adam"
    config.learning_rate = 0.0001
    config.momentum = 0.5
    config.gradient_clipping = 1
    config.weight_decay = 0

    discriminator = Sequential()
    discriminator.add(Linear(None, 500, use_weightnorm=config.use_weightnorm))