Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim3:npu:npu-prebuilt-demo-usage

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:vim3:npu:npu-prebuilt-demo-usage [2022/09/15 23:48]
ivan
products:sbc:vim3:npu:npu-prebuilt-demo-usage [2023/09/11 09:58] (current)
hyphop
Line 1: Line 1:
 +~~tag>VIM3 VIM3L Amlogic NPU OpenCV Inception YOLO~~
 +
 ====== NPU Prebuilt Demo Usage ====== ====== NPU Prebuilt Demo Usage ======
-<WRAP tip +Prebuilt example demos for interacting with the Amlogic NPU using OpenCV4 
-  - Please follow this docs to upgrade the system to latest version before run any NPU demos. + 
-  - Just support Opencv4+===== Install OpenCV4 ===== 
 +Update your system and install the OpenCV packages. 
 +```shell 
 +$ sudo apt update 
 +$ sudo apt install libopencv-dev python3-opencv 
 +``` 
 + 
 +===== Get NPU Demo ===== 
 + 
 +/* 
 +<WRAP important 
 +The NPU Demo is not installed on the board by default. You need to download it from GitHub first.
 </WRAP> </WRAP>
 +*/
  
-===== install OpenCV4 =====+Get the demo source: [[gh>khadas/aml_npu_demo_binaries]] 
 +  
 +```shell 
 +$ git clone --recursive https://github.com/khadas/aml_npu_demo_binaries 
 +```
  
-```sh Install-OpenCV4.sh +The NPU demo contains three examples: 
-sudo apt install libopencv-dev python3-opencv+ 
 +  ''detect_demo'' - A collection of ''yolo'' series models for camera dynamic recognition
 +  ''detect_demo_picture'' A collection of ''yolo'' series models that identify pictures. 
 +  - ''inceptionv3'' -  Identify the inception model of the picture. 
 + 
 +===== Inception Model ===== 
 +The inception model does not have any library dependencies and can be used as is. 
 + 
 + 
 +Enter the ''inceptionv3'' directory. 
 + 
 +```shell 
 +$ cd aml_npu_demo_binaries/inceptionv3 
 +$ ls 
 +dog_299x299.jpg  goldfish_299x299.jpg  imagenet_slim_labels.txt  VIM3  VIM3L
 ``` ```
  
-===== Get NPU Demo =====+''imagenet_slim_labels.txt'' is a label file. After the result is identified, the label corresponding to the result can be queried in this file.
  
 <WRAP tip > <WRAP tip >
-   NPU Demo is not installed on the board by defaultYou need to download it from github first+Depending on your board, enter the VIM3 or VIM3L directory accordingly. Here is the VIM3 as an example.
 </WRAP> </WRAP>
  
-   * Unordered List ItemClone to the board through the git command.+```shell 
 +$ ls aml_npu_demo_binaries/inceptionv3/VIM3 
 +$ inceptionv3  inception_v3.nb  run.sh   
 +$ cd aml_npu_demo_binaries/inceptionv3/VIM3 
 +$ ./run.sh 
 +Create Neural Network: 59ms or 59022us 
 +Verify... 
 +Verify Graph: 0ms or 739us 
 +Start run graph [1] times... 
 +Run the 1 time: 20.00ms or 20497.00us 
 +vxProcessGraph execution time: 
 +Total   20.00ms or 20540.00us 
 +Average 20.54ms or 20540.00us 
 +--- Top5 --- 
 +2: 0.833984 
 +795: 0.009102 
 +974: 0.003592 
 +408: 0.002207 
 +393: 0.002111 
 +```
    
 +<WRAP Info>  
 +  
 +By querying ''imagenet_slim_labels.txt'', the result is a goldfish, which is also correctly identified. You can use the method above to identify other images.
  
-```sh get-npu-demo-from-demo.sh +</WRAP> 
- cd {workspace} + 
- git clone --recursive https://github.com/khadas/aml_npu_demo_binaries+===== Yolo Series Model ===== 
 + 
 +==== Install and uninstall libraries ==== 
 + 
 +The yolo series models need to install the library into the system. Both the ''detect_demo'' and ''detect_demo_picture'' examples require this procedure. 
 + 
 +You can follow the steps to either install or uninstall the libraries. 
 + 
 +Install libraries: 
 + 
 +```shell 
 +cd aml_npu_demo_binaries/detect_demo_picture 
 +$ sudo ./INSTALL
 ``` ```
-   * Unordered List ItemOr download the compressed package directly, and then unzip it to the board.  
  
-There are three directories in NPU Demo:+Uninstall libraries:
  
-<tabbox detect_demo> +```shell 
-    - detect_demo: A collection of yolo series models for camera dynamic recognition. +$ cd aml_npu_demo_binaries/detect_demo_picture 
-<tabbox detect_demo_picture> +$ sudo ./UNINSTALL 
-    - detect_demo_picture: A collection of yolo series models that identify pictures+```
-<tabbox inceptionv3> +
-    - inceptionv3: Identify the inception model of the picture +
-</tabbox>+
  
 +==== Type Parameter Description ====
  
 +<WRAP important >
 +The type parameter is an input parameter that must be selected whether it is to use camera dynamic recognition or to recognize pictures. This parameter is mainly used to specify the running YOLO series model.
 +</WRAP>
  
 +```shell
 +0 : yoloface model
 +1 : yolov2 model
 +2 : yolov3 model
 +3 : yolov3_tiny model
 +4 : yolov4 model
 +```
 + 
 +==== Operating Environment for NPU demo ====
 +  
 +NPU Demo can run in X11 Desktop or framebuffer mode, just select the corresponding demo to run.
 +
 +    - The demo with fb is running in framebuffer mode.
 +    - The demo with x11 is running in X11 mode.
 +
 +==== Demo examples ====
 +=== detect_demo_picture ===
 +
 +```shell
 +$ cd aml_npu_demo_binaries/detect_demo_picture
 +$ ls 
 +1080p.bmp  detect_demo_x11  detect_demo_fb  INSTALL  lib  nn_data  README.md  UNINSTALL
 +```
 +== Run ==
 +
 +Command format of the picture.
 +
 +```shell
 +$ cd aml_npu_demo_binaries/detect_demo_picture
 +$ ./detect_demo_xx -m <type parameter> -p <picture_path>
 +```
 +
 +Here is an example of using OpenCV4 to call the ''yolov3'' model to recognize pictures under ''x11''.
 +
 +```shell
 +$ cd aml_npu_demo_binaries/detect_demo_picture
 +$ ./detect_demo_x11 -m 2 -p 1080p.bmp
 +```
 +
 +The results of the operation are as follows.
 +
 +{{:products:sbc:vim3:npu:detect-demo-picture-x11-cv4.png?1000|detect-picture}}
 +
 +=== detect_demo ===
 +
 +<WRAP tip >
 +You should use the demo of usb to use the USB camera, and the demo of mipi to use the mipi camera.
 +</WRAP>
 +
 +== Run ==
 +Command format for camera dynamic recognition.
 +
 +```shell
 +$ cd aml_npu_demo_binaries/detect_demo
 +$ ./detect_xx_xx -d <video node> -m <type parameter>
 +```
 + 
 +Here is an example of using OpenCV4 to call ''yolov3'' in the ''x11'' environment using a USB camera.
 +```shell
 +$ cd aml_npu_demo_binaries/detect_demo
 +$ ./detect_demo_x11_usb -d /dev/video1 -m 2
 +```
 +
 +<WRAP info >
 +After turning on the camera, the recognition result will be displayed on the screen.
 +</WRAP>
  
 +{{:products:sbc:vim3:npu:start:detect-demo-picture-x11-cv4.webp?1000 |detect}}
Last modified: 2022/09/15 23:48 by ivan