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/11/11 03:38]
nick
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. +
-</WRAP>+
  
 ===== Install OpenCV4 ===== ===== Install OpenCV4 =====
 +Update your system and install the OpenCV packages.
 ```shell ```shell
 +$ sudo apt update
 $ sudo apt install libopencv-dev python3-opencv $ sudo apt install libopencv-dev python3-opencv
 ``` ```
Line 13: Line 13:
 ===== Get NPU Demo ===== ===== Get NPU Demo =====
  
-<WRAP tip +/* 
-NPU Demo is not installed on the board by default. You need to download it from github first.+<WRAP important 
 +The NPU Demo is not installed on the board by default. You need to download it from GitHub first.
 </WRAP> </WRAP>
 +*/
  
-1. Clone to the board through the git command.+Get the demo source: [[gh>khadas/aml_npu_demo_binaries]]
    
 ```shell ```shell
-$ cd {workspace} 
 $ git clone --recursive https://github.com/khadas/aml_npu_demo_binaries $ git clone --recursive https://github.com/khadas/aml_npu_demo_binaries
 ``` ```
  
-2. Or download the compressed package directly, and then unzip it to the board. +The NPU demo contains three examples:
  
-There are three directories in NPU Demo: +  - ''detect_demo'' A collection of ''yolo'' series models for camera dynamic recognition. 
- +  - ''detect_demo_picture'' A collection of ''yolo'' series models that identify pictures. 
-  - ''detect_demo''A collection of yolo series models for camera dynamic recognition. +  - ''inceptionv3'' -  Identify the inception model of the picture.
-  - ''detect_demo_picture''A collection of yolo series models that identify pictures. +
-  - ''inceptionv3''Identify the inception model of the picture.+
  
 ===== Inception Model ===== ===== Inception Model =====
 +The inception model does not have any library dependencies and can be used as is.
  
-The inception model does not need to install any libraries into the system. Enter the ''inceptionv3'' directory+ 
-''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.+Enter the ''inceptionv3'' directory.
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/inceptionv3+$ cd aml_npu_demo_binaries/inceptionv3
 $ ls $ ls
 dog_299x299.jpg  goldfish_299x299.jpg  imagenet_slim_labels.txt  VIM3  VIM3L dog_299x299.jpg  goldfish_299x299.jpg  imagenet_slim_labels.txt  VIM3  VIM3L
 ``` ```
  
-<WRAP important +''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. 
-If your board is VIM3, enter the VIM3 directory, if it is VIM3L, then enter the VIM3L directory. Here is VIM3 as an example.+ 
 +<WRAP tip 
 +Depending on your board, enter the VIM3 or VIM3L directory accordingly. Here is the VIM3 as an example.
 </WRAP> </WRAP>
  
 ```shell ```shell
-$ ls {workspace}/aml_npu_demo_binaries/inceptionv3/VIM3+$ ls aml_npu_demo_binaries/inceptionv3/VIM3
 $ inceptionv3  inception_v3.nb  run.sh   $ inceptionv3  inception_v3.nb  run.sh  
-$ cd {workspace}/aml_npu_demo_binaries/inceptionv3/VIM3+$ cd aml_npu_demo_binaries/inceptionv3/VIM3
 $ ./run.sh $ ./run.sh
 Create Neural Network: 59ms or 59022us Create Neural Network: 59ms or 59022us
Line 70: Line 72:
 <WRAP Info>   <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.+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.
  
 </WRAP> </WRAP>
Line 76: Line 78:
 ===== Yolo Series Model ===== ===== Yolo Series Model =====
  
-==== Preparation ====+==== Install and uninstall libraries ====
  
-The application of the yolo series model is divided into two parts: camera dynamic recognition and image recognition.+The yolo series models need to install the library into the system. Both the ''detect_demo'' and ''detect_demo_picture'' examples require this procedure.
  
-==== Install and uninstall libraries ==== +You can follow the steps to either install or uninstall the libraries.
- +
-The yolo series models need to install the library into the system. Whether it is using the camera to dynamically recognize or recognize pictures, they share the same library.+
  
-1. Install:+Install libraries:
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo_picture+$ cd aml_npu_demo_binaries/detect_demo_picture
 $ sudo ./INSTALL $ sudo ./INSTALL
 ``` ```
  
-2. Uninstall:+Uninstall libraries:
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo_picture+$ cd aml_npu_demo_binaries/detect_demo_picture
 $ sudo ./UNINSTALL $ sudo ./UNINSTALL
 ``` ```
Line 101: Line 101:
  
 <WRAP important > <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.+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> </WRAP>
  
Line 112: Line 112:
 ``` ```
    
-==== Operating Environment Description ====+==== Operating Environment for NPU demo ====
      
-NPU Demo can run in X11 or framebuffer mode, just select the corresponding demo to run.+NPU Demo can run in X11 Desktop or framebuffer mode, just select the corresponding demo to run.
  
-=== X11 / Framebuffer ===+    - The demo with fb is running in framebuffer mode. 
 +    - The demo with x11 is running in X11 mode.
  
-  - The demo with fb is running in framebuffer mode. +==== Demo examples ==== 
-  - The demo with x11 is running in X11 mode. +=== detect_demo_picture ===
- +
-==== Illustrative Example ==== +
- +
-Here is an example of detect_demo_picture,+
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo_picture+$ cd aml_npu_demo_binaries/detect_demo_picture
 $ ls  $ ls 
-1080p.bmp  detect_demo_x11  detect_demo_xfb  INSTALL  lib  nn_data  README.md  UNINSTALL+1080p.bmp  detect_demo_x11  detect_demo_fb  INSTALL  lib  nn_data  README.md  UNINSTALL
 ``` ```
 +== Run ==
  
-<WRAP tip > +Command format of the picture.
-      - ''detect_demo_fb'' It is a demo that uses opencv4 recognition pictures running under ''framebuffer''+
-      - ''detect_demo_x11'' It is a demo that uses opencv4 recognition pictures running under ''X11''+
-</WRAP> +
- +
-==== Run ==== +
- +
-Identify the command format of the picture.+
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo_picture +$ cd aml_npu_demo_binaries/detect_demo_picture 
-$ ./detect_demo_xx -m <type> -p <picture_path>+$ ./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''.+Here is an example of using OpenCV4 to call the ''yolov3'' model to recognize pictures under ''x11''.
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo_picture +$ cd aml_npu_demo_binaries/detect_demo_picture 
-$ ./detect_demo_fb 2 1080p.bmp+$ ./detect_demo_x11 -m -p 1080p.bmp
 ``` ```
  
Line 156: Line 147:
 {{:products:sbc:vim3:npu:detect-demo-picture-x11-cv4.png?1000|detect-picture}} {{:products:sbc:vim3:npu:detect-demo-picture-x11-cv4.png?1000|detect-picture}}
  
 +=== detect_demo ===
  
-<WRAP Info >+<WRAP tip >
 You should use the demo of usb to use the USB camera, and the demo of mipi to use the mipi camera. You should use the demo of usb to use the USB camera, and the demo of mipi to use the mipi camera.
 </WRAP> </WRAP>
  
 +== Run ==
 Command format for camera dynamic recognition. Command format for camera dynamic recognition.
  
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo +$ cd aml_npu_demo_binaries/detect_demo 
-$ ./detect_xx_xx -d <video node> -m <type>+$ ./detect_xx_xx -d <video node> -m <type parameter>
 ``` ```
    
-Here is an example of using opencv4 to call yolov3 in the ''x11'' environment. +Here is an example of using OpenCV4 to call ''yolov3'' in the ''x11'' environment using a USB camera.
 ```shell ```shell
-$ cd {workspace}/aml_npu_demo_binaries/detect_demo+$ cd aml_npu_demo_binaries/detect_demo
 $ ./detect_demo_x11_usb -d /dev/video1 -m 2 $ ./detect_demo_x11_usb -d /dev/video1 -m 2
 ``` ```
  
-<WRAP tip >+<WRAP info >
 After turning on the camera, the recognition result will be displayed on the screen. After turning on the camera, the recognition result will be displayed on the screen.
 </WRAP> </WRAP>
  
 {{:products:sbc:vim3:npu:start:detect-demo-picture-x11-cv4.webp?1000 |detect}} {{:products:sbc:vim3:npu:start:detect-demo-picture-x11-cv4.webp?1000 |detect}}
Last modified: 2022/11/11 03:38 by nick