Skip to main content

Hailo-8

Hailo-8

The hailo component in Viseron allows you to integrate Hailo-8 AI Accelerators for object detection.

info

The hailo component is only available for aarch64 and amd64 architectures.

Configuration

Configuration example
/config/config.yaml
hailo:
object_detector:
cameras:
camera_one:
fps: 1
labels:
- label: person
confidence: 0.8
- label: cat
confidence: 0.8
camera_two:
fps: 1
scan_on_motion_only: false
labels:
- label: dog
confidence: 0.8
trigger_event_recording: false
hailomap required
Hailo configuration.

Installation

For a Raspberry Pi 5 with the AI kit, follow the instructions in the Raspberry Pi 5 documentation.

If you have installed Ubuntu on your Raspberry Pi 5 instead of Raspberry Pi OS, you need to perform some additional steps. These steps are outlined well in this guide.

For other platforms, please refer to the official Hailo documentation.

note

It is only required to install the HailoRT PCIe driver and HailoRT. PyHailoRT is not necessary since it is installed inside the container.

warning

Viseron is currently using the version 4.22.0 of the Hailo runtime, and you may encounter compatibility issues if you install a different version of the drivers on your host.

Mounting the device

To allow the Viseron container to access the Hailo device, you need to mount it when starting the container.

docker run --rm \
-v {segments path}:/segments \
-v {snapshots path}:/snapshots \
-v {thumbnails path}:/thumbnails \
-v {event clips path}:/event_clips \
-v {timelapse path}:/timelapse \
-v {config path}:/config \
-v /etc/localtime:/etc/localtime:ro \
-p 8888:8888 \
--name viseron \
--shm-size=1024mb \
--device /dev/hailo0 \
roflcoopter/viseron:latest

Object detector

An object detector scans an image to identify multiple objects and their position.

tip

Object detectors can be taxing on the system, so it is wise to combine it with a motion detector

Labels

Labels are used to tell Viseron what objects to look for and keep recordings of. The available labels depends on what detection model you are using.

The max/min width/height is used to filter out any unreasonably large/small objects to reduce false positives.
Objects can also be filtered out with the use of an optional mask.

tip
To see the default available labels you can inspect the label_path file.
docker exec -it viseron cat /detectors/models/darknet/coco.names

Zones

Zones are used to define areas in the cameras field of view where you want to look for certain objects (labels).
Say you have a camera facing the sidewalk and have labels setup to record the label person.
This would cause Viseron to start recording people who are walking past the camera on the sidewalk. Not ideal.
To remedy this you define a zone which covers only the area that you are actually interested in, excluding the sidewalk.

hailo:
object_detector:
cameras:
camera_one:
...
zones:
- name: sidewalk
coordinates:
- x: 522
y: 11
- x: 729
y: 275
- x: 333
y: 603
- x: 171
y: 97
labels:
- label: person
confidence: 0.8
trigger_event_recording: true
tip

See Mask for how to get the coordinates for a zone.

Mask

Masks are used to exclude certain areas in the image from object detection. If a detected object has its lower portion inside of the mask it will be discarded.

The coordinates form a polygon around the masked area.
To easily generate coordinates you can use a tool like image-map.net.
Just upload an image from your camera, choose the Poly shape and start drawing your mask.
Then click Show me the code! and adapt it to the config format.
Coordinates coords="522,11,729,275,333,603,171,97" should be turned into this:

hailo:
object_detector:
cameras:
camera_one:
...
mask:
- coordinates:
- x: 522
y: 11
- x: 729
y: 275
- x: 333
y: 603
- x: 171
y: 97

Paste your coordinates here and press Get config to generate a config example

Troubleshooting

To enable debug logging for hailo, add the following to your config.yaml
/config/config.yaml
logger:
logs:
viseron.components.hailo: debug