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
+31 -2
View File
@@ -61,6 +61,7 @@ def run_face_tracker(
"width": bbox.get("width", f.get("width", 0)),
"height": bbox.get("height", f.get("height", 0)),
"confidence": f.get("confidence", 0.0),
"captureQuality": f.get("captureQuality", 0.0),
}
if "landmarks" in f:
face["landmarks"] = f["landmarks"]
@@ -97,12 +98,40 @@ def run_face_tracker(
print(f"[TRACE] Processing {len(face_data.get('frames', {}))} frames")
# Embeddings no longer loaded from DB - use IoU-only tracking
# Load embeddings from Qdrant _faces collection
file_uuid = (
face_json_path.split("/")[-1]
.replace(".face.json", "")
.replace("_traced.json", "")
)
print(f"[TRACE] Loading embeddings from Qdrant for {file_uuid}...")
try:
from qdrant_faces import get_file_faces
qdrant_points = get_file_faces(file_uuid, with_vector=True)
# Build lookup: (frame, x, y) -> embedding
emb_lookup = {}
for p in qdrant_points:
pl = p.get("payload", {})
frame = pl.get("frame")
bbox = pl.get("bbox", {})
x, y = bbox.get("x"), bbox.get("y")
vec = p.get("vector")
if frame is not None and vec:
emb_lookup[(frame, x, y)] = vec
print(f"[TRACE] Loaded {len(emb_lookup)} embeddings from Qdrant")
# Attach embeddings to face data
attached = 0
for fnum_str, frm_data in face_data.get("frames", {}).items():
fnum = int(fnum_str)
for face in frm_data.get("faces", []):
key = (fnum, face.get("x"), face.get("y"))
if key in emb_lookup:
face["embedding"] = emb_lookup[key]
attached += 1
print(f"[TRACE] Attached {attached} embeddings to face data")
except Exception as e:
print(f"[TRACE] Warning: Failed to load embeddings from Qdrant: {e}")
# Load cut boundaries from cut.json (same directory as face.json)
cut_boundaries = None
@@ -118,7 +147,7 @@ def run_face_tracker(
print(f"[TRACE] Loaded {len(cut_boundaries)} cut boundaries")
face_data = track_faces(
face_data, use_embedding=False, cut_boundaries=cut_boundaries
face_data, use_embedding=True, cut_boundaries=cut_boundaries
)
# Merge traces within same cut (same person re-appearing after occlusion/pose change)