Files
frigate/frigate/detectors/plugins/qualcomm_tfl.py
T
Rami Mouro e769ba7a8c 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>
2026-06-29 19:44:04 -06:00

49 lines
1.4 KiB
Python

"""Qualcomm QNN TFLite delegate detector for Qualcomm NPU acceleration."""
import logging
from pydantic import ConfigDict
from typing_extensions import Literal
from frigate.detectors.detection_api import DetectionApi
from frigate.detectors.detector_config import BaseDetectorConfig
from ..detector_utils import (
tflite_detect_raw,
tflite_init,
tflite_load_delegate_interpreter,
)
logger = logging.getLogger(__name__)
# Use _tfl suffix to default to the bundled tflite model
DETECTOR_KEY = "qualcomm_tfl"
class QualcommDetectorConfig(BaseDetectorConfig):
"""Qualcomm NPU detector using the QNN TFLite delegate to accelerate inference on Qualcomm SoCs with a Hexagon NPU (e.g. IQ9100, QCS6490)."""
model_config = ConfigDict(
title="Qualcomm",
)
type: Literal[DETECTOR_KEY]
class QualcommTfl(DetectionApi):
type_key = DETECTOR_KEY
def __init__(self, detector_config: QualcommDetectorConfig):
# The QNN TFLite delegate library is provided by the host via CDI bind mounts
delegate_library = "libQnnTFLiteDelegate.so"
# Use the Hexagon Tensor Processor (HTP / NPU) backend
device_config = {"backend_type": "htp"}
interpreter = tflite_load_delegate_interpreter(
delegate_library, detector_config, device_config
)
tflite_init(self, interpreter)
def detect_raw(self, tensor_input):
return tflite_detect_raw(self, tensor_input)