感谢电子发烧友和幸狐科技提供了此次LuckFox Pico Plus开发板试用机会。
LuckFox Pico 是一款基于瑞芯微 RV1103 芯片具有高性价比的微型 Linux 开发板,旨在为开发者提供一个简单且高效的开发平台。虽然LuckFox Pico作为入门级开发板只有几十块钱,但是它具有人工智能协处理器NPU,也可以实现人工智能的推理工作。瑞芯微 RV1103芯片采用了和RK3568芯片类似的工具,在以前测试飞凌RK3568开发板时,我们对瑞芯微的RKNN工具有了很多了解,感兴趣的朋友可以参考:
今天我们主要使用厂商自己提供的模型来测试其RKNN推理能力。
首先,需要安装厂商提供的LuckFox
Pico SDK:https://github.com/LuckfoxTECH/luckfox-pico/。然后,安装瑞芯微的rknpu2:https://github.com/rockchip-linux/rknpu2。如果想转换自己的模型,还需要安装瑞芯微的RKNN Toolkit2:https://github.com/rockchip-linux/rknn-toolkit2。
在rknpu2的example目录下可以找到RV1106_RV1103目录,其中包括2个可以直接用于LuckFox Pico开发板的例程。
编译例程前需要设置如下环境变量:
export RK_RV1106_TOOLCHAIN=~/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf
然后执行examples/RV1106_RV1103/rknn_yolov5_demo目录下的build-linux_RV1106.sh脚本。该脚本将编译例程:
-- The C
compiler identification is GNU 8.3.0
-- The CXX
compiler identification is GNU 8.3.0
-- Check for
working C compiler:
/home/test/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc
-- Check for
working C compiler:
/home/test/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc
-- works
-- Detecting C
compiler ABI info
-- Detecting C
compiler ABI info - done
-- Detecting C
compile features
-- Detecting C
compile features - done
-- Check for
working CXX compiler:
/home/test/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-g++
-- Check for
working CXX compiler:
/home/test/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-g++
-- works
-- Detecting CXX
compiler ABI info
-- Detecting CXX
compiler ABI info - done
-- Detecting CXX
compile features
-- Detecting CXX
compile features - done
-- Configuring
done
-- Generating
done
-- Build files
have been written to:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/build/build_linux_arm
Scanning
dependencies of target rknn_yolov5_demo
[ 66%] Building
CXX object CMakeFiles/rknn_yolov5_demo.dir/src/postprocess.cc.o
[ 66%] Building
CXX object CMakeFiles/rknn_yolov5_demo.dir/src/main.cc.o
[100%] Linking
CXX executable rknn_yolov5_demo
[100%] Built
target rknn_yolov5_demo
[100%] Built
target rknn_yolov5_demo
Install the
project...
-- Install
configuration: ""
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/./rknn_yolov5_demo
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/lib/librknnmrt.so
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/.//model
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/.//model/bus.jpg
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/.//model/coco_80_labels_list.txt
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/.//model/RV1106
-- Installing:
/mnt/ok/rknpu2-master/examples/RV1106_RV1103/rknn_yolov5_demo/install/rknn_yolov5_demo_Linux/.//model/RV1106/yolov5s-640-640.rknn
连接板子的usb口到电脑,使用ADB命令将install目录下的整个demo目录复制到到 /userdata
:
adb push install/rknn_yolov5_demo_Linux /userdata/
然后在板子上进入ADB shell运行程序。
adb shell
cd /userdata/rknn_yolov5_demo_Linux/
chmod 777 rknn_yolov5_demo
export LD_LIBRARY_PATH=/userdata/rknn_yolov5_demo_Linux/lib
./rknn_yolov5_demo model/RV1106/yolov5s-640-640.rknn model/bus.jpg
程序运行结果如下图:
我们用OpenCV绘制了识别结果,如下图。
识别的过程耗时100ms,速度还是相当快的。
更多回帖