基于 ncnn 的轻量级 OCR 推理库,支持 C/C++ 与 Python,可在 Windows / Linux / macOS 上快速部署。
- 🚀 轻量高效:基于 ncnn,无重型深度学习框架依赖,推理速度快、内存占用低。
- 🖥️ 跨平台:支持 Windows、Linux 与 macOS。
- 🔌 多语言接口:提供 C API 与 Python 绑定,方便接入 C/C++、Python 项目。
- 📦 即装即用:
pip install .自动构建并打包原生动态库,开箱即用。 - 🔧 模型覆盖:内置 PaddleOCR 检测/识别、文本行方向、文档方向、UVDoc 畸变校正、表格识别等 pipeline。
- 🎛️ 灵活构建:支持 bundled ncnn 或系统 ncnn,可选 Vulkan GPU 加速。
| 模块 | 状态 |
|---|---|
| PaddleOCR 检测 (Det) | ✅ |
| PaddleOCR 识别 (Rec) | ✅ |
| 文本行方向 (Textline ORI) | ✅ |
| 文档方向 (DOC ORI) | ✅ |
| UVDoc 畸变校正 | ✅ |
| 表格识别 (TableRec) | ✅ |
| 版面分析 (Layout) | ⏳ |
| LaTeX OCR | ⏳ |
- PaddleOCR 完整端到端 Pipeline
- HTTP API 服务
- 更多语言支持
git clone https://github.com/futz12/LiteOCR.git
cd LiteOCR
git submodule update --init --recursivecmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallelWindows 使用 Visual Studio 生成器时,可执行文件默认位于 build/Release/。
如需启用 Vulkan GPU 加速:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DLITEOCR_ENABLE_VULKAN=ON详细构建选项请参考 docs/build.md。
pip install .安装完成后验证:
python -m liteocr如需开发测试依赖:
pip install .[dev]
pytest python/tests/test_basic.py -vPython API 详情参考 docs/python.md。
- 预训练模型文件放置于
models/目录。 - C++ 示例位于
examples/。 - Python 可运行示例位于
examples/python/。 - API 使用示例请参考 docs/examples.md。
| 文档 | 说明 |
|---|---|
| docs/build.md | CMake / Python wheel 构建说明 |
| docs/python.md | Python API 文档 |
| docs/c-api.md | C API 文档 |
| docs/examples.md | 使用示例 |
| docs/performance.md | 性能数据 |
本项目基于 Apache License 2.0 开源。
