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](@ref workbench_docs_Workbench_DG_Introduction) (DL Workbench). [DL Workbench](@ref workbench_docs_Workbench_DG_Introduction) 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](@ref workbench_docs_Workbench_DG_Run_Locally) to get started.
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] (https://pypi.org/project/openvino-dev/) 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 ofpython
. 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.
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.
See the "Shared options" section for information on other options accepted by the script.
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:
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.
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.
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.
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:
The are certain options that all tools accept.
-h
/--help
can be used to print a help message:
omz_TOOL --help
There are several mutually exclusive filter options that select the models the tool will process:
To see the available models, you can use the --print_all
option. When this
option is specified, the tool will print all model names defined in the
configuration file and exit:
$ omz_TOOL --print_all
action-recognition-0001-decoder
action-recognition-0001-encoder
age-gender-recognition-retail-0013
driver-action-recognition-adas-0002-decoder
driver-action-recognition-adas-0002-encoder
emotions-recognition-retail-0003
face-detection-adas-0001
face-detection-retail-0004
face-detection-retail-0005
[...]
Either --print_all
or one of the filter options must be specified.
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.