mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-22 22:52:48 +03:00
feat(detectors): add Qualcomm Hexagon NPU support (community board)
Add a community-supported board build for Qualcomm SoCs with a Hexagon NPU, accelerating TFLite object detection through the QNN TFLite delegate on the Hexagon Tensor Processor (HTP). Supported boards: - IQ9100 (IQ-9075 EVK) - QCS6490 (RB3 Gen 2 Vision Kit / Rubik Pi 3) - detector: new `qualcomm_tfl` plugin loading libQnnTFLiteDelegate.so on the HTP backend, reusing the shared TFLite delegate helpers - docker: `docker/qualcomm` board build (Dockerfile, qualcomm.hcl, qualcomm.mk) producing the arm64 `-qualcomm` image - cdi: per-board Container Device Interface descriptors and an install helper exposing the NPU device nodes and QNN libraries to the container - ci/codeowners: register the qualcomm build target and code owner - docs: installation, hardware, and object detector documentation, using the shared model config dropdown component - i18n: add the Qualcomm detector label and description to the generated en config locale Signed-off-by: Rami Mouro <rmouro@qti.qualcomm.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# 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 wheels AS qualcomm-wheels
|
||||
ARG TARGETARCH
|
||||
|
||||
# No extra wheels needed — ai-edge-litert is already in the base image
|
||||
# and the QNN delegate library (libQnnTFLiteDelegate.so) is provided
|
||||
# by the host via CDI bind mounts at runtime.
|
||||
|
||||
FROM deps AS qualcomm-deps
|
||||
ARG TARGETARCH
|
||||
ARG PIP_BREAK_SYSTEM_PACKAGES
|
||||
|
||||
WORKDIR /opt/frigate/
|
||||
COPY --from=rootfs / /
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
|
||||
parser = argparse.ArgumentParser(description="Install CDI on Dragonwing IoT boards")
|
||||
parser.add_argument("--file", type=str, required=True, help="CDI input file")
|
||||
args, unknown = parser.parse_known_args()
|
||||
|
||||
if os.path.exists("/etc/cdi/cdi-hw-acc.json"):
|
||||
print("/etc/cdi/cdi-hw-acc.json already exists. Remove it first before continuing.")
|
||||
exit(1)
|
||||
|
||||
if not os.path.exists(args.file):
|
||||
print(f"{args.file} (via --file) does not exist")
|
||||
exit(1)
|
||||
|
||||
# Check if directory exists
|
||||
if not os.path.exists("/etc/cdi"):
|
||||
# Check if we can create it in /etc
|
||||
if not os.access(os.path.dirname("/etc/cdi"), os.W_OK):
|
||||
print(
|
||||
f"{os.path.dirname('/etc/cdi')} is not writable. Re-run this script with sudo."
|
||||
)
|
||||
exit(1)
|
||||
os.mkdir("/etc/cdi")
|
||||
else:
|
||||
# Directory exists → check if writable
|
||||
if not os.access("/etc/cdi", os.W_OK):
|
||||
print("/etc/cdi is not writable. Re-run this script with sudo.")
|
||||
exit(1)
|
||||
|
||||
with open(args.file, "r") as f:
|
||||
cdi = json.loads(f.read())
|
||||
|
||||
print("Finding missing mount paths...")
|
||||
for device in cdi["devices"]:
|
||||
new_mounts = []
|
||||
|
||||
for mount in device["containerEdits"]["mounts"]:
|
||||
if not os.path.exists(mount["hostPath"]):
|
||||
print(f" Missing {mount['hostPath']}")
|
||||
else:
|
||||
new_mounts.append(mount)
|
||||
|
||||
device["containerEdits"]["mounts"] = new_mounts
|
||||
|
||||
print("")
|
||||
print("Writing to /etc/cdi/cdi-hw-acc.json...")
|
||||
with open("/etc/cdi/cdi-hw-acc.json", "w") as f:
|
||||
f.write(json.dumps(cdi, indent=4))
|
||||
print("Writing to /etc/cdi/cdi-hw-acc.json OK")
|
||||
@@ -0,0 +1,27 @@
|
||||
target wheels {
|
||||
dockerfile = "docker/main/Dockerfile"
|
||||
platforms = ["linux/arm64"]
|
||||
target = "wheels"
|
||||
}
|
||||
|
||||
target deps {
|
||||
dockerfile = "docker/main/Dockerfile"
|
||||
platforms = ["linux/arm64"]
|
||||
target = "deps"
|
||||
}
|
||||
|
||||
target rootfs {
|
||||
dockerfile = "docker/main/Dockerfile"
|
||||
platforms = ["linux/arm64"]
|
||||
target = "rootfs"
|
||||
}
|
||||
|
||||
target qualcomm {
|
||||
dockerfile = "docker/qualcomm/Dockerfile"
|
||||
contexts = {
|
||||
wheels = "target:wheels",
|
||||
deps = "target:deps",
|
||||
rootfs = "target:rootfs"
|
||||
}
|
||||
platforms = ["linux/arm64"]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
BOARDS += qualcomm
|
||||
|
||||
local-qualcomm: version
|
||||
docker buildx bake --file=docker/qualcomm/qualcomm.hcl qualcomm \
|
||||
--set qualcomm.tags=frigate:latest-qualcomm \
|
||||
--load
|
||||
|
||||
build-qualcomm: version
|
||||
docker buildx bake --file=docker/qualcomm/qualcomm.hcl qualcomm \
|
||||
--set qualcomm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-qualcomm
|
||||
|
||||
push-qualcomm: build-qualcomm
|
||||
docker buildx bake --file=docker/qualcomm/qualcomm.hcl qualcomm \
|
||||
--set qualcomm.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-qualcomm \
|
||||
--push
|
||||
Reference in New Issue
Block a user