Raspberry Pi AI HAT+ 2
|
| ||||||||||||||||||
| ||||||||||||||||||
说明
产品介绍
搭载 Hailo-10H AI 加速器和 8GB 板载 RAM,为树莓派 5 带来生成式 AI 功能
特点
- Hailo-10H AI 加速器,提供 40 TOPS (INT4) 推理性能
- 计算机视觉模型性能与 Raspberry Pi AI HAT+ (26 TOPS) 相当
- 利用 8GB 板载 RAM 高效运行生成式 AI 模型
- 深度集成到树莓派的相机系列软件生态系统中
- 符合树莓派 HAT+ 标准
- 随产品附送散热片,以及 16mm 叠加式排针、垫柱和螺丝,可在已安装 树莓派官方散热器 的情况下装配于树莓派 5 上
- 工作温度: 0°C ~ 50°C (环境温度)
- 安装硬件套件
- 堆叠 GPIO 接头
硬件连接
树莓派使用说明
更新系统
仅支持树莓派操作系统 Trixie
sudo apt update sudo apt full-upgrade -y sudo rpi-eeprom-update -a sudo reboot
识别设备
1:启用PCIE接口
连接硬件即可,最新系统系统会存在硬件检测,连接硬件会自动打开PCIE 如果没有打开则执行:在/boot/firmware/config.txt 中添加 dtparam=pciex1
2:启用PCIE Gen3, 则在/boot/firmware/config.txt 中添加:(必须启动Gne3模式)
dtparam=pciex1_gen=3
3:修改之后重启PI5,就可以识别到设备了, (可以先不重启等安装好库一起再重启)
4:安装所需的依赖项
sudo apt install dkms sudo apt install hailo-h10-all
测试
测试运行 LLM
参考点这里
下载软件包
下载文件复制到树莓派里面,Hailo Model Zoo GenAI Debian 软件包5.1.1 版本
sudo dpkg -i hailo_gen_ai_model_zoo_5.1.1_arm64.deb
启动 Hailo Ollama 服务器并运行 LLM
1:启动本地hailo-ollama服务器:
hailo-ollama
2:新打开的终端窗口,获取 LLM 列表:
curl --silent http://localhost:8000/hailo/v1/list如图:返回了5个模型: deepseek_r1_distill_qwen:1.5b llama3.2:3b qwen2.5-coder:1.5b qwen2.5-instruct:1.5b qwen2:1.5b
3:下载模型
curl --silent http://localhost:8000/api/pull \
-H 'Content-Type: application/json' \
-d '{ "model": "examplemodel:tag", "stream" : true }'
#其中examplemodel:tag 改为LLM 列表中的模型,例如使用llama3.2:3b模型
curl --silent http://localhost:8000/api/pull \l \
-H 'Content-Type: application/json' \
-d '{ "model": "llama3.2:3b", "stream": true }'
#执行后会下载模型,等待下载完成
4:执行
通过 POST 请求向 LLM 发送查询
curl --silent http://localhost:8000/api/chat \
-H 'Content-Type: application/json' \
-d '{"model": "examplemodel:tag", "messages": [{"role": "user", "content": "Translate to French: The cat is on the table."}]}'
#其中examplemodel:tag 改为LLM 列表中的模型,例如使用llama3.2:3b模型
curl --silent http://localhost:8000/api/chat \
-H 'Content-Type: application/json' \
-d '{"model": "llama3.2:3b", "messages": [{"role": "user", "content": "Who are you."}]}'
#等待回复即可(耐心等待,比较慢)
安装Docker(可选)
用于:Open WebUI,可以选择跳过
1:移除所有已存在的 Docker 软件包:
sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-doc podman-docker containerd runc | cut -f1)
2:安装 Docker apt 软件仓库:
# 添加Docker 的 GPG key: sudo apt update sudo apt install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # 将该存储库添加到 APT 源中: sudo tee /etc/apt/sources.list.d/docker.sources <<EOF Types: deb URIs: https://download.docker.com/linux/debian Suites: $(. /etc/os-release && echo "$VERSION_CODENAME") Components: stable Signed-By: /etc/apt/keyrings/docker.asc EOF sudo apt update
3:检查docker.sources文件是否已正确创建:
cat /etc/apt/sources.list.d/docker.sources
输出结果应列出以下内容
4:安装并运行 Docker 服务:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo systemctl start docker
5:创建docker群组:
sudo groupadd docker
6:用户添加到该docker组
sudo usermod -aG docker $USER
7:退出登录并重新登录
newgrp docker
8:测试 Docker
docker run hello-world
9:故障检查:
1)如果执行出现"Unable to find image 'hello-world:latest' locally"
#请检查服务启动是否出问题 sudo systemctl status docker --no-pager -l #如果出现下载失败等提示"failed to do request " 或者"context canceled"等,尝试打开VPN 或者同等网络环境下看看是否可以服务连接 #调整好网络环境,重启服务 sudo systemctl restart docker
2)如果"sudo systemctl status docker --no-pager -l" 提示正常,但执行"docker run hello-world" 提示"Unable to find image 'hello-world:latest' locally"
#属于没有下载到对应的文件 #尝试重新拉去官方镜像 docker pull hello-world #如果出现网络超时,请配置 Docker 的 systemd 代理 #配置好代理再重新拉官方镜像
使用Open WebUI(可选)
在上一步安装 Docker 之后,您可以使用 Docker 部署和运行 Open WebUI 容器。
1:安装Open WebUI
docker pull ghcr.io/open-webui/open-webui:main
2:确保该服务hailo-ollama已在运行。然后,启动 Open WebUI 容器并将其连接到hailo-ollama后端服务器:
docker run -d -e OLLAMA_BASE_URL=http://127.0.0.1:8000 -v open-webui:/app/backend/data --name open-webui --network=host --restart always ghcr.io/open-webui/open-webui:main
3:监控容器启动。容器初始化可能需要长达一分钟的时间。要查看进度和日志,请运行以下命令,然后等待日志显示服务器正在运行并准备好接受连接。
docker logs open-webui -f
4:在网页浏览器中访问 Open WebUI,并输入以下网址:http://127.0.0.1:8080 .这将打开一个聊天界面,您可以在其中选择模型并开始与 LLM 进行交互.
更多内容参考这里
实时视觉人工智能演示
rpicam-apps使用 Hailo AI 神经网络加速器运行相机演示
1:检查摄像头
rpicam-hello --list-cameras 请确保摄像头正常工作
2:克隆存储库rpicam-apps
sudo apt update && sudo apt install rpicam-apps
3:测试
- 物体检测
# 原始模型 rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_classifier.json --lores-width 640 --lores-height 640 # Yolov5 模型 rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov5_segmentation.json --lores-width 640 --lores-height 640 # Yolov8 模型 rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov8_inference.json --lores-width 640 --lores-height 640
- 姿态检测
# Yolov8 姿态估计模型 rpicam-hello -t 0 --post-process-file /usr/share/rpi-camera-assets/hailo_yolov8_pose.json --lores-width 640 --lores-height 640
技术支持
联系人:彭工
EMAIL:2851966006@qq.com
电话:0755-83040712
QQ:2851966006
微信:扫下方二维码添加
![]()



