summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-02-16 10:57:32 +0100
committerJules Laplace <julescarbon@gmail.com>2020-02-16 10:57:32 +0100
commit3835bd1700a3f36d10d66ac9358b4aa4fbfeaa10 (patch)
treec7fa0763eea442f6db98e7527a0fb3f1a3fa3199 /cli
parent01a3462d164bf3d7ee01d6ad35e1a4a2df170798 (diff)
scope
Diffstat (limited to 'cli')
-rw-r--r--cli/app/search/search_dense.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py
index 10dbbe0..797f8d5 100644
--- a/cli/app/search/search_dense.py
+++ b/cli/app/search/search_dense.py
@@ -567,6 +567,7 @@ def feature_loss_tfhub(feature_extractor, opt_feature_layers, BATCH_SIZE, img_a,
return feat_loss / len(opt_feature_layers), img_feat_err / len(opt_feature_layers)
scope_index = 0
+vgg_model = tf.make_template(vgg.vgg_16)
def feature_loss_vgg(feature_extractor, opt_feature_layers, BATCH_SIZE, img_a, img_b, y, x, height, width, resize_height=None, resize_width=None):
height = int(height)
width = int(width)
@@ -585,12 +586,15 @@ def feature_loss_vgg(feature_extractor, opt_feature_layers, BATCH_SIZE, img_a, i
global scope_index
scope_index += 1
- scope_a = 'vgg_16_{}_a'.format(scope_index)
- scope_b = 'vgg_16_{}_b'.format(scope_index)
+ # scope_a = 'vgg_16_{}_a'.format(scope_index)
+ # scope_b = 'vgg_16_{}_b'.format(scope_index)
# scope_a = 'vgg_16'
# scope_b = 'vgg_16'
- gen_fc, gen_feat_ex = nets.vgg.vgg_16(img_a, scope=scope_a) #, reuse=True)
- target_fc, target_feat_ex = nets.vgg.vgg_16(img_b, scope=scope_b) #, reuse=True)
+ # gen_fc, gen_feat_ex = nets.vgg.vgg_16(img_a, scope=scope_a) #, reuse=True)
+ # target_fc, target_feat_ex = nets.vgg.vgg_16(img_b, scope=scope_b) #, reuse=True)
+ gen_fc, gen_feat_ex = vgg_model(img_a) #, reuse=True)
+ target_fc, target_feat_ex = vgg_model(img_b) #, reuse=True)
+
# gen_feat_ex = feature_extractor(dict(images=img_a), as_dict=True, signature='image_feature_vector')
# target_feat_ex = feature_extractor(dict(images=img_b), as_dict=True, signature='image_feature_vector')