Files
punimtag/backend/config.py
T
ilia e8c13f86d7
CI / skip-ci-check (pull_request) Successful in 30s
CI / python-lint (pull_request) Successful in 32s
CI / docker-ci (pull_request) Successful in 31s
CI / secret-scan (pull_request) Successful in 39s
CI / viewer-unit (pull_request) Successful in 1m44s
CI / admin-unit (pull_request) Successful in 2m1s
CI / e2e (pull_request) Failing after 2m2s
Add People hub, Phase 5 junk reject, cluster-name, a11y smoke.
Nest Identify/Auto-Match/Modify under /people with redirects; reject
blur/extreme pose at Process; Name-cluster on Identify; axe smoke tests;
helpers to rotate DEV admin password and seed match_decisions.
2026-08-05 14:24:28 -04:00

63 lines
2.5 KiB
Python

"""Configuration values used by the PunimTag web services.
This module replaces the legacy desktop configuration to keep the web
application self-contained.
"""
from __future__ import annotations
# Supported image formats for uploads/imports
SUPPORTED_IMAGE_FORMATS = {".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".tif"}
# Supported video formats for scanning (not processed for faces)
SUPPORTED_VIDEO_FORMATS = {".mp4", ".mov", ".avi", ".mkv", ".webm", ".m4v", ".flv", ".wmv", ".mpg", ".mpeg"}
# DeepFace behavior
DEEPFACE_ENFORCE_DETECTION = False
DEEPFACE_ALIGN_FACES = True
# Face filtering thresholds (Immich-style: prefer precision over recall)
MIN_FACE_CONFIDENCE = 0.55 # was 0.4 — junk detections poison matching
MIN_FACE_SIZE = 40
MAX_FACE_SIZE = 1500
# Matching tolerance and calibration options
DEFAULT_FACE_TOLERANCE = 0.5 # Lowered from 0.6 for stricter matching
USE_CALIBRATED_CONFIDENCE = True
CONFIDENCE_CALIBRATION_METHOD = "empirical" # "empirical", "linear", or "sigmoid"
# Immich-inspired precision gates (false accepts hurt more than misses)
# Hard ceiling on cosine distance regardless of adaptive tolerance
MAX_RECOGNITION_DISTANCE = 0.50
# Require best person to beat runner-up by this margin (sibling/lookalike guard)
MIN_NEXT_BEST_PERSON_MARGIN = 0.08
# Auto-accept: distance must be this close AND (multi-ref agree OR single very close)
AUTO_ACCEPT_MAX_DISTANCE = 0.35
AUTO_ACCEPT_MIN_REF_AGREE = 2
# Auto-match face size filtering
# Minimum face size as percentage of image area (0.5% = 0.005)
# Faces smaller than this are excluded from auto-match to avoid generic encodings
MIN_AUTO_MATCH_FACE_SIZE_RATIO = 0.005 # 0.5% of image area
# Auto-match reference / accept gates (Phase 2 accuracy)
# Reference faces below this quality are not used for matching
MIN_AUTO_MATCH_REFERENCE_QUALITY = 0.5 # was 0.3 — prefer clearer refs
# Default Auto-Accept threshold (%) — align UI copy (~85%) with code
DEFAULT_AUTO_ACCEPT_THRESHOLD = 85.0
# Browse vs Run tolerances (UI defaults; lower = stricter)
DEFAULT_BROWSE_TOLERANCE = 0.5
DEFAULT_RUN_TOLERANCE = 0.4
# Phase 4: match each person against up to N trusted refs; keep best (min) distance
AUTO_MATCH_MAX_REFERENCE_FACES = 3
# Phase 5: reject junk detections at Process time (Immich-style precision)
# Laplacian variance on grayscale face crop; below this = too blurry to keep
MIN_LAPLACIAN_VARIANCE = 80.0
# Extreme pose (degrees) — mirrors PoseDetector EXTREME_* thresholds
MAX_FACE_YAW_DEGREES = 60.0
MAX_FACE_PITCH_DEGREES = 45.0