diff --git a/face.py b/face.py index 08cdc00..ff4547c 100644 --- a/face.py +++ b/face.py @@ -15,7 +15,6 @@ import json ################################################################################ # Class describing Face in the database and DB via sqlalchemy # - face contains the binary version of numpy array so we dont need to recalc it -# - locn is the pixel coords of the face (top, right, bottom, left) # - refimg_lnk and facefile_lnk are viewOnly / just for convenience in viewer # - refimg is a real link to the refimg used for this face (its is only used in # viewer, and is either set when there is a matched face, or None if no match @@ -24,7 +23,6 @@ class Face(PA,db.Model): __tablename__ = "face" id = db.Column(db.Integer, db.Sequence('face_id_seq'), primary_key=True ) face = db.Column( db.LargeBinary ) - locn = db.Column( db.String ) face_top = db.Column( db.Integer ) face_right = db.Column( db.Integer ) face_bottom = db.Column( db.Integer ) diff --git a/person.py b/person.py index e219317..d59960f 100644 --- a/person.py +++ b/person.py @@ -29,7 +29,6 @@ import os.path # fname: original file name of refimg # face: actual binary of numpy data for this refimg's face (always only 1) # orig*: width/height of original image, because when we show in person, it get scaled -# face_locn: location of ace - we need to know to draw green box around face locn (with orig* above) # thumbnail: image data of actual img. once we load refimg, we only store this data, not the orig file # model_used: which AI model (cnn or hog) used to create face # person: read-only convenience field not in DB, just used in html @@ -40,7 +39,6 @@ class Refimg(PA,db.Model): face = db.Column(db.LargeBinary, unique=True, nullable=False) orig_w = db.Column(db.Integer) orig_h = db.Column(db.Integer) - face_locn = db.Column(db.String) face_top = db.Column(db.Integer) face_right = db.Column(db.Integer) face_bottom = db.Column(db.Integer) @@ -453,29 +451,3 @@ def add_no_match_override(): resp={} resp['type']=t.name return resp - -@app.route('/fix_faces') -@login_required -def fix_faces(): - for r in Refimg.query.all(): - print( f"BEFORE: ref# {r.id}, face_locn = {r.face_locn}, top={r.face_top}, right={r.face_right}, bottom={r.face_bottom}, left={r.face_left}" ) - tmp=json.loads(r.face_locn) - r.face_top = tmp[0] - r.face_right = tmp[1] - r.face_bottom = tmp[2] - r.face_left = tmp[3] - db.session.add(r) - print( f" FIXED: ref# {r.id}, face_locn = {r.face_locn}, top={r.face_top}, right={r.face_right}, bottom={r.face_bottom}, left={r.face_left}" ) - - for f in Face.query.all(): - print( f"BEFORE: face# {f.id}, locn = {f.locn}, top={f.face_top}, right={f.face_right}, bottom={f.face_bottom}, left={f.face_left}" ) - tmp=json.loads(f.locn) - f.face_top = tmp[0] - f.face_right = tmp[1] - f.face_bottom = tmp[2] - f.face_left = tmp[3] - db.session.add(f) - print( f" FIXED: ref# {f.id}, locn = {f.locn}, top={f.face_top}, right={f.face_right}, bottom={f.face_bottom}, left={f.face_left}" ) - db.session.commit() - print("faces should be fixed") - return render_template("base.html" )