Skip to content

Commit 4eb1040

Browse files
Merge pull request #34 from KasunThushara/main
ADD: Hailo in raspberry pi environment
2 parents 185948f + 2ba576c commit 4eb1040

File tree

7 files changed

+188
-0
lines changed

7 files changed

+188
-0
lines changed

articles/Chapter_2-Configuring_the_RaspberryPi_Environment/Introduction_to_Hailo_in_Raspberry_Pi_Environment.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,191 @@ sidebar_position: 5
33
---
44

55
# Introduction to Hailo in Raspberry Pi Environment
6+
7+
## What is Hailo?
8+
9+
[Hailo](https://hailo.ai/) offers cutting-edge AI processors uniquely tailored for high-performance deep learning applications on edge devices. The company's solutions focus on enabling the next era of generative AI on the edge, alongside perception and video enhancement, powered by advanced AI accelerators and vision processors.
10+
11+
### Key Features:
12+
- **Hailo-8 NPU Dataflow Architecture**
13+
- Differs from the traditional Von Neumann architecture.
14+
- Implements a distributed memory fabric combined with pipeline elements for low-power memory access.
15+
16+
### Architecture -Hailo AI Software Suite Overview
17+
18+
The **Hailo AI Software Suite** provides powerful tools to run AI models efficiently on hardware accelerators. It is designed to integrate seamlessly with existing deep learning frameworks, offering smooth workflows for developers.
19+
20+
![architecture](../../pictures/Chapter2/architecture.png)
21+
22+
The process involves generating a HEF (Hailo Executable Binary File) from an ONNX file in the Model Build Environment. Once created, the HEF file is transferred to the inference machine (Runtime Environment), where it is used to execute inference with the HailoRT API. The provided script facilitates the conversion of an ONNX file into a HEF file within the Model Build Environment.We will discuss futher more on 5th chapter.
23+
24+
### Hailo Dataflow Compiler (DFC)
25+
The Hailo Dataflow Compiler (DFC) enables users to integrate AI models into their projects with ease. It is compatible with popular frameworks like TensorFlow Lite (TFLite) and ONNX, allowing conversion and compilation of models into the Hailo HEF format, optimized for running on Hailo AI accelerators. The DFC enhances the performance of devices like the Raspberry Pi AI Kit, making them adaptable to specific use cases. To access the DFC, users need to create an account on the Hailo website and download the latest version.
26+
27+
![tflogo](../../pictures/Chapter2/df_compiler.PNG)
28+
29+
### Runtime Software Suite
30+
31+
The **Hailo Runtime (HailoRT)** is a production-grade, lightweight, and scalable runtime software. It provides a robust library with intuitive APIs for optimized performance and supports building fast pipelines for AI applications. HailoRT operates on the Hailo AI Vision Processor or the host processor when using the Hailo AI Accelerator. This ensures high-throughput inferencing with one or more Hailo devices. Standard framework support includes **GStreamer** and **ONNX Runtime**, simplifying integration with existing AI workflows.
32+
33+
### Hailo Model Zoo
34+
The **Hailo Model Zoo** offers a collection of pre-trained deep learning models for various computer vision tasks, enabling rapid prototyping on Hailo devices. These models come with binary HEF files fully supported by the Hailo toolchain. Developers can explore the **Hailo Model Zoo GitHub repository**, which includes common models and architectures, along with resources to replicate Hailo's published performance.
35+
36+
References: Check their [**GitHub repository**](https://github.com/hailo-ai/hailo_model_zoo) for the most updated details.
37+
38+
39+
## Hardware Preparation
40+
41+
### Raspberry Pi AI Kit
42+
43+
<div align="center">
44+
<img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/2/-/2-113060086-raspberry-pi-ai-kit-all.jpg" alt="Raspberry Pi AI Kit" width="300">
45+
<br>
46+
<a href="https://www.seeedstudio.com/Raspberry-Pi-AI-Kit-p-5900.html?utm_source=PiAICourse&utm_medium=github&utm_campaign=Course"><b>Purchase Now</b></a>
47+
</div>
48+
49+
The Raspberry Pi AI Kit is designed to elevate edge IoT devices with Hailo AI capabilities. It includes:
50+
- **13 TOPS Performance** High AI processing power.
51+
- **Effective Heat Dissipation** Ensures stable operation.
52+
- **Modular Design** Compatible with Raspberry Pi 5, CM4-powered IoT gateways, and controllers with M.2 slots.
53+
54+
Additional Resources: Read the following article to learn how to connect your Raspberry Pi 5:
55+
[Raspberry Pi AI Kit Documentation](https://www.raspberrypi.com/documentation/accessories/ai-kit.html)
56+
57+
### AI HAT+ (26 TOPS)
58+
59+
<div align="center">
60+
<img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/a/i/ai_hat.jpg" alt="Raspberry Pi AI Kit" width="300">
61+
<br>
62+
<a href="https://www.seeedstudio.com/Raspberry-Pi-Al-HAT-26-TOPS-p-6243.html"><b>Purchase Now</b></a>
63+
</div>
64+
65+
- **Built-in Hailo AI Accelerator** Offers 26 TOPS of AI performance.
66+
- **PCIe Gen 3 Communication** Harnesses Raspberry Pi 5's PCIe Gen 3 interface for optimal throughput.
67+
- **Post-efficient & Power-efficient** High performance without breaking the bank.
68+
69+
### reComputer AI R2130-12
70+
71+
<div align="center">
72+
<img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/1/_/1_24_1.jpg" alt="Raspberry Pi AI Kit" width="300">
73+
<br>
74+
<a href="https://www.seeedstudio.com/reComputer-AI-R2130-12-p-6368.html"><b>Purchase Now</b></a>
75+
</div>
76+
77+
- **Compact Design**: Optimized thermal architecture suitable for deployment in resource-constrained environments.
78+
- **Performance** 26 Tera-Operations Per Second (TOPS), powered by the Hailo AI Accelerator.
79+
- **Connectivity**
80+
- 2x HDMI 4Kp60.
81+
- 1x Ethernet Port.
82+
- 2x USB 3.0.
83+
- 2x USB 2.0.
84+
- **Expandability**: PCIe 2.0 dual M.2 slot supports both AI accelerators and SSD storage.
85+
86+
## Installing Hailo Software on Raspberry Pi 5
87+
88+
### Step 1: Update the System
89+
90+
```bash
91+
sudo apt update
92+
sudo apt full-upgrade
93+
```
94+
95+
### Step 2: Configure PCIe Settings
96+
97+
```bash
98+
# Enable the PCIe external connector
99+
dtparam=pciex1
100+
101+
# Force Gen 3.0 speeds (optional, comment to use Gen 2)
102+
dtparam=pciex1_gen=3
103+
104+
```
105+
106+
### Step 3: Install Hailo Software
107+
108+
```bash
109+
sudo apt install hailo-all
110+
sudo reboot
111+
112+
```
113+
114+
### Step 4: Verify Installation
115+
116+
117+
- Check software and firmware installation:
118+
119+
```bash
120+
hailortcli fw-control identify
121+
122+
```
123+
![verify](../../pictures/Chapter2/verify.png)
124+
125+
- Verify the Hailo-8L connection
126+
127+
```bash
128+
lspci | grep Hailo
129+
130+
```
131+
![verify2](../../pictures/Chapter2/verify2.png)
132+
133+
134+
## Installing Hailo Software on reComputer R1000
135+
136+
### Step 1: Update System and Configure PCIe to Gen 3
137+
138+
#### Update System
139+
140+
- Open a terminal on the reComputer R1000.
141+
- Run the following commands to update your system.
142+
143+
```bash
144+
sudo apt update
145+
sudo apt full-up
146+
```
147+
148+
#### Configure PCIe to Gen 3
149+
150+
- Open the Raspberry Pi configuration tool:
151+
152+
153+
```bash
154+
sudo raspi-config
155+
```
156+
157+
- Navigate to **6 Advanced Options**
158+
159+
![Advaced Options](../../pictures/Chapter2/advancedoptions.png)
160+
161+
- Next A8 PCIe Speed
162+
163+
![Advaced Options](../../pictures/Chapter2/pcie.png)
164+
165+
- Choose **Yes** to enable PCIe Gen 3 mode.
166+
- Click **Finish** to exit the configuration.
167+
168+
### Step 2: Install Hailo Software
169+
170+
- Install the Hailo software by running
171+
172+
```bash
173+
sudo apt install hailo-all
174+
sudo reboot
175+
```
176+
177+
- Verify the installation:
178+
179+
```bash
180+
hailortcli fw-control identify
181+
```
182+
- Check if the Hailo-8L is connected
183+
184+
```bash
185+
lspci | grep Hailo
186+
```
187+
In this chapter, we have discussed how to set up the Raspberry Pi for your AI project. In the next chapter, we will discuss how to run a pretrained model as well as how to use your custom data model.
188+
189+
190+
191+
192+
193+
1.68 MB
Loading

pictures/Chapter2/architecture.png

82.7 KB
Loading

pictures/Chapter2/df_compiler.PNG

60.6 KB
Loading

pictures/Chapter2/pcie.png

89.9 KB
Loading

pictures/Chapter2/verify.png

75.9 KB
Loading

pictures/Chapter2/verify2.png

18.9 KB
Loading

0 commit comments

Comments
 (0)