From 176af09d1aa3caeecd454a8fe9754e5cb5dc75ff Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 25 Jan 2020 18:30:39 +0100 Subject: adjust --- cli/app/commands/biggan/extract_dense_vectors.py | 4 ++-- cli/app/search/json.py | 4 ++-- cli/app/search/search_class.py | 8 ++++---- cli/app/search/search_dense.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'cli/app') diff --git a/cli/app/commands/biggan/extract_dense_vectors.py b/cli/app/commands/biggan/extract_dense_vectors.py index e8f0587..eb811d5 100644 --- a/cli/app/commands/biggan/extract_dense_vectors.py +++ b/cli/app/commands/biggan/extract_dense_vectors.py @@ -1,4 +1,4 @@ -import click +2import click import os from app.utils.cortex_utils import cortex_folder, download_cortex_files, find_unprocessed_files @@ -24,7 +24,7 @@ from app.search.params import timestamp help='Normalize labels every N steps') @click.option('-feat', '--use_feature_detector', 'opt_use_feature_detector', is_flag=True, help='Compute feature loss') -@click.option('-ll', '--feature_layers', 'opt_feature_layers', default="1a,2a,3a,4a,7a", +@click.option('-ll', '--feature_layers', 'opt_feature_layers', default="1a,4a,7a", help='Feature layers used for loss') @click.option('-snap', '--snapshot_interval', 'opt_snapshot_interval', default=20, help='Interval to store sample images') diff --git a/cli/app/search/json.py b/cli/app/search/json.py index c4c0903..7873c23 100644 --- a/cli/app/search/json.py +++ b/cli/app/search/json.py @@ -68,7 +68,7 @@ def make_params_dense(tag, folder_id): "dataset": os.path.join(app_cfg.DIR_INVERSES, tag, "dataset.latent.hdf5"), "inv_layer": "Generator_2/G_Z/Reshape:0", "decay_lr": True, - "inv_it": 20000, + "inv_it": 10000, "generator_path": "https://tfhub.dev/deepmind/biggan-512/2", "attention_map_layer": "Generator_2/attention/Softmax:0", "pre_trained_latent": True, @@ -91,7 +91,7 @@ def make_params_dense(tag, folder_id): "feature_extractor_output": "InceptionV3/Mixed_7a", "init_lo": -0.001, "lambda_dist": 10.0, - "lambda_feat": 2.0, + "lambda_feat": 1.0, "lambda_mse": 1.0, "lambda_reg": 0.1, "dist_loss": False, diff --git a/cli/app/search/search_class.py b/cli/app/search/search_class.py index a98d7e3..371316e 100644 --- a/cli/app/search/search_class.py +++ b/cli/app/search/search_class.py @@ -200,12 +200,12 @@ def find_nearest_vector(sess, generator, opt_fp_in, opt_dims, out_images, out_la if i % 20 == 0: print('iter: {}, loss: {}'.format(i, curr_loss)) if i > 0: - if opt_stochastic_clipping and (i % opt_clip_interval) == 0 and i < opt_steps * 0.75: - sess.run(clip_latent, { clipped_alpha: (i / opt_steps) }) + if opt_stochastic_clipping and (i % opt_clip_interval) == 0: # and i < opt_steps * 0.75: + sess.run(clip_latent, { clipped_alpha: 0.0 }) sess.run(reinit_optimizer_z) - if opt_label_clipping and (i % opt_clip_interval) == 0 and i < opt_steps * 0.75: + if opt_label_clipping and (i % opt_clip_interval) == 0: # and i < opt_steps * 0.75: # sess.run(clip_labels, { normalized_alpha: (i / opt_steps) ** 2 }) - sess.run(clip_labels, { normalized_alpha: (i / opt_steps) }) + sess.run(clip_labels, { normalized_alpha: 0.0 }) sess.run(reinit_optimizer_y) if opt_video and opt_snapshot_interval != 0 and (i % opt_snapshot_interval) == 0: phi_guess = sess.run(output) diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py index 149b8f6..36fc230 100644 --- a/cli/app/search/search_dense.py +++ b/cli/app/search/search_dense.py @@ -299,7 +299,7 @@ def find_dense_embedding_for_images(params, opt_tag="inverse_" + timestamp(), op # -------------------------- if params.decay_lr: lrate = tf.train.exponential_decay(params.lr, inv_step, - params.inv_it / params.decay_n, 0.1) #, staircase=True) + params.inv_it / params.decay_n, 0.1, staircase=True) else: lrate = tf.constant(params.lr) # trained_params = [label, latent, encoding] -- cgit v1.2.3-70-g09d2