summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-02-10 19:01:08 +0100
committerJules Laplace <julescarbon@gmail.com>2020-02-10 19:01:08 +0100
commit422410e391f4ca7b339c84df2432ca7873f420f5 (patch)
treec1bd815f7671defb73223aa00312c5d412643681
parent8197048ae7b33ce27a810ed43ea188f3815c0f5b (diff)
feature loss on quadrants
-rw-r--r--cli/app/search/search_dense.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py
index 645e4bb..1065edb 100644
--- a/cli/app/search/search_dense.py
+++ b/cli/app/search/search_dense.py
@@ -188,12 +188,12 @@ def find_dense_embedding_for_images(params, opt_tag="inverse_" + timestamp(), op
height, width = hub.get_expected_image_size(feature_extractor)
img_w = IMG_SHAPE[0]
- feat_loss, img_feat_err = feature_loss(gen_img_ch, target_img_ch, None, None, height, width)
+ feat_loss, img_feat_err = feature_loss(feature_extractor, gen_img_ch, target_img_ch, None, None, height, width)
- feat_loss_a, feat_err_a = feature_loss(gen_img_ch, target_img_ch, 0, 0, height, width)
- feat_loss_b, feat_err_b = feature_loss(gen_img_ch, target_img_ch, img_w - width, 0, height, width)
- feat_loss_c, feat_err_c = feature_loss(gen_img_ch, target_img_ch, 0, img_w - width, height, width)
- feat_loss_d, feat_err_d = feature_loss(gen_img_ch, target_img_ch, img_w - width, img_w - width, height, width)
+ feat_loss_a, feat_err_a = feature_loss(feature_extractor, gen_img_ch, target_img_ch, 0, 0, height, width)
+ feat_loss_b, feat_err_b = feature_loss(feature_extractor, gen_img_ch, target_img_ch, img_w - width, 0, height, width)
+ feat_loss_c, feat_err_c = feature_loss(feature_extractor, gen_img_ch, target_img_ch, 0, img_w - width, height, width)
+ feat_loss_d, feat_err_d = feature_loss(feature_extractor, gen_img_ch, target_img_ch, img_w - width, img_w - width, height, width)
feat_loss_quad = feat_loss_a + feat_loss_b + feat_loss_c + feat_loss_d
img_feat_err_quad = feat_err_a + feat_err_b + feat_err_c + feat_err_d
@@ -400,7 +400,7 @@ def find_dense_embedding_for_images(params, opt_tag="inverse_" + timestamp(), op
out_file.close()
sess.close()
-def feature_loss(img_a, img_b, y, x, height, width):
+def feature_loss(feature_extractor, img_a, img_b, y, x, height, width):
if y is not None:
img_a = tf.image.crop_to_bounding_box(img_a, y, x, height, width)
img_b = tf.image.crop_to_bounding_box(img_b, y, x, height, width)