fix: add min_capture_quality to FaceFilterSettings + trace profile fixes

- Add min_capture_quality to FaceFilterSettings (file_profile.rs)
- Fix store_traced_faces.py: load embeddings from Qdrant with_vector=True
- Fix face_tracker.py: force new traces when frame_gap > 30
- Fix backfill_trace_profiles.py: key_frame select=eq(n,N), bbox scaling, best_frame
- Add best_frame to FaceTraceProfile (Rust + Python)
- Fix min_capture_quality persistence in file-profile API
This commit is contained in:
Accusys
2026-08-13 10:12:21 +08:00
parent 71172fa354
commit 39e9ce4c3b
25 changed files with 723 additions and 131 deletions
+32 -3
View File
@@ -2,17 +2,21 @@ use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use crate::core::config::{FACE_FILTER_CONFIDENCE_PCT_DEFAULT, FACE_MIN_SIZE_DEFAULT};
/// Version of the file profile schema.
const PROFILE_VERSION: &str = "1.0";
// ─── Data Types ───
/// Per-file face detection thresholds. `min_confidence` is 0–100 (%),
/// `min_size` is px. Mirrors `videos.face_filter` DB column (same units).
/// `min_size` is px, `min_capture_quality` is 0–1. Mirrors `videos.face_filter` DB column.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FaceFilterSettings {
pub min_confidence: f64,
pub min_size: i32,
#[serde(default)]
pub min_capture_quality: f64,
}
impl FaceFilterSettings {
@@ -20,8 +24,9 @@ impl FaceFilterSettings {
/// Filter later for display; detect everything first.
pub fn defaults() -> Self {
Self {
min_confidence: 50.0,
min_size: 1,
min_confidence: FACE_FILTER_CONFIDENCE_PCT_DEFAULT,
min_size: FACE_MIN_SIZE_DEFAULT,
min_capture_quality: 0.0,
}
}
}
@@ -378,7 +383,19 @@ pub struct FaceTraceProfile {
pub frame_count: i64,
pub start_frame: i64,
pub end_frame: i64,
#[serde(default)]
pub best_frame: Option<i64>,
pub avg_confidence: Option<f64>,
#[serde(default)]
pub best_confidence: Option<f64>,
#[serde(default)]
pub avg_capture_quality: Option<f64>,
#[serde(default)]
pub best_capture_quality: Option<f64>,
#[serde(default)]
pub avg_bbox: Option<serde_json::Value>,
#[serde(default)]
pub best_bbox: Option<serde_json::Value>,
pub key_frame: Option<String>, // filename: key_frame.jpg
pub key_face: Option<String>, // filename: key_face.jpg
pub status: String, // pending / bound / merged
@@ -406,7 +423,13 @@ impl FaceTraceProfile {
frame_count: i64,
start_frame: i64,
end_frame: i64,
best_frame: i64,
avg_confidence: Option<f64>,
avg_capture_quality: Option<f64>,
best_confidence: f64,
best_capture_quality: f64,
avg_bbox: serde_json::Value,
best_bbox: Option<serde_json::Value>,
) -> Self {
Self {
version: PROFILE_VERSION.to_string(),
@@ -416,7 +439,13 @@ impl FaceTraceProfile {
frame_count,
start_frame,
end_frame,
best_frame: Some(best_frame),
avg_confidence,
best_confidence: Some(best_confidence),
avg_capture_quality,
best_capture_quality: Some(best_capture_quality),
avg_bbox: Some(avg_bbox),
best_bbox,
key_frame: None,
key_face: None,
status: "pending".to_string(),