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,
- Public Model Set
You can find a complete list of Public models
here.
- 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,
- Object Detection Models
- Object Recognition Models
- ReIdentification Models
- Semantic Segmentation Models
- Instance Segmentation Models
- Human Pose Estimation Models
- Image Processing Models
- Text Detection Models
- Text Recognition
- Text Spotting
- Action Recognition Models
- Image Retrieval Models
- Compressed Models
- Question Answering Models
Just to give a basic idea of what are the terminologies used:
- 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.
- Image Detection
Through utilizing object recognition models, a bounding box can only be built that fits each class in the image.
- Image Localization
The location of the specific entity is defined in an image.
Machine Learning models can be classified as follows,
- SSD ( Single Shot Multibox Detector)
- YOLO (You look only once)
- Faster R-CNN (Region-based Convolutional Neural Network)
- Mobilenet
- 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)
- Single shot
This means that the task of object localization and classification is done in a single forward pass of the network.
- Multibox
This is the name of the technique for bounding box regressed developed by Szegedy et al
- 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
- python downloader.py [-h] [--name PAT[,PAT...]] [--list FILE.LST] [--all]
- [--print_all] [--precisions PREC[,PREC...]] [-o DIR]
- [--cache_dir DIR] [--num_attempts N]
- [--progress_format {text,json}]
The parameters are as follows:
- -h, --help
show this help message and exit
- --name PAT[,PAT...]
download only models whose names match at least one of the specified patterns
- --list FILE.LST
download only models whose names match at least one of the patterns in the specified file
- --all
download all available models
- --print_all
print all available models
- --precisions PREC[,PREC...]]
download only models with the specified precisions (actual for DLDT networks)
- -o DIR, --output_dir DIR
path where to save models
- --cache_dir DIR
directory to use as a cache for downloaded files
- --num_attempts N
attempt each download up to N times
- --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
- 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:
- python downloader.py --name human-pose-estimation-0001 -o .
To download FP16 precision Text detection model and save the model into the current directory:
- 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:
- 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.