feat: asrx recovery + pipeline fixes + face trace improvements

- ASR-ASRX unified processor (asr_asrx → asrx), output .asrx.json
- ffmpeg -vsync → -fps_mode (swift_ocr, swift_hand, swift_pose, frame_cache)
- ffprobe absolute path for probe
- PYTHONPATH + PATH added to executor subprocesses
- cut processor path fix (cut/cut_processor.py)
- scene_vlm fallback when blur_scores empty + ffmpeg absolute path
- rust_store_traced_faces generates key_face.jpg with --video-path
- face group representative trace picks highest best_confidence
- Studio: move FS doesn't remove from unassigned, always reload after move
- Studio: confirmMoveFaceToNewGroup simplified to just rename
- Studio: scene_vlm added to processors list
- Studio: scene_vlm shows (0) when ready but no scenes
- admin_config asr_config block added
This commit is contained in:
Accusys
2026-11-06 10:00:24 +08:00
parent e56e2892d0
commit c6cbb5d1fb
139 changed files with 27117 additions and 151 deletions
+68 -12
View File
@@ -1346,6 +1346,7 @@ pub async fn get_face_groups_handler(
Path(file_uuid): Path<String>,
Query(q): Query<FaceGroupsQuery>,
) -> Result<Json<FaceGroupsResponse>, StatusCode> {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let tkg_table = schema::table_name("tkg_nodes");
let tp_table = schema::table_name("trace_profiles");
let v_table = schema::table_name("videos");
@@ -1422,20 +1423,48 @@ pub async fn get_face_groups_handler(
let include_trace_ids = q.include_trace_ids.unwrap_or(true);
// Load best_confidence per trace from face_traced.json
let mut trace_best_conf: std::collections::HashMap<i32, f64> = std::collections::HashMap::new();
let traced_path = format!("{}/{}.face_traced.json", output_dir.trim_end_matches('/'), file_uuid);
if let Ok(content) = std::fs::read_to_string(&traced_path) {
if let Ok(traced) = serde_json::from_str::<serde_json::Value>(&content) {
if let Some(traces) = traced.get("traces").and_then(|v| v.as_array()) {
for t in traces {
if let (Some(tid), Some(conf)) = (
t.get("trace_id").and_then(|v| v.as_i64()),
t.get("best_confidence").or(t.get("avg_confidence")).and_then(|v| v.as_f64()),
) {
trace_best_conf.insert(tid as i32, conf);
}
}
}
}
}
let face_groups: Vec<FaceGroup> = filtered_groups
.into_iter()
.enumerate()
.map(|(idx, (name, trace_ids))| FaceGroup {
group_id: (idx + 1) as i32,
name,
trace_count: trace_ids.len() as i32,
representative_trace: trace_ids.first().copied().unwrap_or(0),
trace_ids: if include_trace_ids {
Some(trace_ids)
} else {
None
},
editable: true,
.map(|(idx, (name, trace_ids))| {
// Pick representative trace: highest best_confidence among group traces
let rep_trace = trace_ids.iter()
.filter_map(|tid| trace_best_conf.get(tid).map(|c| (tid, c)))
.max_by(|a, b| a.1.partial_cmp(b.1).unwrap_or(std::cmp::Ordering::Equal))
.map(|(tid, _)| *tid)
.or_else(|| trace_ids.first().copied())
.unwrap_or(0);
FaceGroup {
group_id: (idx + 1) as i32,
name,
trace_count: trace_ids.len() as i32,
representative_trace: rep_trace,
trace_ids: if include_trace_ids {
Some(trace_ids)
} else {
None
},
editable: true,
}
})
.collect();
@@ -1654,6 +1683,28 @@ pub async fn get_cluster_results_handler(
map
};
// Load best_confidence per trace from face_traced.json (for representative selection)
let cluster_trace_conf: HashMap<i32, f64> = {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let mut map = HashMap::new();
let traced_path = format!("{}/{}.face_traced.json", output_dir, file_uuid);
if let Ok(content) = std::fs::read_to_string(&traced_path) {
if let Ok(traced) = serde_json::from_str::<serde_json::Value>(&content) {
if let Some(traces) = traced.get("traces").and_then(|v| v.as_array()) {
for t in traces {
if let (Some(tid), Some(conf)) = (
t.get("trace_id").and_then(|v| v.as_i64()),
t.get("best_confidence").or(t.get("avg_confidence")).and_then(|v| v.as_f64()),
) {
map.insert(tid as i32, conf);
}
}
}
}
}
map
};
// Build trace_id -> name mapping before consuming filtered_groups
let trace_to_name: HashMap<i32, String> = filtered_groups
.iter()
@@ -1672,7 +1723,12 @@ pub async fn get_cluster_results_handler(
cluster_id: group_id,
name,
trace_count: trace_ids.len() as i32,
representative_trace: trace_ids.first().copied().unwrap_or(0),
representative_trace: trace_ids.iter()
.filter_map(|tid| cluster_trace_conf.get(tid).map(|c| (tid, c)))
.max_by(|a, b| a.1.partial_cmp(b.1).unwrap_or(std::cmp::Ordering::Equal))
.map(|(tid, _)| *tid)
.or_else(|| trace_ids.first().copied())
.unwrap_or(0),
trace_ids,
similarity,
}