OpenNCC SDK installation

Please install the SDK development environment according to documentation. Such as:

  • We use Linux for a demo, other platforms are also well supported by OpenNCC.

If you still don't have an SDK, you could clone it from github openncc

  • To use Model Optimizer and BLOB Converter, please make sure the OpenVINO ToolKit is already installed. You could download the OpenVINO here. And MUST choose the 2020 3 LTS version which was comprehensively tested with OpenNCC.
  • If you want to download a model from Open Model Zoo, you need Model Downloader. Or you could also download it from the website.

Steps of deployment a deep learning model on edge

The following figure shows a complete AI model development process: 

If we start with an existing model, the steps are simplified as follows:

Step1: Prepare a trained model

Use the Open Model Zoo to find open-source, pre-trained, and preoptimized models ready for inference, or use your own deep-learning model.

Download a model from open model zoo,like:

  • $./ --name person-detection-retail-0002
  • Note: The OpenNCC supports FP16 format, please use the FP16 model.

Step2: Model Optimizer

Run the trained model through the Model Optimizer to convert the model to an Intermediate Representation (IR), which is represented in a pair of files (.xml and .bin). These files describe the network topology and contain the weights and biased binary data of the model.

  • If you download the model from Open model zoo, it is already IR files. So we don't need to run a model optimizer.
  • If you use your own model, you need to run a model optimizer, please follow the Model Optimizer Developer Guide.

Step3: Convert to BLOB format

After the model optimization is completed, which means you already have two files(.xml and .bin), the model needs to be converted to the Blob format before it can be deployed on OpenNCC.

You need to run the myriad_compile tool to packet the IR files to a BLOB file, the openncc using the blob file to inference the model.

  • Example:

$ ./myriad_compile -m input_xxx-fp16.xml -o output_xxx.blob -VPU_PLATFORM VPU_2480 -VPU_NUMBER_OF_SHAVES 8 -VPU_NUMBER_OF_CMX_SLICES 8

  • Note:

The myriad_compile is a tool of OpenVINO ToolKit, you need to install the openvino on your development host. The tool under:


Step4: Inference on OpenNCC and extract the results

Use the OpenNCC SDK to download the BLOB file, run inference, and output results on OpenNCC Cameras.

The OpenNCC SDK would output two types of streams:

* Normal video stream, support YUV420, YUV422,MJPG, H.264, and H.265

* AI-Meta data stream is the binary results by inference with frame-based data. The specific output structure depends on the model running on OpenNCC.Take the person-detection-retail-0002 model as an example:

  • Outputs:

The net outputs "detection_output" blob with shape: [1x1xNx7], where N is the number of detected pedestrians. For each detection, the description has the format: [image_id, label, conf, x_min, y_min, x_max, y_max], where:

image_id - ID of the image in batch

label - ID of predicted class

conf - Confidence for the predicted class

(x_min, y_min) - Coordinates of the top left bounding box corner

(x_max, y_max) - Coordinates of the bottom right bounding box corner.

So the AI-Meta frame you get from SDK would be this:

Demo and Running

1. Enter 'YOUR OPENNCC SDK INSTALL PATH'/Platform/Linux/Example/How_to/Load_a_model

2. Copy all the related files from SDK to this demo.

$ ./  

3. Download the BLOB model file.

In the main.cpp, ........ //5.2 Image preprocessing parameter initialization cam_info.inputDimWidth = 300; cam_info.inputDimHeight = 300; cam_info.inputFormat = IMG_FORMAT_BGR_PLANAR; cam_info.meanValue[0] = 0; cam_info.meanValue[1] = 0; cam_info.meanValue[2]...
Read more »