Raspberry Pi AI Kit: Custom Object Detection with Hailo8L

Raspberry Pi AI Kit: Custom Object Detection with Hailo8L

Introduction

Artificial Intelligence (AI) is becoming more accessible and affordable for learners and developers with hardware like the Raspberry Pi AI Kit. This kit brings the power of AI, including machine learning and computer vision, to the hands of enthusiasts at a budget-friendly price point. With the Raspberry Pi AI Kit, you can build various AI projects without needing expensive infrastructure. However, it is a multi-step process that involves data collection, model training, and deployment.

 

In this tutorial, we will guide you through setting up a Raspberry Pi AI Kit with a custom YOLOv8s model designed to detect Cytron products, specifically the newly launched Motion 2350 Pro and Maker Pi Pico.

This tutorial will take you through several key processes, including:

  1. Data Preparation
  2. Training the YOLOV8 Model
  3. Model conversion (Pytorch to ONNX to HEF) 
  4. Model Deployment on Raspberry Pi 5 AI Kit.

Dataset Preparation

Data Collection and Labelling Using Roboflow

The first step in creating a custom YOLOv8 model is gathering a dataset that contains images or videos of the object/s you wish to detect. For this tutorial, we’ll use Roboflow for data collection and labeling. Roboflow simplifies the process of dataset management and also provides tools for automatic data augmentation.

Step-by-Step Guide:
​​​​

  1. Collect Images: Capture images or videos of the subject you want to detect from various angles, lighting conditions, and backgrounds to create a robust dataset.
  2. Sign Up on Roboflow: Create a free account on Roboflow.
  3. Create a New Project: Within Roboflow, start a new project for object detection.


     
  4. Name your project and annotation, choose project type (object detection) then click create public project.

  5. Go to classes tab and create your list of class names then add classes.

  6. Upload Images or videos: For this tutorial we will use a video then extracted the images from the video as our dataset.




     
  7. Label Images: Use Roboflow’s labeling interface to draw bounding boxes around the objects. Ensure accuracy by adhering to best labeling practices:


     
  8. Best Practices: Keep the bounding box tight but not too close; avoid occlusion (when possible); balance the dataset with diverse angles and sizes; and ensure no overfitting by not repeating the same image too many times.


     
  9. Add images to dataset: Ensure all the images has been annotated in the progress tab.

  10. Split images accordingly


     
  11. Add pre-processing: Here we going to resize the images to 640x640 and add other optional augmentation accordingly.



     
  12. Create the dataset:


     
  13. Export Dataset: Once labelled, export the dataset in YOLOV8 format. Show download code and copy the code (for training in google collab). Also download the dataset to your computer to be used during the conversion process.



Continue to the next section for dataset training using google collab.