diff options
| -rw-r--r-- | cli/app/search/json.py | 8 | ||||
| -rw-r--r-- | inversion/image_inversion.py | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/cli/app/search/json.py b/cli/app/search/json.py index 1e470bd..0f6c71c 100644 --- a/cli/app/search/json.py +++ b/cli/app/search/json.py @@ -32,14 +32,14 @@ def save_params_latent(fp_out_dir, tag): "lambda_feat": 1.0, "init_gen_dist": False, "log_activation_layer": "Generator_2/GBlock/Relu:0", - "batch_size": 1, + "batch_size": 4, "fixed_z": False, "feature_extractor_output": "InceptionV3/Mixed_7a", "init_lo": -0.001, "lambda_mse": 1.0, "lambda_reg": 0.1, "dist_loss": False, - "sample_size": 1, + "sample_size": 4, "dataset": "inverses/{}/dataset.encodings.hdf5".format(tag), "save_progress": True, } @@ -77,14 +77,14 @@ def save_params_dense(fp_out_dir, tag): "lambda_feat": 1.0, "init_gen_dist": False, "log_activation_layer": "Generator_2/GBlock/Relu:0", - "batch_size": 1, + "batch_size": 4, "fixed_z": True, "feature_extractor_output": "InceptionV3/Mixed_7a", "init_lo": -0.001, "lambda_mse": 1.0, "lambda_reg": 0.1, "dist_loss": True, - "sample_size": 1, + "sample_size": 4, "dataset": "inverses/{}/dataset.encodings.dense.hdf5".format(tag), "save_progress": True, } diff --git a/inversion/image_inversion.py b/inversion/image_inversion.py index 76638f9..38c5261 100644 --- a/inversion/image_inversion.py +++ b/inversion/image_inversion.py @@ -321,12 +321,14 @@ if params.dataset.endswith('.hdf5'): i_1, i_2 = i*BATCH_SIZE, (i+1)*BATCH_SIZE yield sample_latents[i_1:i_2] latent_gen = sample_latent_gen() + if NUM_IMGS % BATCH_SIZE != 0: + REMAINDER = BATCH_SIZE - (NUM_IMGS % BATCH_SIZE) + sample_images = sample_images.append(sample_images[-REMAINDER]) + sample_labels = sample_labels.append(sample_labels[-REMAINDER]) assert(NUM_IMGS % BATCH_SIZE == 0) else: sys.exit('Unknown dataset {}.'.format(params.dataset)) -NUM_IMGS -= NUM_IMGS % BATCH_SIZE - # -------------------------- # Training. # -------------------------- |
