• Stars
    star
    266
  • Rank 154,103 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 1 year ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Formula recognition based on LaTeX-OCR and ONNXRuntime.

Rapid ⚡︎ LaTeX OCR

 

PyPI SemVer2.0

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, 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.

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

Framework

flowchart LR

A(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

TODO

  • Add demo in the hugging face
  • Rewrite LaTeX-OCR GUI version based on rapid_latex_ocr
  • Integrate other better models

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 | Baidu NetDisk.

pip install rapid_latex_ocr

Usage

Used by python script

from rapid_latex_ocr import LatexOCR

model = 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

$ rapid_latex_ocr tests/test_files/6.png

# {\\frac{x^{2}}{a^{2}}}-{\\frac{y^{2}}{b^{2}}}=1
# 0.47902780000000034

Changlog

Click to expand

2023-12-10 v0.0.6 update:

  • Fixed issue #12

2023-12-07 v0.0.5 update:

  • Add the relevant code to automatically download the model when installing the package

2023-09-13 v0.0.4 update:

2023-07-15 v0.0.1 update:

  • First release

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.

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.

More Repositories

1

RapidOCR

Awesome OCR multiple programing languages toolkits based on ONNXRuntime, OpenVION and PaddlePaddle. (将PaddleOCR模型做了转换,采用ONNXRuntime推理,速度很快)
Python
2,639
star
2

RapidASR

商用级开源语音自动识别程序库,开箱即用,全平台支持,中英文混合识别。A Cross-platform implementation of ASR inference. It's based on ONNXRuntime and FunASR. We provide a set of easier APIs to call ASR models.
C++
483
star
3

LabelConvert

🔄 A tool for object detection and image segmentation dataset format conversion.
Python
266
star
4

Knowledge-QA-LLM

QA based on local knowledge and LLM.
Python
189
star
5

RapidStructure

版面分析 | 表格识别 | 文档方向分类
Python
177
star
6

RapidOcrOnnx

rapidocr onnx cpp
C++
146
star
7

TableStructureRec

整理目前开源的表格识别模型,完善前后处理,模型转换为ONNX
Python
130
star
8

RapidOCRPDF

Based on RapidOCR, extract the PDF content.
Python
119
star
9

RapidLayout

Analysis of Chinese and English layouts 中英文版面分析
Python
81
star
10

RapidOcrAndroidOnnx

C++
53
star
11

RapidOcrNcnn

RapidOCR ncnn 推理
C++
50
star
12

PaddleOCRModelConvert

Convert the model in PaddleOCR to ONNX format
Python
45
star
13

LLM-EXAM

大模型中文测试题库-民间版本
45
star
14

RapidTTS

A cross platform implementation of Text-to-Speech based on ONNXRuntime.
Python
32
star
15

OnnxruntimeBuilder

Onnxruntime Builder
Shell
31
star
16

RapidOCRCSharp

C#
28
star
17

OpenCVBuilder

OpenCV Custom Builder
Shell
22
star
18

Paddle2OnnxConvertor

Convert paddle model to onnx model
Python
20
star
19

RapidPunc

A library for adding punctuation into a text from ASR.
C++
17
star
20

RapidOcrAndroidOnnxCompose

opencv onnxruntime ocr android demo, jetpack compose + kotlin
Kotlin
13
star
21

RapidVoice

The engineering implementation of SenseVoice (from Alibaba)
8
star
22

RapidTable

源自PP-Structure的表格识别算法,模型转换为ONNX,推理引擎采用ONNXRuntime,部署简单,无内存泄露问题。
Python
8
star
23

RapidOcrOnnxJvm

RapidOcr onnx java kotlin jni test
Kotlin
7
star
24

RapidOcrAndroidNcnn

C++
6
star
25

RapidLayoutRecover

针对文档类图像,整合版面分析、文字识别、表格识别和公式识别结果,还原版面布局信息。
Python
5
star
26

keyframe_extractor

To extract key frames from a video.
Python
5
star
27

paraformer_simple

Python
4
star
28

LLM-DOC

大模型研究院资料馆
4
star
29

RapidOcrNcnnJvm

RapidOcr ncnn java kotlin jni
Kotlin
4
star
30

RapidAudioKit

It's for the repository of audio resampling tools
C
3
star
31

RapidImgUtil

Image processing library to add some new formats and other supports.
C++
2
star
32

RapidOcrNcnnLibTest

rapid ocr ncnn lib test
CMake
2
star
33

RapidOCRDocs

RapidOCR Document
HTML
2
star
34

VoiceCut

1
star
35

paddleocr2ncnn

Batchfile
1
star
36

RapidAIWebSite

HTML
1
star
37

RapidOcrOnnxLibTest

rapidocr onnx cpp lib test
CMake
1
star
38

RapidPix2Pix

Inference code based on the onnxruntime about pix2pix
Python
1
star