added auto-rotate to settings, not used in job mgr yet
This commit is contained in:
11
settings.py
11
settings.py
@@ -1,4 +1,4 @@
|
||||
from wtforms import SubmitField, StringField, IntegerField, FloatField, HiddenField, validators, Form, SelectField
|
||||
from wtforms import SubmitField, StringField, IntegerField, FloatField, HiddenField, validators, Form, SelectField, BooleanField
|
||||
from flask_wtf import FlaskForm
|
||||
from flask import request, render_template, redirect, url_for
|
||||
from main import db, app, ma
|
||||
@@ -30,6 +30,7 @@ class Settings(db.Model):
|
||||
import_path = db.Column(db.String)
|
||||
storage_path = db.Column(db.String)
|
||||
recycle_bin_path = db.Column(db.String)
|
||||
auto_rotate = db.Column(db.Boolean)
|
||||
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)
|
||||
@@ -41,7 +42,7 @@ class Settings(db.Model):
|
||||
job_archive_age = 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_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}, face_size_limit: {self.face_size_limit}, scheduled_import_scan:{self.scheduled_import_scan}, scheduled_storage_scan: {self.scheduled_storage_scan}, scheduled_bin_cleanup: {self.scheduled_bin_cleanup}, bin_cleanup_file_age: {self.bin_cleanup_file_age}, job_archive_age: {self.job_archive_age}>"
|
||||
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, auto_rotate: {self.auto_rotate}, default_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}, face_size_limit: {self.face_size_limit}, scheduled_import_scan:{self.scheduled_import_scan}, scheduled_storage_scan: {self.scheduled_storage_scan}, scheduled_bin_cleanup: {self.scheduled_bin_cleanup}, bin_cleanup_file_age: {self.bin_cleanup_file_age}, job_archive_age: {self.job_archive_age}>"
|
||||
|
||||
################################################################################
|
||||
# Helper class that inherits a .dump() method to turn class Settings into json / useful in jinja2
|
||||
@@ -63,6 +64,7 @@ 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()])
|
||||
auto_rotate = BooleanField('Automatically rotate jpegs based on exif', [validators.AnyOf([True, False])])
|
||||
default_refimg_model = SelectField( 'Default model to use for reference images', choices=[(c.id, c.name) for c in AIModel.query.order_by('id')] )
|
||||
default_scan_model = SelectField( 'Default model to use for all scanned images', 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()])
|
||||
@@ -87,6 +89,7 @@ def settings():
|
||||
HELP['import_path']="Path(s) to import files from. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['storage_path']="Path(s) to store sorted files to. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['recycle_bin_path']="Path where deleted files are moved to. If starting with /, then used literally, otherwise base path is prepended"
|
||||
HELP['auto_rotate']="Automatically rotate jpegs based on exif to orient them so that AI matching will work. NOTE: this actually changes/rewrites the file - as it is a simple rotate, it is down without losing quality/content"
|
||||
HELP['default_refimg_model']="Default face recognition model used for reference images - cnn is slower/more accurate, hog is faster/less accurate - we scan (small) refimg once, so cnn is okay"
|
||||
HELP['default_scan_model']="Default face recognition model used for scanned images - cnn is slower/more accurate, hog is faster/less accurate - we scan (large) scanned images lots, so cnn NEEDS gpu/mem"
|
||||
HELP['default_threshold']="The distance below which a face is considered a match. The default is usually 0.6, we are trying for about 0.55 with kids. YMMV"
|
||||
@@ -106,6 +109,10 @@ 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']
|
||||
if 'auto_rotate' in request.form:
|
||||
s.auto_rotate = True
|
||||
else:
|
||||
s.auto_rotate = False
|
||||
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']
|
||||
|
||||
Reference in New Issue
Block a user