无线表格识别模型LORE转换库:ConvertLOREToONNX

引言

总有小伙伴问到阿里的无线表格识别模型是如何转换为ONNX格式的。这个说来有些惭愧,现有的ONNX模型是很久之前转换的了,转换环境已经丢失,且没有做任何笔记。

今天下定决心再次尝试转换,庆幸的是转换成功了。于是有了转换笔记:ConvertLOREToONNX

这次吸取教训,环境文件采用Anaconda导出的,更加详细记录当前转换环境。以下是转换仓库的README,感兴趣小伙伴可以点击文末的“阅读原文”跳转到转换仓库尝试。

1. Clone the source code.
git clone https://github.com/SWHL/ConvertLaTeXOCRToONNX.git
2. Install env.
conda install --yes --file 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)
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值