fix: TKG key frame/face selection uses best-confidence — match frontend label

- tkg.rs: key_frame/key_face/best_bbox now use best-confidence frame
  (was cq_best capture-quality) so thumbnails agree with trace_agent_api
  best_face_frame / [F..] labels
- keep cq_best_quality as trace-level stat only
- add backfill_trace_dirs + skip_existing resume mode
- trace_agent_api.rs regenerate-thumbnail: use strict > tie-break (reduce)
  matching list_traces_sorted so equal-confidence frames pick the same one
This commit is contained in:
Accusys
2026-08-20 01:27:35 +08:00
parent efa17d4b62
commit 6d7b477b31
2 changed files with 82 additions and 31 deletions
+9 -1
View File
@@ -1002,7 +1002,15 @@ async fn regenerate_trace_thumbnail(
conf,
))
})
.max_by(|a, b| a.5.partial_cmp(&b.5).unwrap_or(std::cmp::Ordering::Equal));
.reduce(|acc, cur| {
// Match list_traces_sorted tie-break: strict > keeps the first-seen
// point on equal confidence so the label and thumbnail agree.
if cur.5 > acc.5 {
cur
} else {
acc
}
});
let (best_frame, bx, by, bw, bh, _conf) = best.ok_or_else(|| {
(