So, with the recent release of the Raspberry Pi AI Kit, I just couldn’t resist jumping into the AI pool with my shiny new toy. The AI Kit packs a whopping 13 tera-operations per second (TOPS) neural network inference accelerator powered by the mighty Hailo-8L chip.

raspberry-pi-ai-kit


Getting Started

As always, I got straight to work, setting up my Pi by flashing the Raspberry Pi OS onto a 64GB SD card using the reliable Raspberry Pi Imager. I added the active cooler, connected the AI Kit, and hooked up the AI camera. And since I’m a big fan of building things (especially with Legos), I crafted a highly professional Lego case to house it all.

raspberry-pi-ai-kit-lego-case

Setting Up the Raspberry Pi 5 + Hailo

Now, let’s get the brain of the operation fired up! Following the excellent Raspberry Pi 5 and Hailo setup guide, here’s how I got everything running smoothly:

sudo apt update
sudo apt full-upgrade

# Enable PCIe Gen 3 mode for max speed (because speed is life)
sudo raspi-config
sudo reboot

sudo apt install hailo-all

hailortcli fw-control identify

fw-control-identify

Next, I cloned the repository and installed the necessary tools:

git clone https://github.com/hailo-ai/hailo-rpi5-examples.git

cd hailo-rpi5-examples
./install.sh

Installing the AI Camera

For the AI Camera, I followed the steps in the official documentation. Here’s what I ran:

sudo apt update && sudo apt full-upgrade

sudo apt install imx500-all
sudo reboot

AI Camera

Now, the fun part — getting that AI camera working! The camera app comes with built-in stages for IMX500 object detection and pose estimation, which means my Pi can spot objects and even analyze human poses. Here’s a quick peek at the settings in the imx500_posenet.json file:

{
    "imx500_posenet":
    {
        "max_detections" : 5,
        "threshold" : 0.4,
        "offset_refinement_steps": 5,
        "nms_radius": 10.0,
        "network_file": "/usr/share/imx500-models/imx500_network_posenet.rpk",

        "save_input_tensor":
        {
            "filename": "/home/pi/posenet_input_tensor.raw",
            "num_tensors": 10
        },

        "temporal_filter":
        {
            "tolerance": 0.3,
            "factor": 0.3,
            "visible_frames": 8,
            "hidden_frames": 2
        }
    },

    "plot_pose_cv":
    {
        "confidence_threshold" : 0.2
    }
}

Some other post-processing JSON files can be found in /usr/share/rpicam-assets/:

raspberry-rpicam-assets

To take it a step further, I ran the Pose Estimation app, which can detect body joints, limbs, and even facial features, using this command:

rpicam-hello -t 0s --post-process-file /usr/share/rpi-camera-assets/hailo_yolov8_pose.json --viewfinder-width 1920 --viewfinder-height 1080 --framerate 30

For object detection, I tried out MobileNet SSD, which performs detection and labels objects in real-time. Check out the action:

rpicam-hello -t 0s --post-process-file /usr/share/rpi-camera-assets/imx500_mobilenet_ssd.json --viewfinder-width 1920 --viewfinder-height 1080 --framerate 30

ai-camera-imx500-mobilenet-ssd

Though I love the AI Camera, it’s a bit of a lightweight compared to the full power of the Hailo AI Kit.


Hailo AI Kit

Now, let’s talk about the Hailo AI Kit. This thing is a beast. Using the YOLOv8s model, it handled object detection like a pro, with a smooth 13 TOPS (for context, that’s a lot of operations per second). Check out the official demo:

python basic_pipelines/detection.py

basic-pipelines-detection

Next, I took it a step further with Retrained Models. With custom models loaded up, it was time to get specific with object detection:

# Raspberry Pi camera input
python basic_pipelines/detection.py --labels-json resources/barcode-labels.json --hef resources/yolov8s-hailo8l-barcode.hef --input rpi

basic-pipelines-detection-retrained-models

Then, I tried out Pose Estimation with the YOLOv8s_pose model, which detected not just people but their poses:

python basic_pipelines/pose_estimation.py

basic-pipelines-pose-estimation

Finally, I explored Instance Segmentation, which allows the system to distinguish and separate individual objects within a scene.

python basic_pipelines/instance_segmentation.py

basic-pipelines-instance-segmentation


Wrap-Up

In conclusion, this little Raspberry Pi 5 is an absolute champ when paired with the Hailo-8L AI Kit. From object detection to pose estimation and even instance segmentation, I’ve only scratched the surface of its capabilities. So, stay tuned—this is just the beginning of my AI adventures!