{"id":28652263,"url":"https://github.com/robbyzhaox/myocr","last_synced_at":"2025-06-13T06:07:14.677Z","repository":{"id":288241791,"uuid":"947658754","full_name":"robbyzhaox/myocr","owner":"robbyzhaox","description":"A highly extensible and customizable framework for building OCR systems.","archived":false,"fork":false,"pushed_at":"2025-05-25T06:37:34.000Z","size":8720,"stargazers_count":254,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-25T07:35:38.697Z","etag":null,"topics":["ai","cv","machine-learning","ocr"],"latest_commit_sha":null,"homepage":"https://robbyzhaox.github.io/myocr/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robbyzhaox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-13T03:27:27.000Z","updated_at":"2025-05-25T06:37:08.000Z","dependencies_parsed_at":"2025-05-15T03:47:27.311Z","dependency_job_id":null,"html_url":"https://github.com/robbyzhaox/myocr","commit_stats":null,"previous_names":["robbyzhaox/myocr"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/robbyzhaox/myocr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbyzhaox%2Fmyocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbyzhaox%2Fmyocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbyzhaox%2Fmyocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbyzhaox%2Fmyocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robbyzhaox","download_url":"https://codeload.github.com/robbyzhaox/myocr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbyzhaox%2Fmyocr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259592261,"owners_count":22881266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cv","machine-learning","ocr"],"created_at":"2025-06-13T06:02:10.108Z","updated_at":"2025-06-13T06:07:14.197Z","avatar_url":"https://github.com/robbyzhaox.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1 align=\"center\"\u003eMyOCR - Advanced OCR Pipeline Builder\u003c/h1\u003e\n    \u003cimg width=\"200\" alt=\"myocr logo\" src=\"https://raw.githubusercontent.com/robbyzhaox/myocr/refs/heads/main/documentation/docs/assets/images/logomain.png\"\u003e\n\n[![Docs](https://img.shields.io/badge/Docs-online-brightgreen)](https://robbyzhaox.github.io/myocr/)\n[![HuggingFace](https://img.shields.io/badge/HuggingFace-model-yellow?logo=huggingface\u0026logoColor=white\u0026labelColor=ffcc00)](https://huggingface.co/spaces/robbyzhaox/myocr)\n[![Docker](https://img.shields.io/docker/pulls/robbyzhaox/myocr?logo=docker\u0026label=Docker%20Pulls)](https://hub.docker.com/r/robbyzhaox/myocr)\n[![PyPI](https://img.shields.io/pypi/v/myocr-kit?logo=pypi\u0026label=Pypi)](https://pypi.org/project/myocr-kit/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](LICENSE)\n\nEnglish | [简体中文](./README_zh.md)\n\u003c/div\u003e\n\nMyOCR is a highly extensible and customizable framework for building OCR systems. Engineers can easily train, integrate deep learning models into custom OCR pipelines for real-world applications.\n\nTry the online demo on \n[HuggingFace](https://huggingface.co/spaces/robbyzhaox/myocr) or [ModelScope](https://modelscope.cn/studios/robbyzhao/myocr/summary)\n\n## **🌟 Key Features**:\n\n**⚡️ End-to-End OCR Development Framework** – Designed for developers to build and integrate detection, recognition, and custom OCR models in a unified and flexible pipeline.\n\n**🛠️ Modular \u0026 Extensible** – Mix and match components - swap models, predictors, or input output processors with minimal changes.\n\n**🔌 Developer-Friendly by Design** - Clean Python APIs, prebuilt pipelines and processors, and straightforward customization for training and inference.\n\n**🚀 Production-Ready Performance** – ONNX runtime support for fast CPU/GPU inference, support various ways of deployment.\n\n## 📣 Updates\n- **🔥2025.05.17 MyOCR v0.1.1 released**\n\n\n## 🛠️ Installation\n\n### 📦 Requirements\n- Python 3.11+\n- CUDA: Version 12.6 or higher is recommended for GPU acceleration. CPU-only mode is also supported.\n- Operating System: Linux, macOS, or Windows.\n\n### 📥  Install Dependencies\n\n```bash\n# Clone the code from GitHub\ngit clone https://github.com/robbyzhaox/myocr.git\ncd myocr\n\n# You can create your own venv before the following steps\n# Install dependencies\npip install -e .\n\n# Development environment installation\npip install -e \".[dev]\"\n\n# Download pre-trained model weights to models\n# for Linux, macOS\nmkdir -p ~/.MyOCR/models/\n# for Windows, the \"models\" directory can be created in the current path\nDownload weights from: https://drive.google.com/drive/folders/1RXppgx4XA_pBX9Ll4HFgWyhECh5JtHnY\n# Alternative download link: https://pan.baidu.com/s/122p9zqepWfbEmZPKqkzGBA?pwd=yq6j\n```\n\n## 🚀 Quick Start\n\n### 🖥️ Local Inference\n\n#### Basic OCR Recognition\n\n```python\nfrom myocr.pipelines import CommonOCRPipeline\n\n# Initialize common OCR pipeline (using GPU)\npipeline = CommonOCRPipeline(\"cuda:0\")  # Use \"cpu\" for CPU mode\n\n# Perform OCR recognition on an image\nresult = pipeline(\"path/to/your/image.jpg\")\nprint(result)\n```\n\n#### Structured OCR Output (Example: Invoice Information Extraction)\n\nconfig chat_bot in myocr.pipelines.config.structured_output_pipeline.yaml\n```yaml\nchat_bot:\n  model: qwen2.5:14b\n  base_url: http://127.0.0.1:11434/v1\n  api_key: 'key'\n```\n**Note:** chat bot currently support:\n- Ollama API\n- OpenAI API\n\n\n```python\nfrom pydantic import BaseModel, Field\nfrom myocr.pipelines import StructuredOutputOCRPipeline\n\n# Define output data model, refer to InvoiceModel in main.py\n\n# Initialize structured OCR pipeline\npipeline = StructuredOutputOCRPipeline(\"cuda:0\", InvoiceModel)\n\n# Process image and get structured data\nresult = pipeline(\"path/to/invoice.jpg\")\nprint(result.to_dict())\n```\n\n### 🐳 Docker Deployment\n\nThe framework provides support for Docker deployment, which can be built and run using the following commands:\n\n#### Run the Docker Container\n\n```bash\ndocker run -d -p 8000:8000 robbyzhaox/myocr:latest\n\n# set the environment variables like following with -e option of docker run if you want use the StructuredOutputOCRPipline\ndocker run -d \\\n  -p 8000:8000 \\\n  -e CHAT_BOT_MODEL=\"qwen2.5:14b\" \\\n  -e CHAT_BOT_BASEURL=\"http://127.0.0.1:11434/v1\" \\\n  -e CHAT_BOT_APIKEY=\"key\" \\\n  robbyzhaox/myocr:latest\n```\n\n#### Accessing API Endpoints (Docker)\n\n```bash\nIMAGE_PATH=\"your_image.jpg\"\n\nBASE64_IMAGE=$(base64 -w 0 \"$IMAGE_PATH\")  # Linux\n#BASE64_IMAGE=$(base64 -i \"$IMAGE_PATH\" | tr -d '\\n') # macOS\n\ncurl -X POST \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"image\\\": \\\"${BASE64_IMAGE}\\\"}\" \\\n  http://localhost:8000/ocr\n\n```\n\n### 🔗 Using Rest API\n\nThe framework provides a simple Flask API service that can be called via HTTP interface:\n\n```bash\n# Start the service default port: 5000\npython main.py \n```\n\nAPI endpoints:\n- `GET /ping`: Check if the service is running properly\n- `POST /ocr`: Basic OCR recognition\n- `POST /ocr-json`: Structured OCR output\n\nWe also have a UI for these endpoints, please refer to [doc-insight-ui](https://github.com/robbyzhaox/doc-insight-ui)\n\n\n## 🎖 Contribution Guidelines\n\nWe welcome any form of contribution, including but not limited to:\n\n- Submitting bug reports\n- Adding new features\n- Improving documentation\n- Optimizing performance\n\n## 📄 License\n\nThis project is open-sourced under the Apache 2.0 License, see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobbyzhaox%2Fmyocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobbyzhaox%2Fmyocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobbyzhaox%2Fmyocr/lists"}