Commit Graph

169 Commits

Author SHA1 Message Date
Accusys 882e31ab96 feat: declarative pipeline config, non-blocking Scene VLM, rust_asrx
Consolidated snapshot (previously WIP in working tree).

- core/pipeline_config: new module loading config/pipeline_flows.json as the
  source of truth for stage execution mode (parallel/blocking) and dependencies
- worker/job_worker: dispatch Scene VLM to a background task when the stage is
  declared parallel, unblocking the worker poll loop; resolve processor
  dependencies from pipeline_flows.json (fallback to built-in)
- config/pipeline_flows.json: asrx depends on [cut, asr]
- scripts/fix_stuck_jobs: fix UTC timezone comparison, raise default threshold
  to 6h, skip jobs with recent processor activity
- rust_asrx: Rust speaker diarization CLI + processor wiring
- processor metadata helper; fast_face_clustering script; file_progress pipeline
  API; scan API; VAD updates
2026-10-15 13:01:12 +08:00
Accusys dc6081fcaf release: v1.3.4 - File Metadata Display & Queue Monitoring
Phase 1 Features:
- Add file_size and modified_time to videos table
- Display file metadata in /api/v1/files
- Queue monitoring script (auto-cleanup stuck commands)

Improvements:
- 188 files updated with metadata
- Queue monitoring runs every 5 minutes
- Auto-reset stuck commands (>1 hour)
- Auto-cleanup orphan commands

Documentation:
- Pipeline worker architecture analysis
- Refactor plan (Phase 2)
- Release checklist and test reports

Tested:
- All P0 tests passed
- API response time < 100ms
- Data coverage 99.5%
2026-10-12 23:29:47 +08:00
Accusys be8333d8f3 docs: 添加 pipeline worker 分析和监控脚本
添加文件:
- docs_v1.0/M4_workspace/2026-10-12_pipeline_worker_analysis.md: 架构分析和问题诊断
- docs_v1.0/M4_workspace/2026-10-12_pipeline_worker_fix_execution.md: 修复执行报告
- docs_v1.0/M4_workspace/2026-10-12_pipeline_worker_complete_solution.md: 完整解决方案
- scripts/monitor_command_queue.sh: 队列监控脚本(每 5 分钟自动检查)

更新:
- Cargo.lock: 依赖版本更新
2026-10-12 18:40:33 +08:00
Accusys b47f473db6 fix: 添加 file_size 和 modified_time 到 videos 表和 API
问题:
- /library 页面已注册文件卡片不显示 size 和 mdate
- 数据库 videos 表缺少 file_size 和 modified_time 列
- API 查询未返回这些字段

修复:
- 添加数据库迁移 (migrations/20261012_add_file_size_columns.sql)
- 修改 register_single_file() 获取并保存 file_size 和 modified_time
- 修改 list_files() API 查询包含新字段
- 创建脚本更新历史数据 (scripts/update_file_metadata.py)

影响:
- 新注册文件自动填充 size 和 mtime
- API 正确返回 file_size 和 modified_time
- 历史数据已批量更新 (188 个文件)

测试:
- API 测试通过
- 数据库验证通过
- 文件大小匹配验证通过
2026-10-12 17:07:48 +08:00
Accusys 8074bee4a1 docs: M4ProMini worker offline root cause analysis
- Identified plist hardcoded paths as root cause
- v1.3.2 code improvements insufficient (plist not modified)
- Added fix script: scripts/fix_m4promini_plist.sh
- Proposed v1.3.3 solution: plist templates
2026-10-12 15:44:32 +08:00
Accusys 63fbbe1225 release: v1.3.1 - Pipeline Queue Integration, OCR Fix, Worker Compatibility
Major Changes:
- Pipeline Queue integration completed (internal.file + pipeline.commands)
- Fixed old job_worker database compatibility with new command_queue table
- Compiled Swift OCR binary (was missing, causing empty OCR results)
- Added deep scan functionality through re-scan API

Fixes:
- Changed CommandJob.id from i32 to i64 for database compatibility
- Added UUID generation in create_command (message_id field)
- Fixed claim_pending_commands to query queue_name = 'internal.file'
- Fixed field mappings: command_id → message_id, job_type → command_type
- Added support for 'processing' status in CommandJobStatus

Queue System:
- internal.file queue: for register/unregister/re-scan commands (job_worker)
- pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker)

Documentation:
- Added comprehensive queue system documentation
- Created M4 workspace status reports
- Updated AGENTS.md with queue system details
2026-10-12 10:00:51 +08:00
Accusys a738b2d974 feat: 启用 Rust VAD 作为 ASRX 默认实现
变更:
- vad.py 默认值: USE_RUST_VAD=true
- .env 添加: MOMENTRY_USE_RUST_VAD=true
- Binary 路径更新: tools/cli/rust/target/release/rust_vad

性能提升:
- 单独 VAD: 1.9x faster (Python 1.09s → Rust 0.58s)
- 完整 ASRX: 1.1x faster (62.48s → 56.91s)

部署要求:
- tools/cli/rust/target/release/rust_vad (26M)
- /Users/accusys/models/silero_vad.onnx (2.2M)

回退机制:
- export MOMENTRY_USE_RUST_VAD=false

状态: ✅ 生产就绪,默认启用
影响: ASRX 处理流程
向后兼容: 是
2026-10-08 13:05:10 +08:00
Accusys e84d92d52c fix: remove hardcoded path in facenet_embedding.swift (A-4.2)
Problem:
- L24 had hardcoded model path as default_value
- Would cause D-4 failure (strings shows dev path)

Solution:
- Remove default_value
- Add runtime resolution:
  1. CLI --model argument
  2. MOMENTRY_MODELS_DIR env var
  3. Sibling of binary (models/facenet512.mlpackage)

Impact:
- Swift CLI now portable
- No dev path strings in binary
- D-4 Gate condition satisfied

Verification: grep shows 0 hardcoded paths
2026-10-04 19:31:51 +08:00
Accusys 2f5e2c1314 fix: resolve all P1 hardcoded model paths at runtime (A-4.2 P1)
Issues: 6 P1 locations with hardcoded model paths
- asr.rs:81 - whisper model
- scene_classification.rs:68 - resnet18 model
- qwen_vl_manager.rs:25,26 - Qwen model + mmproj
- rust_vad.rs:18 - silero_vad model
- facenet_embedding.swift:24 - already fixed (A-11)

Impact: Missing models cause silent degradation (A-12)
        No embeddings → TKG 0 nodes (020.mp4 root cause)

Solution: Use path_utils::resolve_asset_path for all model paths
- Resolves via MOMENTRY_MODELS_DIR env var
- Falls back to current_exe sibling
- Final fallback to models/ directory

Changes:
1. asr.rs: Resolve whisper model dir
2. scene_classification.rs: Resolve resnet18 model path
3. qwen_vl_manager.rs: Resolve Qwen model + mmproj paths
4. rust_vad.rs: Resolve silero_vad model via env or relative

Benefits:
- All P1 models now configurable via MOMENTRY_MODELS_DIR
- No more silent failures when models missing
- Models can be placed in release bundle

Verification:
- cargo check --lib passes
- cargo build --release --bin rust_vad passes

Next steps: Address P2 (41 locations) and P3 (35 locations)

References:
- A-4.2 P1 in Momentry_Release_Requirements_20261004.md v1.1
- A-11, A-12
- G-3 gate condition
2026-10-04 15:59:56 +08:00
Accusys 3399a137d8 fix: resolve FaceNet model path at runtime (A-4.2 P1, A-11, A-12)
Issues:
- facenet_embedding.swift:28 hardcoded model path
- face.rs:227-231 did not pass model path parameter
- face.rs:249-255 only logged warnings, causing silent degradation
- M4ProMini missing facenet512.mlpackage → embeddings all None → TKG 0 nodes

Changes:
1. facenet_embedding.swift:
   - Add --model option (default: models/facenet512.mlpackage)
   - Validate model file exists before loading
   - Print clear error message if missing

2. face.rs:
   - Use path_utils::resolve_asset_path for models dir
   - Pass --model argument to facenet_embedding
   - Validate model exists before running
   - Elevate errors from warn! to error! + bail!
   - Fail fast on embedding generation failure

Benefits:
- Runtime resolution via MOMENTRY_MODELS_DIR
- No silent degradation - missing model causes explicit error
- Clear error messages guide users to fix

Verification:
- cargo check --lib passes
- swift build -c release passes

Next steps:
- Add facenet512.mlpackage to release delivery (A-11 requirement 3)
- Update smoketest to verify embeddings != None (A-5.3)

References:
- A-4.2 P1 in Momentry_Release_Requirements_20261004.md v1.1
- A-11, A-12
- 020.mp4 diagnosis (appendix C)
2026-10-04 14:37:49 +08:00
Accusys a3c3ed8dc1 refactor: eliminate all CARGO_MANIFEST_DIR compile-time dependencies (A-4)
- Add src/core/path_utils.rs with runtime path resolution helpers
- Replace all env!("CARGO_MANIFEST_DIR") with runtime resolution
- Priority: env var -> current_exe sibling -> dev fallback

Changes:
- executor.rs: scripts_dir(), cli_dir() (4 locations)
- face.rs: swift_processor_path()
- tool_selector.rs: swift_binary_path()
- thumbnail/mod.rs: script_path()

Issue: CARGO_MANIFEST_DIR expands to build machine path at compile time,
       breaking on binary-only release hosts.

Solution: Resolve paths at runtime in this order:
1. Explicit environment variable (MOMENTRY_SCRIPTS_DIR, MOMENTRY_CLI_DIR)
2. Sibling of current_exe (same directory as running binary)
3. Relative path fallback (dev machine)

Verified: cargo check --lib passes
2026-10-04 13:44:40 +08:00
Accusys 3d363e6266 feat: add release build scripts and manifest (A-2, A-3)
- scripts/build_release.sh: Build 3 binaries + generate manifest
- scripts/sign_binaries.sh: Ad-hoc sign binaries for macOS
- RELEASE_MANIFEST.txt: Record binary sizes, MD5, SHA256

Solves:
- A-2: Release build now includes momentry, rust_register, rust_unregister
- A-3: Binaries are signed to avoid SIGKILL on release machines

Verified: M4ProMini deployment (2026-10-04)
2026-10-04 13:42:17 +08:00
Accusys 15fc356666 fix: handle metadata=None in face_tracker.py
Two places assumed metadata dict exists but didn't handle None value:
1. L455: dict.get('metadata', {}) returns None if key exists with None value
2. L467: 'metadata not in face_data' doesn't catch metadata=None

Fixes:
- Use 'or {}' pattern to handle None: (face_data.get('metadata') or {}).get(...)
- Use 'if not face_data.get("metadata")' to catch both missing and None
2026-10-02 17:10:25 +08:00
Accusys e0d04e242f feat: face clustering pipeline improvements and Rust/Swift face processing
- Add Rust face processor module (detection, embedding, tracking, qdrant)
- Add Facenet CoreML/ONNX conversion scripts and tests
- Refactor swift_face into Sources/swift_face with ArgumentParser support
- Update store_traced_faces to handle face.json correctly
- Fix ASRX parsing and TKG bbox reading from Qdrant
- Improve admin_config and trace_agent APIs
- Add M4 workspace docs for face clustering, dedup, and Facenet validation
- Fix worker heartbeat TTL (poll_interval x 3, min 60s) for offline detection
2026-10-02 12:24:55 +08:00
Accusys 4b694a1c2d remove: Portal project (Core Team 不再維護前端)
- 移除 portal/ 目錄 (Vue 3 + Tauri 前端)
- 更新 AGENTS.md 移除 Portal 相關說明
- 更新代碼註釋移除 Portal 引用
- 前端開發統一由 Studio Team 負責

參考: docs_v1.0/OPERATIONS/GUI_ARCHITECTURE_REVIEW.md
2026-09-30 18:59:40 +08:00
Accusys e95cdcc673 fix: add bbox validation in Swift Face processor
問題:
- Face detection 輸出無效 bbox (width=0, height=0)
- 導致 face tracing 失敗
- 所有 faces trace_id = -1

修復:
- ✅ 添加 bbox 驗證邏輯
- ✅ 過濾 width <= 0 或 height <= 0 的 bbox
- ✅ 添加警告日誌
- ✅ 修復 swift_face_pose.swift 類型錯誤

影響文件:
- scripts/swift_processors/swift_face.swift
- scripts/swift_processors/swift_face_pose.swift

狀態: ✅ 已修復,需要重新處理受影響的文件
2026-09-29 01:03:54 +08:00
Accusys 9823cd4328 analysis: deep scan trace_id=-1 issue
問題鏈:
1. Qdrant trace_id 全部為 -1 (40 個 faces)
2. rust_face_cluster 過濾所有 faces (trace_id >= 0)
3. 沒有 trace_profiles 生成
4. Worker 無限循環 (trace_stability = 0)
5. Deep scan 卡死

數據證據:
- Qdrant: trace_id=-1: 40 faces (100%)
- rust_face_cluster: Found 0 unique traces
- processor_results: 只有 scene_vlm
- 輸出文件: 全部缺失
- Worker: 無限循環,每 2 秒檢查一次

修復:
- ✅ Python 腳本修復 (face_clustering_processor.py)
- ✅ 問題定位完成
- ⏳ 等待決策: 方案 A (重置) 或 方案 B (調試)

文檔:
- docs_v1.0/M4_workspace/2026-09-28_deep_scan_trace_id_issue.md
- docs_v1.0/M4_workspace/2026-09-28_deep_scan_final_summary.md

狀態: ⚠️ Critical - 等待 M4 決策
2026-09-28 20:55:35 +08:00
Accusys 3ab65a698a fix: update MediaPipe Pose to v1.0.0 API
問題:
- MediaPipe 1.0.0 使用新 API (tasks.vision)
- 舊 API (solutions) 不存在

修復:
- ✅ 使用 PoseLandmarker (新 API)
- ✅ 使用 pose_landmarker_heavy.task 模型
- ✅ model_complexity=2 (最高準確率)

模型:
- 下載位置: ~/models/mediapipe/
- 大小: 29 MB

測試:
- ✅ 初始化成功
- ✅ 支持 GPU (Metal) 加速

API:
- mp.tasks.vision.PoseLandmarker
- RunningMode.VIDEO
- 33 個關鍵點
2026-09-28 00:26:40 +08:00
Accusys 33ee2d37c9 feat: add MediaPipe Pose support (highest accuracy)
問題:
- Apple Vision Pose 準確率太低
- YOLOv8 Pose 效果也不好
- 需要 MediaPipe Pose (Google)

新增:
- ✅ pose_processor_mediapipe.py (Python)
- ✅ Worker 支持 MediaPipe Pose
- ✅ model_complexity=2 (最準確)

處理器優先級:
1. MediaPipe Pose (最高準確率) ← 新增
2. Rust Pose
3. Swift Pose (Apple Vision)
4. Python YOLOv8

技術:
- MediaPipe Pose: 33 關鍵點
- 支持遮擋和困難姿勢
- CPU 運算(較慢但準確)

測試:
- ✅ 編譯成功
- ⚠️ 需要實際測試準確率
2026-09-28 00:15:49 +08:00
Accusys 30b9a400ae fix: generate traces field when face.json already has trace_id
問題:
- face.json 已包含 trace_id (來自 Rust face_tracker)
- store_traced_faces.py 直接複製,跳過 traces 字段生成
- Worker 檢查 traces 字段判斷 trace_done
- 因缺少 traces 字段,trace_done=false,阻塞 TKG 構建

修復:
- ✅ 即使 face.json 有 trace_id,仍生成 traces 字段
- ✅ 從 faces 提取 trace_id,構建 traces dict
- ✅ 包含 start_frame, end_frame, duration 等信息
- ✅ Worker 可正確判斷 trace_done

影響:
- 修復 020.mp4 卡在 40% 的問題
- 確保 TKG 和後續流程可以繼續
2026-09-27 21:56:22 +08:00
Accusys 1f1522c5ef fix: handle both list and dict formats in store_traced_faces.py
問題:
- face_clustering_processor.py 生成的 frames 是列表格式
- store_traced_faces.py 期望 frames 是字典格式
- 導致 AttributeError: 'list' object has no attribute 'items'

修復:
- 添加格式判斷,支持列表和字典兩種格式
- 向後兼容舊格式

測試:
- ✅ 腳本運行成功
- ✅ 不再報錯

影響:
- Face Deduplication 可以正常執行
- 後續 TKG, Rule2, VLM Summary 可以繼續
2026-09-27 14:50:14 +08:00
Accusys 82c400ed6c fix: migrate TKG Builder to V4.0 architecture (Qdrant)
Problem: TKG Builder used deprecated face_detections table
Solution: Migrated to Qdrant _faces collection

Changes:
- Added qdrant_faces module import
- Replaced SQL queries with Qdrant API calls
- Updated build_face_track_nodes to use get_file_faces()
- Updated build_co_occurrence_edges to fetch from Qdrant
- Updated build_speaker_face_edges to calculate trace spans from Qdrant
- Updated build_face_face_edges to find co-occurrences in Python
- Updated build_face_body_edges to fetch face data from Qdrant
- Changed default schema from 'dev' to 'public'
- Changed default output_dir to /Users/accusys/momentry/output

Test results:
- ✅ Successfully created 7 face_track nodes
- ✅ Successfully created 6 face-face co-occurrence edges
- TKG Builder now works with V4.0 architecture

Related: #V4.0-migration
2026-09-27 10:59:23 +08:00
Accusys 3ed4cb38b3 feat: add common language polling for ASR
Features:
- New --try-common-languages flag for smart language detection
- Tries en, zh, ja when auto-detection fails or quality is poor
- Quality scoring based on avg_logprob, no_speech_prob, segment count
- Automatically selects best result from all attempts

Quality metrics:
- avg_logprob (higher is better)
- no_speech_prob (lower is better)
- segment count (more is better)

Use case:
- Fixes garbled output from wrong language detection
- Prevents Sinhala character output for Japanese audio
- Provides better language detection for common languages
2026-09-27 05:19:23 +08:00
Accusys ba18f4c403 feat: upgrade ASR to large-v3 model + add vocal separation
- Upgrade Whisper model: small -> large-v3
- Add --language parameter for forced language detection
- Add --separate-vocals for demucs vocal separation
- Add preprocess_audio.py utility
- Fix Japanese detection failure issue
- Improve transcription accuracy significantly

Usage:
  python3 scripts/asr_processor.py video.mp4 output.json --language ja --separate-vocals
2026-09-27 04:40:15 +08:00
Accusys 4f60e7ae96 docs: add Whisper Japanese detection failure analysis
- Analyze why Whisper detected 'nn' instead of Japanese
- Document root causes: poor audio quality, high noise, model confusion
- Provide diagnostic tool (analyze_whisper_language.py)
- Document 4 solutions: force language, audio preprocessing, model upgrade, parameter tuning
- Recommend integration into Momentry ASR pipeline
2026-09-27 04:22:25 +08:00
Accusys 5b76b3e647 fix: store_traced_faces.py skips tracking if trace_id exists
- Check if face.json already has trace_id (from Rust face_tracker)
- Skip Python tracking if traces already assigned
- Prevent duplicate tracking and preserve Rust results
- Support both list (FaceResult) and dict formats
2026-09-27 02:38:58 +08:00
Accusys 696ede8696 fix: face_tracker.py now supports list format for frames 2026-09-27 01:14:28 +08:00
Accusys 357e585399 fix: Face processor now saves status and total_faces to face.json 2026-09-26 23:06:11 +08:00
Accusys b0244691cb feat: integrate embeddings storage to Face processor
- Create store_face_embeddings_to_qdrant.py script
- Add automatic Qdrant storage call after FaceNet completes
- Store 512D embeddings with metadata (frame, confidence, bbox)
- Enables downstream face tracing and clustering

This ensures embeddings are automatically stored in Qdrant without manual intervention.
2026-09-26 21:32:56 +08:00
Accusys 693bb56d7f feat: integrate FaceNet CoreML for face embeddings
- Add Swift FaceNet program using FaceNet CoreML model
- Integrate FaceNet into Rust Face processor (auto-generate embeddings)
- Adjust face_filter_defaults: min_confidence=0.5, min_size=1
- Support 512-dim embeddings with ANE acceleration
- Remove Python dependency for face embedding generation

Verified: 210 embeddings generated successfully (99.1% success rate)
Performance: 6.5s for 210 embeddings

Production ready.
2026-09-26 14:29:28 +08:00
Accusys ebee351523 refactor: enable Rust processors and remove appearance_processor.py
- Set MOMENTRY_USE_RUST_PROCESSORS=true in .env
- Remove scripts/appearance_processor.py (Rust binary replaces it)
- Update AGENTS.md with Rust Processors configuration
- Rust binaries available: rust_face_cluster, rust_appearance, rust_pose
- All Rust processors A/B tested and verified against Python versions
2026-09-20 20:12:43 +08:00
Accusys 31d1b4050f fix: correct face detection threshold defaults
- Changed min_confidence from 50.0 to 0.5 (Vision uses 0.0-1.0 range)
- Changed min_size from 32 to 1 (was filtering out all small faces)
- Changed min_capture_quality from 25.0 to 0.25
- Fixes issue where all videos showed 0 faces detected

Root cause: admin_config.rs used wrong defaults (50.0/32) instead of
config.rs constants (0.5/1), causing Vision framework to filter out
ALL faces because confidence threshold exceeded valid range.

Verified: IMG_9449 now correctly detects 191 faces (was 0).
2026-09-18 02:42:21 +08:00
Accusys 9ffbfeb6c5 feat: OCR resolution optimization - native resolution up to 1920px
- Replace fixed 320px downscale with smart resolution handling
- Videos <= 1920px: use native resolution (no downscale)
- Videos > 1920px: downscale to 1920px width
- Improves OCR quality for small text, subtitles, and scene text

Before: All videos scaled to 320px → poor OCR for small text
After: 1080p/720p videos use native resolution, 4K scales to 1920px

Verified: swift_ocr binary builds and runs correctly
- 720x890 video: native resolution (no scaling)
- 1920x1080 video: native resolution (at threshold)
- Detects video width and applies conditional scaling

Note: PaddleOCR fallback (ocr_processor_mps.py) already uses native resolution
2026-09-17 22:18:33 +08:00
Accusys 474a5bee99 refactor: remove YOLO processor and dependencies
- Delete YOLO processor implementation (src/core/processor/yolo.rs)
- Remove YOLO from processing pipeline and worker
- Clean up YOLO-related code across multiple modules
- Add migration 033_remove_yolo.sql

YOLO functionality removed as part of architecture simplification
2026-09-17 16:56:25 +08:00
Accusys e25c279eeb feat: port face clustering to Rust (rust_face_cluster) with A/B gating
- rust_face_cluster: seed-leader + agglomerative clustering port of
  fast_face_clustering_processor.py (Qdrant _faces scroll, trace aggregation,
  auto speaker bind, strict 2dp rounding parity)
- A/B verified vs Python on same Qdrant snapshot: both methods match on
  cluster membership/trace_id/confidence (leader + agglomerative)
- face_clustering.rs: USE_RUST_PROCESSORS switch with Python fallback
- executor.rs: run_rust_with_output_idx_and_frames (+ QDRANT env passthrough)
- appearance/pose: re-use rust runner path (previous migration)
- verify_face_cluster.py / verify_pose.py / verify_appearance.py: A/B harness
2026-09-16 21:50:07 +08:00
Accusys 362a735a91 feat: add VLM model logging before processing
- Add info log in vlm_summary.rs showing VLM model name
- Add print statements in Python VLM scripts showing model name
- Applies to: trace_vlm_caption.py, scene_vlm_caption.py, interval_vlm_caption.py
2026-08-27 20:16:08 +08:00
Accusys 7c9c3ded42 feat: opt-in face trace quality filter (min_trace_len/min_confidence, default off) 2026-08-16 09:36:23 +08:00
Accusys 2466a41eb8 perf: cut face_traced Qdrant I/O — merge trace-count scan (B1) + batch 1000 (B2) 2026-08-16 09:27:46 +08:00
Accusys 5e6a7b7d51 feat: round output JSON floats to 2dp + unify ensure_ascii for asr/asrx 2026-08-16 06:38:39 +08:00
Accusys 39e9ce4c3b fix: add min_capture_quality to FaceFilterSettings + trace profile fixes
- Add min_capture_quality to FaceFilterSettings (file_profile.rs)
- Fix store_traced_faces.py: load embeddings from Qdrant with_vector=True
- Fix face_tracker.py: force new traces when frame_gap > 30
- Fix backfill_trace_profiles.py: key_frame select=eq(n,N), bbox scaling, best_frame
- Add best_frame to FaceTraceProfile (Rust + Python)
- Fix min_capture_quality persistence in file-profile API
2026-08-13 10:12:21 +08:00
Accusys 71172fa354 fix: separate confidence and captureQuality in face detection output
Apple Vision provides two distinct scores:
- confidence: detection confidence (is this a face?)
- faceCaptureQuality: capture quality (is this face suitable for recognition?)

Previously these were mixed together as 'confidence'. Now both are
stored separately in the output JSON for downstream use.
2026-08-12 11:51:10 +08:00
Accusys 86f1fe8852 fix: restore Apple Vision default detection thresholds (0.5 / 1px)
job_worker.rs was overriding Apple Vision defaults with 0.75/64 even when
no face_settings were provided, causing fewer faces to be detected.

Now detect all faces with Vision defaults (confidence 0.5, min_size 1px);
filter later for display via face_filter settings.
2026-08-12 09:16:30 +08:00
Accusys 2e4559715b fix: tkg face_track drift — trace stability check + repair script
Part B (source fix): Enhanced TKG build Qdrant readiness check in
job_worker.rs. Previously only checked point count >= expected_faces,
which could fire before short traces finished uploading. Now verifies
trace_id stability: two consecutive scroll checks (2s apart) with same
unique trace count before proceeding.

Part A (repair): New scripts/repair_tkg_face_tracks.py reconciles Qdrant
_faces traces with PG tkg_nodes face_track rows, inserts missing ones.
Fixed 233 missing traces in 44c37c (1197 → 1430).
2026-08-12 06:21:18 +08:00
Accusys 2b1af42d06 fix: keep all traces in face clustering (remove min_faces=4 cutoff)
Large files (>1000 traces) used min_faces_per_trace=4, silently dropping
short traces (<=3 face points) from dedup. For 44c37c this excluded
484/1430 traces (34%) — walk-ons and passers-by never got a person label.

Now use min_faces=1 constant; noise is handled by the confidence>=0.5
filter in cluster_by_trace instead of dropping short appearances.

Result on 44c37c: 1430/1430 traces clustered, 21717/21717 faces assigned,
clusters 104 -> 203.
2026-08-12 05:19:54 +08:00
Accusys 258f8c4e96 fix: face clustering speaker mapping + representative face_id
- auto_bind_speakers: remove dead DB writes to nonexistent talents table,
  output speaker_person_mapping metadata into face_cluster.json instead
- fix representative_face.face_id to use face_idx (was frame_idx twice,
  causing duplicate face_ids for multi-face frames)
- fix asrx segment field names (start_time/end_time) and pass correct
  asrx path (ASRX_JSON_PATH was stale after UUID reassignment)
2026-08-12 05:04:48 +08:00
Accusys 65da4b451a fix: resolve trace-profile UPSERT SQL error and face-filter route syntax
- Fixed upsert_trace_profile() SQL: replaced scalar subqueries with LEFT JOIN
  to properly reference trace_profiles table in backfill logic
- Fixed face_filter routes: changed {file_uuid} to :file_uuid syntax for
  axum 0.7.9 compatibility
- Both fixes resolve HTTP 500 errors in rename and 404 errors in face filter
- Verified both APIs working correctly with test requests
2026-08-10 00:04:15 +08:00
Accusys 8dada662e8 fix: add parameter logging for face detection settings
- swift_face.swift: Log MIN_CONFIDENCE and MIN_SIZE at startup
- face_processor.py: Log settings passed to swift_face subprocess
- executor.rs: Log face settings being passed to Python subprocesses (4 run methods)
- Enables debugging of face detection parameter chain

Test results:
- FACE_MIN_CONFIDENCE=0.5, FACE_MIN_SIZE=1 → 392 faces (195 frames with 2 faces)
- SwiftFace log shows: MIN_CONFIDENCE=0.5, MIN_SIZE=1
- face_processor.py log shows: Settings passed to swift_face: FACE_MIN_CONFIDENCE=0.5, FACE_MIN_SIZE=1
2026-08-08 16:10:47 +08:00
Accusys a06973484b fix: pass FACE_MIN_CONFIDENCE and FACE_MIN_SIZE env vars to swift_face subprocess
- executor.rs: Add cmd.env() for FACE_MIN_CONFIDENCE and FACE_MIN_SIZE in all 4 run methods
- face_processor.py: Pass os.environ to subprocess.Popen to inherit env vars
- Fixes multi-face detection issue where second face was being filtered out
- Tested: CONFIDENCE=0.5 preserves both faces (392 total), CONFIDENCE=0.75 filters second face (196 total), SIZE=100 filters small faces (201 total)
2026-08-08 15:41:26 +08:00
Accusys 256e872fd9 fix: swift_face.swift reads MIN_CONFIDENCE and MIN_SIZE from env vars
- FACE_MIN_CONFIDENCE env var (default 0.75)
- FACE_MIN_SIZE env var (default 64)
- Allows per-file threshold configuration via environment
2026-08-08 04:19:45 +08:00
Accusys 15967929ef fix: ASR fails to find cut.json when executor uses .tmp output path
- ASR script used output_path.replace('.asr.json', '.cut.json') to find CUT file
- Executor passes output path with .tmp suffix (xxx.asr.json.tmp)
- This produced wrong path: xxx.cut.json.tmp (doesn't exist)
- Fix: use --uuid to construct CUT path from output_dir instead
- Also added executor Full command logging for debugging

Fixed IMG_9449 (1).MOV ASR failure: status changed from failed → completed
2026-08-05 01:45:59 +08:00