树莓派开发者 发表于 2024-9-2 18:01

何在 Raspberry Pi 5 上设置 Raspberry Pi AI Kit

<p>&nbsp;本指南将帮助您在 Raspberry Pi 5 上安装 Raspberry Pi AI Kit。这将使您能够使用 Hailo AI 神经网络加速器运行 rpicam-apps 摄像头演示。</p>

<div></div>

<p>如果您在开始安装人工智能套件之前需要帮助,本指南提供了安装过程的分步图片。</p>

<p><a class="link-info has-card" contenteditable="true" data-link-icon="https://csdnimg.cn/release/blog_editor_html/release2.3.6/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=N7T8" data-link-title="安装人工智能套件:" data-widget="csdnlink" href="https://www.raspberrypi.com/documentation/accessories/ai-kit.html#install" target="_blank" title="安装人工智能套件:">安装人工智能套件:</a></p>

<div></div>

<p><span style="font-size:20px;"><strong>前提条件</strong></span></p>

<p>本指南需要以下设备:</p>

<ul>
        <li>
        <p>一台 Raspberry Pi 5</p>
        </li>
        <li>
        <p>一个 Raspberry Pi AI 套件,其中包括</p>
        </li>
</ul>

<p>&nbsp; &nbsp; &nbsp; &nbsp; 一个 M.2 HAT+</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; 一个预装的 Hailo-8L AI 模块</p>

<ul>
        <li>
        <p>一个 64 位 Raspberry Pi OS&nbsp;Bookworm&nbsp;安装包</p>
        </li>
        <li>
        <p>任何 Raspberry Pi 官方摄像头(如摄像头模块 3 或高质量摄像头)</p>
        </li>
</ul>

<div></div>

<div></div>

<p><span style="font-size:20px;"><strong>硬件设置</strong></span></p>

<p>1. 按照安装 Raspberry Pi 摄像头的说明,将摄像头安装到 Raspberry Pi 5 板上。您可以跳过将 Raspberry Pi 重新连接到电源的步骤,因为您需要断开 Raspberry Pi 的电源才能进行下一步。</p>

<p><a class="link-info has-card" contenteditable="true" data-link-icon="https://csdnimg.cn/release/blog_editor_html/release2.3.6/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=N7T8" data-link-title="安装 Raspberry Pi 摄像头:" data-widget="csdnlink" href="https://www.raspberrypi.com/documentation/accessories/camera.html#install-a-raspberry-pi-camera" title="安装 Raspberry Pi 摄像头:">安装 Raspberry Pi 摄像头:</a></p>

<p>2. 按照安装说明将 AI 套件硬件连接到 Raspberry Pi 5。</p>

<p><a class="link-info has-card" contenteditable="true" data-link-icon="https://csdnimg.cn/release/blog_editor_html/release2.3.6/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=N7T8" data-link-title="安装说明:" data-widget="csdnlink" href="https://www.raspberrypi.com/documentation/accessories/ai-kit.html#ai-kit-installation" title="安装说明:">安装说明:</a></p>

<p>3. 按照说明启用 PCIe Gen 3.0。这一步是可选的,但强烈建议您这样做,以使您的 AI Kit 获得最佳性能。</p>

<p>&nbsp;<a class="link-info has-card" contenteditable="true" data-link-icon="https://csdnimg.cn/release/blog_editor_html/release2.3.6/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=N7T8" data-link-title="PCIe Gen 3.0 启用说明:" data-widget="csdnlink" href="https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#pcie-gen-3-0" title="PCIe Gen 3.0 启用说明:">PCIe Gen 3.0&nbsp;启用说明:</a></p>

<p>4. 安装使用 AI 套件所需的依赖项。在终端窗口运行以下命令</p>

<pre data-widget="codeSnippet">
<code class="hljs"><code>$&nbsp;sudo&nbsp;apt&nbsp;install&nbsp;hailo-all</code>nbsp;sudo&nbsp;apt&nbsp;install&nbsp;hailo-all</code></pre>

<p>这将安装以下依赖项:</p>

<ul>
        <li>
        <p>Hailo 内核设备驱动程序和固件</p>
        </li>
        <li>
        <p>HailoRT 中间件软件</p>
        </li>
        <li>
        <p>Hailo Tappas 核心后处理库</p>
        </li>
        <li>
        <p>rpicam-apps Hailo 后处理软件演示阶段</p>
        </li>
</ul>

<p>5. 最后,使用 sudo reboot 重启树莓派,使这些设置生效。</p>

<p>6. 为确保一切运行正常,请运行以下命令:</p>

<pre data-widget="codeSnippet">
<code class="hljs"><code>$&nbsp;hailortcli&nbsp;fw-control&nbsp;identify</code>nbsp;hailortcli&nbsp;fw-control&nbsp;identify</code></pre>

<p>如果您看到类似下面的输出,说明您已经成功安装了 AI 工具包及其软件依赖项:</p>

<pre data-widget="codeSnippet">
<code class="hljs">Executing on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.17.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB234500054
Part Number: HM21LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP</code></pre>

<p>此外,还可以运行 dmesg | grep -i hailo 检查内核日志,其输出结果应与下面类似:</p>

<pre data-widget="codeSnippet">
<code class="hljs">[&nbsp;&nbsp;&nbsp;&nbsp;3.049657]&nbsp;hailo:&nbsp;Init&nbsp;module.&nbsp;driver&nbsp;version&nbsp;4.17.0
[&nbsp;&nbsp;&nbsp;&nbsp;3.051983]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing&nbsp;on:&nbsp;1e60:2864...
[&nbsp;&nbsp;&nbsp;&nbsp;3.051989]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;Allocate&nbsp;memory&nbsp;for&nbsp;device&nbsp;extension,&nbsp;11600
[&nbsp;&nbsp;&nbsp;&nbsp;3.052006]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;enabling&nbsp;device&nbsp;(0000&nbsp;-&gt;&nbsp;0002)
[&nbsp;&nbsp;&nbsp;&nbsp;3.052011]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;Device&nbsp;enabled
[&nbsp;&nbsp;&nbsp;&nbsp;3.052028]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;mapped&nbsp;bar&nbsp;0&nbsp;-&nbsp;000000000d8baaf1&nbsp;16384
[&nbsp;&nbsp;&nbsp;&nbsp;3.052034]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;mapped&nbsp;bar&nbsp;2&nbsp;-&nbsp;000000009eeaa33c&nbsp;4096
[&nbsp;&nbsp;&nbsp;&nbsp;3.052039]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;mapped&nbsp;bar&nbsp;4&nbsp;-&nbsp;00000000b9b3d17d&nbsp;16384
[&nbsp;&nbsp;&nbsp;&nbsp;3.052044]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;Force&nbsp;setting&nbsp;max_desc_page_size&nbsp;to&nbsp;4096&nbsp;(recommended&nbsp;value&nbsp;is&nbsp;16384)
[&nbsp;&nbsp;&nbsp;&nbsp;3.052052]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;Enabled&nbsp;64&nbsp;bit&nbsp;dma
[&nbsp;&nbsp;&nbsp;&nbsp;3.052055]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;Using&nbsp;userspace&nbsp;allocated&nbsp;vdma&nbsp;buffers
[&nbsp;&nbsp;&nbsp;&nbsp;3.052059]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Disabling&nbsp;ASPM&nbsp;L0s
[&nbsp;&nbsp;&nbsp;&nbsp;3.052070]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Successfully&nbsp;disabled&nbsp;ASPM&nbsp;L0s
[&nbsp;&nbsp;&nbsp;&nbsp;3.221043]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Firmware&nbsp;was&nbsp;loaded&nbsp;successfully
[&nbsp;&nbsp;&nbsp;&nbsp;3.231845]&nbsp;hailo&nbsp;0000:01:00.0:&nbsp;Probing:&nbsp;Added&nbsp;board&nbsp;1e60-2864,&nbsp;/dev/hailo0</code></pre>

<p>7. 为确保摄像机正常运行,请运行以下命令:</p>

<pre data-widget="codeSnippet">
<code class="hljs"><code>$&nbsp;rpicam-hello&nbsp;-t&nbsp;10s</code>nbsp;rpicam-hello&nbsp;-t&nbsp;10s</code></pre>

<p>这将启动摄像机并显示十秒钟的预览窗口。确认一切安装正确后,就可以运行一些演示了。</p>

<p><a class="link-info has-card" contenteditable="true" data-link-icon="https://csdnimg.cn/release/blog_editor_html/release2.3.6/ckeditor/plugins/CsdnLink/icons/icon-default.png?t=N7T8" data-link-title="演示 Demo:" data-widget="csdnlink" href="https://www.raspberrypi.com/documentation/accessories/ai-kit.html#demos" title="演示 Demo:">演示 Demo:</a></p>

damiaa 发表于 2024-9-2 22:35

<p>把这一套搞下来要1k多呢。<img height="48" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/facebook/wanwan88.gif" width="59" /></p>

树莓派开发者 发表于 2024-9-3 09:31

damiaa 发表于 2024-9-2 22:35
把这一套搞下来要1k多呢。

<p>新的确实要</p>
页: [1]
查看完整版本: 何在 Raspberry Pi 5 上设置 Raspberry Pi AI Kit