-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add ultralytics yolo11 rknn zh/en usage
signed-off-by: "Morgan ZHANG" <zhangzifeng@radxa.com>
- Loading branch information
1 parent
63e533a
commit 3d2c27c
Showing
32 changed files
with
486 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
:::tip | ||
本文档旨在演示如何在 rk3588/356X 上推理 YOLOv11 目标检测模型,所需环境配置请参考[ RKNN 安装](./rknn_install) | ||
::: | ||
|
||
目前 [Ultralytics](https://docs.ultralytics.com/integrations/rockchip-rknn/) 官方已经支持 rknn 平台,RK3588/356X 产品用户可以直接使用 `ultralytics` 库进行 yolov11 的模型转换和模型部署。 | ||
|
||
## PC 端模型转换 | ||
|
||
**Radxa 已提供预转换好的 `yolov11n.rknn` 模型,用户可直接参考[板端推理 YOLOv11 ](#板端推理-yolov11)跳过 PC 端模型转换章节** | ||
|
||
- 安装最新版本的 ultralytics | ||
```bash | ||
pip3 install -U ultralytics | ||
``` | ||
- 使用 ultralytics 导出 yolov11 rknn 格式模型, | ||
|
||
<Tabs> | ||
|
||
<TabItem value="CLI"> | ||
|
||
```bash | ||
# 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118 | ||
yolo export model=yolo11n.pt format=rknn name=rk3588 | ||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="Python"> | ||
|
||
```python | ||
from ultralytics import YOLO | ||
|
||
# Load the YOLOv11 model | ||
model = YOLO("yolo11n.pt") | ||
|
||
# Export the model to RKNN format | ||
# 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118 | ||
model.export(format="rknn", name="rk3588") # creates '/yolo11n_rknn_model' | ||
``` | ||
|
||
</TabItem> | ||
|
||
</Tabs> | ||
|
||
结果保存在 ./yolo11n_rknn_model | ||
|
||
- 将 **yolo11n_rknn_model** 目录拷贝到板端 | ||
|
||
## 板端推理 YOLOv11 | ||
|
||
:::tip | ||
RK356X 芯片用户使用 NPU 前需要在终端使用 **rsetup** 开启 NPU: sudo rsetup -> overlays -> Enable NPU,最后重启系统。 | ||
|
||
如 overlays 选项中无 `Enable NPU` 选项,请通过: sudo rsetup -> system -> System Update 升级系统, 重启后执行上述步骤开启 NPU。 | ||
::: | ||
|
||
- (可选)下载 radxa 准备的 yolov11n rknn 模型 | ||
| 平台 | 下载链接 | | ||
| -------- | ------------------------------------------------------------ | | ||
| rk3566 | [yolo11n_3566_rknn_model](https://github.com/zifeng-radxa/rknn_model_zoo/releases/download/yolov11/yolo11n_3566_rknn_model.zip) | | ||
| rk3568 | [yolo11n_3568_rknn_model](https://github.com/zifeng-radxa/rknn_model_zoo/releases/download/yolov11/yolo11n_3568_rknn_model.zip) | | ||
| rk3588 | [yolo11n_3588_rknn_model](https://github.com/zifeng-radxa/rknn_model_zoo/releases/download/yolov11/yolo11n_3588_rknn_model.zip) | | ||
|
||
- 在虚拟环境下安装最新版本的 ultralytics | ||
|
||
虚拟环境安装请参考 [Python 虚拟环境使用](venv_usage) | ||
|
||
```bash | ||
pip3 install -U ultralytics | ||
``` | ||
|
||
- 板端推理 | ||
|
||
<Tabs> | ||
<TabItem value="CLI"> | ||
```bash | ||
yolo predict model='./yolo11n_rknn_model' source='https://ultralytics.com/images/bus.jpg' | ||
``` | ||
</TabItem> | ||
<TabItem value="Python"> | ||
```python | ||
from ultralytics import YOLO | ||
|
||
# Load the exported RKNN model | ||
rknn_model = YOLO("./yolo11n_rknn_model") | ||
|
||
# Run inference | ||
results = rknn_model("https://ultralytics.com/images/bus.jpg") | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
结果保存在 runs/detect/predict 中 | ||
|
||
<img width="400" src="/img/general-tutorial/rknn/yolov11.webp" /> | ||
|
||
## 更多使用细节 | ||
|
||
更多 Ultralytics 使用细节请参考 [Ultralytics](https://docs.ultralytics.com/) 官方文档 |
10 changes: 10 additions & 0 deletions
10
docs/compute-module/cm3/app-development/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
10 changes: 10 additions & 0 deletions
10
docs/compute-module/cm3i/app-development/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
10 changes: 10 additions & 0 deletions
10
docs/compute-module/cm5/radxa-os/app-dev/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
10 changes: 10 additions & 0 deletions
10
docs/compute-module/nx5/radxa-os/app-dev/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 22 | ||
--- | ||
|
||
# Python 虚拟环境使用 | ||
|
||
import VENVUSAGE from '../../../common/dev/\_venv_usage.mdx'; | ||
|
||
<VENVUSAGE /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "通过 RK3588/RK356X 板端部署 YOLOv11,开启智能目标检测的新时代,让技术与人文关怀在精准识别中完美融合" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
99 changes: 99 additions & 0 deletions
99
i18n/en/docusaurus-plugin-content-docs/current/common/dev/_rknn-ultralytics.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
:::tip | ||
This document demonstrates how to perform inference for the YOLOv11 object detection model on RK3588/356X. For the required environment setup, please refer to [RKNN Installation](./rknn_install). | ||
::: | ||
|
||
Currently, the [Ultralytics](https://docs.ultralytics.com/integrations/rockchip-rknn/) library officially supports the RKNN platform. Users of RK3588/356X products can directly use the `ultralytics` library for YOLOv11 model conversion and deployment. | ||
|
||
## Model Conversion on PC | ||
|
||
**Radxa has provided a pre-converted `yolov11n.rknn` model. Users can skip the PC-side model conversion section and directly refer to [YOLOv11 Inference on Board](#yolov11-inference-on-board).** | ||
|
||
- Install the latest version of Ultralytics: | ||
```bash | ||
pip3 install -U ultralytics | ||
``` | ||
- Use Ultralytics to export the YOLOv11 model in RKNN format: | ||
|
||
<Tabs> | ||
|
||
<TabItem value="CLI"> | ||
|
||
```bash | ||
# 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118 | ||
yolo export model=yolo11n.pt format=rknn name=rk3588 | ||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="Python"> | ||
|
||
```bash | ||
from ultralytics import YOLO | ||
|
||
# Load the YOLOv11 model | ||
model = YOLO("yolo11n.pt") | ||
|
||
# Export the model to RKNN format | ||
# 'name' can be one of rk3588, rk3576, rk3566, rk3568, rk3562, rv1103, rv1106, rv1103b, rv1106b, rk2118 | ||
model.export(format="rknn", name="rk3588") # creates '/yolo11n_rknn_model' | ||
``` | ||
|
||
</TabItem> | ||
|
||
</Tabs> | ||
|
||
The result is saved in `./yolo11n_rknn_model`. | ||
|
||
- Copy the **yolo11n_rknn_model** directory to the target device. | ||
|
||
## YOLOv11 Inference on Board | ||
|
||
:::tip | ||
For RK356X chip users, before using the NPU, enable it through the terminal using **rsetup**: `sudo rsetup -> overlays -> Enable NPU`, and then reboot the system. | ||
|
||
If the `Enable NPU` option is missing in overlays, update the system via: `sudo rsetup -> system -> System Update`. Reboot and perform the above steps to enable the NPU. | ||
::: | ||
|
||
- (Optional) Download the YOLOv11n RKNN model provided by Radxa: | ||
| Platform | Download Link | | ||
| -------- | ------------------------------------------------------------ | | ||
| rk3566 | [yolo11n_3566_rknn_model](https://github.com/zifeng-radxa/rknn_model_zoo/releases/download/yolov11/yolo11n_3566_rknn_model.zip) | | ||
| rk3568 | [yolo11n_3568_rknn_model](https://github.com/zifeng-radxa/rknn_model_zoo/releases/download/yolov11/yolo11n_3568_rknn_model.zip) | | ||
| rk3588 | [yolo11n_3588_rknn_model](https://github.com/zifeng-radxa/rknn_model_zoo/releases/download/yolov11/yolo11n_3588_rknn_model.zip) | | ||
|
||
- Install the latest version of Ultralytics in a virtual environment: | ||
|
||
For instructions on virtual environments, refer to [Python Virtual Environment Usage](venv_usage). | ||
|
||
```bash | ||
pip3 install -U ultralytics | ||
``` | ||
|
||
- Run inference on the board: | ||
|
||
<Tabs> | ||
<TabItem value="CLI"> | ||
```bash | ||
yolo predict model='./yolo11n_rknn_model' source='https://ultralytics.com/images/bus.jpg' | ||
``` | ||
</TabItem> | ||
<TabItem value="Python"> | ||
```python | ||
from ultralytics import YOLO | ||
|
||
# Load the exported RKNN model | ||
rknn_model = YOLO("./yolo11n_rknn_model") | ||
|
||
# Run inference | ||
results = rknn_model("https://ultralytics.com/images/bus.jpg") | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
The results are saved in `runs/detect/predict`. | ||
|
||
<img width="400" src="../../../img/general-tutorial/rknn/yolov11.webp" /> | ||
|
||
## Additional Usage Details | ||
|
||
For more details about using Ultralytics, refer to the [Ultralytics](https://docs.ultralytics.com/) official documentation. |
10 changes: 10 additions & 0 deletions
10
...gin-content-docs/current/compute-module/cm3/app-development/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "Deploying YOLOv11 on the RK3588/356X board side opens a new era of intelligent target detection, allowing technology and humanistic care to merge perfectly in accurate identification" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
10 changes: 10 additions & 0 deletions
10
...in-content-docs/current/compute-module/cm3i/app-development/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "Deploying YOLOv11 on the RK3588/356X board side opens a new era of intelligent target detection, allowing technology and humanistic care to merge perfectly in accurate identification" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
10 changes: 10 additions & 0 deletions
10
...in-content-docs/current/compute-module/cm5/radxa-os/app-dev/rknn_ultralytics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
sidebar_position: 16 | ||
description: "Deploying YOLOv11 on the RK3588/356X board side opens a new era of intelligent target detection, allowing technology and humanistic care to merge perfectly in accurate identification" | ||
--- | ||
|
||
# RKNN Ultralytics YOLOv11 | ||
|
||
import RKNNULTRALYTICS from '../../../../common/dev/\_rknn-ultralytics.mdx'; | ||
|
||
<RKNNULTRALYTICS /> |
Oops, something went wrong.