NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Consolidate HailoRT into the main Docker Image (#16487)
Nicolas Mowenb594f198a95f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex bf5763c006..2046ed1003 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -202,33 +202,6 @@ jobs:set: |rk.tags=${{ steps.setup.outputs.image-name }}-rk*.cache-from=type=gha- combined_extra_builds:- runs-on: ubuntu-22.04- name: Combined Extra Builds- needs:- - amd64_build- - arm64_build- steps:- - name: Check out code- uses: actions/checkout@v4- with:- persist-credentials: false- - name: Set up QEMU and Buildx- id: setup- uses: ./.github/actions/setup- with:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- - name: Build and push Hailo-8l build- uses: docker/bake-action@v6- with:- source: .- push: true- targets: h8l- files: docker/hailo8l/h8l.hcl- set: |- h8l.tags=${{ steps.setup.outputs.image-name }}-h8l- *.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-h8l- *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-h8l,mode=max# The majority of users running arm64 are rpi users, so the rpi# build should be the primary arm64 imageassemble_default_build:diff --git a/docker/hailo8l/Dockerfile b/docker/hailo8l/Dockerfiledeleted file mode 100644index 33b5b08f0d..0000000000--- a/docker/hailo8l/Dockerfile+++ /dev/null@@ -1,42 +0,0 @@-# syntax=docker/dockerfile:1.6--ARG DEBIAN_FRONTEND=noninteractive--# Build Python wheels-FROM wheels AS h8l-wheels--RUN python3 -m pip config set global.break-system-packages true-COPY docker/main/requirements-wheels.txt /requirements-wheels.txt-COPY docker/hailo8l/requirements-wheels-h8l.txt /requirements-wheels-h8l.txt--RUN sed -i "/https:\/\//d" /requirements-wheels.txt--# Create a directory to store the built wheels-RUN mkdir /h8l-wheels--# Build the wheels-RUN pip3 wheel --wheel-dir=/h8l-wheels -c /requirements-wheels.txt -r /requirements-wheels-h8l.txt--FROM wget AS hailort-ARG TARGETARCH-RUN --mount=type=bind,source=docker/hailo8l/install_hailort.sh,target=/deps/install_hailort.sh \- /deps/install_hailort.sh--# Use deps as the base image-FROM deps AS h8l-frigate--# Copy the wheels from the wheels stage-COPY --from=h8l-wheels /h8l-wheels /deps/h8l-wheels-COPY --from=hailort /hailo-wheels /deps/hailo-wheels-COPY --from=hailort /rootfs/ /--# Install the wheels-RUN python3 -m pip config set global.break-system-packages true-RUN pip3 install -U /deps/h8l-wheels/*.whl-RUN pip3 install -U /deps/hailo-wheels/*.whl--# Copy base files from the rootfs stage-COPY --from=rootfs / /--# Set workdir-WORKDIR /opt/frigate/diff --git a/docker/hailo8l/h8l.hcl b/docker/hailo8l/h8l.hcldeleted file mode 100644index 91f6d13c6e..0000000000--- a/docker/hailo8l/h8l.hcl+++ /dev/null@@ -1,34 +0,0 @@-target wget {- dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64","linux/amd64"]- target = "wget"-}--target wheels {- dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64","linux/amd64"]- target = "wheels"-}--target deps {- dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64","linux/amd64"]- target = "deps"-}--target rootfs {- dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64","linux/amd64"]- target = "rootfs"-}--target h8l {- dockerfile = "docker/hailo8l/Dockerfile"- contexts = {- wget = "target:wget"- wheels = "target:wheels"- deps = "target:deps"- rootfs = "target:rootfs"- }- platforms = ["linux/arm64","linux/amd64"]-}diff --git a/docker/hailo8l/h8l.mk b/docker/hailo8l/h8l.mkdeleted file mode 100644index 3187718029..0000000000--- a/docker/hailo8l/h8l.mk+++ /dev/null@@ -1,15 +0,0 @@-BOARDS += h8l--local-h8l: version- docker buildx bake --file=docker/hailo8l/h8l.hcl h8l \- --set h8l.tags=frigate:latest-h8l \- --load--build-h8l: version- docker buildx bake --file=docker/hailo8l/h8l.hcl h8l \- --set h8l.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-h8l--push-h8l: build-h8l- docker buildx bake --file=docker/hailo8l/h8l.hcl h8l \- --set h8l.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-h8l \- --push\ No newline at end of filediff --git a/docker/hailo8l/install_hailort.sh b/docker/hailo8l/install_hailort.shdeleted file mode 100755index c0198b34c4..0000000000--- a/docker/hailo8l/install_hailort.sh+++ /dev/null@@ -1,19 +0,0 @@-#!/bin/bash--set -euxo pipefail--hailo_version="4.20.0"--if [[ "${TARGETARCH}" == "amd64" ]]; then- arch="x86_64"-elif [[ "${TARGETARCH}" == "arm64" ]]; then- arch="aarch64"-fi--wget -qO- "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${TARGETARCH}.tar.gz" |- tar -C / -xzf ---mkdir -p /hailo-wheels--wget -P /hailo-wheels/ "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${hailo_version}-cp311-cp311-linux_${arch}.whl"-diff --git a/docker/hailo8l/requirements-wheels-h8l.txt b/docker/hailo8l/requirements-wheels-h8l.txtdeleted file mode 100644index e125f9e8b1..0000000000--- a/docker/hailo8l/requirements-wheels-h8l.txt+++ /dev/null@@ -1,12 +0,0 @@-appdirs==1.4.*-argcomplete==2.0.*-contextlib2==0.6.*-distlib==0.3.*-filelock==3.8.*-future==0.18.*-importlib-metadata==5.1.*-importlib-resources==5.1.*-netaddr==0.8.*-netifaces==0.10.*-verboselogs==1.7.*-virtualenv==20.17.*diff --git a/docker/main/Dockerfile b/docker/main/Dockerfileindex e6dee8380e..4c3416789f 100644--- a/docker/main/Dockerfile+++ b/docker/main/Dockerfile@@ -170,6 +170,9 @@ RUN /build_pysqlite3.shCOPY docker/main/requirements-wheels.txt /requirements-wheels.txtRUN pip3 wheel --wheel-dir=/wheels -r /requirements-wheels.txt+# Install HailoRT & Wheels+RUN --mount=type=bind,source=docker/main/install_hailort.sh,target=/deps/install_hailort.sh \+ /deps/install_hailort.sh# Collect deps in a single layerFROM scratch AS deps-rootfs@@ -180,6 +183,7 @@ COPY --from=libusb-build /usr/local/lib /usr/local/libCOPY --from=tempio /rootfs/ /COPY --from=s6-overlay /rootfs/ /COPY --from=models /rootfs/ /+COPY --from=wheels /rootfs/ /COPY docker/main/rootfs/ /diff --git a/docker/main/install_hailort.sh b/docker/main/install_hailort.shnew file mode 100755index 0000000000..e050bd591f--- /dev/null+++ b/docker/main/install_hailort.sh@@ -0,0 +1,14 @@+#!/bin/bash++set -euxo pipefail++hailo_version="4.20.0"++if [[ "${TARGETARCH}" == "amd64" ]]; then+ arch="x86_64"+elif [[ "${TARGETARCH}" == "arm64" ]]; then+ arch="aarch64"+fi++wget -qO- "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${TARGETARCH}.tar.gz" | tar -C / -xzf -+wget -P /wheels/ "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${hailo_version}-cp311-cp311-linux_${arch}.whl"diff --git a/docker/main/requirements-wheels.txt b/docker/main/requirements-wheels.txtindex 40a2f1d8b4..ab91c94a7c 100644--- a/docker/main/requirements-wheels.txt+++ b/docker/main/requirements-wheels.txt@@ -54,3 +54,16 @@ pywebpush == 2.0.*pyclipper == 1.3.*shapely == 2.0.*prometheus-client == 0.21.*+# HailoRT Wheels+appdirs==1.4.*+argcomplete==2.0.*+contextlib2==0.6.*+distlib==0.3.*+filelock==3.8.*+future==0.18.*+importlib-metadata==5.1.*+importlib-resources==5.1.*+netaddr==0.8.*+netifaces==0.10.*+verboselogs==1.7.*+virtualenv==20.17.*diff --git a/docs/docs/frigate/installation.md b/docs/docs/frigate/installation.mdindex 2c139d2bda..e145596976 100644--- a/docs/docs/frigate/installation.md+++ b/docs/docs/frigate/installation.md@@ -117,7 +117,7 @@ For other installations, follow these steps for installation:#### Setup-To set up Frigate, follow the default installation instructions, but use a Docker image with the `-h8l` suffix, for example: `ghcr.io/blakeblackshear/frigate:stable-h8l`+To set up Frigate, follow the default installation instructions, for example: `ghcr.io/blakeblackshear/frigate:stable`Next, grant Docker permissions to access your hardware by adding the following lines to your `docker-compose.yml` file: