Datasets:

ArXiv:
Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/datasets-cards)

OpenOCR: A general OCR system with accuracy and efficiency

If you find this project useful, please give us a star๐ŸŒŸ.

license PyPI

๐Ÿš€ Quick Start | English | ็ฎ€ไฝ“ไธญๆ–‡


We aim to establish a unified benchmark for training and evaluating models in scene text detection and recognition. Building on this benchmark, we introduce a general OCR system with accuracy and efficiency, OpenOCR. This repository also serves as the official codebase of the OCR team from the FVL Laboratory, Fudan University.

We sincerely welcome the researcher to recommend OCR or relevant algorithms and point out any potential factual errors or bugs. Upon receiving the suggestions, we will promptly evaluate and critically reproduce them. We look forward to collaborating with you to advance the development of OpenOCR and continuously contribute to the OCR community!

Features

  • ๐Ÿ”ฅOpenDoc-0.1B: Ultra-Lightweight Document Parsing System with 0.1B Parameters

    • [Quick Start] [ModelScope Demo] [Hugging Face Demo] [Local Demo]

      • An ultra-lightweight document parsing system with only 0.1B parameters
      • Two-stage pipeline:
        1. Layout analysis via PP-DocLayoutV2
        2. Unified recognition of text, formulas, and tables using the in-house model UniRec-0.1B
          • In the original version of UniRec-0.1B, only text and formula recognition were supported. In OpenDoc-0.1B, we rebuilt UniRec-0.1B to enable unified recognition of text, formulas, and tables.
      • Supports document parsing for Chinese and English
      • Achieves 90.57% on OmniDocBench (v1.5), outperforming many document parsing models based on multimodal large language models
  • ๐Ÿ”ฅUniRec-0.1B: Unified Text and Formula Recognition with 0.1B Parameters

  • ๐Ÿ”ฅOpenOCR: A general OCR system with accuracy and efficiency

  • ๐Ÿ”ฅSVTRv2: CTC Beats Encoder-Decoder Models in Scene Text Recognition (ICCV 2025)

    • [Paper] [Doc] [Model] [Datasets] [Config, Training and Inference] [Benchmark]
    • Introduction
      • A unified training and evaluation benchmark (on top of Union14M) for Scene Text Recognition
      • Supports 24 Scene Text Recognition methods trained from scratch on the large-scale real dataset Union14M-L-Filter, and will continue to add the latest methods.
      • Improves accuracy by 20-30% compared to models trained based on synthetic datasets.
      • Towards Arbitrary-Shaped Text Recognition and Language modeling with a Single Visual Model.
      • Surpasses Attention-based Encoder-Decoder Methods across challenging scenarios in terms of accuracy and speed
    • Get Started with training a SOTA Scene Text Recognition model from scratch.

Ours OCR algorithms

  • UniRec-0.1B (Yongkun Du, Zhineng Chen, Yazhen Xie, Weikang Bai, Hao Feng, Wei Shi, Yuchen Su, Can Huang, Yu-Gang Jiang. UniRec-0.1B: Unified Text and Formula Recognition with 0.1B Parameters, Preprint. Doc, Paper)
  • MDiff4STR (Yongkun Du, Miaomiao Zhao, Songlin Fan, Zhineng Chen*, Caiyan Jia, Yu-Gang Jiang. MDiff4STR: Mask Diffusion Model for Scene Text Recognition, AAAI 2026 Oral. Doc, Paper)
  • CMER (Weikang Bai, Yongkun Du, Yuchen Su, Yazhen Xie, Zhineng Chen*. Complex Mathematical Expression Recognition: Benchmark, Large-Scale Dataset and Strong Baseline, AAAI 2026. Paper, Code is coming soon.)
  • TextSSR (Xingsong Ye, Yongkun Du, Yunbo Tao, Zhineng Chen*. TextSSR: Diffusion-based Data Synthesis for Scene Text Recognition, ICCV 2025. Paper, Code)
  • SVTRv2 (Yongkun Du, Zhineng Chen*, Hongtao Xie, Caiyan Jia, Yu-Gang Jiang. SVTRv2: CTC Beats Encoder-Decoder Models in Scene Text Recognition, ICCV 2025. Doc, Paper)
  • IGTR (Yongkun Du, Zhineng Chen*, Yuchen Su, Caiyan Jia, Yu-Gang Jiang. Instruction-Guided Scene Text Recognition, TPAMI 2025. Doc, Paper)
  • CPPD (Yongkun Du, Zhineng Chen*, Caiyan Jia, Xiaoting Yin, Chenxia Li, Yuning Du, Yu-Gang Jiang. Context Perception Parallel Decoder for Scene Text Recognition, TPAMI 2025. PaddleOCR Doc, Paper)
  • SMTR&FocalSVTR (Yongkun Du, Zhineng Chen*, Caiyan Jia, Xieping Gao, Yu-Gang Jiang. Out of Length Text Recognition with Sub-String Matching, AAAI 2025. Doc, Paper)
  • DPTR (Shuai Zhao, Yongkun Du, Zhineng Chen*, Yu-Gang Jiang. Decoder Pre-Training with only Text for Scene Text Recognition, ACM MM 2024. Paper)
  • CDistNet (Tianlun Zheng, Zhineng Chen*, Shancheng Fang, Hongtao Xie, Yu-Gang Jiang. CDistNet: Perceiving Multi-Domain Character Distance for Robust Text Recognition, IJCV 2024. Paper)
  • MRN (Tianlun Zheng, Zhineng Chen*, Bingchen Huang, Wei Zhang, Yu-Gang Jiang. MRN: Multiplexed Routing Network for Incremental Multilingual Text Recognition, ICCV 2023. Paper, Code)
  • TPS++ (Tianlun Zheng, Zhineng Chen*, Jinfeng Bai, Hongtao Xie, Yu-Gang Jiang. TPS++: Attention-Enhanced Thin-Plate Spline for Scene Text Recognition, IJCAI 2023. Paper, Code)
  • SVTR (Yongkun Du, Zhineng Chen*, Caiyan Jia, Xiaoting Yin, Tianlun Zheng, Chenxia Li, Yuning Du, Yu-Gang Jiang. SVTR: Scene Text Recognition with a Single Visual Model, IJCAI 2022 (Long). PaddleOCR Doc, Paper)
  • NRTR (Fenfen Sheng, Zhineng Chen, Bo Xu. NRTR: A No-Recurrence Sequence-to-Sequence Model For Scene Text Recognition, ICDAR 2019. Paper)

Recent Updates

Quick Start

Note: OpenOCR supports inference using both the ONNX and Torch frameworks, with the dependency environments for the two frameworks being isolated. When using ONNX for inference, there is no need to install Torch, and vice versa.

1. ONNX Inference

Install OpenOCR and Dependencies:

pip install openocr-python
pip install onnxruntime

Usage:

from openocr import OpenOCR
onnx_engine = OpenOCR(backend='onnx', device='cpu')
img_path = '/path/img_path or /path/img_file'
result, elapse = onnx_engine(img_path)

2. Pytorch inference

Dependencies:

  • PyTorch version >= 1.13.0
  • Python version >= 3.7
conda create -n openocr python==3.8
conda activate openocr
# install gpu version torch
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=11.8 -c pytorch -c nvidia
# or cpu version
conda install pytorch torchvision torchaudio cpuonly -c pytorch

After installing dependencies, the following two installation methods are available. Either one can be chosen.

2.1. Python Modules

Install OpenOCR:

pip install openocr-python

Usage:

from openocr import OpenOCR
engine = OpenOCR()
img_path = '/path/img_path or /path/img_file'
result, elapse = engine(img_path)

# Server mode
# engine = OpenOCR(mode='server')

2.2. Clone this repository:

git clone https://github.com/Topdu/OpenOCR.git
cd OpenOCR
pip install -r requirements.txt
wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/openocr_det_repvit_ch.pth
wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/openocr_repsvtr_ch.pth
# Rec Server model
# wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/openocr_svtrv2_ch.pth

Usage:

# OpenOCR system: Det + Rec model
python tools/infer_e2e.py --img_path=/path/img_fold or /path/img_file
# Det model
python tools/infer_det.py --c ./configs/det/dbnet/repvit_db.yml --o Global.infer_img=/path/img_fold or /path/img_file
# Rec model
python tools/infer_rec.py --c ./configs/rec/svtrv2/repsvtr_ch.yml --o Global.infer_img=/path/img_fold or /path/img_file
Export ONNX model
pip install onnx
python tools/toonnx.py --c configs/rec/svtrv2/repsvtr_ch.yml --o Global.device=cpu
python tools/toonnx.py --c configs/det/dbnet/repvit_db.yml --o Global.device=cpu
Inference with ONNXRuntime
pip install onnxruntime
# OpenOCR system: Det + Rec model
python tools/infer_e2e.py --img_path=/path/img_fold or /path/img_file --backend=onnx --device=cpu
# Det model
python tools/infer_det.py --c ./configs/det/dbnet/repvit_db.yml --o Global.backend=onnx Global.device=cpu Global.infer_img=/path/img_fold or /path/img_file
# Rec model
python tools/infer_rec.py --c ./configs/rec/svtrv2/repsvtr_ch.yml --o Global.backend=onnx Global.device=cpu Global.infer_img=/path/img_fold or /path/img_file

Local Demo

pip install gradio==4.20.0
wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/OCR_e2e_img.tar
tar xf OCR_e2e_img.tar
# start demo
python demo_gradio.py

Reproduction schedule:

Scene Text Recognition

Method Venue Training Evaluation Contributor
CRNN TPAMI 2016 โœ… โœ…
ASTER TPAMI 2019 โœ… โœ… pretto0
NRTR ICDAR 2019 โœ… โœ…
SAR AAAI 2019 โœ… โœ… pretto0
MORAN PR 2019 โœ… โœ…
DAN AAAI 2020 โœ… โœ…
RobustScanner ECCV 2020 โœ… โœ… pretto0
AutoSTR ECCV 2020 โœ… โœ…
SRN CVPR 2020 โœ… โœ… pretto0
SEED CVPR 2020 โœ… โœ…
ABINet CVPR 2021 โœ… โœ… YesianRohn
VisionLAN ICCV 2021 โœ… โœ… YesianRohn
PIMNet ACM MM 2021 TODO
SVTR IJCAI 2022 โœ… โœ…
PARSeq ECCV 2022 โœ… โœ…
MATRN ECCV 2022 โœ… โœ…
MGP-STR ECCV 2022 โœ… โœ…
LPV IJCAI 2023 โœ… โœ…
MAERec(Union14M) ICCV 2023 โœ… โœ…
LISTER ICCV 2023 โœ… โœ…
CDistNet IJCV 2024 โœ… โœ… YesianRohn
BUSNet AAAI 2024 โœ… โœ…
DCTC AAAI 2024 TODO
CAM PR 2024 โœ… โœ…
OTE CVPR 2024 โœ… โœ…
CFF IJCAI 2024 TODO
DPTR ACM MM 2024 fd-zs
VIPTR ACM CIKM 2024 TODO
IGTR TPAMI 2025 โœ… โœ…
SMTR AAAI 2025 โœ… โœ…
CPPD TPAMI 2025 โœ… โœ…
FocalSVTR-CTC AAAI 2025 โœ… โœ…
SVTRv2 ICCV 2025 โœ… โœ…
ResNet+Trans-CTC โœ… โœ…
ViT-CTC โœ… โœ…
MDiff4STR AAAI 2025 Oral โœ… โœ…

Contributors


Yiming Lei (pretto0), Xingsong Ye (YesianRohn), and Shuai Zhao (fd-zs) from the FVL Laboratory, Fudan University, with guidance from Dr. Zhineng Chen (Homepage), completed the majority work of the algorithm reproduction. Grateful for their outstanding contributions.

Scene Text Detection (STD)

TODO

Text Spotting

TODO


Citation

If you find our method useful for your reserach, please cite:

@inproceedings{Du2025SVTRv2,
  title={SVTRv2: CTC Beats Encoder-Decoder Models in Scene Text Recognition},
  author={Yongkun Du and Zhineng Chen and Hongtao Xie and Caiyan Jia and Yu-Gang Jiang},
  booktitle={ICCV},
  year={2025},
  pages={20147-20156}
}

@article{du2025unirec,
  title={UniRec-0.1B: Unified Text and Formula Recognition with 0.1B Parameters},
  author={Yongkun Du and Zhineng Chen and Yazhen Xie and Weikang Bai and Hao Feng and Wei Shi and Yuchen Su and Can Huang and Yu-Gang Jiang},
  journal={arXiv preprint arXiv:2512.21095},
  year={2025}
}

Acknowledgement

This codebase is built based on the PaddleOCR, PytorchOCR, and MMOCR. Thanks for their awesome work!

Downloads last month
-