hailo-ai / hailo-rpi5-examples

MIT License
387 stars 59 forks source link

Banner

Hailo Raspberry Pi 5 Examples

Welcome to the Hailo Raspberry Pi 5 Examples repository. This project showcases various examples demonstrating the capabilities of the Hailo AI processor on a Raspberry Pi 5. These examples will help you get started with AI on embedded devices. The examples in this repository are designed to work with the Raspberry Pi AI Kit and AI HAT, supporting both the Hailo8 (26 TOPS) and Hailo8L (13 TOPS) AI processors. The examples can also be run on an x86_64 Ubuntu machine with the Hailo8/8L AI processor. Visit the Hailo Official Website and Hailo Community Forum for more information.

Table of Contents

Raspberry Pi 5 with Hailo AI HAT

Hailo Packages Installation

For installation instructions, see the Hailo Raspberry Pi 5 installation guide.

Hailo Version Upgrade Instructions

See the Upgrade or Downgrade Hailo Software section for instructions on how to upgrade the Hailo software.

Available Examples and Resources

Hailo Python API

The Hailo Python API is now available on the Raspberry Pi 5. This API allows you to run inference on the Hailo-8L AI processor using Python. For examples, see our Python code examples. Additional examples can be found in RPi picamera2 code. Visit our HailoRT Python API documentation for more information.

Hailo Examples

Basic Pipelines (Python)

These pipelines are included in this repository. They demonstrate object detection, human pose estimation, and instance segmentation in an easy-to-use format. For installation instructions, see the Basic Pipelines Installation Guide. See our Developement Guide for more information on how to use the pipelines to create your own custom pipelines.

Detection Example

Detection Example

Retrained Networks Support

This application includes support for using retrained detection models. For more information, see Using Retrained Models.

Pose Estimation Example

Pose Estimation Example

Instance Segmentation Example

Instance Segmentation Example

CLIP Application

CLIP (Contrastive Language-Image Pretraining) predicts the most relevant text prompt on real-time video frames using the Hailo-8L AI processor. See the hailo-CLIP Repository for more information. Click the image below to watch the demo on YouTube.

Watch the demo on YouTube

Frigate Integration - Coming Soon

Frigate is an open-source video surveillance software that runs on a Raspberry Pi. This integration will allow you to use the Hailo-8L AI processor for object detection in real-time video streams.

Raspberry Pi Official Examples

rpicam-apps

Raspberry Pi rpicam-apps Hailo post-processing examples. This is Raspberry Pi's official example for AI post-processing using the Hailo AI processor integrated into their CPP camera framework. The documentation on how to use rpicam-apps can be found here. The run command is simplified, and the assets are pre-installed in the system. To run an example from rpicam-apps, run:

rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov6_inference.json

See more available examples in the /usr/share/rpi-camera-assets directory.

picamera2

Raspberry Pi picamera2 is the libcamera-based replacement for Picamera, which was a Python interface to the Raspberry Pi's legacy camera stack. Picamera2 also presents an easy-to-use Python API. Run the following command to clone the picamera2 repo and get the example files:

git clone --depth 1 https://github.com/raspberrypi/picamera2

The examples will be in ./picamera2/examples/hailo/. To run an example from picamera2, run:

cd picamera2/examples/hailo/
python3 pose.py

Hailo Dataflow Compiler (DFC)

The Hailo Dataflow Compiler (DFC) is a software tool that enables developers to compile their neural networks to run on the Hailo-8/8L AI processors. The DFC is available for download from the Hailo Developer Zone (Registration required). For examples, tutorials, and retrain instructions, see the Hailo Model Zoo Repo. Additional documentation and tutorials can be found in the Hailo Developer Zone Documentation. For a full end-to-end training and deployment example, see the Retraining Example. The detection basic pipeline example includes support for retrained models. For more information, see Using Retrained Models.

Contributing

We welcome contributions from the community. You can contribute by:

  1. Opening a pull request.
  2. Reporting issues and bugs.
  3. Suggesting new features or improvements.
  4. Joining the discussion on the Hailo Community Forum.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

This code example is provided by Hailo solely on an “AS IS” basis and “with all faults.” No responsibility or liability is accepted or shall be imposed upon Hailo regarding the accuracy, merchantability, completeness, or suitability of the code example. Hailo shall not have any liability or responsibility for errors or omissions in, or any business decisions made by you in reliance on this code example or any part of it. If an error occurs when running this example, please open a ticket in the "Issues" tab.