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:
@@ -137,11 +137,46 @@ def match_faces(
|
||||
if not previous_faces:
|
||||
return {i: -1 for i in range(len(current_faces))}
|
||||
|
||||
# If a scene cut exists between prev and current frame, force all new traces
|
||||
# If frame gap is too large, force new traces (likely crossed multiple scenes)
|
||||
if frame_gap is not None and frame_gap > 30:
|
||||
return {i: -1 for i in range(len(current_faces))}
|
||||
|
||||
# If a scene cut exists between prev and current frame, only continue
|
||||
# traces for faces matching the previous frame with high IoU (same person
|
||||
# in the same position across the cut); unmatched faces get new traces.
|
||||
if cut_boundaries and prev_frame is not None and curr_frame is not None:
|
||||
for cf in cut_boundaries:
|
||||
if prev_frame < cf <= curr_frame:
|
||||
return {i: -1 for i in range(len(current_faces))}
|
||||
matches = {}
|
||||
used_prev = set()
|
||||
for curr_idx, curr_face in enumerate(current_faces):
|
||||
best_prev_idx = -1
|
||||
best_iou = 0.0
|
||||
curr_bbox = {
|
||||
"x": curr_face["x"],
|
||||
"y": curr_face["y"],
|
||||
"width": curr_face["width"],
|
||||
"height": curr_face["height"],
|
||||
}
|
||||
for prev_idx, prev_face in enumerate(previous_faces):
|
||||
if prev_idx in used_prev:
|
||||
continue
|
||||
prev_bbox = {
|
||||
"x": prev_face["x"],
|
||||
"y": prev_face["y"],
|
||||
"width": prev_face["width"],
|
||||
"height": prev_face["height"],
|
||||
}
|
||||
iou = calculate_bbox_iou(curr_bbox, prev_bbox)
|
||||
if iou > best_iou:
|
||||
best_iou = iou
|
||||
best_prev_idx = prev_idx
|
||||
if best_prev_idx >= 0 and best_iou > 0.5:
|
||||
matches[curr_idx] = best_prev_idx
|
||||
used_prev.add(best_prev_idx)
|
||||
else:
|
||||
matches[curr_idx] = -1
|
||||
return matches
|
||||
|
||||
matches = {}
|
||||
used_prev = set()
|
||||
|
||||
Reference in New Issue
Block a user