summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-01-14 20:10:45 +0100
committerJules Laplace <julescarbon@gmail.com>2020-01-14 20:10:45 +0100
commit536dc2710d7a9449fe7e2da79d79feee62b7a828 (patch)
tree24a64318b1cbb4ebadfa5c75b6db4ec93c540cb7 /cli
parentf91ed4899d5706c7771327269e69fa9ae4a10f9f (diff)
fixes
Diffstat (limited to 'cli')
-rw-r--r--cli/app/commands/biggan/extract_dense_vectors.py3
-rw-r--r--cli/app/search/search_class.py5
-rw-r--r--cli/app/search/search_dense.py2
3 files changed, 6 insertions, 4 deletions
diff --git a/cli/app/commands/biggan/extract_dense_vectors.py b/cli/app/commands/biggan/extract_dense_vectors.py
index 40b90f9..866104d 100644
--- a/cli/app/commands/biggan/extract_dense_vectors.py
+++ b/cli/app/commands/biggan/extract_dense_vectors.py
@@ -64,7 +64,8 @@ def cli(ctx, opt_folder_id, opt_latent_steps, opt_dense_steps, opt_video, opt_re
opt_use_feature_detector=opt_use_feature_detector,
opt_feature_layers=opt_feature_layers,
opt_snapshot_interval=opt_snapshot_interval,
- opt_clip_interval=opt_clip_interval
+ opt_clip_interval=opt_clip_interval,
+ opt_folder_id=folder['id']
)
params = params_dense_dict(tag, folder_id=folder['id'])
diff --git a/cli/app/search/search_class.py b/cli/app/search/search_class.py
index 40801d6..0c3fd29 100644
--- a/cli/app/search/search_class.py
+++ b/cli/app/search/search_class.py
@@ -48,7 +48,8 @@ feature_layer_names = {
def find_nearest_vector_for_images(paths, opt_dims, opt_steps, opt_video, opt_tag,
opt_limit=-1, opt_stochastic_clipping=True, opt_label_clipping=True,
- opt_use_feature_detector=False, opt_feature_layers=[1,2,4,7], opt_snapshot_interval=20, opt_clip_interval=500):
+ opt_use_feature_detector=False, opt_feature_layers=[1,2,4,7], opt_snapshot_interval=20, opt_clip_interval=500,
+ opt_folder_id=59):
tf.reset_default_graph()
sess = tf.compat.v1.Session()
print("Initializing generator...")
@@ -57,7 +58,7 @@ def find_nearest_vector_for_images(paths, opt_dims, opt_steps, opt_video, opt_ta
fp_inverses = os.path.join(app_cfg.DIR_INVERSES, opt_tag)
os.makedirs(fp_inverses, exist_ok=True)
# save_params_latent(fp_inverses, opt_tag)
- save_params_dense(fp_inverses, opt_tag)
+ save_params_dense(fp_inverses, opt_tag, folder_id=opt_folder_id)
out_file = h5py.File(join(fp_inverses, 'dataset.latent.hdf5'), 'w')
out_images = out_file.create_dataset('xtrain', (len(paths), 3, 512, 512,), dtype='float32')
out_labels = out_file.create_dataset('ytrain', (len(paths), 1000,), dtype='float32')
diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py
index 7d3fd2a..1f08e24 100644
--- a/cli/app/search/search_dense.py
+++ b/cli/app/search/search_dense.py
@@ -227,7 +227,7 @@ def find_dense_embedding_for_images(params, opt_tag="inverse_" + timestamp(), op
# # feat_loss += tf.reduce_mean(feat_square_diff) * 0.17
# # img_feat_err += tf.reduce_mean(feat_square_diff, axis=1) * 0.17
- feat_square_diff = tf.constant(0.0)
+ feat_loss = tf.constant(0.0)
img_feat_err = tf.constant(0.0)
for layer in opt_feature_layers: