2020-04-15 19:01:57 +03:00
|
|
|
#!/usr/bin/env python3
|
2020-04-27 21:21:29 +03:00
|
|
|
|
2021-03-26 17:54:28 +03:00
|
|
|
# Copyright (C) 2018-2021 Intel Corporation
|
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2020-04-27 21:21:29 +03:00
|
|
|
|
2020-04-15 19:01:57 +03:00
|
|
|
""" Script to acquire model IRs for stress tests.
|
|
|
|
|
Usage: ./scrips/get_testdata.py
|
|
|
|
|
"""
|
2020-04-27 21:21:29 +03:00
|
|
|
# pylint:disable=line-too-long
|
|
|
|
|
|
2020-04-15 19:01:57 +03:00
|
|
|
import argparse
|
2021-09-07 23:02:10 +03:00
|
|
|
import json
|
2020-04-27 21:21:29 +03:00
|
|
|
import logging as log
|
2020-04-15 19:01:57 +03:00
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
import subprocess
|
2020-04-27 21:21:29 +03:00
|
|
|
import sys
|
2021-04-23 12:56:59 +03:00
|
|
|
from distutils.dir_util import copy_tree
|
2020-04-15 19:01:57 +03:00
|
|
|
from inspect import getsourcefile
|
2020-04-27 21:21:29 +03:00
|
|
|
from pathlib import Path
|
2020-05-13 21:12:22 +03:00
|
|
|
from xml.etree import ElementTree as ET
|
2020-04-27 21:21:29 +03:00
|
|
|
|
|
|
|
|
log.basicConfig(format="{file}: [ %(levelname)s ] %(message)s".format(file=os.path.basename(__file__)),
|
|
|
|
|
level=log.INFO, stream=sys.stdout)
|
2020-04-15 19:01:57 +03:00
|
|
|
|
|
|
|
|
# Parameters
|
2020-04-27 21:21:29 +03:00
|
|
|
OMZ_NUM_ATTEMPTS = 6
|
2020-04-15 19:01:57 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def abs_path(relative_path):
|
|
|
|
|
"""Return absolute path given path relative to the current file.
|
|
|
|
|
"""
|
|
|
|
|
return os.path.realpath(
|
|
|
|
|
os.path.join(os.path.dirname(getsourcefile(lambda: 0)), relative_path))
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 21:21:29 +03:00
|
|
|
class VirtualEnv:
|
|
|
|
|
"""Class implemented creation and use of virtual environment."""
|
|
|
|
|
is_created = False
|
|
|
|
|
|
|
|
|
|
def __init__(self, venv_dir):
|
2020-05-18 17:21:58 +03:00
|
|
|
self.venv_dir = Path(abs_path('..')) / venv_dir
|
2020-04-27 21:21:29 +03:00
|
|
|
if sys.platform.startswith('linux') or sys.platform == 'darwin':
|
|
|
|
|
self.venv_executable = self.venv_dir / "bin" / "python3"
|
|
|
|
|
else:
|
|
|
|
|
self.venv_executable = self.venv_dir / "Scripts" / "python3.exe"
|
|
|
|
|
|
|
|
|
|
def get_venv_executable(self):
|
|
|
|
|
"""Returns path to executable from virtual environment."""
|
|
|
|
|
return str(self.venv_executable)
|
|
|
|
|
|
|
|
|
|
def get_venv_dir(self):
|
|
|
|
|
"""Returns path to virtual environment root directory."""
|
|
|
|
|
return str(self.venv_dir)
|
|
|
|
|
|
|
|
|
|
def create(self):
|
|
|
|
|
"""Creates virtual environment."""
|
|
|
|
|
cmd = '{executable} -m venv {venv}'.format(executable=sys.executable,
|
|
|
|
|
venv=self.get_venv_dir())
|
|
|
|
|
run_in_subprocess(cmd)
|
|
|
|
|
self.is_created = True
|
|
|
|
|
|
|
|
|
|
def install_requirements(self, *requirements):
|
|
|
|
|
"""Installs provided requirements. Creates virtual environment if it hasn't been created."""
|
|
|
|
|
if not self.is_created:
|
|
|
|
|
self.create()
|
|
|
|
|
cmd = '{executable} -m pip install --upgrade pip'.format(executable=self.get_venv_executable())
|
|
|
|
|
for req in requirements:
|
2020-05-18 17:21:58 +03:00
|
|
|
# Don't install requirements via one `pip install` call to prevent "ERROR: Double requirement given"
|
|
|
|
|
cmd += ' && {executable} -m pip install -r {req}'.format(executable=self.get_venv_executable(), req=req)
|
2020-04-27 21:21:29 +03:00
|
|
|
run_in_subprocess(cmd)
|
|
|
|
|
|
|
|
|
|
def create_n_install_requirements(self, *requirements):
|
|
|
|
|
"""Creates virtual environment and installs provided requirements in it."""
|
|
|
|
|
self.create()
|
|
|
|
|
self.install_requirements(*requirements)
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 17:21:58 +03:00
|
|
|
def run_in_subprocess(cmd, check_call=True):
|
2020-04-27 21:21:29 +03:00
|
|
|
"""Runs provided command in attached subprocess."""
|
|
|
|
|
log.info(cmd)
|
2020-05-18 17:21:58 +03:00
|
|
|
if check_call:
|
|
|
|
|
subprocess.check_call(cmd, shell=True)
|
|
|
|
|
else:
|
|
|
|
|
subprocess.call(cmd, shell=True)
|
2020-04-27 21:21:29 +03:00
|
|
|
|
|
|
|
|
|
Static test cases definition + supporting multi-model cases in MemLeaks tests (#7378)
* add multimodel memleaks test runner
* Add support for is_equal_data, get_source_tensor, get_target_tensor methods in ONNX FE API (#6991)
* Change ngraph public api (#6920)
* Moved nGraph function
* Added legacy nGraph function
* Moved export API
* Moved variant
* Added old header for backward compatibility
* Introduce define
* [LPT] LP Transformations refactoring after dynamic shapes support (#6950)
* [LPT] Transformations refactoring after dynamic shapes support
* [LPT] ReshapeTransformation: 2D->2D fix
* [LPT] fixes after review
* [GPU] Fix ScatterNDUpdate unit tests (#7103)
* Deprecate ngraph file utils. Need to have common functions (#7105)
* [GPU] Get rid of memory alloc for input_layout in internal networks (#6897)
* Renamed component name (#7110)
* Propose new MaxPool-8 operation (#5359)
* MaxPool-8: pads_value attribute removal from the operator definition (#7119)
* Remove deprecated option and enable compilation without device (#6022)
* Build openvino wheel package from setup.py (#7091)
* Added ability to build wheel package by executing `setup.py bdist_wheel`
* fix linter issues
* fix formating
* remove blank line
* Support unregistered operations in MO IR Reader (#6837)
* Add support for unregistred operations in MO IR Reader
* Remove commented lines
* Add shapes equality check
* Update comments
* Update groupconv_to_conv function to support case with multiple destinations
* Add ir_data_attrs attribute to restored layers
* Update copy_shape_infer function to new graph api
* Add attribute IE to unsuppurted operations to save their attributes
* Fix wrong attribute name
* Update commentary
* Partially revert updating to new Graph API to fix regression, add appropriate comments
* Update code comments
* Rename copy_shape_infer function and add more comments
* First stage of the AUTO-MULTI merge: redirecting AUTO to the MULTI device plugin (#7037)
* Redirect -d AUTO to MULTI device plugin
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Modify AUTO tests with MULTI config
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Fix CI
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Fix bug: CVS-62424
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Add some tests for AUTO
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Add select device logic to MULTI
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Fix extract device name bug
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Address reviewer's comment
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Delete AUTO plugin source code
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* [CPU] Deform. conv. - reference enforced (#6945)
* [CPU] Bump up MKLDNN version to get fix of c26453 warning (#7089)
* OpenVINO ONNX CI Azure - update onnx/models on demand only (#7125)
* [CPU] Added improvements for StridedSlice (#6658)
* Removal of FusedOp inheritance leftovers (#7113)
* Remove FusedOp from v0::Gelu
* Update v0::Gelu NGRAPH_RTTI_DECLARATION
* Enable gelu type_prop tests
* Remove FusedOp from v0::MVN
* Remove FusedOp from HardSigmoid
* Remove FusedOp from LSTMSequence
* Remove supress deprecated
* Add missed NGRAPH_OP_SCOPE to v0 Gelu and HardSigmoid
* Move ngraph::element::Type to ov namespace (#7124)
* Moved ngraph::Type -> ov::Type
* Revert original files
* [GNA] Fix order of SwapMatMulInput transformations (#7137)
* Moved Dimension, PartialShape, Interval, Rank to ov namespace (#7136)
* Mo implementation for If with tf extractor (#6662)
* Add tf2.x impl for If
* Fix ir_engine
* Fix opset
* Fix BOM file
* Added new test
* Fix comments
* Add subgraph_utils
* Fix comments
* Fix transform
* code refactoring
* Fix description
* rewrite support for empty tensor in if
* added onnx extractor
* delete onnx_if
* fix bug with fake_outputs
* Fix test
* Fix control_flow and fix commentaries
* create method results_mapping_and_finding_fake_outputs(output_nodes_in_subgraph,
* [GPU] Fixed 'assigned to self' error in loop_inst.h (#7126)
* [GPU] Fix build for gcc 10 (#7142)
* [GNA] Set input scale factors for imported model (#7139)
* add doc:'Paddle_Support.md' (#7122)
* add doc:'Paddle_Support.md'
* Apply suggestions from code review
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Apply suggestions from code review
* Update docs/IE_DG/Paddle_Support.md
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Remove local configs and it's copying to bin/ for stress tests (#7131)
* Moved DEPRECATION macro and ITT domains to ov namespace (#7153)
* Moved DEPRECATION macro and ITT domains to ov namespace
* Fixed code style
* Enable NormalizeL2Fusion and LeakyReluFusion inside MOC (#7096)
* Enable NormalizeL2Fusion inside MOC
* Fix NormalizewL2 decomposition (KeepDims=True)
* Add support for ONNX Crop operator (#6956)
* Review/update spec for NotEqual operation (#6797)
* Hiding the problem, Validate() changes 'function'
* Review/update spec for NotEqual operation
* Remove unnecessary edits not related to the ticket
* Removing the extra word binary for the short description
* Re-writing detailed description
* Correcting punctuation docs/ops/comparison/NotEqual_1.md
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Specifying auto_broadcast in the short description is similar to Equal spec
* The range of values for auto_brodcast is similar to Equal spec and includes the missing pdpd
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Moved DiscreteTypeInfo to ov namespace (#7127)
* Moved DiscreteTypeInfo to new opset
* Revert old header
* Fixed code style
* Revise CTCLoss OP (#6953)
* Add visitor test to CTCLoss
* Add CTC Loss SSLT
* Add CTC Loss template tests
* Use ngraph rtti macros
* Code style fix
* Enable PriorBoxClustered tests (#7078)
* CumSum spec revision (#6966)
* Update detailed description
* Update exclusive attribute description
* Update Inputs/Outpu description
* Update types
* Update descriptions
* Update data input rank info
* Added common.hpp file with aliases (#7158)
* CumSum reference implementation revision (#6915)
* New CumSum implementation init
* Unified ndim approach
* Move transpose to separate function
* Move transpose to original to separate function
* Move slice_count calculation to function
* Negative axes support
* Refactor redundant copy
* Changed copy to move
* Temp more backend tests
* Add const to shape arg
* Use span for slices calculation
* Remove unused headers
* CumSum new ref tests
* Add more ref tests
* Add all cumsum modes ref tests
* new optimized cum_sum reference
* Add reverse mode
* Optimized cumsum ref
* Remove deprecated cumsum backend tests
* Add more CumSum reference tests
* Simplify CumSum shared layer tests SetUp
* Replace auto to size_t in loop
* Change static_cast to T{}
* [LPT] MarkupCanBeQuantized: handled unsupported concat (#7045)
* [LPT] MarkupCanBeQuantized: added check on unsupported concat
* [LPT] ConcatTransformation: added test-case with unsupported concat and convolution
* [LPT] added test on rtInfo check for unsupported concat
* [LPT] ConcatTransformation: added test-case with unsupported axis to plugin tests
* CVS-56144 Enable all OMZ scope (#7084)
* Install layer tests with CMake (#6892)
* add CMakeLists.txt
* add copyright docstring
* add newline after copyright
* set target name
* change TARGET to DIRECTORY
* Rename layer tests dir to avoid name conflict
* cmakelists.txt final version
* Change destination to tests\layer_tests_openvino
* Add cmake_minimum_required to CMakeLists.txt
* Update CMakeLists.txt
* ReverseSequence specification refactored (#7112)
* ReverseSequence specification refactored
* Change attribute description to avoid confusion
* Allow seq_lenghts input to be of floating-point precision
* MemCheck add INT8 models to pre-commit (#7166)
* updated desktop configs with int8 models
* updated desktop reference configs with actual values
* added commit comments
* parametrize proxy (#7174)
* Updated list of supported operations. (#6981)
* Updated list of supported layers.
* Removed Crop, softsign from Kaldi list.
* Updated limitations.
* Corrected limitations.
* Updated limitations.
* Added Einsum, corrected Where.
* Apply suggestions from code review
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
* [MO] turn on MarkSubGraphsWithCorrectLayout for TF NCHW (#7150)
* turned on MarkingSubgraphsWithCorrectLayout for TF NCHW
* restricted MarkSubgraphsWithCorrectLayout.py only to TF
* added comments why need to MarkSubgraphsWithCorrectLayout even for TF NCHW models
* [CPU][TESTS][LPT] MatMulTransformations test-cases removed from skip config (#7181)
* Fixed ngraph_onnx_importer compatibility target creation for older cmake (3.10) (#7176)
* [GPU] Fix clBuildProgram failure with ssd_mobilnet_v1_coco and batch=256 (#7121)
* Fix v0::MVN default constructor (#7175)
* [GPU] Fixes for correct MultiDevice plugin and inference request behavior (#7161)
* Fix op category section in operations spec (#7130)
* add ngraph::pass::LSTMCellDecomposition as mandatory (#7028)
* add ngraph::pass::LSTMCellDecomposition as mandatory
* move LSTMCellDecomposition just after CommonOptimizations before all convert opset transformations
* code review fixes: add flag that prevents some legacy transformations if their ngraph-based analogues were executed
* remove isNgraphPassesUsed from ModelQuantizer
* cleanups
* [IE] Convert to unsigned NMS:0 ->Gather path (#6474)
* inserted Convert to unsigned
* moved declarations from hpp into cpp, specification corrected
* added static const modifier
* updated convert specification
* minor corrections
* split into 3 passes(Init, Propogate, Update), renamed final pass to ConvertNmsGatherPathToUnsigned
* added description why transformation is needed
* added matcher for several NMS versions, removed TRANSFORMATIONS_API macros from cpp
* applied comments:
- used GraphRewrite instead of FunctionPass
- simplified some expressions
- corrected case when Converts output goes to multiple nodes
- added to MOC transformations
- other minor corrections
* removed redundant namespace prefixes
* fixed #include <ngraph/pass/graph_rewrite.hpp>
* removed matcher_scope, debug code, and redundant dynamic_cast
* [nG] [IE] use GatherBase in negative indices resolver (#7145)
* updated pattern matcher into GatherBase in negative indices resolver, so that it is triggered in all versions of operation
* copy_runtime_info fix
* added constant folding
* Nested loop (#6710)
* initial changes to support nested loop
* fixed issues
* fixed nested loop extraction
* added comments
* removed unneeded comments
* review fix
* added tests
* turned off loop tests on GPU
* set xfail for TF tests
* removed TF test to move it in another repo
* fix typo in comment
* move duplicated code to separate functions;
added asserts
* add function for onnx constant creation;
add function to create body of loop
add comments to test
* move main change for nested loop to separate function
* install necessary dirs for tests (#7044)
* install necessary dirs to tests
* rem RUNTIME from install step
* fix paths
* fix install paths
* fix install paths: add destination dirs
* add pandas
* fix requirements conflict - change pytest version to ~5
* remove comment from requirements.txt
* upd numpy version
* Added openvino infer request API (#7151)
* [CPU] Removed eltwise overhead on execution stage (#6760)
* [GNA] For similar records, the pattern length was increased to 4 in the algorithm for determining infinite cycles. (#7165)
* for similar records, the pattern length was increased to 4
* Added comments
* [CPU] Enable direct copy implementation for u8->u8 reorder. (#7043)
* [CPU] Fix not expected No-Preprocess Exception with RGB to BGR conversion (#6954)
* [CPU] Avoid inserting additional transpose + reorder after RNN node. (#5921)
* [MO] Replacing StridedSlice with Squeeze/Unsqueeze (#6693)
* added reinterp_shape parameter to tf ss extractor
* removed reinterp_shape
* added transformation to replace ss
* updated bom
* fix for e2e tests
* updated a case when shrink_axis_mask and new_axis_mask are both initialized
* unittests
* added comments
* updated graph_condition
* comments resolving
* updated the case, when shrink_axis_mask and new_axis_mask are both initialized
* added layer tests for squeeze/unsqueeze cases
* remove case when shrink and new axis masks are both set
* [VPU] Added ConvertGather7ToGather1 pass to frontend (#7183)
This pr adds ConvertGather7ToGather1 pass to frontend before MergeGatherGatherElements pass, to make it so that when MergeGatherGatherElements is ran, any v7::Gather will be replaced with v1::Gather
* [MO] Add transformation for single CTCGreedyDecoder operation (#7023)
* Add transformation for single CTCGreedyDecoder operation
* Fix style in op specification
* Update transformation logic
* refactor old tests and add tests for new transformation
* Move tf specific front transformations to tf folder
* Update transformation logic and comments
* Add run_after function and update comments
* Add output_sparse_format attribute to extractor
* Update transformation conditions and tests
* Fix incorrect comment
* Move sparse_to_dense_replacer to front/tf folder to fix problems with class registration
* Update import
* Update output ports handling in transformation
* Update test
* Fix BOM file
* Update pattern for ctcloss transformation
* Fix and refactor tests for ctcloss transform
* Update transformation conditions
* Add support opset11 for gemm normalizer (#6733)
* Add support opset11 for gemm normolizer
* Add layer test for gemm opset 11
* Fix layer test
* Fix layer test
* Refactoring according to code review
* Fix
* Update biases norm
* Refactoring matmul norm
* Fix accoding to review
* Fix alpha parameter
* Fix variable naming
* Refactoring according to code review
* Add support for ONNX RandomUniform and RandomUniformLike ops (#7190)
* remove adaptive pool2d shape check in ngraph paddle frontend (#7074)
* remove adaptive pool2d shape check in ngraph paddle frontend
* add ngraph paddle frontend dynamic pool2d test
* Revise ReverseSequence reference implementation (#7117)
* ReverseSequence ngraph op shell revision with type_prop tests
* Add attribute count check in visitor test
* Refactor backend tests to template plugin test with reference values
* Rename cpu SLT instances
* Add op to list of trusted operations
* Rewrite validation check for input type due to backward compatibility
* Reference implementation speed up by replacing index function call of CoordinateTransform by precalculated strides
* Moved attribute_adapter, attribute_visitor files to ov namespave (#7179)
* Fixed nGraph build
* Fixed nGraph unit tests
* Fixed func tests
* Fix some operators
* Fixed build
* Try to fix specialization in different namespace
* Try to fix build
* Fixed element_type
* memleaks multimodel supporting
* revert rebase mistake
* add newline at the end of config file
* fix log messages
* refine memelaks test case class
* remove temporary decision designed to save in memory pipeline functions parameters
* code consistency
* rework example of new memleak tests config format
* oop in testcases
* mistype
* set num of iterations in example test config to previous value
* add multiproc stress unit tests
* Add more cases
* remove unique_ptr test objects saving logic
* switch memleak test configs to new format
* swith weekly memleak test config to new format
* Clarify new get_testdata script arg
* clang-format
* wrong changes
* Add docstring to generateTestsParamsMemLeaks()
* add explanation what update_item_for_name() doing
* Autodetect stress framework while parsing models
* adjust the wording
* Shorten test cases names
* fix get_testdata for memcheck tests
Co-authored-by: Mateusz Bencer <mateusz.bencer@intel.com>
Co-authored-by: Ilya Churaev <ilya.churaev@intel.com>
Co-authored-by: Vladislav Golubev <vladislav.golubev@intel.com>
Co-authored-by: Sergey Shlyapnikov <sergey.shlyapnikov@intel.com>
Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com>
Co-authored-by: Ilya Sharikov <ilya.sharikov@intel.com>
Co-authored-by: Michał Karzyński <michal.karzynski@intel.com>
Co-authored-by: Tomasz Dołbniak <tomasz.dolbniak@intel.com>
Co-authored-by: Daria Mityagina <daria.mityagina@intel.com>
Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com>
Co-authored-by: Anton Chetverikov <Anton.Chetverikov@intel.com>
Co-authored-by: Shoujiang Ma <shoujiang.ma@intel.com>
Co-authored-by: Yury Gaydaychuk <yury.gaydaychuk@intel.com>
Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com>
Co-authored-by: Rafal Blaczkowski <rafal.blaczkowski@intel.com>
Co-authored-by: Alexandra Sidorova <alexandra.sidorova@intel.com>
Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
Co-authored-by: Elizaveta Lobanova <elizaveta.lobanova@intel.com>
Co-authored-by: Eugeny Volosenkov <eugeny.volosenkov@intel.com>
Co-authored-by: Paul Youngsoo Ahn <paul.y.ahn@intel.com>
Co-authored-by: Mikhail Ryzhov <mikhail.ryzhov@intel.com>
Co-authored-by: Liu Bo <bo4.liu@intel.com>
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
Co-authored-by: Olesya Martinyuk <olesya.martinyuk@intel.com>
Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>
Co-authored-by: Nikita Semaev <nikita.semaev@intel.com>
Co-authored-by: Bartosz Lesniewski <bartosz.lesniewski@intel.com>
Co-authored-by: Anton Pankratv <anton.pankratov@intel.com>
Co-authored-by: Anastasiia Urlapova <anastasiia.urlapova@intel.com>
Co-authored-by: Gabriele Galiero Casay <gabriele.galiero.casay@intel.com>
Co-authored-by: Anastasia Popova <anastasia.popova@intel.com>
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
Co-authored-by: Pavel Esir <pavel.esir@intel.com>
Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
Co-authored-by: Andrew Kwangwoong Park <andrew.kwangwoong.park@intel.com>
Co-authored-by: Mikhail Letavin <mikhail.letavin@intel.com>
Co-authored-by: Evgeny Kotov <evgeny.kotov@intel.com>
Co-authored-by: Svetlana Dolinina <svetlana.a.dolinina@intel.com>
Co-authored-by: Victor Kuznetsov <victor.kuznetsov@intel.com>
Co-authored-by: Dmitrii Khurtin <dmitrii.khurtin@intel.com>
Co-authored-by: Ivan Novoselov <ivan.novoselov@intel.com>
Co-authored-by: Aleksandr Pertovsky <aleksandr.pertovsky@intel.com>
Co-authored-by: Nikolay Shchegolev <nikolay.shchegolev@intel.com>
Co-authored-by: Yegor Kruglov <yegor.kruglov@intel.com>
Co-authored-by: Polina Brzezinskaya <polina.brzezinskaya@intel.com>
Co-authored-by: iliya mironov <iliya.mironov@intel.com>
Co-authored-by: mei, yang <yang.mei@intel.com>
2021-09-20 11:47:34 +03:00
|
|
|
def get_model_recs(test_conf_root):
|
|
|
|
|
"""Parse models from test config.
|
|
|
|
|
Model records in multi-model configs with static test definition are members of "device" sections
|
|
|
|
|
"""
|
|
|
|
|
device_recs = test_conf_root.findall("device")
|
|
|
|
|
if device_recs:
|
|
|
|
|
model_recs = []
|
|
|
|
|
for device_rec in device_recs:
|
|
|
|
|
for model_rec in device_rec.findall("model"):
|
|
|
|
|
model_recs.append(model_rec)
|
|
|
|
|
|
|
|
|
|
return model_recs
|
|
|
|
|
|
|
|
|
|
return test_conf_root.find("models")
|
|
|
|
|
|
|
|
|
|
|
2020-04-15 19:01:57 +03:00
|
|
|
def main():
|
|
|
|
|
"""Main entry point.
|
|
|
|
|
"""
|
2021-02-24 14:56:09 +03:00
|
|
|
parser = argparse.ArgumentParser(description='Acquire test data',
|
|
|
|
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
2020-04-15 19:01:57 +03:00
|
|
|
|
2020-05-18 17:21:58 +03:00
|
|
|
parser.add_argument('--test_conf', required=True, type=Path,
|
2020-05-13 21:12:22 +03:00
|
|
|
help='Path to a test config .xml file containing models '
|
|
|
|
|
'which will be downloaded and converted to IRs via OMZ.')
|
2020-04-27 21:21:29 +03:00
|
|
|
parser.add_argument('--omz_repo', required=False,
|
|
|
|
|
help='Path to Open Model Zoo (OMZ) repository. It will be used to skip cloning step.')
|
2020-05-13 21:12:22 +03:00
|
|
|
parser.add_argument('--mo_tool', type=Path,
|
2020-05-18 17:21:58 +03:00
|
|
|
default=Path(abs_path('../../../model-optimizer/mo.py')).resolve(),
|
2020-04-27 21:21:29 +03:00
|
|
|
help='Path to Model Optimizer (MO) runner. Required for OMZ converter.py only.')
|
2020-05-13 21:12:22 +03:00
|
|
|
parser.add_argument('--omz_models_out_dir', type=Path,
|
|
|
|
|
default=abs_path('../_omz_out/models'),
|
2021-02-24 14:56:09 +03:00
|
|
|
help='Directory to put test data into. Required for OMZ downloader.py and converter.py.')
|
2020-05-13 21:12:22 +03:00
|
|
|
parser.add_argument('--omz_irs_out_dir', type=Path,
|
|
|
|
|
default=abs_path('../_omz_out/irs'),
|
2020-04-27 21:21:29 +03:00
|
|
|
help='Directory to put test data into. Required for OMZ converter.py only.')
|
2020-05-13 21:12:22 +03:00
|
|
|
parser.add_argument('--omz_cache_dir', type=Path,
|
|
|
|
|
default=abs_path('../_omz_out/cache'),
|
2020-04-27 21:21:29 +03:00
|
|
|
help='Directory with test data cache. Required for OMZ downloader.py only.')
|
|
|
|
|
parser.add_argument('--no_venv', action="store_true",
|
|
|
|
|
help='Skip preparation and use of virtual environment to convert models via OMZ converter.py.')
|
2020-05-18 17:21:58 +03:00
|
|
|
parser.add_argument('--skip_omz_errors', action="store_true",
|
|
|
|
|
help='Skip errors caused by OMZ while downloading and converting.')
|
2020-04-15 19:01:57 +03:00
|
|
|
args = parser.parse_args()
|
2020-05-13 21:12:22 +03:00
|
|
|
|
2020-07-08 12:33:39 +03:00
|
|
|
# prepare Open Model Zoo
|
2020-04-27 21:21:29 +03:00
|
|
|
if args.omz_repo:
|
|
|
|
|
omz_path = Path(args.omz_repo).resolve()
|
|
|
|
|
else:
|
2020-05-18 17:21:58 +03:00
|
|
|
omz_path = Path(abs_path('..')) / "_open_model_zoo"
|
2020-07-08 12:33:39 +03:00
|
|
|
# clone Open Model Zoo into temporary path
|
2020-04-27 21:21:29 +03:00
|
|
|
if os.path.exists(str(omz_path)):
|
|
|
|
|
shutil.rmtree(str(omz_path))
|
2020-07-16 15:28:25 +03:00
|
|
|
cmd = 'git clone --single-branch --branch develop' \
|
2021-06-22 17:43:17 +03:00
|
|
|
' https://github.com/openvinotoolkit/open_model_zoo {omz_path}'.format(omz_path=omz_path)
|
2020-04-27 21:21:29 +03:00
|
|
|
run_in_subprocess(cmd)
|
|
|
|
|
|
2020-07-08 12:33:39 +03:00
|
|
|
# prepare virtual environment and install requirements
|
2020-04-27 21:21:29 +03:00
|
|
|
python_executable = sys.executable
|
|
|
|
|
if not args.no_venv:
|
|
|
|
|
Venv = VirtualEnv("./.stress_venv")
|
|
|
|
|
requirements = [
|
|
|
|
|
omz_path / "tools" / "downloader" / "requirements.in",
|
2020-05-13 21:12:22 +03:00
|
|
|
args.mo_tool.parent / "requirements.txt",
|
|
|
|
|
args.mo_tool.parent / "requirements_dev.txt",
|
2020-05-18 17:21:58 +03:00
|
|
|
omz_path / "tools" / "downloader" / "requirements-caffe2.in",
|
|
|
|
|
omz_path / "tools" / "downloader" / "requirements-pytorch.in"
|
2020-04-27 21:21:29 +03:00
|
|
|
]
|
|
|
|
|
Venv.create_n_install_requirements(*requirements)
|
|
|
|
|
python_executable = Venv.get_venv_executable()
|
2020-04-15 19:01:57 +03:00
|
|
|
|
2020-10-30 00:37:02 +03:00
|
|
|
test_conf_obj = ET.parse(str(args.test_conf))
|
|
|
|
|
test_conf_root = test_conf_obj.getroot()
|
Static test cases definition + supporting multi-model cases in MemLeaks tests (#7378)
* add multimodel memleaks test runner
* Add support for is_equal_data, get_source_tensor, get_target_tensor methods in ONNX FE API (#6991)
* Change ngraph public api (#6920)
* Moved nGraph function
* Added legacy nGraph function
* Moved export API
* Moved variant
* Added old header for backward compatibility
* Introduce define
* [LPT] LP Transformations refactoring after dynamic shapes support (#6950)
* [LPT] Transformations refactoring after dynamic shapes support
* [LPT] ReshapeTransformation: 2D->2D fix
* [LPT] fixes after review
* [GPU] Fix ScatterNDUpdate unit tests (#7103)
* Deprecate ngraph file utils. Need to have common functions (#7105)
* [GPU] Get rid of memory alloc for input_layout in internal networks (#6897)
* Renamed component name (#7110)
* Propose new MaxPool-8 operation (#5359)
* MaxPool-8: pads_value attribute removal from the operator definition (#7119)
* Remove deprecated option and enable compilation without device (#6022)
* Build openvino wheel package from setup.py (#7091)
* Added ability to build wheel package by executing `setup.py bdist_wheel`
* fix linter issues
* fix formating
* remove blank line
* Support unregistered operations in MO IR Reader (#6837)
* Add support for unregistred operations in MO IR Reader
* Remove commented lines
* Add shapes equality check
* Update comments
* Update groupconv_to_conv function to support case with multiple destinations
* Add ir_data_attrs attribute to restored layers
* Update copy_shape_infer function to new graph api
* Add attribute IE to unsuppurted operations to save their attributes
* Fix wrong attribute name
* Update commentary
* Partially revert updating to new Graph API to fix regression, add appropriate comments
* Update code comments
* Rename copy_shape_infer function and add more comments
* First stage of the AUTO-MULTI merge: redirecting AUTO to the MULTI device plugin (#7037)
* Redirect -d AUTO to MULTI device plugin
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Modify AUTO tests with MULTI config
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Fix CI
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Fix bug: CVS-62424
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Add some tests for AUTO
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Add select device logic to MULTI
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Fix extract device name bug
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Address reviewer's comment
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* Delete AUTO plugin source code
Signed-off-by: Shoujiang Ma <shoujiang.ma@intel.com>
* [CPU] Deform. conv. - reference enforced (#6945)
* [CPU] Bump up MKLDNN version to get fix of c26453 warning (#7089)
* OpenVINO ONNX CI Azure - update onnx/models on demand only (#7125)
* [CPU] Added improvements for StridedSlice (#6658)
* Removal of FusedOp inheritance leftovers (#7113)
* Remove FusedOp from v0::Gelu
* Update v0::Gelu NGRAPH_RTTI_DECLARATION
* Enable gelu type_prop tests
* Remove FusedOp from v0::MVN
* Remove FusedOp from HardSigmoid
* Remove FusedOp from LSTMSequence
* Remove supress deprecated
* Add missed NGRAPH_OP_SCOPE to v0 Gelu and HardSigmoid
* Move ngraph::element::Type to ov namespace (#7124)
* Moved ngraph::Type -> ov::Type
* Revert original files
* [GNA] Fix order of SwapMatMulInput transformations (#7137)
* Moved Dimension, PartialShape, Interval, Rank to ov namespace (#7136)
* Mo implementation for If with tf extractor (#6662)
* Add tf2.x impl for If
* Fix ir_engine
* Fix opset
* Fix BOM file
* Added new test
* Fix comments
* Add subgraph_utils
* Fix comments
* Fix transform
* code refactoring
* Fix description
* rewrite support for empty tensor in if
* added onnx extractor
* delete onnx_if
* fix bug with fake_outputs
* Fix test
* Fix control_flow and fix commentaries
* create method results_mapping_and_finding_fake_outputs(output_nodes_in_subgraph,
* [GPU] Fixed 'assigned to self' error in loop_inst.h (#7126)
* [GPU] Fix build for gcc 10 (#7142)
* [GNA] Set input scale factors for imported model (#7139)
* add doc:'Paddle_Support.md' (#7122)
* add doc:'Paddle_Support.md'
* Apply suggestions from code review
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Apply suggestions from code review
* Update docs/IE_DG/Paddle_Support.md
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Remove local configs and it's copying to bin/ for stress tests (#7131)
* Moved DEPRECATION macro and ITT domains to ov namespace (#7153)
* Moved DEPRECATION macro and ITT domains to ov namespace
* Fixed code style
* Enable NormalizeL2Fusion and LeakyReluFusion inside MOC (#7096)
* Enable NormalizeL2Fusion inside MOC
* Fix NormalizewL2 decomposition (KeepDims=True)
* Add support for ONNX Crop operator (#6956)
* Review/update spec for NotEqual operation (#6797)
* Hiding the problem, Validate() changes 'function'
* Review/update spec for NotEqual operation
* Remove unnecessary edits not related to the ticket
* Removing the extra word binary for the short description
* Re-writing detailed description
* Correcting punctuation docs/ops/comparison/NotEqual_1.md
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Specifying auto_broadcast in the short description is similar to Equal spec
* The range of values for auto_brodcast is similar to Equal spec and includes the missing pdpd
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
* Moved DiscreteTypeInfo to ov namespace (#7127)
* Moved DiscreteTypeInfo to new opset
* Revert old header
* Fixed code style
* Revise CTCLoss OP (#6953)
* Add visitor test to CTCLoss
* Add CTC Loss SSLT
* Add CTC Loss template tests
* Use ngraph rtti macros
* Code style fix
* Enable PriorBoxClustered tests (#7078)
* CumSum spec revision (#6966)
* Update detailed description
* Update exclusive attribute description
* Update Inputs/Outpu description
* Update types
* Update descriptions
* Update data input rank info
* Added common.hpp file with aliases (#7158)
* CumSum reference implementation revision (#6915)
* New CumSum implementation init
* Unified ndim approach
* Move transpose to separate function
* Move transpose to original to separate function
* Move slice_count calculation to function
* Negative axes support
* Refactor redundant copy
* Changed copy to move
* Temp more backend tests
* Add const to shape arg
* Use span for slices calculation
* Remove unused headers
* CumSum new ref tests
* Add more ref tests
* Add all cumsum modes ref tests
* new optimized cum_sum reference
* Add reverse mode
* Optimized cumsum ref
* Remove deprecated cumsum backend tests
* Add more CumSum reference tests
* Simplify CumSum shared layer tests SetUp
* Replace auto to size_t in loop
* Change static_cast to T{}
* [LPT] MarkupCanBeQuantized: handled unsupported concat (#7045)
* [LPT] MarkupCanBeQuantized: added check on unsupported concat
* [LPT] ConcatTransformation: added test-case with unsupported concat and convolution
* [LPT] added test on rtInfo check for unsupported concat
* [LPT] ConcatTransformation: added test-case with unsupported axis to plugin tests
* CVS-56144 Enable all OMZ scope (#7084)
* Install layer tests with CMake (#6892)
* add CMakeLists.txt
* add copyright docstring
* add newline after copyright
* set target name
* change TARGET to DIRECTORY
* Rename layer tests dir to avoid name conflict
* cmakelists.txt final version
* Change destination to tests\layer_tests_openvino
* Add cmake_minimum_required to CMakeLists.txt
* Update CMakeLists.txt
* ReverseSequence specification refactored (#7112)
* ReverseSequence specification refactored
* Change attribute description to avoid confusion
* Allow seq_lenghts input to be of floating-point precision
* MemCheck add INT8 models to pre-commit (#7166)
* updated desktop configs with int8 models
* updated desktop reference configs with actual values
* added commit comments
* parametrize proxy (#7174)
* Updated list of supported operations. (#6981)
* Updated list of supported layers.
* Removed Crop, softsign from Kaldi list.
* Updated limitations.
* Corrected limitations.
* Updated limitations.
* Added Einsum, corrected Where.
* Apply suggestions from code review
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
* [MO] turn on MarkSubGraphsWithCorrectLayout for TF NCHW (#7150)
* turned on MarkingSubgraphsWithCorrectLayout for TF NCHW
* restricted MarkSubgraphsWithCorrectLayout.py only to TF
* added comments why need to MarkSubgraphsWithCorrectLayout even for TF NCHW models
* [CPU][TESTS][LPT] MatMulTransformations test-cases removed from skip config (#7181)
* Fixed ngraph_onnx_importer compatibility target creation for older cmake (3.10) (#7176)
* [GPU] Fix clBuildProgram failure with ssd_mobilnet_v1_coco and batch=256 (#7121)
* Fix v0::MVN default constructor (#7175)
* [GPU] Fixes for correct MultiDevice plugin and inference request behavior (#7161)
* Fix op category section in operations spec (#7130)
* add ngraph::pass::LSTMCellDecomposition as mandatory (#7028)
* add ngraph::pass::LSTMCellDecomposition as mandatory
* move LSTMCellDecomposition just after CommonOptimizations before all convert opset transformations
* code review fixes: add flag that prevents some legacy transformations if their ngraph-based analogues were executed
* remove isNgraphPassesUsed from ModelQuantizer
* cleanups
* [IE] Convert to unsigned NMS:0 ->Gather path (#6474)
* inserted Convert to unsigned
* moved declarations from hpp into cpp, specification corrected
* added static const modifier
* updated convert specification
* minor corrections
* split into 3 passes(Init, Propogate, Update), renamed final pass to ConvertNmsGatherPathToUnsigned
* added description why transformation is needed
* added matcher for several NMS versions, removed TRANSFORMATIONS_API macros from cpp
* applied comments:
- used GraphRewrite instead of FunctionPass
- simplified some expressions
- corrected case when Converts output goes to multiple nodes
- added to MOC transformations
- other minor corrections
* removed redundant namespace prefixes
* fixed #include <ngraph/pass/graph_rewrite.hpp>
* removed matcher_scope, debug code, and redundant dynamic_cast
* [nG] [IE] use GatherBase in negative indices resolver (#7145)
* updated pattern matcher into GatherBase in negative indices resolver, so that it is triggered in all versions of operation
* copy_runtime_info fix
* added constant folding
* Nested loop (#6710)
* initial changes to support nested loop
* fixed issues
* fixed nested loop extraction
* added comments
* removed unneeded comments
* review fix
* added tests
* turned off loop tests on GPU
* set xfail for TF tests
* removed TF test to move it in another repo
* fix typo in comment
* move duplicated code to separate functions;
added asserts
* add function for onnx constant creation;
add function to create body of loop
add comments to test
* move main change for nested loop to separate function
* install necessary dirs for tests (#7044)
* install necessary dirs to tests
* rem RUNTIME from install step
* fix paths
* fix install paths
* fix install paths: add destination dirs
* add pandas
* fix requirements conflict - change pytest version to ~5
* remove comment from requirements.txt
* upd numpy version
* Added openvino infer request API (#7151)
* [CPU] Removed eltwise overhead on execution stage (#6760)
* [GNA] For similar records, the pattern length was increased to 4 in the algorithm for determining infinite cycles. (#7165)
* for similar records, the pattern length was increased to 4
* Added comments
* [CPU] Enable direct copy implementation for u8->u8 reorder. (#7043)
* [CPU] Fix not expected No-Preprocess Exception with RGB to BGR conversion (#6954)
* [CPU] Avoid inserting additional transpose + reorder after RNN node. (#5921)
* [MO] Replacing StridedSlice with Squeeze/Unsqueeze (#6693)
* added reinterp_shape parameter to tf ss extractor
* removed reinterp_shape
* added transformation to replace ss
* updated bom
* fix for e2e tests
* updated a case when shrink_axis_mask and new_axis_mask are both initialized
* unittests
* added comments
* updated graph_condition
* comments resolving
* updated the case, when shrink_axis_mask and new_axis_mask are both initialized
* added layer tests for squeeze/unsqueeze cases
* remove case when shrink and new axis masks are both set
* [VPU] Added ConvertGather7ToGather1 pass to frontend (#7183)
This pr adds ConvertGather7ToGather1 pass to frontend before MergeGatherGatherElements pass, to make it so that when MergeGatherGatherElements is ran, any v7::Gather will be replaced with v1::Gather
* [MO] Add transformation for single CTCGreedyDecoder operation (#7023)
* Add transformation for single CTCGreedyDecoder operation
* Fix style in op specification
* Update transformation logic
* refactor old tests and add tests for new transformation
* Move tf specific front transformations to tf folder
* Update transformation logic and comments
* Add run_after function and update comments
* Add output_sparse_format attribute to extractor
* Update transformation conditions and tests
* Fix incorrect comment
* Move sparse_to_dense_replacer to front/tf folder to fix problems with class registration
* Update import
* Update output ports handling in transformation
* Update test
* Fix BOM file
* Update pattern for ctcloss transformation
* Fix and refactor tests for ctcloss transform
* Update transformation conditions
* Add support opset11 for gemm normalizer (#6733)
* Add support opset11 for gemm normolizer
* Add layer test for gemm opset 11
* Fix layer test
* Fix layer test
* Refactoring according to code review
* Fix
* Update biases norm
* Refactoring matmul norm
* Fix accoding to review
* Fix alpha parameter
* Fix variable naming
* Refactoring according to code review
* Add support for ONNX RandomUniform and RandomUniformLike ops (#7190)
* remove adaptive pool2d shape check in ngraph paddle frontend (#7074)
* remove adaptive pool2d shape check in ngraph paddle frontend
* add ngraph paddle frontend dynamic pool2d test
* Revise ReverseSequence reference implementation (#7117)
* ReverseSequence ngraph op shell revision with type_prop tests
* Add attribute count check in visitor test
* Refactor backend tests to template plugin test with reference values
* Rename cpu SLT instances
* Add op to list of trusted operations
* Rewrite validation check for input type due to backward compatibility
* Reference implementation speed up by replacing index function call of CoordinateTransform by precalculated strides
* Moved attribute_adapter, attribute_visitor files to ov namespave (#7179)
* Fixed nGraph build
* Fixed nGraph unit tests
* Fixed func tests
* Fix some operators
* Fixed build
* Try to fix specialization in different namespace
* Try to fix build
* Fixed element_type
* memleaks multimodel supporting
* revert rebase mistake
* add newline at the end of config file
* fix log messages
* refine memelaks test case class
* remove temporary decision designed to save in memory pipeline functions parameters
* code consistency
* rework example of new memleak tests config format
* oop in testcases
* mistype
* set num of iterations in example test config to previous value
* add multiproc stress unit tests
* Add more cases
* remove unique_ptr test objects saving logic
* switch memleak test configs to new format
* swith weekly memleak test config to new format
* Clarify new get_testdata script arg
* clang-format
* wrong changes
* Add docstring to generateTestsParamsMemLeaks()
* add explanation what update_item_for_name() doing
* Autodetect stress framework while parsing models
* adjust the wording
* Shorten test cases names
* fix get_testdata for memcheck tests
Co-authored-by: Mateusz Bencer <mateusz.bencer@intel.com>
Co-authored-by: Ilya Churaev <ilya.churaev@intel.com>
Co-authored-by: Vladislav Golubev <vladislav.golubev@intel.com>
Co-authored-by: Sergey Shlyapnikov <sergey.shlyapnikov@intel.com>
Co-authored-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com>
Co-authored-by: Ilya Sharikov <ilya.sharikov@intel.com>
Co-authored-by: Michał Karzyński <michal.karzynski@intel.com>
Co-authored-by: Tomasz Dołbniak <tomasz.dolbniak@intel.com>
Co-authored-by: Daria Mityagina <daria.mityagina@intel.com>
Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com>
Co-authored-by: Anton Chetverikov <Anton.Chetverikov@intel.com>
Co-authored-by: Shoujiang Ma <shoujiang.ma@intel.com>
Co-authored-by: Yury Gaydaychuk <yury.gaydaychuk@intel.com>
Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com>
Co-authored-by: Rafal Blaczkowski <rafal.blaczkowski@intel.com>
Co-authored-by: Alexandra Sidorova <alexandra.sidorova@intel.com>
Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
Co-authored-by: Elizaveta Lobanova <elizaveta.lobanova@intel.com>
Co-authored-by: Eugeny Volosenkov <eugeny.volosenkov@intel.com>
Co-authored-by: Paul Youngsoo Ahn <paul.y.ahn@intel.com>
Co-authored-by: Mikhail Ryzhov <mikhail.ryzhov@intel.com>
Co-authored-by: Liu Bo <bo4.liu@intel.com>
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
Co-authored-by: Olesya Martinyuk <olesya.martinyuk@intel.com>
Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>
Co-authored-by: Nikita Semaev <nikita.semaev@intel.com>
Co-authored-by: Bartosz Lesniewski <bartosz.lesniewski@intel.com>
Co-authored-by: Anton Pankratv <anton.pankratov@intel.com>
Co-authored-by: Anastasiia Urlapova <anastasiia.urlapova@intel.com>
Co-authored-by: Gabriele Galiero Casay <gabriele.galiero.casay@intel.com>
Co-authored-by: Anastasia Popova <anastasia.popova@intel.com>
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
Co-authored-by: Pavel Esir <pavel.esir@intel.com>
Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
Co-authored-by: Andrew Kwangwoong Park <andrew.kwangwoong.park@intel.com>
Co-authored-by: Mikhail Letavin <mikhail.letavin@intel.com>
Co-authored-by: Evgeny Kotov <evgeny.kotov@intel.com>
Co-authored-by: Svetlana Dolinina <svetlana.a.dolinina@intel.com>
Co-authored-by: Victor Kuznetsov <victor.kuznetsov@intel.com>
Co-authored-by: Dmitrii Khurtin <dmitrii.khurtin@intel.com>
Co-authored-by: Ivan Novoselov <ivan.novoselov@intel.com>
Co-authored-by: Aleksandr Pertovsky <aleksandr.pertovsky@intel.com>
Co-authored-by: Nikolay Shchegolev <nikolay.shchegolev@intel.com>
Co-authored-by: Yegor Kruglov <yegor.kruglov@intel.com>
Co-authored-by: Polina Brzezinskaya <polina.brzezinskaya@intel.com>
Co-authored-by: iliya mironov <iliya.mironov@intel.com>
Co-authored-by: mei, yang <yang.mei@intel.com>
2021-09-20 11:47:34 +03:00
|
|
|
model_recs = get_model_recs(test_conf_root)
|
|
|
|
|
|
|
|
|
|
for model_rec in model_recs:
|
2020-10-30 00:37:02 +03:00
|
|
|
if "name" not in model_rec.attrib or model_rec.attrib.get("source") != "omz":
|
|
|
|
|
continue
|
|
|
|
|
model_name = model_rec.attrib["name"]
|
2021-02-24 14:56:09 +03:00
|
|
|
precision = model_rec.attrib["precision"]
|
2020-10-30 00:37:02 +03:00
|
|
|
|
|
|
|
|
info_dumper_path = omz_path / "tools" / "downloader" / "info_dumper.py"
|
2021-02-24 14:56:09 +03:00
|
|
|
cmd = '"{executable}" "{info_dumper_path}" --name {model_name}'.format(executable=sys.executable,
|
|
|
|
|
info_dumper_path=info_dumper_path,
|
|
|
|
|
model_name=model_name)
|
2021-03-12 01:14:40 +03:00
|
|
|
try:
|
|
|
|
|
out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True, universal_newlines=True)
|
|
|
|
|
except subprocess.CalledProcessError as exc:
|
|
|
|
|
log.warning(exc.output)
|
|
|
|
|
continue
|
|
|
|
|
|
2020-10-30 00:37:02 +03:00
|
|
|
model_info = json.loads(out)[0]
|
|
|
|
|
|
|
|
|
|
# update model record from test config with Open Model Zoo info
|
|
|
|
|
fields_to_add = ["framework", "subdirectory"]
|
|
|
|
|
info_to_add = {key: model_info[key] for key in fields_to_add}
|
2021-02-24 14:56:09 +03:00
|
|
|
# check selected precision with model info from Open Model Zoo
|
|
|
|
|
if precision not in model_info['precisions']:
|
|
|
|
|
log.warning("Please specify precision for the model "
|
|
|
|
|
"{model_name} from the list: {model_info}".format(model_name=model_name,
|
|
|
|
|
model_info=model_info['precisions']))
|
2021-03-12 01:14:40 +03:00
|
|
|
continue
|
2020-10-30 00:37:02 +03:00
|
|
|
model_rec.attrib.update(info_to_add)
|
|
|
|
|
model_rec.attrib["path"] = str(
|
2021-02-24 14:56:09 +03:00
|
|
|
Path(model_rec.attrib["subdirectory"]) / precision / (model_rec.attrib["name"] + ".xml"))
|
2020-10-30 00:37:02 +03:00
|
|
|
model_rec.attrib["full_path"] = str(
|
2021-02-24 14:56:09 +03:00
|
|
|
args.omz_irs_out_dir / model_rec.attrib["subdirectory"] / precision / (model_rec.attrib["name"] + ".xml"))
|
2020-10-30 00:37:02 +03:00
|
|
|
|
|
|
|
|
# prepare models
|
|
|
|
|
downloader_path = omz_path / "tools" / "downloader" / "downloader.py"
|
|
|
|
|
cmd = '{downloader_path} --name {model_name}' \
|
2021-02-24 14:56:09 +03:00
|
|
|
' --precisions={precision}' \
|
2020-10-30 00:37:02 +03:00
|
|
|
' --num_attempts {num_attempts}' \
|
|
|
|
|
' --output_dir {models_dir}' \
|
|
|
|
|
' --cache_dir {cache_dir}'.format(downloader_path=downloader_path, model_name=model_name,
|
2021-02-24 14:56:09 +03:00
|
|
|
precision=precision, num_attempts=OMZ_NUM_ATTEMPTS,
|
2020-10-30 00:37:02 +03:00
|
|
|
models_dir=args.omz_models_out_dir, cache_dir=args.omz_cache_dir)
|
|
|
|
|
|
|
|
|
|
run_in_subprocess(cmd, check_call=not args.skip_omz_errors)
|
|
|
|
|
|
|
|
|
|
# convert models to IRs
|
|
|
|
|
converter_path = omz_path / "tools" / "downloader" / "converter.py"
|
|
|
|
|
# NOTE: remove --precisions if both precisions (FP32 & FP16) required
|
|
|
|
|
cmd = '{executable} {converter_path} --name {model_name}' \
|
|
|
|
|
' -p {executable}' \
|
2021-02-24 14:56:09 +03:00
|
|
|
' --precisions={precision}' \
|
2020-10-30 00:37:02 +03:00
|
|
|
' --output_dir {irs_dir}' \
|
|
|
|
|
' --download_dir {models_dir}' \
|
2021-02-24 14:56:09 +03:00
|
|
|
' --mo {mo_tool}'.format(executable=python_executable, precision=precision,
|
2020-10-30 00:37:02 +03:00
|
|
|
converter_path=converter_path,
|
|
|
|
|
model_name=model_name, irs_dir=args.omz_irs_out_dir,
|
|
|
|
|
models_dir=args.omz_models_out_dir, mo_tool=args.mo_tool)
|
|
|
|
|
run_in_subprocess(cmd, check_call=not args.skip_omz_errors)
|
|
|
|
|
|
|
|
|
|
# rewrite test config with updated records
|
|
|
|
|
test_conf_obj.write(args.test_conf)
|
|
|
|
|
|
|
|
|
|
# Open Model Zoo doesn't copy downloaded IRs to converter.py output folder where IRs should be stored.
|
|
|
|
|
# Do it manually to have only one folder with IRs
|
|
|
|
|
for ir_src_path in args.omz_models_out_dir.rglob("*.xml"):
|
|
|
|
|
ir_dst_path = args.omz_irs_out_dir / os.path.relpath(ir_src_path, args.omz_models_out_dir)
|
2021-04-23 12:56:59 +03:00
|
|
|
# allows copy to an existing folder
|
|
|
|
|
copy_tree(str(ir_src_path.parent), str(ir_dst_path.parent))
|
2020-04-15 19:01:57 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|