progress towards allowing overrides. dbox can now allow finding a person and clicking them to post to back-end.. More work to make this real, for now it goes through the routes but does not update the DB, see bottom of face.py for next steps

This commit is contained in:
2022-06-10 16:53:13 +10:00
parent b0779c2704
commit 8c78d9e633
3 changed files with 107 additions and 3 deletions

24
face.py
View File

@@ -2,6 +2,7 @@ from main import db, app, ma
from sqlalchemy import Sequence
from sqlalchemy.exc import SQLAlchemyError
# DEL ME SOON
from flask_login import login_required
from flask import render_template
@@ -61,3 +62,26 @@ class FaceRefimgLink(db.Model):
def __repr__(self):
return f"<face_id: {self.face_id}, refimg_id={self.refimg_id}, face_distance: {self.face_distance}"
### DDP: todo next, make these into sqlachemy classes, THEN person.py add the override in ORM, THEN draw override in blue/not green in DrawImg
### THEN find_person needs to call appropriate override func (OR pass in type?) and get it to be smarter - that sounds okay actually
# create table FACE_OVERRIDE_TYPE ( ID integer, NAME varchar unique, constraint PK_FACE_OVERRIDE_TYPE_ID primary key(ID) );
#create sequence FACE_OVERRIDE_TYPE_ID_SEQ;
#create sequence FACE_OVERRIDE_ID_SEQ;
#create table FACE_OVERRIDE_TYPE ( ID integer, NAME varchar unique, constraint PK_FACE_OVERRIDE_TYPE_ID primary key(ID) );
#insert into FACE_OVERRIDE_TYPE values ( (select nextval('FACE_OVERRIDE_TYPE_ID_SEQ')), 'Not a face' );
#insert into FACE_OVERRIDE_TYPE values ( (select nextval('FACE_OVERRIDE_TYPE_ID_SEQ')), 'Too young' );
#insert into FACE_OVERRIDE_TYPE values ( (select nextval('FACE_OVERRIDE_TYPE_ID_SEQ')), 'Ignore face' );
#insert into FACE_OVERRIDE_TYPE values ( (select nextval('FACE_OVERRIDE_TYPE_ID_SEQ')), 'Manual match' );
#
#-- keep non-redundant FACE because, when we rebuild data we may have a null FACE_ID, but still want to connect to this override
#-- from a previous AI pass... (would happen if we delete a file and then reimport/scan it), OR, more likely we change (say) a threshold, etc.
#-- any reordering of faces, generates new face_ids... (but if the face data was the same, then this override should stand)
#create table FACE_NO_MATCH_OVERRIDE ( ID integer, FACE_ID integer, TYPE integer, FACE bytea,
# constraint FK_FNMO_FACE_ID foreign key (FACE_ID) references FACE(ID),
# constraint FK_FNMO_TYPE foreign key (TYPE) references FACE_OVERRIDE_TYPE(ID),
# constraint PK_FNMO_ID primary key(ID) );
#
#-- manual match goes to person not refimg, so on search, etc. we deal with this anomaly (via sql not ORM)
#create table FACE_MANUAL_OVERRIDE ( ID integer, FACE_ID integer, PERSON_ID integer, TYPE integer, constraint PK_FACE_MANUAL_OVERRIDE_ID primary key(ID) );