Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim3:npu:npu-app

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
Last revision Both sides next revision
products:sbc:vim3:npu:npu-app [2023/09/12 03:12]
sravan [Table]
products:sbc:vim3:npu:npu-app [2024/01/22 20:31]
louis
Line 18: Line 18:
  
 ===== Source Description ===== ===== Source Description =====
 +==== Base directory ==== 
 +Base directory of the cloned repository.
 ```shell ```shell
 $ cd aml_npu_app $ cd aml_npu_app
Line 24: Line 25:
 DDK_6.3.2  DDK_6.3.2.3  DDK_6.3.2.5  DDK_6.3.3.4  DDK_6.4.0.3  DDK_6.4.3  detect_library  LICENSE  NN_SLT DDK_6.3.2  DDK_6.3.2.3  DDK_6.3.2.5  DDK_6.3.3.4  DDK_6.4.0.3  DDK_6.4.3  detect_library  LICENSE  NN_SLT
 ``` ```
-^ File                ^ Description                                                                                                      +^ File ^ Description ^ 
-**DDK_xx**          | Library source code, xx is the version code                                                                      +| DDK_xx | Library source code, xx is the version code | 
-**detect_library**  | Application layer source code. the detect_library/model_code is linked to the latest version of the DDK library  +| detect_library | Application layer source code. the detect_library/model_code \\ is linked to the latest version of the DDK library | 
-**NN_SLT**          | Separate source code directory for DnCnn model (no longer maintained).                                           +| NN_SLT | Separate source code directory for DnCnn model (no longer maintained). | 
-**LICENSE**         | LICENSE file.                                                                                                    |+| LICENSE | LICENSE file. 
 +                                                                                                |
  
 +==== Detect library ====
 +Directory with various model specific application code.
 ```shell ```shell
 $ cd aml_npu_app/detect_library $ cd aml_npu_app/detect_library
Line 40: Line 44:
 | **model_code**  | Load model and complete pre-processing and post-processing. | | **model_code**  | Load model and complete pre-processing and post-processing. |
 | **source_code** | Provide interfaces for demo to call model_code. | | **source_code** | Provide interfaces for demo to call model_code. |
-| **Other folders** | Load input and visualize the results. |+| **Other folders** | Application source code |
  
-Enter the directory of the library **model_code**, which is the directory of the DDK.+==== Model code ==== 
 +Directory containing all the detection library code.
  
 ```shell ```shell
Line 64: Line 69:
 | **detect_yolov8n** | yolov8n model, for object detection. The latest yolo model. | | **detect_yolov8n** | yolov8n model, for object detection. The latest yolo model. |
 | **facenet** | Deprecated - No longer in use. | | **facenet** | Deprecated - No longer in use. |
- 
  
  
Line 85: Line 89:
  
  
-Enter the directory of the **source_code**.+==== Source code ==== 
 +Directory containing the application library source code
  
 ```shell ```shell
Line 92: Line 97:
 build_vx.sh  detect.c  detect_log.c  include  Makefile  makefile.linux  makefile.linux.def build_vx.sh  detect.c  detect_log.c  include  Makefile  makefile.linux  makefile.linux.def
 ``` ```
- 
-Main content description: 
  
 ^ File ^ Description ^ ^ File ^ Description ^
Line 104: Line 107:
  
  
-Enter the directory of the **yolo_demo_x11_usb**:+Enter the directory of the ''yolo_demo_x11_usb'':
  
 ```shell ```shell
Line 119: Line 122:
 | **makefile.target_name** | The name of the compiled executable. | | **makefile.target_name** | The name of the compiled executable. |
  
-===== Compile and inference =====+===== Compile the application=====
  
 1. Compile the model you want to use from the ''model_code'' directory. Here we shall take ''detect_yolo_v3'' as an example. 1. Compile the model you want to use from the ''model_code'' directory. Here we shall take ''detect_yolo_v3'' as an example.
Line 132: Line 135:
 ``` ```
  
-2. The compiled library ''libnn_yolo_v3.so'' is generated in bin_r folder. Move the library file into the ''/usr/lib'' directory of the system.+2. The compiled library ''libnn_yolo_v3.so'' is generated in ''bin_r'' folder. Add it to the library path variable.
  
 ```shell ```shell
-sudo cp -r bin_r/libnn_yolo_v3.so /usr/lib+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bin_r/libnn_yolo_v3.so
 ``` ```
  
-3. You will also need to build the contents of the ''source_code'' directory and move the library file into ''/usr/lib'' as well.+3. You will also need to build the contents of the ''source_code'' directory.
 ```shell ```shell
 $ cd aml_npu_app/detect_library/source_code $ cd aml_npu_app/detect_library/source_code
Line 146: Line 149:
 $ ls $ ls
 bin_r  build_vx.sh  detect.c  detect_log.c  include  Makefile  makefile.linux  makefile.linux.def bin_r  build_vx.sh  detect.c  detect_log.c  include  Makefile  makefile.linux  makefile.linux.def
-$ sudo cp -r bin_r/libnn_detect.so /usr/lib 
 ``` ```
  
-4. Now, Build the example application+4. The compiled library ''libnn_yolo_v3.so'' is generated in bin_r folder. Add it to the library path variable. 
 + 
 +```shell 
 +$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bin_r/libnn_detect.so 
 +``` 
 + 
 +5. Now, Build the example application.
 ```shell ```shell
 $ cd aml_npu_app/detect_library/yolo_demo_x11_usb $ cd aml_npu_app/detect_library/yolo_demo_x11_usb
Line 159: Line 167:
 ``` ```
  
-5. Create a folder named ''nn_data'' under ''bin_r_cv4'' and place the ''yolov3_88.nb'' model file in it.+<WRAP important > 
 +If you use kernel are using version 5.15 or above, please modify ''makefile.linux'' as follows before running ''build_vx.sh''
 +</WRAP> 
 + 
 +```diff 
 +-#LIBS +=-L$(LIB_DIR) -lstdc++ 
 +-LIBS += -lvpcodec -lamcodec -lamadec -lamvdec -lamavutils -lrt -lpthread -lge2d -lion 
 +``` 
 + 
 +6. Create a folder named ''nn_data'' under ''bin_r_cv4'' and place the ''yolov3_88.nb'' model file in it.
 ```shell ```shell
 $ cd bin_r_cv4 $ cd bin_r_cv4
Line 167: Line 184:
 detect_demo_x11_usb  main.o  nn_data detect_demo_x11_usb  main.o  nn_data
 ``` ```
 +===== Run the application =====
  
-6. Finally you can run inference on captured video data using the model.+Now you can run inference on captured video data using the model.
 ```shell ```shell
 $ ./detect_demo_x11_usb -m 2 -d /dev/video1 $ ./detect_demo_x11_usb -m 2 -d /dev/video1
 ``` ```
-==== Run-time parameters ==== +==== Application setup parameters ==== 
-=== Selecting the model ===+=== Parameter to select the detection model ===
  
 The parameter ''-m'' is for selecting the inference model, Here are the all the available models and their respective serial numbers. The parameter ''-m'' is for selecting the inference model, Here are the all the available models and their respective serial numbers.
Line 189: Line 207:
  
  
-For the above example, we used the serial number ''2'' which corresponds to the yolov3 model.+For the above example, we used the serial number ''2'' which corresponds to the ''yolov3'' model.
  
-=== Providing picture as input ===+=== Parameter to set the input as picture ===
  
-If you use the model that takes input as a picture, change ''-d'' to ''-p''. Here is an example with densenet_ctc.+If you use the model that takes input as a picture, change ''-d'' to ''-p''. Here is an example with ''densenet_ctc''.
 ```shell ```shell
 $ ./densenet_ctc_picture -m 15 -p ../KhadasTeam.png $ ./densenet_ctc_picture -m 15 -p ../KhadasTeam.png
 ``` ```
Last modified: 2024/03/12 05:26 by louis