model_used is now per file, not per face, implemented split of default_model to default_refimg_model and default_scan_model in settings, and default_refimg_model actualy works when creating refimgs in person.py. The model_used in face_file_link is based on default settings model and will scan with cnn if chosen and store that in DB as needed. Need viewer to allow changing per file / not just default for future scans

This commit is contained in:
2021-07-27 17:14:03 +10:00
parent 50e28ed27c
commit b7d346c206
7 changed files with 59 additions and 62 deletions

View File

@@ -29,11 +29,12 @@ class Settings(db.Model):
import_path = db.Column(db.String)
storage_path = db.Column(db.String)
recycle_bin_path = db.Column(db.String)
default_model = db.Column(db.Integer,db.ForeignKey('ai_model.id'), unique=True, nullable=False)
default_refimg_model = db.Column(db.Integer,db.ForeignKey('ai_model.id'), unique=True, nullable=False)
default_scan_model = db.Column(db.Integer,db.ForeignKey('ai_model.id'), unique=True, nullable=False)
default_threshold = db.Column(db.Integer)
def __repr__(self):
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, default_model: {self.default_model}, default_threshold: {self.default_threshold}>"
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, default_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}>"
################################################################################
# Helper class that inherits a .dump() method to turn class Settings into json / useful in jinja2
@@ -54,7 +55,8 @@ class SettingsForm(FlaskForm):
import_path = StringField('Path(s) to import from:', [validators.DataRequired()])
storage_path = StringField('Path to store sorted images to:', [validators.DataRequired()])
recycle_bin_path = StringField('Path to temporarily store deleted images in:', [validators.DataRequired()])
default_model = SelectField( 'default_model', choices=[(c.id, c.name) for c in AIModel.query.order_by('id')] )
default_refimg_model = SelectField( 'default_refimg_model', choices=[(c.id, c.name) for c in AIModel.query.order_by('id')] )
default_scan_model = SelectField( 'default_scan_model', choices=[(c.id, c.name) for c in AIModel.query.order_by('id')] )
default_threshold = StringField('Face Distance threshold (below is a match):', [validators.DataRequired()])
submit = SubmitField('Save' )
@@ -78,7 +80,8 @@ def settings():
s.import_path = request.form['import_path']
s.storage_path = request.form['storage_path']
s.recycle_bin_path = request.form['recycle_bin_path']
s.default_model = request.form['default_model']
s.default_refimg_model = request.form['default_refimg_model']
s.default_scan_model = request.form['default_scan_model']
s.default_threshold = request.form['default_threshold']
db.session.commit()
return redirect( '/settings' )