summaryrefslogtreecommitdiff
path: root/cli/app/search/search_dense.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/app/search/search_dense.py')
-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')