SWHL/ConvertLOREToONNX

Convert LORE model from torch format to ONNX format.

12

stars

4

commits

Python

primary language

Oct 28, 2024

updated

table-recognition

README

Convert LORE to ONNX

This repo is used to convert LORE to ONNX format.

1. Clone the source code

git clone https://github.com/SWHL/ConvertLaTeXOCRToONNX.git

2. Install env

# Anaconda
conda env create -f environment.yml

# pip (python 3.10.0)
pip install -r requirements.txt

3. Run the demo, and the converted model is located in the moodels directory

python main.py

4. Install lineless_table_rec

pip install lineless_table_rec

5. Use

from pathlib import Path

from lineless_table_rec import LinelessTableRecognition

detect_path = "models/lore_detect.onnx"
process_path = "models/lore_process.onnx"
engine = LinelessTableRecognition(
    detect_model_path=detect_path, process_model_path=process_path
)

img_path = "images/lineless_table_recognition.jpg"
table_str, elapse = engine(img_path)

print(table_str)
print(elapse)

with open(f"{Path(img_path).stem}.html", "w", encoding="utf-8") as f:
    f.write(table_str)

print("ok")

Contributors

SWHL

4 commits

SWHL/ConvertLOREToONNX

Convert LORE model from torch format to ONNX format.

12

stars

4

commits

Python

primary language

Oct 28, 2024

updated

table-recognition

README

Convert LORE to ONNX

This repo is used to convert LORE to ONNX format.

1. Clone the source code

git clone https://github.com/SWHL/ConvertLaTeXOCRToONNX.git

2. Install env

# Anaconda
conda env create -f environment.yml

# pip (python 3.10.0)
pip install -r requirements.txt

3. Run the demo, and the converted model is located in the moodels directory

python main.py

4. Install lineless_table_rec

pip install lineless_table_rec

5. Use

from pathlib import Path

from lineless_table_rec import LinelessTableRecognition

detect_path = "models/lore_detect.onnx"
process_path = "models/lore_process.onnx"
engine = LinelessTableRecognition(
    detect_model_path=detect_path, process_model_path=process_path
)

img_path = "images/lineless_table_recognition.jpg"
table_str, elapse = engine(img_path)

print(table_str)
print(elapse)

with open(f"{Path(img_path).stem}.html", "w", encoding="utf-8") as f:
    f.write(table_str)

print("ok")

Contributors

SWHL

4 commits

Languages

Python

98.6%