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

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

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

项目介绍

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

本项目目录如下:

需要重点关注的几个文件

构建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

相关推荐
思绪无限15 小时前
YOLOv5至YOLOv12升级:疲劳驾驶检测系统的设计与实现(完整代码+界面+数据集项目)
人工智能·深度学习·yolo·目标检测·计算机视觉
郝开17 小时前
Docker Compose 本地环境搭建:独立 Compose + 共享网络 + .env 统一管理(架构设计篇)
网络·docker·容器
岳来17 小时前
docker 容器文件 hostconfig.json 和 config.v2.json 的区别
docker·容器·hostconfig.json·config.v2.json
jay神17 小时前
基于YOLO26的珍稀鸟类检测系统
人工智能·深度学习·yolo·目标检测·毕业设计
我材不敲代码17 小时前
YOLOv1 ——One-Stage目标检测开山之作
人工智能·yolo·目标检测
xiaotao13117 小时前
04-进阶方向: 01-计算机视觉(CV)——目标检测:SSD
人工智能·目标检测·计算机视觉
AI服务老曹17 小时前
深度解析:基于 Docker 与 GB28181 的异构计算 AI 视频管理架构,如何实现 X86/ARM 与 GPU/NPU 的全场景兼容?
运维·docker·容器
mahtengdbb117 小时前
P6超大目标检测层改进YOLOv26四尺度特征金字塔与大感受野建模双重突破
yolo·目标检测·目标跟踪
阿正的梦工坊17 小时前
DOCKER_DATABASE_URL 逐段解析:部署时候的信息解析
数据库·docker·容器
郝开18 小时前
Docker Compose 本地环境搭建:nacos
运维·docker·容器