Files
momentry_core/tools
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
..

title, version, date, author, status
title version date author status
Tools Directory 1.1 2026-09-27 OpenCode migrated

目錄結構

tools/
├── script/           # Python 處理器腳本
│   ├── asr/         # ASR 處理器
│   ├── face/        # Face 處理器
│   ├── pose/        # Pose 處理器
│   ├── cut/         # Cut 處理器
│   ├── ocr/         # OCR 處理器
│   ├── vlm/         # VLM 處理器
│   ├── embedding/   # Embedding 服務器
│   ├── identity/    # Identity 處理器
│   └── utils/       # 工具腳本
└── cli/             # Swift/Rust CLI 工具
    ├── swift/       # Swift 處理器
    └── rust/        # Rust 處理器

Python 腳本 (script/)

ASR

  • asr_processor_base.py - ASR 基礎類
  • asr_processor_contract_v1.py - ASR V1 合約
  • asr_processor_contract_v2.py - ASR V2 合約

Face

  • face_processor.py - Face 處理器
  • store_traced_faces.py - Face 追蹤存儲

Pose

  • pose_processor.py - Pose 處理器

Cut

  • cut_processor.py - Cut 處理器

OCR

  • ocr_processor.py - OCR 處理器

VLM

  • tkg_builder.py - TKG Builder
  • appearance_processor_v2.py - Appearance 處理器

Embedding

  • embeddinggemma_server.py - Embedding 服務器

Identity

  • identity_agent.py - Identity Agent
  • identity_bind.py - Identity 綁定
  • identity_matcher.py - Identity 匹配

CLI 工具 (cli/)

Swift

處理器:

  • asr_swift.swift - ASR Swift 處理器
  • asrx_swift.swift - ASRX Swift 處理器
  • swift_face.swift - Face Swift 處理器
  • swift_pose.swift - Pose Swift 處理器
  • swift_ocr.swift - OCR Swift 處理器
  • swift_hand.swift - Hand Swift 處理器
  • swift_face_pose.swift - Face+Pose Swift 處理器

擴展:

  • swift_appearance_expansion.swift - Appearance 擴展
  • swift_pose_expansion.swift - Pose 擴展

測試:

  • face_vision_test.swift
  • pose_benchmark.swift
  • speaker_test.swift

Rust

獨立的 Rust CLI 工具項目,包含:

  • Face Cluster
  • Appearance
  • Pose

使用方式

Python 腳本

# ASR
python3 tools/script/asr/asr_processor_contract_v2.py

# Face
python3 tools/script/face/face_processor.py

# TKG
python3 tools/script/vlm/tkg_builder.py

Swift CLI

# 編譯
cd tools/cli/swift
swift build

# 運行
swift run asr_swift
swift run swift_face

Rust CLI

# 編譯
cd tools/cli/rust
cargo build --release

# 運行
./target/release/face_cluster
./target/release/appearance

環境變數配置

腳本路徑

# Python 腳本路徑
export MOMENTRY_SCRIPTS_DIR=/Users/accusys/momentry_core/tools/script

# CLI 工具路徑
export MOMENTRY_CLI_DIR=/Users/accusys/momentry_core/tools/cli

其他路徑

# 輸出路徑
export MOMENTRY_OUTPUT_DIR=/Users/accusys/momentry/output

# Python 路徑
export MOMENTRY_PYTHON_PATH=/opt/homebrew/bin/python3.11

Rust 代碼中使用

use crate::core::config::{SCRIPTS_DIR, CLI_DIR};

// 獲取腳本路徑
let scripts_dir = SCRIPTS_DIR.as_str();

// 獲取 CLI 路徑
let cli_dir = CLI_DIR.as_str();

遷移說明

來源

  • Python: scripts/ → tools/script/
  • Swift: scripts/swift_processors/ → tools/cli/swift/
  • Rust: scripts/rust_processors/ → tools/cli/rust/

原路徑保留

舊路徑 scripts/ 仍然存在,可以繼續使用。

新代碼建議使用 tools/ 路徑。

相關文檔

  • /Users/accusys/momentry_core/docs_v1.0/DESIGN/Tools_Directory_Restructure.md
  • /Users/accusys/momentry_core/AGENTS.md - 環境變數配置