perf: batch GET /api/faces; skip download on low confidence; batch gate tracker writes
Fetch all Frigate training files once before the upload loop instead of once per person — for N people this reduces GET /api/faces calls from N to 1. Falls back to per-person calls if the pre-fetch fails. Check InsightFace detection confidence immediately after face enrichment, before fetching the full-resolution image. Assets that fail MIN_CONFIDENCE are skipped without downloading, saving potentially large image downloads. Collapse the gate removal tracker writes from 3×N file ops into 2 total via remove_and_reclassify_batch: one write to the uploaded tracker (remove file mappings + remove from flat set) and one write to the rejected tracker. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,22 @@ def get_frigate_face_counts() -> dict[str, int] | None:
|
||||
}
|
||||
|
||||
|
||||
def get_all_frigate_person_files() -> dict[str, list[str]] | None:
|
||||
"""Return {person_name: [filename, ...]} for every person in Frigate.
|
||||
|
||||
Single call used to build per-person snapshots before the upload loop,
|
||||
avoiding one GET /api/faces per person. Returns None if unavailable.
|
||||
"""
|
||||
data = _get_faces_data()
|
||||
if data is None:
|
||||
return None
|
||||
return {
|
||||
name: files
|
||||
for name, files in data.items()
|
||||
if name != "train" and isinstance(files, list)
|
||||
}
|
||||
|
||||
|
||||
def get_frigate_person_files(person_name: str) -> list[str] | None:
|
||||
"""Return the list of training filenames for a person in Frigate.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user