Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:vim4:npu:npu-applications

This is an old revision of the document!


VIM4 NPU Applications

Only New VIM4 supports NPU, you can check the version of your VIM4 here: VIM4 Versions

Linux

Only supports OpenCV4

Install Dependencies

$ sudo apt update
$ sudo apt install libopencv-dev python3-opencv cmake

Source Code for Applications

You need to download the source code to your VIM4 board and compile on it.

Clone the NPU demo applications to somewhere, e.g. ~/workspace:

$ mkdir ~/workspace
$ cd ~/workspace
$ git clone https://github.com/khadas/vim4_npu_applications
$ cd vim4_npu_applications
$ ls
mobilenet_v2  nn_sdk  yolov3  yolov3_cap  yolov7_tiny  yolov7_tiny_cap  yolov8n  yolov8n_cap
  • mobilenet_v2/yolov3/yolov3_cap/yolov7_tiny/yolov8n: Different demo for VIM4 NPU.
  • nn_sdk: Dependencies required for compilation.

Compile

Take mobilenet_v2 as an example, other demos are the same.

$ cd mobilenet_v2
$ mkdir build && cd build
$ cmake ..
$ make

Run

Mobilenet V2

$ cd mobilenet_v2/build
$ sudo ./mobilenetv2 ../data/mobilenetv2_int8.adla ../data/goldfish_224x224.jpg 
[sudo] password for khadas: 
997: 0.273438
886: 0.031250
108: 0.023438
109: 0.019531
127: 0.019531

Yolov3

The demos of the Yolo series only support running under the desktop environment.

Before running, please complie. The method of compliation is same as Mobilenet V2.

Detect picture:

$ cd yolov3/build
$ sudo ./yolov3 -p ../data/1080p.bmp  -m ../data/det_yolov3_int8.adla

Detection with camera:

$ cd yolov3_cap/build
$ sudo ./yolov3_cap -m ../data/det_yolov3_int8.adla -d X -w 1920 -h 1080

x: the number for you camera device. such as /dev/video0, x is 0.

Yolov7_tiny

Detect picture:

$ cd yolov7_tiny/build
$ sudo ./yolov7_tiny -p ../data/horses.jpg  -m ../data/yolov7_tiny_int8.adla

Detection with camera:

$ cd yolov7_tiny_cap/build
$ sudo ./yolov7_tiny_cap -m ../data/yolov7_tiny_int8.adla -d X -w 1920 -h 1080

Yolov8n

Detect picture:

$ cd yolov8n/build
$ sudo ./yolov8n -p ../data/horses.jpg  -m ../data/yolov8n_int8.adla

Detection with camera:

$ cd yolov8n_cap/build
$ sudo ./yolov8n_cap -m ../data/yolov8n_int8.adla -d X -w 1920 -h 1080

Android

WIP:

Last modified: 2023/06/06 22:32 by louis