-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backend] Add YOLOv5、PPYOLOE and PP-Liteseg for RV1126 (#647)
* add yolov5 and ppyoloe for rk1126 * update code, rename rk1126 to rv1126 * add PP-Liteseg * update lite lib * updade doc for PPYOLOE * update doc * fix docs * fix doc and examples * update code * uodate doc * update doc Co-authored-by: Jason <jiangjiajun@baidu.com>
- Loading branch information
1 parent
763da98
commit 104d965
Showing
59 changed files
with
804 additions
and
987 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
Empty file.
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,100 @@ | ||
# 瑞芯微 RV1126 部署环境编译安装 | ||
|
||
FastDeploy基于 Paddle-Lite 后端支持在瑞芯微(Rockchip)Soc 上进行部署推理。 | ||
更多详细的信息请参考:[PaddleLite部署示例](https://www.paddlepaddle.org.cn/lite/develop/demo_guides/verisilicon_timvx.html)。 | ||
|
||
本文档介绍如何编译基于 PaddleLite 的 C++ FastDeploy 交叉编译库。 | ||
|
||
相关编译选项说明如下: | ||
|编译选项|默认值|说明|备注| | ||
|:---|:---|:---|:---| | ||
|ENABLE_LITE_BACKEND|OFF|编译RK库时需要设置为ON| - | | ||
|ENABLE_TIMVX|OFF|编译RK库时需要设置为ON| - | | ||
|
||
更多编译选项请参考[FastDeploy编译选项说明](./README.md) | ||
|
||
## 交叉编译环境搭建 | ||
|
||
### 宿主机环境需求 | ||
- os:Ubuntu == 16.04 | ||
- cmake: version >= 3.10.0 | ||
|
||
### 环境搭建 | ||
```bash | ||
# 1. Install basic software | ||
apt update | ||
apt-get install -y --no-install-recommends \ | ||
gcc g++ git make wget python unzip | ||
|
||
# 2. Install arm gcc toolchains | ||
apt-get install -y --no-install-recommends \ | ||
g++-arm-linux-gnueabi gcc-arm-linux-gnueabi \ | ||
g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf \ | ||
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
|
||
# 3. Install cmake 3.10 or above | ||
wget -c https://mms-res.cdn.bcebos.com/cmake-3.10.3-Linux-x86_64.tar.gz && \ | ||
tar xzf cmake-3.10.3-Linux-x86_64.tar.gz && \ | ||
mv cmake-3.10.3-Linux-x86_64 /opt/cmake-3.10 && \ | ||
ln -s /opt/cmake-3.10/bin/cmake /usr/bin/cmake && \ | ||
ln -s /opt/cmake-3.10/bin/ccmake /usr/bin/ccmake | ||
``` | ||
|
||
## 基于 PaddleLite 的 FastDeploy 交叉编译库编译 | ||
搭建好交叉编译环境之后,编译命令如下: | ||
```bash | ||
# Download the latest source code | ||
git clone https://github.com/PaddlePaddle/FastDeploy.git | ||
cd FastDeploy | ||
mkdir build && cd build | ||
|
||
# CMake configuration with RK toolchain | ||
cmake -DCMAKE_TOOLCHAIN_FILE=./../cmake/timvx.cmake \ | ||
-DENABLE_TIMVX=ON \ | ||
-DCMAKE_INSTALL_PREFIX=fastdeploy-tmivx \ | ||
-DENABLE_VISION=ON \ # 是否编译集成视觉模型的部署模块,可选择开启 | ||
-Wno-dev .. | ||
|
||
# Build FastDeploy RV1126 C++ SDK | ||
make -j8 | ||
make install | ||
``` | ||
编译完成之后,会生成 fastdeploy-tmivx 目录,表示基于 PadddleLite TIM-VX 的 FastDeploy 库编译完成。 | ||
|
||
## 准备设备运行环境 | ||
部署前要保证芯原 Linux Kernel NPU 驱动 galcore.so 版本及所适用的芯片型号与依赖库保持一致,在部署前,请登录开发板,并通过命令行输入以下命令查询 NPU 驱动版本,Rockchip建议的驱动版本为: 6.4.6.5 | ||
```bash | ||
dmesg | grep Galcore | ||
``` | ||
|
||
如果当前版本不符合上述,请用户仔细阅读以下内容,以保证底层 NPU 驱动环境正确。 | ||
|
||
有两种方式可以修改当前的 NPU 驱动版本: | ||
1. 手动替换 NPU 驱动版本。(推荐) | ||
2. 刷机,刷取 NPU 驱动版本符合要求的固件。 | ||
|
||
### 手动替换 NPU 驱动版本 | ||
1. 使用如下命令下载解压 PaddleLite demo,其中提供了现成的驱动文件 | ||
```bash | ||
wget https://paddlelite-demo.bj.bcebos.com/devices/generic/PaddleLite-generic-demo.tar.gz | ||
tar -xf PaddleLite-generic-demo.tar.gz | ||
``` | ||
2. 使用 `uname -a` 查看 `Linux Kernel` 版本,确定为 `Linux` 系统 4.19.111 版本, | ||
3. 将 `PaddleLite-generic-demo/libs/PaddleLite/linux/armhf/lib/verisilicon_timvx/viv_sdk_6_4_6_5/lib/1126/4.19.111/` 路径下的 `galcore.ko` 上传至开发板。 | ||
|
||
4. 登录开发板,命令行输入 `sudo rmmod galcore` 来卸载原始驱动,输入 `sudo insmod galcore.ko` 来加载传上设备的驱动。(是否需要 sudo 根据开发板实际情况,部分 adb 链接的设备请提前 adb root)。此步骤如果操作失败,请跳转至方法 2。 | ||
5. 在开发板中输入 `dmesg | grep Galcore` 查询 NPU 驱动版本,确定为:6.4.6.5 | ||
|
||
### 刷机 | ||
根据具体的开发板型号,向开发板卖家或官网客服索要 6.4.6.5 版本 NPU 驱动对应的固件和刷机方法。 | ||
|
||
更多细节请参考:[PaddleLite准备设备环境](https://www.paddlepaddle.org.cn/lite/develop/demo_guides/verisilicon_timvx.html#zhunbeishebeihuanjing) | ||
|
||
## 基于 FastDeploy 在 RV1126 上的部署示例 | ||
1. RV1126 上部署 PaddleClas 分类模型请参考:[PaddleClas 分类模型在 RV1126 上的 C++ 部署示例](../../../examples/vision/classification/paddleclas/rv1126/README.md) | ||
|
||
2. RV1126 上部署 PPYOLOE 检测模型请参考:[PPYOLOE 检测模型在 RV1126 上的 C++ 部署示例](../../../examples/vision/detection/paddledetection/rv1126/README.md) | ||
|
||
3. RV1126 上部署 YOLOv5 检测模型请参考:[YOLOv5 检测模型在 RV1126 上的 C++ 部署示例](../../../examples/vision/detection/yolov5/rv1126/README.md) | ||
|
||
4. RV1126 上部署 PP-LiteSeg 分割模型请参考:[PP-LiteSeg 分割模型在 RV1126 上的 C++ 部署示例](../../../examples/vision/segmentation/paddleseg/rv1126/README.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
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
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
6 changes: 3 additions & 3 deletions
6
...lassification/paddleclas/rk1126/README.md → ...lassification/paddleclas/rv1126/README.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# PaddleClas 量化模型在 RK1126 上的部署 | ||
目前 FastDeploy 已经支持基于 PaddleLite 部署 PaddleClas 量化模型到 RK1126 上。 | ||
# PaddleClas 量化模型在 RV1126 上的部署 | ||
目前 FastDeploy 已经支持基于 PaddleLite 部署 PaddleClas 量化模型到 RV1126 上。 | ||
|
||
模型的量化和量化模型的下载请参考:[模型量化](../quantize/README.md) | ||
|
||
|
||
## 详细部署文档 | ||
|
||
在 RK1126 上只支持 C++ 的部署。 | ||
在 RV1126 上只支持 C++ 的部署。 | ||
|
||
- [C++部署](cpp) |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.