feat: add enable_detection switch to skip text detection

enable_detection: false 跳过检测模型,直接把整图当一行文本送识别。
实测:单行图可正确识别;多行整图因识别模型固定缩放到高 48px 会返回空结果,已加告警。

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
zimoyin
2026-10-13 15:59:25 +08:00
parent 6821d0d137
commit a7d4ff6454
8 changed files with 162 additions and 16 deletions
+10
View File
@@ -52,6 +52,16 @@ text_recognition_batch_size: 8
# 而且会挤占同机其它服务。建议用 benchmark_ocr.py 实测后再定。
cpu_threads: 1
# 是否先做文本框检测(det 模型),再做文字识别(rec 模型)。
# true(默认)= 检测 + 识别:先找出所有文本框,再逐个识别。适合正常的多行文档/截图。
# false = 跳过检测,直接把整张图当作「一行文本」送识别模型。
# ⚠️ 只适用于图片本身就是单行文本的场景(例如你自己裁好的一行文字)。
# 识别模型会把输入统一缩放到高约 48px,多行图会被压扁到读不出内容,
# 此时服务会返回空结果并打印告警。
# 关闭检测后 text_det_limit_side_len / text_det_* 等检测参数不再生效。
# 备注:检测模型不是「画框」,而是用来定位文字区域;正常 OCR 必须保留。
enable_detection: true
# 是否返回每个识别文本框内部的字/词级 polygon。
# false:默认,只返回行/文本片段框,速度更快、JSON 更小。
# true :在 data.result.polygon.textN.words 中返回字/词级四点坐标,会增加耗时和响应体积。