快速构建基于Paddle Serving部署的Paddle Detection目标检测Docker镜像

news/2025/3/19 11:16:39/

快速构建基于Paddle Serving部署的Paddle Detection目标检测Docker镜像

  • 项目介绍
  • 需要重点关注的几个文件
      • 构建cpu版本的docker
      • 构建gpu版本的docker(cuda11.2+cudnn8)

阅读提示:
(1)Paddle的Serving项目中,在tools文件下,已提供了丰富的Dockerfile,可供参考,有点让人眼花缭乱。
(2)需要熟悉serving部署,port通过内部的config.yml来指定,此处Dockerfile内可不指定port。
(3)本文只介绍4个重要的文件,操作细节懂的都懂,不再赘述。

项目介绍

本项目采用Paddle Detection框架开发目标检测服务,采用Paddle Serving提供Web服务,采用Docker方式打包服务,方便部署。
本项目目录如下:
Alt

需要重点关注的几个文件

构建cpu版本的docker

指令:docker build -t aep-aiplus-ppyoloe-multiclass:cpu-1.0.0 -f ./Dockerfile-cpu .

  • Dockerfile-cpu文件
FROM python:3.8.16
COPY . /aep-aiplus-ppyoloe-multiclass
WORKDIR /aep-aiplus-ppyoloe-multiclass
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \&& sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \&& apt-get clean \&& apt update \&& apt-get install -y libgl1-mesa-dev \&& pip config set global.index-url https://mirror.baidu.com/pypi/simple \&& pip install --upgrade setuptools \&& pip install --upgrade pip \&& pip install -r requirements.txt
CMD ["python", "web_service.py"]
  • requirements.txt文件
paddlepaddle==2.2.2
paddle-serving-client==0.9.0
paddle-serving-app==0.9.0
paddle-serving-server==0.9.0

构建gpu版本的docker(cuda11.2+cudnn8)

指令:docker build -t aep-aiplus-ppyoloe-multiclass:cu1102-1.0.0 -f ./Dockerfile-cuda1102-cudnn8 .

  • Dockerfile-cuda1102-cudnn8文件
FROM registry.baidubce.com/paddlepaddle/paddle:2.2.2-gpu-cuda11.2-cudnn8
COPY . /aep-aiplus-ppyoloe-multiclass
WORKDIR /aep-aiplus-ppyoloe-multiclass
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get clean
RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt update
RUN apt-get install -y libgl1-mesa-dev
RUN pip3 config set global.index-url https://mirror.baidu.com/pypi/simple
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements-gpu.txt
CMD ["python", "web_service.py"]
  • requirements-gpu.txt文件
paddle-serving-client==0.9.0
paddle-serving-app==0.9.0
paddle-serving-server-gpu==0.9.0.post112

http://www.ppmy.cn/news/1098153.html

相关文章

mac如何创建mysql数据库

使用mac创建mysql数据库十分简单,我们只需要按照以下步骤即可完成。 首先,我们需要安装mysql,我们可以通过官网下载对应的安装包,或者通过Homebrew进行安装。 接下来,我们需要启动mysql服务,在终端中输入以…

Go语言内置类型和函数

Golang内置类型和函数 1.1 内置类型 1.1.1 值类型 boolint(32 or 64), int8, int16, int32, int64uint(32 or 64), uint8(byte), uint16, uint32, uint64float32, float64stringcomplex64, complex128array -- 固定长度的数组1.1.2 引用类型:(指针类…

selenium自动化chrome

from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options from fake_useragent import UserAgent# 启动 Chrome 浏览器 chrome_o…

const的值可不可以被更改

总结: 当const定义的常量是基本数据类型的时候不可以被更改 当const定义的常量是基本数据类型的时候不可以被更改 const定义的常量实际上是栈内存地址中的保存的值,const常量的值不可以被更改就是栈内存中保存的数据不可以被更改。基本数据类型直接存储在…

2023高教社杯数学建模B题思路代码 - 多波束测线问题

# 1 赛题 B 题 多波束测线问题 单波束测深是利用声波在水中的传播特性来测量水体深度的技术。声波在均匀介质中作匀 速直线传播, 在不同界面上产生反射, 利用这一原理,从测量船换能器垂直向海底发射声波信 号,并记录从声波发射到…

『SpringBoot 源码分析』run() 方法执行流程:(3)刷新应用上下文-处理 @ComponentScan 注解

『SpringBoot 源码分析』run() 方法执行流程:(3)刷新应用上下文-处理 ComponentScan 注解 基于 2.2.9.RELEASE问题:当方法进行了注释标记之后,springboot 又是怎么注入到容器中并创建类呢? 首先创建测试主…

Eviews用向量自回归模型VAR实证分析公路交通通车里程与经济发展GDP协整关系时间序列数据和脉冲响应可视化...

全文下载链接:http://tecdat.cn/?p27784 河源市是国务院1988年1月7日批准设立的地级市,为了深入研究河源市公路交通与经济发展的关系,本文选取了1988-2014年河源市建市以来24年的地区生产总值(GDP)和公路通…

window和linux下载ffmpeg

window 进入官方 进入 download 页面并选择 window 版本 下载 zip 压缩包 解压压缩包 解压压缩包之后,在 bin 目录下有三个文件,我们要下载的 window 版 ffmpeg.exe 就在其中,后续你可以添加系统环境变量或者在每次执行 ffmpeg.exe 都带上路…