PaddleOCR
Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Top Related Projects
Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities
Tesseract Open Source OCR Engine (main repository)
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
Text recognition (optical character recognition) with deep learning methods, ICCV 2019
Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Quick Overview
PaddleOCR is an open-source Optical Character Recognition (OCR) toolkit developed by Baidu's PaddlePaddle team. It provides a comprehensive set of tools for text detection, recognition, and layout analysis, supporting multiple languages and offering both lightweight and accurate models for various OCR tasks.
Pros
- Comprehensive OCR solution with support for multiple languages and tasks
- Offers both lightweight models for mobile devices and high-accuracy models for server-side applications
- Active development and frequent updates from the PaddlePaddle team
- Extensive documentation and examples for easy integration
Cons
- Primarily based on the PaddlePaddle deep learning framework, which may have a steeper learning curve for those familiar with other frameworks
- Some advanced features may require more computational resources
- Documentation is sometimes not fully up-to-date with the latest features
- Limited community support compared to some other popular OCR libraries
Code Examples
- Basic text detection and recognition:
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr('image.jpg')
for line in result:
print(line)
- Extracting text from a specific region of an image:
import cv2
from paddleocr import PaddleOCR
image = cv2.imread('image.jpg')
roi = image[100:300, 200:400] # Define region of interest
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr(roi)
for line in result:
print(line[1][0]) # Print recognized text
- Using a custom dictionary for text recognition:
from paddleocr import PaddleOCR
custom_dict = 'path/to/custom_dict.txt'
ocr = PaddleOCR(use_angle_cls=True, lang='en', rec_char_dict_path=custom_dict)
result = ocr.ocr('image.jpg')
for line in result:
print(line)
Getting Started
To get started with PaddleOCR:
- Install PaddleOCR:
pip install paddleocr
- Use PaddleOCR in your Python script:
from paddleocr import PaddleOCR
# Initialize PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en')
# Perform OCR on an image
result = ocr.ocr('path/to/your/image.jpg')
# Print the results
for line in result:
print(line)
For more advanced usage and customization options, refer to the official documentation on the PaddleOCR GitHub repository.
Competitor Comparisons
Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities
Pros of UniLM
- Broader scope: Supports a wide range of natural language processing tasks beyond OCR
- More advanced language understanding: Utilizes large-scale pre-trained models for improved performance
- Active research focus: Regularly updated with cutting-edge NLP techniques and models
Cons of UniLM
- Less specialized for OCR: May not offer as many OCR-specific features and optimizations
- Potentially more complex to use: Broader scope may require more setup and configuration for OCR tasks
- Larger resource requirements: Pre-trained models can be computationally intensive
Code Comparison
PaddleOCR:
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr('image.jpg')
UniLM (using LayoutLM for OCR):
from transformers import LayoutLMForTokenClassification, LayoutLMTokenizer
model = LayoutLMForTokenClassification.from_pretrained("microsoft/layoutlm-base-uncased")
tokenizer = LayoutLMTokenizer.from_pretrained("microsoft/layoutlm-base-uncased")
Note: The code snippets demonstrate basic setup and may not reflect the full complexity of using each library for OCR tasks.
Tesseract Open Source OCR Engine (main repository)
Pros of Tesseract
- Mature and widely adopted OCR engine with a long history
- Supports a wide range of languages and scripts
- Highly customizable with extensive documentation
Cons of Tesseract
- Generally slower performance compared to modern deep learning-based approaches
- May struggle with complex layouts or low-quality images
- Requires more manual configuration for optimal results
Code Comparison
Tesseract
import pytesseract
from PIL import Image
image = Image.open('image.png')
text = pytesseract.image_to_string(image)
print(text)
PaddleOCR
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr('image.png', cls=True)
for line in result:
print(line[1][0])
PaddleOCR offers a more streamlined API for OCR tasks, with built-in support for text detection, recognition, and angle classification. Tesseract, while powerful, often requires additional preprocessing steps for optimal results. PaddleOCR's deep learning approach generally provides better performance on complex layouts and low-quality images, but Tesseract's extensive language support and customization options make it a versatile choice for specific use cases.
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
Pros of EasyOCR
- Simpler installation process and easier to use for beginners
- Supports a wider range of languages (80+) out of the box
- Better documentation and examples for quick start
Cons of EasyOCR
- Generally slower inference speed compared to PaddleOCR
- Less flexibility and customization options for advanced users
- Smaller community and fewer pre-trained models available
Code Comparison
EasyOCR:
import easyocr
reader = easyocr.Reader(['en'])
result = reader.readtext('image.jpg')
PaddleOCR:
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr('image.jpg')
Both libraries offer simple APIs for OCR tasks, but PaddleOCR provides more options for fine-tuning and optimization. EasyOCR's code is more straightforward, making it easier for beginners to get started quickly. PaddleOCR's approach allows for more advanced configurations, which can be beneficial for complex OCR tasks or when performance optimization is crucial.
Text recognition (optical character recognition) with deep learning methods, ICCV 2019
Pros of deep-text-recognition-benchmark
- Focuses specifically on text recognition, providing a comprehensive benchmark for various models
- Implements multiple state-of-the-art architectures, allowing for easy comparison and experimentation
- Offers a modular design, making it easier to swap components and test different combinations
Cons of deep-text-recognition-benchmark
- Limited to text recognition, while PaddleOCR offers a more comprehensive OCR pipeline
- Less extensive documentation and fewer pre-trained models compared to PaddleOCR
- Smaller community and fewer updates, potentially leading to slower development and support
Code Comparison
deep-text-recognition-benchmark:
model = Model(opt)
converter = AttnLabelConverter(opt.character)
criterion = torch.nn.CrossEntropyLoss(ignore_index=0).to(device)
PaddleOCR:
model = build_model(config['Architecture'])
loss_class = build_loss(config['Loss'])
optimizer = build_optimizer(config['Optimizer'], model)
Both repositories use similar approaches for model initialization and loss function definition. However, PaddleOCR's code structure is more modular and configurable, allowing for easier customization of the OCR pipeline.
Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Pros of Mask_RCNN
- Specialized in instance segmentation, offering precise object detection and segmentation
- Well-documented with extensive tutorials and examples
- Supports both TensorFlow 1.x and 2.x
Cons of Mask_RCNN
- Limited to object detection and segmentation tasks
- Less frequent updates and maintenance compared to PaddleOCR
- Steeper learning curve for beginners
Code Comparison
Mask_RCNN:
import mrcnn.model as modellib
from mrcnn import utils
class InferenceConfig(coco.CocoConfig):
GPU_COUNT = 1
IMAGES_PER_GPU = 1
model = modellib.MaskRCNN(mode="inference", config=InferenceConfig(), model_dir=MODEL_DIR)
PaddleOCR:
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr('image.jpg', cls=True)
The code snippets highlight the difference in focus between the two repositories. Mask_RCNN requires more setup for object detection and segmentation, while PaddleOCR offers a simpler interface for OCR tasks.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
English | ç®ä½ä¸æ
ç®ä»
PaddleOCR æ¨å¨æé ä¸å¥ä¸°å¯ãé¢å ãä¸å®ç¨ç OCR å·¥å ·åºï¼å©åå¼åè è®ç»åºæ´å¥½ç模åï¼å¹¶åºç¨è½å°ã
ð 社åº
PaddleOCR ç± PMC çç£ãIssues å PRs å°å¨å°½åçåºç¡ä¸è¿è¡å®¡æ¥ã欲äºè§£ PaddlePaddle 社åºçå®æ´æ¦åµï¼è¯·è®¿é® communityã
â ï¸æ³¨æï¼Issues模åä» ç¨æ¥æ¥åç¨åºðBugï¼å ¶ä½æé®è¯·ç§»æ¥Discussions模åæé®ãå¦ææIssueä¸æ¯Bugï¼ä¼è¢«ç§»å°Discussions模åï¼æ¬è¯·è° 解ã
ð£ è¿ææ´æ°(more)
-
ð¥ð¥ãPaddleOCR 2.9 åå¸ï¼æ£å¼å¼æºææ¬å¾åæºè½åæå©å¨ãï¼ææ¬å¾åçé¢è§£æå®ç°é«ç²¾åº¦å®æ¶é¢æµï¼ä½ä»£ç å ¨æµç¨å¼åå é产ä¸åºç¨ãéæææ¬å¾åç«æ£ãçé¢åºåæ£æµã常è§ææ¬æ£æµãå°ç« ææ¬æ£æµãææ¬è¯å«ãè¡¨æ ¼è¯å«çå¤åè½ã6æ¡æ¨¡å产线ä¸é®è°ç¨ï¼æ¾èéä½å¼åææ¬ãæ¯æé«æ§è½æ¨çãæå¡åé¨ç½²å端侧é¨ç½²çå¤ç§é¨ç½²æ¹å¼ã10æ24æ¥ï¼å¨åï¼19ï¼00ç´æ为æ¨æ·±åº¦è§£æææ°å级亮ç¹ã æ¥åé¾æ¥
-
ð¥2024.10.1 æ·»å OCRé¢åä½ä»£ç å ¨æµç¨å¼åè½å:
-
é£æ¡¨ä½ä»£ç å¼åå·¥å ·PaddleXï¼ä¾æäºPaddleOCRçå è¿ææ¯ï¼æ¯æäºOCRé¢åçä½ä»£ç å ¨æµç¨å¼åè½åï¼
- ð¨ 模å丰å¯ä¸é®è°ç¨ï¼å°ææ¬å¾åæºè½åæãéç¨OCRãéç¨çé¢è§£æãéç¨è¡¨æ ¼è¯å«ãå ¬å¼è¯å«ãå°ç« ææ¬è¯å«æ¶åç17个模åæ´å为6æ¡æ¨¡å产线ï¼éè¿æç®çPython APIä¸é®è°ç¨ï¼å¿«éä½éªæ¨¡åææãæ¤å¤ï¼åä¸å¥APIï¼ä¹æ¯æå¾ååç±»ãç®æ æ£æµãå¾ååå²ãæ¶åºé¢æµçå ±è®¡200+模åï¼å½¢æ20+ååè½æ¨¡åï¼æ¹ä¾¿å¼åè è¿è¡æ¨¡åç»å使ç¨ã
- ðæé«æçéä½é¨æ§ï¼æä¾åºäºç»ä¸å½ä»¤åå¾å½¢çé¢ä¸¤ç§æ¹å¼ï¼å®ç°æ¨¡åç®æ´é«æç使ç¨ãç»åä¸å®å¶ãæ¯æé«æ§è½æ¨çãæå¡åé¨ç½²å端侧é¨ç½²çå¤ç§é¨ç½²æ¹å¼ãæ¤å¤ï¼å¯¹äºåç§ä¸»æµç¡¬ä»¶å¦è±ä¼è¾¾GPUãæä»è¯ãæè ¾ãå¯æ¦çºªåæµ·å çï¼è¿è¡æ¨¡åå¼åæ¶ï¼é½å¯ä»¥**æ ç¼åæ¢**ã
-
æ¯æææ¡£åºæ¯ä¿¡æ¯æ½åv3PP-ChatOCRv3-docãåºäºRT-DETRçé«ç²¾åº¦çé¢åºåæ£æµæ¨¡ååPicoDetçé«æççé¢åºåæ£æµæ¨¡åãé«ç²¾åº¦è¡¨æ ¼ç»æè¯å«æ¨¡åSLANet_Plusãææ¬å¾åç«æ£æ¨¡åUVDocãå ¬å¼è¯å«æ¨¡åLatexOCRãåºäºPP-LCNetçææ¡£å¾åæ¹åå类模å
-
-
ð¥2024.7 æ·»å PaddleOCR ç®æ³æ¨¡åææèµå åæ¹æ¡ï¼
- èµé¢ä¸ï¼OCR 端å°ç«¯è¯å«ä»»å¡å åæ¹æ¡ââåºæ¯ææ¬è¯å«ç®æ³-SVTRv2ï¼
- èµé¢äºï¼éç¨è¡¨æ ¼è¯å«ä»»å¡å åæ¹æ¡ââè¡¨æ ¼è¯å«ç®æ³-SLANet-LCNetV2ã
ð ç¹æ§
æ¯æå¤ç§ OCR ç¸å ³å沿ç®æ³ï¼å¨æ¤åºç¡ä¸æé 产ä¸çº§ç¹è²æ¨¡åPP-OCRãPP-StructureåPP-ChatOCRï¼å¹¶æéæ°æ®ç产ã模åè®ç»ãå缩ãé¢æµé¨ç½²å ¨æµç¨ã
â¡ å¿«éå¼å§
ð¥ ä½ä»£ç å ¨æµç¨å¼å
ð ææ¡£
å®æ´æ档请移æ¥ï¼docs
ðãå¨æå¦ OCRãçµå书
ð è´¡ç®è
âï¸ Star
许å¯è¯ä¹¦
æ¬é¡¹ç®çåå¸å Apache License Version 2.0 许å¯è®¤è¯ã
Top Related Projects
Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities
Tesseract Open Source OCR Engine (main repository)
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
Text recognition (optical character recognition) with deep learning methods, ICCV 2019
Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot