NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Hailo amd64 support (#12820)
Nicolas Mowenc16450adc873
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 5d68c62959..e14516b04b 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -78,16 +78,6 @@ jobs:set: |rk.tags=${{ steps.setup.outputs.image-name }}-rk*.cache-from=type=gha- - name: Build and push Hailo-8l build- uses: docker/bake-action@v4- with:- 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=maxjetson_jp4_build:runs-on: ubuntu-latestname: Jetson Jetpack 4@@ -165,6 +155,30 @@ jobs:tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64,mode=max+ combined_extra_builds:+ runs-on: ubuntu-latest+ name: Combined Extra Builds+ needs:+ - amd64_build+ - arm64_build+ steps:+ - name: Check out code+ uses: actions/checkout@v4+ - 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@v4+ with:+ 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#- name: AMD/ROCm general build# env:# AMDGPU: gfxdiff --git a/docker/hailo8l/Dockerfile b/docker/hailo8l/Dockerfileindex 881fcf5943..391f6f5414 100644--- a/docker/hailo8l/Dockerfile+++ b/docker/hailo8l/Dockerfile@@ -17,20 +17,27 @@ RUN mkdir /h8l-wheelsRUN pip3 wheel --wheel-dir=/h8l-wheels -c /requirements-wheels.txt -r /requirements-wheels-h8l.txt# Build HailoRT and create wheel-FROM deps AS build-hailort+FROM wheels AS build-hailort+ARG TARGETARCH++SHELL ["/bin/bash", "-c"]# Install necessary APT packages-RUN apt-get update && apt-get install -y \- build-essential \- cmake \- git \+RUN apt-get -qq update \+ && apt-get -qq install -y \+ apt-transport-https \+ gnupg \wget \- python3-dev \- gcc-9 \- g++-9 \- libzmq3-dev \- pciutils \- rsync \+ # the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html+ && wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \+ gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \+ && echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \+ tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \+ && apt-get -qq update \+ && apt-get -qq install -y \+ python3.9 \+ python3.9-dev \+ build-essential cmake git \&& rm -rf /var/lib/apt/lists/*# Extract Python version and set environment variables@@ -39,9 +46,6 @@ RUN PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)echo "PYTHON_VERSION=$PYTHON_VERSION" > /etc/environment && \echo "PYTHON_VERSION_NO_DOT=$PYTHON_VERSION_NO_DOT" >> /etc/environment-#ENV PYTHON_VER=$PYTHON_VERSION-#ENV PYTHON_VER_NO_DOT=$PYTHON_VERSION_NO_DOT-# Clone and build HailoRTRUN . /etc/environment && \git clone https://github.com/hailo-ai/hailort.git /opt/hailort && \@@ -50,7 +54,7 @@ RUN . /etc/environment && \cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DHAILO_BUILD_PYBIND=1 -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION} && \cmake --build build --config release --target libhailort && \cmake --build build --config release --target _pyhailort && \- cp build/hailort/libhailort/bindings/python/src/_pyhailort.cpython-${PYTHON_VERSION_NO_DOT}-aarch64-linux-gnu.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/ && \+ cp build/hailort/libhailort/bindings/python/src/_pyhailort.cpython-${PYTHON_VERSION_NO_DOT}-$(if [ $TARGETARCH == "amd64" ]; then echo 'x86_64'; else echo 'aarch64'; fi )-linux-gnu.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/ && \cp build/hailort/libhailort/src/libhailort.so hailort/libhailort/bindings/python/platform/hailo_platform/pyhailort/RUN ls -ahl /opt/hailort/build/hailort/libhailort/src/@@ -94,7 +98,7 @@ COPY --from=rootfs / /# Set environment variables for Hailo SDKENV PATH="/opt/hailort/bin:${PATH}"-ENV LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:${LD_LIBRARY_PATH}"+ENV LD_LIBRARY_PATH="/usr/lib/$(if [ $TARGETARCH == "amd64" ]; then echo 'x86_64'; else echo 'aarch64'; fi )-linux-gnu:${LD_LIBRARY_PATH}"# Set workdirWORKDIR /opt/frigate/diff --git a/docker/hailo8l/h8l.hcl b/docker/hailo8l/h8l.hclindex bff09e6bab..a1eb82fb5e 100644--- a/docker/hailo8l/h8l.hcl+++ b/docker/hailo8l/h8l.hcl@@ -1,18 +1,18 @@target wheels {dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64"]+ platforms = ["linux/arm64","linux/amd64"]target = "wheels"}target deps {dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64"]+ platforms = ["linux/arm64","linux/amd64"]target = "deps"}target rootfs {dockerfile = "docker/main/Dockerfile"- platforms = ["linux/arm64"]+ platforms = ["linux/arm64","linux/amd64"]target = "rootfs"}@@ -23,5 +23,5 @@ target h8l {deps = "target:deps"rootfs = "target:rootfs"}- platforms = ["linux/arm64"]+ platforms = ["linux/arm64","linux/amd64"]}diff --git a/docker/hailo8l/user_installation.sh b/docker/hailo8l/user_installation.shnew file mode 100644index 0000000000..0f40bbaac1--- /dev/null+++ b/docker/hailo8l/user_installation.sh@@ -0,0 +1,35 @@+#!/bin/bash++# Update package list and install dependencies+sudo apt-get update+sudo apt-get install -y build-essential cmake git wget linux-modules-extra-$(uname -r)++arch=$(uname -m)++if [[ $arch == "x86_64" ]]; then+ sudo apt install -y linux-headers-$(uname -r);+else+ sudo apt install -y linux-modules-extra-$(uname -r);+fi++# Clone the HailoRT driver repository+git clone --depth 1 --branch v4.17.0 https://github.com/hailo-ai/hailort-drivers.git++# Build and install the HailoRT driver+cd hailort-drivers/linux/pcie+sudo make all+sudo make install++# Load the Hailo PCI driver+sudo modprobe hailo_pci++# Download and install the firmware+cd ../../+./download_firmware.sh+sudo mv hailo8_fw.4.17.0.bin /lib/firmware/hailo/hailo8_fw.bin++# Install udev rules+sudo cp ./linux/pcie/51-hailo-udev.rules /etc/udev/rules.d/+sudo udevadm control --reload-rules && sudo udevadm trigger++echo "HailoRT driver installation complete."diff --git a/docs/docs/frigate/installation.md b/docs/docs/frigate/installation.mdindex 2d2bb32c4b..98f55f229e 100644--- a/docs/docs/frigate/installation.md+++ b/docs/docs/frigate/installation.md@@ -108,10 +108,10 @@ The Hailo-8L is an M.2 card typically connected to a carrier board for PCIe, whiFor Raspberry Pi 5 users with the AI Kit, installation is straightforward. Simply follow this [guide](https://www.raspberrypi.com/documentation/accessories/ai-kit.html#ai-kit-installation) to install the driver and software.-For other boards, follow these steps for installation:+For other installations, follow these steps for installation:1. Install the driver from the [Hailo GitHub repository](https://github.com/hailo-ai/hailort-drivers). A convenient script for Linux is available to clone the repository, build the driver, and install it.-2. Copy or download [this script](https://gist.github.com/spanner3003/4b85751d671d4ac55f926e564f1abc3e#file-install_hailo8l_driver-sh).+2. Copy or download [this script](https://github.com/blakeblackshear/frigate/blob/41c9b13d2fffce508b32dfc971fa529b49295fbd/docker/hailo8l/user_installation.sh).3. Ensure it has execution permissions with `sudo chmod +x install_hailo8l_driver.sh`4. Run the script with `./install_hailo8l_driver.sh`