新一代GOT-OCR端到端模型本地部署

GOT-OCR本地部署:

一:项目介绍:这是一款对纯文本,公式等进行识别的工具

项目地址:https://github.com/Ucas-HaoranWei/GOT-OCR2.0

二:准备环境与工具:python3.10、CUDA12.2

三:部署步骤:

  1. 将项目文件下载到本地

  1. 创建虚拟环境:conda create -n got python=3.10 -y

  1. 激活虚拟环境:conda activate got

  1. 进入项目所在文件夹,如:

D:

cd D:\liu\Project\GOT-OCR2.0-main\GOT-OCR-2.0-master

  1. 使用项目安装文件安装依赖:pip install -e .

  1. 重装与本机对应版本的pytorch(因为项目文件安装的pytorch文件可能与本机cuda版本不对应,此处也可修改其项目文件中下载pytorch字段):pip install torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu121
  2. 输入命令单独安装Flash-Attention:

pip install ninja

pip install flash-attn --no-build-isolation(此条命令耗时较久,本次安装大约耗时三小时)

  1. 下载模型(前两个需要科学上网):

Huggingfacehttps://huggingface.co/ucaslcl/GOT-OCR2_0

Google Drivedrive.google.com

BaiduYun:百度网盘 请输入提取码 (baidu.com) 提取码:OCR2

  1. 本地运行

      纯文本识别:python GOT/demo/run_ocr_2.0.py  --model-name  GOT_weights/  --image-file  file.png  --type ocr

格式化文本识别: python GOT/demo/run_ocr_2.0.py  --model-name  GOT_weights/  --image-file  file.png  --type format

更多功能见官网:

可能出现的问题:本人在安装过程中出现报错RuntimeError: Numpy is not available,大概原因是版本不兼容,使用命令pip install numpy==1.24.4重新安装其他版本numpy

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值