METADATA 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. Metadata-Version: 2.4
  2. Name: onnxocr
  3. Version: 2025.5
  4. Summary: A lightweight OCR system based on PaddleOCR
  5. Home-page: https://github.com/jingsongliujing/OnnxOCR
  6. Author: jingsongliujing
  7. Author-email: jingsongliujing <45508593+jingsongliujing@users.noreply.github.com>
  8. License-Expression: Apache-2.0
  9. Project-URL: Homepage, https://github.com/jingsongliujing/OnnxOCR
  10. Project-URL: Repository, https://github.com/jingsongliujing/OnnxOCR
  11. Project-URL: Issues, https://github.com/jingsongliujing/issues
  12. Classifier: Programming Language :: Python :: 3
  13. Classifier: Development Status :: 4 - Beta
  14. Requires-Python: >=3.6
  15. Description-Content-Type: text/markdown
  16. License-File: LICENSE
  17. Requires-Dist: opencv-python-headless
  18. Requires-Dist: opencv-contrib-python
  19. Requires-Dist: onnxruntime
  20. Requires-Dist: shapely
  21. Requires-Dist: pyclipper
  22. Requires-Dist: numpy<2.0.0
  23. Requires-Dist: pymupdf
  24. Requires-Dist: pdf2image
  25. Dynamic: author
  26. Dynamic: home-page
  27. Dynamic: license-file
  28. Dynamic: requires-python
  29. English | [简体中文](./Readme_cn.md) |
  30. ### **OnnxOCR**
  31. ### ![onnx_logo](onnxocr/test_images/onnxocr_logo.png)
  32. **A High-Performance Multilingual OCR Engine Based on ONNX**
  33. [![GitHub Stars](https://img.shields.io/github/stars/jingsongliujing/OnnxOCR?style=social&label=Star&maxAge=3600)](https://github.com/jingsongliujing/OnnxOCR/stargazers)
  34. [![GitHub Forks](https://img.shields.io/github/forks/jingsongliujing/OnnxOCR?style=social&label=Fork&maxAge=3600)](https://github.com/jingsongliujing/OnnxOCR/network/members)
  35. [![GitHub License](https://img.shields.io/github/license/jingsongliujing/OnnxOCR)](https://github.com/jingsongliujing/OnnxOCR/blob/main/LICENSE)
  36. [![Python Version](https://img.shields.io/badge/Python-%E2%89%A53.6-blue.svg)](https://www.python.org/)
  37. ## 🚀 Version Updates
  38. - **2025.05.21**
  39. 1. Added PP-OCRv5 model, supporting 5 language types in a single model: Simplified Chinese, Traditional Chinese, Chinese Pinyin, English, and Japanese.
  40. 2. Overall recognition accuracy improved by 13% compared to PP-OCRv4.
  41. 3. Accuracy is consistent with PaddleOCR 3.0.
  42. ## 🌟 Core Advantages
  43. 1. **Deep Learning Framework-Free**: A universal OCR engine ready for direct deployment.
  44. 2. **Cross-Architecture Support**: Uses PaddleOCR-converted ONNX models, rebuilt for deployment on both ARM and x86 architecture computers with unchanged accuracy under limited computing power.
  45. 3. **High-Performance Inference**: Faster inference speed on computers with the same performance.
  46. 4. **Multilingual Support**: Single model supports 5 language types: Simplified Chinese, Traditional Chinese, Chinese Pinyin, English, and Japanese.
  47. 5. **Model Accuracy**: Consistent with PaddleOCR models.
  48. 6. **Domestic Hardware Adaptation**: Restructured code architecture for easy adaptation to more domestic GPUs by modifying only the inference engine.
  49. ## 🛠️ Environment Setup
  50. ```bash
  51. python>=3.6
  52. pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
  53. ```
  54. **Note**:
  55. - The Mobile version model is used by default; the PP-OCRv5_Server-ONNX model offers better performance.
  56. - The Mobile model is already in `onnxocr/models/ppocrv5` and requires no download;
  57. - The PP-OCRv5_Server-ONNX model is large and uploaded to [Baidu Netdisk](https://pan.baidu.com/s/1hpENH_SkLDdwXkmlsX0GUQ?pwd=wu8t) (extraction code: wu8t). After downloading, place the `det` and `rec` models in `./models/ppocrv5/` to replace the existing ones.
  58. ## 🚀 One-Click Run
  59. ```bash
  60. python test_ocr.py
  61. ```
  62. ## 📡 API Service (CPU Example)
  63. ### Start Service
  64. ```bash
  65. python app-service.py
  66. ```
  67. ### Test Example
  68. #### Request
  69. ```bash
  70. curl -X POST http://localhost:5005/ocr \
  71. -H "Content-Type: application/json" \
  72. -d '{"image": "base64_encoded_image_data"}'
  73. ```
  74. #### Response
  75. ```json
  76. {
  77. "processing_time": 0.456,
  78. "results": [
  79. {
  80. "text": "Name",
  81. "confidence": 0.9999361634254456,
  82. "bounding_box": [[4.0, 8.0], [31.0, 8.0], [31.0, 24.0], [4.0, 24.0]]
  83. },
  84. {
  85. "text": "Header",
  86. "confidence": 0.9998759031295776,
  87. "bounding_box": [[233.0, 7.0], [258.0, 7.0], [258.0, 23.0], [233.0, 23.0]]
  88. }
  89. ]
  90. }
  91. ```
  92. ## 🐳 Docker Image Environment (CPU)
  93. ### Build Image
  94. ```bash
  95. docker build -t ocr-service .
  96. ```
  97. ### Run Image
  98. ```bash
  99. docker run -itd --name onnxocr-service-v3 -p 5006:5005 onnxocr-service:v3
  100. ```
  101. ### POST Request
  102. ```
  103. url: ip:5006/ocr
  104. ```
  105. ### Response Example
  106. ```json
  107. {
  108. "processing_time": 0.456,
  109. "results": [
  110. {
  111. "text": "Name",
  112. "confidence": 0.9999361634254456,
  113. "bounding_box": [[4.0, 8.0], [31.0, 8.0], [31.0, 24.0], [4.0, 24.0]]
  114. },
  115. {
  116. "text": "Header",
  117. "confidence": 0.9998759031295776,
  118. "bounding_box": [[233.0, 7.0], [258.0, 7.0], [258.0, 23.0], [233.0, 23.0]]
  119. }
  120. ]
  121. }
  122. ```
  123. ## 🌟 Effect Demonstration
  124. | Example 1 | Example 2 |
  125. |-----------|-----------|
  126. | ![](result_img/r1.png) | ![](result_img/r2.png) |
  127. | Example 3 | Example 4 |
  128. |-----------|-----------|
  129. | ![](result_img/r3.png) | ![](result_img/draw_ocr4.jpg) |
  130. | Example 5 | Example 6 |
  131. |-----------|-----------|
  132. | ![](result_img/draw_ocr5.jpg) | ![](result_img/555.png) |
  133. ## 👨💻 Contact & Communication
  134. ### Career Opportunities
  135. I am currently seeking job opportunities. Welcome to connect!
  136. ![WeChat QR Code](onnxocr/test_images/myQR.jpg)
  137. ### OnnxOCR Community
  138. #### WeChat Group
  139. ![WeChat Group](onnxocr/test_images/微信群.jpg)
  140. #### QQ Group
  141. ![QQ Group](onnxocr/test_images/QQ群.jpg)
  142. ## 🎉 Acknowledgments
  143. Thanks to [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) for technical support!
  144. ## 🌍 Open Source & Donations
  145. I am passionate about open source and AI technology, believing they can bring convenience and help to those in need, making the world a better place. If you recognize this project, you can support it via Alipay or WeChat Pay (please note "Support OnnxOCR" in the remarks).
  146. <img src="onnxocr/test_images/weixin_pay.jpg" alt="WeChat Pay" width="200">
  147. <img src="onnxocr/test_images/zhifubao_pay.jpg" alt="Alipay" width="200">
  148. ## 📈 Star History
  149. [![Star History Chart](https://api.star-history.com/svg?repos=jingsongliujing/OnnxOCR&type=Date)](https://star-history.com/#jingsongliujing/OnnxOCR&Date)
  150. ## 🤝 Contribution Guidelines
  151. Welcome to submit Issues and Pull Requests to improve the project together!