* Commit. * Started to write nGraph operation ExperimentalDetectronDetectionOutput. Written draft of the header file. * Written draft of the cpp-file for nGraph operation ExperimentalDetectronDetectionOutput. * Small fix. * Added reading of ExperimentalDetectronDetectionOutput as nGraph operation. * Some fix. * Unregistered old shape infer function of the operation ExperimentalDetectronDetectionOutput. * Written the header file for the operation ExperimentalDetectronPriorGridGenerator. * Small refactoring. * Small fix. * Added set_output_size(3) into op::ExperimentalDetectronDetectionOutput::validate_and_infer_types(). * Added check for number of inputs of ExperimentalDetectronDetectionOutput. * Reverted some changes. * Changed IR for ExperimentalDetectronDetectionOutput serialization test. * Written cpp-file of nGraph operation ExperimentalDetectronPriorGridGenerator. * Small fix. * Some fixes. * Fixes in type and shape infer functions of the MO operation ExperimentalDetectronDetectionOutput. * Now ExperimentalDetectronPriorGridGenerator is readed as nGraph operation. * Fixed the infer function of the nGraph operation ExperimentalDetectronPriorGridGenerator. * Started to write tests for the shape infer function of the nGraph operation ExperimentalDetectronDetectionOutput. * Written the draft of the test for the shape infer function of the nGraph operation ExperimentalDetectronDetectionOutput. * Small fix. * Fixed ngraph/test/CMakeLists.txt. * Started to write tests for the shape infer function of the nGraph operation ExperimentalDetectronPriorGridGenerator. * Now the shape infer function of the nGraph operation ExperimentalDetectronPriorGridGenerator performs correctly case dynamic input shapes with static ranks. * Continued to write test for the nGraph operation ExperimentalDetectronPriorGridGenerator. * Small fixes. * Written tests for the shape infer function of the nGraph operation ExperimentalDetectronPriorGridGenerator (case when input shapes are partially dynamic). * Added test for reading ExperimentalDetectronDetectionOutput as an operation from opset6. * Some fixes. * Added some debug outputs. * Deleted inserted debug output. * Small fixes. * Small fix. * Small fix. * Small change. * Added comments to attributes of ExperimentalDetectronDetectionOutput. * Reverted changes. * Deleted shape infer for output port 3. * Small fixes. * Deleted redundant keyword 'virtual'. * Deleted redundant usings in header files of nGraph operations ExperimentalDetectronDetectionOutput and ExperimentalDetectronPriorGridGenerator. * Some fixes. * Small change. * Now GridGenerator::validate takes three args (input partial shapes). * Small fix. * Deleted some usings. * Small code style fix. * Reverted changes in validate_and_infer_types() and validate() of op::v6::ExperimentalDetectronPriorGridGenerator. * Added description of the class ExperimentalDetectronDetectionOutput. * Added some comments into the header file of the nGraph operation ExperimentalDetectronPriorGridGenerator. * Some fixes. * Added some comments to the class of the nGraph operation ExperimentalDetectronPriorGridGenerator. * Now the MO operation ExperimentalDetectronDetectionOutput has the attribute 'version' as 'opset6'. * Now the MO operation ExperimentalDetectronPriorGridGenerator has the attribute 'version' as 'opset6'. * Some fixes in the MO class ExperimentalDetectronDetectionOutput. * Fixes in the shape infer function of the nGraph operation ExperimentalDetectronPriorGridGenerator. * Renamed test XML model for ExperimentalDetectronDetectionOutput serialization tests. * Added validation of input shapes for the nGraph operation ExperimentalDetectronDetectionOutput. * Small fixes in the XML models for serialization testing of ExperimentalDetectronDetectionOutput. * Added tests of shape infer function of the nGraph operation ExperimentalDetectronDetectionOutput for the case when input shapes are partially dynamic. * Added tests of shape infer function of the nGraph operation ExperimentalDetectronDetectionOutput for the case when some input shapes have dynamic ranks. * Small fixes. * Small fix in the MO operation ExperimentalDetectronDetectionOutput shape infer function. * Fixes in op::v6::ExperimentalDetectronDetectionOutput::validate_and_infer_types(). * Code style fix. * Small refactoring. * Added NGRAPH_OP_SCOPE into ExperimentalDetectronDetectionOutput nGraph class. * Added NGRAPH_OP_SCOPE to the nGraph class ExperimentalDetectronPriorGridGenerator. * Small fixes. * Some refactoring. * Small fix. * Small fixes. * Reverted some changes in ExperimentalDetectronDetectionOutput::validate_and_infer_type(). * Now VPU reads the attribute class_agnostic_box_regression of ExperimentalDetectronDetectionOutput as Bool. * Now MO generates attribute 'class_agnostic_box_regression' of ExperimentalDetectronDetectionOutput only with values false or true. * Small fix. * Tabs were replaced by spaces in some XMLs. * Fixed copyrights. * Refactoring in op::v6::ExperimentalDetectronDetectionOutput::validate_and_infer_types(). * Refactoring in op::v6::ExperimentalDetectronPriorGridGenerator::validate_and_infer_types(). * Small fixes. * Started to write ExperimentalDetectronPriorGridGenerator shape infer tests for the case when dynamic input dimensions are intervals. * Deleted redundant 'return'. * Written tests for interval values of input shapes of op::v6::ExperimentalDetectronPriorGridGenerator. * Code style fix. * Code style fix.
Prerequisites
Model Optimizer requires:
-
Python 3 or newer
-
[Optional] Please read about use cases that require Caffe* to be available on the machine in the documentation.
Installation instructions
- Go to the Model Optimizer folder:
cd PATH_TO_INSTALL_DIR/deployment_tools/model_optimizer
-
Create virtual environment and activate it. This option is strongly recommended as it creates a Python sandbox and dependencies for the Model Optimizer do not influence global Python configuration, installed libraries etc. At the same time, special flag ensures that system-wide Python libraries are also available in this sandbox. Skip this step only if you do want to install all Model Optimizer dependencies globally:
- Create environment:
virtualenv -p /usr/bin/python3.6 .env3 --system-site-packages
- Activate it:
. .env3/bin/activate
- Create environment:
-
Install dependencies. If you want to convert models only from particular framework, you should use one of available
requirements_*.txtfiles corresponding to the framework of choice. For example, for Caffe userequirements_caffe.txtand so on. When you decide to switch later to other frameworks, please install dependencies for them using the same mechanism:pip3 install -r requirements.txt
Or you can use the installation scripts from the "install_prerequisites" directory.
-
[OPTIONAL] If you use Windows OS, most probably you get python version of
protobuflibrary. It is known to be rather slow, and you can use a boosted version of library by building the .egg file (Python package format) yourself, using instructions below (section 'How to boost Caffe model loading') for the target OS and Python, or install it with the pre-built .egg (it is built for Python 3.4, 3.5, 3.6, 3.7):python3 -m easy_install protobuf-3.6.1-py3.6-win-amd64.egg
It overrides the protobuf python package installed by the previous command.
Set environment variable to enable boost in protobuf performance:
set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
Setup development environment
How to run unit-tests
- Run tests with:
python -m unittest discover -p "*_test.py" [-s PATH_TO_DIR]
How to capture unit-tests coverage
- Run tests with:
coverage run -m unittest discover -p "*_test.py" [-s PATH_TO_DIR]
- Build html report:
coverage html
How to run code linting
- Run the following command:
pylint mo/ extensions/ mo.py