imgocr
Python3 package for Chinese/English OCR,use paddleocr-v5 onnx model(~20MB), with ultra-fast inference speed. 基于ppocr-v5-onnx模型推理,中英文OCR开源SOTA,推理速度超快。
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.8%) to scientific vocabulary
Keywords
Repository
Python3 package for Chinese/English OCR,use paddleocr-v5 onnx model(~20MB), with ultra-fast inference speed. 基于ppocr-v5-onnx模型推理,中英文OCR开源SOTA,推理速度超快。
Basic Info
Statistics
- Stars: 98
- Watchers: 2
- Forks: 12
- Open Issues: 2
- Releases: 0
Topics
Metadata Files
README.md
imgocr: Image OCR toolkit
imgocrPython3 package for Chinese/English OCR, with paddleocr-v4/paddleocr-v5 onnx model(~20MB).
imgocrPaddleOCR-v5-onnx~20MB CPU OCR SOTA
Showcase
| |
|
|------|-----------------------------------------------------------------------------------------------|
| |
|
| |
|
| |
|
| |
|
| |
|
Benchmark
PP-OCRv4

OCR / benchmark
| | mAP(%) | Acc(%) | GPU (ms) | CPU (ms) | (MB) | | |----------------------|-----------|-----------|--------------|--------------|------------|------------------------------------------------------------------------| | PP-OCRv4-mobile | 63.8 | 78.74 | 2.71 | 79.11 | 14 | v4-mobile-model | | PP-OCRv4-server | 69.2 | 85.19 | 24.92 | 2742.31 | 207 | v4-server-model | | PP-OCRv5-mobile() | 79.0 | 81.29 | 6.36 | 82.11 | 20 | v5-mobile-model | | PP-OCRv5-server | 83.8 | 86.38 | 28.15 | 2900.12 | 160 | v5-server-model |
GPU NVIDIA Tesla T4 FP32CPU Intel(R) Xeon(R) Gold 5117 CPU @ 2.00GHz FP32
OCR PaddleOCR 1.1w500
Demo
HuggingFace Demo: https://huggingface.co/spaces/shibing624/imgocr

run example: examples/gradio_demo.py to see the demo:
shell
python examples/gradio_demo.py
Install
paddlepaddlepaddleocronnxruntimeimgocr
shell
pip install onnxruntime # pip install onnxruntime-gpu for gpu
pip install imgocr
or
shell
git clone https://github.com/shibing624/imgocr.git
cd imgocr
pip install onnxruntime # pip install onnxruntime-gpu for gpu
pip install -r requirements.txt
pip install .
Usage
OCR
example: examples/ocr_demo.py
python
from imgocr import ImgOcr
m = ImgOcr(use_gpu=False, is_efficiency_mode=True)
result = m.ocr("data/11.jpg")
print("result:", result)
for i in result:
print(i['text'])
is_efficiency_mode:True(v5-mobile20MB)imgocr/modelsFalse(v5-server160MB)imgocr/models
output: ```shell result: [{'box': [[28.0, 37.0], [302.0, 39.0], [302.0, 72.0], [27.0, 70.0]], 'text': '', 'score': 0.9978395700454712}, {'box': [[26.0, 83.0], [173.0, 83.0], [173.0, 104.0], [26.0, 104.0]], 'text': '/', 'score': 0.9898329377174377}, {'box': [[27.0, 112.0], [331.0, 112.0], [331.0, 135.0], [27.0, 135.0]], 'text': '45/100', 'score': 0.9659210443496704}, {'box': [[25.0, 143.0], [281.0, 143.0], [281.0, 165.0], [25.0, 165.0]], 'text': '221000', 'score': 0.9928666353225708}, {'box': [[26.0, 179.0], [300.0, 179.0], [300.0, 195.0], [26.0, 195.0]], 'text': '/OEMODM', 'score': 0.9843945503234863}, {'box': [[26.0, 210.0], [234.0, 210.0], [234.0, 227.0], [26.0, 227.0]], 'text': '', 'score': 0.9963161945343018}, {'box': [[25.0, 239.0], [241.0, 239.0], [241.0, 259.0], [25.0, 259.0]], 'text': 'YM-X-3011', 'score': 0.9848018884658813}, {'box': [[413.0, 232.0], [430.0, 232.0], [430.0, 306.0], [413.0, 306.0]], 'text': 'ODMOEM', 'score': 0.9908049702644348}, {'box': [[24.0, 271.0], [180.0, 271.0], [180.0, 290.0], [24.0, 290.0]], 'text': '220ml', 'score': 0.9892324209213257}, {'box': [[26.0, 303.0], [251.0, 303.0], [251.0, 319.0], [26.0, 319.0]], 'text': '', 'score': 0.9909228682518005}, {'box': [[26.0, 335.0], [344.0, 335.0], [344.0, 352.0], [26.0, 352.0]], 'text': '-', 'score': 0.9828647971153259}, {'box': [[26.0, 364.0], [281.0, 364.0], [281.0, 384.0], [26.0, 384.0]], 'text': '', 'score': 0.9505177140235901}, {'box': [[368.0, 368.0], [477.0, 368.0], [477.0, 389.0], [368.0, 389.0]], 'text': '', 'score': 0.992072343826294}, {'box': [[26.0, 397.0], [360.0, 397.0], [360.0, 414.0], [26.0, 414.0]], 'text': '', 'score': 0.9904329180717468}, {'box': [[28.0, 429.0], [370.0, 429.0], [370.0, 445.0], [28.0, 445.0]], 'text': '', 'score': 0.9874186515808105}, {'box': [[27.0, 458.0], [137.0, 458.0], [137.0, 479.0], [27.0, 479.0]], 'text': '', 'score': 0.9987384676933289}]
/ 45/100 221000 /OEMODM
YM-X-3011 ODMOEM 220ml
-
```

CLI
OCR
code: cli.py
```
imgocr -h
usage: cli.py [-h] --imagedir IMAGEDIR [--outputdir OUTPUTDIR] [--chunksize CHUNKSIZE] [--usegpu USEGPU]
imgocr cli
options: -h, --help show this help message and exit --imagedir IMAGEDIR input image dir path, required --outputdir OUTPUTDIR output ocr result dir path, default outputs --chunksize CHUNKSIZE chunk size, default 10 --usegpu USEGPU use gpu, default False ```
run
shell
pip install imgocr -U
imgocr --image_dir data
--image_dir required
Contact

Citation
imgocr
APA:
latex
Xu, M. imgocr: Image OCR toolkit (Version 0.0.1) [Computer software]. https://github.com/shibing624/imgocr
BibTeX:
latex
@misc{imgocr,
author = {Ming Xu},
title = {imgocr: Image OCR toolkit},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/shibing624/imgocr}},
}
License
The Apache License 2.0imgocr
Contribute
testspython -m pytest -v
PR
References
Owner
- Name: xuming
- Login: shibing624
- Kind: user
- Location: Beijing, China
- Company: @tencent
- Website: https://blog.csdn.net/mingzai624
- Repositories: 32
- Profile: https://github.com/shibing624
Senior Researcher, Machine Learning Developer, Advertising Risk Control.
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Xu
given-names: Ming
title: "imgocr: A Python package for image ocr."
version: 0.0.1
date-released: 2024-12-18
url: "https://github.com/shibing624/imgocr"
GitHub Events
Total
- Issues event: 10
- Watch event: 82
- Issue comment event: 13
- Push event: 33
- Gollum event: 2
- Fork event: 12
- Create event: 4
Last Year
- Issues event: 10
- Watch event: 82
- Issue comment event: 13
- Push event: 33
- Gollum event: 2
- Fork event: 12
- Create event: 4
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| shibing624 | s****4@1****m | 33 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 6
- Total pull requests: 0
- Average time to close issues: 1 day
- Average time to close pull requests: N/A
- Total issue authors: 6
- Total pull request authors: 0
- Average comments per issue: 1.67
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 0
- Average time to close issues: 1 day
- Average time to close pull requests: N/A
- Issue authors: 6
- Pull request authors: 0
- Average comments per issue: 1.67
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ILG2021 (1)
- yunqianluo (1)
- acan0513 (1)
- liuzjMr (1)
- zoushucai (1)
- usun1997 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 77 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 12
- Total maintainers: 1
pypi.org: imgocr
Image ocr tool, use ppocr onnx model.
- Homepage: https://github.com/shibing624/imgocr
- Documentation: https://imgocr.readthedocs.io/
- License: Apache License 2.0
-
Latest release: 0.2.2
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/cache v2 composite
- actions/checkout v2 composite
- conda-incubator/setup-miniconda v2 composite
- loguru *
- numpy *
- onnxruntime *
- opencv-python-headless *
- pillow *
- pyclipper *
- requests *
- shapely *
- tqdm *
- loguru *
- numpy *
- opencv-python-headless *
- pillow *
- pyclipper *
- requests *
- shapely *
- tqdm *