How To Compile And Run Tengine Demo

The source code repository is a simple demo repository made by khadas based on the tengine API

Note

After tengine-lite v.14 (ie NPU6.4.4.3), the demo only supports local compilation on the board

Get Source code

The source code repository is located on gitlab of khadas

1
2
3
4
5
6
$ mkdir workspace
$ cd ${workspace}
$ git clone https://gitlab.com/khadas/tengine_khadas_app.git
$ cd tengine_khadas_app
$ ls
yolov3-camera yolov3-picture

yolov3-camera and yolov3-picture are based on the demos of camera recognition and picture recognition of opencv respectively

Install opencv4

1
$ sudo apt install libopencv-dev python3-opencv 

How To Compile

yolov3-picture:

1
2
3
4
5
$ cd ${workspace}/tengine_khadas_app/yolov3-picture
$ ./build-cv4.sh
COMPILE ${workspace}/tengine_khadas_app/yolov3-picture/tengine_khadas_yolov3_picture.cpp
$ ls cv3_output/
tengine_khadas_yolov3_picture tengine_khadas_yolov3_picture.o

yolov3-camera:

1
2
3
4
5
$ cd ${workspace}/tengine_khadas_app/yolov3-camera
$ ./build-cv4.sh
COMPILE ${workspace}/tengine_khadas_app/yolov3-camera/tengine_khadas_yolov3_camera.cpp
$ ls cv3_output/
tengine_khadas_yolov3_camera tengine_khadas_yolov3_camera.o

Among them, tengine_khadas_yolov3_picture and tengine_khadas_yolov3_camera are compiled executable files

How To Run

  1. Get tmfile

Please refer to How To Use Tengine SDK

  1. Run
1
2
$ ./tengine_khadas_yolov3_camera -m path/to/yolov3_uint8_t_timfile -i path/to/picture
$ ./tengine_khadas_yolov3_camera -m path/to/yolov3_uint8_t_timfile -d /dev/videoX