---
title: imgocr
canonical_url: "https://www.modelscope.cn/models/lili666/imgocr"
md_url: "https://www.modelscope.cn/models/lili666/imgocr.md"
repository: lili666/imgocr
chinese_name: "ppocr-v4-onnx模型"
last_updated: 2025-07-14
license: "Apache License 2.0"
pipeline_tag: ocr-recognition
tasks:
  - ocr-recognition
library_name:
  - onnx
  - pytorch
frameworks:
  - Pytorch
downloads: 6688
stars: 9
---

# imgocr

> imgocr - lili666 在 ModelScope 开源的模型。ocr识别模型

lili666/imgocr 是 ModelScope 魔搭社区上的ocr-recognition模型，采用 Apache License 2.0 许可。

- **Repository**: lili666/imgocr
- **License**: Apache License 2.0
- **Tasks**: ocr-recognition
- **Downloads**: 6688
- **Stars**: 9
- **Last updated**: 2025-07-14

Source: https://www.modelscope.cn/models/lili666/imgocr

---

这里用来托管从PaddleOCR项目转换而来的ONNX模型，涵盖PPOCR-v4/PPOCR-v5的mobile和serve版本的模型。

建议pip install imgocr -U 来加载PPOCR-v4-onnx/ppocr-v5-onnx模型.


## Usage

```python
import time
import sys

sys.path.append('..')
from imgocr import ImgOcr
from imgocr import drwa_ocr_boxes

if __name__ == "__main__":
    m = ImgOcr(use_gpu=False, is_efficiency_mode=True)
    img_path = "sample_img.jpg"
    s = time.time()
    result = m.ocr(img_path)
    e = time.time()
    print("total time: {:.4f} s".format(e - s))
    print("result:", result)
    for line in result:
        print(line.get('text'))

    # draw boxes
    drwa_ocr_boxes(img_path, result, '11_box.jpg')
    print('Save result to 11_box.jpg')
```



>  is_efficiency_mode: 是否使用高效率模型，默认True，使用高效率模型(mobile，14MB)，速度更快，精度稍低。如果需要更高精度，设置为False，使用高精度模型(server，207MB)。

sample_img:

![](sample_img.jpg)

output:

![](sample_img_box.jpg)
