Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:edge2:npu:npu-applications

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:edge2:npu:npu-applications [2022/11/16 05:26]
nick
products:sbc:edge2:npu:npu-applications [2024/04/25 03:46] (current)
louis
Line 1: Line 1:
 +{{indexmenu_n>2}}
 +
 ====== NPU Applications ====== ====== NPU Applications ======
- 
-===== Introduction ===== 
- 
-This document mainly introduces how to compile and use NPU applications in Edge2. 
  
 ===== Get Source Code ===== ===== Get Source Code =====
  
-Clone the source code form our [[https://github.com/khadas/edge2-npu|Github]].+Clone the source code form our [[gh>khadas/edge2-npu]].
  
 ```shell ```shell
Line 27: Line 25:
 ```shell ```shell
 $ sudo cp ../C++/runtime/librknn_api/aarch64/librknnrt.so /usr/lib $ sudo cp ../C++/runtime/librknn_api/aarch64/librknnrt.so /usr/lib
-$ sudo apt-get install -y python3-dev python3-pip +$ sudo apt update 
-$ sudo apt-get install -y python3-opencv python3-numpy+$ sudo apt install -y python3-dev python3-pip python3-opencv python3-numpy
 $ pip3 install ./wheel/rknn_toolkit_lite2-1.3.0-cp310-cp310-linux_aarch64.whl $ pip3 install ./wheel/rknn_toolkit_lite2-1.3.0-cp310-cp310-linux_aarch64.whl
 ``` ```
Line 55: Line 53:
 done done
 ``` ```
- 
  
 ===== C++ Applications ===== ===== C++ Applications =====
  
-Enter C++ directory,take yolov5 as an example, other demos are similar.+Enter C++ directory, take yolov5 as an example.
  
-```shell +Install dependences.
-$ cd C++ +
-``` +
- +
-Install dependences,+
  
 ```shell ```shell
 +$ sudo apt update
 $ sudo apt install cmake libopencv-dev $ sudo apt install cmake libopencv-dev
 ``` ```
  
-Compile,+Complie and Run
  
 ```shell ```shell
 +# Yolov5
 +# Compile
 $ cd yolov5 $ cd yolov5
-./build.sh +bash build.sh
-```+
  
-Run.+Run 
 +$ cd install/yolov5 
 +./yolov5 data/model/yolov5s-640-640.rknn data/img/bus.jpg
  
-```shell+# Yolov5_cap 
 +# Compile 
 +$ cd yolov5_cap 
 +$ bash build.sh 
 + 
 +# Run
 $ cd install/yolov5 $ cd install/yolov5
-$ ./yolov5 data/model/yolov5s-640-640.rknn data/img/bus.jpg  +$ ./yolov5 data/model/yolov5s-640-640.rknn 33
-post process config: box_conf_threshold = 0.50, nms_threshold = 0.60 +
-Read data/img/bus.jpg ... +
-img width = 640, img height = 640 +
-Loading mode... +
-sdk version: 1.3.0 (c193be371@2022-05-04T20:16:33) driver version: 0.7.2 +
-model input num: 1, output num: 3 +
-  index=0, name=images, n_dims=4, dims=[1, 640, 640, 3], n_elems=1228800, size=1228800, fmt=NHWC, type=INT8, qnt_type=AFFINE, zp=-128, scale=0.003922 +
-  index=0, name=output, n_dims=5, dims=[1, 3, 85, 80], n_elems=1632000, size=1632000, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=77, scale=0.080445 +
-  index=1, name=371, n_dims=5, dims=[1, 3, 85, 40], n_elems=408000, size=408000, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=56, scale=0.080794 +
-  index=2, name=390, n_dims=5, dims=[1, 3, 85, 20], n_elems=102000, size=102000, fmt=UNDEFINED, type=INT8, qnt_type=AFFINE, zp=69, scale=0.081305 +
-model is NHWC input fmt +
-model input height=640, width=640, channel=3 +
-once run use 32.872000 ms +
-loadLabelName ./data/coco_80_labels_list.txt +
-person @ (474 250 559 523) 0.996784 +
-person @ (112 238 208 521) 0.992214 +
-bus @ (99 141 557 445) 0.976798 +
-person @ (211 242 285 509) 0.976798 +
-loop count = 10 , average run  26.577900 ms+
 ``` ```
 +
 +''33'' is the index of camera.
 +
Last modified: 2022/11/16 05:26 by nick