Skip to content

futz12/LiteOCR

Repository files navigation

LiteOCR

LiteOCR

基于 ncnn 的轻量级 OCR 推理库,支持 C/C++ 与 Python,可在 Windows / Linux / macOS 上快速部署。

License Python CMake CI


✨ 特性

  • 🚀 轻量高效:基于 ncnn,无重型深度学习框架依赖,推理速度快、内存占用低。
  • 🖥️ 跨平台:支持 Windows、Linux 与 macOS。
  • 🔌 多语言接口:提供 C API 与 Python 绑定,方便接入 C/C++、Python 项目。
  • 📦 即装即用pip install . 自动构建并打包原生动态库,开箱即用。
  • 🔧 模型覆盖:内置 PaddleOCR 检测/识别、文本行方向、文档方向、UVDoc 畸变校正、表格识别等 pipeline。
  • 🎛️ 灵活构建:支持 bundled ncnn 或系统 ncnn,可选 Vulkan GPU 加速。

📋 Pipeline 进度

模块 状态
PaddleOCR 检测 (Det)
PaddleOCR 识别 (Rec)
文本行方向 (Textline ORI)
文档方向 (DOC ORI)
UVDoc 畸变校正
表格识别 (TableRec)
版面分析 (Layout)
LaTeX OCR

📝 TODO

  • PaddleOCR 完整端到端 Pipeline
  • HTTP API 服务
  • 更多语言支持

🚀 快速开始

1. 克隆仓库并初始化子模块

git clone https://github.com/futz12/LiteOCR.git
cd LiteOCR
git submodule update --init --recursive

2. C++ 构建

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel

Windows 使用 Visual Studio 生成器时,可执行文件默认位于 build/Release/

如需启用 Vulkan GPU 加速:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DLITEOCR_ENABLE_VULKAN=ON

详细构建选项请参考 docs/build.md

3. Python 安装

pip install .

安装完成后验证:

python -m liteocr

如需开发测试依赖:

pip install .[dev]
pytest python/tests/test_basic.py -v

Python API 详情参考 docs/python.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 开源。

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors