File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44assets_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+
714def 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
You can’t perform that action at this time.
0 commit comments