From aefeb98b872702ff24f1ae6ecf2df57bc5fb12e6 Mon Sep 17 00:00:00 2001 From: detlef Date: Mon, 23 Sep 2019 17:35:10 +0200 Subject: [PATCH] - some experiments, not successfull --- few_shot_tests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/few_shot_tests.py b/few_shot_tests.py index 203baa1..ca89b09 100755 --- a/few_shot_tests.py +++ b/few_shot_tests.py @@ -57,7 +57,8 @@ def parser(): parser.add_argument('--EarlyStop', dest='EarlyStop', type=str, default='EarlyStop') parser.add_argument('--max_idx', dest='max_idx', type=int, default=-1) parser.add_argument('--dense_img_num', dest='dense_img_num', type=int, default=-1) - parser.add_argument('--binary_siamese', dest='binary_siamese', action='store_true') + parser.add_argument('--binary_siamese', dest='binary_siamese', action='store_true') #seems to be a bad idea + parser.add_argument('--square_siamese', dest='square_siamese', action='store_true') args = parser.parse_args() @@ -415,7 +416,10 @@ def get_config(self): prediction = Dense(1, name = 'dense_siamese')(L1_distance) else: # Add a customized layer to compute the absolute difference between the encodings - L1_layer = Lambda(lambda tensors:K.abs(tensors[0] - tensors[1])) + if args.square_siamese: + L1_layer = Lambda(lambda tensors:K.pow(tensors[0] - tensors[1], 2)) + else: + L1_layer = Lambda(lambda tensors:K.abs(tensors[0] - tensors[1])) L1_distance = L1_layer([encoded_l, encoded_rb_scale]) prediction = Dense(1, name = 'dense_siamese')(L1_distance)