Skip to content

Commit 74b2a74

Browse files
committed
Add: Accelerating_the_MediaPipe_models_with_Hailo_NPU and Run_DeepSeek_on_Raspberry_Pi_AI_Box
1 parent 92121c8 commit 74b2a74

2 files changed

Lines changed: 218 additions & 0 deletions

File tree

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
sidebar_position: 4
3+
---
4+
5+
# Accelerating the MediaPipe models with Hailo NPU
6+
7+
## Overview
8+
9+
[MediaPipe](https://github.com/google-ai-edge/mediapipe) is an open-source framework created by Google for constructing machine learning pipelines that handle time-series data, including video and audio. It provides customizable solutions for a wide range of applications, particularly in computer vision and on-device machine learning tasks.
10+
11+
This article outlines the process of deploying a MediaPipe model on an AI Box to enhance hand detection, gesture landmarks, and face landmarks.
12+
13+
## Prepare Hardware
14+
15+
> **Note:**
16+
> Please connect a USB camera to the AI Box.
17+
18+
<div class="table-center">
19+
<table align="center">
20+
<tr>
21+
<th>reComputer AI R2130</th>
22+
</tr>
23+
<tr>
24+
<td><div style={{textAlign:'center'}}><img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/1/_/1_24_1.jpg" style={{width:600, height:'auto'}}/></div></td>
25+
</tr>
26+
<tr>
27+
<td><div class="get_one_now_container" style={{textAlign: 'center'}}>
28+
<a class="get_one_now_item" href="https://www.seeedstudio.com/reComputer-AI-R2130-12-p-6368.html">
29+
<strong><span><font color={'FFFFFF'} size={"4"}> Get One Now 🖱️</font></span></strong>
30+
</a>
31+
</div></td>
32+
</tr>
33+
</table>
34+
</div>
35+
36+
37+
## Install Hailo Software & Verify Installation
38+
39+
### update the system:
40+
41+
```
42+
sudo apt update
43+
sudo apt full-upgrade
44+
```
45+
46+
:::note
47+
Sometimes you may encounter the following issues during updates.
48+
```
49+
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
50+
Get:2 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
51+
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
52+
Get:4 http://archive.raspberrypi.com/debian bookworm InRelease [39.0 kB]
53+
Reading package lists... Done
54+
E: Release file for http://deb.debian.org/debian/dists/bookworm/InRelease is not valid yet (invalid for another 58d 8h 26min 35s). Updates for this repository will not be applied.
55+
E: Release file for http://deb.debian.org/debian-security/dists/bookworm-security/InRelease is not valid yet (invalid for another 84d 18h 23min 59s). Updates for this repository will not be applied.
56+
E: Release file for http://archive.raspberrypi.com/debian/dists/bookworm/InRelease is not valid yet (invalid for another 84d 13h 13min 5s). Updates for this repository will not be applied.
57+
E: Release file for http://deb.debian.org/debian/dists/bookworm-updates/InRelease is not valid yet (invalid for another 85d 0h 52min 29s). Updates for this repository will not be applied.
58+
```
59+
This is because the time on the Raspberry Pi is set incorrectly, and you need to manually set the time on the Raspberry Pi with command below:
60+
```
61+
# This command only you can connect google.com
62+
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
63+
```
64+
After set your raspberry time, you can update your raspberry.
65+
:::
66+
67+
### Set pcie to gen2/gen3(gen3 is faster than gen2):
68+
69+
Add following text to ```/boot/firmware/config.txt```
70+
71+
```
72+
#Enable the PCIe external connector
73+
74+
dtparam=pciex1
75+
76+
#Force Gen 3.0 speeds
77+
78+
dtparam=pciex1_gen=3
79+
80+
```
81+
:::note
82+
If you want to use gen2, please comment dtparam=pciex1_gen=3
83+
:::
84+
85+
### Install hailo-all and reboot:
86+
87+
Open terminal on the AI Box, and input command as follows to install Hailo software.
88+
89+
```
90+
sudo apt install hailo-all
91+
sudo apt-get -y install libblas-dev nlohmann-json3-dev
92+
sudo reboot
93+
```
94+
### Check Software and Hardware:
95+
96+
Open terminal on the AI Box, and input command as follows to check if hailo-all have been installed.
97+
98+
```
99+
hailortcli fw-control identify
100+
```
101+
102+
The right result show as bellow:
103+
<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/YOLOV8/check_software.png" alt="pir" width={1000} height="auto"/></p>
104+
105+
Open terminal on the AI Box, and input command as follows to check if hailo-8L have been connected.
106+
107+
```
108+
lspci | grep Hailo
109+
```
110+
111+
The right result show as bellow:
112+
<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/reComputer-R1000/YOLOV8/check_hardware.png" alt="pir" width={1000} height="auto"/></p>
113+
114+
## Run Project
115+
116+
### Install Project
117+
118+
```
119+
git clone https://github.com/AlbertaBeef/blaze_app_python
120+
```
121+
122+
### Install the hailo model
123+
124+
Input the command below you will see a clip demo:
125+
```
126+
cd blaze_app_python
127+
128+
sudo chmod 755 ./blaze_hailo/models/get_hailo8_models.sh
129+
130+
./blaze_hailo/models/get_hailo8_models.sh
131+
132+
unzip ./blaze_hailo/models/blaze_hailo8_models.zip
133+
134+
mv ./blaze_hailo/models/hailo8/* ./blaze_hailo/models/
135+
```
136+
137+
### Install necessary lib
138+
139+
```
140+
python -m venv .env && source .env/bin/activate
141+
pip install numpy opencv-python plotly
142+
```
143+
144+
### Run the project
145+
146+
```
147+
cd ./blaze_hailo
148+
python blaze_detect_live.py --blaze hand -f
149+
```
150+
151+
## Result
152+
153+
Coming soon...
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
sidebar_position: 7
3+
---
4+
5+
# Deploy DeepSeek on Raspberry Pi AI Box
6+
7+
## Introduction
8+
9+
This article explains how to deploy the [DeepSeek](https://github.com/deepseek-ai/DeepSeek-LLM) model on a Raspberry Pi AI Box using the [Ollama](https://ollama.com/) deployment framework. Ollama simplifies the process of installing and running AI models on compact hardware like the Raspberry Pi, handling dependency management and system configuration. In this guide, you will find clear, step-by-step instructions on setting up your environment, installing the necessary software, and launching the DeepSeek model. This resource is aimed at developers and AI enthusiasts who want to harness the power of AI on low-power devices.
10+
11+
## Prepare Hardware
12+
13+
<div class="table-center">
14+
<table align="center">
15+
<tr>
16+
<th>reComputer AI R2130</th>
17+
</tr>
18+
<tr>
19+
<td><div style={{textAlign:'center'}}><img src="https://media-cdn.seeedstudio.com/media/catalog/product/cache/bb49d3ec4ee05b6f018e93f896b8a25d/1/_/1_24_1.jpg" style={{width:600, height:'auto'}}/></div></td>
20+
</tr>
21+
<tr>
22+
<td><div class="get_one_now_container" style={{textAlign: 'center'}}>
23+
<a class="get_one_now_item" href="https://www.seeedstudio.com/reComputer-AI-R2130-12-p-6368.html">
24+
<strong><span><font color={'FFFFFF'} size={"4"}> Get One Now 🖱️</font></span></strong>
25+
</a>
26+
</div></td>
27+
</tr>
28+
</table>
29+
</div>
30+
31+
## Prepare software
32+
33+
### update the system:
34+
35+
```
36+
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
37+
sudo apt update
38+
sudo apt full-upgrade
39+
```
40+
41+
### Install Ollama
42+
43+
Open one terminal with `Ctrl+Alt+T` and input command like below to install ollama:
44+
45+
<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/AI_box_deepseek/install_ollama.png" alt="pir" width={1000} height="auto"/></p>
46+
47+
```
48+
curl -fsSL https://ollama.com/install.sh | sh
49+
```
50+
51+
### Install and run deepseek model
52+
53+
Then input command like below to install and run deepseek 7b model:
54+
55+
<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/AI_box_deepseek/install_deepseek.png" alt="pir" width={1000} height="auto"/></p>
56+
57+
```
58+
ollama run deepseek-r1
59+
```
60+
61+
## Result
62+
63+
In this demonstration, I used the DeepSeek 1.5b model. You can choose which model to use based on your needs and the capacity of your hardware.
64+
65+
[![Alt text](https://img.youtube.com/vi/qo2iv5RLgbA/0.jpg)](https://www.youtube.com/watch?v=qo2iv5RLgbA)

0 commit comments

Comments
 (0)