Using Intel OpenVINO Pre-Trained Models

Introduction

 
In the last article, we learned what Intel OpenVINO Toolkit is and how to install and configure it on your desired operating system. In this article, we will learn how we can download some pre-trained models to use with Intel OpenVINO to fine-tune and optimize.
 

Intel® OpenVINO® Model Zoo 

 
Intel Architecture Model Zoo is an open-source series of automated machine learning inference software that illustrates how Intel systems produce the most effective outcomes. The software includes more than 20 pre-trained models, benchmarking instructions, best practice guides, and step-by-step tutorials for Intel® Xeon® Scalable Processors to operate Deep Learning ( DL) applications.
 
With the Model Zoo, you can easily,
  • Learn which AI topologies and applications Intel has optimized to run on its hardware
  • Benchmark the performance of optimized models on Intel hardware
  • Get started efficiently running optimized models in the cloud or on bare metal
Intel OpenVINO Model Zoo has two types of Repositories,
  1. Public Model Set
    You can find a complete list of Public models here
  2. Free Model Set
    You can find a complete list of Free models here 
The Free models available can be broadly classified into the following category based on what they are used for,
  1. Object Detection Models
  2. Object Recognition Models
  3. ReIdentification Models
  4. Semantic Segmentation Models
  5. Instance Segmentation Models
  6. Human Pose Estimation Models
  7. Image Processing Models
  8. Text Detection Models
  9. Text Recognition
  10. Text Spotting
  11. Action Recognition Models
  12. Image Retrieval Models
  13. Compressed Models
  14. Question Answering Models
The whole of the model Zoo can be found on either Github or on Intel Website.
 
Just to give a basic idea of what are the terminologies used:
  1. Image Segmentation
    We split or break into separate sections called segments. We can use the appropriate parts for picture processing by splitting the image into segments.
  2. Image Detection
    Through utilizing object recognition models, a bounding box can only be built that fits each class in the image.
  3. Image Localization
    The location of the specific entity is defined in an image.
Machine Learning models can be classified as follows,
  1. SSD ( Single Shot Multibox Detector)
  2. YOLO (You look only once)
  3. Faster R-CNN (Region-based Convolutional Neural Network)
  4. Mobilenet
  5. ResNet (Residual Neural Network)
You can visit to learn in detail about these models. I have tried to give an introduction to these models.
 

Single Short Multibox Detector (SSD)

  1. Single shot
    This means that the task of object localization and classification is done in a single forward pass of the network.

  2. Multibox
    This is the name of the technique for bounding box regressed developed by Szegedy et al

  3. Detector
    The network is an object detector that also classifies those detected objects.
Specific aspect ratios and dimensions per characteristic of the boundary boxes are separated from a collection of default boxes. The network creates scores for each category of an object in each of the default boxes and makes box adjustments to fit the object shape. The network also combines multi-functional map predictions with different resolutions in which objects of different sizes are handled naturally. This fully avoids the generation of the proposal and the resulting resampling process of pixels or functions. The actual research paper can be found here.
 

YOLO (You Only Look Once) 

 
Here we model the identification of events into spatial boundaries and related class probabilities as a regression. A single neural network analyzes items in one test for bounding boxes and class probabilities. Since the whole detection system is one neural network, the detection output may be tuned end-to-end directly. YOLO can process 45 frames/sec. Fast YOLO, a small version of YOLO can process 155 frames/sec. The actual research paper can be found here.
 

Faster R-CNN

 
The Region Proposal Network or RPN is a fully convolutional network that predicts field borders and events at each region simultaneously. Faster R-CNN merges RPN and Fast R-CNN into one network by integrating their convolutional functionality utilizing the recently common neural network terminology and using an attention algorithm, which tells the combined network where to look. RPN has been trained end-to-end to produce top-quality regional ideas, which are being used by Fast R-CNN. The actual research paper can be found here.
 

MobileNet

 
This is built on an innovative design utilizing deeply divided convolutions to build large and lightweight neural networks. The two hyperparameters (latency and precision) allow the model maker to select the right model for their implementations on the basis of the problem's constraints. It is primarily designed for mobiles. The actual research paper can be found here.
 

ResNet 

 
The layers are reformulated as residual functions to benefit from the inputs of the layer rather than unreferenced functions. This uses residual information in "skip layers" and thereby eliminates the issue of "vanishing gradient." The residual layer enables preparation for the very deep neural network. The actual research paper can be found here.
 

Loading Pre-Trained Models

 
So far  we learned about what all pre-trained models are there in the Intel Model Zoo. You are free to use some other models, but to use them you have to convert them to IR form to be able to load into the OpenVINO toolkit. I have already explained how to convert a model into the IR form in the last article.
 
Here I will use 3 different models to show you some variations, namely,
I will be using Windows as base OS, you can use Linux, MAC, or Rasbian as per your wish.
 

Model Downloader

 
To download models from the model zoo, we require a model downloader. A model downloader is a python file that is located in the openvino\deployment_tools\open_model_zoo\tools\downloader. 
 
Syntax of Model Downloader
  1. python downloader.py [-h] [--name PAT[,PAT...]] [--list FILE.LST] [--all]  
  2. [--print_all] [--precisions PREC[,PREC...]] [-o DIR]  
  3. [--cache_dir DIR] [--num_attempts N]  
  4. [--progress_format {text,json}]   
The parameters are as follows:
  1. -h, --help
    show this help message and exit
  2. --name PAT[,PAT...]
    download only models whose names match at least one of the specified patterns
  3. --list FILE.LST
    download only models whose names match at least one of the patterns in the specified file
  4. --all
    download all available models
  5. --print_all
    print all available models
  6. --precisions PREC[,PREC...]]
    download only models with the specified precisions (actual for DLDT networks)
  7. -o DIR, --output_dir DIR
    path where to save models
  8. --cache_dir DIR
    directory to use as a cache for downloaded files
  9. --num_attempts N
    attempt each download up to N times
  10. --progress_format {text,json}
    which format to use for progress reporting
Example
 
Move the OpenVINO directory which contains the model downloader, for me it is 
  1. cd C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\open_model_zoo\tools\downloader    
To download Human Pose estimation model with all 3 precisions and save the model to current directory:
  1. python downloader.py --name human-pose-estimation-0001 -o . 
To download FP16 precision Text detection model and save the model into the current directory:
  1. python ./downloader.py --name text-detection-0004 --precisions FP16 -o .  
To download INT8 precision Vehicle Attributes Recognition model and save the model into the current directory:
  1. python ./downloader.py --name vehicle-attributes-recognition-barrier-0039 --precisions INT8 -o /home/workspace   
Note
the value of '--name' you have to find from the official Intel Model Zoo website.
 
Post downloading you will see that a folder named 'intel' is created, in which you will find the folder by the name of the model. Verify your download by finding if the model folder has both '.xml' and '.bin' file. 
 

Conclusion

 
In this article, we had a look at how to download some pre-trained models. In the next article, I will tell you how we can create a simple application with the help of these pre-trained downloaded models.


Similar Articles