This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
products:sbc:vim3:npu:npu-app [2023/09/12 02:23] sravan [Compile and inference] |
products:sbc:vim3:npu:npu-app [2024/03/12 05:26] (current) louis |
||
---|---|---|---|
Line 18: | Line 18: | ||
===== Source Description ===== | ===== Source Description ===== | ||
+ | ==== Base directory ==== | ||
+ | Base directory of the cloned repository. | ||
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_app |
$ ls | $ ls | ||
DDK_6.3.2 | DDK_6.3.2 | ||
``` | ``` | ||
+ | ^ File ^ Description ^ | ||
+ | | DDK_xx | Library source code, xx is the version code | | ||
+ | | detect_library | Application layer source code. the detect_library/ | ||
+ | | NN_SLT | Separate source code directory for DnCnn model (no longer maintained). | | ||
+ | | LICENSE | LICENSE file. | | ||
+ | | | ||
- | * **DDK_xxx** - Different versions of library | + | ==== Detect |
- | * **detect_library** - Application layer source | + | Directory with various model specific application |
- | * **NN_SLT** - Separate source code directory for DnCnn model (no longer maintained). | + | |
- | * **LICENSE** - LICENSE file. | + | |
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_app/ |
$ ls | $ ls | ||
densenet_ctc_demo_picture | densenet_ctc_demo_picture | ||
Line 37: | Line 41: | ||
``` | ``` | ||
- | * **model_code** | + | ^ File ^ Description ^ |
- | | + | | **model_code** |
- | | + | | **source_code** |
+ | | **Other folders** | ||
- | Enter the directory of the library | + | ==== Model code ==== |
+ | Directory containing all the detection | ||
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_app/ |
$ ls | $ ls | ||
densenet_ctc | densenet_ctc | ||
Line 52: | Line 58: | ||
Except for '' | Except for '' | ||
- | * **densenet_ctc** | + | ^ File ^ Description ^ |
- | | + | | **densenet_ctc** |
- | | + | | **detect_retinaface** |
- | | + | | **detect_yoloface** |
- | | + | | **detect_yolo_v2** |
- | | + | | **detect_yolo_v3** |
- | | + | | **detect_yolo_v3_tiny** |
- | | + | | **detect_yolo_v4** |
- | | + | | **detect_yolo_v7_tiny** |
- | | + | | **detect_yolov8n** |
+ | | **facenet** | ||
Take '' | Take '' | ||
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_app/ |
$ ls | $ ls | ||
build_vx.sh | build_vx.sh | ||
``` | ``` | ||
- | Main content description: | + | ^ File ^ Description ^ |
+ | | **build_vx.sh** | Compile script. | | ||
+ | | **include** | The corresponding header files and all definitions will be placed in this directory. | | ||
+ | | **Makefile** | Makefile file. | | ||
+ | | **makefile.linux** | Make environment configuration file. | | ||
+ | | **vnn_yolov3.c** | SDK The converted model processing file is mainly used to interface with the nb file. | | ||
+ | | **yolo_v3.c** | Specify the called nb file, and define all the interfaces of the model call. | | ||
+ | | **yolov3_process.c** | Mainly defines the pre-processing and post-processing of the model. | | ||
- | * **build_vx.sh** - Compile script. | ||
- | * **include** - The corresponding header files and all definitions will be placed in this directory. | ||
- | * **Makefile** - Makefile file. | ||
- | * **makefile.linux** - Make environment configuration file. | ||
- | * **vnn_yolov3.c** - SDK The converted model processing file is mainly used to interface with the nb file. | ||
- | * **yolo_v3.c** - Specify the called nb file, and define all the interfaces of the model call. | ||
- | * **yolov3_process.c** - Mainly defines the pre-processing and post-processing of the model. | ||
- | Enter the directory of the **source_code**. | + | ==== Source code ==== |
+ | Directory containing | ||
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_app/ |
$ ls | $ ls | ||
build_vx.sh | build_vx.sh | ||
``` | ``` | ||
- | Main content description: | + | ^ File ^ Description ^ |
+ | | **build_vx.sh** | Compile script. | | ||
+ | | **detect.c** | Provide interface for detect and call model_code. | | ||
+ | | **detect_log.c** | About log level. | | ||
+ | | **include** | The corresponding header files and all definitions will be placed in this directory. | | ||
+ | | **Makefile** | Makefile file. | | ||
+ | | **makefile.linux** | Make environment configuration file. | | ||
- | * **build_vx.sh** - Compile script. | ||
- | * **detect.c** - Provide interface for detect and call model_code. | ||
- | * **detect_log.c** - About log level. | ||
- | * **include** - The corresponding header files and all definitions will be placed in this directory. | ||
- | * **Makefile** - Makefile file. | ||
- | * **makefile.linux** - Make environment configuration file. | ||
- | Enter the directory of the **yolo_demo_x11_usb**. | + | Enter the directory of the '' |
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_app/ |
$ ls | $ ls | ||
build_vx.sh | build_vx.sh | ||
``` | ``` | ||
- | * **build_vx.sh** | + | ^ File ^ Description ^ |
- | | + | | **build_vx.sh** |
- | | + | | **main.cpp** |
- | | + | | **detect.h**, |
- | | + | | **makefile.linux** |
+ | | **makefile.target_name** | ||
- | ===== Compile | + | ===== Compile |
1. Compile the model you want to use from the '' | 1. Compile the model you want to use from the '' | ||
Line 125: | Line 135: | ||
``` | ``` | ||
- | 2. The compiled library '' | + | 2. The compiled library '' |
```shell | ```shell | ||
- | $ sudo cp -r bin_r/ | + | $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: |
``` | ``` | ||
- | 3. You will also need to build the contents of the '' | + | 3. You will also need to build the contents of the '' |
```shell | ```shell | ||
$ cd aml_npu_app/ | $ cd aml_npu_app/ | ||
Line 139: | Line 149: | ||
$ ls | $ ls | ||
bin_r build_vx.sh | bin_r build_vx.sh | ||
- | $ sudo cp -r bin_r/ | ||
``` | ``` | ||
- | 4. Now, Build the example application | + | 4. The compiled library '' |
+ | |||
+ | ```shell | ||
+ | $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: | ||
+ | ``` | ||
+ | |||
+ | 5. Now, Build the example application. | ||
```shell | ```shell | ||
$ cd aml_npu_app/ | $ cd aml_npu_app/ | ||
Line 152: | Line 167: | ||
``` | ``` | ||
- | 5. Create a folder named '' | + | <WRAP important > |
+ | If you use kernel are using version | ||
+ | </ | ||
+ | |||
+ | ```diff | ||
+ | LIBS += -L$(VIVANTE_SDK_LIB) -lOpenVX -lOpenVXU -lGAL -lovxlib -lArchModelSw -lNNArchPerf | ||
+ | |||
+ | LIBS += -L../ | ||
+ | |||
+ | -#LIBS +=-L$(LIB_DIR) -lstdc++ | ||
+ | -LIBS += -lvpcodec -lamcodec -lamadec -lamvdec -lamavutils -lrt -lpthread -lge2d -lion | ||
+ | |||
+ | ############################################################################# | ||
+ | # Macros. | ||
+ | PROGRAM = 1 | ||
+ | CUR_SOURCE = ${wildcard *.c} | ||
+ | ############################################################################# | ||
+ | ``` | ||
+ | |||
+ | 6. Create a folder named '' | ||
```shell | ```shell | ||
$ cd bin_r_cv4 | $ cd bin_r_cv4 | ||
Line 160: | Line 194: | ||
detect_demo_x11_usb | detect_demo_x11_usb | ||
``` | ``` | ||
+ | ===== Run the application ===== | ||
- | 6. Finally | + | Now you can run inference on captured video data using the model. |
```shell | ```shell | ||
$ ./ | $ ./ | ||
``` | ``` | ||
- | ==== Run-time | + | ==== Application setup parameters ==== |
- | === Selecting | + | === Parameter to select |
The parameter '' | The parameter '' | ||
- | * **0** - detect_yoloface | ||
- | * **1** - detect_yolo_v2 | ||
- | * **2** - detect_yolo_v3 | ||
- | * **3** - detect_yolo_v3_tiny | ||
- | * **4** - detect_yolo_v4 | ||
- | * **13** - detect_yolo_v7_tiny | ||
- | * **14** - detect_yolov8n | ||
- | * **15** - densenet_ctc | ||
- | * **16** - detect_retinaface | ||
- | For the above example, we used the serial number '' | + | ^ Index ^ File ^ |
+ | | **0** | detect_yoloface | | ||
+ | | **1** | detect_yolo_v2 | | ||
+ | | **2** | detect_yolo_v3 | | ||
+ | | **3** | detect_yolo_v3_tiny | | ||
+ | | **4** | detect_yolo_v4 | | ||
+ | | **13** | detect_yolo_v7_tiny | | ||
+ | | **14** | detect_yolov8n | | ||
+ | | **15** | densenet_ctc | | ||
+ | | **16** | detect_retinaface | | ||
+ | |||
+ | |||
+ | For the above example, we used the serial number '' | ||
- | === Providing picture as input === | + | === Parameter to set the input as picture |
- | If you use the model that takes input as a picture, change '' | + | If you use the model that takes input as a picture, change '' |
```shell | ```shell | ||
$ ./ | $ ./ | ||
``` | ``` |