yuv_dnn_app

 

Table of contents


 

Introduction


This explanation assumes that the i-PRO camera application development environment has been completed.
If you are not ready to build the development environment, please refer to here to complete it.

Also, in this tutorial, the SDK installation directory is described as ${SDK_DIR}.

Operation overview


yuv_dnn_app is a sample application that infers the model on the camera and outputs the results.

 

External libraries required for operation


No special mention.

 

Directory path of the sample app


The C/C++ source code is stored below.

${SDK_DIR}/src/adamapp/yuv_dnn_app

The Python source code is stored below.

${SDK_DIR}/src/adamapp-py/yuv_dnn_app

 

Use of AI model conversion tool


Before building the sample app, you need to use the AI model conversion tool.

The yuv_dnn_app sample application has the following files, so you can check the operation without using the AI model conversion tool.

[For ambaCV2X app]
${SDK_DIR}/src/adamapp/yuv_dnn_app/data_CV2X/cnn/mobilenet_cavalry.bin
[For ambaCV5X app]
${SDK_DIR}/src/adamapp/yuv_dnn_app/data_CV5X/cnn/mobilenet_cavalry.bin

Get the AI model conversion tool from below and build the environment.

AI model convert tool - Technology Partner FAQ (En) - Confluence (atlassian.net)

It may take several days from the time you make an inquiry to the time it is provided.

 After building the environment, refer to the following and convert the sample model.

AI model convert tool: Caffe - Technology Partner FAQ (En) - Confluence (atlassian.net)

 

How to build the sample app (C/C++)


Load the build environment settings file in the SDK installation directory.

$ cd ${SDK_DIR} $ source setup_env.sh ipro-ambaCV2X

Set the build environment according to each environment.
Here, specify ipro-ambaCV2X.

 

Next, place the model-converted mobilenet_cavalry.bin file in the sample app directory with the following configuration.

[For ambaCV2X app]
${SDK_DIR}/src/adamapp/yuv_dnn_app/data_CV2X/cnn/mobilenet_cavalry.bin
[For ambaCV5X app]
${SDK_DIR}/src/adamapp/yuv_dnn_app/data_CV5X/cnn/mobilenet_cavalry.bin

 

make.

$ cd src/adamapp/yuv_dnn_app $ make

It is successful if the .ext file is created in ${SDK_DIR}/src/adamapp/yuv_dnn_app.

 

Install it on the camera (eg, you can install from the green frame in the image below). Select the created .ext file and install it.
Open the app screen (red frame button in the image below).

 

If the image of the camera is displayed, it is successful.

 

How to build the sample app (Python)


Load the build environment settings file in the SDK installation directory.

$ cd ${SDK_DIR} $ source setup_env.sh ipro-ambaCV2X

 

Next, place the model-converted mobilenet_cavalry.bin file in the sample app directory with the following configuration.

[For ambaCV2X app]
${SDK_DIR}/src/adamapp/yuv_dnn_app/data_CV2X/cnn/mobilenet_cavalry.bin
[For ambaCV5X app]
${SDK_DIR}/src/adamapp/yuv_dnn_app/data_CV5X/cnn/mobilenet_cavalry.bin

 

make.

It is successful if the .ext file is created in ${SDK_DIR}/src/adamapp-py/yuv_dnn_app.

 

Install it on the camera (eg, you can install from the green frame in the image below). Select the created .ext file and install it.
Open the app screen (red frame button in the image below).

 

If the image of the camera is displayed, it is successful.

 

How to use the sample app


The name of the dog breed such as Toy_poodle is displayed on the upper left of the screen. When you show an image of a dog on the camera, you can see that the number of the corresponding dog breed increases. Try it yourself.

 

Appendix


How to change preferences

This application has some preferneces which a user is able to change.
When changing some preferneces, push "AppPrefs" button in "ADAM OPERATION UI" html page.

Resoultion:
Resolution to get YUV images. Specfify HD(1280x720) or FHD(1920x1080).
However, by the ability of the camera, it may not work with the specified value.

Frame rate:
Frame rate to get YUV images. Specify 1 or more.
However, by the ability of the camera, it may not work with the specified value.

 

How to change AI model

  1. Please replace
    data_CV2X/cnn/mobilenetv1_ssd_cavalry.bin
    data_CV5X/cnn/mobilenetv1_ssd_cavalry.bin
    and
    data_CV2X/cnn/mobilenet_priorbox_fp32.bin
    data_CV5X/cnn/mobilenet_priorbox_fp32.bin
    with your model.

  2. Please change the following part of main.cpp according to your model.
    #define OUTSIZE_HEIGHT<Input height of your model>
    #define OUTSIZE_WIDTH<Input width of your model>

    #define NETNAME<File name of your model>
    #define PRIORBOXFILE<File name of prior box>
    #define LAYERNAMEIN<Input layer name of your model>
    #define LAYERNAMEOUT_MBOX_LOC<Output layer name of your model to indicate boundary box location>
    #define LAYERNAMEOUT_MBOX_CONF_FLATTEN<Output layer name of your model to indicate boundary box confidence>
    #define PROPERTY_NUMCLASSES<Number of classes including background label>
    #define PROPERTY_MBOXLOCSIZE<Number of boundary boxes * 4> : 4 means (x,y,w,h)
    #define PROPERTY_BACKGROUND_LABEL_ID<Background label id>

    Following parameters are valid only for tensorflow SSD. For caffe SSD, please set these values to 0.
    #define X_SCALE<X scale value>
    #define Y_SCALE<Y scale value>
    #define WIDTH_SCALE<Width scale value>
    #define HEIGHT_SCALE<Height scale value>

  3. Please describe "objectname" (label-objectname matrix) according to your model.

 

Port in use

This application uses 8082 port for websocket communication.