课程精品网站开发,如何自建网站入口,php商城,标点狗logo设计官网引言
总有小伙伴问到阿里的无线表格识别模型是如何转换为ONNX格式的。这个说来有些惭愧#xff0c;现有的ONNX模型是很久之前转换的了#xff0c;转换环境已经丢失#xff0c;且没有做任何笔记。
今天下定决心再次尝试转换#xff0c;庆幸的是转换成功了。于是有了转换笔…引言
总有小伙伴问到阿里的无线表格识别模型是如何转换为ONNX格式的。这个说来有些惭愧现有的ONNX模型是很久之前转换的了转换环境已经丢失且没有做任何笔记。
今天下定决心再次尝试转换庆幸的是转换成功了。于是有了转换笔记ConvertLOREToONNX。
这次吸取教训环境文件采用Anaconda导出的更加详细记录当前转换环境。以下是转换仓库的README感兴趣小伙伴可以点击文末的“阅读原文”跳转到转换仓库尝试。
1. Clone the source code.
git clone https://github.com/SWHL/ConvertLaTeXOCRToONNX.git2. Install env.
conda install --yes --file requirements.txt3. Run the demo, and the converted model is located in the moodels directory.
python main.py4. Install lineless_table_rec
pip install lineless_table_rec5. Use
from pathlib import Pathfrom lineless_table_rec import LinelessTableRecognitiondetect_path models/lore_detect.onnx
process_path models/lore_process.onnx
engine LinelessTableRecognition(detect_model_pathdetect_path, process_model_pathprocess_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, encodingutf-8) as f:f.write(table_str)print(ok)