diff --git a/.github/workflows/ax.yml b/.github/workflows/ax.yml deleted file mode 100644 index 82721eb3c..000000000 --- a/.github/workflows/ax.yml +++ /dev/null @@ -1,143 +0,0 @@ -name: AXERA - -on: - workflow_dispatch: - -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - -env: - PYTHON_VERSION: 3.9 - -jobs: - x86_axcl_builds: - runs-on: ubuntu-22.04 - name: x86_AXCL Build - steps: - - name: Check out code - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set x86_AXCL_TAG - run: echo "x86_AXCL_TAG=x86-axcl-${GITHUB_SHA:0:7}" >> $GITHUB_ENV - - - name: Set Version - run: make version - - - name: Build - uses: docker/bake-action@v6 - with: - source: . - push: false - targets: x86-axcl - files: docker/axcl/x86-axcl.hcl - no-cache: true - set: | - x86-axcl.tags=frigate:${{ env.x86_AXCL_TAG }} - - - name: Clean up disk space - run: | - docker system prune -f - - - name: Save Docker image as tar file - run: | - docker save frigate:${{ env.x86_AXCL_TAG }} -o frigate-${{ env.x86_AXCL_TAG }}.tar - ls -lh frigate-${{ env.x86_AXCL_TAG }}.tar - - - name: Upload Docker image artifact - uses: actions/upload-artifact@v4 - with: - name: x86-axcl-docker-image - path: frigate-${{ env.x86_AXCL_TAG }}.tar - retention-days: 7 - - rk_axcl_builds: - runs-on: ubuntu-22.04-arm - name: rk_AXCL Build - steps: - - name: Check out code - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set RK_AXCL_TAG - run: echo "RK_AXCL_TAG=rk-axcl-${GITHUB_SHA:0:7}" >> $GITHUB_ENV - - - name: Set Version - run: make version - - - name: Build - uses: docker/bake-action@v6 - with: - source: . - push: false - targets: rk-axcl - files: | - docker/rockchip/rk.hcl - docker/axcl/rk-axcl.hcl - no-cache: true - set: | - rk-axcl.tags=frigate:${{ env.RK_AXCL_TAG }} - - - name: Clean up disk space - run: | - docker system prune -f - - - name: Save Docker image as tar file - run: | - docker save frigate:${{ env.RK_AXCL_TAG }} -o frigate-${{ env.RK_AXCL_TAG }}.tar - ls -lh frigate-${{ env.RK_AXCL_TAG }}.tar - - - name: Upload Docker image artifact - uses: actions/upload-artifact@v4 - with: - name: rk-axcl-docker-image - path: frigate-${{ env.RK_AXCL_TAG }}.tar - retention-days: 7 - - - rpi_axcl_builds: - runs-on: ubuntu-22.04-arm - name: RPi_AXCL Build - steps: - - name: Check out code - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set RPi_AXCL_TAG - run: echo "RPi_AXCL_TAG=rpi-axcl-${GITHUB_SHA:0:7}" >> $GITHUB_ENV - - - name: Set Version - run: make version - - - name: Build - uses: docker/bake-action@v6 - with: - source: . - push: false - targets: rpi-axcl - files: | - docker/rpi/rpi.hcl - docker/axcl/rpi-axcl.hcl - no-cache: true - set: | - rpi-axcl.tags=frigate:${{ env.RPi_AXCL_TAG }} - - - name: Clean up disk space - run: | - docker system prune -f - - - name: Save Docker image as tar file - run: | - docker save frigate:${{ env.RPi_AXCL_TAG }} -o frigate-${{ env.RPi_AXCL_TAG }}.tar - ls -lh frigate-${{ env.RPi_AXCL_TAG }}.tar - - - name: Upload Docker image artifact - uses: actions/upload-artifact@v4 - with: - name: rpi-axcl-docker-image - path: frigate-${{ env.RPi_AXCL_TAG }}.tar - retention-days: 7 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97b022ffc..9c67d4e3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -223,30 +223,4 @@ jobs: tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }} sources: | ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-amd64 - ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi - axera_build: - runs-on: ubuntu-22.04 - name: AXERA Build - needs: - - amd64_build - - arm64_build - steps: - - name: Check out code - uses: actions/checkout@v5 - 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 Axera build - uses: docker/bake-action@v6 - with: - source: . - push: true - targets: axcl - files: docker/axcl/axcl.hcl - set: | - axcl.tags=${{ steps.setup.outputs.image-name }}-axcl - *.cache-from=type=gha \ No newline at end of file + ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ env.SHORT_SHA }}-rpi \ No newline at end of file diff --git a/docker/axcl/Dockerfile b/docker/axcl/Dockerfile deleted file mode 100644 index e67046055..000000000 --- a/docker/axcl/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -# syntax=docker/dockerfile:1.6 - -# https://askubuntu.com/questions/972516/debian-frontend-environment-variable -ARG DEBIAN_FRONTEND=noninteractive - -# Globally set pip break-system-packages option to avoid having to specify it every time -ARG PIP_BREAK_SYSTEM_PACKAGES=1 - -FROM frigate AS frigate-axcl -ARG TARGETARCH -ARG PIP_BREAK_SYSTEM_PACKAGES - -# Install axpyengine -RUN wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc1/axengine-0.1.3-py3-none-any.whl -O /axengine-0.1.3-py3-none-any.whl -RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ /axengine-0.1.3-py3-none-any.whl \ - && rm /axengine-0.1.3-py3-none-any.whl - -# Set ldconfig path -RUN echo "/usr/lib/axcl" > /etc/ld.so.conf.d/ax.conf - -# Set env -ENV PATH="$PATH:/usr/bin/axcl" -ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/axcl" - -ENTRYPOINT ["sh", "-c", "ldconfig && exec /init"] \ No newline at end of file diff --git a/docker/axcl/axcl.hcl b/docker/axcl/axcl.hcl deleted file mode 100644 index d7cf0d4eb..000000000 --- a/docker/axcl/axcl.hcl +++ /dev/null @@ -1,13 +0,0 @@ -target frigate { - dockerfile = "docker/main/Dockerfile" - platforms = ["linux/amd64", "linux/arm64"] - target = "frigate" -} - -target axcl { - dockerfile = "docker/axcl/Dockerfile" - contexts = { - frigate = "target:frigate", - } - platforms = ["linux/amd64", "linux/arm64"] -} \ No newline at end of file diff --git a/docker/axcl/axcl.mk b/docker/axcl/axcl.mk deleted file mode 100644 index e4b6d4cef..000000000 --- a/docker/axcl/axcl.mk +++ /dev/null @@ -1,15 +0,0 @@ -BOARDS += axcl - -local-axcl: version - docker buildx bake --file=docker/axcl/axcl.hcl axcl \ - --set axcl.tags=frigate:latest-axcl \ - --load - -build-axcl: version - docker buildx bake --file=docker/axcl/axcl.hcl axcl \ - --set axcl.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-axcl - -push-axcl: build-axcl - docker buildx bake --file=docker/axcl/axcl.hcl axcl \ - --set axcl.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-axcl \ - --push \ No newline at end of file diff --git a/docker/axcl/rk-axcl.hcl b/docker/axcl/rk-axcl.hcl deleted file mode 100644 index eea2bd93d..000000000 --- a/docker/axcl/rk-axcl.hcl +++ /dev/null @@ -1,7 +0,0 @@ -target rk-axcl { - dockerfile = "docker/axcl/Dockerfile" - contexts = { - frigate = "target:rk", - } - platforms = ["linux/arm64"] -} \ No newline at end of file diff --git a/docker/axcl/rpi-axcl.hcl b/docker/axcl/rpi-axcl.hcl deleted file mode 100644 index 72cdc71c0..000000000 --- a/docker/axcl/rpi-axcl.hcl +++ /dev/null @@ -1,7 +0,0 @@ -target rpi-axcl { - dockerfile = "docker/axcl/Dockerfile" - contexts = { - frigate = "target:rpi", - } - platforms = ["linux/arm64"] -} \ No newline at end of file diff --git a/docker/axcl/x86-axcl.hcl b/docker/axcl/x86-axcl.hcl deleted file mode 100644 index 78546be1a..000000000 --- a/docker/axcl/x86-axcl.hcl +++ /dev/null @@ -1,13 +0,0 @@ -target frigate { - dockerfile = "docker/main/Dockerfile" - platforms = ["linux/amd64"] - target = "frigate" -} - -target x86-axcl { - dockerfile = "docker/axcl/Dockerfile" - contexts = { - frigate = "target:frigate", - } - platforms = ["linux/amd64"] -} \ No newline at end of file diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 055a1458f..5c9465d10 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -266,6 +266,18 @@ RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \ pip3 install -U /deps/wheels/*.whl +#### +# +# AXEngine Support +# +#### +RUN pip3 install https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc1/axengine-0.1.3-py3-none-any.whl + +RUN echo "/usr/lib/axcl" > /etc/ld.so.conf.d/ax.conf + +ENV PATH="${PATH}:/usr/bin/axcl" +ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/axcl" + # Install MemryX runtime (requires libgomp (OpenMP) in the final docker image) RUN --mount=type=bind,source=docker/main/install_memryx.sh,target=/deps/install_memryx.sh \ bash -c "bash /deps/install_memryx.sh" diff --git a/frigate/detectors/detection_runners.py b/frigate/detectors/detection_runners.py index 7565c9a3d..694ebc67d 100644 --- a/frigate/detectors/detection_runners.py +++ b/frigate/detectors/detection_runners.py @@ -10,10 +10,6 @@ from typing import Any import numpy as np import onnxruntime as ort -from frigate.util.axengine_converter import ( - auto_convert_model as auto_load_axengine_model, -) -from frigate.util.axengine_converter import is_axengine_compatible from frigate.util.model import get_ort_providers from frigate.util.rknn_converter import auto_convert_model, is_rknn_compatible @@ -675,6 +671,11 @@ def get_optimized_runner( """Get an optimized runner for the hardware.""" device = device or "AUTO" + from frigate.util.axengine_converter import ( + auto_convert_model as auto_load_axengine_model, + ) + from frigate.util.axengine_converter import is_axengine_compatible + if is_axengine_compatible(model_path, device, model_type): axmodel_path = auto_load_axengine_model(model_path, model_type)