Hailo official integration with Frigate

Official Hailo8 AI Accelerator Support for Frigate NVR :tada:

We’ve partnered with the Frigate NVR team to bring official Hailo8 AI accelerator support to the project. This allows Frigate users to harness Hailo’s efficient edge AI processing for faster, more accurate home surveillance.

Overview

This guide provides a template for using Hailo with Frigate. Note that Hailo support is still not in the official release, so a specific image is used instead of ghcr.io/blakeblackshear/frigate:stable.
See the exact image in the docker-compose below.

See more details in: Installation | Frigate

Prerequisites

  • Ubuntu 22.04 LTS or RPi OS
  • Docker & Docker Compose
  • Hailo8 AI Accelerator connected to your system
  • One or more IP cameras

Installation Steps

1. Install Hailo Runtime

Raspberry Pi:

sudo apt update && sudo apt full-upgrade
sudo apt install hailo-all
reboot the rpi

x86 Systems:
Follow the Hailo-RT v4.20 installation guide.

Working version: 4.20

2. Prepare the Directory Structure

Create config and storage directories to be mapped to the container:

mkdir config storage

3. Create Docker Compose File

Create a docker-compose.yaml file:

nano docker-compose.yaml

Add the following content:

version: "3"
services:
  frigate:
    container_name: frigate
    image: ghcr.io/blakeblackshear/frigate:678ae87
    shm_size: "512mb" # calculate on your own
    stop_grace_period: 30s # allow enough time to shut down the various services
    restart: unless-stopped
    privileged: true
    ports:
      - "5000:5000"
      - "1935:1935"
      - "8554:8554"
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    devices:
      - /dev/bus/usb:/dev/bus/usb
      - /dev/hailo0:/dev/hailo0
      - /dev/video0:/dev/video0
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config:/config
      - ./storage:/media/frigate
      - /tmp/cache:/tmp/cache

4. Start Docker

Run the following command to start Docker in daemon mode:

docker compose up --build -d

Warning : this is running in the background and will hold the hailo device

5. Configure Frigate

Once Docker is running, you can access Frigate in your browser at:

http://localhost:5000/

Edit the configuration file by clicking on the ‘cog wheel’ button and selecting the configuration editor.

6. Setup Camera and Detector

Configure your camera according to
1-Camera specefic Guide
2-Cameras Guide
and select one of the detector options below:

Default YOLOv6n Model (Auto Detection)

detectors:
  hailo8l:
    type: hailo8l
    device: PCIe

model:
  width: 320
  height: 320
  input_tensor: nhwc
  input_pixel_format: rgb
  input_dtype: int
  model_type: yolo-generic

Custom YOLO Model with URL (e.g. YOLOv8m)

detectors:
  hailo8l:
    type: hailo8l
    device: PCIe

model:
  path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8/yolov8m.hef

SSD MobileNet v1

detectors:
  hailo8l:
    type: hailo8l
    device: PCIe

model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: rgb
  model_type: ssd
  path: https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.14.0/hailo8l/ssd_mobilenet_v1.hef

Important Notes

  • If you run Frigate in the background, the Hailo device will be used, and trying to use it elsewhere will show a HAILO_OUT_OF_PHYSICAL_DEVICES(74) error.- If you run Frigate in the background, the Hailo device will be used, and trying to use it elsewhere will show a HAILO_OUT_OF_PHYSICAL_DEVICES(74) error.

  • Frigate will be restarted after boot, so even if you restart your device, Frigate will restart and the device will be used.

  • You can stop Frigate to release the Hailo device.

  • Support for running from Frigate and from additional processes will be added in the future.

Performance

  • Hailo-8: Up to 1200 FPS with YOLOv6n, handles up to 8 cameras at 20-30 FPS each
  • Hailo-8L: Around 300 FPS

Supported Models

Frigate with Hailo8 supports any YOLO or SSD model compiled for Hailo with post-processing.

Recommended Defaults

Hardware Model Input Size Performance
Hailo-8L YOLOv6n 320x320 ~11 ms inference
Hailo-8 YOLOv6n 320x320 ~7 ms inference

Tested Models

The following models have been tested and verified to work with Hailo8 and Frigate:

  • YOLOv8 variants (YOLOv8n, YOLOv8m, etc.)
  • YOLOv9 variants
  • YOLOv11 variants
  • SSD MobileNet v1 and v2
  • YOLOv5n, YOLOv5s, YOLOv6n, YOLOv6m

Troubleshooting

For troubleshooting, please refer to the Frigate documentation: https://docs.frigate.video/

4 Likes

Will this isolate rpi5+frigate+hailo8 users from the version kablooey after most any update to the system where the hailo driver version mismatches the hailo library version mistmatches the container’s hailo version(s)? The pain there has been off the charts whenever something updates. Hoping this improves that situation.

1 Like

Hey @Christopher_Davis ,

Welcome to the Hailo Community!

This container is optimized for 4.20 version , for now we recommend staying at this version to use frigate!

Thanks for the guide… I noticed a typo in the above config during my test setup with yolo model.

You’ve got the HW setup for a hailo8L in the detector section but in the YOLO model section you’re pulling a hef file generated for the hailo8. I simply added an “l” to the end of the hailo8 to pull the right version.

Hey @David_Pinto ,

Welcome to the Hailo Community!

Thanks for pointing it out !