diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-02-14 17:42:22 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-02-14 17:42:22 +0100 |
| commit | 7130b4a16b1571a8dcc6cca55e485c55866dd56d (patch) | |
| tree | b49ce871a5cba067011aaf2b4e9d54621df9b3b1 /cli | |
| parent | 3efc333ae78dc50d005174f1fa18e56973e72c9a (diff) | |
vgg feature loss
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/app/search/search_dense.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py index 4341130..8b45f60 100644 --- a/cli/app/search/search_dense.py +++ b/cli/app/search/search_dense.py @@ -221,7 +221,7 @@ def find_dense_embedding_for_images(params, opt_tag="inverse_" + timestamp(), op else: print("Unknown feature extractor") return - variables_to_restore = slim.get_variables_to_restore() + variables_to_restore = slim.get_variables_to_restore(include=['vgg_16']) restorer = tf.train.Saver(variables_to_restore) else: print("Unknown feature extractor") @@ -581,11 +581,13 @@ def feature_loss_vgg(feature_extractor, opt_feature_layers, BATCH_SIZE, img_a, i img_b = tf.image.resize_images(img_b, [resize_height, resize_width]) global scope_index - scope_index += 1 - scope_a = 'vgg_16_{}_a'.format(scope_index) - scope_b = 'vgg_16_{}_b'.format(scope_index) - gen_fc, gen_feat_ex = nets.vgg.vgg_16(img_a, scope=scope_a) - target_fc, target_feat_ex = nets.vgg.vgg_16(img_b, scope=scope_b) + # scope_index += 1 + # 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_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') |
