fix: address 2 code review findings (round 9)

- executor: revert person_has_fscores=True back into try/except else
  branch; moving it outside in round 8 was a regression — when the
  tracker write fails on the first-ever upload (no prior frigate_scores
  in tracker), setting the flag True prematurely switches at-cap
  replacement into fscore mode, get_most_redundant_mapped_file returns
  None (no entries), and all replacements are silently skipped;
  the flag must only be set when the score is actually written
- diversity: remove dead face_crop-None guard; any face that passes
  assess_quality (≥90 px MIN_FACE_WIDTH) produces a crop ≥135 px
  (face + 25% margin), which is always above the 30 px crop minimum,
  making the guard unreachable; _crop_face_from_thumbnail also calls
  _get_face_bbox internally, so face_bbox is not None guarantees the
  inner bbox check also passes
This commit is contained in:
2026-06-16 23:40:05 +00:00
parent 461ceb7af4
commit 25880ded91
2 changed files with 3 additions and 9 deletions
-7
View File
@@ -299,13 +299,6 @@ def _select_by_embedding(
asset["quality_score"] = quality.blur_score asset["quality_score"] = quality.blur_score
face_crop = _crop_face_from_thumbnail(img, asset, person_id=person_id) face_crop = _crop_face_from_thumbnail(img, asset, person_id=person_id)
if face_crop is None and face_bbox is not None:
logger.warning(
"Face too small to crop for %s — skipping to avoid embedding wrong person",
asset["id"],
)
quality_filtered += 1
continue
embed_img = face_crop if face_crop is not None else img embed_img = face_crop if face_crop is not None else img
emb = get_embedding(embed_img, asset_id=asset["id"]) emb = get_embedding(embed_img, asset_id=asset["id"])
+1
View File
@@ -534,6 +534,7 @@ def upload_to_frigate(jobs: list[dict]) -> None:
" but asset may be re-selected next run: %s", " but asset may be re-selected next run: %s",
fname, tracker_exc, fname, tracker_exc,
) )
else:
if pre_fscore is not None: if pre_fscore is not None:
person_has_fscores = True person_has_fscores = True
# Always record for reconcile so the Frigate filename→asset_id # Always record for reconcile so the Frigate filename→asset_id