Tengine on VIM3

Prepare

  1. Reburn the Ubunru image into VIM3.

  2. Upgrade your system to least OTA version. Then reboot.

  1. Check Galcore version
$ dmesg | grep Galcore
[   14.541908] Galcore version 6.4.8.7.1.1.1
  1. Install cmake
$ sudo apt-get install cmake

Compile Tengine

  1. Get TIM-VX
$ git clone https://github.com/VeriSilicon/TIM-VX.git
  1. Get Tengine-lite
$ git clone https://github.com/OAID/Tengine.git
  1. Copy TIM-VX files into Teinge-lite
$ cp -rf ../TIM-VX/include  ./source/device/tim-vx/
$ cp -rf ../TIM-VX/src      ./source/device/tim-vx/
  1. Get 3rdparty
$ wget -c https://github.com/VeriSilicon/TIM-VX/releases/download/v1.1.34.fix/aarch64_A311D_6.4.8.tgz
$ tar zxvf aarch64_A311D_6.4.8.tgz
$ cd Tengine && mkdir -p ./3rdparty/tim-vx/include
$ cp -rf ../prebuild-sdk-s905d3/include/*  ./3rdparty/tim-vx/include/
  1. Compile
$ cd Tengine
$ mkdir build && cd build
$ cmake -DTENGINE_ENABLE_TIM_VX=ON ..
$ make -j4 && make install

Test Tengine

  1. Download mobilenet_uint8.tmfile from Google Drive.

  2. wget -c https://github.com/khadas/aml_npu_sdk/raw/master/acuity-toolkit/demo/data/cat.jpg .

  3. Set environment variables.

$ cd Tengine
$ export LD_LIBRARY_PATH=./build/install/lib
$ ./build/install/bin/tm_classification_timvx -m path/to/mobilenet_uint8.tmfile -i path/to/cat.jpg -g 224,224 -s 0.017,0.017,0.017 -w 104.007,116.669,122.679
tengine-lite library version: 1.5-dev

model file : build/install/bin/mobilenet_uint8.tmfile
image file : cat.jpg
img_h, img_w, scale[3], mean[3] : 224 224 , 0.017 0.017 0.017, 104.0 116.7 122.7
Repeat 1 times, thread 1, avg time 4.47 ms, max_time 4.47 ms, min_time 4.47 ms
--------------------------------------
5.520552, 283
5.200520, 285
5.040504, 281
4.880488, 282
4.720472, 287
--------------------------------------
1 Like