Model Downloader and other automation tools¶
Open Model Zoo automation tools contain scripts that automate certain model-related tasks based on configuration files in the models’ directories.
Model Downloader:
omz_downloader
downloads model files from online sources and, if necessary, patches them to make them more usable with Model Optimizer;Model Converter:
omz_converter
converts the models that are not in the OpenVINO™ IR format into that format using Model Optimizer.Model Information Dumper:
omz_info_dumper
prints information about the models in a stable machine-readable format.Datasets’ Data Downloader:
omz_data_downloader
copies datasets’ data from installed location.
Please use these tools instead of attempting to parse the configuration files directly. Their format is undocumented and may change in incompatible ways in future releases.
Tip
You also can work with the Model Downloader inside the OpenVINO™ Deep Learning Workbench (DL Workbench). DL Workbench is a platform built upon OpenVINO™ and provides a web-based graphical environment that enables you to optimize, fine-tune, analyze, visualize, and compare performance of deep learning models on various Intel® architecture configurations. In the DL Workbench, you can use most of OpenVINO™ toolkit components.
Proceed to an easy installation from Docker to get started.
Installation¶
Model Downloader and other automation tools can be installed as part of the OpenVINO™ Development Tools Python package or from source if you need the latest changes. To install the tools from the package, go to the OpenVINO™ Development Tools PyPI page and follow the instructions.
To install the tools from source:
Install Python (version 3.6 or higher), setuptools :
Install openvino-dev Python* package to obtain Model Optimizer and Post-Training Optimization Toolkit:
pip install openvino-dev
Note
openvino-dev version should be the same as OMZ Tools. For example, if you are using OMZ Tools for 2021.4.2 then install openvino-dev==2021.4.2.
Install the
omz-tools
with the following command:
# Navigate to the open_model_zoo/tools/model_tools directory
pip install --upgrade pip
pip install .
Note
On Linux and macOS, you may need to type python3
instead of python
. You may also need to install pip. For example, on Ubuntu execute the following command to get pip installed: sudo apt install python3-pip
. If you are using pip version lower than 21.3, you also need to set OMZ_ROOT variable: export OMZ_ROOT=<omz_dir>
To convert models from certain frameworks, you may also need to install additional dependencies.
python -mpip install --user -r ./requirements-pytorch.in
python -mpip install --user -r ./requirements-tensorflow.in
Model Downloader Usage¶
The basic usage is to run the script like this:
omz_downloader --all
This will download all models. The --all
option can be replaced with other filter options to download only a subset of models. See the “Shared options” section.
Model Downloader Starting Parameters¶
See the “Shared options” section for information on other options accepted by the script.
JSON Progress Report Format¶
This section documents the format of the progress report produced by the script when the --progress_format=json
option is specified.
The report consists of a sequence of events, where each event is represented by a line containing a JSON-encoded object. Each event has a member with the name $type
whose value determines the type of the event, as well as which additional members it contains.
The following event types are currently defined:
Event type |
Additional members |
Explanation |
---|---|---|
|
|
The script started downloading the model named by |
|
|
The script stopped downloading the model named by |
|
|
The script started downloading the file named by |
|
|
The script stopped downloading the file named by |
|
|
The script downloaded |
|
|
The script started post-download processing on the model named by |
|
|
The script stopped post-download processing on the model named by |
Additional event types and members may be added in the future.
Tools parsing the machine-readable format should avoid relying on undocumented details. In particular:
Tools should not assume that any given event will occur for a given model/file (unless specified otherwise above) or will only occur once.
Tools should not assume that events will occur in a certain order beyond the ordering constraints specified above. In particular, when the
--jobs
option is set to a value greater than 1, event sequences for different files or models may get interleaved.
Model Converter Usage¶
The basic usage is to run the script like this:
omz_converter --all
This will convert all models into the OpenVINO™ IR format. Models that were originally in that format are ignored. Models in PyTorch format will be converted in ONNX format first.
The --all
option can be replaced with other filter options to convert only a subset of models. See the “Shared options” section.
Model Converter Starting Parameters¶
The script will attempt to locate Model Optimizer using several methods:
If the
--mo
option was specified, then its value will be used as the path to the script to run:omz_converter --all --mo my/openvino/path/model_optimizer/mo.py
Otherwise, if the selected Python executable can find the
mo
entrypoint, then it will be used.Otherwise, if the OpenVINO toolkit’s
setupvars.sh
/setupvars.bat
script has been executed, the environment variables set by that script will be used to locate Model Optimizer within the toolkit.Otherwise, the script will fail.
Model Information Dumper Usage¶
The basic usage is to run the script like this:
omz_info_dumper --all
The other options accepted by the script are described in the “Shared options” section.
This will print to standard output information about all models. The script’s output is a JSON array, each element of which is a JSON object describing a single model. Each such object has the following keys:
Datasets’ Data Downloader Usage¶
The usage is to run the script like this:
omz_data_downloader -o my/output/directory
This will copy datasets’ data from installed location to the specified location. If -o
/ --output_dir
option is not set, the files will be copied into a directory tree rooted in the current directory.
OpenVINO is a trademark of Intel Corporation or its subsidiaries in the U.S. and/or other countries.
Copyright 2018-2024 Intel Corporation
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.