diff options
Diffstat (limited to 'cli/app/search/search_dense.py')
| -rw-r--r-- | cli/app/search/search_dense.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py index 392fa70..a538d0d 100644 --- a/cli/app/search/search_dense.py +++ b/cli/app/search/search_dense.py @@ -72,15 +72,13 @@ def find_dense_embedding_for_images(params): LATENT_TAG = 'latent' if params.inv_layer == 'latent' else 'dense' BATCH_SIZE = params.batch_size SAMPLE_SIZE = params.sample_size - LOGS_DIR = os.path.join('inverses', params.tag, LATENT_TAG, 'logs') - SAMPLES_DIR = os.path.join('inverses', params.tag, LATENT_TAG, 'samples') - INVERSES_DIR = os.path.join('inverses', params.tag) - if not os.path.exists(LOGS_DIR): - os.makedirs(LOGS_DIR) - if not os.path.exists(SAMPLES_DIR): - os.makedirs(SAMPLES_DIR) - if not os.path.exists(INVERSES_DIR): - os.makedirs(INVERSES_DIR) + LOGS_DIR = os.path.join(params.path, LATENT_TAG, 'logs') + SAMPLES_DIR = os.path.join(params.path, LATENT_TAG, 'samples') + VECTOR_DIR = os.path.join(params.path, 'vectors') + + os.makedirs(LOGS_DIR, exist_ok=True) + os.makedirs(SAMPLES_DIR, exist_ok=True) + os.makedirs(VECTOR_DIR, exist_ok=True) # -------------------------- # Util functions. @@ -410,7 +408,7 @@ def find_dense_embedding_for_images(params): NUM_IMGS_TO_PROCESS = NUM_IMGS # Output file. - out_file = h5py.File(os.path.join(INVERSES_DIR, params.out_dataset), 'w') + out_file = h5py.File(params.out_dataset, 'w') out_images = out_file.create_dataset('xtrain', [NUM_IMGS_TO_PROCESS,] + IMG_SHAPE, dtype='float32') out_enc = out_file.create_dataset('encoding', [NUM_IMGS_TO_PROCESS,] + ENC_SHAPE, dtype='float32') out_lat = out_file.create_dataset('latent', [NUM_IMGS_TO_PROCESS, Z_DIM], dtype='float32') @@ -421,9 +419,6 @@ def find_dense_embedding_for_images(params): out_fns[:] = sample_fns[:NUM_IMGS_TO_PROCESS] - vector_dir = os.path.join(app_cfg.INVERSES_DIR, "vectors") - os.makedirs(vector_dir, exist_ok=True) - # Gradient descent w.r.t. generator's inputs. it = 0 out_pos = 0 |
