Deep learning openvino pre-training model test

0 background

In " Deep Learning Win10 Installation and Configuration Openvino ", we introduced the installation method of openvino. This article introduces the use of the next step.

1 Model introduction

openvino provides a series of pre-training models, including intel pre-training models and public pre-training models, covering common tasks such as target detection, semantic segmentation, and instance segmentation.

With the update of different versions, the pre-training models provided are becoming more and more abundant.

For the pre-training model provided by intel, we can directly call it in openvino, while for the public pre-training model, a conversion process is required. This article gives a detailed introduction to the application methods of these two types of models.

1.1 Intel pre-training model

1.2 Public pre-training model

2 intel pre-training model test

2.1 Model introduction

We take the semantic segmentation model as an example to test  the unet-camvid-onnx-0001  model in Semantic Segmentation Models . As you can see from the name, this is an unet model trained on the camvid dataset. The data set contains 12 categories, namely Sky, Building, Pole, Road, Pavement, Tree, SignSymbol, Fence, Vehicle, Pedestrian, Bike, Unlabeled.

The performance of the model is as follows. You can choose a model that meets your needs by comparing the parameters and accuracy of different models, such as pursuing speed, choosing a model with fewer parameters, pursuing accuracy, and choosing a model with high mIou.

indexvalue
GFlops260.1
MParams31.03
Source FrameworkPyTorch
mIou71.95%

Enter information:

Image, shape-  1,3,368,480, format is  B,C,H,W where:

  • B -batch size
  • C -channel
  • H -height
  • W -width

Channel order is BGR

Output information:

Semantic segmentation class probabilities map, shape- 1,12,368,480, output data format is  B,C,H,W where:

  • B -batch size
  • C -predicted probabilities of input pixel belonging to class  C in the [0, 1] range
  • H -horizontal coordinate of the input pixel
  • W -vertical coordinate of the input pixel

2.2 Model download

After understanding the basic situation of the model, we download the model for testing. In the SDK C:\Program Files (x86)\IntelSWTools\openvino_2020.3.355\deployment_tools\tools\model_downloader path, the model download script downloader.py is included

Let's check how to use this script in cmd or powershell terminal

As you can see, you only need to specify the model name. The downloaded model path is C:\Program Files (x86)\IntelSWTools\openvino_2020.3.355\deployment_tools\tools\model_downloader\intel\unet-camvid-onnx-0001

2.3 Project compilation

In the SDK, a series of Demos are provided to realize the detection of different functions, mainly in C++, and part of the python code. The path is located at C:\Program Files (x86)\IntelSWTools\openvino_2020.3.355\deployment_tools\open_model_zoo\demos

Run build_demos_msvc.bat in the terminal, you can process these demos in batches, and generate project files under the path C:\Users\ZONGXP\Documents\Intel\OpenVINO\omz_demos_build ( look up according to your user name )

The executable file we want to use is generated in intel64/Release, including segmentation_demo.exe

2.3 Engineering test

Check the usage method in the terminal, you can see that you need to specify the input image to be processed, and the model path

We use a photo in the camVID dataset for testing and specify the unet pre-trained model just downloaded

operation result

Note that the code runs on the CPU by default. If you want to use a hashrate or GPU device, use the -d command to specify

It can be seen that in my test environment, the computing power of the Hashbar is not as good as the CPU of the notebook, indicating that this device is suitable for use on devices with weaker CPUs to have an acceleration effect.

3 public pre-training model

emm... I suddenly discovered that the version of openvino I used is a bit low, Version 2020.3, which is not classified according to the method I said, that is, to distinguish between intel and public, so this article is here first, and I have time to upgrade the version before doing it. Further test

4 Reference