summaryrefslogtreecommitdiff
path: root/cli/app
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-02-14 16:29:52 +0100
committerJules Laplace <julescarbon@gmail.com>2020-02-14 16:29:52 +0100
commitc24d0b8631eebb273e57ff0c112564299a8c54bd (patch)
treef37cc96582b743265d7d447fe4384ea4dd0ef7e7 /cli/app
parent0a7725b4e1ee2d10e7fe6c99c643bd5c25b325c8 (diff)
vgg feature loss
Diffstat (limited to 'cli/app')
-rw-r--r--cli/app/search/search_dense.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py
index fba393a..e0f069f 100644
--- a/cli/app/search/search_dense.py
+++ b/cli/app/search/search_dense.py
@@ -563,7 +563,7 @@ def feature_loss_tfhub(feature_extractor, opt_feature_layers, BATCH_SIZE, img_a,
img_feat_err += tf.reduce_mean(feat_square_diff, axis=1)
return feat_loss / len(opt_feature_layers), img_feat_err / len(opt_feature_layers)
-
+scope_index = 0
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)
@@ -580,8 +580,11 @@ def feature_loss_vgg(feature_extractor, opt_feature_layers, BATCH_SIZE, img_a, i
img_a = tf.image.resize_images(img_a, [resize_height, resize_width])
img_b = tf.image.resize_images(img_b, [resize_height, resize_width])
- gen_fc, gen_feat_ex = nets.vgg.vgg_16(img_a)
- target_fc, target_feat_ex = nets.vgg.vgg_16(img_b)
+ scope_index += 1
+ gen_fc, gen_feat_ex = nets.vgg.vgg_16(img_a, scope='vgg_16_{}'.format(scope))
+
+ scope_index += 1
+ target_fc, target_feat_ex = nets.vgg.vgg_16(img_b, scope='vgg_16_{}'.format(scope))
# 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')