DIY operators rknnplugin
环境:RK3399pro + fedora
![GitHub license](http://OAID.github.io/pics/apache_2.0.svg)
1 下载Tengine Tengine in GitHub
git clone git@192.168.234.8:8022/internal/tengine.git
cd Tengine
2 Checkout tag v1.3.2
git checkout -b v1.3.2 v1.3.2
3 Build Protobuf
git clone git@github.com:protocolbuffers/protobuf.git
cd protobuf
git checkout -b v3.5.0 v3.5.0
./autogen.sh
./configure --with-protoc=protoc
make -j4
make install
4 Build opencv
git clone git@github.com:opencv/opencv.git
git checkout -b 3.4.0 3.4.0
cd opencvcp build_opencv.sh .
mkdir build
cd build
../build_opencv.sh
make -j4
sudo make install
5 Build Tengine
mkdir build
./linux_build.sh default_config/arm64_linux_native.config
make -j4
make install
6 Download rknn SDK. see [Toybrick]
此处我下载的是rknn-api-0.9.9,放置在home目录下备用
7 Build rknnplugin
cd <RKNNPLUGIN_ROOT> #此处是你的rknnplugin根目录
mkdir build
cd build
vim ../linux_build.sh
需要将tengin的根路径、将要安装至哪里的路径、rknn SDK的根路径 指定对。
![1.jpg](//file.elecfans.com/web2/M00/69/F0/pYYBAGMi95yAZLmbAACd3AItC8U039.jpg)
![2.jpg](//file.elecfans.com/web2/M00/69/F0/pYYBAGMi96CActZYAAAYV2wGGZI918.jpg)
若有一些找不到路径的错误,可以尝试以下修改:
1.在rknnplugin-master/CMakeLists修改
set(LIB_PATH ${RKNN_SDK_PATH}/rknn_api/arm/lib64)
include_directories(${RKNN_SDK_PATH}/rknn_api/arm/include)
为
set(LIB_PATH ${RKNN_SDK_PATH}/rknn_api/arm/lib64)
include_directories(${RKNN_SDK_PATH}/rknn_api/arm/include)
2.在rknnplugin-master/rknn/CMakeLists.txt 中修改
include_directories(${RKNN_SDK_PATH}/rknn_api/arm/include)为
include_directories(${RKNN_SDK_PATH}/rknn_api/include)
#可能会报错,说thread_->Activate(-1); thread_->Deactivate(); 没有这个成员函数,注释掉它们即可。
8.测试
export LD_LIBRARY_PATH=<RKNNPLUGIN_ROOT>/install:<TENGINE_PATH>/install/lib
cp <RKNN_SDK_ROOT>/rknn-api/Linux/tmp/* . -rf
../install/test_rknn_mobilenet
在./install/目录下有若干个程序可供测试使用。可以一一尝试。
谨记:如果更改了.cpp文件,一定要记得make && make install。
原作者:reachfoo