Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rapidai/rapidlatexocr
Formula recognition based on LaTeX-OCR and ONNXRuntime.
https://github.com/rapidai/rapidlatexocr
equation im2text image-processing img2latex latex latex-ocr math-formula math-formula-recognition math-ocr ocr onnxruntime python
Last synced: 1 day ago
JSON representation
Formula recognition based on LaTeX-OCR and ONNXRuntime.
- Host: GitHub
- URL: https://github.com/rapidai/rapidlatexocr
- Owner: RapidAI
- License: mit
- Created: 2023-07-13T13:20:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-03T14:41:54.000Z (about 2 months ago)
- Last Synced: 2024-12-14T07:03:39.369Z (9 days ago)
- Topics: equation, im2text, image-processing, img2latex, latex, latex-ocr, math-formula, math-formula-recognition, math-ocr, ocr, onnxruntime, python
- Language: Python
- Homepage:
- Size: 96.7 KB
- Stars: 310
- Watchers: 8
- Forks: 28
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
### Introduction
`rapid_latex_ocr` is a tool to convert formula images to latex format.
**The reasoning code in the repo is modified from [LaTeX-OCR](https://github.com/lukas-blecher/LaTeX-OCR), the model has all been converted to ONNX format, and the reasoning code has been simplified, Inference is faster and easier to deploy.**
The repo only has codes based on `ONNXRuntime` or `OpenVINO` inference in onnx format, and does not contain training model codes. If you want to train your own model, please move to [LaTeX-OCR](https://github.com/lukas-blecher/LaTeX-OCR).
If it helps you, please give a little star ⭐ or sponsor a cup of coffee (click the link in Sponsor at the top of the page)
🔥 Model Conversion Notes 👉 [ConvertLaTeXOCRToONNX](https://github.com/SWHL/ConvertLaTeXOCRToONNX)
### [Online Demo](https://swhl-rapidlatexocrdemo.hf.space)
### Framework
```mermaid
flowchart LRA(Preprocess Formula\n ProcessLaTeXFormulaTools) --> B(Train\n LaTeX-OCR) --> C(Convert \n ConvertLaTeXOCRToONNX) --> D(Deploy\n RapidLaTeXOCR)
click A "https://github.com/SWHL/ProcessLaTeXFormulaTools" _blank
click B "https://github.com/lukas-blecher/LaTeX-OCR" _blank
click C "https://github.com/SWHL/ConvertLaTeXOCRToONNX" _blank
click D "https://github.com/RapidAI/RapidLaTeXOCR" _blank
```### Installation
>
> [!NOTE]
> When installing the package through pip, the model file will be automatically downloaded and placed under models in the installation directory.
>
> If the Internet speed is slow, you can download it separately through [Google Drive](https://drive.google.com/drive/folders/1e8BgLk1cPQDSZjgoLgloFYMAQWLTaroQ?usp=sharing) or [Baidu NetDisk](https://pan.baidu.com/s/1rnYmmKp2HhOkYVFehUiMNg?pwd=dh72).```bash
pip install rapid_latex_ocr
```### Usage
#### Used by python script
```python
from rapid_latex_ocr import LaTeXOCRmodel = LaTeXOCR()
img_path = "tests/test_files/6.png"
with open(img_path, "rb") as f:
data = f.read()res, elapse = model(data)
print(res)
print(elapse)
```#### Used by command line
```bash
$ rapid_latex_ocr tests/test_files/6.png# {\\frac{x^{2}}{a^{2}}}-{\\frac{y^{2}}{b^{2}}}=1
# 0.47902780000000034
```### Code Contributors
### Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
### [Sponsor](https://swhl.github.io/RapidVideOCR/docs/sponsor/)
If you want to sponsor the project, you can directly click the **Buy me a coffee** image, please write a note (e.g. your github account name) to facilitate adding to the sponsorship list below.
### License
This project is released under the [MIT license](./LICENSE).