From e987fb8119c01a7163b77aa607026c6ebaa39184 Mon Sep 17 00:00:00 2001 From: Accusys Date: Thu, 1 Oct 2026 02:45:44 +0800 Subject: [PATCH] fix: TKG bbox reading from Qdrant payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 問題: - TKG 從 Qdrant 讀取 bbox 時,期望 payload['bbox']['x'] - 但實際 Qdrant payload 結構是 payload['x'] - 導致所有 bbox 值為 0.0 - trace_profile.json 的 best_bbox 和 avg_bbox 為 null - key_face.jpg 無法生成 修復: - parse_face_points: 直接從 payload 讀取 x, y, width, height - get_representative_frame: 同樣修復 影響: - 修復後,TKG 能正確讀取 bbox - best_bbox 和 avg_bbox 將有正確數據 - key_face.jpg 能正常生成 - PeopleView 頁面能正常顯示人臉縮略圖 參考: - 修復請求文檔:/Users/accusys/momentry_studio/docs/TKG_BBOX_WRITE_FIX_REQUEST.md - 問題診斷:Qdrant payload 結構不匹配 感謝 Studio Team 的詳細問題報告! --- src/core/processor/tkg.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/core/processor/tkg.rs b/src/core/processor/tkg.rs index 988fecc4..b8e526e1 100644 --- a/src/core/processor/tkg.rs +++ b/src/core/processor/tkg.rs @@ -109,11 +109,11 @@ fn parse_face_points(points: Vec) -> Vec { return None; } valid += 1; - let bbox = &payload["bbox"]; - let x = bbox["x"].as_f64().unwrap_or(0.0); - let y = bbox["y"].as_f64().unwrap_or(0.0); - let w = bbox["width"].as_f64().unwrap_or(0.0); - let h = bbox["height"].as_f64().unwrap_or(0.0); + // Read bbox directly from payload (not nested in "bbox" key) + let x = payload["x"].as_f64().unwrap_or(0.0); + let y = payload["y"].as_f64().unwrap_or(0.0); + let w = payload["width"].as_f64().unwrap_or(0.0); + let h = payload["height"].as_f64().unwrap_or(0.0); Some(FacePoint { trace_id: trace_id.unwrap(), frame: frame.unwrap(), @@ -3236,15 +3236,18 @@ pub async fn query_auto_representative_frame( .filter_map(|p| { let payload = &p["payload"]; let trace_id = payload["trace_id"].as_i64()? as i32; - let bbox = &payload["bbox"]; + let x = payload["x"].as_f64().unwrap_or(0.0) as i32; + let y = payload["y"].as_f64().unwrap_or(0.0) as i32; + let width = payload["width"].as_f64().unwrap_or(0.0) as i32; + let height = payload["height"].as_f64().unwrap_or(0.0) as i32; Some(FrameTraceInfo { trace_id, identity_uuid: None, name: None, - x: bbox["x"].as_f64().unwrap_or(0.0) as i32, - y: bbox["y"].as_f64().unwrap_or(0.0) as i32, - width: bbox["width"].as_f64().unwrap_or(0.0) as i32, - height: bbox["height"].as_f64().unwrap_or(0.0) as i32, + x, + y, + width, + height, confidence: payload["confidence"].as_f64().unwrap_or(0.5), }) })