Jump to content
Sign in to follow this  
Tinker Board

How to run Yolo-Fastest (ncnn) on Tinker Board 2

Recommended Posts

This tutorial uses TinkerBoard 2 series, an RK3399 Arm-based single board computer (SBC) with a 64-bit processor using Arm big.LITTLE™ technology to deliver enhanced computing performance at lower power consumption.
The 6-core Rockchip RK3399 System-on-Chip (SoC) with the new 64-bit Armv8 architecture CPU and a multi-core Mali-T860 GPU. Therefore, Yolo-Fastest (ncnn) can be deployed on it and run at 30fps+ with real-time detection.

 

Installation Environment

sudo apt-get install make cmake git 
sudo apt-get install aptitude 
sudo aptitude install libopencv-dev 

note: Use aptitude to install the opencv library, if you use apt-get to install opencv there may be a problem of missing other dependencies.
KOthtm0.png

 

Get Yolo-Fastest source code

git clone https://github.com/dog-qiuqiu/Yolo-Fastest.git

 

Configuring the ncnn environment

cd Yolo-Fastest/sample/ncnn
git clone https://github.com/Tencent/ncnn.git
cd ncnn
mkdir build
cd build
cmake ..
make
make install
cp -rf install/* ../../

 

Test ncnn

cd ../../
ls /dev/video* #With no camera connected
ls /dev/video* #In case of camera connected, check whether the camera device is loaded and whether the camera node is 0
#If the camera node is not 0, modify the 0 of cv::VideoCapture cap(0); in the demo.cpp file to the right number of the camera
sh build.sh #Build
./demo #Run and check if the camera can start.

 

Model Conversion

Here we are using the yolo-fastest-1.1 model

mkdir yolo-fastest-1.1-model && cd yolo-fastest-1.1-model
../ncnn/build/tools/darknet/darknet2ncnn ../../../ModelZoo/yolo-fastest-1.1_coco/yolo-fastest-1.1.cfg ../../../ModelZoo/yolo-fastest-1.1_coco/yolo-fastest-1.1.weights yolo-fastest-1.1.param yolo-fastest-1.1.bin

 

Source Code Modification

vim demo.cpp
#Replace the following codes with
api.init("model/yolo-fastest-1.1.param", 
            "model/yolo-fastest-1_last.bin");
#follwing codes
api.init("yolo-fastest-1.1-model/yolo-fastest-1.1.param", 
            "yolo-fastest-1.1-model/yolo-fastest-1.1.bin"); #Here is the model after the conversion in the previous step
#Save to exit
cd src/include/
vim YoloDet.h #Change NUMRTHREADS 8 to NUMRTHREADS 6, because the Tinker Board 2 used are 6-core.

#Save to exit
rm demo
sh build.sh #Build
./demo #Run

 

The running result is as follows

43JokAP.png

 

Turn on bf16s

Open the `sample/ncnn/src/YoloDet.cpp` file and add following inside the `YoloDet::init` function

net.opt.use_packing_layout = true;
net.opt.use_bf16_storage = true;

Finally, set the processor again to achieve the best performance.
Ways to achieve the best performance with RK3399: http://blog.sina.com.cn/s/blog_15d5280590102yarw.html 
 

The running result is as follows

dnSq2K6.png

 

Source: 

http://wiki.smartfire.cn/Tinkerboard2/Yolo-Fastest(ncnn)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...