removed useless [0] for face_locn in refimg code

This commit is contained in:
2022-01-31 21:08:33 +11:00
parent 47b9e13a53
commit 79a817fa90
3 changed files with 5 additions and 8 deletions

2
TODO
View File

@@ -13,8 +13,6 @@
* re-think unmatched faces... * re-think unmatched faces...
(the view needs a orig_url and pa_user_state to support viewer for current) (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), * 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 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 if count('new files') < say 1000 do eids, otherwise do path AND no new refimgs

View File

@@ -139,10 +139,9 @@ def GenThumb(fname):
# used to store refimg data into the DB # used to store refimg data into the DB
def GenFace(fname, model): def GenFace(fname, model):
img = face_recognition.load_image_file(fname) img = face_recognition.load_image_file(fname)
# TODO: change face_locations call basedon model
location = face_recognition.face_locations(img, model=model) location = face_recognition.face_locations(img, model=model)
encodings = face_recognition.face_encodings(img, known_face_locations=location) encodings = face_recognition.face_encodings(img, known_face_locations=location)
if len(encodings): if len(encodings):
return encodings[0].tobytes(), location return encodings[0].tobytes(), location[0]
else: else:
return None, None return None, None

View File

@@ -33,10 +33,10 @@
// store this stuff in an javascript Object to use when document is ready event is triggered // store this stuff in an javascript Object to use when document is ready event is triggered
var orig_face_{{refimg.id}}=new Object; var orig_face_{{refimg.id}}=new Object;
orig_face_{{refimg.id}}.x = {{refimg.face_locn[0][3]}} orig_face_{{refimg.id}}.x = {{refimg.face_locn[3]}}
orig_face_{{refimg.id}}.y = {{refimg.face_locn[0][0]}} orig_face_{{refimg.id}}.y = {{refimg.face_locn[0]}}
orig_face_{{refimg.id}}.w = {{refimg.face_locn[0][1]}}-{{refimg.face_locn[0][3]}} orig_face_{{refimg.id}}.w = {{refimg.face_locn[1]}}-{{refimg.face_locn[3]}}
orig_face_{{refimg.id}}.h = {{refimg.face_locn[0][2]}}-{{refimg.face_locn[0][0]}} 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_w = {{refimg.orig_w}}
orig_face_{{refimg.id}}.orig_h = {{refimg.orig_h}} orig_face_{{refimg.id}}.orig_h = {{refimg.orig_h}}