Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 43 additions & 106 deletions docs/common/ai/qualcomm/_aotgan_qai-app-builder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

**示例支持设备**

| 设备 | SoC |
| -------------------- | ----- |
| 设备 | SoC |
| -------------------- | ------- |
| Fogwise® AIRbox Q900 | QCS9075 |

## 安装 QAI AppBuilder
Expand All @@ -20,134 +20,71 @@

### 安装依赖

在已激活的虚拟环境中安装示例依赖:

<NewCodeBlock tip="Device" type="device">

```bash
pip3 install requests tqdm qai-hub py3_wget opencv-python torch torchvision
pip3 install requests tqdm qai-hub py3-wget Pillow torch torchvision opencv-python-headless
```

</NewCodeBlock>

### 运行脚本

- 进入示例目录

<Tabs>

<TabItem value="QCS9075" default={props.tag === "qcs9075"} attributes={{className: props.tag !== "qcs9075" && "tab_none"}}>

<NewCodeBlock tip="Device" type="device">

```bash
cd ai-engine-direct-helper/samples/python
```
- 进入上游示例目录

</NewCodeBlock>
<NewCodeBlock tip="Device" type="device">

</TabItem>

</Tabs>

- 准备输入图片,这里以以下图片为输入示例
```bash
cd qai-appbuilder/samples
```

{" "}
</NewCodeBlock>

<div style={{ textAlign: "center" }}>
<img
src="/img/fogwise/airbox-q900/qairt-aotgan_input.webp"
style={{ width: "65%" }}
/>
input image
</div>
- 准备输入数据(示例自带输入文件时可直接运行;也可按脚本参数指定)

<div style={{ textAlign: "center" }}>
<img
src="/img/fogwise/airbox-q900/qairt-aotgan_mask.webp"
style={{ width: "65%" }}
/>
mask image
</div>
<div style={{ textAlign: "center" }}>
<img
src="/img/fogwise/airbox-q900/qairt-aotgan_input.webp"
style={{ width: "65%" }}
/>
input image
</div>

- 执行推理

<NewCodeBlock tip="Device" type="device">

```bash
python3 aotgan/aotgan.py
python3 ComputerVision/Image_Editing/aotgan/aotgan.py --chipset 9075
```

</NewCodeBlock>

```bash
$ python3 aotgan/aotgan.py
0.0ms [WARNING] <W> Initializing HtpProvider

/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpc
0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

136.6ms [WARNING] Time: Read model file to memory. 21.49

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support
- 运行结果示意

<div style={{ textAlign: "center" }}>
<img
src="/img/fogwise/airbox-q900/qairt-aotgan_mask.webp"
style={{ width: "65%" }}
/>
mask image
</div>
<div style={{ textAlign: "center" }}>
<img
src="/img/fogwise/airbox-q900/qairt-aotgan_output.webp"
style={{ width: "65%" }}
/>
output image
</div>

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

205.5ms [WARNING] Time: contextCreateFromBinary. 68.83

205.6ms [WARNING] Time: UnmapViewOfFile. 0.00

207.5ms [WARNING] Time: model_initialize aotgan 207.45

415.4ms [WARNING] Time: model_inference aotgan 154.66

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening '/tmp/tmpjvwp3wzi.PNG'
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc
801.6ms [WARNING] Time: model_destroy aotgan 67.93

/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening '/tmp/tmp0z61xxdt.PNG'
```
:::tip
首次运行会通过 Qualcomm® AI Hub 自动下载模型,耗时取决于网络。也可在 `samples` 目录使用启动器:

{" "}
```bash
python3 run_inference.py --list
python3 run_inference.py --model aotgan --args "--chipset 9075"
```

<div style={{ textAlign: "center" }}>
<img
src="/img/fogwise/airbox-q900/qairt-aotgan_output.webp"
style={{ width: "65%" }}
/>
output image
</div>
:::
104 changes: 24 additions & 80 deletions docs/common/ai/qualcomm/_beit_qai-app-builder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

**示例支持设备**

| 设备 | SoC |
| -------------------- | ----- |
| 设备 | SoC |
| -------------------- | ------- |
| Fogwise® AIRbox Q900 | QCS9075 |

## 安装 QAI AppBuilder
Expand All @@ -20,107 +20,51 @@

### 安装依赖

在已激活的虚拟环境中安装示例依赖:

<NewCodeBlock tip="Device" type="device">

```bash
pip3 install requests tqdm qai-hub py3_wget opencv-python torch torchvision
pip3 install requests tqdm qai-hub py3-wget Pillow torch torchvision opencv-python-headless
```

</NewCodeBlock>

### 运行脚本

- 进入示例目录

<Tabs>

<TabItem value="QCS9075" default={props.tag === "qcs9075"} attributes={{className: props.tag !== "qcs9075" && "tab_none"}}>

<NewCodeBlock tip="Device" type="device">

```bash
cd ai-engine-direct-helper/samples/python
```
- 进入上游示例目录

</NewCodeBlock>
<NewCodeBlock tip="Device" type="device">

</TabItem>

</Tabs>
```bash
cd qai-appbuilder/samples
```

- 准备输入图片,这里以以下图片为输入示例
</NewCodeBlock>

{" "}
- 准备输入数据(示例自带输入文件时可直接运行;也可按脚本参数指定)

<div style={{ textAlign: "center" }}>
<img src="/img/dragon/q6a/test_image.webp" style={{ width: "65%" }} />
input image
</div>
<div style={{ textAlign: "center" }}>
<img src="/img/dragon/q6a/test_image.webp" style={{ width: "65%" }} />
input image
</div>

- 执行推理

<NewCodeBlock tip="Device" type="device">

```bash
python3 beit/beit.py
python3 ComputerVision/Image_Classification/beit/beit.py --chipset 9075
```

</NewCodeBlock>

```bash
$ python3 beit/beit.py
0.0ms [WARNING] <W> Initializing HtpProvider

/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpc
0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

179.0ms [WARNING] Time: Read model file to memory. 60.05

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

284.7ms [WARNING] Time: contextCreateFromBinary. 105.62

284.8ms [WARNING] Time: UnmapViewOfFile. 0.00

288.1ms [WARNING] Time: model_initialize beit 288.01

365.3ms [WARNING] Time: model_inference beit 17.72

Top 5 predictions for image:

"Samoyed", 0.6322221756
"Pomeranian", 0.1098636836
"Keeshond", 0.0410530604
"Japanese Chin", 0.0093044275
"Chow Chow", 0.0058453484
0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support

0.0ms [WARNING] <W> This META does not have Alloc2 Support
:::tip
首次运行会通过 Qualcomm® AI Hub 自动下载模型,耗时取决于网络。也可在 `samples` 目录使用启动器:

/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc
483.8ms [WARNING] Time: model_destroy beit 113.14
```
```bash
python3 run_inference.py --list
python3 run_inference.py --model beit --args "--chipset 9075"
```

打印结果可以看到 `Samoyed` 置信度最高,这与输入图片内容吻合。
:::
Loading
Loading