Files
FastDeploy/examples/vision/classification/paddleclas/rknpu2/cpp/README_CN.md
charl-u cbf88a46fa [Doc]Update English version of some documents (#1083)
* 第一次提交

* 补充一处漏翻译

* deleted:    docs/en/quantize.md

* Update one translation

* Update en version

* Update one translation in code

* Standardize one writing

* Standardize one writing

* Update some en version

* Fix a grammer problem

* Update en version for api/vision result

* Merge branch 'develop' of https://github.com/charl-u/FastDeploy into develop

* Checkout the link in README in vision_results/ to the en documents

* Modify a title

* Add link to serving/docs/

* Finish translation of demo.md

* Update english version of serving/docs/

* Update title of readme

* Update some links

* Modify a title

* Update some links

* Update en version of java android README

* Modify some titles

* Modify some titles

* Modify some titles

* modify article to document

* update some english version of documents in examples

* Add english version of documents in examples/visions

* Sync to current branch

* Add english version of documents in examples

* Add english version of documents in examples

* Add english version of documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples

* Update some documents in examples
2023-01-09 10:08:19 +08:00

2.4 KiB
Raw Blame History

English | 简体中文

PaddleClas C++部署示例

本目录下用于展示 ResNet50_vd 模型在RKNPU2上的部署以下的部署过程以 ResNet50_vd 为例子。

在部署前,需确认以下两个步骤:

  1. 软硬件环境满足要求
  2. 根据开发环境下载预编译部署库或者从头编译FastDeploy仓库

以上步骤请参考RK2代NPU部署库编译实现

生成基本目录文件

该例程由以下几个部分组成

.
├── CMakeLists.txt
├── build  # 编译文件夹
├── images  # 存放图片的文件夹
├── infer.cc
├── ppclas_model_dir  # 存放模型文件的文件夹
└── thirdpartys  # 存放sdk的文件夹

首先需要先生成目录结构

mkdir build
mkdir images
mkdir ppclas_model_dir
mkdir thirdpartys

编译

编译并拷贝SDK到thirdpartys文件夹

请参考RK2代NPU部署库编译仓库编译SDK编译完成后将在build目录下生成fastdeploy-0.0.3目录请移动它至thirdpartys目录下.

拷贝模型文件以及配置文件至model文件夹

在Paddle动态图模型 -> Paddle静态图模型 -> ONNX模型的过程中将生成ONNX文件以及对应的yaml配置文件请将配置文件存放到model文件夹内。 转换为RKNN后的模型文件也需要拷贝至model转换方案: (ResNet50_vd RKNN模型)。

准备测试图片至image文件夹

wget https://gitee.com/paddlepaddle/PaddleClas/raw/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg

编译example

cd build
cmake ..
make -j8
make install

运行例程

cd ./build/install
./rknpu_test ./ppclas_model_dir ./images/ILSVRC2012_val_00000010.jpeg

运行结果展示

ClassifyResult( label_ids: 153, scores: 0.684570, )

注意事项

RKNPU上对模型的输入要求是使用NHWC格式且图片归一化操作会在转RKNN模型时内嵌到模型中因此我们在使用FastDeploy部署时需要先调用DisablePermute(C++)或`disable_permute(Python),在预处理阶段禁用数据格式的转换。

其它文档