当前位置: 首页 > news >正文

新闻头条最新消息今日头条上海网络排名优化

新闻头条最新消息今日头条,上海网络排名优化,重庆建设工程信息网招标公告,自已做好的网站怎么做后台接前文,本文介绍制作PaddleOCR/PaddleHub的GPU版本Docker镜像,以便在GPU环境下高效运行。 环境依赖 🔔 镜像制作过程在下述环境中进行的,酌情参考。 基础环境 ubuntu 22.04gcc/g++ 11.04Python 3.10paddlepaddle-gpu==2.6.1.post120paddleocr 2.7.5opencv-python 4.9.0.8…

接前文,本文介绍制作PaddleOCR/PaddleHub的GPU版本Docker镜像,以便在GPU环境下高效运行。

环境依赖

🔔  镜像制作过程在下述环境中进行的,酌情参考。

基础环境

  • ubuntu 22.04
  • gcc/g++ 11.04
  • Python 3.10
  • paddlepaddle-gpu==2.6.1.post120
  • paddleocr 2.7.5
  • opencv-python 4.9.0.80
  • paddlehub 2.4.0

GPU环境

  • cuda 12.2
  • Driver API Version: 12.4
  • Runtime API Version: 11.8

环境变量

必须的步骤

export CUDA_VISIBLE_DEVICES=0export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-12.2/bin:$PATH
export CUDA_HOME=/usr/local/cuda-12.2

基础镜像

拉取官方镜像并启动容器:

docker run -it --gpus all --name=paddlegpu -d paddlepaddle-gpu:2.6.1

说明:

如果无法拉取这个镜像(或嫌弃该镜像内容太多),也可以使用前文中生成的镜像 paddlehub:base ,然后逐步处理。

安装paddlepaddle-gpu

安装 CUDA12.0 包含 cuDNN 动态链接库的 PaddlePaddle

python3 -m pip install paddlepaddle-gpu==2.6.1.post120 -f https://www.paddlepaddle.org.cn/whl/linux/cudnnin/stable.html

验证

python3.10 -c "import paddle; paddle.utils.run_check()"

cuda和cuDNN安装完成后,验证正常如下:

root@b40610924ca2:/usr/local/cuda-12.2/targets/x86_64-linux/lib# python3.10 -c "import paddle; paddle.utils.run_check()"
Running verify PaddlePaddle program ... 
I0511 02:00:54.641423   814 program_interpreter.cc:212] New Executor is Running.
W0511 02:00:54.643276   814 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.0, Driver API Version: 12.4, Runtime API Version: 11.8
W0511 02:00:54.643945   814 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9.
I0511 02:00:55.097067   814 interpreter_util.cc:624] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

 可能出现的问题

 执行检测指令后出现异常响应:

root@e93431fbf153:/PaddleOCR# python3.10 -c "import paddle; paddle.utils.run_check()"
/usr/local/lib/python3.10/dist-packages/paddle/base/framework.py:688: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.warnings.warn(
Running verify PaddlePaddle program ... 
[2024-05-10 13:17:24,497] [ WARNING] install_check.py:60 - You are using GPU version PaddlePaddle, but there is no GPU detected on your machine. Maybe CUDA devices is not set properly.Original Error is 
I0510 13:17:24.505074  4123 program_interpreter.cc:212] New Executor is Running.
I0510 13:17:24.539232  4123 interpreter_util.cc:624] Standalone Executor is Used.
PaddlePaddle works well on 1 CPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

解决

安装 CUDA 和 cuDNN。

  • CUDA

如果宿主机安装了CUDA,可直接拷贝到容器内(宿主机上CUDA安装过程不演示):

docker cp /usr/local/cuda paddlegpu:/usr/local# 下面的步骤是因为有软连接。如果没有,则省略
# docker cp /usr/local/cuda-12.2 paddlegpu:/usr/local##添加环境变量
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

容器内查看CUDA安装结果:

root@b40610924ca2:/# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

说明:

如果基础镜像中包含了旧版本的CUDA,可直接删除。然后拷贝新版本使用。

  • 安装cuDNN

容器内执行下面这个指令,确保执行成功:

python3 -m pip install paddlepaddle-gpu==2.6.1.post120 -f https://www.paddlepaddle.org.cn/whl/linux/cudnnin/stable.html

安装PoddleOCR

在容器内执行:

wget https://github.com/PaddlePaddle/PaddleOCR/archive/refs/tags/v2.7.5.tar.gz && \tar -zxvf v2.7.5.tar.gz && \mv PaddleOCR-2.7.5 PaddleOCR \&& rm -rf v2.7.5.tar.gz \&& cd PaddleOCR \&& pip3.10 install -r requirements.txt -i https://mirror.baidu.com/pypi/simple \&& mkdir -p /PaddleOCR/inference/ \&& wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar && \tar xf ch_ppocr_mobile_v2.0_det_infer.tar -C /PaddleOCR/inference/ && \wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar && \tar xf ch_ppocr_mobile_v2.0_cls_infer.tar -C /PaddleOCR/inference/ && \wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar && \tar xf ch_ppocr_mobile_v2.0_rec_infer.tar -C /PaddleOCR/inference/ \&& rm -rf ch_ppocr_mobile_v2.0_det_infer.tar \&& rm -rf ch_ppocr_mobile_v2.0_cls_infer.tar \&& rm -rf ch_ppocr_mobile_v2.0_rec_infer.tar

安装paddlehub

pip3.10 install --upgrade -i https://mirror.baidu.com/pypi/simple paddlehub## 以下包 是执行hub serving install 时需要安装的包
pip3.10 install -i https://mirror.baidu.com/pypi/simple shapely
pip3.10 install -i https://mirror.baidu.com/pypi/simple pyclipper
pip3.10 install -i https://mirror.baidu.com/pypi/simple scikit-image
pip3.10 install -i https://mirror.baidu.com/pypi/simple imgaug
pip3.10 install -i https://mirror.baidu.com/pypi/simple lmdb

安装模块

#表格识别
hub install deploy/hubserving/structure_table#文字识别
hub install deploy/hubserving/ocr_system#版面识别
hub install deploy/hubserving/structure_layout

不报错,说明安装成功了。

说明:

其他模块按需安装。

其他问题

ImportError: libGL.so.1

File "/usr/local/lib/python3.10/dist-packages/paddlehub/vision/utils.py", line 18, in <module>import cv2
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

需要安装如下包(容器内):

apt-get update
apt-get install libgl1-mesa-glx -y
apt-get install libglib2.0-0 -y

降级protobuf

报错:

TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:1. Downgrade the protobuf package to 3.20.x or lower.
…………

解决方案:降级

pip3.10 install -i https://mirror.baidu.com/pypi/simple protobuf==3.20.2

缺少模型文件

类似如下报错:

    raise ValueError(
ValueError: not find model.pdmodel or inference.pdmodel in ./inference/ch_PP-OCRv3_det_infer/

少哪个模型就下载、解压到inference目录下即可。

同时,修改params.py文件:

cd /PaddleOCR
vi deploy/hubserving/structure_table/params.pydef read_params():cfg = pp_ocr_read_params()# params for table structure modelcfg.table_max_len = 488#cfg.table_model_dir = './inference/en_ppocr_mobile_v2.0_table_structure_infer/'cfg.table_model_dir = './inference/ch_ppstructure_mobile_v2.0_SLANet_infer/'#cfg.table_char_dict_path = './ppocr/utils/dict/table_structure_dict.txt'cfg.table_char_dict_path = './ppocr/utils/dict/table_structure_dict_ch.txt'cfg.show_log = Falsereturn cfg

版本问题

启动gpu版本的服务后,客户端调用时报错ÿ

http://www.cadmedia.cn/news/14764.html

相关文章:

  • 中国建设银行投标再什么网站上官方百度平台
  • 成都建设二维码网站怎么样优化网站seo
  • 网页版微信消息撤回seo博客优化
  • 营销网站建设多少钱html网页制作软件
  • b2b网站一般流程广州seo招聘网
  • 网站建设有哪些公司发稿网
  • 中国建设银行阜阳分行网站百度搜索关键词规则
  • 贪玩原始传奇官方网站网络营销最火的案例
  • 三合一网站建设公司官方app下载安装
  • 店铺运营数据分析seo刷关键词排名工具
  • 做时时彩网站都要什么网站排名英文
  • 长春电商网站建设公司常见的营销方式有哪些
  • 加强政府门户网站建设讲话深圳网站建设系统
  • 网站建设蛋蛋28seo网站运营
  • 郑州专业的网站建设公司哪家好太原互联网推广公司
  • cms网站怎么做免费源码下载网站
  • 广西水利工程建设管理网站新媒体营销推广公司
  • 如何把网站一个栏目做301跳转百度刷首页怎么刷
  • 用手机建立网站seo点击软件手机
  • 建立网站是很多企业开始进行网络营销的第一步株洲网站设计
  • 东营市城乡建设信息网英文seo外链发布工具
  • 云南网站建设哪家便宜网络推广网站大全
  • 中国网站有哪些必应搜索引擎地址
  • 深圳网站建设公司 犀牛云 移动云网站宣传页面怎么制作
  • 如何查询网站接入信息抖音推广方案
  • 建立网站的是什么人百度云盘登录入口
  • 网站建设 技术协议专业百度seo排名优化
  • 手机网站开发环境搭建alexa排名查询统计
  • 佛山做网站企业百度seo是什么意思呢
  • 企业网站托管电话杭州网络优化公司排名