af028ab8f4
新結構: - tools/script/ (Python 處理器腳本) - tools/cli/ (Swift/Rust CLI 工具) 遷移內容: - Python 腳本: ASR, Face, Pose, Cut, OCR, VLM, Embedding, Identity - Swift CLI: 24 個 Swift 處理器和測試文件 - Rust CLI: Face Cluster, Appearance, Pose 保留向後兼容: - 舊路徑 scripts/ 仍然存在 - 環境變數可配置新路徑 文檔: - tools/README.md - docs_v1.0/DESIGN/Tools_Directory_Restructure.md
157 lines
3.1 KiB
Markdown
157 lines
3.1 KiB
Markdown
---
|
|
title: Tools Directory
|
|
version: 1.0
|
|
date: 2026-09-27
|
|
author: OpenCode
|
|
status: 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 腳本
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
# 編譯
|
|
cd tools/cli/swift
|
|
swift build
|
|
|
|
# 運行
|
|
swift run asr_swift
|
|
swift run swift_face
|
|
```
|
|
|
|
### Rust CLI
|
|
|
|
```bash
|
|
# 編譯
|
|
cd tools/cli/rust
|
|
cargo build --release
|
|
|
|
# 運行
|
|
./target/release/face_cluster
|
|
./target/release/appearance
|
|
```
|
|
|
|
## 遷移說明
|
|
|
|
### 來源
|
|
|
|
- Python: `scripts/` → `tools/script/`
|
|
- Swift: `scripts/swift_processors/` → `tools/cli/swift/`
|
|
- Rust: `scripts/rust_processors/` → `tools/cli/rust/`
|
|
|
|
### 原路徑保留
|
|
|
|
舊路徑 `scripts/` 仍然存在,可以繼續使用。
|
|
|
|
新代碼建議使用 `tools/` 路徑。
|
|
|
|
## 配置
|
|
|
|
環境變數 `MOMENTRY_SCRIPTS_DIR` 需要更新:
|
|
|
|
```bash
|
|
# 舊路徑
|
|
export MOMENTRY_SCRIPTS_DIR=/Users/accusys/momentry_core/scripts
|
|
|
|
# 新路徑
|
|
export MOMENTRY_SCRIPTS_DIR=/Users/accusys/momentry_core/tools/script
|
|
```
|
|
|
|
## 相關文檔
|
|
|
|
- `/Users/accusys/momentry_core/docs_v1.0/DESIGN/Tools_Directory_Restructure.md`
|