This shows you the differences between two versions of the page.
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> | ||
+ | |||
====== 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:// | + | Clone the source code form our [[gh>khadas/ |
```shell | ```shell | ||
Line 27: | Line 25: | ||
```shell | ```shell | ||
$ sudo cp ../ | $ sudo cp ../ | ||
- | $ 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 ./ | $ pip3 install ./ | ||
``` | ``` | ||
Line 55: | Line 53: | ||
done | done | ||
``` | ``` | ||
- | |||
===== C++ Applications ===== | ===== C++ Applications ===== | ||
- | Enter C++ directory, | + | 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 data/ | ||
- | ```shell | + | # Yolov5_cap |
+ | # Compile | ||
+ | $ cd yolov5_cap | ||
+ | $ bash build.sh | ||
+ | |||
+ | # Run | ||
$ cd install/ | $ cd install/ | ||
- | $ ./yolov5 data/ | + | $ ./yolov5 data/ |
- | post process config: box_conf_threshold = 0.50, nms_threshold = 0.60 | + | |
- | Read data/ | + | |
- | img width = 640, img height = 640 | + | |
- | Loading mode... | + | |
- | sdk version: 1.3.0 (c193be371@2022-05-04T20: | + | |
- | model input num: 1, output num: 3 | + | |
- | index=0, name=images, | + | |
- | index=0, name=output, | + | |
- | index=1, name=371, n_dims=5, dims=[1, 3, 85, 40], n_elems=408000, | + | |
- | index=2, name=390, n_dims=5, dims=[1, 3, 85, 20], n_elems=102000, | + | |
- | model is NHWC input fmt | + | |
- | model input height=640, width=640, channel=3 | + | |
- | once run use 32.872000 ms | + | |
- | loadLabelName ./ | + | |
- | 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 | + | |
``` | ``` | ||
+ | |||
+ | '' | ||
+ |