Skip to content

Commit

Permalink
Merge pull request #778 from roflcoopter/feature/v3.0.0b7-fixes
Browse files Browse the repository at this point in the history
Feature/v3.0.0b7 fixes
  • Loading branch information
roflcoopter authored Jun 29, 2024
2 parents 4a1520f + 83826cc commit c43c791
Show file tree
Hide file tree
Showing 71 changed files with 2,079 additions and 472 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
!docker/ffprobe_wrapper
!requirements.txt
!requirements_test.txt
!docker/opencv-python-headless-setup.py
!docker/jetson-nano/opencv-tuple.patch
!rootfs/
!frontend/
frontend/node_modules
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
!/docker/ffprobe_wrapper
!/docker/ffmpeg_wrapper
!/docker/yolov4*.cfg
!/docker/opencv-python-headless-setup.py
!/docker/jetson-nano/opencv-tuple.patch
!/rootfs/
!/rootfs/etc/
!/rootfs/etc/**
Expand Down
3 changes: 3 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ ignore_missing_imports = true
[mypy-sklearn.*]
ignore_missing_imports = true

[mypy-supervision.*]
ignore_missing_imports = true

[mypy-tflite_runtime.*]
ignore_missing_imports = true

Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"pylint.severity": {
"convention": "Warning"
"convention": "Warning",
"refactor": "Warning"
},
"[python]": {
"editor.rulers": [88],
Expand Down
10 changes: 5 additions & 5 deletions azure-pipelines/.env
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
UBUNTU_VERSION="jammy"
UBUNTU_VERSION_NUMBER="22.04"
BASE_VERSION="1.7.0"
OPENCV_VERSION="4.9.0"
OPENVINO_VERSION="2023.3.0"
BASE_VERSION="1.8.0"
OPENCV_VERSION="4.10.0"
OPENVINO_VERSION="2024.0.0"
FFMPEG_VERSION="5.1.2"
DLIB_VERSION="19.24.4"
SKLEARN_VERSION="1.2.2"
WHEELS_VERSION="1.5"
WHEELS_VERSION="1.6"
S6_OVERLAY_VERSION="2.1.0.2"
CMAKE_VERSION=3.20.0
MAKEFLAGS="-j 5"
Expand All @@ -20,7 +20,7 @@ LEVEL_ZERO_GPU="1.3.29138.7"
OPENCL_SHA256_FILENAME="ww13"
JETSON_NANO_UBUNTU_VERSION="bionic"
JETPACK_VERSION_MAJOR=32
JETPACK_VERSION_MINOR=7
JETPACK_VERSION_MINOR=6
JETPACK_VERSION_PATCH=1
JETSON_NANO_FFMPEG_VERSION="4.2.2"
JETSON_NANO_FFMPEG_APT_VERSION="7:4.2.2-nvidia"
Expand Down
5 changes: 5 additions & 0 deletions azure-pipelines/docker-compose-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ services:
ARCH: amd64
BUILD_FROM: ubuntu:$UBUNTU_VERSION
DLIB_VERSION: "$DLIB_VERSION"
OPENCV_VERSION: "$OPENCV_VERSION"
cache_from:
- roflcoopter/amd64-wheels:$WHEELS_VERSION
image: roflcoopter/amd64-wheels:$WHEELS_VERSION
Expand Down Expand Up @@ -223,6 +224,7 @@ services:
ARCH: amd64-cuda
BUILD_FROM: ubuntu:$UBUNTU_VERSION
DLIB_VERSION: "$DLIB_VERSION"
OPENCV_VERSION: "$OPENCV_VERSION"
cache_from:
- roflcoopter/amd64-cuda-wheels:$WHEELS_VERSION
image: roflcoopter/amd64-cuda-wheels:$WHEELS_VERSION
Expand Down Expand Up @@ -327,6 +329,7 @@ services:
DLIB_VERSION: "$DLIB_VERSION"
EXTRA_PIP_ARGS: --extra-index-url https://www.piwheels.org/simple
CMAKE_VERSION: "$CMAKE_VERSION"
OPENCV_VERSION: "$OPENCV_VERSION"
cache_from:
- roflcoopter/rpi3-wheels:$WHEELS_VERSION
image: roflcoopter/rpi3-wheels:$WHEELS_VERSION
Expand Down Expand Up @@ -415,6 +418,7 @@ services:
ARCH: aarch64
BUILD_FROM: balenalib/aarch64-ubuntu:$UBUNTU_VERSION-build
DLIB_VERSION: "$DLIB_VERSION"
OPENCV_VERSION: "$OPENCV_VERSION"
cache_from:
- roflcoopter/aarch64-wheels:$WHEELS_VERSION
image: roflcoopter/aarch64-wheels:$WHEELS_VERSION
Expand Down Expand Up @@ -563,6 +567,7 @@ services:
DLIB_VERSION: "$DLIB_VERSION"
JETPACK_VERSION: "$JETPACK_VERSION_MAJOR.$JETPACK_VERSION_MINOR.$JETPACK_VERSION_PATCH"
ARCH: jetson-nano
OPENCV_VERSION: "$OPENCV_VERSION"
cache_from:
- roflcoopter/jetson-nano-wheels:$WHEELS_VERSION
image: roflcoopter/jetson-nano-wheels:$WHEELS_VERSION
Expand Down
10 changes: 9 additions & 1 deletion docker/Dockerfile.wheels
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN \
[ "$ARCH" = "aarch64" ] ; then echo "Crossbuilding!" && cross-build-start; fi

RUN apt-get -yqq update && apt-get install -yq --no-install-recommends \
cmake \
curl \
python3 \
python3-dev \
Expand All @@ -31,7 +32,14 @@ RUN apt-get -yqq update && apt-get install -yq --no-install-recommends \
&& python3 -m pip install --upgrade pip \
&& apt-get autoremove -y && apt-get clean -y

# Pip does not find our OpenCV built from source so we fake it here
ARG OPENCV_VERSION
ADD docker/opencv-python-headless-setup.py /opencv-python-headless/setup.py
ADD requirements.txt requirements.txt
# Set OpenCV Version
RUN sed -i "s/OPENCV_VERSION=/OPENCV_VERSION=\"$OPENCV_VERSION\"/" /opencv-python-headless/setup.py
RUN echo "opencv-python-headless==$OPENCV_VERSION" >> /requirements.txt

# We need to setup Rust compiler for bcrypt
# A tmpfs is needed: https://github.com/rust-lang/cargo/issues/8719
RUN --mount=type=tmpfs,target=/root/.cargo curl https://sh.rustup.rs -sSf | bash -s -- -y \
Expand All @@ -41,7 +49,7 @@ RUN --mount=type=tmpfs,target=/root/.cargo curl https://sh.rustup.rs -sSf | bash
elif [ "$ARCH" = "armhf" ] || [ "$ARCH" = "rpi3" ]; then export PLATFORM="armv7l"; \
else export PLATFORM="$ARCH"; fi \
\
&& python3 -m pip wheel --wheel-dir=/wheels --find-links=/wheels ${EXTRA_PIP_ARGS} -r /requirements.txt \
&& python3 -m pip wheel --wheel-dir=/wheels --find-links=/wheels ${EXTRA_PIP_ARGS} /opencv-python-headless -r /requirements.txt \
\
&& ls -al /wheels/

Expand Down
9 changes: 0 additions & 9 deletions docker/amd64-cuda/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ln -s /detectors/models/darknet/yolov7.weights /detectors/models/darknet/default.weights && \
ln -s /detectors/models/darknet/yolov7.cfg /detectors/models/darknet/default.cfg

# Install CUDNN 8 since OpenCV 4.9 does not support CUDNN 9
RUN UBUNTU_VERSION=$(echo $UBUNTU_VERSION_NUMBER | tr -d '.') && \
wget "https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121_1.0-1_amd64.deb" -O cudnn-local-repo.deb && \
dpkg -i cudnn-local-repo.deb && \
cp /var/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121/cudnn-local-04B81517-keyring.gpg /usr/share/keyrings/ && \
apt-get update && \
apt-get install -y libcudnn8 libcudnn8-dev && \
rm cudnn-local-repo.deb

COPY --from=darknet /darknet/lib /usr/local/lib
9 changes: 0 additions & 9 deletions docker/amd64-cuda/Dockerfile.darknet
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ RUN buildDeps="autoconf \
apt-get install -yq --no-install-recommends ${buildDeps}

ARG UBUNTU_VERSION_NUMBER
RUN \
# Install CUDNN 8 since OpenCV 4.9 does not support CUDNN 9
UBUNTU_VERSION=$(echo $UBUNTU_VERSION_NUMBER | tr -d '.') && \
wget "https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121_1.0-1_amd64.deb" -O cudnn-local-repo.deb && \
dpkg -i cudnn-local-repo.deb && \
cp /var/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121/cudnn-local-04B81517-keyring.gpg /usr/share/keyrings/ && \
apt-get update && \
apt-get install -y libcudnn8 libcudnn8-dev && \
rm cudnn-local-repo.deb

## Install OpenVINO
ARG OPENVINO_VERSION
Expand Down
11 changes: 0 additions & 11 deletions docker/amd64-cuda/Dockerfile.dlib
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ RUN buildDeps="autoconf \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}

ARG UBUNTU_VERSION_NUMBER
RUN \
# Install CUDNN 8 since OpenCV 4.9 does not support CUDNN 9
UBUNTU_VERSION=$(echo $UBUNTU_VERSION_NUMBER | tr -d '.') && \
wget "https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121_1.0-1_amd64.deb" -O cudnn-local-repo.deb && \
dpkg -i cudnn-local-repo.deb && \
cp /var/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121/cudnn-local-04B81517-keyring.gpg /usr/share/keyrings/ && \
apt-get update && \
apt-get install -y libcudnn8 libcudnn8-dev && \
rm cudnn-local-repo.deb

# Create dlib wheel
RUN \
DIR=/tmp && mkdir -p ${DIR} && cd ${DIR} && \
Expand Down
11 changes: 0 additions & 11 deletions docker/amd64-cuda/Dockerfile.opencv
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ RUN buildDeps="autoconf \
apt-get install -yq --no-install-recommends ${buildDeps}

ARG UBUNTU_VERSION_NUMBER
RUN \
# Install CUDNN 8 since OpenCV 4.9 does not support CUDNN 9
UBUNTU_VERSION=$(echo $UBUNTU_VERSION_NUMBER | tr -d '.') && \
wget "https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121_1.0-1_amd64.deb" -O cudnn-local-repo.deb && \
dpkg -i cudnn-local-repo.deb && \
cp /var/cudnn-local-repo-ubuntu$UBUNTU_VERSION-8.8.0.121/cudnn-local-04B81517-keyring.gpg /usr/share/keyrings/ && \
apt-get update && \
apt-get install -y libcudnn8 libcudnn8-dev && \
rm cudnn-local-repo.deb

## Install OpenVINO
RUN \
Expand Down Expand Up @@ -100,8 +91,6 @@ RUN \
-D WITH_OPENCL=ON \
-D WITH_OPENVINO=ON \
-D WITH_INF_ENGINE=ON \
-D InferenceEngine_DIR="/usr/local/runtime/cmake" \
-D ngraph_DIR="/usr/local/runtime/cmake" \
-D WITH_NGRAPH=ON \
-D ENABLE_CXX11=ON \
-D WITH_OPENMP=ON \
Expand Down
3 changes: 0 additions & 3 deletions docker/amd64/Dockerfile.opencv
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ RUN \
-D WITH_OPENCL=ON \
-D WITH_OPENVINO=ON \
-D WITH_INF_ENGINE=ON \
-D InferenceEngine_DIR="/usr/local/runtime/cmake" \
-D ngraph_DIR="/usr/local/runtime/cmake" \
-D WITH_NGRAPH=ON \
-D INF_ENGINE_RELEASE="2023030000" \
-D ENABLE_CXX11=ON \
-D WITH_OPENMP=ON \
-D WITH_IPP=ON \
Expand Down
7 changes: 6 additions & 1 deletion docker/jetson-nano/Dockerfile.opencv.part1
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,19 @@ RUN buildDeps="autoconf \
RUN ln -s /usr/local/cuda-10.2 /usr/local/cuda

## OpenCV
# Patch OpenCV to build with CUDA on Jetson Nano
# Can be removed with Opencv => 4.11
# https://github.com/opencv/opencv_contrib/pull/3751
ADD docker/jetson-nano/opencv-tuple.patch /tmp/opencv_contrib/opencv-tuple.patch
RUN \
DIR=/tmp/opencv && mkdir -p ${DIR} && cd ${DIR} && \
curl -sL -o opencv-${OPENCV_VERSION}.tar.gz https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz && \
tar -x --strip-components=1 -f opencv-${OPENCV_VERSION}.tar.gz
RUN \
DIR=/tmp/opencv_contrib && mkdir -p ${DIR} && cd ${DIR} && \
curl -sL -o opencv_contrib-${OPENCV_VERSION}.tar.gz https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.tar.gz && \
tar -x --strip-components=1 -f opencv_contrib-${OPENCV_VERSION}.tar.gz
tar -x --strip-components=1 -f opencv_contrib-${OPENCV_VERSION}.tar.gz && \
git apply opencv-tuple.patch

RUN \
DIR=/tmp/opencv/build && mkdir -p ${DIR} && cd ${DIR} && \
Expand Down
18 changes: 17 additions & 1 deletion docker/jetson-nano/Dockerfile.wheels
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ENV \
RUN [ "cross-build-start" ]

RUN apt-get -yqq update && apt-get install -yq --no-install-recommends \
wget \
curl \
gcc \
python3 \
Expand All @@ -41,11 +42,26 @@ RUN apt-get -yqq update && apt-get install -yq --no-install-recommends \
&& apt-get autoremove -y && apt-get clean -y \
&& python3 -m pip install numpy pybind11

# Install CMake
RUN wget https://cmake.org/files/v3.22/cmake-3.22.1-linux-aarch64.tar.gz && \
tar -xvf cmake-3.22.1-linux-aarch64.tar.gz && \
cp -r cmake-3.22.1-linux-aarch64/* /usr && \
rm -rf cmake-3.22.1-linux-aarch64 && \
rm cmake-3.22.1-linux-aarch64.tar.gz

# Pip does not find our OpenCV built from source so we fake it here
ARG OPENCV_VERSION
ADD docker/opencv-python-headless-setup.py /opencv-python-headless/setup.py
ADD requirements.txt requirements.txt
# Set OpenCV Version
RUN sed -i "s/OPENCV_VERSION=/OPENCV_VERSION=\"$OPENCV_VERSION\"/" /opencv-python-headless/setup.py
RUN echo "opencv-python-headless==$OPENCV_VERSION" >> /requirements.txt

ADD requirements.txt requirements.txt
RUN \
mkdir -p /wheels \
\
&& python3 -m pip wheel --wheel-dir=/wheels --find-links=/wheels -r /requirements.txt \
&& python3 -m pip wheel --wheel-dir=/wheels --find-links=/wheels /opencv-python-headless -r /requirements.txt \
\
&& ls -al /wheels/

Expand Down
28 changes: 28 additions & 0 deletions docker/jetson-nano/opencv-tuple.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/modules/cudev/include/opencv2/cudev/ptr2d/zip.hpp b/modules/cudev/include/opencv2/cudev/ptr2d/zip.hpp
index f5a3f8c8..98fb9d1e 100644
--- a/modules/cudev/include/opencv2/cudev/ptr2d/zip.hpp
+++ b/modules/cudev/include/opencv2/cudev/ptr2d/zip.hpp
@@ -49,7 +49,9 @@
#include "../common.hpp"
#include "../util/tuple.hpp"
#include "traits.hpp"
+#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ > 12 || (__CUDACC_VER_MAJOR__ == 12 && __CUDACC_VER_MINOR__ >= 4))
#include <cuda/std/tuple>
+#endif

namespace cv { namespace cudev {

@@ -176,6 +178,7 @@ template <class PtrTuple> struct PtrTraits< ZipPtrSz<PtrTuple> > : PtrTraitsBase

}}

+#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ > 12 || (__CUDACC_VER_MAJOR__ == 12 && __CUDACC_VER_MINOR__ >= 4))
_LIBCUDACXX_BEGIN_NAMESPACE_STD

template< class... Types >
@@ -198,3 +201,4 @@ struct tuple_element<N, cv::cudev::ZipPtrSz<tuple<Types...> > >
_LIBCUDACXX_END_NAMESPACE_STD

#endif
+#endif
\ No newline at end of file
11 changes: 11 additions & 0 deletions docker/opencv-python-headless-setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Dummy setup.py so that pip does not try to install opencv-python-headless."""
from setuptools import setup, find_packages

OPENCV_VERSION=

setup(
name="opencv-python-headless",
version=OPENCV_VERSION,
packages=find_packages(),
install_requires=[],
)
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
"name": "save_unknown_faces",
"description": "If set to <code>true</code>, any unrecognized faces will be stored in the database, as well as having a snapshot saved. You can then move this image to the folder of the correct person to improve accuracy.",
"optional": true,
"default": false
"default": true
},
{
"type": "string",
Expand Down Expand Up @@ -529,6 +529,13 @@
"optional": true,
"default": []
},
{
"type": "boolean",
"name": "save_plates",
"description": "If set to <code>true</code>, detected license plates will be stored in the database, as well as having a snapshot saved.",
"optional": true,
"default": true
},
{
"type": "float",
"valueMin": 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"name": "save_unknown_faces",
"description": "If set to <code>true</code>, any unrecognized faces will be stored in the database, as well as having a snapshot saved. You can then move this image to the folder of the correct person to improve accuracy.",
"optional": true,
"default": false
"default": true
},
{
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
"name": "save_unknown_faces",
"description": "If set to <code>true</code>, any unrecognized faces will be stored in the database, as well as having a snapshot saved. You can then move this image to the folder of the correct person to improve accuracy.",
"optional": true,
"default": false
"default": true
},
{
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"name": "save_unknown_faces",
"description": "If set to <code>true</code>, any unrecognized faces will be stored in the database, as well as having a snapshot saved. You can then move this image to the folder of the correct person to improve accuracy.",
"optional": true,
"default": false
"default": true
},
{
"type": "string",
Expand Down
Loading

0 comments on commit c43c791

Please sign in to comment.