Skip to content

Commit 152dddf

Browse files
committed
chore(model): 使用 v6 small det + tiny rec
1 parent f2b1da7 commit 152dddf

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

tools/configure.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@
44
assets_dir = Path(__file__).parent.parent
55

66

7+
# PP-OCRv6 混合档:
8+
# - det.onnx 用 small:检测框更准(按钮/干员名/关卡名定位更稳)
9+
# - rec.onnx + keys.txt 用 tiny:识别轻量,包体积小
10+
_OCR_SRC = assets_dir / "MaaCommonAssets" / "OCR" / "ppocr_v6"
11+
_OCR_DST = assets_dir / "resource" / "base" / "model" / "ocr"
12+
13+
714
def configure_ocr_model():
8-
shutil.copytree(
9-
assets_dir / "MaaCommonAssets" / "OCR" / "ppocr_v4" / "zh_cn",
10-
assets_dir / "resource" / "base" / "model" / "ocr",
11-
dirs_exist_ok=True,
15+
shutil.rmtree(_OCR_DST, ignore_errors=True)
16+
_OCR_DST.mkdir(parents=True, exist_ok=True)
17+
18+
shutil.copy2(_OCR_SRC / "small" / "det.onnx", _OCR_DST / "det.onnx")
19+
shutil.copy2(_OCR_SRC / "tiny" / "rec.onnx", _OCR_DST / "rec.onnx")
20+
shutil.copy2(_OCR_SRC / "tiny" / "keys.txt", _OCR_DST / "keys.txt")
21+
22+
(_OCR_DST / "README.md").write_text(
23+
"PP-OCRv6 mixed model:\n"
24+
"- det.onnx: ppocr_v6/small\n"
25+
"- rec.onnx, keys.txt: ppocr_v6/tiny\n",
26+
encoding="utf-8",
1227
)
1328

1429

0 commit comments

Comments
 (0)