From 9c46a9ab17897ee477e72a117d788c423572af64 Mon Sep 17 00:00:00 2001 From: serengil Date: Mon, 30 Nov 2020 12:42:02 +0300 Subject: [PATCH] dict for json instead of string in verification --- deepface/DeepFace.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/deepface/DeepFace.py b/deepface/DeepFace.py index def741d..5441ba4 100644 --- a/deepface/DeepFace.py +++ b/deepface/DeepFace.py @@ -299,21 +299,16 @@ def verify(img1_path, img2_path = '', model_name = 'VGG-Face', distance_metric = toc = time.time() #print("identification lasts ",toc-tic," seconds") - + if bulkProcess == True: - resp_obj = "{" + + resp_obj = {} for i in range(0, len(resp_objects)): - resp_item = json.dumps(resp_objects[i]) - - if i > 0: - resp_obj += ", " - - resp_obj += "\"pair_"+str(i+1)+"\": "+resp_item - resp_obj += "}" - resp_obj = json.loads(resp_obj) + resp_item = resp_objects[i] + resp_obj["pair_%d" % (i+1)] = resp_item + return resp_obj - #return resp_objects def analyze(img_path, actions = [], models = {}, enforce_detection = True , detector_backend = 'mtcnn'):