# LanyOCR
A general OCR to detect and recognize English texts in an image based on a combination of [EasyOCR](https://github.com/JaidedAI/EasyOCR) and [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR).
LanyOCR automatically merges text boxes into lines even for rotated texts.


# Getting Started
### Install dependencies
```
pip install lanyocr
```
### Run example
```
PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --image_path images/example1.jpg
```
Faster version, a bit less accurate
```
PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --merge_boxes_inference true --image_path images/example1.jpg
```
Switch to different recognizer
```
PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --recognizer_name paddleocr_en_mobile --image_path images/example1.jpg
```
Recognize other languages
```
PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --recognizer_name paddleocr_french_mobile --image_path images/french_example1.jpg
```
Output image will be in outputs/output.jpg
**Supported Languages**
- English: paddleocr_en_server, paddleocr_en_mobile
- French: paddleocr_french_mobile
- Latin: paddleocr_latin_mobile
**Note**: Some unicode characters cannot be visualized correctly by OpenCV, please find the text lines in the console log.
## Validate accuracy
Download ICDAR 2015 dataset
```
bash datasets/download_icdar2015.sh
```
Validate accuracy
```
python benchmark.py
```
## Online API
You can try LanyOCR free on [RapidAPI](https://rapidapi.com/JC1DA/api/lanyocr)
## To Do
[x] Abstract Class/Interface for each component
[x] LanyOcrDetector: outputs locations of text boxes
[x] LanyOcrMerger: merge text boxes into text lines
[x] LanyOcrRecognizer: convert text boxes/lines into text
[x] LanyOcrAngleClassifier: estimate the angle of a text box/line
[ ] Multi-languages support
[X] French
[X] Latin
[ ] German
[ ] Inference using multi-models to improve accuracy
[ ] Add interface to support voting policy
[ ] Expose flags to configure each component in OCR pipeline
## Known issues
[ ] Visualization step: some small texts are drawn in incorrect directions
## License
This project is licensed under the [MIT License](LICENSE).
## Credits
Special thanks to authors and developers of [EasyOCR](https://github.com/JaidedAI/EasyOCR) and [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) projects.
Raw data
{
"_id": null,
"home_page": "https://github.com/JC1DA/lanyocr",
"name": "lanyocr",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": "",
"keywords": "ocr",
"author": "JC1DA",
"author_email": "jc1da.3011@gmail.com",
"download_url": "https://github.com/JC1DA/lanyocr",
"platform": null,
"description": "# LanyOCR\n\nA general OCR to detect and recognize English texts in an image based on a combination of [EasyOCR](https://github.com/JaidedAI/EasyOCR) and [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR).\n\nLanyOCR automatically merges text boxes into lines even for rotated texts.\n\n\n\n\n\n# Getting Started\n### Install dependencies\n```\npip install lanyocr\n```\n\n### Run example\n```\nPYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --image_path images/example1.jpg\n```\n\nFaster version, a bit less accurate\n```\nPYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --merge_boxes_inference true --image_path images/example1.jpg\n```\n\nSwitch to different recognizer\n```\nPYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --recognizer_name paddleocr_en_mobile --image_path images/example1.jpg\n```\n\nRecognize other languages\n```\nPYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --recognizer_name paddleocr_french_mobile --image_path images/french_example1.jpg\n```\n\nOutput image will be in outputs/output.jpg\n\n**Supported Languages**\n- English: paddleocr_en_server, paddleocr_en_mobile\n- French: paddleocr_french_mobile\n- Latin: paddleocr_latin_mobile\n\n**Note**: Some unicode characters cannot be visualized correctly by OpenCV, please find the text lines in the console log.\n\n## Validate accuracy\n\nDownload ICDAR 2015 dataset\n```\nbash datasets/download_icdar2015.sh\n```\n\nValidate accuracy\n```\npython benchmark.py\n```\n\n\n## Online API\n\nYou can try LanyOCR free on [RapidAPI](https://rapidapi.com/JC1DA/api/lanyocr)\n\n## To Do\n [x] Abstract Class/Interface for each component\n [x] LanyOcrDetector: outputs locations of text boxes \n [x] LanyOcrMerger: merge text boxes into text lines\n [x] LanyOcrRecognizer: convert text boxes/lines into text\n [x] LanyOcrAngleClassifier: estimate the angle of a text box/line\n\n [ ] Multi-languages support\n [X] French \n [X] Latin\n [ ] German\n\n [ ] Inference using multi-models to improve accuracy\n [ ] Add interface to support voting policy\n\n [ ] Expose flags to configure each component in OCR pipeline\n\n## Known issues\n [ ] Visualization step: some small texts are drawn in incorrect directions\n\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Credits\nSpecial thanks to authors and developers of [EasyOCR](https://github.com/JaidedAI/EasyOCR) and [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) projects.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An OCR library for Python",
"version": "0.1.12",
"split_keywords": [
"ocr"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a66f54825573a737b22a35da73df291af5d9904384de4083527b40e082c3a233",
"md5": "8d87f778d6534f9281d93a1e4c37ee15",
"sha256": "132171cdd81efbb9dd46c929adc9bbbed0c4e3185f24deffeaa399d53c844801"
},
"downloads": -1,
"filename": "lanyocr-0.1.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8d87f778d6534f9281d93a1e4c37ee15",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 90941,
"upload_time": "2023-03-30T03:20:52",
"upload_time_iso_8601": "2023-03-30T03:20:52.617220Z",
"url": "https://files.pythonhosted.org/packages/a6/6f/54825573a737b22a35da73df291af5d9904384de4083527b40e082c3a233/lanyocr-0.1.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-30 03:20:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "JC1DA",
"github_project": "lanyocr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "lanyocr"
}