# py-ocr-app **Repository Path**: uuuoop/py-ocr-app ## Basic Information - **Project Name**: py-ocr-app - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-24 - **Last Updated**: 2026-03-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # py-ocr-app 一个离线 OCR 桌面工具,技术栈为 `Vue 3 + Tauri + Python(RapidOCR ONNXRuntime)`。 ## 功能 - 批量选择图片并并发识别 - 可配置关键字字段提取(关键字右侧值) - 自动提取日期信息 - 识别结果可编辑并导出 Excel - 本地历史记录缓存(localStorage) ## 项目结构 - `src/`:前端页面(Vue + Element Plus) - `src-tauri/`:Tauri Rust 壳层 - `ocr_engine.py`:Python OCR 引擎入口(RapidOCR) - `scripts/package-ocr-sidecar.ps1`:打包 OCR sidecar(Windows) ## 环境要求 - Node.js 18+ - Rust(稳定版) - Python 3.11 - Windows(当前脚本面向 Windows) ## 安装前端依赖 ```powershell npm install ``` ## 安装 Python OCR 依赖 ```powershell py -3.11 -m venv .venv .\.venv\Scripts\Activate.ps1 python -m pip install --upgrade pip pip uninstall -y paddleocr paddlepaddle paddlepaddle-gpu pip install -r requirements.txt ``` ## 准备 PP-OCRv4 ONNX 模型 在项目根目录创建 `models/`,并放入以下文件: - `ch_PP-OCRv4_det_infer.onnx` - `ch_PP-OCRv4_rec_infer.onnx` - `ch_ppocr_mobile_v2.0_cls_infer.onnx` - `ppocr_keys_v1.txt` 建议从 PaddleOCR / RapidOCR 官方发布资源下载对应的 PP-OCRv4 ONNX 模型后覆盖到该目录。 脚本和运行时都会校验这些文件是否存在。 ## 一键打包 OCR sidecar ```powershell powershell -ExecutionPolicy Bypass -File .\scripts\package-ocr-sidecar.ps1 ``` ## 极简 PyInstaller 命令 ```powershell pyinstaller --noconfirm --clean --onefile --name ocr-backend-x86_64-pc-windows-msvc --collect-all rapidocr_onnxruntime --collect-all onnxruntime --collect-all cv2 --collect-all pyclipper --collect-all shapely --add-data "models;models" --exclude-module matplotlib --exclude-module tkinter --exclude-module _tkinter --exclude-module pandas --exclude-module scipy --exclude-module skimage --exclude-module openpyxl ocr_engine.py ``` ## 精度建议参数 当前 `ocr_engine.py` 已固定如下参数用于降低数字误识别(如 2024 -> 2014)风险: - `det_limit_side_len=2048` - `det_limit_type="max"` - `text_score=0.45` 如需进一步调优,推荐顺序: 1. `det_limit_side_len`:2048 -> 2560 2. `text_score`:0.45 -> 0.42 3. `det_box_thresh`:0.5 -> 0.45 ## 开发运行 ```powershell npm run tauri dev ``` ## 构建应用 ```powershell npm run tauri build ```