Zoom out a bit on final image, disable /progress route spam
This commit is contained in:
parent
32c74cc627
commit
24a4727dd1
2 changed files with 11 additions and 11 deletions
15
main.py
15
main.py
|
|
@ -4,6 +4,7 @@ import threading
|
|||
import subprocess
|
||||
from flask import Flask, request, render_template, jsonify, redirect, url_for
|
||||
from timelapse import process_faces, ProcessConfig, validate_immich_connection
|
||||
import logging
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
|
@ -24,6 +25,13 @@ processing_thread = None
|
|||
# Global flag to signal cancellation
|
||||
cancel_requested = False
|
||||
|
||||
class ProgressRouteFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
# Filter out logs containing the progress route
|
||||
return "/progress" not in record.getMessage()
|
||||
|
||||
log = logging.getLogger('werkzeug')
|
||||
log.addFilter(ProgressRouteFilter())
|
||||
|
||||
def update_progress(current, total):
|
||||
"""
|
||||
|
|
@ -215,13 +223,8 @@ def index():
|
|||
resize_size = int(request.form.get("resize_size", 512))
|
||||
face_resolution_threshold = int(request.form.get("face_resolution_threshold", 128))
|
||||
pose_threshold = float(request.form.get("pose_threshold", 25))
|
||||
|
||||
# Parse left_eye_pos tuple from form
|
||||
left_eye_x = float(request.form.get("left_eye_x", 0.35))
|
||||
left_eye_y = float(request.form.get("left_eye_y", 0.45))
|
||||
left_eye_pos = (left_eye_x, left_eye_y)
|
||||
|
||||
max_workers = int(request.form.get("max_workers", 1))
|
||||
left_eye_pos = (0.4, 0.4)
|
||||
|
||||
# Date ranges are optional
|
||||
date_from = request.form.get("date_from") or None
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class ProcessConfig:
|
|||
min_face_width: int = 128
|
||||
min_face_height: int = 128
|
||||
pose_threshold: float = 25
|
||||
left_eye_pos: tuple = (0.35, 0.45)
|
||||
left_eye_pos: tuple = (0.4, 0.4)
|
||||
landmark_model_path: str = "shape_predictor_68_face_landmarks.dat"
|
||||
|
||||
|
||||
|
|
@ -275,17 +275,14 @@ def align_face(image, desired_face_width, desired_face_height, left_eye_pos, pos
|
|||
img_width, img_height = image.size
|
||||
face_width = img_width / (1 + 2 * padding_percent)
|
||||
face_height = img_height / (1 + 2 * padding_percent)
|
||||
|
||||
# Calculate the face rectangle coordinates
|
||||
x1 = int((img_width - face_width) / 2)
|
||||
x2 = int(x1 + face_width)
|
||||
y1 = int((img_height - face_height) / 2)
|
||||
y2 = int(y1 + face_height)
|
||||
|
||||
# Resize the image for landmark detection
|
||||
optimal_size = 256 # optimal image resolution for landmark detection (between 200-400px)
|
||||
scale_factor = optimal_size / face_width
|
||||
|
||||
# Resize the image for landmark detection
|
||||
resized_width = int(img_width * scale_factor)
|
||||
resized_height = int(img_height * scale_factor)
|
||||
resized_gray = cv2.resize(gray, (resized_width, resized_height))
|
||||
|
|
|
|||
Loading…
Reference in a new issue