remove temporary code to fix faces (move coords from locn to top, right, etc.)

This commit is contained in:
2022-12-23 16:04:46 +11:00
parent 6774bb101f
commit 46c0f3a06f
2 changed files with 0 additions and 30 deletions

View File

@@ -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" )