Ubuntu配置PaddlePaddle飞桨OCR的环境

安装PaddlePaddle之前可以先建一个虚拟环境(Python版本需要是3.7安装的cuda才是10.2)

conda install pytorch==1.8.1 torchvision==0.9.1 torchaudio==0.8.1 cudatoolkit=10.2 -c pytorch

这个是cuda10.2

具体链接:Ubuntu20.04配置深度学习环境yolov5最简流程_ubuntu yolov5_耳语ai的博客-CSDN博客

1 安装 PaddlePaddle

pip install --upgrade pip

#如果是CUDA9或CUDA10,请运行以下命令安装

python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple


2 安装PPOCRLabel

pip install PPOCRLabel -i https://mirror.baidu.com/pypi/simple

pip install trash-cli -i https://mirror.baidu.com/pypi/simple


3 检查 是否有labelme
检查当前conda 环境中是否安装了labelme 标注工具,如果当前conda环境中又安装了labelme工具无法运行PPOCRLabel,若同时安装了labelme,运行是会报错误:no labs.labelColor model
所以,如果当前conda环境中有labelme工具需要卸载掉:

pip uninstall labelme


4 检查 环境opencv-python 版本
若当前环境中的opencv-python 版本过高会报错:QObject::moveToThread: Current thread (0x5581364d38c0) is not the object’s thread (0x55813a1b08f0).

所以,需要重新安装低版本的opencv-python

pip install opencv-python==4.2.0.32 -i https://pypi.tuna.tsinghua.edu.cn/simple


5 运行
启动【普通模式】,用于打【检测+识别】场景的标签

PPOCRLabel --lang ch


启动 【KIE 模式】,用于打【检测+识别+关键字提取】场景的标签

PPOCRLabel --lang ch --kie True  


也可以进入到 安装目录运行

cd ./PPOCRLabel  

切换到PPOCRLabel目录
 

python PPOCRLabel.py --lang ch

猜你喜欢

转载自blog.csdn.net/m0_60657960/article/details/130489554