Hailo-8

The hailo
component in Viseron allows you to integrate Hailo-8 AI Accelerators for object detection.
The hailo
component is only available for aarch64
and amd64
architectures.
Configuration
Configuration example
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.
It is only required to install the HailoRT PCIe driver
and HailoRT
. PyHailoRT
is not necessary since it is installed inside the container.
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
- Docker-Compose
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
services:
viseron:
image: roflcoopter/viseron:latest
container_name: viseron
shm_size: "1024mb"
volumes:
- {segments path}:/segments
- {snapshots path}:/snapshots
- {thumbnails path}:/thumbnails
- {event clips path}:/event_clips
- {timelapse path}:/timelapse
- {config path}:/config
- /etc/localtime:/etc/localtime:ro
ports:
- 8888:8888
devices:
- /dev/hailo0
Object detector
An object detector scans an image to identify multiple objects and their position.
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.
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
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
hailo
, add the following to your config.yaml
logger:
logs:
viseron.components.hailo: debug