docs: add face_tracker Rust status update

- ✅ Rust implementation complete (3/3 unit tests pass)
- ✅ Integrated into face processor
- ⚠️ Playground compilation error blocks integration testing
- Document 3 options for next steps
- Recommend Option A (fix Playground)
This commit is contained in:
Accusys
2026-09-27 02:20:15 +08:00
parent 74288a7ddd
commit 6ec6a93764
2 changed files with 233 additions and 0 deletions
@@ -0,0 +1,42 @@
use momentry_core::core::processor::face::FaceResult;
use momentry_core::core::processor::face_tracker::track_faces;
#[test]
fn test_rust_face_tracker_with_real_data() {
// 讀取測試數據
let json_str = std::fs::read_to_string("/tmp/test_input_no_trace.json")
.expect("Failed to read test input");
let mut result: FaceResult = serde_json::from_str(&json_str)
.expect("Failed to parse FaceResult");
println!("Processing {} frames", result.frames.len());
println!("Total faces: {}", result.total_faces);
// 檢查沒有 trace_id
let before_count = result.frames.iter()
.flat_map(|f| &f.faces)
.filter(|face| face.trace_id.is_some())
.count();
println!("Faces with trace_id before: {}/{}", before_count, result.total_faces);
assert_eq!(before_count, 0, "No faces should have trace_id initially");
// 執行 tracking
track_faces(&mut result, 0.3, 0.7, 100.0, true, None)
.expect("Tracking failed");
// 檢查結果
let after_count = result.frames.iter()
.flat_map(|f| &f.faces)
.filter(|face| face.trace_id.is_some())
.count();
println!("Faces with trace_id after: {}/{}", after_count, result.total_faces);
// 保存結果
let output = serde_json::to_string_pretty(&result).expect("Failed to serialize");
std::fs::write("/tmp/test_rust_output.json", output).expect("Failed to write");
println!("Output saved to /tmp/test_rust_output.json");
// 驗證
assert!(after_count > 0, "At least some faces should have trace_id after tracking");
}