mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-23 07:02:48 +03:00
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>
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
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")
|