Skip to content

Commit

Permalink
change: custom opencv to opencv-python
Browse files Browse the repository at this point in the history
  • Loading branch information
minostauros committed May 24, 2024
1 parent f8de00e commit 089a631
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

# Associated pytorch version will not be set automatically. Scroll down and set appropriate versions.

FROM ghcr.io/minostauros/cuda-ffmpeg-opencv-docker:4.7.0-cu118-py310
# opencv is not built well with cuda 11.8, we use opencv-python instead
FROM ghcr.io/minostauros/cuda-ffmpeg-docker:6.1-cu118

ARG PYTHON_VERSION=3.10
ARG OPENCV_VERSION=4.9.0.80
ARG PYTORCH_VERSION=2.1.2
ARG TORCHVISION_VERSION=0.16.2
ARG TORCHAUDIO_VERSION=2.1.2
Expand Down Expand Up @@ -45,7 +47,7 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
net-tools \
curl \
openssh-server \
#libpng-dev \ # included in base image
libpng-dev \
swig \
locales \
tzdata \
Expand All @@ -54,7 +56,9 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
ninja-build \
rclone \
libdrm-dev libsystemd-dev \
python${PYTHON_VERSION}-dev && \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
$( [ ${PYTHON_VERSION%%.*} -ge 3 ] && echo "python${PYTHON_VERSION%%.*}-distutils" ) \
apt-get clean -y && \
# Language & Timezone setting
echo "Asia/Seoul" > /etc/timezone && \
Expand All @@ -64,8 +68,13 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8 && \
# PyTorch (Mind cuda version and associated torch and torchvision versions)
# OpenCV
wget https://bootstrap.pypa.io/get-pip.py --progress=bar:force:noscroll --no-check-certificate && \
python${PYTHON_VERSION} get-pip.py && \
rm get-pip.py && \
python${PYTHON_VERSION} -m pip install --upgrade pip && \
pip${PYTHON_VERSION} install opencv-python==${OPENCV_VERSION} && \
# PyTorch (Mind cuda version and associated torch and torchvision versions)
pip${PYTHON_VERSION} install torch==${PYTORCH_VERSION}+${TARGET_CUDA_VERSION} torchvision==${TORCHVISION_VERSION}+${TARGET_CUDA_VERSION} torchaudio==${TORCHAUDIO_VERSION}+${TARGET_CUDA_VERSION} --index-url https://download.pytorch.org/whl/${TARGET_CUDA_VERSION} && \
# CMake higher version than apt-get
pip${PYTHON_VERSION} install cmake packaging && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

# Associated pytorch version will not be set automatically. Scroll down and set appropriate versions.

FROM ghcr.io/minostauros/cuda-ffmpeg-opencv-docker:4.7.0-cu118-py310
# opencv is not built well with cuda 11.8, we use opencv-python instead
FROM ghcr.io/minostauros/cuda-ffmpeg-docker:6.1-cu118

ARG PYTHON_VERSION=3.10
ARG OPENCV_VERSION=4.9.0.80
ARG PYTORCH_VERSION=2.2.1
ARG TORCHVISION_VERSION=0.17.1
ARG TORCHAUDIO_VERSION=2.2.1
Expand Down Expand Up @@ -45,7 +47,7 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
net-tools \
curl \
openssh-server \
#libpng-dev \ # included in base image
libpng-dev \
swig \
locales \
tzdata \
Expand All @@ -54,7 +56,9 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
ninja-build \
rclone \
libdrm-dev libsystemd-dev \
python${PYTHON_VERSION}-dev && \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
$( [ ${PYTHON_VERSION%%.*} -ge 3 ] && echo "python${PYTHON_VERSION%%.*}-distutils" ) \
apt-get clean -y && \
# Language & Timezone setting
echo "Asia/Seoul" > /etc/timezone && \
Expand All @@ -64,8 +68,13 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8 && \
# PyTorch (Mind cuda version and associated torch and torchvision versions)
# OpenCV
wget https://bootstrap.pypa.io/get-pip.py --progress=bar:force:noscroll --no-check-certificate && \
python${PYTHON_VERSION} get-pip.py && \
rm get-pip.py && \
python${PYTHON_VERSION} -m pip install --upgrade pip && \
pip${PYTHON_VERSION} install opencv-python==${OPENCV_VERSION} && \
# PyTorch (Mind cuda version and associated torch and torchvision versions)
pip${PYTHON_VERSION} install torch==${PYTORCH_VERSION}+${TARGET_CUDA_VERSION} torchvision==${TORCHVISION_VERSION}+${TARGET_CUDA_VERSION} torchaudio==${TORCHAUDIO_VERSION}+${TARGET_CUDA_VERSION} --index-url https://download.pytorch.org/whl/${TARGET_CUDA_VERSION} && \
# CMake higher version than apt-get
pip${PYTHON_VERSION} install cmake packaging && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

# Associated pytorch version will not be set automatically. Scroll down and set appropriate versions.

FROM ghcr.io/minostauros/cuda-ffmpeg-opencv-docker:4.9.0-cu118-py310
# opencv is not built well with cuda 11.8, we use opencv-python instead
FROM ghcr.io/minostauros/cuda-ffmpeg-docker:6.1-cu118

ARG PYTHON_VERSION=3.10
ARG OPENCV_VERSION=4.9.0.80
ARG PYTORCH_VERSION=2.2.2
ARG TORCHVISION_VERSION=0.17.2
ARG TORCHAUDIO_VERSION=2.2.2
Expand Down Expand Up @@ -45,7 +47,7 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
net-tools \
curl \
openssh-server \
#libpng-dev \ # included in base image
libpng-dev \
swig \
locales \
tzdata \
Expand All @@ -54,7 +56,9 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
ninja-build \
rclone \
libdrm-dev libsystemd-dev \
python${PYTHON_VERSION}-dev && \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
$( [ ${PYTHON_VERSION%%.*} -ge 3 ] && echo "python${PYTHON_VERSION%%.*}-distutils" ) \
apt-get clean -y && \
# Language & Timezone setting
echo "Asia/Seoul" > /etc/timezone && \
Expand All @@ -64,8 +68,13 @@ RUN echo "Asia/Seoul" > /etc/timezone && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8 && \
# PyTorch (Mind cuda version and associated torch and torchvision versions)
# OpenCV
wget https://bootstrap.pypa.io/get-pip.py --progress=bar:force:noscroll --no-check-certificate && \
python${PYTHON_VERSION} get-pip.py && \
rm get-pip.py && \
python${PYTHON_VERSION} -m pip install --upgrade pip && \
pip${PYTHON_VERSION} install opencv-python==${OPENCV_VERSION} && \
# PyTorch (Mind cuda version and associated torch and torchvision versions)
pip${PYTHON_VERSION} install torch==${PYTORCH_VERSION}+${TARGET_CUDA_VERSION} torchvision==${TORCHVISION_VERSION}+${TARGET_CUDA_VERSION} torchaudio==${TORCHAUDIO_VERSION}+${TARGET_CUDA_VERSION} --index-url https://download.pytorch.org/whl/${TARGET_CUDA_VERSION} && \
# CMake higher version than apt-get
pip${PYTHON_VERSION} install cmake packaging && \
Expand Down

0 comments on commit 089a631

Please sign in to comment.