PaddleOCR环境配置与试用官方的模型笔记

首先去github下载:https://github.com/PaddlePaddle/PaddleOCR,然后解压。

一、配置环境

(背景环境:linux+anaconda,CUDA Version: 11.4,无root权限)

1.1新建一个虚拟环境,名字为paddleocr :

conda create -n paddleocr python=3.9
conda activate paddleocr

 1.2安装PaddleOCR的依赖

cd PaddleOCR
pip install -r requirements.txt

1.3安装paddlepaddle GPU版本:

注:尝试使用pip install paddlepaddle-gpu进行安装,报错:RuntimeError: (PreconditionNotMet) Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.

故本处参考【Paddle Detection】跳坑总结 中的问题3,利用如下方法进行安装即可。

conda install paddlepaddle-gpu==2.2.2 cudatoolkit=11.2 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/ -c conda-forge

可参考官网安装

1.4运行测试

>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ... 
W0719 20:56:56.254106 33372 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.4, Runtime API Version: 11.2
W0719 20:56:56.260345 33372 device_context.cc:465] device: 0, cuDNN Version: 8.1.
PaddlePaddle works well on 1 GPU.
W0719 20:57:00.134809 33372 parallel_executor.cc:617] Cannot enable P2P access from 0 to 1
W0719 20:57:00.134840 33372 parallel_executor.cc:617] Cannot enable P2P access from 0 to 2
W0719 20:57:00.134847 33372 parallel_executor.cc:617] Cannot enable P2P access from 1 to 0
W0719 20:57:02.398772 33372 parallel_executor.cc:617] Cannot enable P2P access from 2 to 0
W0719 20:57:08.944207 33372 dynamic_loader.cc:258] You may need to install 'nccl2' from NVIDIA official website: https://developer.nvidia.com/nccl/nccl-downloadbefore install PaddlePaddle.
WARNING:root:PaddlePaddle meets some problem with 3 GPUs. This may be caused by:
 1. There is not enough GPUs visible on your system
 2. Some GPUs are occupied by other process now
 3. NVIDIA-NCCL2 is not installed correctly on your system. Please follow instruction on https://github.com/NVIDIA/nccl-tests 
 to test your NCCL, or reinstall it following https://docs.nvidia.com/deeplearning/sdk/nccl-install-guide/index.html
WARNING:root:
 Original Error is: (PreconditionNotMet) The third-party dynamic library (libnccl.so) that Paddle depends on is not configured correctly. (error code is libnccl.so: cannot open shared object file: No such file or directory)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX; (at /paddle/paddle/fluid/platform/dynload/dynamic_loader.cc:285)

PaddlePaddle is installed successfully ONLY for single GPU! Let's start deep learning with PaddlePaddle now.

提示多卡训练的警告,可以参考:

PaddleOCR多卡运行时报错 NCCL error-CSDN博客

二、试用官方的模型

参考PaddleOCR学习(一)PaddleOCR安装与测试中的试用官方的模型过程即可。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值