Use opencv-python-headless in Dockerfiles (#21647)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-08-12 00:04:48 +02:00 committed by GitHub
parent 5b55b3cea3
commit 11e43791f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 11 deletions

View File

@ -39,7 +39,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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

View File

@ -31,7 +31,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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

View File

@ -19,10 +19,10 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
# Install linux packages
# gnupg required for Edge TPU install
# Java runtime environment (default-jre) required for Sony IMX export
# 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 \
python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg default-jre-headless \
&& rm -rf /var/lib/apt/lists/*
# Create working directory
@ -30,7 +30,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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

View File

@ -35,7 +35,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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 .
# Download onnxruntime-gpu 1.8.0 and tensorrt 8.2.0.6

View File

@ -28,7 +28,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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 .
# Replace pyproject.toml TF.js version with 'tensorflowjs>=3.9.0' for JetPack5 compatibility

View File

@ -30,7 +30,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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 .
# Pip install numpy, onnxruntime-gpu, torch, torchvision and ultralytics

View File

@ -19,10 +19,10 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \
# Install linux packages
# gnupg required for Edge TPU install
# Java runtime environment (default-jre) required for Sony IMX export
# 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 \
python3-pip git zip unzip wget curl htop libgl1 libglib2.0-0 libpython3-dev gnupg default-jre-headless \
&& rm -rf /var/lib/apt/lists/*
# Create working directory
@ -30,7 +30,8 @@ WORKDIR /ultralytics
# Copy contents and configure git
COPY . .
RUN sed -i '/^\[http "https:\/\/github\.com\/"\]/,+1d' .git/config
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