feat: face fix deployment + trace_* regeneration + executor stderr filter fix
- swift_face.swift: frame rounding (.rounded()), conf 0.75, min_size 64 - trace_* directories regenerated for KOBA (37 traces, start_frame 5307) - executor.rs: stderr filter now logs all non-empty stderr (was discarding) - VAD not skippable in ASRX (main_fixed.py Step 2 always runs) - Step 2.5 sentence boundary refinement added - Cluster agent async endpoints + similarity transparency - Keyword search: relationship text extraction, priority ordering - Face fix handoff doc for Studio team
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
# Studio Bug Report: `get_trace_profile` 讀寫不一致
|
||||
|
||||
**Date**: 2026-07-27
|
||||
**Author**: Studio Team
|
||||
**Status**: 🔴 待修復
|
||||
**Priority**: High
|
||||
|
||||
---
|
||||
|
||||
## 問題描述
|
||||
|
||||
Studio 前端 rename face group 後,離開再回來選同一個檔案,名稱變回舊的。
|
||||
|
||||
## 影響
|
||||
|
||||
使用者 rename 的變更無法持久顯示。雖然 `trace_profiles.name` 已更新,但 `get_trace_profile` API 回傳的是舊的 `tkg_nodes.label`,導致前端 `loadClusterNames()` 用舊名覆蓋新名。
|
||||
|
||||
---
|
||||
|
||||
## 測試驗證
|
||||
|
||||
### 1. Rename
|
||||
```bash
|
||||
curl -X PUT "http://localhost:3002/api/v1/trace-profile/group" \
|
||||
-H "X-API-Key: $KEY" -H "Content-Type: application/json" \
|
||||
-d '{"file_uuid": "9cbeb112fcc5452e869755a539478061", "trace_ids": [1], "name": "SusanTest"}'
|
||||
```
|
||||
回傳:`{"success": true, "updated_count": 1}` ✅
|
||||
|
||||
### 2. 讀取單筆 profile(❌ 仍是舊名)
|
||||
```bash
|
||||
GET /api/v1/trace-profile?file_uuid=...&trace_id=1
|
||||
```
|
||||
回傳:`{"name": "Person_0"}` ← **錯誤,應為 "SusanTest"**
|
||||
|
||||
### 3. 讀取 face groups(✅ 是新名)
|
||||
```bash
|
||||
GET /api/v1/file/{uuid}/face-groups
|
||||
```
|
||||
回傳:`{"name": "SusanTest", "trace_ids": [1]}` ← **正確**
|
||||
|
||||
---
|
||||
|
||||
## 根因分析
|
||||
|
||||
### 寫入路徑(正確)
|
||||
`PUT /api/v1/trace-profile/group` → `update_trace_profile_group_handler`(profile.rs:228):
|
||||
```sql
|
||||
UPDATE trace_profiles SET name = $1 WHERE file_uuid = $2 AND trace_id = $3
|
||||
```
|
||||
寫入 `trace_profiles.name` ✅
|
||||
|
||||
### 讀取路徑 — 單筆(❌ 錯誤)
|
||||
`GET /api/v1/trace-profile` → `get_trace_profile_handler`(profile.rs:78-81):
|
||||
```sql
|
||||
SELECT label, external_id, properties FROM tkg_nodes
|
||||
WHERE file_uuid = $1 AND node_type = 'face_track'
|
||||
AND (external_id = $2 OR external_id = $3)
|
||||
```
|
||||
讀取 `tkg_nodes.label`,**沒有 JOIN `trace_profiles`** ❌
|
||||
|
||||
### 讀取路徑 — 群組(✅ 正確)
|
||||
`GET /api/v1/file/{uuid}/face-groups` → `get_face_groups_handler`(profile.rs:560-566):
|
||||
```sql
|
||||
SELECT COALESCE(tp.name, tn.label) as name, tn.properties
|
||||
FROM tkg_nodes tn
|
||||
LEFT JOIN trace_profiles tp ON tp.file_uuid = tn.file_uuid
|
||||
AND tp.trace_id = (tn.properties->>'trace_id')::int
|
||||
WHERE tn.file_uuid = $1 AND tn.node_type = 'face_track'
|
||||
```
|
||||
使用 `COALESCE(tp.name, tn.label)`,優先取 `trace_profiles.name` ✅
|
||||
|
||||
---
|
||||
|
||||
## 前端影響流程
|
||||
|
||||
```
|
||||
User rename group → updateTraceProfileGroup() → PUT /trace-profile/group
|
||||
→ trace_profiles.name = "SusanTest" ✅
|
||||
|
||||
User refresh → loadClusterResults() → GET /face-groups
|
||||
→ cluster.name = "SusanTest" ✅
|
||||
→ loadClusterNames() → GET /trace-profile
|
||||
→ profile.name = "Person_0" ❌ (tkg_nodes.label)
|
||||
→ c.name = profile.name → "Person_0" ❌ 覆蓋了新名
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 建議修復
|
||||
|
||||
### 方案:改 `get_trace_profile_handler` 使用 JOIN
|
||||
|
||||
```rust
|
||||
pub async fn get_trace_profile_handler(...) {
|
||||
let tkg_table = schema::table_name("tkg_nodes");
|
||||
let tp_table = schema::table_name("trace_profiles");
|
||||
|
||||
let row: Option<(String, String, serde_json::Value)> = sqlx::query_as(&format!(
|
||||
"SELECT COALESCE(tp.name, tn.label) as name, tn.external_id, tn.properties \
|
||||
FROM {} tn \
|
||||
LEFT JOIN {} tp ON tp.file_uuid = tn.file_uuid \
|
||||
AND tp.trace_id = (tn.properties->>'trace_id')::int \
|
||||
WHERE tn.file_uuid = $1 AND tn.node_type = 'face_track' \
|
||||
AND (tn.external_id = $2 OR tn.external_id = $3)",
|
||||
tkg_table, tp_table
|
||||
))
|
||||
.bind(¶ms.file_uuid)
|
||||
.bind(&external_id_face)
|
||||
.bind(&external_id_trace)
|
||||
.fetch_optional(state.db.pool())
|
||||
.await?;
|
||||
|
||||
let (name, _ext_id, properties) = row.ok_or(StatusCode::NOT_FOUND)?;
|
||||
|
||||
Ok(Json(TraceProfile {
|
||||
file_uuid: params.file_uuid,
|
||||
trace_id: params.trace_id,
|
||||
name, // 改為使用 JOIN 後的 name
|
||||
// ... 其他欄位不變
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
### 一致性保證
|
||||
|
||||
| API | 讀取欄位 | 修復後 |
|
||||
|-----|---------|--------|
|
||||
| `PUT /trace-profile/group` | 寫入 `trace_profiles.name` | 不變 |
|
||||
| `GET /trace-profile` | ~~`tkg_nodes.label`~~ → `COALESCE(tp.name, tn.label)` | ✅ 一致 |
|
||||
| `GET /file/{uuid}/face-groups` | `COALESCE(tp.name, tn.label)` | 不變 |
|
||||
|
||||
---
|
||||
|
||||
## 相關文件
|
||||
- `18_profile.md` — Profile API 文件
|
||||
- `19_people_api.md` — People API 文件
|
||||
- `23_studio_face_group_name_fix.md` — Studio face-groups JOIN 修復
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
title: Sync Status Completed Logic Fix
|
||||
version: 1.0
|
||||
date: 2026-07-28
|
||||
author: Core Team
|
||||
status: draft
|
||||
---
|
||||
|
||||
# Sync Status "Completed" Logic Fix
|
||||
|
||||
## Problem
|
||||
|
||||
The `sync_file_status` endpoint (`POST /api/v1/file/:file_uuid/sync-status`) incorrectly returns `"completed"` status when some processor JSON files are missing.
|
||||
|
||||
### Root Cause
|
||||
|
||||
In `src/api/files.rs:1673-1753`, the `all_consistent` flag is only updated when `json_exists = true`:
|
||||
|
||||
```rust
|
||||
if json_exists {
|
||||
any_json_exists = true;
|
||||
// ... check consistency, set consistent ...
|
||||
if !consistent {
|
||||
all_consistent = false; // Only executed when JSON exists!
|
||||
}
|
||||
}
|
||||
// When json_exists = false: consistent = false, but all_consistent stays true
|
||||
```
|
||||
|
||||
This means if `asr.json` doesn't exist:
|
||||
- `consistent = false` (initialized at line 1676)
|
||||
- But the `if !consistent` block is never reached
|
||||
- `all_consistent` remains `true`
|
||||
- Status becomes `"completed"` instead of `"scanning"`
|
||||
|
||||
## Design
|
||||
|
||||
### Processor JSON Files (7 required)
|
||||
|
||||
| Processor | Filename | Special Cases |
|
||||
|-----------|----------|---------------|
|
||||
| ASR | `{uuid}.asr.json` | `"status": "no_audio_track"` or `"silent_audio"` |
|
||||
| ASRX | `{uuid}.asrx.json` | `"status": "no_audio_track"` |
|
||||
| OCR | `{uuid}.ocr.json` | Always exists if processor ran |
|
||||
| Pose | `{uuid}.pose.json` | Always exists if processor ran |
|
||||
| CUT | `{uuid}.cut.json` | Always exists if processor ran |
|
||||
| Face | `{uuid}.face.json` | `"status": "no_faces"` |
|
||||
| Face Cluster | `{uuid}.face_cluster.json` | `"status": "no_faces"` or `"no_embeddings"` |
|
||||
|
||||
**Key principle**: ALL processors produce their JSON files, even for special cases. The JSON file exists but may contain empty arrays or special status fields.
|
||||
|
||||
### Status Determination Logic
|
||||
|
||||
| Condition | Status |
|
||||
|-----------|--------|
|
||||
| All 7 JSONs exist AND all consistent AND has TKG edges | `agent_ready` |
|
||||
| All 7 JSONs exist AND all consistent AND no TKG edges | `completed` |
|
||||
| Any JSON exists (but not all, or not consistent) | `scanning` |
|
||||
| No JSON exists | `registered` |
|
||||
|
||||
### Fix
|
||||
|
||||
Move the `all_consistent` update outside the `json_exists` block:
|
||||
|
||||
```rust
|
||||
for (name, filename) in &processors {
|
||||
let path = ...;
|
||||
let json_exists = path.exists();
|
||||
let mut consistent = false;
|
||||
|
||||
if json_exists {
|
||||
any_json_exists = true;
|
||||
// ... check consistency, set consistent ...
|
||||
}
|
||||
|
||||
// MOVED HERE: JSON not existing = not consistent
|
||||
if !consistent {
|
||||
all_consistent = false;
|
||||
}
|
||||
|
||||
processor_status.insert(...);
|
||||
}
|
||||
```
|
||||
|
||||
## Impact
|
||||
|
||||
- **API**: No change to response format
|
||||
- **Behavior**: Files missing any JSON will show `"scanning"` instead of `"completed"`
|
||||
- **Backward compat**: No breaking changes
|
||||
|
||||
## Testing
|
||||
|
||||
1. File with all 7 JSONs → `completed` or `agent_ready`
|
||||
2. File with 6 JSONs (1 missing) → `scanning`
|
||||
3. File with no JSONs → `registered`
|
||||
4. Special case (no audio, no faces) → all JSONs exist with special status → `completed`
|
||||
@@ -18,9 +18,13 @@ Core 完成 trace_profiles UPSERT 修復後(`2026-07-31_trace_profile_upsert_f
|
||||
| # | Studio 呼叫 | Core 端點 | 狀態 |
|
||||
|---|-------------|-----------|------|
|
||||
| 1 | `get_cluster_results` | `GET /api/v1/cluster-results?file_hash=` | ❌ 404 (Core 無此端點) |
|
||||
| 2 | `get_identity_matches` | `GET /api/v1/identity-matches?file_hash=` | ❌ 404 (Core 無此端點) |
|
||||
| 2 | `get_identity_matches` | `GET /api/v1/identity-matches?file_hash=` | ⏹️ **已不使用** (identity/TMDB 功能停用,僅殘留呼叫) |
|
||||
| 3 | `get_similar_face_groups` | `GET /api/v1/file/:file_uuid/face-groups/similar` | ⚠️ 逾時 (183K points 全量 scroll) |
|
||||
|
||||
> **2026-07-31 更新**:斷點 2 (identity-matches / TMDB) 確認**已不使用**。
|
||||
> identity 與 TMDB 功能已停用;Studio 端該呼叫是殘留程式碼,
|
||||
> 404 時被 `try/catch` 吞掉,不影響任何流程,**不需處理**。
|
||||
|
||||
---
|
||||
|
||||
## 二、斷點 1:`cluster-results`(影響最大)
|
||||
@@ -107,35 +111,19 @@ Core 完全沒有 `cluster-results` 端點(`grep cluster-results src/` 無結
|
||||
|
||||
---
|
||||
|
||||
## 三、斷點 2:`identity-matches`
|
||||
## 三、斷點 2:`identity-matches`(⏹️ 已不使用,不需處理)
|
||||
|
||||
### Studio 端呼叫
|
||||
> **2026-07-31**:identity / TMDB 功能已停用。以下記錄僅供留存,**不需任何修改**。
|
||||
|
||||
- `momentry_studio/src/api/index.ts:465-467`
|
||||
```typescript
|
||||
case 'get_identity_matches': {
|
||||
return { url: `/api/v1/identity-matches?file_hash=${a.fileHash}`, method: 'GET' }
|
||||
}
|
||||
```
|
||||
### 殘留呼叫位置(僅供留存)
|
||||
|
||||
- `momentry_studio/src/views/PeopleView.vue:943-970`:抓 TMDB identity 建議,
|
||||
對每個 cluster 統計 trace → suggestion 的 `group_uuid` 映射,取最高頻者設為
|
||||
`c.tmdb_name` / `c.tmdb_uuid` / `c.tmdb_count`。
|
||||
|
||||
### Studio 預期回應格式(PeopleView.vue:945-946)
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"suggestions": {
|
||||
"12": { "group_uuid": "tmdb-xxx", "name": "Alice" }, // key = trace_id (string)
|
||||
"34": { "group_uuid": "tmdb-xxx", "name": "Alice" }
|
||||
}
|
||||
}
|
||||
```
|
||||
- `momentry_studio/src/api/index.ts:465-467` → `get_identity_matches`
|
||||
- `momentry_studio/src/views/PeopleView.vue:943-970` → 抓 TMDB identity 建議
|
||||
並設 `c.tmdb_name` / `c.tmdb_uuid` / `c.tmdb_count`
|
||||
|
||||
### Core 現況
|
||||
|
||||
Core 無此端點。若無法提供,**影響有限**:Studio 已用 `try/catch` 包住
|
||||
Core 無此端點。Studio 已用 `try/catch` 包住
|
||||
(line 970 `catch { /* no identity matches available */ }`),
|
||||
404 時只是 TMDB 名稱建議不顯示,不阻斷 face group 流程。
|
||||
|
||||
@@ -186,7 +174,7 @@ Core 有端點(`src/api/profile.rs:1329`,handler `get_similar_group_handler`
|
||||
| B | Studio 改用 `GET /file/:file_uuid/face-groups` + 另行組 `frames[]` | Studio team |
|
||||
| C | 暫緩,僅記錄。cluster-results 404 時 face group 列表不顯示 | 維持現狀 |
|
||||
|
||||
`identity-matches` 影響最小(已 try/catch),`similar` 為效能問題需 Core 優化 scroll。
|
||||
`identity-matches` 已不使用(不需處理);`similar` 為效能問題需 Core 優化 scroll。
|
||||
|
||||
---
|
||||
|
||||
@@ -194,4 +182,5 @@ Core 有端點(`src/api/profile.rs:1329`,handler `get_similar_group_handler`
|
||||
|
||||
| Version | Date | Author | Changes |
|
||||
|---------|------|--------|---------|
|
||||
| 1.1 | 2026-07-31 | OpenCode | 標記斷點 2 (identity-matches/TMDB) 已不使用,不需處理 |
|
||||
| 1.0 | 2026-07-31 | OpenCode | Initial analysis report |
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Studio 修復文件:Face Group 縮圖載入優化
|
||||
|
||||
## 問題描述
|
||||
|
||||
Face Group 卡片縮圖載入緩慢,大量空缺。之前曾修復過但現在又變慢。
|
||||
|
||||
## 根因分析
|
||||
|
||||
`src/store.ts` 的 `loadTraceThumb` 使用舊 API:
|
||||
|
||||
```js
|
||||
const result = await apiCall('get_face_thumbnail', args) // ffmpeg crop,慢
|
||||
```
|
||||
|
||||
應改用 trace-thumb 端點直接讀取預先裁剪的 `key_face.jpg`:
|
||||
|
||||
```
|
||||
/api/v1/trace-thumb/{file_uuid}/{trace_id} // 直接讀檔,~5ms
|
||||
```
|
||||
|
||||
## 修復內容
|
||||
|
||||
**檔案:** `src/store.ts`
|
||||
|
||||
**修改 `loadTraceThumb` 函數(約 line 588-610):**
|
||||
|
||||
```js
|
||||
export function loadTraceThumb(t: any) {
|
||||
if (!t.file_uuid || t.trace_id === undefined || t.trace_id === null) return
|
||||
const key = `${t.trace_id}-${t.file_uuid}-${t.best_face_id || 0}`
|
||||
if (faceThumbsCache.value[key] || loadingFaceThumbs.has(key)) return
|
||||
loadingFaceThumbs.add(key)
|
||||
queueThumb(async () => {
|
||||
try {
|
||||
// 改用 trace-thumb 端點(直接讀 key_face.jpg,~5ms)
|
||||
const url = `/api/v1/trace-thumb/${t.file_uuid}/${t.trace_id}`
|
||||
const resp = await fetch(url)
|
||||
if (resp.ok) {
|
||||
const blob = await resp.blob()
|
||||
const dataUrl = URL.createObjectURL(blob)
|
||||
faceThumbsCache.value[key] = dataUrl
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('loadTraceThumb failed:', key, e)
|
||||
} finally {
|
||||
loadingFaceThumbs.delete(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## 預期效果
|
||||
|
||||
| 指標 | 修改前 | 修改後 |
|
||||
|------|--------|--------|
|
||||
| 單張縮圖 | ~500ms (ffmpeg) | ~5ms (讀檔) |
|
||||
| 133 張群組縮圖 | ~66s (排隊) | <1s (並行) |
|
||||
| 空缺數量 | 大量 | 0 |
|
||||
|
||||
## 驗證步驟
|
||||
|
||||
1. 打開 Charade 檔案的 People View
|
||||
2. Face Group 卡片應立即顯示縮圖,無空缺
|
||||
3. Network tab 檢查 `/api/v1/trace-thumb/` 請求回應時間應 < 10ms
|
||||
@@ -0,0 +1,95 @@
|
||||
# Studio 修復文件
|
||||
|
||||
## 問題:FS Player Seek 位置錯誤
|
||||
|
||||
### 根因
|
||||
剪輯影片的 videoFps 偵測不準確(`getVideoPlaybackQuality().totalVideoFrames` 只反映已解碼幀數)。
|
||||
|
||||
### 檔案
|
||||
`src/components/VideoPlayer.vue`
|
||||
|
||||
### 修改 onLoaded 函數(約 line 1196-1234)
|
||||
|
||||
```js
|
||||
async function onLoaded() {
|
||||
const el = videoEl.value
|
||||
if (!el) return
|
||||
|
||||
// 優先順序:
|
||||
// 1. Trace-derived fps ← 最準確(來自 trace 的 frame/sec 資料)
|
||||
// 2. get_file_info.fps ← DB 儲存的實際 fps(已修正為 nb_frames/duration)
|
||||
// 3. Clip 偵測 ← 最後手段(可能不準確)
|
||||
const knownFps = resolveKnownFps()
|
||||
if (knownFps >= 1) {
|
||||
videoFps.value = knownFps
|
||||
} else {
|
||||
let fileFps = 0
|
||||
const fu = curFileUuid.value || props.fileUuid
|
||||
if (fu && fu !== 'undefined') {
|
||||
try {
|
||||
const info: any = await apiCall('get_file_info', { uuid: fu })
|
||||
fileFps = Number(info?.fps)
|
||||
} catch { /* fall back below */ }
|
||||
}
|
||||
if (fileFps >= 1) {
|
||||
videoFps.value = fileFps
|
||||
} else if (el.getVideoPlaybackQuality) {
|
||||
// @ts-ignore - webkitVideoDecodedByteCount etc. are non-standard
|
||||
const quality = el.getVideoPlaybackQuality()
|
||||
if (quality.totalVideoFrames > 0 && el.duration > 0) {
|
||||
videoFps.value = Math.round(quality.totalVideoFrames / el.duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seekFrame.value !== null) {
|
||||
el.currentTime = seekFrame.value / videoFps.value
|
||||
} else {
|
||||
el.currentTime = 0
|
||||
}
|
||||
|
||||
el.play().catch(() => {})
|
||||
}
|
||||
```
|
||||
|
||||
### 輔助函數 resolveKnownFps(trace-derived fps)
|
||||
|
||||
```js
|
||||
function resolveKnownFps(): number {
|
||||
let t = props.allTraces[currentTraceIdx.value]
|
||||
if (!t && playMode.value === 'segment') {
|
||||
const s = props.mergedSegments[currentSegmentIdx.value]
|
||||
t = props.allTraces[s?._startIdx]
|
||||
}
|
||||
if (!t) t = props.allTraces[0]
|
||||
const tf = getTraceFps(t)
|
||||
return tf >= 1 ? tf : 0
|
||||
}
|
||||
```
|
||||
|
||||
### 輔助函數 getTraceFps(FS0-safe)
|
||||
|
||||
```js
|
||||
function getTraceFps(t: any): number {
|
||||
if (!t) return 30
|
||||
const lf = t.last_frame !== undefined && t.last_frame !== null ? t.last_frame : 0
|
||||
const ff = t.first_frame !== undefined && t.first_frame !== null ? t.first_frame : 0
|
||||
const ls = t.last_sec !== undefined && t.last_sec !== null ? t.last_sec : 0
|
||||
const fs = t.first_sec !== undefined && t.first_sec !== null ? t.first_sec : 0
|
||||
const frameDiff = lf - ff
|
||||
const secDiff = ls - fs
|
||||
if (secDiff <= 0 || frameDiff <= 0) return 30
|
||||
return frameDiff / secDiff
|
||||
}
|
||||
```
|
||||
|
||||
### 核心修改
|
||||
- **優先順序正確**:Trace-derived fps(最準確)→ `get_file_info.fps`(DB 正確值)→ Clip 偵測(最後手段)。
|
||||
- **FS Player 播放 trace 時**使用 trace 本身的 fps(來自 trace 的 `first/last_frame` + `first/last_sec`)。
|
||||
- **完整影片播放時**使用 DB 的正確 fps。
|
||||
- **只有在以上都失敗時**才用 clip 偵測。
|
||||
- `getTraceFps` 改為 FS0-safe(顯式 `undefined/null` 檢查,取代 `||`,避免 trace_id 0 / frame 0 被當成 falsy)。
|
||||
|
||||
## 驗證
|
||||
- 打開 FS Player,Console 檢查 videoFps 應 ≈ 30
|
||||
- Seek 到第一幀,顯示 frame number 應與 Library 一致
|
||||
@@ -0,0 +1,142 @@
|
||||
# Studio 配套修復文件 - 2026-08-02
|
||||
|
||||
## 概述
|
||||
|
||||
本文檔記錄 Studio 已實作的修復,以配合 Core API 的變更並解決已知問題。
|
||||
|
||||
---
|
||||
|
||||
## 修復 1: Face Group 縮圖載入優化
|
||||
|
||||
### 問題
|
||||
Face Group 卡片縮圖載入緩慢,大量空缺(Charade 133 groups 中 ~76% placeholder)。
|
||||
|
||||
### 根因
|
||||
阻塞式分頁抓取 + key 不一致導致 rep 縮圖無法命中快取,非單純端點速度問題。
|
||||
|
||||
### 實際實作(4 項)
|
||||
|
||||
**1a. loadTraceThumb key 簡化**
|
||||
- 檔案:`/Users/accusys/momentry_studio/src/store.ts:588-610`
|
||||
- 修改:key 從 `${trace_id}-${file_uuid}-${best_face_id}` 簡化為 `${file_uuid}-${trace_id}`
|
||||
- 原因:避免合成/真實 rep_trace key 不一致導致快取未命中
|
||||
|
||||
**1b. loadClusterResults() 立即載入 rep 縮圖**
|
||||
- 檔案:`/Users/accusys/momentry_studio/src/views/PeopleView.vue:949-957`
|
||||
- 修改:從 cluster-results payload 立即載入 rep 縮圖,不需等慢速 map
|
||||
|
||||
**1c. faceGroups computed 合成 rep_trace**
|
||||
- 檔案:`/Users/accusys/momentry_studio/src/views/PeopleView.vue:670-681`
|
||||
- 修改:map 查無 rep 時合成 rep_trace(map 只抓前 1000 筆,Charade 133 groups 中 101 個 rep 落於其後)
|
||||
|
||||
**1d. buildClusterTracesMap() 背景並行**
|
||||
- 檔案:`/Users/accusys/momentry_studio/src/views/PeopleView.vue:1000-1045`
|
||||
- 修改:Promise.all 並行 10 頁,只服務 cluster detail strip
|
||||
|
||||
### 預期效果
|
||||
| 指標 | 修改前 | 修改後 |
|
||||
|------|--------|--------|
|
||||
| 根因 | ~50s 阻塞 | **已消除** |
|
||||
| placeholder 比例 | ~76% | **0%** |
|
||||
|
||||
---
|
||||
|
||||
## 修復 2: FS Player Seek 位置錯誤
|
||||
|
||||
### 問題
|
||||
FS Player 播放剪輯影片時,frame number 顯示錯誤。
|
||||
|
||||
### 根因
|
||||
VideoPlayer fps 偵測優先序不當,導致剪輯影片使用不準確的 clip 偵測值。
|
||||
|
||||
### 實際實作
|
||||
|
||||
**檔案:** `/Users/accusys/momentry_studio/src/components/VideoPlayer.vue:1218`
|
||||
|
||||
**Fps 優先序:**
|
||||
1. **Trace-derived fps**(最準確,來自 trace frame/sec 資料)
|
||||
2. **get_file_info.fps**(DB 儲存值,已修正為 nb_frames/duration)
|
||||
3. **Clip 偵測**(最後手段,`totalVideoFrames / duration`,剪輯含 padding 不可靠)
|
||||
|
||||
**註:** 原 doc 建議 clip 模式 `fps = (endF - startF) / duration` 已棄用。
|
||||
|
||||
---
|
||||
|
||||
## 修復 3: FS Detail Key Frame Loading 指示器
|
||||
|
||||
### 問題
|
||||
打開 FS Detail 時,key face 縮圖載入中沒有顯示 Loading 狀態。
|
||||
|
||||
### 實際實作
|
||||
|
||||
**共用 store + 既有元件:**
|
||||
- 使用 `loadingFaceThumbs.has(thumbTraceKey(...))` 取代獨立 ref
|
||||
- 使用既有 `spinner-sm`(`/Users/accusys/momentry_studio/src/views/PeopleView.vue:141`)
|
||||
- `loadCandidateThumb`(`:1065`)委派給 `loadTraceThumb`
|
||||
- **移除** 原 doc 建議的獨立 `loadingCandidateThumb` ref + 新 CSS
|
||||
|
||||
---
|
||||
|
||||
## 修復 4: ASRX 字幕對時
|
||||
|
||||
### 問題
|
||||
ASRX 字幕與影片不同步,Charade 錯位約 ×1.25。
|
||||
|
||||
### 根因
|
||||
ASRX `start_frame` 基底各檔不一:
|
||||
- **Charade**(44c37c078d6562d226003d9a44c72eca):ASRX=30fps 基底 vs 影片 23.976fps(DB 確認 fps=23.976023976023978),ASRX 幀數 203148 > 影片總幀數 162696
|
||||
- **其餘 13/14 檔**:基底相符,無此問題
|
||||
|
||||
### 實際實作
|
||||
|
||||
**檔案:** `/Users/accusys/momentry_studio/src/components/VideoPlayer.vue`
|
||||
|
||||
**改以秒數比對(fps 無關):**
|
||||
- Mark interface 加 `startSec/endSec`(`:301-302`)
|
||||
- `loadProcessorMarks`(`:352-366`)
|
||||
- `currentAsrxMark`(`:460-468`)
|
||||
- `getMarkStyle` / `goToMark` / `isMarkActive`
|
||||
- `asrxStartFrame` / `asrxEndFrame`(`:471-479`)
|
||||
- Speaker 改用 `speaker_id`
|
||||
|
||||
---
|
||||
|
||||
## 狀態總覽
|
||||
|
||||
### Core API
|
||||
| 項目 | 狀態 |
|
||||
|------|------|
|
||||
| DB fps 修正(nb_frames/duration) | ✅ 已完成 |
|
||||
| `trace-thumb` 端點 | ✅ 已完成 |
|
||||
| TKG key_face.jpg 重建 | ✅ 已完成 |
|
||||
| Proxy 自動轉發 `/api/*` | ✅ 已完成 |
|
||||
|
||||
### Studio
|
||||
| 項目 | 狀態 | 實測 |
|
||||
|------|------|------|
|
||||
| Face Group 縮圖 | ✅ 已完成 | "good" |
|
||||
| FS Player Seek | ✅ 已完成 | 正常 |
|
||||
| FS Detail Loading | ✅ 已完成 | 正常 |
|
||||
| ASRX 字幕對時 | ✅ 已完成 | Charade "so far so good" |
|
||||
|
||||
---
|
||||
|
||||
## 驗證步驟
|
||||
|
||||
### Face Group 縮圖
|
||||
1. 打開 Charade Face Groups
|
||||
2. 所有卡片應立即顯示縮圖,無 placeholder
|
||||
|
||||
### FS Player Seek
|
||||
1. 播放任意 trace
|
||||
2. Frame number 應與 Library 顯示一致
|
||||
3. Console `videoFps` 應接近實際 fps(非 60)
|
||||
|
||||
### FS Detail Loading
|
||||
1. 打開 FS Detail
|
||||
2. 應顯示 spinner-sm 動畫後出現 key_face.jpg
|
||||
|
||||
### ASRX 字幕對時
|
||||
1. 播放 Charade(44c37c078d6562d226003d9a44c72eca)
|
||||
2. ASRX 字幕應與語音同步
|
||||
3. 其他檔案字幕也應正常
|
||||
@@ -0,0 +1,138 @@
|
||||
# Face Fix Handoff to Studio Team
|
||||
|
||||
**Date**: 2026-08-04
|
||||
**File**: KOBA 2022 Interview SBU Accusys Storage.mp4
|
||||
**UUID**: `5e207a246fd6a2a65ee0a267440465ee`
|
||||
**Status**: Core team completed, ready for Studio verification
|
||||
|
||||
---
|
||||
|
||||
## 修正摘要
|
||||
|
||||
### 1. Frame Numbering Fix
|
||||
- **問題**: `swift_face.swift` 使用 `Int(seconds * fps)` 無條件截斷,造成 frame 標號 off-by-one
|
||||
- **修正**: 改為 `Int((seconds * fps).rounded())` 四捨五入
|
||||
- **影響**: 所有 frame 標號 +0 或 +1(多數 +1)
|
||||
|
||||
### 2. Confidence Threshold
|
||||
- **修正前**: `MIN_CONFIDENCE = 0.6`
|
||||
- **修正後**: `MIN_CONFIDENCE = 0.75`
|
||||
- **影響**: 誤報下降,trace 總數從 55 → 37
|
||||
|
||||
### 3. Min Bbox Size
|
||||
- **修正前**: `MIN_SIZE = 20px`
|
||||
- **修正後**: `MIN_SIZE = 64px`
|
||||
- **影響**: 過小的人臉框被過濾
|
||||
|
||||
---
|
||||
|
||||
## 基準數據 vs 修正後
|
||||
|
||||
| 項目 | 修正前(Jul 30) | 修正後(Aug 4) |
|
||||
|------|-----------------|----------------|
|
||||
| face.json faces | - | 1206 |
|
||||
| frame mismatch | - | 0/1098 |
|
||||
| face_traced.json traces | 55 | 37 |
|
||||
| min confidence | 0.6 | 0.7503 |
|
||||
| min bbox size | 20px | 64px |
|
||||
| Qdrant _faces points | 1397 | 1206 |
|
||||
|
||||
---
|
||||
|
||||
## Trace ID 變更(重要)
|
||||
|
||||
由於 confidence 門檻調升,trace 編號已重新指派。Studio 端的 FS#33(原 frame 5306)現在對應新的 **trace_17**(frame 5307)。
|
||||
|
||||
### 原 FS#33 對應
|
||||
|
||||
| 項目 | 舊值 | 新值 |
|
||||
|------|------|------|
|
||||
| trace_id | 33 | **17** |
|
||||
| start_frame | 5306 | **5307** |
|
||||
| confidence | 0.842 | 0.8544 |
|
||||
| bbox | (717,169,159,159) | (717,169,159,159) — 相同 |
|
||||
|
||||
### 完整 trace 對應表
|
||||
|
||||
| 新 trace_id | start_frame | end_frame | frames | 備註 |
|
||||
|-------------|-------------|-----------|--------|------|
|
||||
| 0 | 159 | 315 | 40 | |
|
||||
| 1 | 319 | 523 | 52 | |
|
||||
| 2 | 527 | 647 | 31 | |
|
||||
| 3 | 651 | 903 | 64 | |
|
||||
| 4 | 907 | 951 | 12 | |
|
||||
| 5 | 1151 | 1475 | 82 | |
|
||||
| 6 | 1479 | 1807 | 83 | |
|
||||
| 7 | 2520 | 2679 | 40 | |
|
||||
| 8 | 2683 | 2779 | 24 | |
|
||||
| 9 | 2783 | 2919 | 35 | |
|
||||
| 10 | 2851 | 2871 | 6 | |
|
||||
| 11 | 2983 | 3075 | 24 | |
|
||||
| 12 | 2983 | 3067 | 22 | |
|
||||
| 13 | 3203 | 3211 | 3 | |
|
||||
| 14 | 3683 | 3747 | 16 | |
|
||||
| 15 | 4699 | 4915 | 55 | |
|
||||
| 16 | 4920 | 5303 | 97 | 原 FS#32? |
|
||||
| **17** | **5307** | **5635** | **83** | **原 FS#33(右受訪者)** |
|
||||
| 18 | 5640 | 5987 | 88 | |
|
||||
| 19 | 5995 | 6107 | 29 | |
|
||||
| 20 | 6187 | 6375 | 48 | |
|
||||
| 21 | 7020 | 7255 | 60 | |
|
||||
| 22 | 7260 | 7311 | 13 | |
|
||||
| 23 | 7283 | 7327 | 11 | |
|
||||
| 24 | 7323 | 7355 | 8 | |
|
||||
| 25 | 7335 | 7367 | 8 | |
|
||||
| 26 | 7367 | 7367 | 1 | |
|
||||
| 27 | 7415 | 7447 | 8 | |
|
||||
| 28 | 7587 | 7667 | 21 | |
|
||||
| 29 | 7587 | 7731 | 37 | |
|
||||
| 30 | 7675 | 7731 | 15 | |
|
||||
| 31 | 7735 | 7759 | 7 | |
|
||||
| 32 | 7939 | 7963 | 6 | |
|
||||
| 33 | 7967 | 8031 | 16 | |
|
||||
| 34 | 8035 | 8151 | 30 | |
|
||||
| 35 | 8035 | 8035 | 1 | |
|
||||
| 36 | 8047 | 8151 | 27 | |
|
||||
|
||||
---
|
||||
|
||||
## Studio 驗證步驟
|
||||
|
||||
### 1. Face Detail Modal 驗證
|
||||
1. 開啟 KOBA 影片的 People 頁面
|
||||
2. 找到 **trace_17**(start_frame=5307,原 FS#33)
|
||||
3. 點擊 trace 開啟 Face Detail modal
|
||||
4. 驗證:
|
||||
- **key_face.jpg** 顯示右受訪者
|
||||
- **bbox overlay** 框住右受訪者(bbox: 717,169,159,159)
|
||||
- key_face 與 bbox 對應的畫面一致
|
||||
|
||||
### 2. Frame 標號驗證
|
||||
1. 在 Face Detail modal 中查看 frame number
|
||||
2. 驗證 trace_17 的 start_frame = **5307**(非 5306)
|
||||
|
||||
### 3. 誤報驗證
|
||||
1. 隨機開啟 3-5 個 trace 的 Face Detail modal
|
||||
2. 驗證 key_face.jpg 確實顯示人臉(非誤報)
|
||||
|
||||
---
|
||||
|
||||
## 檔案位置
|
||||
|
||||
| 檔案 | 路徑 |
|
||||
|------|------|
|
||||
| face.json | `/Users/accusys/momentry/output/5e207a246fd6a2a65ee0a267440465ee.face.json` |
|
||||
| face_traced.json | `/Users/accusys/momentry/output/5e207a246fd6a2a65ee0a267440465ee.face_traced.json` |
|
||||
| face_cluster.json | `/Users/accusys/momentry/output/5e207a246fd6a2a65ee0a267440465ee.face_cluster.json` |
|
||||
| trace_* 目錄 | `/Users/accusys/momentry/output/5e207a246fd6a2a65ee0a267440465ee/trace_0/` ~ `trace_36/` |
|
||||
| key_frame.jpg | `trace_{id}/key_frame.jpg` |
|
||||
| key_face.jpg | `trace_{id}/key_face.jpg` |
|
||||
| trace_profile.json | `trace_{id}/trace_profile.json` |
|
||||
|
||||
---
|
||||
|
||||
## 備註
|
||||
|
||||
- trace_* 目錄已重新生成(37 個,對應新的 37 條 traces)
|
||||
- 所有 trace_profile.json 的 start_frame 使用修正後的 frame 標號
|
||||
- Qdrant _faces collection 已更新(1206 點,frame payload 正確)
|
||||
Reference in New Issue
Block a user