惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
Simon Willison's Weblog
Simon Willison's Weblog
H
Help Net Security
F
Fortinet All Blogs
H
Heimdal Security Blog
S
Schneier on Security
L
LangChain Blog
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
NISL@THU
NISL@THU
P
Palo Alto Networks Blog
J
Java Code Geeks
博客园 - 【当耐特】
The Last Watchdog
The Last Watchdog
W
WeLiveSecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost
I
InfoQ
Recorded Future
Recorded Future
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CERT Recently Published Vulnerability Notes
T
Tenable Blog
腾讯CDC
C
Check Point Blog
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
罗磊的独立博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog
小众软件
小众软件
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
V2EX - 技术
V2EX - 技术
T
Threatpost
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
T
Tailwind CSS Blog
S
Securelist
The Cloudflare Blog
博客园 - 叶小钗
L
LINUX DO - 最新话题
T
Troy Hunt's Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
爱范儿
爱范儿

博客园 - 张高兴

张高兴的 Hailo-10 开发指南:(二)使用 LangChain 搭建本地大模型 RAG 问答应用 张高兴的 Hailo-10 开发指南:(一)实现离线语音识别 张高兴的大模型开发实战:(八)在 Dify 中使用 MCP 协议 张高兴的大模型开发实战:(七)基于 Dify + Ollama 搭建私有化知识问答助手 🚀 Python f-string 全攻略:从入门到大师,让你的编码效率翻倍! 张高兴的大模型开发实战:(六)在 LangGraph 中使用 MCP 协议 为什么要对程序进行调试 张高兴的大模型开发实战:(五)使用 LLaMA Factory 微调与量化模型并部署至 Ollama 张高兴的大模型开发实战:(四)使用 LangGraph 实现多智能体应用 张高兴的大模型开发实战:(三)使用 LangGraph 为对话添加历史记录 张高兴的大模型开发实战:(二)使用 LangChain 构建本地知识库应用 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫 张高兴的 Raspberry Pi AI 开发指南:(三)将自定义模型编译为 Hailo NPU 的 .hef 模型 张高兴的 Raspberry Pi AI 开发指南:(二)使用 Python 和 HailoRT 进行实时目标检测 张高兴的 MicroPython 入门指南:(三)使用串口通信 张高兴的 MicroPython 入门指南:(二)GPIO 的使用 张高兴的 MicroPython 入门指南:(一)环境配置、Blink、部署 如何安全地访问互联网 RowHammer 攻击:内存的隐形威胁 在 .NET 中使用 OPC UA 协议 张高兴的 .NET IoT 入门指南:(八)基于 GPS 的 NTP 时间同步服务器
张高兴的 Raspberry Pi AI 开发指南:(一)Hailo-8 配置
张高兴 · 2024-12-01 · via 博客园 - 张高兴

2024 年 6 月,Raspberry Pi AI Kit 发布,将 M.2 HAT+ 与 Hailo-8 AI 加速模块捆绑在一起,使 Raspberry Pi 具有了运行 AI 程序的能力。Hailo-8 是由以色列公司 Hailo 开发的一款高性能边缘 AI 处理器(NPU),它专为低功耗、高效率的深度学习推理任务设计,可以提供高达 26 TOPS 的计算能力,适用于各种边缘计算场景。本文主要介绍 AI Kit(AI HAT+)在 Raspberry Pi 5 上的配置和使用。

摄像头配置

Raspberry Pi 5 的主板上有两个 CSI 接口用于接入摄像头,其位置在有线网口后。接入摄像头时将排线的金属面朝向有线网口位置,插入接口。

如果是官方的摄像头模块,不需要做任何配置,即插即用。如果是第三方摄像头模块,需要修改 /boot/firmware/config.txt 配置文件。找到 camera-auto-detect=1 语句,修改为 camera_auto_detect=0 在文件结尾,根据摄像头型号加入以下设置语句:

型号 设置语句
OV9281 dtoverlay=ov9281
IMX290/IMX327 dtoverlay=imx290,clock-frequency=37125000
IMX378 dtoverlay=imx378
IMX219 dtoverlay=imx219
IMX477 dtoverlay=imx477
IMX708 dtoverlay=imx708

如果需要同时接入两路摄像头,可以在对应的摄像头配置语句后面加入 cam0cam1 指定摄像头,例如 dtoverlay=imx219,cam0

配置完成后重启,运行命令,预览摄像头并将摄像头画面显示在屏幕上。

rpicam-hello -t 0

AI Kit 配置

Raspberry Pi 5 主板上有一个 PCIe 接口,其位置在 SD 卡槽上方。接入模块时将排线的金属面朝向有线网口位置,插入接口。

安装完成后需要更新系统软件以及固件。

sudo apt update && sudo apt full-upgrade
sudo rpi-eeprom-update

使用 raspi-config 工具启用 PCIe Gen 3.0 确保 NPU 获得最佳性能。

sudo raspi-config  # 选择 Advanced Options -> 选择 PCIe Speed -> 选择 Yes

安装 NPU 所需的软件包。

sudo apt install hailo-all

重启后可运行命令,检查 NPU 是否正常运行。

hailortcli fw-control identify

看到类似于以下内容的输出,则表示已成功。

Executing on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.18.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB243301512
Part Number: HM21LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP

测试

通过克隆官方的仓库 rpicam-apps 来运行示例程序。rpicam 程序实现了一个后处理框架(post-processing framework),可以使用 JSON 处理从摄像头中获取的图像。

git clone --depth 1 https://github.com/raspberrypi/rpicam-apps.git ~/rpicam-apps

仓库提供了对象检测、图像分割、姿态识别等主流模型的应用案例,例如使用如下命令运行 YOLOv8 的对象检测模型。

rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov8_inference.json --lores-width 640 --lores-height 640

参考

  1. AI software - Raspberry Pi Documentation:https://www.raspberrypi.com/documentation/computers/ai.html
  2. AI Kit - Raspberry Pi Documentation:https://www.raspberrypi.com/documentation/accessories/ai-kit.html
  3. 树莓派摄像头使用方法 Camera教程:https://www.raspi.cc/index.php?c=read&id=53&page=1