https://github.com/swhl/convertloretoonnx
Convert LORE model from torch format to ONNX format.
https://github.com/swhl/convertloretoonnx
table-recognition
Last synced: 9 months ago
JSON representation
Convert LORE model from torch format to ONNX format.
- Host: GitHub
- URL: https://github.com/swhl/convertloretoonnx
- Owner: SWHL
- License: mit
- Created: 2024-03-10T06:34:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T03:30:36.000Z (over 1 year ago)
- Last Synced: 2025-04-11T22:37:40.972Z (about 1 year ago)
- Topics: table-recognition
- Language: Python
- Homepage:
- Size: 4.25 MB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Convert LORE to ONNX
This repo is used to convert [LORE](https://www.modelscope.cn/models/iic/cv_resnet-transformer_table-structure-recognition_lore/summary) to ONNX format.
#### 1. Clone the source code
```bash
git clone https://github.com/SWHL/ConvertLaTeXOCRToONNX.git
```
#### 2. Install env
```bash
# 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
```bash
python main.py
```
#### 4. Install `lineless_table_rec`
```bash
pip install lineless_table_rec
```
#### 5. Use
```python
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")
```