From 79a817fa90e376c0f406052386b168e6d9f907c3 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Mon, 31 Jan 2022 21:08:33 +1100 Subject: [PATCH] removed useless [0] for face_locn in refimg code --- TODO | 2 -- shared.py | 3 +-- templates/person.html | 8 ++++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index afecf10..d86677f 100644 --- a/TODO +++ b/TODO @@ -13,8 +13,6 @@ * re-think unmatched faces... (the view needs a orig_url and pa_user_state to support viewer for current) - * refimg locns can lose an array idx of 0 always. - * could get better AI optim, by keeping track of just new files since scan (even if we did this from the DB), then we could just feed those eid's explicitly into a 'run_ai_on_new_files' :) -- maybe particularly if count('new files') < say 1000 do eids, otherwise do path AND no new refimgs diff --git a/shared.py b/shared.py index c5c20a9..4baafcf 100644 --- a/shared.py +++ b/shared.py @@ -139,10 +139,9 @@ def GenThumb(fname): # used to store refimg data into the DB def GenFace(fname, model): img = face_recognition.load_image_file(fname) - # TODO: change face_locations call basedon model location = face_recognition.face_locations(img, model=model) encodings = face_recognition.face_encodings(img, known_face_locations=location) if len(encodings): - return encodings[0].tobytes(), location + return encodings[0].tobytes(), location[0] else: return None, None diff --git a/templates/person.html b/templates/person.html index e9430cb..80aeafa 100644 --- a/templates/person.html +++ b/templates/person.html @@ -33,10 +33,10 @@ // store this stuff in an javascript Object to use when document is ready event is triggered var orig_face_{{refimg.id}}=new Object; - orig_face_{{refimg.id}}.x = {{refimg.face_locn[0][3]}} - orig_face_{{refimg.id}}.y = {{refimg.face_locn[0][0]}} - orig_face_{{refimg.id}}.w = {{refimg.face_locn[0][1]}}-{{refimg.face_locn[0][3]}} - orig_face_{{refimg.id}}.h = {{refimg.face_locn[0][2]}}-{{refimg.face_locn[0][0]}} + orig_face_{{refimg.id}}.x = {{refimg.face_locn[3]}} + orig_face_{{refimg.id}}.y = {{refimg.face_locn[0]}} + orig_face_{{refimg.id}}.w = {{refimg.face_locn[1]}}-{{refimg.face_locn[3]}} + orig_face_{{refimg.id}}.h = {{refimg.face_locn[2]}}-{{refimg.face_locn[0]}} orig_face_{{refimg.id}}.orig_w = {{refimg.orig_w}} orig_face_{{refimg.id}}.orig_h = {{refimg.orig_h}}