mirror of
https://github.com/ultralytics/ultralytics.git
synced 2025-09-15 15:48:41 +08:00
ultralytics 8.3.178 new lighter Dockerfile-python images (#21661)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
bc507dac58
commit
c2569acc06
12
.github/workflows/docker.yml
vendored
12
.github/workflows/docker.yml
vendored
@ -21,7 +21,7 @@ on:
|
||||
default: true
|
||||
Dockerfile-python:
|
||||
type: boolean
|
||||
description: Dockerfile-python (+ jupyter, cpu)
|
||||
description: Dockerfile-python (+ jupyter, cpu, python-export)
|
||||
default: true
|
||||
Dockerfile-arm64:
|
||||
type: boolean
|
||||
@ -50,7 +50,7 @@ on:
|
||||
jobs:
|
||||
docker:
|
||||
if: github.repository == 'ultralytics/ultralytics'
|
||||
name: Push Docker Images
|
||||
name: Build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 10
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
tags: "latest-python"
|
||||
platforms: "linux/amd64"
|
||||
runs_on: "ubuntu-latest"
|
||||
derivatives: "Dockerfile-jupyter,Dockerfile-cpu"
|
||||
derivatives: "Dockerfile-jupyter,Dockerfile-cpu,Dockerfile-python-export"
|
||||
# Standalone base images
|
||||
- dockerfile: "Dockerfile-arm64"
|
||||
tags: "latest-arm64"
|
||||
@ -210,15 +210,15 @@ jobs:
|
||||
|
||||
- name: Check Environment
|
||||
if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && (matrix.platforms == 'linux/amd64' || matrix.platforms == 'linux/arm64') && matrix.dockerfile != 'Dockerfile-conda'
|
||||
run: docker run ultralytics/ultralytics:${{ matrix.tags }} /bin/bash -c "yolo checks && uv pip list"
|
||||
run: docker run ultralytics/ultralytics:${{ matrix.tags == 'latest-python' && 'latest-python-export' || matrix.tags }} /bin/bash -c "yolo checks && uv pip list"
|
||||
|
||||
- name: Run Tests
|
||||
if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && (matrix.platforms == 'linux/amd64' || matrix.platforms == 'linux/arm64') && matrix.dockerfile != 'Dockerfile-conda'
|
||||
run: docker run ultralytics/ultralytics:${{ matrix.tags }} /bin/bash -c "pip install pytest && pytest tests"
|
||||
run: docker run ultralytics/ultralytics:${{ matrix.tags == 'latest-python' && 'latest-python-export' || matrix.tags }} /bin/bash -c "pip install pytest && pytest tests"
|
||||
|
||||
- name: Run Benchmarks
|
||||
if: (github.event_name == 'push' || github.event.inputs[matrix.dockerfile] == 'true') && (matrix.platforms == 'linux/amd64' || matrix.dockerfile == 'Dockerfile-arm64') && matrix.dockerfile != 'Dockerfile' && matrix.dockerfile != 'Dockerfile-conda'
|
||||
run: docker run ultralytics/ultralytics:${{ matrix.tags }} yolo benchmark model=yolo11n.pt imgsz=160 verbose=0.309
|
||||
run: docker run ultralytics/ultralytics:${{ matrix.tags == 'latest-python' && 'latest-python-export' || matrix.tags }} yolo benchmark model=yolo11n.pt imgsz=160 verbose=0.309
|
||||
|
||||
- name: Push All Images
|
||||
if: github.event_name == 'push' || (github.event.inputs[matrix.dockerfile] == 'true' && github.event.inputs.push == 'true')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Image is CUDA-optimized for YOLO11 single/multi-GPU training and inference
|
||||
# Image is CUDA-optimized for YOLO single/multi-GPU training and inference
|
||||
|
||||
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:25.02-py3
|
||||
FROM pytorch/pytorch:2.7.0-cuda12.6-cudnn9-runtime
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds ultralytics/ultralytics:jetson-jetpack4 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Supports JetPack4.x for YOLO11 on Jetson Nano, TX2, Xavier NX, AGX Xavier
|
||||
# Builds ultralytics/ultralytics:latest-jetson-jetpack4 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Supports JetPack4.x for YOLO on Jetson Nano, TX2, Xavier NX, AGX Xavier
|
||||
|
||||
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-cuda
|
||||
FROM nvcr.io/nvidia/l4t-cuda:10.2.460-runtime
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds ultralytics/ultralytics:jetson-jetpack5 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Supports JetPack5.1.2 for YOLO11 on Jetson Xavier NX, AGX Xavier, AGX Orin, Orin Nano and Orin NX
|
||||
# Builds ultralytics/ultralytics:latest-jetson-jetpack5 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Supports JetPack5.1.2 for YOLO on Jetson Xavier NX, AGX Xavier, AGX Orin, Orin Nano and Orin NX
|
||||
|
||||
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-jetpack
|
||||
FROM nvcr.io/nvidia/l4t-jetpack:r35.4.1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds ultralytics/ultralytics:jetson-jetpack6 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Supports JetPack6.1 for YOLO11 on Jetson AGX Orin, Orin NX and Orin Nano Series
|
||||
# Builds ultralytics/ultralytics:latest-jetson-jetpack6 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Supports JetPack6.1 for YOLO on Jetson AGX Orin, Orin NX and Orin Nano Series
|
||||
|
||||
# Start FROM https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-jetpack
|
||||
FROM nvcr.io/nvidia/l4t-jetpack:r36.4.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLO11 deployments
|
||||
# Builds ultralytics/ultralytics:latest-python image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Lightweight CPU image optimized for YOLO inference
|
||||
|
||||
# Use official Python base image for reproducibility (3.11.10 for export and 3.12.10 for inference)
|
||||
FROM python:3.11.10-slim-bookworm
|
||||
@ -18,11 +18,9 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
|
||||
/root/.config/Ultralytics/
|
||||
|
||||
# Install linux packages
|
||||
# gnupg required for Edge TPU install
|
||||
# Java runtime environment (default-jre-headless) required for Sony IMX export
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg default-jre-headless && \
|
||||
python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create working directory
|
||||
@ -34,18 +32,11 @@ RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config && \
|
||||
sed -i'' -e 's/"opencv-python/"opencv-python-headless/' pyproject.toml
|
||||
ADD https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt .
|
||||
|
||||
# Install pip packages and run exports to AutoInstall packages
|
||||
# Install pip packages
|
||||
RUN pip install uv && \
|
||||
uv pip install --system -e ".[export]" --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match && \
|
||||
# Need lower version of 'numpy' for Sony IMX export
|
||||
uv pip install --system numpy==1.26.4 && \
|
||||
# Run exports to AutoInstall packages
|
||||
yolo export model=tmp/yolo11n.pt format=edgetpu imgsz=32 && \
|
||||
yolo export model=tmp/yolo11n.pt format=ncnn imgsz=32 && \
|
||||
yolo export model=tmp/yolo11n.pt format=imx imgsz=32 && \
|
||||
uv pip install --system paddlepaddle x2paddle && \
|
||||
uv pip install --system -e . --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match && \
|
||||
# Remove extra build files
|
||||
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
|
||||
rm -rf tmp
|
||||
|
||||
# Usage Examples -------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
40
docker/Dockerfile-python-export
Normal file
40
docker/Dockerfile-python-export
Normal file
@ -0,0 +1,40 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds ultralytics/ultralytics:latest-python-export image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Full-featured image with export capabilities for YOLO model conversion
|
||||
|
||||
# Build from lightweight Ultralytics Python image
|
||||
FROM ultralytics/ultralytics:latest-python
|
||||
|
||||
# Install export-specific system packages
|
||||
# gnupg required for Edge TPU install
|
||||
# Java runtime environment (default-jre-headless) required for Sony IMX export
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends gnupg default-jre-headless && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install export dependencies and run exports to AutoInstall packages
|
||||
RUN uv pip install --system -e ".[export]" && \
|
||||
# Need lower version of 'numpy' for Sony IMX export
|
||||
uv pip install --system numpy==1.26.4 && \
|
||||
# Run exports to AutoInstall packages
|
||||
yolo export model=yolo11n.pt format=edgetpu imgsz=32 && \
|
||||
yolo export model=yolo11n.pt format=ncnn imgsz=32 && \
|
||||
yolo export model=yolo11n.pt format=imx imgsz=32 && \
|
||||
uv pip install --system paddlepaddle x2paddle && \
|
||||
# Remove extra build files
|
||||
rm -rf tmp /root/.config/Ultralytics/persistent_cache.json
|
||||
|
||||
# Usage Examples -------------------------------------------------------------------------------------------------------
|
||||
|
||||
# Build and Push
|
||||
# t=ultralytics/ultralytics:latest-python-export && sudo docker build -f docker/Dockerfile-python-export -t $t . && sudo docker push $t
|
||||
|
||||
# Run
|
||||
# t=ultralytics/ultralytics:latest-python-export && sudo docker run -it --ipc=host $t
|
||||
|
||||
# Pull and Run
|
||||
# t=ultralytics/ultralytics:latest-python-export && sudo docker pull $t && sudo docker run -it --ipc=host $t
|
||||
|
||||
# Pull and Run with local volume mounted
|
||||
# t=ultralytics/ultralytics:latest-python-export && sudo docker pull $t && sudo docker run -it --ipc=host -v "$(pwd)"/shared/datasets:/datasets $t
|
||||
@ -1,7 +1,7 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
# Builds GitHub actions CI runner image for deployment to DockerHub https://hub.docker.com/r/ultralytics/ultralytics
|
||||
# Image is CUDA-optimized for YOLO11 single/multi-GPU training and inference tests
|
||||
# Image is CUDA-optimized for YOLO single/multi-GPU training and inference tests
|
||||
|
||||
# Start FROM Ultralytics GPU image
|
||||
FROM ultralytics/ultralytics:latest
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
|
||||
__version__ = "8.3.177"
|
||||
__version__ = "8.3.178"
|
||||
|
||||
import os
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user