# Petoi AI Vision摄像头模块

## 功能简介

Petoi AI 视觉模块是基于 Arm Cortex-M55 和 Ethos-U5开发的嵌入式视觉模块。它支持 TensorFlow 和 PyTorch 框架，并与 Arduino IDE 兼容。借助 SenseCraft AI 算法平台，无需编码即可将训练好的 ML 模型部署到传感器。它具有标准 CSI 接口、板载数字麦克风和 SD 卡插槽，非常适合各种嵌入式 AI 视觉项目。  &#x20;

* 强大的 AI 处理能力：采用 WiseEye2 HX6538 处理器，配备双核 Arm Cortex-M55 和集成 Arm Ethos-U55 神经网络单元。
* 多功能 AI 模型支持：轻松部署 SenseCraft AI 的现成或自定义 AI 模型，包括 Mobilenet V1、V2、Efficientnet-lite、Yolo v5 和 v8。支持 TensorFlow 和 PyTorch 框架。
* 丰富的外设：包括PDM麦克风、SD卡槽、Type-C、Grove接口等外设。
* &#x20;高兼容性：兼容XIAO系列、Arduino、Raspberry Pi、ESP32开发板，方便进一步开发。
* 完全开源：所有代码、设计文件和原理图均可修改和使用。

<figure><img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2FKnnKnZuIWwbXWcXClYTH%2Fimage.png?alt=media&#x26;token=c66f68b4-8779-4b8b-ac3d-c6347dd3dbf8" alt=""><figcaption></figcaption></figure>

## 硬件设置

### BiBoard V0

<figure><img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2FuZR3lbyXIudu4a8Ye5mn%2FAI_Vision_BiBoard_V0.png?alt=media&#x26;token=540ff6bb-6936-4a1b-8732-1fbf1a264726" alt=""><figcaption><p>Bittle X</p></figcaption></figure>

### BiBoard V1

<figure><img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2F77cw6weWiRWtnsO3etkf%2Fimage.png?alt=media&#x26;token=15aa590e-e678-430c-90a7-26bb5becc199" alt="Bittle X: BiBoard V1 with AI vision module"><figcaption><p>Bittle X</p></figcaption></figure>

<figure><img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2FGVjq7sVRQfMlOBU3IFxx%2Fimage.png?alt=media&#x26;token=ee2f5693-654b-49a7-84d8-7f00564544ea" alt="Bittle X+Arm: BiBoard V1 with AI vision module"><figcaption><p>Bittle X+Arm</p></figcaption></figure>

具体使用时可以将连接摄像头的一端固定在机器人的头部（比如含在Bittle X的嘴中, 或者卡在Bittle X+Arm的机械臂上）。

## 软件设置

### Petoi 桌面应用程序

您可以在 Petoi 桌面应用程序中使用**固件上载**。

请选择正确的产品类型、**主板型号**及串口名称，模式设置为"标准"，点击“**升级固件**”按钮。例如，BittleX、BiBoard\_V0\_2、COM3 如下所示：

<figure><img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2Fms0ZS4Pj7kRrNI4cLNVa%2Fimage.png?alt=media&#x26;token=f20e1d49-aec6-4e01-80c8-a9ca08d00f3d" alt=""><figcaption></figcaption></figure>

固件上传完成后，打开[串口监视器](https://docs.petoi.com/chinese/arduino-ide/chuan-kou-jian-shi-qi#biboard)发送串口命令“**XC**”切换到摄像头模式。

### Arduino IDE

具体步骤请参考[**为BiBoard上传程序**](https://docs.petoi.com/chinese/arduino-ide/wei-biboard-shang-chuan-cheng-xu)。

程序上传完成后，打开[串口监视器](https://docs.petoi.com/chinese/arduino-ide/chuan-kou-jian-shi-qi#biboard)发送串口命令“**XC**”切换到摄像头模式。

{% hint style="info" %}
如果提示摄像头模块启动失败，如下图所示:

<img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2FfNF2i0r8GsJjkIuBfTEE%2Fimage.png?alt=media&#x26;token=217f9666-5e18-4513-8db9-d4cf6dff1b41" alt="" data-size="original">

您可以使用[web调试页面](https://sensecraft.seeed.cc/ai/#/device/local)升级模块固件并上传人脸检测模型。

![](https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2F8uSh2chxtOrJoFeRjiK7%2Fimage.png?alt=media\&token=a1a5ec0f-62e9-4c88-acf3-5858271e437f)
{% endhint %}

### 验证模块功能（可选）

{% hint style="warning" %}
要运行库**Seeed\_Arduino\_SSCMA**中的示例程序，您应该下载[最新版本的库代码](https://github.com/Seeed-Studio/Seeed_Arduino_SSCMA/releases)，通过选择**项目**>**加载库**>**添加 .zip 库**，选择下载的.zip库文件添加到Arduino IDE中。或者，您可以在Arduino IDE的库管理器中搜索安装库文件，如下图所示：

![](https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2Ff5lZymmaGEvQu3FHmpdy%2Fimage.png?alt=media\&token=acc490a8-cf8d-498b-83d0-79381287163e)

![](https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2FmnQ0YG2Ym6UShiElqqXk%2Fimage.png?alt=media\&token=2785f04e-df78-4b41-82ca-cbe9bb599829)
{% endhint %}

下面是一个Seeed\_Arduino\_SSCMA库中的示例程序（inference.ino），您可以将其[上传](https://docs.petoi.com/v/chinese/arduino-ide/wei-biboard-shang-chuan-cheng-xu)到机器人主板BiBoard中，测试Grove Vision AI V2 的功能是否正常。您也可以参考该函数将模型输出结果用于其他功能：

```
#include <Seeed_Arduino_SSCMA.h>

SSCMA AI;

void setup()
{
    AI.begin();
    Serial.begin(9600);
}

void loop()
{
    if (!AI.invoke())
    {
        Serial.println("invoke success");
        Serial.print("perf: prepocess=");
        Serial.print(AI.perf().prepocess);
        Serial.print(", inference=");
        Serial.print(AI.perf().inference);
        Serial.print(", postpocess=");
        Serial.println(AI.perf().postprocess);

        for (int i = 0; i < AI.boxes().size(); i++)
        {
            Serial.print("Box[");
            Serial.print(i);
            Serial.print("] target=");
            Serial.print(AI.boxes()[i].target);
            Serial.print(", score=");
            Serial.print(AI.boxes()[i].score);
            Serial.print(", x=");
            Serial.print(AI.boxes()[i].x);
            Serial.print(", y=");
            Serial.print(AI.boxes()[i].y);
            Serial.print(", w=");
            Serial.print(AI.boxes()[i].w);
            Serial.print(", h=");
            Serial.println(AI.boxes()[i].h);
        }
        for (int i = 0; i < AI.classes().size(); i++)
        {
            Serial.print("Class[");
            Serial.print(i);
            Serial.print("] target=");
            Serial.print(AI.classes()[i].target);
            Serial.print(", score=");
            Serial.println(AI.classes()[i].score);
        }
        for (int i = 0; i < AI.points().size(); i++)
        {
            Serial.print("Point[");
            Serial.print(i);
            Serial.print("] target=");
            Serial.print(AI.points()[i].target);
            Serial.print(", score=");
            Serial.print(AI.points()[i].score);
            Serial.print(", x=");
            Serial.print(AI.points()[i].x);
            Serial.print(", y=");
            Serial.println(AI.points()[i].y);
        }
    }
}
```

正常运行时，打开[串口监视器](https://docs.petoi.com/chinese/arduino-ide/chuan-kou-jian-shi-qi#biboard)，效果如下图所示：

<figure><img src="https://201656985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%2Fuploads%2FAptGzCwaIm3ma73ydA4x%2Fimage.png?alt=media&#x26;token=7030cf88-15d7-4cd4-949a-ef2cfeb4a89b" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/chinese/kuo-zhan-mo-kuai/petoi-ai-vision-she-xiang-tou-mo-kuai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
