chore: backup before code cleanup

Backup commit before executing remove-unused-code proposal.
This includes all pending changes and new features.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-11 11:55:39 +08:00
parent eff9b0bcd5
commit 940a406dce
58 changed files with 8226 additions and 175 deletions

61
docs/ocr-presets.md Normal file
View File

@@ -0,0 +1,61 @@
# OCR 處理預設與進階參數指南
本指南說明如何選擇預設組合、覆寫參數以及常見問題的處理方式。前端預設選擇卡與進階參數面板已對應此文件API 端點請參考 `/api/v2/tasks`
## 預設選擇建議
- 預設值:`datasheet`(保守表格解析,避免 cell explosion
- 若文件類型不確定,先用 `datasheet`,再視結果調整。
| 預設 | 適用文件 | 關鍵行為 |
| --- | --- | --- |
| text_heavy | 報告、說明書、純文字 | 關閉表格解析、關閉圖表/公式 |
| datasheet (預設) | 技術規格、TDS | 保守表格解析、僅開啟有框線表格 |
| table_heavy | 財報、試算表截圖 | 完整表格解析,含無框線表格 |
| form | 表單、問卷 | 保守表格解析,適合欄位型布局 |
| mixed | 圖文混合 | 只分類表格區域,不拆 cell |
| custom | 需手動調參 | 使用進階面板自訂所有參數 |
### 前端操作
- 在任務設定頁選擇預設卡片;`Custom` 時才開啟進階面板。
- 進階參數修改後會自動切換到 `custom` 模式。
### API 範例
```json
POST /api/v2/tasks
{
"processing_track": "ocr",
"ocr_preset": "datasheet",
"ocr_config": {
"table_parsing_mode": "conservative",
"enable_wireless_table": false
}
}
```
## 參數對照OCRConfig
**表格處理**
- `table_parsing_mode`: `full` / `conservative` / `classification_only` / `disabled`
- `enable_wired_table`: 解析有框線表格
- `enable_wireless_table`: 解析無框線表格(易產生過度拆分)
**版面偵測**
- `layout_threshold`: 01越高越嚴格空值採模型預設
- `layout_nms_threshold`: 01越高保留更多框越低過濾重疊
**前處理**
- `use_doc_orientation_classify`: 自動旋轉校正
- `use_doc_unwarping`: 展平扭曲(可能失真,預設關)
- `use_textline_orientation`: 校正文行方向
**辨識模組開關**
- `enable_chart_recognition`: 圖表辨識
- `enable_formula_recognition`: 公式辨識
- `enable_seal_recognition`: 印章辨識
- `enable_region_detection`: 區域偵測輔助結構解析
## 疑難排解
- 表格被過度拆分cell explosion改用 `datasheet``conservative`,關閉 `enable_wireless_table`
- 表格偵測不到:改用 `table_heavy``full`,必要時開啟 `enable_wireless_table`
- 版面框選過多或過少:調整 `layout_threshold`(過多→提高;過少→降低)。
- 公式/圖表誤報:在 `custom` 模式關閉 `enable_formula_recognition``enable_chart_recognition`
- 文檔角度錯誤:確保 `use_doc_orientation_classify` 開啟;若出現拉伸變形,關閉 `use_doc_unwarping`