updated comments

This commit is contained in:
2021-08-10 21:31:09 +10:00
parent d49af24fee
commit 03a2b4a9d9
2 changed files with 24 additions and 5 deletions

7
ai.py
View File

@@ -37,10 +37,8 @@ def aistats():
################################################################################ ################################################################################
# /run_ai_on -> CAM: needs more thought (what actual params, e.g list of file - # /run_ai_on -> creates a job, with extras containing entry ids (eid-0, eid-1,
# tick, but which face or faces? are we forcing a re-finding of unknown faces # etc.) and person=all|dad, etc. Room to consider threshold, algo, etc.
# or just looking for matches? (maybe in the long run there are different
# routes, not params - stuff we will work out as we go)
################################################################################ ################################################################################
@app.route("/run_ai_on", methods=["POST"]) @app.route("/run_ai_on", methods=["POST"])
@login_required @login_required
@@ -48,7 +46,6 @@ def run_ai_on():
jex=[] jex=[]
for el in request.form: for el in request.form:
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) ) jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
print( f"would create new job with extras={jex}" )
job=NewJob( "run_ai_on", 0, None, jex ) job=NewJob( "run_ai_on", 0, None, jex )
st.SetAlert("success") st.SetAlert("success")
st.SetMessage( f"Created&nbsp;<a href=/job/{job.id}>Job #{job.id}</a>&nbsp;to Look for face(s) in selected file(s)") st.SetMessage( f"Created&nbsp;<a href=/job/{job.id}>Job #{job.id}</a>&nbsp;to Look for face(s) in selected file(s)")

22
face.py
View File

@@ -2,6 +2,16 @@ from main import db, app, ma
from sqlalchemy import Sequence from sqlalchemy import Sequence
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
# pylint: disable=no-member
################################################################################
# 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
################################################################################
class Face(db.Model): class Face(db.Model):
__tablename__ = "face" __tablename__ = "face"
id = db.Column(db.Integer, db.Sequence('face_id_seq'), primary_key=True ) id = db.Column(db.Integer, db.Sequence('face_id_seq'), primary_key=True )
@@ -14,6 +24,13 @@ class Face(db.Model):
def __repr__(self): def __repr__(self):
return f"<id: {self.id}, face={self.face}, locn={self.locn}" return f"<id: {self.id}, face={self.face}, locn={self.locn}"
################################################################################
# Class describing FaceFileLink in the database and DB via sqlalchemy
# each face comes from a file and used a model to find the face
# this is not perfect, each face in the same file is always foudn with the same
# model - so really should have ModelFileLink or something, in the long run
# this might even be better as ScanDetailsFileLink and ScanDetails
################################################################################
class FaceFileLink(db.Model): class FaceFileLink(db.Model):
__tablename__ = "face_file_link" __tablename__ = "face_file_link"
face_id = db.Column(db.Integer, db.ForeignKey("face.id"), primary_key=True ) face_id = db.Column(db.Integer, db.ForeignKey("face.id"), primary_key=True )
@@ -23,6 +40,11 @@ class FaceFileLink(db.Model):
def __repr__(self): def __repr__(self):
return f"<face_id: {self.face_id}, file_eid={self.file_eid}, model_used: {self.model_used}" return f"<face_id: {self.face_id}, file_eid={self.file_eid}, model_used: {self.model_used}"
################################################################################
# Class describing FaceRefimgLink in the database and DB via sqlalchemy
# connects / implies a face has matched a refimg and we keep the distance too
# distance is mainly for debugging for now and shown in viewer
################################################################################
class FaceRefimgLink(db.Model): class FaceRefimgLink(db.Model):
__tablename__ = "face_refimg_link" __tablename__ = "face_refimg_link"
face_id = db.Column(db.Integer, db.ForeignKey("face.id"), primary_key=True ) face_id = db.Column(db.Integer, db.ForeignKey("face.id"), primary_key=True )