| # UniRec-0.1B: Unified Text and Formula Recognition with 0.1B Parameters | |
| \[[Paper](https://arxiv.org/pdf/2512.21095)\] \[[ModelScope Model](https://www.modelscope.cn/models/topdktu/unirec-0.1b)\] \[[HuggingFace Model](https://huggingface.co/topdu/unirec-0.1b)\] \[[ModelScope Demo](https://www.modelscope.cn/studios/topdktu/OpenOCR-UniRec-Demo)\] \[[Hugging Face Demo](https://huggingface.co/spaces/topdu/OpenOCR-UniRec-Demo)\] \[[Local Demo](#local-demo)\] | |
| ## Introduction | |
| **UniRec** is good at recognizing plain text (words, lines, paragraphs), formulas (single-line, multi-line), and mixed text-and-formulas content. You only need to use a screenshot tool to select the text area from a paper and paste it into the \[[ModelScope Demo](https://www.modelscope.cn/studios/topdktu/OpenOCR-UniRec-Demo)\] or \[[Hugging Face Demo](https://huggingface.co/spaces/topdu/OpenOCR-UniRec-Demo)\]. After clicking Run, the recognition will be completed automatically | |
| ## Get Started with the UniRec | |
| ### Dependencies: | |
| - [PyTorch](http://pytorch.org/) version >= 1.13.0 | |
| - Python version >= 3.7 | |
| ```shell | |
| conda create -n openocr python==3.9 | |
| conda activate openocr | |
| # install gpu version torch >=1.13.0 | |
| 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 | |
| git clone https://github.com/Topdu/OpenOCR.git | |
| ``` | |
| ### Downloding the UniRec Model from ModelScope or Hugging Face | |
| ```shell | |
| cd OpenOCR | |
| pip install -r requirements.txt | |
| # download model from modelscope | |
| modelscope download topdktu/unirec-0.1b --local_dir ./unirec-0.1b | |
| # or download model from huggingface | |
| huggingface-cli download topdu/unirec-0.1b --local-dir ./unirec-0.1b | |
| ``` | |
| ### Inference | |
| ```shell | |
| python tools/infer_rec.py --c ./configs/rec/unirec/focalsvtr_ardecoder_unirec.yml --o Global.infer_img=/path/img_fold or /path/img_file | |
| ``` | |
| ### Local Demo | |
| ```shell | |
| pip install gradio==4.20.0 | |
| python demo_unirec.py | |
| ``` | |
| ## Citation | |
| If you find our method useful for your research, please cite: | |
| ```bibtex | |
| @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} | |
| } | |
| ``` | |