Compare commits

...

574 Commits

Author SHA1 Message Date
Maxim Shevtsov
834755680d fp32 outputs fixup to properly handle negative values (#2529) 2020-10-05 13:51:41 +03:00
Maxim Shevtsov
c8b783f644 Pre.2021.1.submission (#2094)
* fixed code and updated unit tests to accomodate auto-reshaping graphs, to unlock full validation

* [CPU][BF16] bf16 for Gemm or MatMul was enabled (#1920)

# Conflicts:
#	inference-engine/thirdparty/mkl-dnn

* Fuse EmbeddingBag

* [IE CLDNN] Fix result storing in leftover's branch (#2050)

Co-authored-by: Alexey Varyzgin <alexey.varyzgin@intel.com>
Co-authored-by: Vafin, Maxim <maxim.vafin@intel.com>
Co-authored-by: Ilya Znamenskiy <ilya.znamenskiy@intel.com>
2020-09-07 17:24:59 +03:00
Maxim Shevtsov
1e6ca0627a MLPerf's pre.2021.1.submission branch update (DO NOT REVIEW) (#2083)
* fixed code and updated unit tests to accomodate auto-reshaping graphs, to unlock full validation

* [CPU][BF16] bf16 for Gemm or MatMul was enabled (#1920)

# Conflicts:
#	inference-engine/thirdparty/mkl-dnn

* Fuse EmbeddingBag

Co-authored-by: Alexey Varyzgin <alexey.varyzgin@intel.com>
Co-authored-by: Vafin, Maxim <maxim.vafin@intel.com>
2020-09-04 18:20:25 +03:00
Maxim Shevtsov
05a57ebd8e fixed code and updated unit tests to accomodate auto-reshaping graphs, to unlock full validation (#1808) 2020-08-17 20:17:30 +03:00
Maxim Shevtsov
e8a178e196 fixed unit tests to accomodate auto-reshaping graphs, to unlock full validation (#1795) 2020-08-14 21:52:22 +03:00
myshevts
0aead5c070 Fuses duplicated QuantizeLinear and DequantizeLinear nodes, (redundancy in the official NV's int8 MLPerf BERT model that is not good for the OV), per discussion with NV reps 2020-08-14 15:57:51 +03:00
myshevts
dcfaeedb6f multo-graph for automatic dynamic sequence handling via auto-pre-reshaping 2020-08-14 15:57:51 +03:00
Mikhail Letavin
2bdb658ca9 [IE CLDNN] dp4a check that works both with old and new drivers (#1766) 2020-08-14 14:50:33 +03:00
Gleb Kazantaev
983e2a922f opset4 Convolution/GroupConvolution -> Multiply fusion (#1754)
* Added new predicates for smart pattern matching

* Added ConvMul and GroupConvMul fusion passes based on opset4; Added CPU functional tests for comparing fusion accuracy

* Improved ConvMultiply fusion to support scalars; Added positive and negative tests

* Added ConvolutionBackprop/GrouConvolutionBackprop Multiply fusion; Added functional tests
2020-08-14 13:47:02 +03:00
Ilya Lavrenov
a4dcfed1a9 Simplified plugin interfaces (#1745)
* Simplified plugin interface

* Allow not implemented

* Fixes

* Fixed CPU plugin tests

* Fixed tests dependencies

* Fixes

* Fixed GPU plugin compilation

* Renamed plugin

* Fixes

* Removed tests for plugin base

* Fix2

* Fix 2

* Define a macro to define plugin creation function

* Clean-up

* Fixed OSX build

* Fixed CentOS

* Fixed exception catch / throw

* Fixed clang issue

* Fixed python tests on macOsx
2020-08-14 12:11:54 +03:00
iliya mironov
0cc63cbb05 Add asinh acosh atanh to python api (#1488)
* Add asinh acosh atanh to python api
2020-08-14 10:07:58 +03:00
Ilya Churaev
d8133824b3 Deprecate FusedOp class (#1758)
* Deprecate FusedOps

* Try to fix windows

* Added temp headers
2020-08-14 06:27:58 +03:00
Alexander Zhogov
ea5bfaf8d6 Azure CI: Add IncrediBuild option: /MaxCPUS=40 (#1779)
* Azure CI: Add IncrediBuild options: /ShowTime /StopOnErrors /MaxCPUS=62

* set 48 cores

* Remove /StopOnErrors

* Set 40 cores
2020-08-14 00:55:34 +03:00
Ilya Lavrenov
a8842ec32e Updated mock interfaces in tests (#1762)
* Updated mock interfaces in tests

* Added mock_engine dependency
2020-08-13 20:17:30 +03:00
Jan Iwaszkiewicz
680cdacc11 [nGraph] Add Manager to Py API (#1533)
* Added test

* working ManagerWrapper

* Clean-up in ManagerWrapper

* worksave

* fixed building error

* Finished test of constant folding

* remove unused param

* Added get_vector function

* clean up
2020-08-13 19:56:59 +03:00
Alexander Peskov
7c921b8b45 [CPU] Add explicit storage for MemoryNode (#895) 2020-08-13 19:06:20 +03:00
Sergey Lyalin
9a62e00674 TypeRelaxed implementation (#1561)
* RTTI base for ngraph::Node; cherry-pick from another branch, draft

* Added comments, moved code, switched to custom RTTI-based version of is_type

* Move rtti definitions in ngraph op class to the beginning of each class definition as a preparation for the next replacement

* Migrate part of operations to new RTTI

* Migrate GroupConvolution and Concat to new RTTI

* Apply code style for ngraph part

* Rename RTTI_DECLARATION/DEFINITION to NGRAPH_RTTI_DECLARATION/DEFINITION

* Reverted accidentally updated version of mkldnn

* TMP: rewrite RTTI back to constexprions as an attempt to fix static objects initialization order issue

* Apply ngraph code style

* Finalize move back to constexpr for RTTI

* Applied code-style

* TypeRelaxed template class implementation and necessary changes in ngraph + tests.

* Applied code-style

* Fix in fast algorithm in GraphRewrite, add new tests for this and other cases

* Make parent optional parameter for NGRAPH_RTTI_DECLARATION and remove Node::type_info; remove ability to have Node as a parent for type_info

* Try to resolve compilation error on Windows

* The next attempt to fix Windows build: re-introduce get_type_info_static

* Removed file that was removed in master and kept in this branch by mistake

* Next attempt to fix Windows build: externConstexpr

* Attempt to fix win build: extra public (suspect icc bug), remove get_type_info_static as useless.

* Next attempt to fix Windows: proxy const and constexpr

* Fixed constexpr

* Next attmpts: move get_type_info to cpp file

* Code stype fix

* Re-implemented RTTI without use of constexpr; run-time initialization is used; removed global definitions to avoid issues with order of static objects initialization

* Removed externConstexpr flag and removed TRANSFOMRATIONS_API for TypeRelaxed

* get_type_info_static initializes static local constant with type_info that is used for CLASS::type_info and CLASS::get_type_info

* Removed not needed debug output and useless comments

* Implemented better copy ctor for Node

* Fixed VisualizeTree issue for TypeRelaxed: stopped using < and > in type_info::name

* Better comments and names for methods

* Remove unused include

* Remove commented line

* Workaround for legacy conversion that uses Node::get_type_info().name as a type for the resulting CNNLayer leading to incorrect types for TypeRelaxed-based operations and then to fail in plugins

* Fixed typos, explicit ctor for TypeRelaxedBase, explanation for the need of get_overridden_output_type

* Fix typo

* Fixed issue with non-static name in type definition for TypeRelaxed and fixed WrapType to make it compatible with hierarchical relations between types

* Reverted default ctor for Output and reverted ability to reduce number of outputs for a Node; syntactically better debug message for a Node

* Cover methods of TypeRelaxedBase by tests

* Apply code-style
2020-08-13 18:45:37 +03:00
Andrew Bakalin
44236c5d9a [IE][VPU][GT]: Fix different blobs for the same network (#1738)
* Use vector instead of unordered_map in order to get stable blob serialization.
2020-08-13 14:57:10 +03:00
Evgeny Lazarev
133baf23ef Updated a link to MO FAQ (#1750) 2020-08-13 13:20:29 +03:00
Alexander Zhogov
98cf891b25 Azure CI: Add Windows job with IncrediBuild (#1761) 2020-08-13 13:10:12 +03:00
Gorokhov Dmitriy
ce90329b26 [CPU] Disable quantize ranges validation in order to avoid regressions (#1720) 2020-08-13 08:39:08 +03:00
Ilya Churaev
618c61537b Remove some builders for old operations (#1736)
* Remove some builders

* Removed reshape v0 builder

* Fixed code style
2020-08-13 07:17:24 +03:00
Gleb Kazantaev
e752911b62 nGraph passes clean up (#1742)
* Cleanup pass::Manager;Update VisualizeTree to inherit FunctionPass; Removed deprecated tranformations types

* Removed legacy code; Updated docs
2020-08-13 06:49:51 +03:00
Andrey Zaytsev
df7fb6c069 Changed anchors (#1749) 2020-08-13 00:11:35 +03:00
azhogov
edbb54ff8a Revert "Azure CI: Add Windows job with IncrediBuild (#1282)"
This reverts commit 41c5f2d2d6.
2020-08-12 23:17:10 +03:00
Alexander Zhogov
41c5f2d2d6 Azure CI: Add Windows job with IncrediBuild (#1282)
* Azure CI: Add Windows job with IncrediBuild

* Update IB version to 9.4.6

* Fix "Clone submodules"

* Update IB version to 9.5

* Update install link

* Add debug out

* Update debug out

* Remove debug out

* Disable initiator machine from acting as helpers
2020-08-12 20:22:00 +03:00
Anna Alberska
93d3fec503 [GNA] fix scale factor issue in remove permutation test (#1740) 2020-08-12 17:37:00 +03:00
Mateusz Tabaka
df448c092e Improve SpaceToDepth tests (#1661) 2020-08-12 16:06:09 +02:00
Ilya Churaev
819aadd981 Removed ngraph assertion (#1719) 2020-08-12 15:39:51 +03:00
Ilya Churaev
b5cf2a1f2e Removed cpio (#1735) 2020-08-12 15:39:23 +03:00
Alexey Moskalev
750fc90293 Update issue templates
Removing wrong template
2020-08-12 13:17:34 +03:00
Alexey Moskalev
8d196e1e6d Update issue templates
removing wrong templates
2020-08-12 13:16:22 +03:00
Alexey Moskalev
31d45061d4 Update issue templates
First version
2020-08-12 13:13:41 +03:00
Ilya Lavrenov
2b81b947dc Define a macro to define plugin creation function (#1727) 2020-08-12 12:00:30 +03:00
Konrad Dobros
21bef4ed39 [IE CLDNN] Add asymmetric dw convolution improvements (#1251)
This change adds full support for asymmetric quantization to optimized
depthwise convolution, adds slm optimization and other minor
improvements.

Issue: CVS-25122
2020-08-12 09:01:19 +03:00
Roman Kazantsev
2ccd9b0bc8 Add requirements_tf2.txt to package_BOM.txt (#1728) 2020-08-12 08:55:56 +03:00
Ilya Churaev
40ce418eab Removed constant folding pass for reverse (#1716) 2020-08-12 06:57:38 +03:00
Dmitry Kurtaev
f25c8843dc size_t on 32bit OS (#1721) 2020-08-12 06:56:19 +03:00
Andrey Zaytsev
a0581d3d8f Merging Documentation updates for 2020.4 (#1672) (#1726) 2020-08-11 19:10:56 +03:00
Evgenya Stepyreva
9c1f479a61 [ MO ] Turning GNMT KSO OFF (#1718) 2020-08-11 18:47:27 +03:00
Ivan Tikhonov
abab645c42 Unroll transformation for TensorIterator (#1259)
* unroll ti transformation, lstm sequence ie, rnn sequence ie

* Update unroll ti transformation, added GRUSequenceIE op, fixed several ti e2e tests

* apply ngraph codestyle

* fix naming after unroll transformation

* Added default constructor for RNNCellBase, fix conversions

* copy runtime info

* added UnrollTI unit tests

* clean up, move sequence ops in a separate PR

* clean up, ngraph code style

* temporary disable ngraph reader unit tests for ti

* fix unit tests on windows

* naming: use name of tensor after unroll tensor iteration transformation

* apply transformations to tensor iterator body, separate pass for ti transformations, fix naming issue

* fix build

* remove TensorIterationTransformations pass

* fix includes

* resolve conflicts

* fix build: incorrect includes

* remove split/concat for single iteration of TI, update to opset4, unit tests

* use matcher pass instead of graph rewrite

* try to enable UnrollTI transformation for all plugins

* disable unrollTI transformation for cpu plugin

* resolve review comments, enable unit tests

* update transformation description

* fix unit tests

* update transformation pipeline

* clean up

* clean up

* resolve review comments
2020-08-11 18:46:57 +03:00
Roman Kazantsev
b4b03b14f7 Separate MO configuration for TensorFlow 2 model conversion (#1685)
* Separate MO configuration for TensorFlow 2 model conversion

Also, it updates documentation including steps to convert
TF2 model with a custom layer in Keras H5 format into SavedModel

* Do fixes based on the first-round code review
2020-08-11 18:02:05 +03:00
Mateusz Tabaka
5814bd9b98 Improve DepthToSpace tests (#1659) 2020-08-11 16:28:24 +02:00
Anastasia Kuporosova
02e5a912a2 [Tools] Install compile tool to tool directory (#1649) 2020-08-11 17:27:49 +03:00
Tomasz Dołbniak
76648b378a Make Clip work for dynamic input (#1666) 2020-08-11 16:59:15 +03:00
Jan Iwaszkiewicz
2b6b047b43 [nGraph] Create Python API support for rt_info (#1696) 2020-08-11 15:57:31 +02:00
Vladimir Paramuzov
fb8a9cbb87 [IE CLDNN] Enabled fsv16 asymmetric first conv (#1372) 2020-08-11 16:40:52 +03:00
Ilya Churaev
c46c978c79 Remove GetOutputElement op (#1604) 2020-08-11 15:28:14 +03:00
Anna Alberska
21f2a97402 [GNA] Support of NHWC conv2d with N=1 H=1 and 1xk Kernel (#1209)
* [GNA] Support of NHWC conv2d with N=1 H=1 and 1xk Kernel

* [GNA] add test for comparing optimization outputs & cpplint fixes

* fix getInputTo() & fix cpplint

* fix tests

* revert kernel padding

* add AddConvolutionKernelPadPass & refactor

* cpplint fix

* fix CI issues & add layout sensitive dimensions

* move kernel padding issue to another branch

* add more legible error descriptions

* fix legacy tests & disable 3d input convolution tests

* change comment messages

* fix additional convolution kernel padding for PWL case
2020-08-11 15:20:19 +03:00
Egor Churaev
2caca604ca [IE CLDNN] Fix reshape for yxfb layout (#1632)
In one of the network it was the following pipeline:
```
FullyConnected -> Reshape -> FullyConnected
```
And the output of Reshape wasn't in the same order as input for this
layer. I found that the problem was connected with format of the layers.
During optimization passes this pipeline was transformed to the
following:
```
FullyConnected -> Reorder -> Reshape -> Reorder -> FullyConnected
```
Both `FullyConnected` layers works with `yxfb` format.  This is why
Reorder layer after the Reshape has output layout with format `yxfb` and
`reshape_in_layout.format` returns `yxfb` format. But in this case we
have to convert Reshape to `bfyx` format because in this case we won't
change the order of elements.
I replaced `reshape_in_layout.format` (which returns `yxfb`) and
explicitly set `bfyx` format.

JIRA: 35288
2020-08-11 14:52:04 +03:00
Pavel Rodionov
129376f609 [GNA] Bump GNA2 version to 1047 (#1629) 2020-08-11 14:37:40 +03:00
Pavel Rodionov
f47bd72301 [GNA] Remove empty PWL (#1224) 2020-08-11 14:35:39 +03:00
Anna Alberska
d8b366c573 [GNA] Add Basic_LSTM_S test (#805)
* add Basic_LSTM_S test

* add comparing with model with unrolled TI

* move computing reference output to overridden CalculateRefs()
2020-08-11 12:46:27 +03:00
Gleb Kazantaev
10d1cd3162 Removed CNNNetwork BlobTransformer (#1709)
* Removed CNNNetwork BlobTransformer

* Removed inference_engine_lp_transformations dependency for GNA and VPU plugins
2020-08-11 12:14:14 +03:00
Denis Orlov
8c122f4ea0 [GNA] Fixes in checks, asserts, etc. (#903) 2020-08-11 12:13:06 +03:00
Ilya Churaev
3c9fc72b58 Changed structure of nGraph core library (#1658) 2020-08-11 11:11:33 +03:00
Rafal Blaczkowski
0721761492 Enable Model Zoo in OpenVINO-ONNX CI (#1660) 2020-08-11 09:28:55 +02:00
Katarzyna Mitrus
0be11a462f HSwish operation specification (#1708)
* HSwish specification init

* Update docs/ops/activation/HSwish_4.md

Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com>

* Update docs/ops/opset4.md

Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com>
2020-08-11 09:54:08 +03:00
Ilya Znamenskiy
6cccbcf28a [IE CLDNN] Gemm fp16/fp32 optimized kernel (#1646) 2020-08-11 09:54:00 +03:00
Evgenya Stepyreva
2d2a6dbfd8 [ MO ] Fixed layout interpretation for 4/5D tensors calculated from ShapeOfs (#1634) 2020-08-11 09:34:04 +03:00
Jan Iwaszkiewicz
2b474c8a47 Fixed access to the data of FP16 IRs with nGraph Python API (#1707) 2020-08-11 07:16:11 +03:00
Ilya Lavrenov
51b564e9d8 Moved plugin-specific utils from blob_factory.hpp (#1710) 2020-08-11 07:06:24 +03:00
Dmitry Kurtaev
2b9ffd9ff8 Add python executable for RPI compilation Docker (#1530) 2020-08-10 23:10:46 +03:00
Maxim Vafin
a6efc86a6a [MO] Support ONNX QuantizeLinear (#1451)
* [MO] Support ONNX QuantizeLinear

* Update docs

* Fix cast type

* Fix error messages
2020-08-10 21:10:45 +03:00
Ilya Lavrenov
e2e2785131 Moved legacy API to legacy/ subfolder for include (#1677) 2020-08-10 18:33:25 +03:00
Ilya Churaev
a60f1d4633 Removed onnx_import folder from src (#1706) 2020-08-10 18:25:44 +03:00
Ilya Lavrenov
f95f756929 Changed ICNNNetwork to CNNNetwork in QueryNetwork (#1704) 2020-08-10 18:24:54 +03:00
Ilya Churaev
3928f8806d Fixed input/output shape initialization (#1695)
* Fixed input/output shape initialization

* Use template_extension library in tests
2020-08-10 18:24:25 +03:00
Gleb Kazantaev
97842212c3 Removed transformations _tbl.hpp files (#1700) 2020-08-10 16:32:03 +03:00
Evgeny Lazarev
318d38770b Enable swish (#1682)
* Draft version of the Swish nGraph operation and fusing transformations for different approaches to express the operation

* Swish fusing transformation refactoring

* Added Swish operation and extractor for TF. Removed unfolding transformation for the operation.

* Added SwishIE. Implemented transformation to convert Swish to SwishIE.

* Code style fixes

* Updated Swish reference implementation. Added tests for shape and value inference


* Fixed code style for Python API

* Fixed unit test

* Apply review comments

* Use matcher_pass_callback

* Make m_alpha attribute protected in the SwishIE operation

* Fixed Swish op PythonAPI test
2020-08-10 15:51:21 +03:00
Ilya Lavrenov
600ad8d180 Fixed CPU performance (#1702) 2020-08-10 15:43:25 +03:00
Evgenya Stepyreva
3cc7896e42 [ MO ] Extended Const->Result replacer (#1688)
* [ MO ] Extended Const->Result replacer
2020-08-10 15:36:05 +03:00
Kamil Magierski
cb8892ca2b [GNA] Fix cases when Gna2ModelGetLastError() returns unknown error (#1255)
Co-authored-by: kmagiers <kmagiers@intel.com>
2020-08-10 15:23:25 +03:00
Mateusz Bencer
f5884231d3 Extend dynamic shape support for ops which use auto padding mode (#1432) 2020-08-10 13:48:18 +02:00
Mateusz Bencer
e88c7b5ed7 Check if input of Unsqueeze is parameter during NopElimination (#1622) 2020-08-10 13:45:58 +02:00
Mateusz Bencer
ae48d9deb8 Test calculation output shape for Broadcast op, relax restrictions for partially dynamic input data (#1247) 2020-08-10 13:39:14 +02:00
Pavel Rodionov
ffe8599c30 [GNA] Remove old GNA1 from Cmake scripts (#1686) 2020-08-10 14:38:11 +03:00
Alexandra Sidorova
50e003cded [CPU] Added Mish activation (#1555) 2020-08-10 13:59:17 +03:00
Evgenya Stepyreva
1eac9e3932 [ KALDI ] Disable KSO (#1689) 2020-08-10 12:22:42 +03:00
Pavel Esir
7e82728130 remove TestMode restriction for batchnorm in Kaldi (#1697) 2020-08-10 12:21:53 +03:00
Pavel Esir
75d2d88b61 Reshape able slice (#1241)
* Added Caffe Slice_ext

* Added TFSlice, AttributedSlice (both with extractors and replacers), corrected SliceConverter and added unittests for all cases

* added comments to each type of Slice operation; optimized shape inference; moved mxlice inside of slice.py; renamed slice_replacers

* removed type annotation for get_shape_after_slice routine

* replaced zeros_like with zeros

* Corrected preserving node names, renamed attributes names, added tests fro slice_replacer onnx phase

* Renamed slice_replacers.py

* added more unittest cases

* added type annotations, moved to more relevant place routines for shape calculation, and some other minor corrections

* corrected a typo `normalize_slice_indices` comment

* corrected shape calculation for Nonconstant inputs

* corrected a few typos

* corrected type declarations

* corrected shape inference with rounding

* refactored unit-tests for front transforms of Slice

* added error raising for negative and zero shapes

* removed magic_num

* corrected AttributedSlice, clarified comments

* fixed unit-test for AttributedSliceToSlice

* typo in type hints corrected

* removed supported_attrs

* returned back default None for attrs of Slice
2020-08-10 12:19:08 +03:00
Vladislav Volkov
5883a232c3 Performance counters for nGraph and additional ITT libraries on Linux (#1665) 2020-08-10 06:58:01 +03:00
Gleb Kazantaev
1c062b6e92 Updated ConvertPrecision transformation to be executed for TI Body (#1673)
* Updated ConvertPrecision transformation to be executed for TI Body

* Added type fusion for GenericIE operation

* Added test for TensorIterator body precision conversion
2020-08-08 21:33:07 +03:00
Ilya Churaev
135e7c0aba Move downgrade passes to pass folder (#1675) 2020-08-07 21:46:13 +03:00
Maxim Andronov
4054364fbf [NGraph] Add scatterNDUpdate and scatterUpdate reference implementations (#1494) 2020-08-07 16:09:28 +03:00
Konrad Dobros
caa38130b9 [IE CLDNN] Extend resample int8 packing optimization (#1662)
This extends resample optimization for 8-bit types that uses feature
packed to mode to process multiple features in one work-item to features
not being multiple of packing factor.

For nearest resampling it is safe to copy extra feature padding for
blocked formats, so this change only removes this condition.
2020-08-07 16:08:40 +03:00
Alexander Trifonov
3becdf8a5e docs contribution guides (#1535)
* docs contribution guides

* Fixed link to documentation_guidelines.md

Co-authored-by: Alexander1 Trifonov <alexander1.trifonov@intel.com>
Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com>
2020-08-07 15:33:11 +03:00
iliya mironov
52ad786b6c Add convert GluonCV docs (#1413)
* Add convert GluonCV docs
2020-08-07 14:37:55 +03:00
iliya mironov
c8d74632f9 Add mxnet extractors (#1667)
* Add mxnet extractors for hyperbolic functions
2020-08-07 14:36:41 +03:00
Ilya Churaev
6085c797d3 Moved frontends to separate folder (#1657) 2020-08-07 13:08:38 +03:00
Ilya Lavrenov
f832453d9d Added compilation of Plugin API headers with strict flags (#1654)
* Minimized ngraph headers inclusion

* Added compilation of plugin api headers with strict flags

* Fixed -WPedantic issue in ngraph headers

* Fixed compilation

* Trying to fix Windows

* Fixed GNA unit tests compilation

* Disabled WX test on Windows
2020-08-07 12:06:47 +03:00
Rafal Blaczkowski
054a7cdf8d Enable ngraph python tests in OpenVINO-ONNX CI (#1603)
* Enable ngraph python tests

* Refactor and unify ngraph with onnx python tests

* Revert deprecated test cases

* Set ngraph and onnx python tests as a one test suite execution

* Change unstrict Xfails to strict ones

* Update after review:
 - add model zoo to onnx tests,
 - improvements of tests

* Revert mounting zoo models dir

Co-authored-by: Michał Karzyński <4430709+postrational@users.noreply.github.com>
2020-08-07 09:58:57 +03:00
Maxim Andronov
f9023ff7da [CPU] Add support 4th and 5th input DetectionOutput (#1290)
* [CPU] Add support 4th and 5th input DetectionOutput

* fix any comments

* move reference to ngraph

* some changes for mx nms

* change namespace for ref impl
2020-08-07 09:05:41 +03:00
Ilya Lavrenov
8c118ef8b2 Moved caseless to Plugin API (#1664) 2020-08-07 06:24:28 +03:00
Gleb Kazantaev
764eff9819 Initial nGraph Transformations type info (#1635) 2020-08-07 06:06:32 +03:00
Ilya Lavrenov
09c43536fe Link CMAKE_DL_LIBS to IE (#1663) 2020-08-06 18:49:17 +03:00
iliya mironov
7e856c3700 Add mish fusion transformation (#1399)
* Add mish fusion transformation

* Add mish op to python api
2020-08-06 15:55:12 +03:00
Roman Kazantsev
ab869da588 Add CTCLoss op to nGraph Python API (#1642) 2020-08-06 15:03:39 +03:00
Maxim Andronov
21c4312453 [CPU] Add check to reduce for scalar dims (#1577) 2020-08-06 14:44:29 +03:00
Evgeny Lazarev
853cfaa038 Fixed extractor for MVN from ONNX (#1653)
* Fixed extractor for MVN from ONNX

* Updated MVN extractor from ONNX

* Code style
2020-08-06 13:53:16 +03:00
Vladislav Volkov
8ae30481f1 ENABLE_PROFILING_ITT option is ignored if ITT library not found (#1647) 2020-08-06 13:20:35 +03:00
Mateusz Tabaka
58fe0106cc Reduce number of ops generated by ngraph::pass::BatchNormDecomposition (#1569)
Number of ops went down by 4.
Also fewer floating point operations improves precision here, so we're able
to unblock some test cases from ngraph's suite.
2020-08-06 11:14:08 +02:00
Ilya Lavrenov
6a5993fb36 Implement unicode conversion using Windows native functions (#1590)
* Implement unicode conversion using Windows native functions

* NOCPPLINT

* Fixed deprecated c++ api usage in tests

* Moved impl to cpp

* Moved Unicode utils to Plugin API

* Added missed include for Windows

* Fixes for unit tests; CentOS fixes

* Fixed Windows compilation

* Fixed unit tests on Unix

* Fixed unix 2
2020-08-06 12:01:34 +03:00
Anton Potapov
ea34f04028 [PP GAPI] - U16toF32 conversion kernel (#1298)
- the kernel itself is not yet used in the Preprocessing graph
- tests
2020-08-06 06:26:49 +03:00
Ilya Lavrenov
6f6d6f8296 Removed not-used file utils (#1644) 2020-08-06 06:18:48 +03:00
Ilya Lavrenov
b9c3825897 Moved QueryNetworkResult to ie_common.h (#1648) 2020-08-06 06:17:29 +03:00
Ilya Churaev
7a314f216a Remove JSON serializer (#1638) 2020-08-06 05:51:05 +03:00
Ilya Lavrenov
0339fff3bc [IE CLDNN] Add push / pop macro for OpenCL header (#1645) 2020-08-05 23:55:42 +03:00
Andrey Somsikov
2c41b8e4f3 Add support for /INTEGRITYCHECK flag on Windows (#1390)
* Build dlls with INTEGRITYCHECK flag if ENABLE_INTEGRITYCHECK=ON

INTEGRITYCHECK flag enforces digital signature before loading the binary in Windows.
Also, refine /guard:cf flag enabling - MSCV, Intel, clang compilers does support /guard:cf.
2020-08-05 22:37:16 +03:00
Alexander Zhogov
ee2312abdb Azure CI: Update metadata API version (#1652)
* Azure CI: Update metadata API version

* Set -NoProxy

* Fix issue
2020-08-05 18:42:50 +03:00
Alexander Chaiko
1acfca0ec6 [IE CLDNN] Support IC={1,2,4} in the first convolution kernel (#1583) 2020-08-05 18:32:32 +03:00
Alexey Ershov
dc89cb1627 [IE][VPU][GT]: Added support for SoftPlus & Swish layers (#1612)
* Implement SoftPlus stage
* Implement Swish stage
2020-08-05 18:28:04 +03:00
Mikhail Letavin
fcb93b161d [IE CLDNN] Implement nGraph function support in QueryNetwork() (#1601) 2020-08-05 18:26:14 +03:00
Ilya Lavrenov
415b441be2 Updated documentation for HETERO plugin (#1643) 2020-08-05 18:04:35 +03:00
Bartosz Lesniewski
4fa55d581a Refactored nGraph operator tests to use TestCase (#1623) 2020-08-05 16:27:18 +02:00
Alexander Peskov
f56cfd3c4b Fix missprint
Signed-off-by: Alexander Peskov <alexander.peskov@intel.com>
2020-08-05 17:01:35 +03:00
Alexander Peskov
49ac69f855 Add fallback for TBB version without NUMA-aware API
Signed-off-by: Alexander Peskov <alexander.peskov@intel.com>
2020-08-05 17:01:35 +03:00
Alexander Peskov
cd92d392b6 External TBB support on cmake script level
Signed-off-by: Alexander Peskov <alexander.peskov@intel.com>
2020-08-05 17:01:35 +03:00
Alexander Peskov
9d3292dd15 Fix clang build
Signed-off-by: Alexander Peskov <alexander.peskov@intel.com>
2020-08-05 17:01:35 +03:00
Andrew Bakalin
5272e94614 [IE][VPU]: Optimizations for Broadcast & ROIAlign (#1641)
* Update firmware
2020-08-05 16:45:19 +03:00
Anton Zaytsev
8570015347 [IE TESTS] Add VariadicSplit in SingleLayerTest (#1468)
* [IE TESTS] add variadic split

* [IE TESTS] update  variadic split

* [IE TESTS] update instance variadic split

* [IE TESTS] update variadic_split.cpp
2020-08-05 15:06:55 +03:00
Mateusz Bencer
0100a16228 Reference implementation to Split op (#1526)
* first version

* fixed lower_bounds

* Added unit test

* Added support of negative axis

* Added more tests

* Slice refactor in order to reduce binary size

* remvoed unused headers

* added eveluate method to split

* review remarks. part 1

* review remakrs. part 2

* review remarks

* sync with master
2020-08-05 14:32:14 +03:00
Alexander Zhogov
1ccf3ecf53 Azure CI: Install monitoring (#1640)
* Azure CI: Install monitoring

* Fix cleaning
2020-08-05 12:44:37 +03:00
Vitaliy Urusovskij
2386c5d376 [Stress] Define --timeout in run_memcheck.py used in gtest-parallel (#1576) 2020-08-05 12:33:01 +03:00
Ilya Lavrenov
c084ace9cd Removed CMAKE_DL_LIBS from OpenVINO ITT wrapper (#1637) 2020-08-05 12:28:24 +03:00
Rafal Blaczkowski
4f96ea684a Update xfail status of onnx python tests (#1639) 2020-08-05 12:20:07 +03:00
Michał Karzyński
dbb87462f6 Change working directory in setup.py (#1624)
Co-authored-by: Alexander Zhogov <alexander.zhogov@intel.com>
2020-08-05 12:07:04 +03:00
Maxim Vafin
75cb10fd6d Improve node name with port resolving (#1581)
* Improve node name with port resolving

* Fix IE remove Convert on output

* Address feedback
2020-08-05 11:31:17 +03:00
Ilya Churaev
850665d992 Enable NGRAPH_DEPRECATED (#1617)
* Enable NGRAPH_DEPRECATED

* Try to fix Windows

* Added NGRAPH_SUPPRESS_DEPRECATED_END for headers

* Removed tests on downgrade/upgrade passes
2020-08-05 11:13:05 +03:00
Ilya Churaev
3ce87f5487 Mark evaluate method as constant (#1628) 2020-08-05 08:39:00 +03:00
Ilya Lavrenov
388aae5fd6 Removed public dependency on CMAKE_DL_LIB (#1633) 2020-08-05 06:11:13 +03:00
Ilya Lavrenov
ae4bd370ea Added conversion of execution graph to old representation (#1626)
* Added conversion of execution graph to old representation

* Fixed compilation on Windows
2020-08-04 20:30:35 +03:00
Nadezhda Ageeva
7c78b0d03d [PYTHON][nGraph] add get_type_name for element type (#1513) 2020-08-04 19:01:12 +03:00
Alexander Perepelkin
0a5d6409ff Allow descendants to reuse LayerTestsCommon (#1625) 2020-08-04 18:10:29 +03:00
iliya mironov
680e93fba7 Add asinh acosh atanh extractors (#1600)
* Add asinh acosh atanh extractors

* Add asinh acosh atanh ext for tf

* Update docs
2020-08-04 14:56:15 +03:00
Rafal Blaczkowski
d14d09e796 Update ONNX Python tests (#1514) 2020-08-04 12:26:32 +02:00
Gabriele Galiero Casay
19f798b084 Ngraph unit tests refactoring: part 2 (#1518) 2020-08-04 11:56:46 +02:00
Ivan Tikhonov
80b6bf28c2 Align with the specification SpaceToBatch, BatchToSpace ops (#1140)
* Aligned SpaceToBatch/BatchToSpace with the spec, converted from fused_op to op

* Implemented transformation to decompose STB/BTS

* Added unit tests

* Added new mode (INTERPRETER_TRANSFOMATIONS) for functional tests
2020-08-04 12:35:24 +03:00
Marcin Penkowski
bb408f2ca9 Feature/ar24 int8 optimizations (#1208) 2020-08-04 12:09:23 +03:00
Jan Iwaszkiewicz
136dccf905 [nGraph] Public Py API to get function from cnnnetwork (#1567) 2020-08-04 09:39:37 +02:00
Ilya Churaev
e4b411f027 Removed constant folding for Tile op (#1595) 2020-08-04 07:42:23 +03:00
Ewa Tusień
86fb108b00 Remove reverse op from pyAPI. (#1538) 2020-08-04 06:39:29 +03:00
Sergey Lyalin
a069e39906 Hierarchical extension to nGraph RTTI (#1245)
* RTTI base for ngraph::Node; cherry-pick from another branch, draft

* Added comments, moved code, switched to custom RTTI-based version of is_type

* Move rtti definitions in ngraph op class to the beginning of each class definition as a preparation for the next replacement

* Migrate part of operations to new RTTI

* Migrate GroupConvolution and Concat to new RTTI

* Apply code style for ngraph part

* Rename RTTI_DECLARATION/DEFINITION to NGRAPH_RTTI_DECLARATION/DEFINITION

* Reverted accidentally updated version of mkldnn

* TMP: rewrite RTTI back to constexprions as an attempt to fix static objects initialization order issue

* Apply ngraph code style

* Finalize move back to constexpr for RTTI

* Applied code-style

* Fix in fast algorithm in GraphRewrite, add new tests for this and other cases

* Make parent optional parameter for NGRAPH_RTTI_DECLARATION and remove Node::type_info; remove ability to have Node as a parent for type_info

* Try to resolve compilation error on Windows

* The next attempt to fix Windows build: re-introduce get_type_info_static

* Removed file that was removed in master and kept in this branch by mistake

* Next attempt to fix Windows build: externConstexpr

* Attempt to fix win build: extra public (suspect icc bug), remove get_type_info_static as useless.

* Next attempt to fix Windows: proxy const and constexpr

* Fixed constexpr

* Next attmpts: move get_type_info to cpp file

* Code stype fix

* Re-implemented RTTI without use of constexpr; run-time initialization is used; removed global definitions to avoid issues with order of static objects initialization

* Remove already unncecessary compiler flag for Windows

* get_type_info_static initializes static local constant with type_info that is used for CLASS::type_info and CLASS::get_type_info

* Rewrite commens for NGRAPH_RTTI_... macros, remove not used header
2020-08-04 06:35:58 +03:00
Ilya Churaev
478d0368d0 Removed reshape and transpose constant folding passes (#1598)
* Removed template code from reshape implementation

* Removed constant foldyng for transpose and dyn reshape
2020-08-04 05:44:25 +03:00
Gleb Kazantaev
c518667e0a ngraph::pass::ConvertPrecision transformation (#1312)
* In this PR I'll add ngraph::pass::ConvertPrecision transformation and change only CPU Plugin to decrease number of changes. Other plugins will be updated in separate PR.

* This PR also includes changes for TI body transformations. We need to call the same sequence of transformations including ConvertPrecision for TI body.
2020-08-03 22:21:38 +03:00
Vladislav Volkov
acc9a41c62 ITT library usage fixes (#1613) 2020-08-03 21:50:26 +03:00
Evgenya Stepyreva
45d04f5f55 [ nG GRUCell ] Allowed dynamic input shape (#1606) 2020-08-03 19:55:22 +03:00
Ilya Churaev
d791d295aa Use clone_function instead of specialize_function (#1523)
* Try to use clone_function instead of specialize_function

* Try to fix stress tests

* Remove redundant specialize_function

* Fixed TI clone

* Removed redundant code

* Uncomment threading tests

* Fixed docs

* copy function friendly name too

* Fixed copy rt_info

* Fixed comments
2020-08-03 18:23:02 +03:00
Roman Lyamin
15f91be168 [IE CLDNN] Added fsv16 and int8 support in BatchToSpace and SpaceToBatch (#1381) 2020-08-03 15:04:49 +03:00
Evgenya Stepyreva
067c2414d1 [ MO GroupNorm ] Covered float Multiplication with Converts (#1602) 2020-08-03 14:45:39 +03:00
Ilya Lavrenov
9f767f7b93 Hide implementation of SharedObjectLoader to cpp files (#1556)
* Hide implementation of SharedObjectLoader to cpp files

* Fixed GPU tests compilation

* Fixes for Unix; check OpenCL headers with strict flags

* Fixed Windows

* More fixes for Windows

* Fixed Unit tests

* Enabled compilation with libVA for new GPU tests

* Fixes for case when libVA is not available

* Removed useless NOMINMAX

* Useless include

* Fix

* Fixes

* Fixes for Intel compiler

* Fix for Windows + Intel compiler

* Fixed samples compilation with Intel compiler
2020-08-03 14:01:56 +03:00
Ilya Churaev
03dda94c5d Disabled JSON library (#1599) 2020-08-03 13:59:20 +03:00
Tomasz Socha
91c71b81e0 [nG][Python]Make model runner compatibile with python 3.5 (#1578) 2020-08-03 12:56:59 +02:00
Ilya Lavrenov
b58d03ae05 Removed dirty skip from tests definitions (#1591) 2020-08-03 13:22:13 +03:00
Vitaliy Urusovskij
f8513d8fd3 [Stress] Remove --env_conf at all after deprecation (#1582) 2020-08-03 12:58:27 +03:00
Vladislav Volkov
d946f6cfde Common library to trace using Intel ITT and new performance counters (#1479) 2020-08-03 12:53:00 +03:00
Ilya Lavrenov
80f2459e8e Removed ie_parallel include from task executors (#1588) 2020-08-03 10:56:44 +03:00
Roman Lyamin
8245e5b6f4 [IE CLDNN] Added HSwish-4 operation (#1585) 2020-08-03 10:15:43 +03:00
Lukasz Debski
a17472fed0 [IE CLDNN] Gather 5d/6d support (#1553) 2020-08-03 10:05:53 +03:00
Nikita Kudriavtsev
e27382070c [IE][VPU]: Use the string size, including the null-terminated character, to serialize the DataNode name (#1496) 2020-07-31 16:21:55 +03:00
Adam Osewski
1c22023a8e Fix typo. (#1571) 2020-07-31 15:05:53 +03:00
Ilya Churaev
41da44ec07 Removed v0 convolution and group convolution (#1512) 2020-07-31 13:00:28 +03:00
Alexander Zhogov
601f66e1ec Run nGraph code style check in the root of repo (#1573) 2020-07-31 12:19:12 +03:00
Vitaliy Urusovskij
25cadb661b [Stress] Enable OMZ info_dumper.py in get_testdata.py (#1485)
* [Stress] Support OMZ model_info.py in get_testdata.py

* [Stress] Copy IRs from OMZ models folder to IRs folder

* [Stress] Support modified configs in C++ tests

* [Stress] Deprecate support of --env_conf due refactoring of configs

* [Stress] Update configs:
1. Removed env configs due deprecation
2. Moved test configs to a new format

* [Stress] Extend MemCheck records with info from test config
2020-07-31 12:13:12 +03:00
Roman Kazantsev
c56f024630 Fix for CTCLoss in NGraph (#1563)
Blank index is optional input and must be handled appropriately

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-07-31 11:57:29 +03:00
Jan Iwaszkiewicz
43652498c7 [nGraph] Py API get/set partial shape of parameter (#1560) 2020-07-31 10:14:39 +02:00
Alexander Zhogov
c5bac5a1b9 GitHub CI: Add filter for newly created PRs, and labels map in config.json (#1532)
* Add filter for newly created PRs, and labels map in config.json

* Fix label name
2020-07-31 10:43:22 +03:00
Alexander Perepelkin
d8502bf7d3 Virtual inheritance to allow inheriting test classes and overriding common logic (#1557) 2020-07-30 23:57:01 +03:00
Alexey Suhov
b760fbb9f6 add Ubuntu 20.04 to dependencies.cmake (#1565) 2020-07-30 20:49:27 +03:00
Ilya Lavrenov
17e457d7c8 Updated inference_engine.hpp (#1539) 2020-07-30 18:40:28 +03:00
Vladimir Paramuzov
8f966887d7 [IE CLDNN] Prod mode support in eltwise fusings (#1491) 2020-07-30 18:16:37 +03:00
Andrey Dmitriev
861bcc2949 [GNA] Support for cascade concat with non functional layers between concats (#598)
[GNA] Support for cascade concat with non functional layers between concats
2020-07-30 16:45:18 +03:00
Ilya Churaev
cf4dedbb92 Removed classes for DistributedInterface, State and Send, Resv v0 operations (#1549)
* Removed State

* Removed Recv and Send operations

* Remoced distributed interface
2020-07-30 16:27:21 +03:00
Ilya Churaev
ecb1344b4b Removed v0 builders (#1528) 2020-07-30 16:26:31 +03:00
Ilya Churaev
1a727a597e Changed visibility of nGraph node methods (#1544) 2020-07-30 16:25:32 +03:00
Adam Osewski
fc5d8c75d3 Fix false positives in ModelRunner. (#1541) 2020-07-30 13:26:19 +02:00
Jan Iwaszkiewicz
0f62031991 [nGraph] Matching names of functions (#1524) 2020-07-30 13:25:42 +02:00
Pavel Esir
66ebc76512 Specify, review and approve operation Proposal-4 (#1270)
* Specify, review and approve operation Proposal-4

* added types section and some other corrections

* Added example of Proposal-4 without reductions

* Corrected information about input tensors

* removed 'logits' from specification, added information about shapes

* removed `for_deformable` attribute

* changed `batch_size` to 7

* updated output dimension
2020-07-30 13:21:23 +03:00
Daria Mityagina
e38106239c [IE][VPU]: Enable new tests for adjust_data_batch pass (#1219)
* New tests for adjust_data_batch pass
2020-07-30 13:19:33 +03:00
Roman Vyunov (Intel)
00630127e7 [IE][VPU]: Enabling of NonZero single layer tests (#1502) 2020-07-30 13:14:51 +03:00
Gleb Kazantaev
531a7209d5 Disable MatMul to FC conversion for VPU (#1520)
* Splited MatmulToFCorGemm transformation

* Updated VPU transformation predicate to check that MatMul has DSR as input
2020-07-30 11:50:52 +03:00
Jozef Daniecki
0c3da56ae1 nGraph unit tests refactoring (#1495) 2020-07-30 10:04:22 +02:00
Andrey Somsikov
9299e32df0 Add product version to memcheck records (#1508) 2020-07-30 10:17:56 +03:00
Ilya Lavrenov
9351547707 Removed public headers / dependencies for readers plugins (#1534)
* Removed public headers / depedencies for readers plugins

* Refactored cmake for onnx reader plugin as well
2020-07-30 07:00:44 +03:00
Ilya Lavrenov
77345a7383 Template documentation update (#1519)
* Updated Inference Engine Plugin developer guide
after inference using ngraph reference backend is added

* Documentation fixes

* Fixed review comments
2020-07-29 19:56:24 +03:00
Ilya Churaev
6c3b7ee8ca Avoid redundant clone and reshape (#1376)
* Avoid redundant clone and reshape

* Removed some constructors

* Fixed output precision
2020-07-29 19:30:59 +03:00
Artyom Anokhov
2b1fc60435 setupvars.sh: Updated logic for detecting INSTALLDIR - using relative path every time instead of checking <INSTALLDIR> or INTEL_OPENVINO_DIR (#1536) 2020-07-29 18:23:36 +03:00
Katarzyna Mitrus
f34511642a NodeVector -> OutputVector replacement (#1272) 2020-07-29 17:18:56 +02:00
Evgeny Lazarev
dec7df17ed MO clean from IR v7 and other legacy code (#1521)
* Remove unnnecessary ir_version checks in the MO

* Cleaned up 'backend_attrs_v2' function

* Small clean up from the 'TFCustomSubgraphCall'

* Clean up the MO extractor attributes mapping

* Renamed PreluOp to PReLU
2020-07-29 17:43:12 +03:00
Szymon Durawa
aef6016298 Refactor tests to use TestCase class (#1517) 2020-07-29 16:08:19 +02:00
Vladimir Paramuzov
6e0001a189 [IE CLDNN] Changed weights layout for 1d scaleshift (#1483) 2020-07-29 14:08:58 +03:00
Jan Iwaszkiewicz
13ae51930b Fix node name tests (#1507) 2020-07-29 12:27:30 +02:00
Evgeny Lazarev
eb8fe44de3 Updated MO requirements files (#1511)
* Updated MO requirements files

* Updated requirements in the CI config to run the pylint
2020-07-29 13:23:52 +03:00
Jan Iwaszkiewicz
185cafb4cc [nGraph] Remove legacy Python API (1) (#1504) 2020-07-29 12:19:05 +02:00
Nikita Kudriavtsev
a644cb85d2 [IE Myriad] Use instance of InferenceEngine::Core via ie::ICore interface in Myriad plugin (#1316)
* [ci-skip][IE Myriad] ie::ICore pointer passed into FrontEnd from plugin

* [ci-skip][IE Myriad] Added MockICore to fix graph transformer tests

* [ci-skip][IE Myriad] IN renamed to I_N to avoid compile error in Windows build: C2513: 'int': no variable declared before '='
2020-07-29 11:30:30 +03:00
Adam Osewski
3a87653483 ONNX Model runner (#1415) 2020-07-29 09:34:35 +02:00
Ilya Churaev
5b918810d0 Removed redundant methods from function and util (#1505) 2020-07-29 06:19:45 +03:00
Anton Pankratv
18836f53cd Implemented inference in template plugin (#1308)
* Implemented inference in template plugin

* Fixed tests

* Removed thirdparty dependency

* Simplified executor configuration

* removed half

* Fixed cmake

* Fixed ngraph node check

* device blob allocation

* Fixed enum error
2020-07-28 17:25:31 +03:00
Adam Osewski
2a96917e2a Treat 1d single-element tensors as scalars. (#1498) 2020-07-28 14:01:13 +02:00
Anton Chetverikov
4e1f7d2b96 InterpolateWithConcat pass fix (#1501)
* Fix InterpolateWithConcat pass

* Add test for None case
2020-07-28 14:50:32 +03:00
Nikita Kudriavtsev
cbdfa38392 [IE][VPU]: Enable conv_3x3s1p1_vgg test for ma2085 (#1486) 2020-07-28 14:36:03 +03:00
Jan Iwaszkiewicz
12457ca85b Add atanh to onnx importer opset4 (#1425) 2020-07-28 10:58:53 +02:00
Vladislav Vinogradov
0b1ef99fd7 [IE] Add Blob::createROI method (#882)
* Add default implementation that throws exception.
* Implement `createROI` for `TBlob` and existing compound blobs.
* Use reference couting for TBlob memory buffer to prolong its life time for ROI blobs.
* Add private extension for ND ROI and use it as implementation detail for now:
  * Add `DimSlice` and `TensorSlice` structures for generic ND ROI support.
  * Add `make_roi_desc` function to create `TensorDesc` for ROI.
2020-07-28 11:26:38 +03:00
Ilya Lavrenov
a19a8645e8 Removed IInferencePluginAPI interface (#1497)
* Removed legacy library includes from plugin api headers

* Removed IInferencePluginAPI interface; merged with IInferencePlugin

* Removed pluginAPIInterface usage in Core implementation
2020-07-28 11:08:45 +03:00
Ilya Churaev
534fe35c0a Remove old transformation passes (#1463) 2020-07-28 08:54:50 +03:00
Ilya Lavrenov
3be1f6b6fa Removed NgraphData (#1416) 2020-07-28 05:58:52 +03:00
Alexey Tarakanov
e5dfb71178 Tests for keep_constant_inputs (#1366)
* First variant of tests for keep_constant_inputs

* Redone tests to check number of inputs

* Count inputs of layer via ngraph::Function

* Add additional transformations for CNNNetwork

* Modified work with CNNNetwork via iterators

* Add tests for FullyConnected Network

* Rename function for counting of inputs

* Debug output was deleted

* transformations_callback was removed

* Change ASSERT_GT on ASSERT_EQ
2020-07-28 05:56:48 +03:00
Ilya Churaev
af3a0900b0 Removed v0 operations from AlgebraicSimplufication pass (#1481)
* Removed v0 operations from AlgebraicSimplufication pass

* Fixed tests
2020-07-28 05:48:12 +03:00
Ilya Churaev
ffcb7fab2d Fixed incorrect logic in detection of result shape for convolution (#1444)
* Fixed incorrect logic in detection of result shape for convolution

* Added test
2020-07-28 05:47:43 +03:00
Gleb Kazantaev
bd42f09e98 nGraph Transformations refactoring (#931)
This PR introduces next changes:
1. Transformations *_tbl.hpp files were replaced with direct registration in cpp files.
2. Plugins use pass::Manager to call conversion passes.
3. Transformations callback was moved to PassBase class as there is no more need to keep it in separate class
4. All pattern based transformations must be inherited from MatcherPass class. GraphRewrite class will be used only for matchers registration and execution on function.
MatcherPass class adds new features to pattern-based transformations approach:
* Allows to run matcher pass on a single node.
* Operations that were created inside transformation callback can be added to execution list to be available for pattern matching within single GraphRewrite.
5. GraphRewrite MatchClosure was replaced with MatcherPass. So all matchers will be registered as a MatcherPass.
6. Added pass::Manager::clear_state() method to avoid dependency with nodes that no longer belongs to function after replacement.
7.  Some representative transformations were updated to use MatcherPass as an example.
8.  Mul->Add sequence fusion transformation was replaced with LinOpSequenceFusion.
9. Pattern and callback registration code was moved to class c-tors (will be finished for remaining passes in other PR) .
10. Updated pass::Manager to get pass names only when NGRAPH_PROFILE_PASS_ENABLE enabled.
11. Moving towards removing PassProperty.
12. Added ngraph::pattern::wrap_type<T>(inputs, pred) to simplify pattern creation.
13. GraphRewrite was updated to execute MatcherPass more efficient.
2020-07-27 19:47:37 +03:00
Artyom Anokhov
4ae03a0d5d setupvars: Added post_training_optimization_toolkit to PYTHONPATH (#1492) 2020-07-27 19:45:26 +03:00
Alexander Zhogov
e0023b3f71 GitHub CI: Disable/remove set_pr_labels 2020-07-27 19:22:05 +03:00
Anna Khakimova
9b76b3ea39 Preprocessing(GAPI): Universal intrinsics (AVX512) implementation of linear Resize 8UC1 (#1132) 2020-07-27 19:04:51 +03:00
Vladimir Paramuzov
48f5f524b8 [IE CLDNN] Fixed gemm fusings with FP precision (#1490) 2020-07-27 18:49:54 +03:00
Nadezhda Ageeva
40d597c313 Adds first inference time measurements in benchmark_app (#1487) 2020-07-27 16:45:07 +03:00
Mateusz Bencer
5ff59eb711 Add support (limited, based on Interpolate-1) to Resize-11 ONNX op (#1364)
* Implementation of Resize-11

* Added support to sizes input

* Add tests to sizes input

* Added missing comment

* fixed tests

* fixed tests

* Fixed test. part 2.

* review remaks. part 1.

* review remarks. part 2.

Co-authored-by: Tomasz Socha <tomasz.socha@intel.com>

* Added more tests

Co-authored-by: Tomasz Socha <tomasz.socha@intel.com>
2020-07-27 16:42:00 +03:00
Konrad Dobros
0846f2050e [IE CLDNN] Add b_fs_fsv16 concat optimizations (#1452)
1. Add fsv16 int8 support to optimized kernel
2. Optimize fsv16 concat kernel
3. Add graph optimization to improve concat alignment

Issue: CVS-28494
2020-07-27 14:49:22 +03:00
Irina Efode
3632dde431 [IE NGRAPH] Remove default values in InterpolateAttr structure (#1484) 2020-07-27 14:03:16 +03:00
Mateusz Tabaka
2ac35247ea Add tests for ArgMin/ArgMax with float inputs (#1429) 2020-07-27 12:40:27 +02:00
Ilya Churaev
7827490340 Removed v0 CropAndResize and EmbeddingLoop operations (#1450) 2020-07-27 12:34:20 +03:00
Vladimir Paramuzov
3c99c13feb [IE CLDNN] Improvements for SpaceToDepth (#1454) 2020-07-27 11:52:18 +03:00
Irina Efode
0560b61cbd [IE TESTS] Add Interpolate single layer test (#1456) 2020-07-27 11:45:19 +03:00
Ilya Churaev
3bbdda6b48 Removed BroadcastDistributed (#1430) 2020-07-27 10:49:56 +03:00
Ivan Tikhonov
98ad4ac869 Specification for RNN/GRU sequences (#1426)
* Specification for RNN/GRU sequences

* update opset4 list
2020-07-27 09:22:46 +03:00
Sergey Shlyapnikov
fc3f9af923 [IE CLDNN] fix warnings from gcc-9 compiler (#1431) 2020-07-24 20:13:29 +03:00
Alexander Zhogov
8b44f4343d GitHub CI: set_pr_labels - runs every 4 hours 2020-07-24 19:57:58 +03:00
Maxim Vafin
43b46036ae Fix the case with nodes containing ":" in names (#1089)
* Fix the case with nodes containing : in names

* Raise error in case of several possibilities
2020-07-24 18:39:57 +03:00
Maxim Vafin
663be787d6 Add ONNX DequantizeLinear to MO (#1250)
* Add ONNX DequantizeLinear to MO

* Update docs
2020-07-24 18:39:09 +03:00
Irina Efode
db176dfc5d [IE TESTS] Add Minimum tests (#1470) 2020-07-24 17:51:21 +03:00
Alina Alborova
6e07a4c72b [DL Workbench] Move files to another guide (#1443)
* [DL Workbench] Moved files to another guide

* Fixed indentation
2020-07-24 16:58:51 +03:00
Alexander Zhogov
d196c7cb15 GitHub CI: Fix issues in check_pr.py 2020-07-24 16:20:34 +03:00
Liubov Batanina
a38e9f9059 Add input transposing for MatMul (#1462) 2020-07-24 15:15:20 +03:00
Maxim Vafin
c10c80bdca Specify Range-4 operation (#1180) 2020-07-24 14:37:32 +03:00
Alexander Zhogov
3945acd65b GitHub CI: Change secret 2020-07-24 13:25:29 +03:00
Alexander Zhogov
765202e23c GitHub CI: Add set_pr_labels (#1467)
* GitHub CI: Add set_pr_labels

* Change to run every 10 min

* Update names
2020-07-24 13:00:04 +03:00
iliya mironov
f865945448 Add acosh asinh atanh to opset3 ngraph (#1278)
* Add acosh, asinh and atanh to opset4
2020-07-23 21:40:04 +03:00
Gabriele Galiero Casay
2936ea8800 Add asinh to onnx importer opset4 (#1436) 2020-07-23 17:03:06 +02:00
Alexander Zhogov
c1dec4ad42 GitHub CI: Add Python scripts for controlling organization (#1437) 2020-07-23 17:29:18 +03:00
Nikita Kudriavtsev
8a6bd1dba3 [IE][VPU]: Added Mish layer (#1158)
* Add Mish stage in GraphTransformer
* Add Mish per-layer tests
2020-07-23 16:58:03 +03:00
Ilya Lavrenov
07bedc5d6f Network serializer for v7 is removed (#1414)
* Network serializer for v7 is removed

* Fixed compilation

* Fixed Windows build

* WA for GPU

* Create function 2 times

* Fixed compilation

* Added return
2020-07-23 16:23:19 +03:00
Pavel Esir
e56c8a2bc7 support parallel nested nnet for Kaldi (#1194)
* supported nested nnet1 for Kaldi
2020-07-23 15:37:41 +03:00
Anton Chetverikov
f90f242626 Update Reduction operations specification (#1446) 2020-07-23 15:34:53 +03:00
Ilya Churaev
82aa1e112d Remove deprecated methods from node (#1369) 2020-07-23 14:44:32 +03:00
Anton Chetverikov
cdd5605c61 Update ShapeOf extender (#1406) 2020-07-23 14:07:34 +03:00
Ilya Lavrenov
9440561fa4 Documentation updates (#1433) 2020-07-23 13:15:20 +03:00
Ilya Lavrenov
8fedb0bf94 Corrected message about deprecated IR version (#1438) 2020-07-23 13:14:09 +03:00
Maxim Vafin
0063efeb09 Add ONNX SpaceToDepth and DepthToSpace extractor (#1122)
* Add ONNX SpaceToDepth extractor

* Add DepthToSpace ONNX extractor
2020-07-23 13:05:42 +03:00
Andrew Bakalin
f00cdddede [IE][VPU][GT]: Change begin and end masks serialization for StridedSlice (#1417)
* In order to support cases when begin and end size is less than input rank, the serialization was changed.
* Add tests
* Update firmware
2020-07-23 12:20:08 +03:00
Ruslan Garnov
d6c412ca40 Updated fluid to 4.3.0 (#1422) 2020-07-23 12:04:31 +03:00
Vitaliy Urusovskij
6fcad95c71 [Stress] Redesign of MemCheckTests (#650)
* [Stress] Redesigned MemCheckTests: 1. Added MemCheckPipeline to incapsulate measures and logging. 2. Moved references to array

* [Stress] Added tracking of THREADS in MemCheckTests
2020-07-23 11:07:13 +03:00
Andrew Bakalin
dce1063526 [IE][VPU][NGraph] Move dynamic NMS from common to vpu folder (#1409)
* [IE][VPU]: Moves UpgradeNMS4ToNMSDynamic transformation into myriad plugin

* [IE][VPU]: Moves UpgradeNMS4ToNMSDynamic from common to vpu folder

* [IE][VPU]: Moves Dynamic NMS from common folder to vpu

* [VPU]: Makes NMS conversion unconditional

* [VPU][NGraph]: Changes dynamic NMS base class from v3 to v4

* [VPU]: Moves NMS4toDynamic transformation before common optimization
2020-07-23 10:23:35 +03:00
Vladimir Paramuzov
c69591c0b7 [IE CLDNN] Shrink reshapes (#1362) 2020-07-23 10:14:52 +03:00
Andrey Zaytsev
045fe44d29 Fixes LFS issues (#1440)
* Removed non-LFS images to reload them to LFS

* Reload images to LFS

* Reload images to LFS
2020-07-22 22:35:58 +03:00
Nikita Kudriavtsev
5b9a5a6293 [IE Myriad/35383] vpu_profile is removed (#1393) 2020-07-22 17:34:16 +03:00
Adam Osewski
093a02fcef Test fix import of ONNX model in serialized Protobuf binary format. (#1355)
* Try fix parsing error.

* Small exception refinements during importing model.

* More exception refinements.

* Skip segfaulting tests.

* More clear error types and messages. Func rename.

* Fix typo.

* Check on CI whether test_onnx will work.

* Add only those file which pass tests or have failing ones skipped.
2020-07-22 13:52:53 +03:00
Roman Kazantsev
6ccc025a43 Extend nGraph for operation CTCLoss (#1236)
* Extend nGraph for operation CTCLoss

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fixes as per comments

Co-authored-by: Nikolay Shchegolev <nikolay.shchegolev@intel.com>
2020-07-22 13:45:42 +03:00
Ilya Churaev
141b24cf44 Replaced copy_with_new_args() to clone_with_new_inputs() (#1395) 2020-07-22 13:44:22 +03:00
Ewa Tusień
821a3dae32 Expose OpSets as part of nGraph PythonAPI (#1261) 2020-07-22 12:02:54 +02:00
Ewa Tusień
b3f55dd0be Update list of tests passing/failing using TestCase on IE backend (#1161) 2020-07-22 11:42:19 +02:00
Vitaliy Urusovskij
5665ec9b26 [Stress] Small improvement of scripts (#1302)
* [Stress] Extend CLI with arguments checks for compare_memcheck_2_runs.py

* [Stress] Extend requirements.txt with PyYAML
2020-07-22 10:24:15 +03:00
Ilya Lavrenov
a773dfbbcc Removed ie_deprecated.cpp from legacy library (#1419) 2020-07-22 06:44:53 +03:00
Ilya Lavrenov
8e081c8388 Removed CNNLayer entries from ie_common.h (#1420)
* Removed useless header include

* Removed CNNLayer entries from ie_common.h
2020-07-22 06:44:05 +03:00
Ilya Churaev
c75ff2a4fc Removed is_parameter, is_constant and is_output (#1408) 2020-07-22 06:11:28 +03:00
Ilya Churaev
a864c2eb85 Removed redundant licenses (#1392)
* Removed redundant licenses

* Added protobuf license
2020-07-21 19:48:25 +03:00
Ilya Lavrenov
79349ae4a6 CMAKE: added ie_libraries target (#1411) 2020-07-21 18:58:20 +03:00
Ilya Znamenskiy
c37f73334c [IE CLDNN] Gemm int8 with slm optimization. Fused ops fix (#1319) 2020-07-21 17:45:42 +03:00
Roman Lyamin
613d822458 [IE TESTS] Added single layer test Mish (#1401) 2020-07-21 15:11:05 +03:00
Anna Khakimova
eecd03aa85 Pre-processing(GAPI): ARM(NEON) integration + Split, Merge, Color conversion kernels on NEON (#1315) 2020-07-21 14:19:15 +03:00
Ilya Lavrenov
14d371849d Split CNNlayer validators (#1403)
* Simplified CNNLayer validators: keep only parsing of arguments

* Added validators as is

* Removed parsing arguments

* Removed Backetize validator
2020-07-21 13:57:56 +03:00
Nikita Kudriavtsev
a482e32911 [IE][VPU]: Added Gelu layer (#1195)
* Implement Gelu stage in GraphTransformer
* Disable GeLU decomposition in the nGraph transformations
2020-07-21 11:36:35 +03:00
Ilya Lavrenov
f7d6711137 Removed addLayer implementation from ngraph impl (#1400) 2020-07-21 06:36:18 +03:00
Ilya Churaev
54ae67414e Remove redundant node methods (#1324)
* Remove placement

* Removed validate and infer eltwise

* Remove is eltwise

* Remove support broadcast and decompose

* Removed is_op, is_parameter, is_pattern

* Fixed code style

* Added is_constant and is_output

* Removed is_communicative and is_null

* Fixed code style

* Fixed typo

* Fixed comments

* Fixed typo

* Revert is_parameter, is_output, is_result for OpenCV build
2020-07-21 06:02:00 +03:00
Anna Khakimova
898f0626ad Fix for issue (#1335) 2020-07-20 20:09:23 +03:00
Vladislav Volkov
41f8086765 Header length for supported model detection is increased (#1363) 2020-07-20 18:11:22 +03:00
iliya mironov
399c7bf39a Add mish op to ngraph (#1187)
* Add mish op to ngraph

* Update mish op

* Set v4 namespase for tests

* Add mish to cmake

* Add comments for mish op.

* Refactoring code style

* Update version to v1 for Mish op

* Add value propogation test for Mish op

* Refactoring mish op according to review

* Fix mish version

* Update cmake file

* Fix mish value propogation unit test

* Add unit test for mish op

Co-authored-by: Your Name <you@example.com>
2020-07-20 17:43:32 +03:00
Nikolay Tyukaev
ef45b5da8d Doc Migration (master) (#1377)
* Doc Migration from Gitlab (#1289)

* doc migration

* fix

* Update FakeQuantize_1.md

* Update performance_benchmarks.md

* Updates graphs for FPGA

* Update performance_benchmarks.md

* Change DL Workbench structure (#1)

* Changed DL Workbench structure

* Fixed tags

* fixes

* Update ie_docs.xml

* Update performance_benchmarks_faq.md

* Fixes in DL Workbench layout

* Fixes for CVS-31290

* [DL Workbench] Minor correction

* Fix for CVS-30955

* Added nGraph deprecation notice as requested by Zoe

* fix broken links in api doxy layouts

* CVS-31131 fixes

* Additional fixes

* Fixed POT TOC

* Update PAC_Configure.md

PAC DCP 1.2.1 install guide.

* Update inference_engine_intro.md

* fix broken link

* Update opset.md

* fix

* added opset4 to layout

* added new opsets to layout, set labels for them

* Update VisionAcceleratorFPGA_Configure.md

Updated from 2020.3 to 2020.4

Co-authored-by: domi2000 <domi2000@users.noreply.github.com>
2020-07-20 17:36:08 +03:00
Ivan Tikhonov
4037613db3 Added default constructor for RNNCellBase, fix conversions (#1370) 2020-07-20 14:15:37 +03:00
Rafal Blaczkowski
06119efdf2 ONNX CI: add docker image cleanup (#1394)
* change stage name
 * add docker image cleanup
2020-07-20 13:42:52 +03:00
Jan Iwaszkiewicz
d4c9af91d8 Add getting/setting friendly name for Node wrapper Py API (#1286) 2020-07-20 10:31:49 +02:00
Tomasz Dołbniak
8d6238a3d7 Reference implementations for ReduceLogicalAnd & ReduceLogicalOr (#1333) 2020-07-20 10:20:05 +02:00
Jozef Daniecki
eca80086ac Add Acosh operator to ONNX importer opset4 (#1351) 2020-07-20 10:18:03 +02:00
Vitaliy Urusovskij
57779511d6 [Stress] Integrate compare_memcheck_2_runs call in run_memcheck.py (#1036)
* [Stress] Define Database constant arguments in memcheck_upload.py only

* [Stress] Simplify computations using HashableDict in `compare_memcheck_2_runs`

* [Stress] Add comparison using pandas
2020-07-20 10:23:51 +03:00
Ilya Lavrenov
2ddf08d14b Removed tests for old IR reader (#1368) 2020-07-18 12:42:40 +03:00
Ilya Churaev
cc19e57a06 Removed v0 fused operations (#1263) 2020-07-17 19:51:04 +03:00
Anton Chetverikov
dca2ee2bcc ReduceLp operation specification (#1205)
* Add ReduceL2 operation specification

* Add example

* Update operation specification

* Update operation specification

* Update operation specification

* Update operation specification

* Update types in operation specification
2020-07-17 16:13:19 +03:00
Tomasz Socha
28227dcd9f [nGraph][Py][Tests] Remove backup of old models (#1349) 2020-07-17 15:12:11 +02:00
Alexander Zhogov
17287f20a0 CODEOWNERS: Add .ci & docs 2020-07-17 15:07:58 +03:00
Andrew Bakalin
5cda3938d8 [IE][VPU][GT]: Use topological order in shape allocation (#1281)
* Some pass creates datas duplicate with a different order from time to time (because of unordered_set usage). It leads to a different order in model->datas() list and affects the shape allocation process which relies on this order.
* Make shape allocation be relied on topological order of datas which is stable and doesn't depend on order datas creation during different passes.
2020-07-17 11:47:37 +03:00
Ilya Lavrenov
ee3fafceda Fix unsafe use of CPU_ISSET_S macro. (#1357)
Don't increment mapped_idx via prefix increment within the argument of the
potentially unsafe CPU_ISSET_S macro. If the macro is expanded so that the
increment expression is evaluated multiple times, it will return unexpected
results.

While the glibc implementation of CPU_ISSET_S macro seems to be safe, the musl
libc (v1.1.23) version is unsafe and will evaluate the first argument of
CPU_ISSET_S three times.

Co-authored-by: Christian Priebe <cp3213@ic.ac.uk>
2020-07-17 10:51:56 +03:00
Ilya Churaev
29816f7a44 Remove get_arguments (#1323)
* Removed get_arguments

* Fixed code style
2020-07-17 09:50:06 +03:00
Nikita Kudriavtsev
73ee68afb2 [IE][VPU]: CMX limit compile option (#1268)
In some networks, mvTensor would request a large CMX-DMA transfer (<512K). That starves DMA for other timing critical tasks such as SIPP. Limit CMX-DMA request size as an option in myriad_compile:
* Add compile option TILING_CMX_LIMIT_KB
* Declare compile option TILING_CMX_LIMIT_KB in IE tools (compile_tool and vpu_compile)
* Add tests for compile option TILING_CMX_LIMIT_KB. Small fix for naming behavior tests.
2020-07-16 19:54:53 +03:00
Alexander Zhogov
d9927a9f35 Azure CI: Fix cloning git submodules (#1356) 2020-07-16 19:29:54 +03:00
Andrey Somsikov
9df6a8f6a0 fix: inference-engine/ie_bridges/python/sample/requirements.txt to reduce vulnerabilities (#1007)
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-73513

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2020-07-16 18:58:26 +03:00
Irina Efode
bfd318cbd3 [IE TESTS] Add PReLu single layer test (#1306)
* [IE TESTS] Add PReLu single layer test

* [IE TESTS] Small refactoring of test infrastructure

* [IE TESTS] Add shape for activation
2020-07-16 18:16:57 +03:00
Rafal Blaczkowski
e7861c7455 Revert "Header length for supported model detection is increased (#1340)" (#1354)
This reverts commit 5b2ec7840a.
2020-07-16 18:09:45 +03:00
Ilya Lavrenov
949fee3cfc Remove implicit conversion from getInputTo, getLayerCreator (#1274)
* Added ctor for CNNNetworkImpl to convert from ngraphImpl

* Re-use in all places instead of manual conversion

* Hide convertToCNNNetworkImpl usage

* Removed conversion from getCreatorLayer

* Fixes 2

* Fixes 3

* Fixes 4

* Fixed ieFuncTests

* Fixed more tests

* Fixed LPT tests

* Remove useless test

* Fixed GNA

* Fixed Gleb's comments

* Fixed Core integration tests

* Trying to fix python

* Fixed GPU tests

* Small fixes

* Fixed QueryNetwork after removing implicit conversion

* Fixed Core integration tests for QueryNetwork

* Fixed python; MULTI device QueryNetwork

* Fixed MULTI QueryNetwork

* Removed unused methods

* Enabled LPT FullyConnectedTestModel test

* Fixed typo in python
2020-07-16 16:44:48 +03:00
Vitaliy Urusovskij
930d687ed9 [Stress] Specify OMZ develop branch in get_testdata.py (#1318)
Since in validation OMZ is used from a package (and OMZ is from develop branch), align OMZ default for get_testdata.py
2020-07-16 15:28:25 +03:00
Irina Efode
afee06ec3d [IE TESTS] Small refactoring of test infrastructure (#1332) 2020-07-16 14:20:08 +03:00
Nadezhda Ageeva
0887a7c0d6 Allow python benchmark_app load onnx model (#1283) 2020-07-16 13:53:43 +03:00
Roman Kazantsev
682e4d3e94 Specify operation CTCLoss-4 (#1189)
* Specify operation CTCLoss-4

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Correct documentation for CTCLoss after #1 review

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Correct documentation for CTCLoss after #2 review

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Correct documentation for CTCLoss after #3 review

* Correct documentation for CTCLoss after #4 review

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Correct layout for logits and add more description for unique attribute

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Correct types for length and indices tensors

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Correct formulas and punctuation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-07-16 12:36:15 +03:00
Alexander Chaiko
0746f47e8a [IE CLDNN] Adjustment of layouts to choose optimal deconvolution (#781) 2020-07-16 11:54:24 +03:00
Vladislav Volkov
5b2ec7840a Header length for supported model detection is increased (#1340) 2020-07-16 11:12:40 +03:00
Anton Pankratv
b5e092c00b Added default multi threaded configuration (#1310)
* Added default multythreaded configuration

* Fixed typo
2020-07-16 10:33:22 +03:00
Nikita Kudriavtsev
804a579be9 [IE Myriad] Remove Myriad 2 from supported devices in XLink (#1331) 2020-07-16 10:29:56 +03:00
Ilya Churaev
317a60545b remove nGraph deprecated methods (part 1) (#1314)
* Remove remove_goe

* Remove traverse_nodes

* Removed deprecated constructors

* Removed deprecated tensor methods

* Fixed IE build

* Fixed code style
2020-07-16 06:03:59 +03:00
Gladilov, Gleb
3b6cb0e0cd [IE][VPU][nGraph]: Enables merging subsequent DSR operations (#1326)
Myriad plugin treats DSR operation in a way removing such operations
and connecting inputs with each other (replacing output with one of them).
Semantic of connection is one inputs contains shape of another.
Since the same data object can have exactly one shape it's prohibited
to have DSR inputs connected with another data objects
(the only allowed exception is inputs that are already connected between
each other).

As a result of nGraph -> CNN conversion some operations could be optimized
out which in turn could lead to subsequent DSR operations where each has
its own shape sub-graph. Even if shape sub-graphs are identical it's not
visible to plugin that sees incorrect inputs (inputs of DSR are already
connected, but now with each other, when second DSR is parsed).

To overcome such issue (the reason is when operations are optimized out,
their shape sub-graphs are still there), additional ngraph
transformation should be introduced to merge subsequent DSR into single
DSR operation.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
2020-07-15 22:21:19 +03:00
Gladilov, Gleb
a0d60abef7 [IE][VPU][nGraph]: Fixes Reshape's shape infer method (#1327)
Previously, if Reshape had input pattern with values [0, -1] - it
propagated dynamic shape through a function. At the same time,
taking "0" and "-1" interpretation into consideration, it turns out
in such cases we could just propagate the same input shape in case of
2D input.

For Faster-RCNN this fix makes static dimensions on dynamic paths static.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
2020-07-15 22:17:36 +03:00
Gladilov, Gleb
2803498995 [IE][VPU][nGraph]: Fixes StridedSlice DTS (#1328)
* In case of Begin/End/Stride inputs of StridedSlice have rank less
than input data rank - remaining dimensions must be kept unchanged.
* Previous, implementation had UB in such cases - out of bound
vector element access

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
2020-07-15 19:43:31 +03:00
Jan Iwaszkiewicz
db09547087 Add Input and Output class to Py API (#1284) 2020-07-15 15:32:24 +02:00
Adam Osewski
173ce2c907 [ONNX] Exception handling refinements. (#1266) 2020-07-15 14:02:18 +02:00
Andrew Bakalin
382b442ab3 [IE Common][Tests] saturated_cast: refactoring & tests (#1304)
* [IE Common] Refactor saturated_cast

* [IE Common][Tests] Add tests for saturated casts

* [IE Common] Review fixes

* [IE Common] Make enable_if check a template parameter
2020-07-15 13:48:57 +03:00
Jan Iwaszkiewicz
8fe1ef0b41 Reverse Sequence code clean up (#1303) 2020-07-15 12:48:53 +02:00
iliya mironov
ac5217d17f Added mish layer doc opset (#1149)
* Added mish layer doc opset

* Refactoring mish spec

* Update mish spec

* Change output description of Mish layer

* Fix Mish according to review

* Refactoring Mish and GELU spec according to code review

* Update formula for ops in spec

* Refactoring spec text

* Update Mish opset

* Change Mish version from 1 to 4

* Sort opset4

Co-authored-by: Your Name <you@example.com>
2020-07-15 10:30:33 +03:00
Vladimir Gavrilov
f2aba7cdf6 Specify, review and approve operation Interpolate-4 (#1035)
* Added documentation for Interpolate-3.

* Some fixes.

* Fixed some typos.

* Now Interpolate-3 is Interpolate-4.

* Fixed typo.

* DEleted unused 'mode' 'area'.

* Fixed some typos.

* Now 'axes' attribute is an input of Interpolate.

* Added description of variants of nearest_mode.

* Added descriptions of coordinate transformation modes.

* Now 'axes' is an optional input.

* Fixed typo.
2020-07-15 10:27:56 +03:00
Anton Zaytsev
24961638cc [IE TESTS] Add ShapeOf SingleLayerTest (#1285)
* [IE TESTS] add single layer test ShapeOf

* [IE TESTS] update for master

* [IE TESTS] add subgraph test

* [IE TESTS] update todo in skip_tests_config

* [IE TESTS] update skip_tests_config

* [IE TESTS] update skip_tests_config

* [IE TESTS] update opset3
2020-07-14 23:55:32 +03:00
Alexey Suhov
d7cb5ba4ba update system requirements (#1321) (#1322)
* update system requirements

* update release version in readme
2020-07-14 22:06:55 +03:00
Maxim Shevtsov
4b5ce75c46 Fix that brings back the MULTI's ability to add/remove devices (to the priorities list) on the fly. Presumably was lost during refactoring. (#1309)
the point is that we should check the ORIGINALLY (largest) list of the devices (actually ExecutableNetworks for them) to see if the device is just added back
2020-07-14 19:15:52 +03:00
Edward Shogulin
d791962464 [LPT] FuseFakeQuantizeAndScaleShift transformation for last layer fix (#1291)
* [LPT] FuseFakeQuantizeAndScaleShift transformation for last layer fix

* [LPT] refactoring

* [LPT] FuseFakeQuantizeAndScaleShift test: last layer name validation was added
2020-07-14 18:55:06 +03:00
Jedrzej Hajduczenia
0607b7b0f7 [IE CLDNN] WA to use bfyx format if applicable for bf(w)zyx Gather input (#1056) 2020-07-14 18:00:51 +03:00
Jedrzej Hajduczenia
92a38b305f [IE CLDNN] Disable inserting reorders if num_dims mismatch (#1023) 2020-07-14 17:59:20 +03:00
Rafal Blaczkowski
07f0d1c492 Add OpenVINO-ONNX CI check (#688) 2020-07-14 14:57:27 +02:00
Andrew Bakalin
c18f3aff91 [IE][VPU][Tests]: Fix M2 on deprecated tests for StridedSlice (#1300)
* Disable reorder in Myriad2 cases in StridedSlice deprecated_tests
2020-07-14 13:13:56 +03:00
Adam Osewski
ed4bbb3a0a [ONNX] Quantize linear using FakeQuantize (#1169) 2020-07-14 10:55:07 +02:00
Adam Osewski
b16c8faceb Enable importing of TF_NASNet_Mobile (#1252) 2020-07-14 10:54:39 +02:00
Ilya Churaev
e8ce8523ed Removed max pool v0 (#1277)
* Removed MaxPool v0

* Removed atan2

* Removed and operation
2020-07-14 10:27:51 +03:00
Ilya Churaev
32d7959b92 Added U32 precision (#1297) 2020-07-14 10:27:10 +03:00
Mikhail Letavin
91ec946865 [IE CLDNN] Optimize kernel cache memory usage in GPU plugin (#1233) 2020-07-13 18:33:32 +03:00
Gladilov, Gleb
543559f58c [IE][VPU][nGraph]: Enables dynamic Reshape with non-const pattern support in myriad plugin (#1159)
* [IE][nGraph]: Introduces PartialShape ctor from values vector

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU][nGraph]: Moves evaluateTargetShape to common utilities

The same functionality - get upper-bound shape estimation for dynamic
input - is needed in dynamic Reshape along with dynamic Broadcast.
Return value type has been changed from PartialShape to vector<int64_t>.
The reason is Reshape encodes special values (0, -1) into input values
that define output shape. Representing those values (which upper-bound
provides evaluateTargetShape) as PartialShape leads to incorrect
representation vector with -1 as dynamic shape - which is not expected.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU][nGraph]: Introduces StaticShapeReshape

In comparison with original Reshape StaticShapeReshape propagates
upper-bound shape through a function in case of dynamic input. To do so,
shape inference method gets upper-bound shape from evaluateTargetShape,
decodes special values (0, -1) in it and then propagate the result.

Output shape processing happens only once, because if shape inference
were called after ShapeOf operations have been optimized out on dynamic
path, then evaluateTargetShape will require evaluate method for all
operations that appear in function before current Reshape. Since
evaluate method is implemented not for all operations it lead to
Faster-RCNN compilation error.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU][nGraph]: Updates Reshape DTS on StaticShapeReshape

In case of non-const Reshape input that defines output shape DTS uses
StaticShapeReshape which propagates upper-bound shape evaluated from
this input through a function.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU][nGraph][Tests]: Refactoring DTS Reshape tests

The only changes are:

* header files include reordering
* indentation/wrapping fixing

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU][nGraph]: Moves ShapeOf transformation out of DTS scope

In comparison with DTS ShapeOf transformation needs to work on whole
function. Separating these 2 transformations makes testing easier since
now it's possible to call specific DTS without ShapeOf transformation
and vice versa.

Also DynamicToStaticShapeOf has been renamed into
EliminateShapeOfAfterDSR since transformation doesn't introduce new DSR
operations.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [VPU][Tests]: Introduces DTS Reshape tests with non-const pattern

New StaticShapeReshape constructor has been added as well, since test
fixture should create it from reshape parameters, not reshape itself.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
2020-07-13 18:19:05 +03:00
Maxim Andronov
08d8d36667 fix strided slice neg out of bounds ends (#1177) 2020-07-13 17:40:24 +03:00
Anastasia Kuporosova
e05e8893f2 [IE Samples] Add api arg to classification sample (#943) 2020-07-13 14:48:40 +03:00
Egor Churaev
668abbc5d9 [IE CLDNN] LRN int8 fsv16 optimizations (#814)
JIRA: 32367
2020-07-13 13:25:15 +03:00
Maxim Andronov
9e14d8b77e [CPU] Add check quantize ranges (#850) 2020-07-13 12:48:00 +03:00
Andrey Sokolov
17657e5f43 [IE][VPU]: adjust batch - support dynamic number of iterations (#1114)
* support dynamic number of iterations in "AdjustBatch" pass
* add unit tests for this case
2020-07-13 11:49:20 +03:00
Ilya Lavrenov
71a7e913d1 Throw special exception if IR v7 is passed, but no IR v7 reader (#1293) 2020-07-13 06:13:59 +03:00
Vladislav Volkov
bce6ca07df Optimisations for binary operations broadcast. Phase 2. (#1295) 2020-07-13 06:11:02 +03:00
Ilya Churaev
9dedb39cfc Remove old Scatter operations (#1265) 2020-07-13 06:02:20 +03:00
Andrew Bakalin
45d1b4eb19 [IE][VPU][GT]: Process StridedSlice stage on device as one kernel (#1244)
* Remove replacement of StridedSlice with other stages and execute it on device as one kernel.
* Refactor strided slice tests to be able to parametrize it by precision.
* Update firmware.
2020-07-10 14:32:49 +03:00
Gorokhov Dmitriy
8768313fef [TESTS] Added Comparison and Logical single layer tests (#1242) 2020-07-10 13:56:22 +03:00
Ilya Churaev
8d1e7a705d Removed adjoints (#1269) 2020-07-10 13:49:43 +03:00
Bartosz Sochacki
8da662b2b8 [GNA] Support in GNA plugin for power layer with non-1 exponents (#997)
* added support for power layer with non-1 exponents to GNA plugin

* reverted a change caused by merge issue

* fixes for review comments (typo fix - lrelu instead of leru, unnamed structure instead of of named one in union with arguments of activation function, name fix - input instead of inputs),

scale-shift implementation based on affine layer instead of PWL,

* fixed code style

* fixes for coding style in scale_factor_calc.hpp

* added domain for power function

* fixed review comment - power function specific methods

* added check if dynamic casting was successful

* removed I16 as it is not supported by ngraph

* fixed initialization per review comment
2020-07-10 13:39:29 +03:00
Kamil Magierski
d9706da8d0 [GNA] MemoryStateImpl (#839)
* [GNA] fix query state for GNAMemoryState

* [GNA] MemoryState implementation:

Fix shared tests
Fix smoke tests
fix SetState
Implement LastState
Fix Reset

* Move getPrecision() to GNAMemoryState

Change Smoke Reset() test to check resetting one state

* [GNA] add dequantize to getLastState()

* code refactor

Co-authored-by: Anna Alberska <anna.alberska@intel.com>
Co-authored-by: kmagiers <kmagiers@intel.com>
2020-07-10 13:37:12 +03:00
Michał Karzyński
cc23e6043a Add nGraph-ONNX tests (#1215) 2020-07-10 11:53:56 +02:00
Roman Kazantsev
7b65ba365e Implement ScatterND operation in MO and transform for SparseToDense (#584)
SparseToDense used in Wide and Deep model is expressed through ScatterND operation.
ScatterND is more functional than SparseToDense. Hence, it was decided to replace SparseToDense
with ScatterND. ScatterND is more useful for other models.

Remove SparseToDense from the previous opset

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-07-10 12:29:15 +03:00
Ilya Lavrenov
297c9f5272 Simplified usage of CNNNetworkIterator (#1260) 2020-07-10 11:22:49 +03:00
Andrew Bakalin
3a0f09c01e [IE Common] Replace static_cast with saturated one (#1257) 2020-07-10 11:20:17 +03:00
Chenhu Wang
b4e3dd5c7b [CPU] ScatterUpdate ScatterElementsUpdate and ScatterNDUpdate support (#909)
* scatter_update_series_enable

* scatter_update_series_enable

* add single layer tests
2020-07-10 11:19:23 +03:00
Roman Lyamin
8e368c5e81 [IE TESTS] Added single layer test "Ceiling" (#1271) 2020-07-10 10:49:50 +03:00
Maksim Doronin
2537174a43 [IE][VPU]: Remove dataToShape edges from unsued data (#1213)
* Check equality of shape data for the replaced and replacement input/output data in the model
* Connect data with shape in duplicateData method
* Disconnect shape with data which is being removed as unsued.
* Check that disconnected shape still have child dataToShape edges or consumers
* Refactor cleanUp to use removeUnsuedData and not duplicate code
2020-07-09 19:21:18 +03:00
Anastasia Kuporosova
c0acbe06f7 Add python API codeowners (#1254) 2020-07-09 18:09:06 +03:00
Roman Lyamin
f3848b4454 [IE CLDNN] Added Mish operation (#1125) 2020-07-09 16:57:59 +03:00
Tomasz Dołbniak
65657ea5c5 Fix the __repr__ function for dynamic shapes (#1210) 2020-07-09 15:52:25 +02:00
Anton Chetverikov
e3f9cf16cd Swish operation specification (#1200)
* Add Swish operation specification
2020-07-09 16:50:15 +03:00
Anton Chetverikov
77bb97fee5 SoftPlus operation specification (#1128)
* Add SoftPlus operation specification
2020-07-09 16:48:59 +03:00
Tomasz Socha
708c16b257 [nGraph] Fix reshape builder if target shape is scalar (#1206) 2020-07-09 15:31:04 +02:00
Tomasz Socha
a09d45d9d5 [nGraph] Allow to use protobuf lite in onnx importer (#687) 2020-07-09 15:30:17 +02:00
Tomasz Dołbniak
130238f509 ONNX Imagescaler op (#1262)
* ONNX ImageScaler op

* UT for ImageScaler op
2020-07-09 12:19:40 +02:00
Mateusz Bencer
f4b76d4e5e Enable importing TinyYOLOv2 (#1121)
* Fixed bugs in TinyYOLOv2 ops

* Added tests

* styles applied

* styles applied

* code review remarks introduced

* code review remarks (unit tests added)
2020-07-09 12:26:00 +03:00
iliya mironov
95677afe29 Move arithmetics spec from v1 to v4 spec docs (#1230)
* Move atanh asinh acosh to opset4

* Update opset3 tables
2020-07-09 11:28:47 +03:00
Roman Lyamin
c18c103f0f [IE TESTS] Added single layer tests (#1137) 2020-07-09 10:22:34 +03:00
Vladimir Zinoviev
77dc21cbdf [LPT] Eltwise Prod transformation fix (#1135)
* [LPT] Eltwise Prod transformation fix

* [LPT] ngraph Multiply lp transformation test
2020-07-09 10:19:52 +03:00
Ilya Lavrenov
1f8a8ab33c Fixed RTTI issues for ngraph::Variant (#1258) 2020-07-09 06:13:20 +03:00
Ilya Churaev
5feeab37d4 Use ngraph.hpp in samples and documentation (#1240) 2020-07-09 06:09:28 +03:00
Anton Zaytsev
2e3378c50f [IE TESTS] dynavic batch for mvn layer (#1010)
* [ci-skip][IE TESTS] dynavic batch for mvn layer

* update instance v0

* [ci-skip][IE TESTS] update instance for mvn layer

* [ci-skip][IE TESTS] fix

* [ci-skip][IE TESTS] add dynamic batch for singleLayer basic class

* [ci-skip][IE TESTS] update dynamic batch for singleLayer basic class

* [ci-skip][IE TESTS] removing bathFlag

* [IE TESTS] removing bathSize

* [IE TESTS] refactor dynamic batch in basic class

* [IE TESTS] refactor dynamic batch in basic class
2020-07-08 20:59:24 +03:00
Ilya Lavrenov
884389d869 Conversion via CNNNetworkImpl ctor (#1222)
* Added ctor for CNNNetworkImpl to convert from ngraphImpl

* Re-use in all places instead of manual conversion

* Hide convertToCNNNetworkImpl usage

* Remove useless test

* Fixed Gleb's comments
2020-07-08 17:26:37 +03:00
Anastasia Kuporosova
c39e32a47b [IE Tools] Update tools with new Python API (#944) 2020-07-08 13:38:49 +03:00
Vladislav Volkov
499c976194 The supported models detection improvement (#1235)
* The supported models detection improvement

* Unit test for supported models detection
2020-07-08 12:57:21 +03:00
Vitaliy Urusovskij
c0b28daf9c Fix MemCheckTests failures caused by change in OMZ models scope (#1214)
Run only models available in OMZ to prevent failures
Remove person-reidentification-retail-0031.xml from configs
2020-07-08 12:33:39 +03:00
Anastasia Kuporosova
b553b6ea17 [Python API] setting and getting preprocessing info through InferRequest (#1009) 2020-07-08 11:25:54 +03:00
jdanieck
8ff7e3381d Refactoring: remove unneeded typedef from DetectionOutputAttrs struct. (#1231) 2020-07-08 11:15:15 +03:00
Ilya Churaev
71d41a992f Removed all and allreduce layers (#1182)
* Removed all and allreduce layers

* Removed reference implementations
2020-07-08 04:16:02 +03:00
Mikhail Kozlov
bd3b6bfc5e Add new parameters to compile-tool (#1153) 2020-07-07 20:14:47 +03:00
Alexey Suhov
8da90f8890 fix build target name in demos for Windows (#1253) 2020-07-07 18:44:11 +03:00
Vitaliy Urusovskij
e085a04d8c [Stress] Move logging after all computations of progress_str (#1226) 2020-07-07 14:23:26 +03:00
Tomasz Dołbniak
ae6cfe12bb ONNX DequantizeLinear op (#1123)
* DequantizeLinear 10 as a subgraph

* Enable DequantizeLinear from opset 13

* Exclude the failing tests

* Re-enable dequantize linear UTs

* Validation helper
2020-07-07 14:08:08 +03:00
Ilya Churaev
59579eb437 Removed And operation (#1183) 2020-07-07 13:32:35 +03:00
Irina Efode
476dc0f00f [IE TESTS] Add Convert, ConvertLike single layer tests. Refactoring Range (#1212) 2020-07-07 11:47:13 +03:00
Irina Efode
ea10ad5ed4 [IE TESTS] Add Multi, hetero and Cpu plugin as dependecies to the functional tests (#1234) 2020-07-07 11:42:13 +03:00
Anna Khakimova
987cc5ee52 Preprocessing(GAPI): Universal intrinsics (AVX2) implementation of U8C1 linear Resize. (#942)
* Preprocessing(GAPI): Universal intrinsics (AVX2) implementation of U8C1 linear Resize

* Refactoring
2020-07-07 11:38:59 +03:00
Ilya Churaev
0602a61a30 Removed ArgMax ArgMin (#1181) 2020-07-07 10:07:08 +03:00
Anton Chetverikov
56916ace61 Fix const node non-deterministic names (part 2) (#1081)
* Fix non-deterministic node names generation in the Model Optimizer (part 2)
2020-07-07 09:37:48 +03:00
Ilya Churaev
5d1c5ee6a9 Removed nGraph experimental operations and headers (#1197) 2020-07-07 07:27:17 +03:00
Ilya Lavrenov
ea20abdabd Added IR v7 reader dependency for functional tests (#1238) 2020-07-07 06:11:26 +03:00
Andrey Dmitriev
9ae3cf3faa [GNA] Added support configuration of nthreads and quantization bits (#1059) 2020-07-06 20:28:33 +03:00
Maxim Vafin
ae8aaedc29 Add assert for Clip-11 (#795) 2020-07-06 18:10:14 +03:00
Evgeny Talanin
02d4787cd4 Stick to isort==4.3.21 (#1223) 2020-07-06 17:49:47 +03:00
Gorokhov Dmitriy
071682629b [CPU][TESTS] Disabled sporadically failed Core treading test on Windows (#1227) 2020-07-06 16:22:59 +03:00
Lukasz Debski
bd0aa6ac6d [IE CLDNN] Addition of eltwise support for different input sizes. (#640) 2020-07-06 15:26:14 +03:00
Tomasz Dołbniak
f4acb0fc40 Windows build fix (#1225) 2020-07-06 14:30:49 +03:00
Vladislav Volkov
aaa61dcd23 Optimisations for binary operations broadcast (#1058) 2020-07-06 13:56:12 +03:00
Ilya Churaev
293b72151d Removed BatchNotmTraining (#1185) 2020-07-06 11:22:27 +03:00
Ilya Churaev
84f7cd2c02 Remove atan2 (#1184) 2020-07-06 06:18:45 +03:00
Jedrzej Hajduczenia
fd9ae15fdd [IE CLDNN] Fix input feature padding handling in dw conv fsv16 kernel (#1217) 2020-07-05 18:57:15 +03:00
Konrad Dobros
fee4a01b26 [IE CLDNN] Add additional check for local block io support (#1211)
This change is needed, because some ocl compiler versions may advertise
support for extension, but fail to compile some of the functions.
2020-07-05 18:56:13 +03:00
Ilya Lavrenov
df772e082a Use include headers in unit tests (#1216) 2020-07-03 23:51:21 +03:00
Anton Voronov
f3c7c731e3 [MKLDNN] Fixed bias datatype in jit_uni_dw_conv kernel (#1131) 2020-07-03 21:57:17 +03:00
Ilya Lavrenov
4f0225014d Deprecated cnn layer (#1138)
* Deprecated getInputTo, getCreatorLayer

* Fixes

* Fixed ie_layers moving to legacy

* Fixed onnx importer dependency

* Fixed python

* Fix python API compilation

* Added comments not to use _impl from Data

Co-authored-by: Nadezhda Ageeva <nadezhda.ageeva@intel.com>
2020-07-03 20:57:28 +03:00
Mateusz Bencer
6365fcb6f5 Empty dimension means Dimension::dynamic() (#1171) 2020-07-03 18:57:58 +02:00
Evgenya Stepyreva
20610ce52e [ BTS & STB ] Fixing broken transformations (#874) 2020-07-03 19:55:00 +03:00
Katarzyna Mitrus
e3e13b9bd8 Add FakeQuantize op to ONNX importer (#1099) 2020-07-03 18:28:33 +02:00
Michał Karzyński
bd8a383560 Enable nGraph Python API unit tests using Inference Engine APIs (#1095) 2020-07-03 18:11:39 +02:00
Evgenya Stepyreva
143036f96f [ MO ] Clamp value inference (#1207) 2020-07-03 17:57:10 +03:00
Evgeny Latkin
951b5eed92 [IE][VPU] exclude test: conv_3x3s1p1_vgg (issue: 34466) (#1204) 2020-07-03 17:33:37 +03:00
Liubov Batanina
9e455ae6d9 Fixed type of reduction axes (#1190) 2020-07-03 16:55:06 +03:00
Katarzyna Mitrus
099edd2f67 Enable read onnx model tensor FLOAT16 no raw data (#1168) 2020-07-03 13:45:00 +02:00
Katarzyna Mitrus
38335b1883 [ONNX importer] Add more Resize-10 tests (#1026) 2020-07-03 13:43:46 +02:00
Ilya Lavrenov
f15b5f2b60 CMAKE: Added IR reader dependency to dev_targets (#1202) 2020-07-03 14:20:08 +03:00
Ilya Lavrenov
5d573e39cd Removed const transformer usage in graph transformer (#1164)
* Commented constant folding

* Fix
2020-07-03 13:29:43 +03:00
Ilya Lavrenov
ab19051b7d Fixed typo in docs (#1201) 2020-07-03 13:27:41 +03:00
Andrew Bakalin
7f37714c02 [VPU] Enable DSR_MatMul tests (#1129)
* [VPU] Remove hardcoded shape type from MatMul dts

* [VPU] Forbid first GEMM input to be dynamic and transposed

* [VPU] Update DSR_MatMul tests to use DSR_TestsCommon base class
2020-07-03 12:30:46 +03:00
Vitaliy Urusovskij
a17366f621 [Stress] Enable StressMemleaksTests on GPU in precommit (#1079)
* [Stress] Fix missing retry for StressMemLeaksTests

* [Stress] Add smoothing with sliding average for StressMemleaksTests

* [Stress] Enable GPU in StressMemleaksTests precommit scope
2020-07-03 11:57:16 +03:00
Ilya Churaev
29ef181e47 Fixed user name in codeowners (#1198) 2020-07-03 10:59:18 +03:00
Ilya Churaev
ac2ce80dae Updated Core::ReadNetwork documentation (#1178) 2020-07-03 08:47:24 +03:00
Wayne Tan
bd25d5174f Resolve build failure due to warning C5208 (#1170)
> warning C5208: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes

This commit adds a placeholder name to the struct definition
according to the accepted solution here:
https://developercommunity.visualstudio.com/content/problem/1034754/warning-c5208-a-c20-feature-occurs-when-compiling-1.html

Only applies to MSVC 19.26 or later. The alternative is to add a switch
`/Wv:19.25` to suppress the warning.
2020-07-03 05:56:04 +03:00
Adam Osewski
b72e56e51d Remove reference to removed function. (#1192) 2020-07-03 05:46:17 +03:00
Maksim Doronin
aa8b364a5c [IE VPU] Enable DSR_* tests: part 1 (#1041)
* [IE VPU] Enable DSR_BinaryEltwise tests

* [IE VPU] Enable DSR_Gather tests

* [IE VPU] Enable DSR_Clamp tests

* [IE VPU] Enable DSR_Concat tests

* [IE VPU] Enable DSR_Convert tests

* [IE VPU] Enable DSR_Squeeze tests

* [IE VPU] Enable DSR_UnaryEltwise tests

* [ nGraph ] Softmax should return input pshape, not fully dynamic shape
2020-07-02 21:00:04 +03:00
Alexander Zhogov
2d8b8428ba Try "system.debug: true" (#1179) 2020-07-02 17:55:53 +03:00
Konrad Dobros
0509c66ce0 [IE CLDNN] Add some auto-tuning improvements (#1154)
- add error reporting for failed kernel runs during auto-tune
- fix auto-tuning for asymmetric quantization
- add asymmetric quantization information to cache
- change auto-tuning metric from average to min
2020-07-02 14:18:28 +03:00
Ilya Lavrenov
054e1cfd13 Removed WA for C API compilation (#1176) 2020-07-02 13:51:21 +03:00
Ilya Lavrenov
ef6280ab99 Split IR readers (#1167)
* Split IR readers

* Fixed tests

* CMAKE: Removed add_clang_format_target usage from readers
2020-07-02 13:31:44 +03:00
Vitaliy Urusovskij
0e904405f7 [Stress] Add --ref_db_collection in compare_memcheck_2_runs.py (#1157) 2020-07-02 13:14:07 +03:00
Ilya Churaev
869cbe489b Removed opset0 from public API (#1144) 2020-07-02 13:08:21 +03:00
Irina Efode
027be06506 [IE TESTS] ie_class migration to the new test infrastructure (#1136) 2020-07-02 11:58:53 +03:00
Andrew Bakalin
dfe27bad26 [VPU] StaticShapeNMS support (#1057)
[IE][VPU]: Introduces StaticShapeNMS stage
2020-07-02 10:57:53 +03:00
Jedrzej Hajduczenia
fe4ff33a82 [IE CLDNN] Don't force expected reorder layout & improve i64->i32 fallback (#1088) 2020-07-02 10:18:38 +03:00
Vladimir Paramuzov
c8a6a7b6d0 [IE CLDNN] Autoremove comments from processed cl files (#1152) 2020-07-02 10:13:59 +03:00
Liubov Batanina
cff39c343b [IE TEST] LRN tests fixed params (#743)
* LRN tests fixed params

* Fix comment

* Swiched to opset3
2020-07-01 22:35:28 +03:00
Ilya Lavrenov
c9749ce397 Clean-up files in tests helpers (#1173) 2020-07-01 22:34:43 +03:00
Ilya Lavrenov
acaab888f2 Removed disable_tests.hpp (#1172) 2020-07-01 22:31:51 +03:00
Yegor Kruglov
465707eba7 [MO MXNET] Fixed spatial reshape on GluonCV models (#587)
* added value propagation for slice_like op

* Mark slice_lice as undead node

* fixes in mark_undead_nodes and unittests update
2020-06-30 22:32:13 +03:00
Vladimir Paramuzov
c9d4e6b934 [IE CLDNN] Removed unused primitives and related structures (#1039) 2020-06-30 22:18:24 +03:00
Konrad Dobros
66f620f97e [IE CLDNN] Add two early optimization capabilites (#1155)
This change adds checks, macros and defines for two early/experimental
features:
- local memory block reads
- builtin optimization hints, ie: __builtin_assume
2020-06-30 18:29:34 +03:00
Gleb Kazantaev
b8b8a21dc7 Added nGraph transformations developer guide (#947)
* Added nGraph transformations developer guide

* Added some more chapters

* Added Transformation writing essentials chapter

* Added working with ngraph::Function chapter

* Added two chapters

* Fix comments

* Moved code snippets to source files

* Moved ngraph test utils to common. Added transformations test examples to template plugin

* Added Common mistake section

* Added doxygen for CommoOptimization passes

* Fixed doxygen comments; added links in md files; fixed typos

* Fixed review comments
2020-06-30 18:02:26 +03:00
Chance Luo
389a1b3ae5 Avoid duplicate data during reshapeDilation (#765) 2020-06-30 17:17:17 +03:00
Maksim Doronin
3790b35060 [IE VPU] Set name for output DSR in DTS (#1011)
* [IE VPU] Set name for outDSR in DTS transformations

* [IE VPU] Enable NonZero_Transpose tests

* [IE VPU] Set name for outDSR in Reduce DTS

* [IE VPU] Use move semantic in DTS
2020-06-30 15:27:22 +03:00
Liubov Batanina
fce9d9def0 [IE TEST] Added constant input to MatMul tests (#1119)
* Added constant input to MatMul tests

* Added InputLayerType to ngraph_helpers.hpp
2020-06-30 14:50:00 +03:00
Evgeny Lazarev
f596432268 NMS-4 op support (#1115)
* Specification for the NMS-4 operation (updated shape infer function)

* Enabled NMS-4 in the Model Optimizer

* Changed opset version for NMS with dynamic outputs and namespace to be "dynamic"

* Added NMS-4

* Added opset4 to the nGraph

* Added unit tests for NMS-4 type infer

* Renamed UpgradeNMS3ToNMS4 to UpgradeNMS3ToNMSDynamic. Added stub for ConvertNMS4ToLegacy

* Make IE aware of opset4 ops

* Updated NMSIE to have different shape infer function based on the NMS it was converted from. Implemented NMS4->NMSIE conversion

* Apply code style

* Updated StaticShapeNonMaximumSuppression op in the VPU

* Introduced new version of NMSIE operation with shape infer function from v4::NMS

* Fixed dynamicToStaticNonMaxSuppression transformation

* Added new version of NMSIE op with updated shape infer function

* Fixed NMS4 to NMSIE2 transformation

* Fixed constructors for nGraph ops v4::NM and dynamic::NMS

* Updated text in the opset4 specification document

* Code style fixes

* Fixed constructors for StaticShapeNMS + fixed test

* Minor change to the NMS op in the MO

* Fixed typo in the dynamic_to_static_shape_non_max_suppression transformation

* Removed redundant checks

* Refactored NMS infer and validate functions

* Added more checks to the validate_and_infer_types functions for NMS-3 and NMS-4

* Fixed compilation issue on Windows for op NMS

* Code style fixes

* Fixed typos in the NMSIE and NMSIE2 to CNNLayer op conversion

* Fixed typo in the ie_cnn_layer_builder_ngraph.cpp

* Fixed the NMSToLegacyNMS transformation. Added unit tests

* Apply code review comments

* Refactored NMSIE to use visitors

* Removed calling ConvertNMS4ToLegacy in the common optimizations

* Moved NMS4ToNMSLegacy to convert1_to_legacy group of transformations

* Removed useless include statement

* Removed copy-paste issue

Co-authored-by: Evgeny Lazarev <elazarev.nnov@gmail.com>
2020-06-30 14:04:31 +03:00
Tomasz Dołbniak
a01b915857 Alpha and beta nodes element types fix (#1150) 2020-06-30 12:04:11 +02:00
Anton Voronov
9b32414747 [CPU] Fixed PostOpsIntBlobMemory filling (#1133) 2020-06-30 12:01:29 +03:00
Liubov Batanina
7cda3bb275 Fixed Softmax reference (#1148) 2020-06-29 23:07:08 +03:00
Alexander Chaiko
da03c7ad0d [IE CLDNN] Fix Android build error: braces around scalar initializer (#1151) 2020-06-29 20:27:41 +03:00
Ilya Lavrenov
b43d26ab8a Cnnnetwork add layer (#1124)
* Removed addLayer from public interface

* Convert to CNNNetworkImpl
2020-06-29 16:21:48 +03:00
Evgenya Stepyreva
62fba3eadf [ MO ] Keep data type of compressed value (#1143)
JIRA: 34085
2020-06-29 14:56:11 +03:00
Alexander Chaiko
f8b2627c3b [IE CLDNN] int8 batches optimization (#632) 2020-06-29 14:09:33 +03:00
Vladimir Gavrilov
b9d67927fd Fixed deleting Transpose layers after and before Interpolate layers. (#1071)
* Fixed deleting Transpose layers after and before Interpolate layers.

* Added run_after() for the transformation InterpolateTranspose.

* Some checks were moved from the replacement function to the pattern.

* Added a check of the attribute 'axes' into the pattern.
2020-06-29 12:49:29 +03:00
Ilya Churaev
182499c006 Removed backprop operations (#1091)
* Removed backprop operations

* Fixed build

* Removed AvgPool

* Removed tests for v0 AvgPool

* Fixed code style

* Fixed export
2020-06-29 11:14:48 +03:00
Egor Churaev
08cd0f7779 [IE CLDNN] Implement ExtractImagePatches operation (#1127)
The ExtractImagePatches operation collects patches from the input
tensor, as if applying a convolution. All extracted patches are stacked
in the depth dimension of the output.

JIRA: 30055
2020-06-29 10:36:30 +03:00
Adam Osewski
d0be6b1d2f Dynamic attribute getters and setters. (#964) 2020-06-26 16:35:00 +02:00
Anton Chetverikov
5aa9ffbfe3 Fix const node non-deterministic names (part 1) (#996)
* Update node names
2020-06-26 13:41:49 +03:00
Adam Osewski
0cdc549911 Fix use of new TestCase. (#1130) 2020-06-26 13:00:28 +03:00
Michał Karzyński
5f4f70e408 Fixes in TensorIterator builder code (#1104) 2020-06-26 10:16:51 +02:00
Adam Osewski
1fb2172457 [ONNX] Support for dynamic shapes for InstanceNormalization (#1076) 2020-06-26 09:38:15 +02:00
Mateusz Bencer
d9076c29a2 Enabled importing ONNX Yolo v3, added Loop op (#957) 2020-06-26 09:18:24 +02:00
Ilya Lavrenov
3a9db885bf Removed getLayerByName from public API (#1110)
* Fixed tests

* Removed getLayerByName from public API
2020-06-25 20:00:39 +03:00
Andrey Zaytsev
ff769a2e31 Link fixes for opset docs (#1072)
* Fixed links

* Update opset.md
2020-06-25 18:46:21 +03:00
Ewa Tusień
f2e8435566 Switch MeanVarianceNormalization op to opset3 in ONNX importer (#865)
* Switch MVN op to opset3.
2020-06-25 16:24:00 +03:00
Anna Alberska
0b9987f5e9 [GNA] fix custom scale factors when importing a model (#1096) 2020-06-25 12:43:47 +03:00
Andrew Bakalin
0f1c8a0763 [VPU] WA for statis shape allocation (#1107) 2020-06-25 10:38:25 +03:00
Jedrzej Hajduczenia
5746e27111 [IE CLDNN] Set strided slice out_format to bfyx when in_format=bfzyx and shrink_axis_mask is set (#1111) 2020-06-25 10:24:00 +03:00
Maxim Shevtsov
7e40136c3c LayerNorm(PyTorch/HuggingFace pattern)->MVN+Mul+Add (#1003)
* LayerNorm(PyTorch/HuggingFace pattern)->MVN+Mul+Add. Improves perf on BERT by 5%

* deducing the across_channels from axes passed to the MVN op.
axes are normalized. if no axes is specified, falling back to the (previously) default across_channel value

Co-authored-by: myshevts <maim.y.shevtsov@intel.com>
2020-06-25 09:25:56 +03:00
Evgenya Stepyreva
f81257c969 [ v4::NMS ] Fixed v4 NMS cloning (#1113) 2020-06-24 23:09:48 +03:00
Ilya Lavrenov
377531002c Removed suppression macro usage (#1108) 2020-06-24 18:40:06 +03:00
Roman Lyamin
bc132056f9 [IE CLDNN] Added space_to_batch operation (#984) 2020-06-24 18:30:24 +03:00
Andrey Dmitriev
cec12131e7 [GNA] Added fix multiple output with one go to memory and test (#669)
[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

Added multi output

Update gna_pass_manager.cpp

test

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

Added multi output

Update gna_pass_manager.cpp

test

tests

[GNA] Added fix multiple output with one go to memory and test

[GNA] Added fix multiple output with one go to memory and test

Added multi output

Update gna_pass_manager.cpp

test

tests

Added pass

Test

test

tests_2

return old
2020-06-24 17:38:34 +03:00
Tomasz Dołbniak
1bfe709e6c TestCase & TestEngine(s) for nGraph UTs (#934) 2020-06-24 16:02:39 +02:00
Irina Efode
615c2a6c30 [IE TESTS] CoreThreadingTestsWithIterations.smoke_LoadNetworkAccuracy disabled & small refactoring of CoreThreadingTests (#1103) 2020-06-24 16:10:39 +03:00
Ilya Lavrenov
fe7f08ca56 Exec extensions (#963)
* Fixes

* Removed some tests for extensions

* Added const

* Removed unknown pragma
2020-06-24 15:12:14 +03:00
Ilya Churaev
934e0c61eb Removed reference implementations for some data types (#1086) 2020-06-24 12:44:19 +03:00
Irina Efode
9e0aa3eb5d [IE TESTS] Remove extra files (#1087)
CI passed
2020-06-24 12:19:11 +03:00
Roman Kazantsev
7a96b03a81 [IE] Preserve output data name after merging and update output data map (#1101)
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-24 12:14:18 +03:00
Ilya Lavrenov
447f69c84e Moved deprecated network iterator to legacy (#913)
* Removed deprecated iterator API

* Applied comments
2020-06-24 11:55:17 +03:00
Ilya Lavrenov
94c8b9e5a7 Removed deprecated ICNNNetwork::getData (#1093) 2020-06-24 05:53:28 +03:00
Ilya Lavrenov
a7579d5c35 Removed ICNNNetReader interface (#1042)
* Removed ICNNNetReader interface

* Fixed stress tests

* Fixed comments in VPU plugin

* Removed duplicated stress tests

* Fixed watchdog tests
2020-06-23 22:34:26 +03:00
Anton Zaytsev
34de464027 [IE TESTS] move BehaviorTestPlugin to the new IE tests infra & small refactoring for Behavior tests (#784)
* [ci-skip][IE TESTS] move beh_test_plugin

* [ci-skip][IE TESTS] move BehaviorHolderTest

* [ci-skip][IE TESTS] fix GNA layout test

* [ci-skip][IE TESTS] fix cmake

* [ci-skip][IE TESTS] fix lib in IEBehaviorTest

* [ci-skip][IE TESTS] separate layout and cpp_wrapers test and fix namespace

* [ci-skip][IE TESTS] fix holders test

* [ci-skip][IE TESTS] fix namespace

* [ci-skip][IE TESTS] fix codestyle

* [ci-skip][IE TESTS] fix test_plugin

* [ci-skip][IE TESTS] fix test_plugin v2

* [ci-skip][IE TESTS] disabled gpu instance for test_plugin

* [ci-skip][IE TESTS] fix
2020-06-23 21:43:13 +03:00
Irina Efode
11d3bd1cb3 [IE TESTS] Range (#1094) 2020-06-23 20:39:06 +03:00
Michał Karzyński
69a342ea68 Fixes for building nGraph Python API (#707) 2020-06-23 17:32:37 +02:00
Anton Pankratv
1ffd736ba9 Hetero plugin supports ngraph (#530) 2020-06-23 17:23:47 +03:00
Egor Churaev
c898142663 [IE CLDNN] Fix device release with static plugin instance (#1034)
The problem was in order of freeing memory. _context was removed before
_device and it looks like cl::Device in destructor tries to read some
info from cl::Context. And in this case we got this problem with
addressing because the memory already was freed.

For fixing the problem I changed the order of constructing members. And
based on principle: "First constructed, last destructed", the problem
was fixed.

JIRA: 29649
2020-06-23 16:21:24 +03:00
Ilya Lavrenov
370f9e7fe1 Removed deprecated Data ctor (#1078) 2020-06-23 16:10:00 +03:00
Ilya Lavrenov
28bdcb374d Cnnnetwork deprecated methods (#1077)
* Removed getName with char *

* Removed getPrecision from ICNNNetwork
2020-06-23 16:09:40 +03:00
Andrew Bakalin
bde7c9baee [VPU] Support for originalLayersNames attribute in exec graph (#1033) 2020-06-23 15:05:40 +03:00
Andrew Bakalin
36fd61f2c9 [VPU] Fix eltwise broadcast (#1001)
* [VPU][Tests] Extend eltwise test cases

* [VPU] Fix Myriad2

* [VPU] Update firmware

* [VPU] Review fixes

* [VPU] Update old deprecated tests
2020-06-23 15:03:50 +03:00
Katarzyna Mitrus
5a2df9ebe7 [ONNX importer] Add support for Usample-8 and Upsample-9 (#967) 2020-06-23 13:11:46 +02:00
Roman Kazantsev
5ad1bf643d Correct removing nodes from graph and add test for ConstToResult transform (#1084)
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-23 13:49:14 +03:00
Ilya Lavrenov
a3a368da64 CMAKE: cross-compilation for ia32 (#1074) 2020-06-23 12:35:17 +03:00
Irina Efode
d20246d2f1 [IE TESTS] Add Squeeze single layer test (#985)
* [IE TESTS] Add Squeeze single layer test

* [IE TESTS] Add Unsqueeze test

* Fix some comments
2020-06-23 10:05:28 +03:00
Evgenya Stepyreva
543cccc8cf [ DTS ] MatMul (#974)
* [ DTS ] MatMul

* [ TESTS ] Dynamic MatMul inference test disabled
2020-06-23 09:58:03 +03:00
Konrad Dobros
9592be6d22 [IE CLDNN] Add work-around for 1d input to Gather (#1070) 2020-06-23 09:40:15 +03:00
Evgenya Stepyreva
f40338ff4b [ MO ] Hard-coded Interpolate followed by concat reshape-ability fixing (#818) 2020-06-23 08:27:27 +03:00
Ivan Tikhonov
3490b985dd Fix for Kaldi models with a batch of more than 1 (#1012)
* Fix kaldi models (batch > 1)

* ngraph codestyle

* fix ngraph to ie conversion

* Added comment

* apply review comments

* Added test for the case using the SetBatchSize function when ReadValue op is in the network

* Check status code instead of message

* Use new ngraph api
2020-06-23 08:22:12 +03:00
Ivan Tikhonov
b5be90a886 Fix Android ARM build (#1032)
* fix arm build: size_t -> uint64_t

* apply static_cast

* fix dynamic_to_static_shape_binary_elementwise.cpp file

* add static_cast in prior_box.cpp
2020-06-22 23:37:08 +03:00
Maxim Vafin
9276334144 Cherry-pick fix OneHot transformation for Bert Squad opset 10 (#1068)
* Fix OneHot transformation for Bert Squad opset 10

* Add transformation for squeezing depth for OneHot
2020-06-22 20:42:02 +03:00
Denis Orlov
85b8bdcfa6 [GNA] Initialize a local variable (#1067) 2020-06-22 18:49:38 +03:00
Pavel Rodionov
d9489d1f5d [GNA] Support export model with multiple inputs/outputs and Permute layer (#775) 2020-06-22 18:00:29 +03:00
Vladimir Paramuzov
0ec07b2c3b [IE CLDNN] fsv4 to fsv16 conv (#1030) 2020-06-22 17:09:39 +03:00
Alexander Chaiko
a5270192d0 [IE CLDNN] WA to inconsistency between input and const 1d tensors for concat (#1063) 2020-06-22 17:02:23 +03:00
dmitrygo
f075b98f20 [CPU] Fixed issue with unsupported reorder case for groupped convolutions 2020-06-22 16:31:01 +03:00
Andrey Somsikov
52a42624e9 Add memcheck runner script (#1031)
Script executes measurement isolated with gtest-parallel,
handles database uploading and reports generation.
2020-06-22 16:23:09 +03:00
Anton Romanov
81046cacf4 Fix samples build script (#819) 2020-06-22 16:12:02 +03:00
Kamil Magierski
f675848680 Fix cases then const blob precision is not FP32/FP16 (#1020)
Co-authored-by: kmagiers <kmagiers@intel.com>
2020-06-22 15:46:01 +03:00
Adam Osewski
491e5e9fbb [Py] Ngraph Py API TensorIterator (#718) 2020-06-22 11:40:58 +02:00
Evgeny Lazarev
970b1301b5 Cleanup IR v7 from the MO (#1008)
* Removed back phase transformations related to IRv7

* Fixed setting value for the input port using the 'set_value' method

* Removed front and middle phase transformations related to IRv7

* Cleanup the rest of the Model Optimizer transformations from IRv7 specific transformations

* Final cleanup of the deprecated IR v7 related code

* Removed 'blobs_as_input' usage in the Model Optimizer.

* Removed function '_fuse_add' from the Model Optimizer since it is not used anymore.

* Removed 'keep_in_IR' node attribute for FakeQuantize ops in the MO

* Disabled failing gpu_engine.user_context test
2020-06-22 11:52:00 +03:00
Ilya Lavrenov
c75920ee69 Remove some stuff from legacy library (#1043) 2020-06-22 11:35:44 +03:00
Edward Shogulin
fbec64d2d2 [LPT] BERT with specific biases support & improvement (cherry-pick to master) (#1021)
* [LPT] BERT with biases support

* [LPT] Gemm biases and quantization

* [CPU] Fixed FullyConnected + Depthwise node fusing

* [LPT] FullyConnected 3D: symmetric quantization support

* [LPT] FullyConnected 3D: symmetric quantization support fix

* [CPU] Fixed FullyConnected + Depthwise fusing initialization

Co-authored-by: dmitrygo <dmitry.gorokhov@intel.com>
2020-06-20 19:06:26 +03:00
Marcin Sielski
22328d49be Fix build issue (#923)
* Fix build issue

Why:

* Enable to build OpenVINO.

This change addresses the need by:

* Adding include directories,
* Removing IE::inference_engine_c_api dependency.

* Remove IE::inference_engine_nn_builder reference.

Why:

* Enable to build OpenVINO.

This change addresses the need by:

* Removing  IE::inference_engine_nn_builder dependency.

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2020-06-19 22:06:30 +03:00
Konrad Dobros
2a1a92d31a [IE CLDNN] Fix activation implementation for fsv16 format (#1037)
For b_fs_yx_fsv16 format in reference kernel features for dispatch are
rounded to multiple of 16. This change adds correct check in kernel to
return work-items that are inside this dispatch padding.
Previously those work-items could corrupt memory expected to be filled
with 0s, and for parametrized activation due to bounds checking with
modulo operator they could have been corrupting actual layer output.

Issue: CVS-27672
2020-06-19 21:41:08 +03:00
Ilya Lavrenov
0b2827e027 Moved plugin to hidden folder (#999) 2020-06-19 21:04:12 +03:00
Ilya Lavrenov
79ff221957 Removed VPU option (#1027) 2020-06-19 20:55:53 +03:00
Vitaliy Urusovskij
3417004e6d Add memcheck comparison script (#935)
Add compare_memcheck_2_runs.py compares two runs.
Add handling of broken files for `parse_memcheck_log`
2020-06-19 15:56:32 +03:00
Ilya Lavrenov
e8aed763d2 Removed Int8 normalizer and statistics (#919)
* Removed Int8 normalizer and statistics

* Removed statistics handling from tests utils

* Fixed tests compilation with statistics
2020-06-19 15:10:21 +03:00
Andrey Sokolov
4cfc4243e9 [IE VPU] use optimized ReduceMean instead of GlobalPooling (#629) 2020-06-19 14:48:53 +03:00
Ilya Lavrenov
bf3f799927 Removed shape infer extension (#917) 2020-06-19 14:48:26 +03:00
Andrey Zaytsev
d67371617a Added opset docs (#992) 2020-06-19 14:39:57 +03:00
Maksim Doronin
a5e5af068f [IE VPU] Evaluate DSR (#770)
* [IE VPU] Add evaluate method to DSR

* [IE VPU] Enable DSR_Reshape tests

* [IE VPU] Improvements in DSR op

* [IE VPU] Fix typo in copyBlobAccordingUpperBound

* [IE VPU] Support dynamic inputs

* [IE VPU] Use dynamic inputs in tests

* [IE VPU] Improve conditions in propogateDynamism pass

* [IE VPU] Fix Myriad2 tests via dosabling reorder

* [IE VPU] make error message more explicit

* [IE VPU] Fix Win compilation: std::stoi in <string>

* [IE VPU] Improve data transferring to work with ND tensors

* [IE VPU] Avoid ODR in myriad common test utils

* [IE VPU] Split code in propagate dynamism into separate methods

* [IE VPU] Simplify conditions in DSR parsing

* [IE VPU] Emplace data in initialStages when remove stage order
2020-06-19 13:22:31 +03:00
Gorokhov Dmitriy
61821983bf [IE Common][WA] Skipped const folding for Convolution layer (#1005) 2020-06-19 13:03:21 +03:00
Andrey Dmitriev
29701de86b [GNA] fix permute 0_2_1 (#991) 2020-06-19 10:21:04 +03:00
Andrey Somsikov
cdab868cbc fix: inference-engine/ie_bridges/python/requirements.txt to reduce vulnerabilities (#1006)
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-73513

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2020-06-19 01:27:32 +03:00
Vladimir Paramuzov
ba8226fcb4 [IE CLDNN] Fix strided slice (#950) 2020-06-18 19:55:17 +03:00
Alexander Zhogov
6ca5cc1fe2 Azure CI: Add gtest-parallel on Lin & Mac (#980) 2020-06-18 19:20:03 +03:00
Jedrzej Hajduczenia
491173e01e [IE CLDNN] Add pooling b_fs_yx_fsv16 int8 (#565) 2020-06-18 16:40:52 +03:00
Mikhail Treskin
438c69411a Adding new layer tests to validation (#848)
* Add transpose, gather and reduce ops layer tests

* Fix skipping of Reduce Logical tests

* Fix compilation error with icl
2020-06-18 14:31:16 +03:00
Maxim Andronov
fafc6a485d [CPU] fix one dims scale shift (#989) 2020-06-18 14:21:23 +03:00
Nikolay Shchegolev
26ae52b461 [Common] Static analysed issues. Part II. (#881) 2020-06-18 13:59:26 +03:00
Nikita Kudriavtsev
fbf062c46b Changes: (#982)
- Named structures in bmp.h to avoid MSFT compiler error
- Fix for non-void function with missing return statement to avoid Intel compiler error
- Enabled "smoke_ExportUsingFileNameImportFromStreamNoThrowWithDeviceName" test
- Fix for MvncTest
2020-06-18 13:49:20 +03:00
Evgenya Stepyreva
bb44f17a06 [ DTS ] Reduces (#940) 2020-06-18 11:36:07 +03:00
Evgenya Stepyreva
88cccee0b7 [ DYN NMS ] Static & Dynamic ops; DTS transformation; VPU tests (#884) 2020-06-18 00:16:20 +03:00
Evgeny Lazarev
356e40c988 Relaxed MO requirements for "protobuf" package (#864)
Co-authored-by: Evgeny Lazarev <elazarev.nnov@gmail.com>
2020-06-17 18:31:23 +03:00
Pavel Esir
00f0247b4e fixed some typos in MO help (#972) 2020-06-17 18:27:37 +03:00
Evgenya Stepyreva
a32d9662c2 [ DTS ] Exp, Softmax, Greater (#926)
- Dynamic to Static transformation enabled for Exp, Softmax, Greater
- Logic Elementwises default ctor sets autobroadcasting according to spec
2020-06-17 18:20:08 +03:00
Ilya Churaev
e0cf66b31a Fixed cpack information, removed some links (#976) 2020-06-17 17:17:32 +03:00
Konrad Dobros
ccbbdcf80d [IE CLDNN] Fix gather dimensions calculation (#959) 2020-06-17 15:07:18 +03:00
Ilya Lavrenov
3bfc35b3fc Execution graph via ngraph for CPU plugin (#510)
* Execution graph via ngraph for CPU plugin

* Fixes

* Migrated to VariantImpl instead of Parameter

* Reverted to dedicated ExecutionNode once again

* Re-use new execution graph in tests

* Fixed one more tests to use execution graph via ngraph::Function
2020-06-17 14:42:41 +03:00
Ilya Lavrenov
7861b67203 CMAKE: fixed path for bin artifacts for 32bits (#890) 2020-06-17 14:41:16 +03:00
Ilya Lavrenov
c02ed9e0a8 Pass SizeVector by const reference in ie_layout.hpp (#965) 2020-06-17 14:34:38 +03:00
Irina Efode
2b5145d207 [IE TESTS] disable Some myriad tests on Win (#763)
* [IE TESTS] disable Some myriad tests on Windisable Some myriad tests on Win

* Skip test with todo
2020-06-17 11:26:33 +03:00
Ilya Churaev
2c7b0eb282 Use creators only for default opsets (#948) 2020-06-16 22:30:20 +03:00
Gladilov, Gleb
4a859833ff [IE][VPU]: Enables dynamic output from middle of network support (#930)
* [IE][VPU]: Enables dynamic output from middle of network support

This feature is very useful for debugging dynamic networks.
Changes include modification of existing addCopyForOutputsInsideNetwork
pass to respect dynamic outputs and moving propagateDynamismToOutputs
pass after addCopyForOutputsInsideNetwork. The motivation for last change
is to avoid unnecessary copy stages due to not synchronized logic, because
previously:

* First in Front-End (parseDSR) we mark shape data object as output
* Then in propagateDynamismToOutputs we insert copy stage for that case.
  It's necessary if shape data object had other consumers
* Then in convertShapeNotation we insert Gather consumer for output data object
* Finally, addCopyForOutputsInsideNetwork inserts one more copy stage to leave
  output data object without consumers.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>

* [IE][VPU]: Replaces attrs.has + attrs.get with attrs.getOrDefault

* [IE][VPU]: Fixes setting IE-notation and converted-notation to the same data object
2020-06-16 16:17:36 +03:00
Andrey Dmitriev
5e165ac484 [GNA] Added test ScaleShift and fixed power layer with non zero shift (#774)
* [GNA] Added test ScaleShift and fixed power layer with non zero shift
2020-06-16 15:21:24 +03:00
Ilya Lavrenov
351a11b730 Removed deprecated error listener, getmappedtopology (#915) 2020-06-16 15:06:48 +03:00
Ilya Lavrenov
3a900d0080 Removed PluginDispatcher; IEPlugin from python API (#920) 2020-06-16 15:03:32 +03:00
Alexey Tarakanov
3127673009 Support fp16 networks (#752)
* Modifications to support fp16 networks in KMB-plugin

* StridedSliceIE is removed

* One function convertFunctionToICNNNetwork with default parameter

* Some little changes in function convertFunctionToICNNNetwork()

* Delete some spaces in code (style changes)

* Edit code style

* Edit code style one more

* Edit code style again

* Remove row with Transpose()
2020-06-16 10:59:20 +03:00
Konrad Dobros
db3dff36b9 [IE CLDNN] Add resample improvements (#933)
This change:
- extends concat in-place optimization for resample on input
- adds resample primitive int8 support for bilinear mode
- fixes some potential issues with offset calculations with in8
2020-06-16 09:07:05 +03:00
Anastasia Kuporosova
e66e0cd893 [Python API] Fix long inference (#938) 2020-06-16 01:27:38 +03:00
Jedrzej Hajduczenia
ecbd9a2c62 [IE CLDNN] Fix inserting reorders in bwd direction (#811) 2020-06-15 16:14:13 +03:00
Maksim Doronin
b23912ac03 [IE VPU] Dynamic Concat fixes (#842)
* [IE VPU] Dynamic Concat fixes

* [IE VPU] Update firmware
2020-06-15 13:57:16 +03:00
Monica-elena Burger
1e180ddf5e [IE VPU] Enable variable number of inputs for ExpPriorGridGenerator (#855)
* [IE VPU] Enable variable number of inputs for ExpPriorGridGenerator layer

* [IE VPU] Add test cases for ExpPriorGridGenerator layer with less than three inputs
2020-06-15 13:00:02 +03:00
Ilya Lavrenov
bb265565c7 CMAKE: removed conditional compilation for C API (#861) 2020-06-15 12:39:45 +03:00
Ilya Lavrenov
88e14c9dd6 Updated dates of removal for deprecated API (#912) 2020-06-15 12:27:20 +03:00
Ilya Lavrenov
7049142080 TESTS: Added test for parallel LoadNetwork with accuracy check (#910) 2020-06-15 12:22:59 +03:00
Ilya Lavrenov
b058948763 Docs 2021 1 (#901)
* Initial state of dev docs

* Ported docs for quantized networks

* Integrate quantization guide + transformations template

* Fixes
2020-06-15 12:20:42 +03:00
Gleb Kazantaev
36be9e4031 Fix NopElimination (#891) 2020-06-15 10:39:55 +03:00
Roman Kazantsev
683c93e011 Fix preserving names of output layers after TopK NGraph transformation (#843)
* Fix preserving names of output layers after TopK NGraph transformation

It helps to infer semantic-segmentation-adas-0001 model. See CVS-31977.

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix a test for TopK

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix TopK NGraph transformation and its test

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-06-15 10:29:02 +03:00
Vladimir Zinoviev
ed444bf9f4 [CLDNN] Fix std::runtime_error missing (#871) 2020-06-14 18:54:36 +03:00
Ivan Tikhonov
e5823bed26 Temporary disable PriorBoxClustered tests due to rare sporadic failures (#892)
* Temporary disable PriorBoxClustered tests due to rare sporadic failures

* Added skip_tests_config for TransformationTests
2020-06-14 17:20:21 +03:00
Vladimir Paramuzov
a2d64b73f6 [IE CLDNN] Fixed clone network to preserve original CNNNetwork (#876) 2020-06-12 15:56:04 +03:00
Konrad Dobros
e1c22196b4 [IE CLDNN] Fix fsv16 -> bfyx reorder removal (#872) 2020-06-12 15:44:14 +03:00
Evgeny Latkin
9fa21902b0 [IE][Myriad] fix HW tiling (#866) 2020-06-11 20:49:17 +03:00
Vladimir Paramuzov
8ae823084f [IE CLDNN] fix perf for fsv16 global avg pooling (#878) 2020-06-11 20:45:11 +03:00
Vladimir Paramuzov
a3fce2d763 [IE CLDNN] Always use FP32 as intermediate type for fused quantize (#877) 2020-06-11 12:27:11 +03:00
Evgenya Stepyreva
c846c049e2 [ nG ] Style-apply (#886) 2020-06-11 12:20:54 +03:00
Evgenya Stepyreva
ffe4a74169 [ nG ] Graph visualization (#807)
* [ nG ] Graph visualization

* Update visualize_tree.cpp
2020-06-11 00:37:37 +03:00
Jedrzej Hajduczenia
4fbec25c01 [IE CLDNN] Enable I64 const inputs for batch_to_space (#860) 2020-06-10 21:07:22 +03:00
Anton Dudchenko
a6bb5aa037 [VPU][GT] Trivial permute optimization (#571)
* Transformation to eliminate trivial permute

* Minor changes in unit tests

* Replace trivial permutation with copy if input and output dims is equal

* Fix mergePermuteStages tests

* Small changes in the loop

* Add const modifier, change dimsVector type to SizeVector

* Change loop condition, rename valiable

* To reverse dimsVector
2020-06-10 17:30:37 +03:00
Nikita Kudriavtsev
086a5c5b26 [IE Myriad] Added test InferWorksCorrectAfter9999Allocations (#709) 2020-06-10 16:42:37 +03:00
Alexander Zhogov
4778feae91 Actions CI: Enable nGraph Code style check (#863) 2020-06-10 16:18:53 +03:00
Aleksandr Korolev
84119afe9a [IE VPU TESTS] Rewrite tests with deprecated API (#761)
* [IE VPU TESTS] Rewrite tests with deprecated API

* Minor changes

Co-authored-by: kora6 <kora6@github.com>
2020-06-10 14:13:08 +03:00
Jedrzej Hajduczenia
85406c9768 [IE CLDNN] Add support for I64 data type in clDNN plugin (#555) 2020-06-10 09:34:29 +03:00
Maksim Derbasov
67ebba6f22 Show error message if output file is not writable (#779) 2020-06-09 23:54:22 +03:00
Andrey Somsikov
2ed596c87a Use default thread sanitizer linkage (#833)
GCC and CLang *default* sanitizer linkage differs (static vs. dynamic).
Prefer default behavior as alternate seen having issues.

Default (GN)U linker fails with unresolved symbols linking Clang built
binaries with sanitizer enabled. Force use LLVM linker lld for Clang
builds.

Sanitizer instrumentation and link flags should be retained for all
binaries. Updating samples cmake configuration to keep those flags
after unset logic at the ie_build_samples().
2020-06-09 20:11:44 +03:00
Evgeny Lazarev
17ca27e4ab Fixed StridedSlice to Crop transformation (#836)
* Fixed StridedSlice to Crop transformation to not apply when rank of data is changed

* Added unit test for StridedSlice to Crop transformation

Co-authored-by: Evgeny Lazarev <elazarev.nnov@gmail.com>
2020-06-09 20:00:43 +03:00
Roman Lyamin
3b4990ed30 [IE CLDNN] Added batch_to_space operation (#753) 2020-06-09 19:19:24 +03:00
Gleb Kazantaev
4c62786499 Fix divide conversion for integer input type (#841) 2020-06-09 19:13:35 +03:00
Anastasia Kuporosova
f278509236 [Python API] Fixate requirements (#834) 2020-06-09 18:06:57 +03:00
Ilya Lavrenov
f518fbb971 Fixed default args for Android build (#827) 2020-06-09 18:02:03 +03:00
Maxim Vafin
074266bf73 Fix onnx slice by clipping ends to int32 domain (#603) 2020-06-09 17:50:38 +03:00
4997 changed files with 191935 additions and 198152 deletions

View File

@@ -0,0 +1,84 @@
FROM ubuntu:20.04
LABEL version=2020.07.09.1
ARG http_proxy
ARG https_proxy
ENV http_proxy ${http_proxy}
ENV https_proxy ${https_proxy}
ENV CI=true
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED 1
# Install base dependencies
RUN apt-get update && apt-get install -y locales && apt-get clean autoclean && apt-get autoremove -y
# Set the locale to en_US.UTF-8
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update && apt-get -y --no-install-recommends install \
# OpenVINO dependencies
autoconf \
automake \
build-essential \
cmake \
curl \
git \
libtool \
ocl-icd-opencl-dev \
pkg-config \
unzip \
wget \
# Python dependencies
python3 \
python3-pip \
python3-dev \
python3-virtualenv \
cython3 \
tox \
# ONNX dependencies
git-lfs \
protobuf-compiler \
libprotobuf-dev && \
apt-get clean autoclean && \
apt-get autoremove -y
# Build OpenVINO
COPY . /openvino/
WORKDIR /openvino/build
RUN cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_VPU=OFF \
-DENABLE_GNA=OFF \
-DENABLE_OPENCV=OFF \
-DENABLE_CPPLINT=OFF \
-DENABLE_TESTS=OFF \
-DENABLE_BEH_TESTS=OFF \
-DENABLE_FUNCTIONAL_TESTS=OFF \
-DENABLE_MKL_DNN=ON \
-DENABLE_CLDNN=OFF \
-DENABLE_PROFILING_ITT=OFF \
-DENABLE_SAMPLES=OFF \
-DENABLE_SPEECH_DEMO=OFF \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DNGRAPH_ONNX_IMPORT_ENABLE=ON \
-DNGRAPH_IE_ENABLE=ON \
-DNGRAPH_INTERPRETER_ENABLE=ON \
-DNGRAPH_DEBUG_ENABLE=OFF \
-DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON \
-DCMAKE_INSTALL_PREFIX=/openvino/dist
RUN make -j $(nproc) install
# Run tests via tox
WORKDIR /openvino/ngraph/python
ENV NGRAPH_CPP_BUILD_PATH=/openvino/dist
ENV LD_LIBRARY_PATH=/openvino/dist/lib
ENV NGRAPH_ONNX_IMPORT_ENABLE=TRUE
ENV PYTHONPATH=/openvino/bin/intel64/Release/lib/python_api/python3.8:${PYTHONPATH}
RUN git clone --recursive https://github.com/pybind/pybind11.git
CMD tox

125
.ci/openvino-onnx/Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,125 @@
// Copyright (C) 2018-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
DOCKER_CONTAINER_NAME= "openvino-onnx-ci-container"
DOCKER_IMAGE_TAG = "openvino-onnx-ci-image"
def getGitPrInfo(String project) {
def gitPrInfo = [
prAuthorEmail : "",
commitAuthorEmail : "",
commitHash : "",
commitSubject : ""
]
try {
dir ("${WORKDIR}/${project}") {
gitPrInfo.prAuthorEmail = sh (script: 'git log -1 --pretty="format:%ae" ', returnStdout: true).trim()
gitPrInfo.commitAuthorEmail = sh (script: 'git log -1 --pretty="format:%ce" ', returnStdout: true).trim()
gitPrInfo.commitSubject = sh (script: 'git log -1 --pretty="format:%H" ', returnStdout: true).trim()
gitPrInfo.commitHash = sh (script: 'git log -1 --pretty="format:%s" ', returnStdout: true).trim()
}
}
catch(e) {
echo "Failed to retrieve ${project} git repository information!"
echo "ERROR: ${e}"
}
return gitPrInfo
}
def notifyByEmail(def gitPrInfo) {
stage('Notify') {
String notifyPeople = "${gitPrInfo.prAuthorEmail}, ${gitPrInfo.commitAuthorEmail}"
emailext (
subject: "OpenVino CI: PR ${CHANGE_ID} ${currentBuild.result}!",
body: """
Status: ${currentBuild.result}
Pull Request Title: ${CHANGE_TITLE}
Pull Request: ${CHANGE_URL}
Branch: ${CHANGE_BRANCH}
Commit Hash: ${gitPrInfo.commitSubject}
Commit Subject: ${gitPrInfo.commitHash}
Jenkins Build: ${RUN_DISPLAY_URL}
""",
to: "${notifyPeople}"
)
}
}
def gitSubmoduleUpdate(String repository_name) {
dir ("${WORKDIR}/${repository_name}") {
sh label: "Init ${repository_name} submodules",
script:
"""
git submodule init && git submodule update \
--init \
--no-fetch \
--recursive
"""
}
}
def buildDockerImage() {
sh """
docker build --tag=${DOCKER_IMAGE_TAG} --file=.ci/openvino-onnx/Dockerfile \
--build-arg http_proxy=http://proxy-chain.intel.com:911/ \
--build-arg https_proxy=http://proxy-chain.intel.com:912/ .
"""
}
def runTests() {
sh """
docker run --rm --name ${DOCKER_CONTAINER_NAME} \
--volume ${HOME}/ONNX_CI/onnx_models/.onnx:/root/.onnx ${DOCKER_IMAGE_TAG}
"""
}
pipeline {
agent {
label "OpenVino"
}
environment {
PROJECT_NAME = "openvino"
WORKDIR = "${WORKSPACE}/${BUILD_NUMBER}"
}
options {
skipDefaultCheckout true
}
stages {
stage("Clone repository") {
steps{
dir("${WORKDIR}") {
checkout scm
}
gitSubmoduleUpdate(PROJECT_NAME)
}
}
stage("Prepare Docker environment") {
steps{
dir("${WORKDIR}") {
buildDockerImage()
}
}
}
stage("Run tests") {
steps{
runTests()
}
}
}
post {
failure {
script {
gitPrInfo = getGitPrInfo(PROJECT_NAME)
notifyByEmail(gitPrInfo)
}
}
cleanup {
dir("${WORKDIR}") {
deleteDir()
sh """
docker image prune -f
"""
}
}
}
}

6
.gitattributes vendored
View File

@@ -63,3 +63,9 @@
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
*.PNG filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.vsdx filter=lfs diff=lfs merge=lfs -text

58
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@@ -0,0 +1,58 @@
---
name: Bug
about: Create a report to help us improve
title: "[Bug]"
labels: bug, support_request
assignees: ''
---
##### System information (version)
<!-- Example
- OpenVINO => 2020.4
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
- Problem classification: Model Conversion
- Framework: TensorFlow (if applicable)
- Model name: ResNet50 (if applicable)
-->
- OpenVINO=> :grey_question:
- Operating System / Platform => :grey_question:
- Compiler => :grey_question:
- Problem classification => :grey_question:
##### Detailed description
<!-- your description -->
##### Steps to reproduce
<!--
Describe your problem and steps you've done before you got to this point.
to add code example fence it with triple backticks and optional file extension
```.cpp
// C++ code example
```
or attach as .txt or .zip file
-->
##### Issue submission checklist
- [ ] I report the issue, it's not a question
<!--
OpenVINO team works with support forum, Stack Overflow and other communities
to discuss problems. Tickets with question without real issue statement will be
closed.
-->
- [ ] I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
<!--
Places to check:
* OpenVINO documentation: https://docs.openvinotoolkit.org/
* OpenVINO forum: https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/bd-p/distribution-openvino-toolkit
* OpenVINO issue tracker: https://github.com/openvinotoolkit/openvino/issues?q=is%3Aissue
* Stack Overflow branch: https://stackoverflow.com/questions/tagged/openvino
-->
- [ ] There is reproducer code and related data files: images, videos, models, etc.
<!--
The best reproducer -- test case for OpenVINO that we can add to the library.
-->

0
.github/org_control/__init__.py vendored Normal file
View File

51
.github/org_control/check_org.py vendored Normal file
View File

@@ -0,0 +1,51 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Check GitHub organization and invite members
"""
# pylint: disable=fixme,no-member
from argparse import ArgumentParser
import github_api
from configs import Config
def main():
"""The main entry point function"""
arg_parser = ArgumentParser()
arg_parser.add_argument("--cfg-file", metavar="PATH", default=Config.default_cfg_path,
help=f"Path to json configuration file, e.g. {Config.default_cfg_path}")
arg_parser.add_argument("--teams", action="store_true", help="Check GitHub teams")
args, unknown_args = arg_parser.parse_known_args()
Config(args.cfg_file, unknown_args)
gh_api = github_api.GithubOrgApi()
if args.teams:
gh_api.get_org_teams()
else:
dev_emails = github_api.get_dev_emails()
print(f'\nDeveloper emails {len(dev_emails)}:', '; '.join(dev_emails))
org_emails = gh_api.get_org_emails()
print(f'\nOrg emails {len(org_emails)}:', '; '.join(org_emails))
org_pendig_invitation_emails = gh_api.get_org_invitation_emails()
invite_emails = dev_emails.difference(org_emails).difference(org_pendig_invitation_emails)
print(f'\nInvite emails {len(invite_emails)}:', '; '.join(invite_emails))
no_in_dev_emails = org_emails.difference(dev_emails)
print(f'\nOrg members - no in developers list {len(no_in_dev_emails)}:',
'; '.join(no_in_dev_emails))
valid_github_users = gh_api.get_valid_github_users(invite_emails)
gh_api.invite_users(valid_github_users)
if __name__ == '__main__':
main()

149
.github/org_control/check_pr.py vendored Normal file
View File

@@ -0,0 +1,149 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Check GitHub PRs and set labels by type and categories, e.g. 'ExternalPR', 'category: ci'
"""
# pylint: disable=fixme,no-member
import re
import datetime
from argparse import ArgumentParser
from enum import Enum
import github_api
from configs import Config
class PrType(Enum):
"""Constants for type of GitHub pull request by author membership"""
EXTERNAL = 'ExternalPR'
INTEL = 'ExternalIntelPR'
ORG = 'OpenvinoPR'
BAD = 'BadPR'
def get_pr_labels(pull):
"""Gets PR labels as set"""
pr_lables = set()
for label in pull.labels:
pr_lables.add(label.name)
return pr_lables
def set_pr_labels(pull, labels):
"""Sets PR labels"""
if not labels or Config().DRY_RUN:
return
print(f'Set PR labels:', labels)
pull.set_labels(labels)
def get_pr_type_by_labels(pull):
"""Gets PR type using labels"""
pr_lables = get_pr_labels(pull)
pr_types = set(type.value for type in PrType)
pr_types_labels = pr_lables & pr_types
if not pr_types_labels:
return None
if len(pr_types_labels) > 1:
print(f'Duplicated labels: {pr_types_labels}')
return PrType.BAD
return PrType(PrType(pr_types_labels.pop()))
def get_label_by_team_name_re(team_name):
"""Generates label by PR reviwer team name using regular expressions"""
if 'admins' in team_name:
return 'category: ci'
re_compile_label = re.compile(rf'{Config().GITHUB_REPO}-(.+)-maintainers')
re_label = re_compile_label.match(team_name)
if re_label:
return f'category: {re_label.group(1).strip()}'
return None
def get_label_by_team_name_map(team_name):
"""Generates label by PR reviwer team name using config map"""
return Config().TEAM_TO_LABEL.get(team_name)
def get_category_labels(pull):
"""Gets list of category labels by all PR reviwer teams"""
labels = []
pr_lables = get_pr_labels(pull)
for reviewer_team in pull.get_review_requests()[1]:
reviewer_label = get_label_by_team_name_map(reviewer_team.name)
if reviewer_label and reviewer_label not in pr_lables:
labels.append(reviewer_label)
return labels
def main():
"""The main entry point function"""
arg_parser = ArgumentParser()
arg_parser.add_argument("--cfg-file", metavar="PATH", default=Config.default_cfg_path,
help=f"Path to json configuration file, e.g. {Config.default_cfg_path}")
arg_parser.add_argument("--pr", metavar="NUMBER",
help="Get GitHub pull request with the number")
arg_parser.add_argument("--pr-state", default="open", choices=["open", "closed"],
help="Set GitHub pull request state")
arg_parser.add_argument("--newer", metavar="MINUTES",
help="Get newly created GitHub pull request only")
args, unknown_args = arg_parser.parse_known_args()
Config(args.cfg_file, unknown_args)
gh_api = github_api.GithubOrgApi()
if args.pr:
pulls = [gh_api.repo.get_pull(int(args.pr))]
else:
pulls = gh_api.repo.get_pulls(state=args.pr_state)
print(f'\nPRs count ({args.pr_state}):', pulls.totalCount)
if args.newer:
pr_created_after = datetime.datetime.now() - datetime.timedelta(minutes=int(args.newer))
print('PRs created after:', pr_created_after)
non_org_intel_pr_users = set()
non_org_pr_users = set()
for pull in pulls:
if args.newer and pull.created_at <= pr_created_after:
print(f'\nIGNORE: {pull} - Created: {pull.created_at}')
continue
pr_lables = get_pr_labels(pull)
pr_type_by_labels = get_pr_type_by_labels(pull)
set_labels = []
print(f'\n{pull} - Created: {pull.created_at} - Labels: {pr_lables} -',
f'Type: {pr_type_by_labels}', end='')
# Checks PR source type
if gh_api.is_org_user(pull.user):
print(' - Org user')
elif github_api.is_intel_email(pull.user.email) or \
github_api.is_intel_company(pull.user.company):
print(' - Non org user with Intel email or company')
non_org_intel_pr_users.add(pull.user)
if pr_type_by_labels is not PrType.INTEL:
print(f'NO "{PrType.INTEL.value}" label: ', end='')
github_api.print_users(pull.user)
set_labels.append(PrType.INTEL.value)
else:
print(f' - Non org user with NO Intel email or company')
non_org_pr_users.add(pull.user)
if pr_type_by_labels is not PrType.EXTERNAL:
print(f'NO "{PrType.EXTERNAL.value}" label: ', end='')
github_api.print_users(pull.user)
set_labels.append(PrType.EXTERNAL.value)
set_labels += get_category_labels(pull)
set_pr_labels(pull, set_labels)
print(f'\nNon org user with Intel email or company:')
github_api.print_users(non_org_intel_pr_users)
print(f'\nNon org user with NO Intel email or company:')
github_api.print_users(non_org_pr_users)
if __name__ == '__main__':
main()

36
.github/org_control/config.json vendored Normal file
View File

@@ -0,0 +1,36 @@
{
"GITHUB_TOKEN": "<Put token here or set as arg or as env variable>",
"GITHUB_ORGANIZATION": "openvinotoolkit",
"GITHUB_REPO": "openvino",
"IGNORE_LOGINS": [
"openvino-ci",
"openvino-pushbot",
"lab-nerval",
"lab-nerval-onnx-ci"
],
"EMAILS_FILE_PATH": "dev_emails-test.txt",
"PROXIES": {
"HTTP_PROXY": null,
"HTTPS_PROXY": null,
"NO_PROXY": "localhost,127.0.0.1,.intel.com"
},
"DRY_RUN": false,
"TEAM_TO_LABEL": {
"openvino-admins": "category: CI",
"openvino-maintainers": "category: IE common",
"openvino-docs-maintainers": "category: docs",
"openvino-ie-maintainers": "category: IE common",
"openvino-ie-cpu-maintainers": "category: CPU",
"openvino-ie-gna-maintainers": "category: GNA",
"openvino-ie-gpu-maintainers": "category: GPU",
"openvino-ie-lpt-maintainers": "category: LP transformations",
"openvino-ie-multi-maintainers": "category: MULTI",
"openvino-ie-python-api-maintainers": "category: python api",
"openvino-ie-tests-maintainers": "category: IE Tests",
"openvino-ie-vpu-maintainers": "category: VPU",
"openvino-mo-maintainers": "category: MO",
"openvino-ngraph-maintainers": "category: nGraph",
"openvino-tests-maintainers": "category: IE Tests",
"openvino-tools-maintainers": "category: tools"
}
}

113
.github/org_control/configs.py vendored Normal file
View File

@@ -0,0 +1,113 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Configurations management
"""
# pylint: disable=fixme,broad-except
import os
import sys
import ast
import json
from pathlib import Path
if sys.hexversion < 0x3060000:
raise Exception('Python version must be >= 3.6')
class ConfigException(Exception):
"""Base configuration exception"""
class Config:
"""Configuration wrapper"""
_instance = None
properties = None
default_cfg_path = Path(__file__).resolve().parent / 'config.json'
def __new__(cls, *_args, **_kwargs):
if not Config._instance:
Config._instance = super(Config, cls).__new__(cls)
return Config._instance
def __init__(self, file_path=None, cli_args=None):
"""
:param file_path: Path to json configuration file
:type file_path: String
:param args: List of argparse arguments with patterns: 'name=value' or 'name'
:type args: list
"""
if Config.properties:
return
self._file_path = file_path or Config.default_cfg_path
self._cli_args = cli_args or []
self._json_cfg = {}
self._args = {}
self._load_cfg()
self._parse_cli_args()
Config.properties = {}
for name, value in self._json_cfg.items():
if hasattr(self, name):
raise ConfigException(f'Duplicating prosperity: {name}')
prosperity_value = self._args.get(name) or os.getenv(name)
if prosperity_value:
# Try to set prosperity_value as Python literal structures, e.g. DRY_RUN=False
try:
prosperity_value = ast.literal_eval(prosperity_value)
except Exception:
pass
if not isinstance(prosperity_value, type(value)):
raise ConfigException(f'Python type of {name} parameter must be {type(value)}')
else:
prosperity_value = value
setattr(self, name, prosperity_value)
Config.properties[name] = prosperity_value
self.set_proxy()
def _load_cfg(self):
"""Load the json configuration file"""
try:
with open(self._file_path) as conf:
self._json_cfg = json.load(conf)
except:
print('Failed to load configuration from:', self._file_path)
raise
def _parse_cli_args(self):
"""Parse argparse arguments with patterns: 'name=value' or 'name'"""
for cli_arg in self._cli_args:
arg = cli_arg.split('=')
if arg[0] not in self._json_cfg:
raise ConfigException(f'Unsupported argument: {arg}')
self._args[arg[0]] = True if len(arg) == 1 else '='.join(arg[1:])
def get_properties(self):
"""Get all properties as Dict"""
return self.properties
def set_proxy(self):
"""Set proxies"""
for proxy_name, url in self.properties['PROXIES'].items():
if url is not None:
print(f'Set proxy: {proxy_name}={url}')
os.environ[proxy_name] = url
def _test():
"""Test and debug"""
print('Config.default_cfg_path:', Config.default_cfg_path)
cfg = Config(cli_args=['DRY_RUN=True'])
print('Config.properties:', cfg.get_properties())
if __name__ == '__main__':
_test()

View File

@@ -0,0 +1,9 @@
# good comment
Last_name, First_name <first_name.last_name@intel.com>
first_name.last_name@intel.com
openvino_pushbot@intel.com
# Wrong emails
foo@foo.com
foo1 foo2
foo1 foo2@intel.com

287
.github/org_control/github_api.py vendored Normal file
View File

@@ -0,0 +1,287 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
GitHub API for controlling organization
"""
# pylint: disable=fixme,no-member
import re
import time
from github import Github, GithubException, RateLimitExceededException, IncompletableObject
from github import UnknownObjectException
from github.PaginatedList import PaginatedList
from configs import Config
def is_valid_user(user):
"""Checks that user is valid github.Github object"""
try:
return user and user.login
except IncompletableObject:
return False
def is_user_ignored(user):
"""Checks that user should be ignored"""
cfg = Config()
if is_valid_user(user) and user.login.lower() not in cfg.properties['IGNORE_LOGINS']:
return False
return True
def is_valid_name(name):
"""Checks that GitHub user's name is valid"""
return name and len(name) >= 3 and ' ' in name
def is_intel_email(email):
"""Checks that email is valid Intel email"""
return email and len(email) > 10 and ' ' not in email and email.lower().endswith('@intel.com')
def is_intel_company(company):
"""Checks that company contains intel"""
return company and 'intel' in company.lower()
def is_valid_intel_user(user):
"""Checks that user is valid GitHub and Intel user"""
return is_valid_user(user) and (is_valid_name(user.name) and is_intel_email(user.email) or
is_user_ignored(user))
def print_users(users):
"""Print list of users in different formats: list, set, PaginatedList"""
if isinstance(users, (list, set, PaginatedList)):
users_count = users.totalCount if isinstance(users, PaginatedList) else len(users)
print(f'\nGitHub users {users_count} (login - name - company - email - valid):')
else:
users = [users]
for user in users:
if not is_valid_user(user):
print('WRONG GitHub user: ???')
continue
valid_check = 'OK' if is_valid_intel_user(user) else 'FIX'
if not is_intel_email(user.email):
valid_check += ' email'
if not is_valid_name(user.name):
valid_check += ' name'
print(f'{user.login} - "{user.name}" - "{user.company}" - {user.email} - {valid_check}')
def get_dev_emails():
"""
Read a file with developer emails. Supported email formats
first_name.last_name@intel.com
Import from Outlook: Last_name, First_name <first_name.last_name@intel.com>
"""
re_email = re.compile(r'.+<(.+)>')
emails = set()
cfg = Config()
with open(cfg.properties['EMAILS_FILE_PATH']) as file_obj:
for line in file_obj:
line = line.strip().lower()
if not line or line.startswith('#'):
continue
re_outlook_email = re_email.match(line)
if re_outlook_email:
line = re_outlook_email.group(1).strip()
if not is_intel_email(line):
print(f'Wrong email in {cfg.properties["EMAILS_FILE_PATH"]}: {line}')
continue
emails.add(line)
return emails
class GithubOrgApi:
"""Common API for GitHub organization"""
def __init__(self):
self._cfg = Config()
self.github = Github(self._cfg.GITHUB_TOKEN)
self.github_org = self.github.get_organization(self._cfg.GITHUB_ORGANIZATION)
self.repo = self.github.get_repo(f'{self._cfg.GITHUB_ORGANIZATION}/'
f'{self._cfg.GITHUB_REPO}')
def is_org_user(self, user):
"""Checks that user is a member of GitHub organization"""
if is_valid_user(user):
try:
membership = user.get_organization_membership(self.github_org)
# membership.role can be 'member' or 'admin'
if membership.state == 'active' and membership.role:
return True
except UnknownObjectException:
pass
return False
def get_org_emails(self):
"""Gets and prints all emails of GitHub organization members"""
org_members = self.github_org.get_members()
org_emails = set()
org_members_fix = set()
org_emails_fix_name = set()
org_logins_fix_intel_email = set()
print(f'\nOrg members {org_members.totalCount} (login - name - company - email - valid):')
for org_member in org_members:
print_users(org_member)
if is_user_ignored(org_member):
continue
if is_intel_email(org_member.email):
org_emails.add(org_member.email.lower())
if not is_valid_name(org_member.name):
org_members_fix.add(org_member)
org_emails_fix_name.add(org_member.email.lower())
else:
org_members_fix.add(org_member)
org_logins_fix_intel_email.add(org_member.login.lower())
print_users(org_members_fix)
print(f'\nOrg members - no Intel emails {len(org_logins_fix_intel_email)}:',
'; '.join(org_logins_fix_intel_email))
print(f'\nOrg members - no real name {len(org_emails_fix_name)}:',
'; '.join(org_emails_fix_name))
return org_emails
def get_org_invitation_emails(self):
"""Gets GitHub organization teams prints info"""
org_invitations = self.github_org.invitations()
org_invitation_emails = set()
print(f'\nOrg invitations {org_invitations.totalCount} (login - name - email - valid):')
for org_invitation in org_invitations:
# TODO: investigate GithubException while access to user name and enable print_users()
# github.GithubException.IncompletableObject: 400 "Returned object contains no URL"
#print_users(org_invitation)
print(f'{org_invitation.login} - ??? - {org_invitation.email} - ???')
if is_user_ignored(org_invitation):
continue
if is_intel_email(org_invitation.email):
org_invitation_emails.add(org_invitation.email.lower())
else:
print('Strange org invitation:', org_invitation)
print(f'\nOrg invitation emails {len(org_invitation_emails)}:',
'; '.join(org_invitation_emails))
return org_invitation_emails
def get_org_teams(self):
"""Gets GitHub organization teams prints info"""
teams = []
org_teams = self.github_org.get_teams()
print('\nOrg teams count:', org_teams.totalCount)
for team in org_teams:
teams.append(team.name)
print(f'\nTeam: {team.name} - parent: {team.parent}')
repos = team.get_repos()
print('Repos:')
for repo in repos:
print(f' {repo.name} -', team.get_repo_permission(repo))
team_maintainers = team.get_members(role='maintainer')
team_maintainer_logins = set()
for maintainer in team_maintainers:
team_maintainer_logins.add(maintainer.login)
team_members = team.get_members(role='member')
team_member_logins = set()
for member in team_members:
team_member_logins.add(member.login)
members = team.get_members(role='all')
member_emails = []
print('Members (role - login - name - company - email - valid):')
for user in members:
if user.login in team_maintainer_logins:
print(' Maintainer - ', end='')
elif user.login in team_member_logins:
print(' Member - ', end='')
else:
# It is not possible to check child teams members
print(' ??? - ', end='')
print_users(user)
if is_intel_email(user.email) and not is_user_ignored(user):
member_emails.append(user.email.lower())
print(f'Intel emails {len(member_emails)}:', '; '.join(member_emails))
return teams
def get_valid_github_users(self, emails):
"""Gets valid GitHub users by email and prints status"""
valid_users = set()
no_account_emails = set()
print(f'\nGitHub users from {len(emails)} invite emails (email - status):')
for email in emails:
if not is_intel_email(email):
print(f'{email} - Non Intel email')
continue
# You can make up to 30 requests per minute; https://developer.github.com/v3/search/
# Sleep 2.4 sec is about 25 requests per minute
time.sleep(2.4)
try:
users = self.github.search_users(f'{email} in:email')
except RateLimitExceededException:
time.sleep(5)
users = self.github.search_users(f'{email} in:email')
if users.totalCount == 0:
print(f'{email} - No valid GitHub account')
no_account_emails.add(email)
continue
if users.totalCount > 1:
print(f'{email} - Found {users.totalCount} GitHub accounts')
for user in users:
if user.email and user.email.lower() == email:
print(f'{email} - OK')
valid_users.add(user)
else:
print(f'{email} - Non public or wrong email - login: {user.login} - '
f'email: {user.email}')
print('Valid users count:', len(valid_users))
print_users(valid_users)
print(f'\nIntel emails - No valid GitHub account {len(no_account_emails)}:',
'; '.join(no_account_emails))
return valid_users
def invite_users(self, users):
"""Invites users and prints status"""
if isinstance(users, (list, set)):
print(f'\nInvite {len(users)} users:')
else:
users = [users]
for user in users:
if isinstance(user, str):
print(f'Email: {user}')
self.github_org.invite_user(email=user)
else:
print(f'{user.login} - "{user.name}" - {user.email} - ', end='')
try:
if is_user_ignored(user):
print('Ignored')
continue
if not self._cfg.DRY_RUN:
self.github_org.invite_user(user=user)
print('OK')
else:
print('Dry run')
except GithubException as exc:
print(f'FAIL: {exc.data["errors"][0]["message"]}')
def _test():
"""Test and debug"""
Config(cli_args=['DRY_RUN=True'])
dev_emails = get_dev_emails()
print('dev_emails:', dev_emails)
gh_api = GithubOrgApi()
gh_api.get_org_emails()
if __name__ == '__main__':
_test()

1
.github/org_control/requirements.txt vendored Normal file
View File

@@ -0,0 +1 @@
PyGithub==1.51

View File

@@ -0,0 +1 @@
pylint==2.3.0

40
.github/workflows/code_style.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Code Style
on: [push, pull_request]
jobs:
nGraph:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install clang-format-3.9
run: sudo apt --assume-yes install clang-format-3.9
- name: Install dependencies
run: |
sudo apt --assume-yes install libusb-1.0-0-dev
python3 -m pip install -r ./inference-engine/ie_bridges/python/requirements.txt
- name: CMake
run: |
mkdir build
cd build
cmake ..
- name: Check code style
run: make style-check
working-directory: build
- name: Create code style diff
if: failure()
run: |
ngraph/maint/apply-code-format.sh
git diff >code_style_diff.patch
- uses: actions/upload-artifact@v2
if: failure()
with:
name: code_style_diff
path: code_style_diff.patch

View File

@@ -32,8 +32,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
# For Pylint
pip install tensorflow==1.14.0 tensorboard==1.14.0 tensorflow-estimator==1.14.0
# For UT
pip install unittest-xml-reporting==3.0.2
# MO requirements

View File

@@ -66,19 +66,18 @@ function(build_ngraph)
ngraph_set(NGRAPH_ADDRESS_SANITIZER FALSE)
endif ()
ngraph_set(NGRAPH_PYTHON_BUILD_ENABLE FALSE)
if (NOT ANDROID)
if(ENABLE_TESTS)
ngraph_set(NGRAPH_UNIT_TEST_ENABLE TRUE)
ngraph_set(NGRAPH_IE_ENABLE TRUE)
else()
ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE)
ngraph_set(NGRAPH_IE_ENABLE FALSE)
endif()
ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE)
if(ENABLE_TESTS AND NOT ANDROID)
ngraph_set(NGRAPH_UNIT_TEST_ENABLE TRUE)
ngraph_set(NGRAPH_IE_ENABLE TRUE)
else()
ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE)
ngraph_set(NGRAPH_TEST_UTIL_ENABLE FALSE)
ngraph_set(NGRAPH_IE_ENABLE FALSE)
endif()
if(NOT ANDROID)
ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE)
else()
ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE FALSE)
endif()
ngraph_set(NGRAPH_INTERPRETER_ENABLE TRUE)
@@ -98,6 +97,13 @@ function(build_ngraph)
elseif(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4308 /wd4146 /wd4703 /wd4244 /wd4819")
endif()
# Preserve the original flags for further use
set(CMAKE_ORIGINAL_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_ORIGINAL_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_ORIGINAL_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_ORIGINAL_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
set(CMAKE_ORIGINAL_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE}")
if(ENABLE_LTO)
ie_enable_lto()
@@ -111,6 +117,8 @@ function(build_ngraph)
set(NGRAPH_LIBRARIES ngraph PARENT_SCOPE)
endfunction()
add_subdirectory(openvino)
build_ngraph()
add_subdirectory(inference-engine)

View File

@@ -8,13 +8,15 @@ CODEOWNERS @openvinotoolkit/openvino-admins @openvinotoolkit/openvino-maintaine
Jenkinsfile @openvinotoolkit/openvino-admins
azure-pipelines.yml @openvinotoolkit/openvino-admins
/.github/ @openvinotoolkit/openvino-admins
/.ci/ @openvinotoolkit/openvino-admins
# QA Tests:
/tests/ @openvinotoolkit/openvino-tests-maintainers
# IE Core:
/inference-engine/ @openvinotoolkit/openvino-ie-maintainers
/inference-engine/src/transformations/ @GlebKazantaev @ichuraev
/inference-engine/ie_bridges/python @openvinotoolkit/openvino-ie-python-api-maintainers
/inference-engine/src/transformations/ @GlebKazantaev @ilyachur
/inference-engine/src/legacy_api/ @openvinotoolkit/openvino-ngraph-maintainers
/inference-engine/src/readers/ @openvinotoolkit/openvino-ngraph-maintainers
@@ -64,3 +66,7 @@ azure-pipelines.yml @openvinotoolkit/openvino-admins
# Tools
/tools/ @openvinotoolkit/openvino-tools-maintainers
# Documentation
/docs/ @openvinotoolkit/openvino-docs-maintainers
*.md @openvinotoolkit/openvino-docs-maintainers

58
CONTRIBUTING_DOCS.md Normal file
View File

@@ -0,0 +1,58 @@
# Contribute to Documentation
If you want to contribute to a project documentation and make it better, your help is very welcome.
This guide puts together the guidelines to help you figure out how you can offer your feedback and contribute to the documentation.
## Contribute in Multiple ways
There are multiple ways to help improve our documentation:
* [Log an issue](https://jira.devtools.intel.com/projects/CVS/issues): Enter an issue for the OpenVINO™ documentation component for minor issues such as typos.
* Make a suggestion: Send your documentation suggestion to the mailing list.
* Contribute via GitHub: Submit pull requests in the [GitHub](https://github.com/openvinotoolkit/openvino/tree/master/docs) documentation repository.
## Contribute via GitHub
Use the following steps to contribute in the OpenVINO™ Toolkit documentation
### Use Documentation Guidelines
The documentation for our project is written using Markdown. Use our [guidelines](./docs/documentation_guidelines.md) and best practices to write consistent, readable documentation:
* **[Authoring Guidelines](./docs/documentation_guidelines.md#authoring-guidelines)**
* **[Structure Guidelines](./docs/documentation_guidelines.md#structure-guidelines)**
* **[Formatting Guidelines](./docs/documentation_guidelines.md#structure-guidelines)**
* **[Graphics Guidelines](./docs/documentation_guidelines.md#graphics-guidelines)**
### Add New Document to the Documentation
> **NOTE**: Please check if that information can be added to existing documents instead of creating a new one.
1. Fork the [OpenVINO™ Toolkit](https://github.com/openvinotoolkit/openvino) repository.
2. Create a new branch.
3. Create a new markdown file in an appropriate folder.
> **REQUIRED**: The document title must contain a document label in a form: `{#openvino_docs_<name>}`. For example: `Deep Learning Network Intermediate Representation and Operation Sets in OpenVINO™ {#openvino_docs_MO_DG_IR_and_opsets}`.
4. Add your file to the documentation structure. Open the documentation structure file [docs/doxygen/ie_docs.xml](./docs/doxygen/ie_docs.xml) and add your file path to the appropriate section.
5. Commit changes to your branch.
6. Create a pull request.
7. Once the pull request is created, automatic checks are started. All checks must pass to continue.
8. Discuss, review, and update your contributions.
9. Get merged once the maintainer approves.
### Edit Existing Document
1. Fork the [OpenVINO™ Toolkit](https://github.com/openvinotoolkit/openvino) repository.
2. Create a new branch.
3. Edit the documentation markdown file and commit changes to the branch.
4. Create a pull request.
5. Once the pull request is created, automatic checks are started. All checks must pass to continue.
6. Discuss, review, and update your contributions.
7. Get merged once the maintainer approves.
### Delete Document from the Documentation
1. Fork the [OpenVINO™ Toolkit](https://github.com/openvinotoolkit/openvino) repository.
2. Create a new branch.
3. Remove the documentation file.
4. Remove your file from the documentation structure. Open the documentation structure file [docs/doxygen/ie_docs.xml](./docs/doxygen/ie_docs.xml) and remove all occurences of your file path.
5. Remove all references to that file from other documents or replace with links to alternatives topics (if any).
6. Commit changes to your branch.
7. Create a pull request.
8. Once the pull request is created, automatic checks are started. All checks must pass to continue.
9. Discuss, review, and update your contributions.
10. Get merged once the maintainer approves.

View File

@@ -1,16 +1,16 @@
# [OpenVINO™ Toolkit](https://01.org/openvinotoolkit) - Deep Learning Deployment Toolkit repository
[![Stable release](https://img.shields.io/badge/version-2020.3-green.svg)](https://github.com/openvinotoolkit/openvino/releases/tag/2020.3.0)
[![Stable release](https://img.shields.io/badge/version-2020.4-green.svg)](https://github.com/openvinotoolkit/openvino/releases/tag/2020.4.0)
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
This toolkit allows developers to deploy pre-trained deep learning models
through a high-level C++ Inference Engine API integrated with application logic.
This toolkit allows developers to deploy pre-trained deep learning models
through a high-level C++ Inference Engine API integrated with application logic.
This open source version includes two components: namely [Model Optimizer] and
[Inference Engine], as well as CPU, GPU and heterogeneous plugins to accelerate
deep learning inferencing on Intel® CPUs and Intel® Processor Graphics.
It supports pre-trained models from the [Open Model Zoo], along with 100+ open
source and public models in popular formats such as Caffe\*, TensorFlow\*,
MXNet\* and ONNX\*.
This open source version includes two components: namely [Model Optimizer] and
[Inference Engine], as well as CPU, GPU and heterogeneous plugins to accelerate
deep learning inferencing on Intel® CPUs and Intel® Processor Graphics.
It supports pre-trained models from the [Open Model Zoo], along with 100+ open
source and public models in popular formats such as Caffe\*, TensorFlow\*,
MXNet\* and ONNX\*.
## Repository components:
* [Inference Engine]
@@ -18,7 +18,7 @@ MXNet\* and ONNX\*.
## License
Deep Learning Deployment Toolkit is licensed under [Apache License Version 2.0](LICENSE).
By contributing to the project, you agree to the license and copyright terms therein
By contributing to the project, you agree to the license and copyright terms therein
and release your contribution under these terms.
## Documentation
@@ -30,13 +30,15 @@ and release your contribution under these terms.
* [Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html)
## How to Contribute
See [CONTRIBUTING](./CONTRIBUTING.md) for details. Thank you!
See [CONTRIBUTING](./CONTRIBUTING.md) for contribution to the code.
See [CONTRIBUTING_DOCS](./CONTRIBUTING_DOCS.md) for contribution to the documentation.
Thank you!
## Support
Please report questions, issues and suggestions using:
* The `openvino` [tag on StackOverflow]\*
* [GitHub* Issues](https://github.com/openvinotoolkit/openvino/issues)
* [GitHub* Issues](https://github.com/openvinotoolkit/openvino/issues)
* [Forum](https://software.intel.com/en-us/forums/computer-vision)
---

View File

@@ -6,13 +6,22 @@ jobs:
#vmImage: 'ubuntu-18.04'
name: LIN_VMSS_VENV_F8S_WU2
variables:
system.debug: true
WORKERS_NUMBER: 8
BUILD_TYPE: Release
BIN_DIR: ../bin/intel64/$(BUILD_TYPE)
steps:
- script: |
git clean -xdf
git reset --hard HEAD
git submodule update --init --recursive --jobs $(WORKERS_NUMBER)
displayName: 'Clone submodules'
- script: |
curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
whoami
uname -a
which python3
python3 --version
gcc --version
lsb_release
env
@@ -32,8 +41,6 @@ jobs:
unzip ninja-linux.zip
sudo cp -v ninja /usr/local/bin/
displayName: 'Install Ninja'
- script: git submodule update --init --recursive --jobs 8
displayName: 'Clone submodules'
- script: |
mkdir dldt-build
cd dldt-build
@@ -53,7 +60,7 @@ jobs:
workingDirectory: dldt-build
displayName: 'nGraph UT'
continueOnError: false
- script: $(BIN_DIR)/InferenceEngineUnitTests
- script: $(BIN_DIR)/InferenceEngineUnitTests --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'IE UT old'
continueOnError: false
@@ -77,7 +84,7 @@ jobs:
workingDirectory: dldt-build
displayName: 'IE FuncTests'
continueOnError: false
- script: $(BIN_DIR)/cpuFuncTests
- script: $(BIN_DIR)/cpuFuncTests --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'CPU FuncTests'
continueOnError: false
@@ -85,12 +92,14 @@ jobs:
workingDirectory: dldt-build
displayName: 'MklDnnBehaviorTests'
continueOnError: false
- script: git clone https://github.com/openvinotoolkit/testdata.git
displayName: 'Clone testdata'
- script: |
git clone https://github.com/openvinotoolkit/testdata.git
git clone https://github.com/google/gtest-parallel.git
displayName: 'Clone testdata & gtest-parallel'
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
$(BIN_DIR)/MklDnnFunctionalTests --gtest_filter=*smoke*:-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
python3 ../gtest-parallel/gtest-parallel $(BIN_DIR)/MklDnnFunctionalTests --workers=$(WORKERS_NUMBER) --print_test_times --dump_json_test_results=MklDnnFunctionalTests.json --gtest_filter=-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric* -- --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'MklDnnFunctionalTests'
continueOnError: false
@@ -120,16 +129,24 @@ jobs:
pool:
vmImage: 'macOS-10.15'
variables:
system.debug: true
WORKERS_NUMBER: 3
BUILD_TYPE: Release
BIN_DIR: ../bin/intel64/$(BUILD_TYPE)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: |
git clean -xdf
git reset --hard HEAD
git submodule update --init --recursive --jobs $(WORKERS_NUMBER)
displayName: 'Clone submodules'
- script: |
whoami
uname -a
which python3
python3 --version
gcc --version
xcrun --sdk macosx --show-sdk-version
env
@@ -141,8 +158,6 @@ jobs:
displayName: 'Install dependencies'
- script: brew install ninja
displayName: 'Install Ninja'
- script: git submodule update --init --recursive --jobs 8
displayName: 'Clone submodules'
- script: |
mkdir dldt-build
cd dldt-build
@@ -167,7 +182,7 @@ jobs:
workingDirectory: dldt-build
displayName: 'nGraph UT'
continueOnError: false
- script: $(BIN_DIR)/InferenceEngineUnitTests
- script: $(BIN_DIR)/InferenceEngineUnitTests --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'IE UT old'
continueOnError: false
@@ -187,7 +202,7 @@ jobs:
workingDirectory: dldt-build
displayName: 'IE FuncTests'
continueOnError: false
- script: $(BIN_DIR)/cpuFuncTests
- script: $(BIN_DIR)/cpuFuncTests --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'CPU FuncTests'
continueOnError: false
@@ -195,12 +210,14 @@ jobs:
workingDirectory: dldt-build
displayName: 'MklDnnBehaviorTests'
continueOnError: false
- script: git clone https://github.com/openvinotoolkit/testdata.git
displayName: 'Clone testdata'
- script: |
git clone https://github.com/openvinotoolkit/testdata.git
git clone https://github.com/google/gtest-parallel.git
displayName: 'Clone testdata & gtest-parallel'
- script: |
export DATA_PATH=`pwd`/../testdata
export MODELS_PATH=`pwd`/../testdata
$(BIN_DIR)/MklDnnFunctionalTests --gtest_filter=*smoke*:-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
python3 ../gtest-parallel/gtest-parallel $(BIN_DIR)/MklDnnFunctionalTests --workers=$(WORKERS_NUMBER) --print_test_times --dump_json_test_results=MklDnnFunctionalTests.json --gtest_filter=-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric* -- --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'MklDnnFunctionalTests'
continueOnError: false
@@ -216,9 +233,10 @@ jobs:
# About 150% of total time
timeoutInMinutes: 120
pool:
#vmImage: 'vs2017-win2016'
name: WIN_VMSS_VENV_F8S_WU2
variables:
system.debug: true
WORKERS_NUMBER: 8
BUILD_TYPE: Release
BUILD_DIR: D:\dldt-build
BIN_DIR: ..\bin\intel64
@@ -226,7 +244,15 @@ jobs:
MSVC_COMPILER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe
steps:
- script: |
git clean -xdf
git reset --hard HEAD
git submodule update --init --recursive --jobs $(WORKERS_NUMBER)
displayName: 'Clone submodules'
- script: |
powershell -command "Invoke-RestMethod -Headers @{\"Metadata\"=\"true\"} -Method GET -Uri http://169.254.169.254/metadata/instance/compute?api-version=2019-06-01 | format-custom"
where python3
where python
python --version
wmic computersystem get TotalPhysicalMemory
wmic cpu list
wmic logicaldisk get description,name
@@ -237,8 +263,13 @@ jobs:
certutil -urlcache -split -f https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip ninja-win.zip
powershell -command "Expand-Archive -Force ninja-win.zip"
displayName: Install Ninja
- script: git submodule update --init --recursive --jobs 8
displayName: 'Clone submodules'
- script: |
certutil -urlcache -split -f https://incredibuilddiag1wu2.blob.core.windows.net/incredibuild/IBSetupConsole_9_5_0.exe IBSetupConsole_9_5_0.exe
call IBSetupConsole_9_5_0.exe /Install /Components=Agent,oneuse /Coordinator=11.1.0.4 /AGENT:OPENFIREWALL=ON /AGENT:AUTOSELECTPORTS=ON /ADDTOPATH=ON /AGENT:INSTALLADDINS=OFF
echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent || cd .
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Xoreax\IncrediBuild\Builder /f /v LastEnabled /d 0
echo Start IncrediBuild_Agent && net start IncrediBuild_Agent
displayName: Install IncrediBuild
- script: |
rd /Q /S $(BUILD_DIR)
mkdir $(BUILD_DIR)\bin
@@ -252,7 +283,8 @@ jobs:
displayName: 'CMake'
- script: |
set PATH=$(Build.Repository.LocalPath)\ninja-win;%PATH%
call "$(MSVS_VARS_PATH)" && ninja
call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="ninja" /MaxCPUS=40
echo Stop IncrediBuild_Agent && net stop IncrediBuild_Agent || cd .
workingDirectory: $(BUILD_DIR)
displayName: 'Build Win'
- script: dir ..\bin\ /s /b
@@ -266,7 +298,7 @@ jobs:
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\InferenceEngineUnitTests
$(BIN_DIR)\InferenceEngineUnitTests --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'IE UT old'
continueOnError: false
@@ -302,7 +334,7 @@ jobs:
continueOnError: false
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;%PATH%
$(BIN_DIR)\cpuFuncTests
$(BIN_DIR)\cpuFuncTests --gtest_print_time=1
workingDirectory: dldt-build
displayName: 'CPU FuncTests'
continueOnError: false
@@ -312,14 +344,18 @@ jobs:
workingDirectory: dldt-build
displayName: 'MklDnnBehaviorTests'
continueOnError: false
- script: git clone https://github.com/openvinotoolkit/testdata.git
- script: |
git clone https://github.com/openvinotoolkit/testdata.git
git clone https://github.com/google/gtest-parallel.git
workingDirectory: $(BUILD_DIR)
displayName: 'Clone testdata'
displayName: 'Clone testdata & gtest-parallel'
# Add for gtest-parallel, it hangs now (CVS-33386)
#python $(BUILD_DIR)\gtest-parallel\gtest-parallel $(BIN_DIR)\MklDnnFunctionalTests --workers=$(WORKERS_NUMBER) --print_test_times --dump_json_test_results=MklDnnFunctionalTests.json --gtest_filter=-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric* -- --gtest_print_time=1
- script: |
set PATH=$(Build.Repository.LocalPath)\inference-engine\temp\tbb\bin;$(Build.Repository.LocalPath)\inference-engine\temp\opencv_4.3.0\opencv\bin;%PATH%
set DATA_PATH=$(BUILD_DIR)\testdata
set MODELS_PATH=$(BUILD_DIR)\testdata
$(BIN_DIR)\MklDnnFunctionalTests --gtest_filter=*smoke*:-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
$(BIN_DIR)\MklDnnFunctionalTests --gtest_print_time=1 --gtest_filter=-smoke_MobileNet/ModelTransformationsTest.LPT/mobilenet_v2_tf_depthwise_batch1_inPluginDisabled_inTestDisabled_asymmetric*
workingDirectory: dldt-build
displayName: 'MklDnnFunctionalTests'
continueOnError: false

View File

@@ -52,14 +52,15 @@ as a part of [Intel® Distribution of OpenVINO™].
## Build on Linux\* Systems
The software was validated on:
- Ubuntu\* 18.04 (64-bit) with default GCC\* 7.5.0
- Ubuntu\* 16.04 (64-bit) with default GCC\* 5.4.0
- CentOS\* 7.4 (64-bit) with default GCC\* 4.8.5
### Software Requirements
- [CMake]\* 3.11 or higher
- GCC\* 4.8 or higher to build the Inference Engine
- Python 2.7 or higher for Inference Engine Python API wrapper
- (Optional) [Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 20.13.16352].
- Python 3.5 or higher for Inference Engine Python API wrapper
- (Optional) [Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441].
### Build Steps
1. Clone submodules:
@@ -77,7 +78,7 @@ The software was validated on:
```
3. By default, the build enables the Inference Engine GPU plugin to infer models
on your Intel® Processor Graphics. This requires you to
[Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 20.13.16352]
[Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441]
before running the build. If you don't want to use the GPU plugin, use the
`-DENABLE_CLDNN=OFF` CMake build option and skip the installation of the
Intel® Graphics Compute Runtime for OpenCL™ Driver.
@@ -145,7 +146,6 @@ You can use the following additional build options:
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
## Build for Raspbian Stretch* OS
@@ -202,7 +202,7 @@ Native compilation of the Inference Engine is the most straightforward solution.
This compilation was tested on the following configuration:
* Host: Ubuntu\* 16.04 (64-bit, Intel® Core™ i7-6700K CPU @ 4.00GHz × 8)
* Host: Ubuntu\* 18.04 (64-bit, Intel® Core™ i7-6700K CPU @ 4.00GHz × 8)
* Target: Raspbian\* Stretch (32-bit, ARMv7, Raspberry Pi\* 3)
1. Install Docker\*:
@@ -242,7 +242,9 @@ with the following content:
libgstreamer1.0-dev:armhf \
libgstreamer-plugins-base1.0-dev:armhf \
libpython3-dev:armhf \
python3-pip
python3-pip \
python-minimal \
python-argparse
RUN wget https://www.cmake.org/files/v3.14/cmake-3.14.3.tar.gz && \
tar xf cmake-3.14.3.tar.gz && \
@@ -324,7 +326,6 @@ You can use the following additional build options:
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
## Build on Windows* Systems
@@ -337,7 +338,7 @@ The software was validated on:
- [CMake]\*3.11 or higher
- Microsoft\* Visual Studio 2017, 2019 or [Intel® C++ Compiler] 18.0
- (Optional) Intel® Graphics Driver for Windows* (26.20) [driver package].
- Python 3.4 or higher for Inference Engine Python API wrapper
- Python 3.5 or higher for Inference Engine Python API wrapper
### Build Steps
@@ -427,7 +428,6 @@ cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 18.0" ^
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
### Building Inference Engine with Ninja* Build System
@@ -454,7 +454,7 @@ The software was validated on:
- [CMake]\* 3.11 or higher
- Clang\* compiler from Xcode\* 10.1 or higher
- Python\* 3.4 or higher for the Inference Engine Python API wrapper
- Python\* 3.5 or higher for the Inference Engine Python API wrapper
### Build Steps
@@ -519,7 +519,6 @@ You can use the following additional build options:
- nGraph-specific compilation options:
`-DNGRAPH_ONNX_IMPORT_ENABLE=ON` enables the building of the nGraph ONNX importer.
`-DNGRAPH_JSON_ENABLE=ON` enables nGraph JSON-based serialization.
`-DNGRAPH_DEBUG_ENABLE=ON` enables additional debug prints.
## Build on Android* Systems
@@ -574,8 +573,7 @@ This section describes how to build Inference Engine for Android x86 (64-bit) op
## Use Custom OpenCV Builds for Inference Engine
> **NOTE**: The recommended and tested version of OpenCV is 4.3. The minimum
supported version is 3.4.0.
> **NOTE**: The recommended and tested version of OpenCV is 4.4.0.
Required versions of OpenCV packages are downloaded automatically during the
building Inference Engine library. If the build script can not find and download
@@ -691,7 +689,7 @@ This target collects all dependencies, prepares the nGraph package and copies it
[Intel® Distribution of OpenVINO™]:https://software.intel.com/en-us/openvino-toolkit
[CMake]:https://cmake.org/download/
[Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 20.13.16352]:https://github.com/intel/compute-runtime/releases/tag/20.13.16352
[Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441]:https://github.com/intel/compute-runtime/releases/tag/19.41.14441
[MKL-DNN repository]:https://github.com/intel/mkl-dnn/releases/download/v0.19/mklml_lnx_2019.0.5.20190502.tgz
[MKL-DNN repository for Windows]:(https://github.com/intel/mkl-dnn/releases/download/v0.19/mklml_win_2019.0.5.20190502.zip)
[OpenBLAS]:https://sourceforge.net/projects/openblas/files/v0.2.14/OpenBLAS-v0.2.14-Win64-int64.zip/download

View File

@@ -122,9 +122,9 @@ include(debug)
include(whole_archive)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH_FOLDER)
if(ARCH_FOLDER STREQUAL "x86_64" OR ARCH_FOLDER STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
if(X86_64)
set(ARCH_FOLDER intel64)
elseif(ARCH_FOLDER STREQUAL "i386")
elseif(X86)
set(ARCH_FOLDER ia32)
endif()

View File

@@ -28,6 +28,8 @@ ie_option (OS_FOLDER "create OS dedicated folder in output" OFF)
# FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow
ie_dependent_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "X86 OR X86_64" OFF)
ie_option (ENABLE_INTEGRITYCHECK "build DLLs with /INTEGRITYCHECK flag" OFF)
ie_option (ENABLE_SANITIZER "enable checking memory errors via AddressSanitizer" OFF)
ie_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitizer" OFF)
@@ -41,3 +43,5 @@ ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR X8
ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR X86" OFF)
ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR X86" OFF)
ie_dependent_option (ENABLE_PROFILING_ITT "ITT tracing of IE and plugins internals" ON "NOT CMAKE_CROSSCOMPILING" OFF)

View File

@@ -238,16 +238,17 @@ if(WIN32)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# 161 unrecognized pragma
# 177 variable was declared but never referenced
# 556 not matched type of assigned function pointer
# 161: unrecognized pragma
# 177: variable was declared but never referenced
# 556: not matched type of assigned function pointer
# 1744: field of class type without a DLL interface used in a class with a DLL interface
# 2586 decorated name length exceeded, name was truncated
# 1879: unimplemented pragma ignored
# 2586: decorated name length exceeded, name was truncated
# 2651: attribute does not apply to any entity
# 3180 unrecognized OpenMP pragma
# 3180: unrecognized OpenMP pragma
# 11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
# 15335 was not vectorized: vectorization possible but seems inefficient. Use vector always directive or /Qvec-threshold0 to override
ie_add_compiler_flags(/Qdiag-disable:161,177,556,1744,2586,2651,3180,11075,15335)
# 15335: was not vectorized: vectorization possible but seems inefficient. Use vector always directive or /Qvec-threshold0 to override
ie_add_compiler_flags(/Qdiag-disable:161,177,556,1744,1879,2586,2651,3180,11075,15335)
endif()
# Debug information flags
@@ -264,6 +265,7 @@ else()
ie_add_compiler_flags(-ffunction-sections -fdata-sections)
ie_add_compiler_flags(-fdiagnostics-show-option)
ie_add_compiler_flags(-Wundef)
ie_add_compiler_flags(-Wreturn-type)
# Disable noisy warnings

View File

@@ -15,7 +15,9 @@ if (ENABLE_SANITIZER)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=gold")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" AND NOT WIN32)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
endif()
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_COMPILER_FLAGS}")
@@ -27,8 +29,14 @@ endif()
if (ENABLE_THREAD_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "-g -fsanitize=thread -fno-omit-frame-pointer")
set(SANITIZER_LINKER_FLAGS "-fsanitize=thread -static-libsan")
set(SANITIZER_LINKER_FLAGS "-fsanitize=thread")
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
else()
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -static-libsan")
endif()
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_COMPILER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_LINKER_FLAGS}")

View File

@@ -14,9 +14,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
else()
@@ -32,14 +30,21 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all")
endif()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -z noexecstack -z relro -z now")
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl")
endif()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /guard:cf")
if(ENABLE_INTEGRITYCHECK)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl /guard:cf")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IE_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IE_C_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
endif()

View File

@@ -30,6 +30,13 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
set(AARCH64 ON)
endif()
# in case of cross-compilation (or -m32) CMAKE_SYSTEM_PROCESSOR is equal to
# CMAKE_HOST_SYSTEM_PROCESSOR which is X86_64; patch this until a better solution
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND X86_64)
unset(X86_64)
set(X86 ON)
endif()
if(UNIX AND NOT APPLE)
set(LINUX ON)
endif()

View File

@@ -0,0 +1,212 @@
# Custom Layers Guide {#openvino_docs_HOWTO_Custom_Layers_Guide}
The Intel® Distribution of OpenVINO™ toolkit supports neural network model layers in multiple frameworks including TensorFlow*, Caffe*, MXNet*, Kaldi* and ONYX*. The list of known layers is different for each of the supported frameworks. To see the layers supported by your framework, refer to [supported frameworks](../MO_DG/prepare_model/Supported_Frameworks_Layers.md).
Custom layers are layers that are not included in the list of known layers. If your topology contains any layers that are not in the list of known layers, the Model Optimizer classifies them as custom.
This guide illustrates the workflow for running inference on topologies featuring custom layers, allowing you to plug in your own implementation for existing or completely new layers.
For a step-by-step example of creating and executing a custom layer, see the [Custom Layer Implementation Tutorials for Linux and Windows.](https://github.com/david-drew/OpenVINO-Custom-Layers/tree/master/2019.r2.0)
## Terms used in this guide
- *Layer* — The abstract concept of a math function that is selected for a specific purpose (relu, sigmoid, tanh, convolutional). This is one of a sequential series of building blocks within the neural network.
- *Kernel* — The implementation of a layer function, in this case, the math programmed (in C++ and Python) to perform the layer operation for target hardware (CPU or GPU).
- *Intermediate Representation (IR)* — Neural Network used only by the Inference Engine in OpenVINO abstracting the different frameworks and describing topology, layer parameters and weights.
The original format will be a supported framework such as TensorFlow, Caffe, or MXNet.
- *Model Extension Generator* — Generates template source code files for each of the extensions needed by the Model Optimizer and the Inference Engine.
- *Inference Engine Extension* — Device-specific module implementing custom layers (a set of kernels).
## Custom Layer Overview
The [Model Optimizer](https://docs.openvinotoolkit.org/2019_R1.1/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) searches the list of known layers for each layer contained in the input model topology before building the model's internal representation, optimizing the model, and producing the Intermediate Representation files.
The [Inference Engine](https://docs.openvinotoolkit.org/2019_R1.1/_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html) loads the layers from the input model IR files into the specified device plugin, which will search a list of known layer implementations for the device. If your topology contains layers that are not in the list of known layers for the device, the Inference Engine considers the layer to be unsupported and reports an error. To see the layers that are supported by each device plugin for the Inference Engine, refer to the [Supported Devices](https://docs.openvinotoolkit.org/2019_R1.1/_docs_IE_DG_supported_plugins_Supported_Devices.html) documentation.
<br>
**Note:** If a device doesn't support a particular layer, an alternative to creating a new custom layer is to target an additional device using the HETERO plugin. The [Heterogeneous Plugin](https://docs.openvinotoolkit.org/2019_R1.1/_docs_IE_DG_supported_plugins_HETERO.html) may be used to run an inference model on multiple devices allowing the unsupported layers on one device to "fallback" to run on another device (e.g., CPU) that does support those layers.
## Custom Layer Implementation Workflow
When implementing a custom layer for your pre-trained model in the Intel® Distribution of OpenVINO™ toolkit, you will need to add extensions to both the Model Optimizer and the Inference Engine.
## Custom Layer Extensions for the Model Optimizer
The following figure shows the basic processing steps for the Model Optimizer highlighting the two necessary custom layer extensions, the Custom Layer Extractor and the Custom Layer Operation.
![](img/MO_extensions_flow.png)
The Model Optimizer first extracts information from the input model which includes the topology of the model layers along with parameters, input and output format, etc., for each layer. The model is then optimized from the various known characteristics of the layers, interconnects, and data flow which partly comes from the layer operation providing details including the shape of the output for each layer. Finally, the optimized model is output to the model IR files needed by the Inference Engine to run the model.
The Model Optimizer starts with a library of known extractors and operations for each [supported model framework](https://docs.openvinotoolkit.org/2019_R1.1/_docs_MO_DG_prepare_model_Supported_Frameworks_Layers.html) which must be extended to use each unknown custom layer. The custom layer extensions needed by the Model Optimizer are:
- Custom Layer Extractor
- Responsible for identifying the custom layer operation and extracting the parameters for each instance of the custom layer. The layer parameters are stored per instance and used by the layer operation before finally appearing in the output IR. Typically the input layer parameters are unchanged, which is the case covered by this tutorial.
- Custom Layer Operation
- Responsible for specifying the attributes that are supported by the custom layer and computing the output shape for each instance of the custom layer from its parameters. <br> The `--mo-op` command-line argument shown in the examples below generates a custom layer operation for the Model Optimizer.
## Custom Layer Extensions for the Inference Engine
The following figure shows the basic flow for the Inference Engine highlighting two custom layer extensions for the CPU and GPU Plugins, the Custom Layer CPU extension and the Custom Layer GPU Extension.
![](img/IE_extensions_flow.png)
Each device plugin includes a library of optimized implementations to execute known layer operations which must be extended to execute a custom layer. The custom layer extension is implemented according to the target device:
- Custom Layer CPU Extension
- A compiled shared library (.so or .dll binary) needed by the CPU Plugin for executing the custom layer on the CPU.
- Custom Layer GPU Extension
- OpenCL source code (.cl) for the custom layer kernel that will be compiled to execute on the GPU along with a layer description file (.xml) needed by the GPU Plugin for the custom layer kernel.
## Model Extension Generator
Using answers to interactive questions or a *.json* configuration file, the Model Extension Generator tool generates template source code files for each of the extensions needed by the Model Optimizer and the Inference Engine. To complete the implementation of each extension, the template functions may need to be edited to fill-in details specific to the custom layer or the actual custom layer functionality itself.
### Command-line
The Model Extension Generator is included in the Intel® Distribution of OpenVINO™ toolkit installation and is run using the command (here with the "--help" option):
```bash
python3 /opt/intel/openvino/deployment_tools/tools/extension_generator/extgen.py new --help
```
where the output will appear similar to:
```
usage: You can use any combination of the following arguments:
Arguments to configure extension generation in the interactive mode:
optional arguments:
-h, --help show this help message and exit
--mo-caffe-ext generate a Model Optimizer Caffe* extractor
--mo-mxnet-ext generate a Model Optimizer MXNet* extractor
--mo-tf-ext generate a Model Optimizer TensorFlow* extractor
--mo-op generate a Model Optimizer operation
--ie-cpu-ext generate an Inference Engine CPU extension
--ie-gpu-ext generate an Inference Engine GPU extension
--output_dir OUTPUT_DIR
set an output directory. If not specified, the current
directory is used by default.
```
The available command-line arguments are used to specify which extension(s) to generate templates for the Model Optimizer or Inference Engine. The generated extension files for each argument will appear starting from the top of the output directory as follows:
Command-line Argument | Output Directory Location |
--------------------- | ------------------------------ |
`--mo-caffe-ext` | user_mo_extensions/front/caffe |
`--mo-mxnet-ext` | user_mo_extensions/front/mxnet |
`--mo-tf-ext` | user_mo_extensions/front/tf |
`--mo-op` | user_mo_extensions/ops |
`--ie-cpu-ext` | user_ie_extensions/cpu |
`--ie-gpu-ext` | user_ie_extensions/gpu |
### Extension Workflow
The workflow for each generated extension follows the same basic steps:
![](img/MEG_generic_flow.png)
**Step 1: Generate:** Use the Model Extension Generator to generate the Custom Layer Template Files.
**Step 2: Edit:** Edit the Custom Layer Template Files as necessary to create the specialized Custom Layer Extension Source Code.
**Step 3: Specify:** Specify the custom layer extension locations to be used by the Model Optimizer or Inference Engine.
## Caffe\* Models with Custom Layers <a name="caffe-models-with-custom-layers"></a>
If your Caffe\* model has custom layers:
**Register the custom layers as extensions to the Model Optimizer**. For instructions, see [Extending Model Optimizer with New Primitives](../MO_DG/prepare_model/customize_model_optimizer/Extending_Model_Optimizer_with_New_Primitives.md). When your custom layers are registered as extensions, the Model Optimizer generates a valid and optimized Intermediate Representation. You will need a bit of Python\* code that lets the Model Optimizer;
- Generate a valid Intermediate Representation according to the rules you specified.
- Be independent from the availability of Caffe on your computer.
If your model contains Custom Layers, it is important to understand the internal workflow of the Model Optimizer. Consider the following example.
**Example**:
The network has:
* One input layer (#1)
* One output Layer (#5)
* Three internal layers (#2, 3, 4)
The custom and standard layer types are:
* Layers #2 and #5 are implemented as Model Optimizer extensions.
* Layers #1 and #4 are supported in Model Optimizer out-of-the box.
* Layer #3 is neither in the list of supported layers nor in extensions, but is specified in CustomLayersMapping.xml.
> **NOTE**: If any of the layers are not in one of three categories described above, the Model Optimizer fails with an appropriate message and a link to the corresponding question in [Model Optimizer FAQ](../MO_DG/prepare_model/Model_Optimizer_FAQ.md).
The general process is as shown:
![Example custom layer network](img/mo_caffe_priorities.png)
<br>
**Step 1:** The example model is fed to the Model Optimizer that **loads the model** with the special parser built on top of the `caffe.proto` file. In case of failure, the Model Optimizer asks you to prepare the parser that can read the model. For more information, refer to the Model Optimizer, <a href="MO_FAQ.html#FAQ1">FAQ #1</a>.
**Step 2:** The Model Optimizer **extracts the attributes of all layers** by going through the list of layers and attempting to find the appropriate extractor. In order of priority, the Model Optimizer checks if the layer is:
* A. Registered as a Model Optimizer extension
* B. Registered as a standard Model Optimizer layer
When the Model Optimizer finds a satisfying condition from the list above, it extracts the attributes according to the following rules:
* For A. - takes only the parameters specified in the extension
* For B. - takes only the parameters specified in the standard extractor
<br>
**Step 3:** The Model Optimizer **calculates the output shape of all layers**. The logic is the same as it is for the priorities. **Important:** the Model Optimizer always takes the first available option.
**Step 4:** The Model Optimizer **optimizes the original model and produces the two Intermediate Representation (IR) files in .xml and .bin**.
<br>
## TensorFlow\* Models with Custom Layers <a name="Tensorflow-models-with-custom-layers"></a>
You have two options for TensorFlow\* models with custom layers:
<br>
* **Register those layers as extensions to the Model Optimizer.** In this case, the Model Optimizer generates a valid and optimized Intermediate Representation.
* **If you have sub-graphs that should not be expressed with the analogous sub-graph in the Intermediate Representation, but another sub-graph should appear in the model, the Model Optimizer provides such an option.** This feature is helpful for many TensorFlow models. To read more, see [Sub-graph Replacement in the Model Optimizer](../MO_DG/prepare_model/customize_model_optimizer/Subgraph_Replacement_Model_Optimizer.md).
## MXNet\* Models with Custom Layers <a name="mxnet-models-with-custom-layers"></a>
There are two options to convert your MXNet* model that contains custom layers:
1. Register the custom layers as extensions to the Model Optimizer. For instructions, see [Extending MXNet Model Optimizer with New Primitives](../MO_DG/prepare_model/customize_model_optimizer/Extending_MXNet_Model_Optimizer_with_New_Primitives.md). When your custom layers are registered as extensions, the Model Optimizer generates a valid and optimized Intermediate Representation. You can create Model Optimizer extensions for both MXNet layers with op `Custom` and layers which are not standard MXNet layers.
2. If you have sub-graphs that should not be expressed with the analogous sub-graph in the Intermediate Representation, but another sub-graph should appear in the model, the Model Optimizer provides such an option. In MXNet the function is actively used for ssd models provides an opportunity to for the necessary subgraph sequences and replace them. To read more, see [Sub-graph Replacement in the Model Optimizer](../MO_DG/prepare_model/customize_model_optimizer/Subgraph_Replacement_Model_Optimizer.md).
## Kaldi\* Models with Custom Layers <a name="Kaldi-models-with-custom-layers"></a>
For information on converting your Kaldi* model containing custom layers see [Converting a Kaldi Model in the Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Kaldi.html).
## ONNX\* Models with Custom Layers <a name="ONNX-models-with-custom-layers"></a>
For information on converting your ONNX* model containing custom layers see [Converting an ONNX Model in the Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_ONNX.html).
## Step-by-Step Custom Layers Tutorial
For a step-by-step walk-through creating and executing a custom layer, see [Custom Layer Implementation Tutorial for Linux and Windows.](https://github.com/david-drew/OpenVINO-Custom-Layers/tree/master/2019.r2.0)
## Additional Resources
- Intel® Distribution of OpenVINO™ toolkit home page: [https://software.intel.com/en-us/openvino-toolkit](https://software.intel.com/en-us/openvino-toolkit)
- OpenVINO™ toolkit online documentation: [https://docs.openvinotoolkit.org](https://docs.openvinotoolkit.org)
- [Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html)
- [Kernel Extensivility in the Inference Engine Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Integrate_your_kernels_into_IE.html)
- [Inference Engine Samples Overview](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Samples_Overview.html)
- [Overview of OpenVINO™ Toolkit Pre-Trained Models](https://docs.openvinotoolkit.org/latest/_intel_models_index.html)
- [Inference Engine Tutorials](https://github.com/intel-iot-devkit/inference-tutorials-generic)
- For IoT Libraries and Code Samples see the [Intel® IoT Developer Kit](https://github.com/intel-iot-devkit).
## Converting Models:
- [Convert Your Caffe* Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_Caffe.md)
- [Convert Your TensorFlow* Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_TensorFlow.md)
- [Convert Your MXNet* Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_MxNet.md)
- [Convert Your ONNX* Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_ONNX.md)

View File

@@ -0,0 +1,83 @@
# Regression tests howto {#openvino_docs_HOWTO_add_regression_test_vpu}
## Purpose
This document contains instructions for correctly modifying a set of regression tests.
## Common
Regression tests for Myriad and HDDL plugins are on the path:
`inference-engine/tests/functional/vpu/regression_tests/`
The tests are divided into 4 groups:
* Classification
* Detection
* Raw-results
* Compilation
* VPU hetero
Testing framework [Google Test](https://github.com/google/googletest/).
Each group contains [parameterized](https://github.com/google/googletest/blob/master/googletest/docs/advanced.md) tests. The main idea is that to add a new test, you only need to add a new parameter. Except for scenarios different from the generalized case.
## Classsification and Detection tests
These groups contains two cases:
* For generalized scenario (` VpuNoClassificationRegression, VpuNoDetectionRegression`)
* For specific scenario (` VpuNoClassificationRegressionSpecific, VpuNoDetectionRegressionSpecific`)
### Generalized scenario
If You want test new parameter(batch, precision, model and etc.) then You need to edit the existing initialization of parameterized tests or create a new one.
Example of initialization of parameterized tests:
``` c++
INSTANTIATE_TEST_CASE_P(
VPURegTestWithResources_nightly,
VpuNoClassificationRegression,
Combine(ValuesIn(VpuTestParamsContainer::testingPlugin()),
Values(Precision::FP16),
Values(1), // batches
Values(true), //IsHwAdaptiveMode
Values(false), //DoReshape
Values(3, 5, 7), //Resources
Values(false), //IsIgnoreStatistic
Values(ClassificationSrcParam{ModelName::GoogleNetV1, SourceImages::kCat3, 0.01, Regression::EMean::eValues})),
VpuNoClassificationRegression::getTestCaseName);
```
### Specific scenario
If You need a test to perform some actions that are not provided in the generalized scenario, then add a specific test case. As with the generalized scenario You can change parameters for these tests.
Example of specific test case:
``` c++
TEST_P(VpuNoClassificationRegressionSpecific, onAlexNetWithNetworkConfig) {
DISABLE_ON_WINDOWS_IF(HDDL_PLUGIN);
DISABLE_IF(do_reshape_);
if (!hw_adaptive_mode_) {
config_[VPU_CONFIG_KEY(NETWORK_CONFIG)] = "data=data,scale=1";
}
assertThat().classificationResultsForInferRequestAPI()
.on(SourceImages::kDog2)
.withInputPrecision(in_precision_)
.times(batch_)
.withBatch(batch_)
.onModel(ModelName::AlexNet)
.setMean(Regression::EMean::eImage)
.onFP16()
.withTopK(1)
.withPluginConfig(config_)
.equalToReferenceWithDelta(0.04);
}
```
## Raw-results tests
There is no generalized scenario and recommendations are the same as for specific test cases for Classification/Detection groups.
## Compilation tests
The tests are in the `vpu_classification_regression.cpp` file and contains only one scenario ` VpuNoRegressionWithCompilation `. To add a new test just update parameters just as in generalized scenarion of Classification/Detection test groups.

View File

@@ -0,0 +1,94 @@
# Fuzzing howto {#openvino_docs_HOWTO_fuzzing_HOWTO}
## Intended Audience
This document is for a developer who wants to contribute fuzz tests.
## Purpose
This document walks you through creating your first fuzzer, running it and evaluating its quality.
## Prerequisites
- Linux OS or Mac OS.
- [American Fuzzy Loop](http://lcamtuf.coredump.cx/afl/) if building with GCC.
## Steps
1. Create a fuzz test in the existing project at `./tests/fuzz`. Fuzz test must
follow `<test name>-fuzzer.cc` naming scheme and implement a
`LLVMFuzzerTestOneInput` entry point.
``` bash
cat << EOF > ./tests/fuzz/test_name-fuzzer.cc
#include <stdint.h>
#include <cstdlib>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// put your fuzzing code here and use data+size as input.
return 0; // always return 0
}
EOF
```
2. Implement test logic under `LLVMFuzzerTestOneInput`.
See example fuzz test at `tests/fuzz/read_network-fuzzer.cc`.
3. Build fuzz tests with `-DENABLE_FUZZING=ON` flag for cmake.
``` bash
mkdir -p build && \
(cd build && \
CXX=afl-g++ CC=afl-gcc cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_FUZZING=ON -DENABLE_TESTS=ON .. && \
make fuzz --jobs=$(getconf _NPROCESSORS_ONLN))
```
4. Prepare sample inputs for your fuzz test to teach fuzzer engine on input
structure
``` bash
(cd bin/intel64/Debug && \
mkdir test_name-corpus && \
echo sample input > test_name-corpus/in1.txt)
```
5. Evaluate fuzz test with `afl-fuzz` fuzzing engine
Run fuzz test:
``` bash
(cd bin/intel64/Debug && \
afl-fuzz -i test_name-corpus -o test_name-out -- ./test_name-fuzzer @@
```
While fuzz test is running it prints out statistics. Besides just crashes `uniq
crashes` and hangs `uniq hangs` you should care about fuzz test quality:
- Fuzz test should be fast - speed of execution `exec speed` should be at least
100 exec/s. Speed less than 20 exec/s is not acceptable.
- Fuzz test should be able to explore new code paths `map coverage` and
`findings in depth`. Confirm it is increasing while fuzz test is running.
6. Reproduce fuzz test findings
All issues found by fuzz test are stored as a file in output folder specified
earlier via `-o` afl-fuzz option. To reproduce an issue run fuzz test executable
with an issue file as an argument.
## Summary
We have created a simple fuzz test, run it and asses its results.
## Extension
Try run parallel fuzzing with the help of
[afl-utils](https://gitlab.com/rc0r/afl-utils).
## Tips or FAQs
GCC 7 in Ubuntu 18.04 LTS has a
[defect](https://bugs.launchpad.net/ubuntu/+source/afl/+bug/1774816). Upgrade
GCC 7 for AFL to work. GCC version `Ubuntu 7.3.0-27ubuntu1~18.04` works OK.

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c2f362a39ae6c2af080e4f055b6fdba4954f918f85731545d1df3d687d9213d5
size 421056

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb5c700d003936779455353bfa4ed9432410c0975c46e2dfd30c6a1abccd1727
size 23320

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99d6b5146be85fa408dc5432883c3e2745cffe890133854a97dcf22f5c5962d4
size 47564

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a4de6e502cae7542f1f311bcdbea6bb145f960f0d27d86a03160d1a60133778
size 301310

679
docs/IE_DG/API_Changes.md Normal file
View File

@@ -0,0 +1,679 @@
# Inference Engine API Changes History {#openvino_docs_IE_DG_API_Changes}
The sections below contain detailed list of changes made to the Inference Engine API in recent releases.
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.
Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.
## 2021.1
### Deprecated API
**Utility functions to convert Unicode paths**
* InferenceEngine::stringToFileName - use OS-specific native conversion functions
* InferenceEngine::fileNameToString - use OS-specific native conversion functions
### Removed API
**Plugin API:**
* InferenceEngine::InferencePlugin C++ plugin wrapper class
* InferenceEngine::IInferencePlugin plugin interface
* InferenceEngine::PluginDispatcher class
* InferenceEngine::InferenceEnginePluginPtr typedef
* InferenceEngine::ICNNNetReader reader interface
* InferenceEngine::CNNNetReader class
**Extensibility API:**
* InferenceEngine::ILayerImplFactory class
* InferenceEngine::IShapeInferImpl class
* InferenceEngine::IShapeInferExtension class
* InferenceEngine::IExtension::getFactoryFor(ILayerImplFactory\*& factory, const CNNLayer\* cnnLayer, ResponseDesc\* resp) noexcept method
* InferenceEngine::IExtension::getPrimitiveTypes(char\*\*& types, unsigned int& size, ResponseDesc\* resp) noexcept method
* InferenceEngine::ShapeInferImpl class
* InferenceEngine::Extension::getFactoryFor(ILayerImplFactory\*& factory, const CNNLayer\* cnnLayer, ResponseDesc\* resp) noexcept method
* InferenceEngine::Extension::getPrimitiveTypes(char\*\*& types, unsigned int& size, ResponseDesc\* resp) noexcept method
**Network API:**
* InferenceEngine::details::CNNNetworkIterator class
* InferenceEngine::CNNNetwork::getPrecision() const method
* InferenceEngine::CNNNetwork::getLayerByName(const char\* layerName) const method
* InferenceEngine::CNNNetwork::size() const method
* InferenceEngine::CNNNetwork::begin() const method
* InferenceEngine::CNNNetwork::end() const method
* InferenceEngine::CNNNetwork::AddExtension(const IShapeInferExtensionPtr& extension) method
* InferenceEngine::ICNNNetwork::getPrecision() const noexcept method
* InferenceEngine::ICNNNetwork::getName(char\* pName, size_t len) const noexcept method
* InferenceEngine::ICNNNetwork::getData(const char\* dname) noexcept method
* InferenceEngine::ICNNNetwork::addLayer(const CNNLayerPtr& layer) noexcept method
* InferenceEngine::ICNNNetwork::getLayerByName(const char\* layerName, CNNLayerPtr& out, ResponseDesc\* resp) const noexcept method
* InferenceEngine::ICNNNetwork::AddExtension(const IShapeInferExtensionPtr& extension, ResponseDesc\* resp) noexcept method
* InferenceEngine::ICNNNetwork::getStats(ICNNNetworkStats\*\* stats, ResponseDesc\* resp) const noexcept method
* InferenceEngine::ICNNNetworkStats class
* InferenceEngine::NetworkNodeStats class
* InferenceEngine::Data::getCreatorLayer() method
* InferenceEngine::Data::getInputTo() method
* InferenceEngine::LayerParams class
**Layer API:**
* InferenceEngine::CNNLayer class
* InferenceEngine::WeightableLayer class
* InferenceEngine::BatchNormalizationLayer class
* InferenceEngine::BatchToSpaceLayer class
* InferenceEngine::BinaryConvolutionLayer class
* InferenceEngine::BroadcastLayer class
* InferenceEngine::BucketizeLayer class
* InferenceEngine::ClampLayer class
* InferenceEngine::ConcatLayer class
* InferenceEngine::ConvolutionLayer class
* InferenceEngine::CropLayer class
* InferenceEngine::DeconvolutionLayer class
* InferenceEngine::DeformableConvolutionLayer class
* InferenceEngine::DepthToSpaceLayer class
* InferenceEngine::EltwiseLayer class
* InferenceEngine::ExperimentalDetectronPriorGridGenerator class
* InferenceEngine::ExperimentalDetectronPriorGridGeneratorLayer class
* InferenceEngine::ExperimentalSparseWeightedReduceLayer class
* InferenceEngine::FillLayer class
* InferenceEngine::FullyConnectedLayer class
* InferenceEngine::GRNLayer class
* InferenceEngine::GRUCell class
* InferenceEngine::GatherLayer class
* InferenceEngine::GemmLayer class
* InferenceEngine::LSTMCell class
* InferenceEngine::MVNLayer class
* InferenceEngine::MathLayer class
* InferenceEngine::NonMaxSuppression class
* InferenceEngine::NormLayer class
* InferenceEngine::OneHotLayer class
* InferenceEngine::PReLULayer class
* InferenceEngine::PadLayer class
* InferenceEngine::PoolingLayer class
* InferenceEngine::PowerLayer class
* InferenceEngine::QuantizeLayer class
* InferenceEngine::RNNCell class
* InferenceEngine::RNNCellBase class
* InferenceEngine::RNNSequenceLayer class
* InferenceEngine::RangeLayer class
* InferenceEngine::ReLU6Layer class
* InferenceEngine::ReLULayer class
* InferenceEngine::ReduceLayer class
* InferenceEngine::ReshapeLayer class
* InferenceEngine::ReverseSequenceLayer class
* InferenceEngine::ScaleShiftLayer class
* InferenceEngine::ScatterLayer class
* InferenceEngine::SelectLayer class
* InferenceEngine::ShuffleChannelsLayer class
* InferenceEngine::SoftMaxLayer class
* InferenceEngine::SpaceToBatchLayer class
* InferenceEngine::SpaceToDepthLayer class
* InferenceEngine::SparseFillEmptyRowsLayer class
* InferenceEngine::SparseSegmentReduceLayer class
* InferenceEngine::SparseToDenseLayer class
* InferenceEngine::SplitLayer class
* InferenceEngine::StridedSliceLayer class
* InferenceEngine::TensorIterator class
* InferenceEngine::TileLayer class
* InferenceEngine::TopKLayer class
* InferenceEngine::UniqueLayer class
## 2020.4
### New API
**CPU Plugin API:**
* InferenceEngine::PluginConfigParams::KEY_ENFORCE_BF16 config key
**Metrics and values for Query API:**
* METRIC_KEY(OPTIMIZATION_CAPABILITIES)
* METRIC_VALUE(BF16)
### Deprecated API
**Myriad Plugin API:**
* VPU_CONFIG_KEY(IGNORE_IR_STATISTIC)
### Removed API
**Inference Engine NN Builder API:**
* InferenceEngine::Builder::EltwiseLayer
* InferenceEngine::Builder::MemoryLayer
* InferenceEngine::Builder::ROIPoolingLayer
* InferenceEngine::Builder::DeconvolutionLayer
* InferenceEngine::Builder::ReLULayer
* InferenceEngine::Builder::TanHLayer
* InferenceEngine::Builder::InputLayer
* InferenceEngine::Builder::PoolingLayer
* InferenceEngine::Builder::CropLayer
* InferenceEngine::Builder::GRUSequenceLayer
* InferenceEngine::Builder::NormLayer
* InferenceEngine::Builder::LSTMSequenceLayer
* InferenceEngine::Builder::ClampLayer
* InferenceEngine::Builder::PSROIPoolingLayer
* InferenceEngine::Builder::Layer
* InferenceEngine::Builder::RNNSequenceLayer
* InferenceEngine::Builder::ReorgYoloLayer
* InferenceEngine::Builder::NormalizeLayer
* InferenceEngine::Builder::PriorBoxClusteredLayer
* InferenceEngine::Builder::MVNLayer
* InferenceEngine::Builder::PermuteLayer
* InferenceEngine::Builder::SimplerNMSLayer
* InferenceEngine::Builder::ConstLayer
* InferenceEngine::Builder::DeformableConvolutionLayer
* InferenceEngine::Builder::FullyConnectedLayer
* InferenceEngine::Builder::PriorBoxLayer
* InferenceEngine::Builder::SoftMaxLayer
* InferenceEngine::Builder::OutputLayer
* InferenceEngine::Builder::TileLayer
* InferenceEngine::Builder::SplitLayer
* InferenceEngine::Builder::PReLULayer
* InferenceEngine::Builder::RegionYoloLayer
* InferenceEngine::Builder::ReshapeLayer
* InferenceEngine::Builder::ConvolutionLayer
* InferenceEngine::Builder::DetectionOutputLayer
* InferenceEngine::Builder::ConcatLayer
* InferenceEngine::Builder::ELULayer
* InferenceEngine::Builder::GRNLayer
* InferenceEngine::Builder::LRNLayer
* InferenceEngine::Builder::ArgMaxLayer
* InferenceEngine::Builder::ReLU6Layer
* InferenceEngine::Builder::ScaleShiftLayer
* InferenceEngine::Builder::ProposalLayer
* InferenceEngine::Builder::SigmoidLayer
* InferenceEngine::Builder::ResampleLayer
* InferenceEngine::Builder::CTCGreedyDecoderLayer
* InferenceEngine::Builder::BatchNormalizationLayer
* InferenceEngine::Builder::LayerDecorator
* InferenceEngine::Builder::PowerLayer
* InferenceEngine::Builder::Network
* InferenceEngine::Builder::PortInfo
* InferenceEngine::Builder::Connection
* InferenceEngine::Builder::PortData
* InferenceEngine::Builder::Port
* InferenceEngine::Builder::ILayer
* InferenceEngine::Builder::INetworkIterator
* InferenceEngine::Builder::INetwork
* InferenceEngine::Builder::ILayer
## 2020.2
### New API
**Extensibility API:**
* InferenceEngine::IExtension::getImplTypes(const std::shared_ptr<ngraph::Node>& node) method
* InferenceEngine::IExtension::getImplementation(const std::shared_ptr<ngraph::Node>& node, const std::string& implType) method
### Deprecated API
**Extensibility API:**
* InferenceEngine::ILayerImplFactory class
* InferenceEngine::IShapeInferImpl class
* InferenceEngine::IShapeInferImpl class
* InferenceEngine::IShapeInferExtension class
* InferenceEngine::IExtension::getFactoryFor(ILayerImplFactory\*& factory, const CNNLayer\* cnnLayer, ResponseDesc\* resp) noexcept method
* InferenceEngine::IExtension::getPrimitiveTypes(char\*\*& types, unsigned int& size, ResponseDesc\* resp) noexcept method
* InferenceEngine::ShapeInferImpl class
* InferenceEngine::Extension::getFactoryFor(ILayerImplFactory\*& factory, const CNNLayer\* cnnLayer, ResponseDesc\* resp) noexcept method
* InferenceEngine::Extension::getPrimitiveTypes(char\*\*& types, unsigned int& size, ResponseDesc\* resp) noexcept method
**Network API:**
* InferenceEngine::details::CNNNetworkIterator class
* InferenceEngine::CNNNetwork::getPrecision() const method
* InferenceEngine::CNNNetwork::getLayerByName(const char\* layerName) const method
* InferenceEngine::CNNNetwork::size() const method
* InferenceEngine::CNNNetwork::begin() const method
* InferenceEngine::CNNNetwork::end() const method
* InferenceEngine::CNNNetwork::AddExtension(const IShapeInferExtensionPtr& extension) method
* InferenceEngine::ICNNNetwork::getPrecision() const noexcept method
* InferenceEngine::ICNNNetwork::getName(char\* pName, size_t len) const noexcept method
* InferenceEngine::ICNNNetwork::getData(const char\* dname) noexcept method
* InferenceEngine::ICNNNetwork::addLayer(const CNNLayerPtr& layer) noexcept method
* InferenceEngine::ICNNNetwork::getLayerByName(const char\* layerName, CNNLayerPtr& out, ResponseDesc\* resp) const noexcept method
* InferenceEngine::ICNNNetwork::AddExtension(const IShapeInferExtensionPtr& extension, ResponseDesc\* resp) noexcept method
* InferenceEngine::ICNNNetwork::getStats(ICNNNetworkStats\*\* stats, ResponseDesc\* resp) const noexcept method
* InferenceEngine::ICNNNetworkStats class
* InferenceEngine::NetworkNodeStats class
* InferenceEngine::Data::getCreatorLayer() method
* InferenceEngine::Data::getInputTo() method
* InferenceEngine::LayerParams class
**Layer API:**
* InferenceEngine::CNNLayer class
* InferenceEngine::WeightableLayer class
* InferenceEngine::BatchNormalizationLayer class
* InferenceEngine::BatchToSpaceLayer class
* InferenceEngine::BinaryConvolutionLayer class
* InferenceEngine::BroadcastLayer class
* InferenceEngine::BucketizeLayer class
* InferenceEngine::ClampLayer class
* InferenceEngine::ConcatLayer class
* InferenceEngine::ConvolutionLayer class
* InferenceEngine::CropLayer class
* InferenceEngine::DeconvolutionLayer class
* InferenceEngine::DeformableConvolutionLayer class
* InferenceEngine::DepthToSpaceLayer class
* InferenceEngine::EltwiseLayer class
* InferenceEngine::ExperimentalDetectronPriorGridGenerator class
* InferenceEngine::ExperimentalDetectronPriorGridGeneratorLayer class
* InferenceEngine::ExperimentalSparseWeightedReduceLayer class
* InferenceEngine::FillLayer class
* InferenceEngine::FullyConnectedLayer class
* InferenceEngine::GRNLayer class
* InferenceEngine::GRUCell class
* InferenceEngine::GatherLayer class
* InferenceEngine::GemmLayer class
* InferenceEngine::LSTMCell class
* InferenceEngine::MVNLayer class
* InferenceEngine::MathLayer class
* InferenceEngine::NonMaxSuppression class
* InferenceEngine::NormLayer class
* InferenceEngine::OneHotLayer class
* InferenceEngine::PReLULayer class
* InferenceEngine::PadLayer class
* InferenceEngine::PoolingLayer class
* InferenceEngine::PowerLayer class
* InferenceEngine::QuantizeLayer class
* InferenceEngine::RNNCell class
* InferenceEngine::RNNCellBase class
* InferenceEngine::RNNSequenceLayer class
* InferenceEngine::RangeLayer class
* InferenceEngine::ReLU6Layer class
* InferenceEngine::ReLULayer class
* InferenceEngine::ReduceLayer class
* InferenceEngine::ReshapeLayer class
* InferenceEngine::ReverseSequenceLayer class
* InferenceEngine::ScaleShiftLayer class
* InferenceEngine::ScatterLayer class
* InferenceEngine::SelectLayer class
* InferenceEngine::ShuffleChannelsLayer class
* InferenceEngine::SoftMaxLayer class
* InferenceEngine::SpaceToBatchLayer class
* InferenceEngine::SpaceToDepthLayer class
* InferenceEngine::SparseFillEmptyRowsLayer class
* InferenceEngine::SparseSegmentReduceLayer class
* InferenceEngine::SparseToDenseLayer class
* InferenceEngine::SplitLayer class
* InferenceEngine::StridedSliceLayer class
* InferenceEngine::TensorIterator class
* InferenceEngine::TileLayer class
* InferenceEngine::TopKLayer class
* InferenceEngine::UniqueLayer class
## 2020.1
### New API
**Integration with ngraph API:**
* InferenceEngine::CNNNetwork(const std::shared_ptr<ngraph::Function>& network) ctor from ngraph::Function
* InferenceEngine::CNNNetwork::getFunction() const noexcept method
* InferenceEngine::ICNNNetwork::getFunction() const noexcept method
* InferenceEngine::Parameter(const std::shared_ptr<ngraph::Variant>& var) ctor
* InferenceEngine::Parameter::asVariant() const method
* InferenceEngine::Parameter::operator std::shared_ptr<ngraph::Variant>() const operator
* InferenceEngine::Core::ReadNetwork(const std::wstring& modelPath, const std::wstring& binPath) method
* InferenceEngine::Core::ReadNetwork(const std::string& modelPath, const std::string& binPath = "") method
* InferenceEngine::Core::ReadNetwork(const std::string& model, const Blob::CPtr& weights) method
* InferenceEngine::Code::AddExtension(const IExtensionPtr& extension) method
* InferenceEngine::IExtension::getOpSets() method
**Offline compilation: import / export to std::stream:**
* InferenceEngine::ExecutableNetwork::Export(std::ostream& networkModel) method
* InferenceEngine::Core::ImportNetwork(std::istream& networkModel, const std::string& deviceName = {}, const std::map<std::string, std::string>& config = {}) method
* InferenceEngine::IExecutableNetwork::Export(std::ostream& networkModel, ResponseDesc \*resp) noexcept method
**RemoteBlob accelerator memory sharing API:**
* InferenceEngine::RemoteContext class
* InferenceEngine::RemoteBlob class
* InferenceEngine::Core::CreateContext(const std::string& deviceName, const ParamMap& params) method
* InferenceEngine::Core::GetDefaultContext(const std::string& deviceName) method
* InferenceEngine::Core::LoadNetwork(CNNNetwork network, RemoteContext::Ptr context, const std::map<std::string, std::string>& config = std::map<std::string, std::string>()) method
**GNA firmware model image generation:**
* GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION) config key
* GNA_CONFIG_VALUE(GEN) value
* GNA_CONFIG_VALUE(GEN_EXACT) value
* GNA_CONFIG_VALUE(SSE) value
* GNA_CONFIG_VALUE(SSE_EXACT) value
* GNA_CONFIG_VALUE(AVX1) value
* GNA_CONFIG_VALUE(AVX1_EXACT) value
* GNA_CONFIG_VALUE(AVX2) value
* GNA_CONFIG_VALUE(AVX2_EXACT) value
**MemoryBlob mapping of memory to the user space:**
* InferenceEngine::MemoryBlob::rwmap() noexcept method
* InferenceEngine::MemoryBlob::rmap() noexcept method
* InferenceEngine::MemoryBlob::wmap() noexcept method
**Memory interoperability on acceleration devices. General classes and GPU helper functions**
* InferenceEngine::RemoteBlob class
* InferenceEngine::RemoteContext class
* InferenceEngine::Core::CreateContext(const std::string& deviceName, const ParamMap& params) method
* InferenceEngine::Core::GetDefaultContext(const std::string& deviceName) method
* InferenceEngine::make_shared_blob(const TensorDesc& desc, RemoteContext::Ptr ctx) function
* InferenceEngine::gpu::make_shared_blob_nv12(size_t height, size_t width, RemoteContext::Ptr ctx, VASurfaceID nv12_surf) function
* InferenceEngine::gpu::make_shared_context(Core& core, std::string deviceName, VADisplay device) function
* InferenceEngine::gpu::make_shared_blob(const TensorDesc& desc, RemoteContext::Ptr ctx, VASurfaceID surface, uint32_t plane = 0) function
* InferenceEngine::gpu::make_shared_blob_nv12(RemoteContext::Ptr ctx, cl::Image2D& nv12_image_plane_y, cl::Image2D& nv12_image_plane_uv) function
* InferenceEngine::gpu::make_shared_context(Core& core, std::string deviceName, cl_context ctx) function
* InferenceEngine::gpu::make_shared_blob(const TensorDesc& desc, ClContext::Ptr ctx) function
* InferenceEngine::gpu::make_shared_blob(const TensorDesc& desc, RemoteContext::Ptr ctx, cl::Buffer& buffer) function
* InferenceEngine::gpu::make_shared_blob(const TensorDesc& desc, RemoteContext::Ptr ctx, cl_mem buffer) function
* InferenceEngine::gpu::make_shared_blob(const TensorDesc& desc, RemoteContext::Ptr ctx, cl::Image2D& image) function
### Deprecated API
**Inference Engine NN Builder API:**
* InferenceEngine::Builder::EltwiseLayer
* InferenceEngine::Builder::MemoryLayer
* InferenceEngine::Builder::ROIPoolingLayer
* InferenceEngine::Builder::DeconvolutionLayer
* InferenceEngine::Builder::ReLULayer
* InferenceEngine::Builder::TanHLayer
* InferenceEngine::Builder::InputLayer
* InferenceEngine::Builder::PoolingLayer
* InferenceEngine::Builder::CropLayer
* InferenceEngine::Builder::GRUSequenceLayer
* InferenceEngine::Builder::NormLayer
* InferenceEngine::Builder::LSTMSequenceLayer
* InferenceEngine::Builder::ClampLayer
* InferenceEngine::Builder::PSROIPoolingLayer
* InferenceEngine::Builder::Layer
* InferenceEngine::Builder::RNNSequenceLayer
* InferenceEngine::Builder::ReorgYoloLayer
* InferenceEngine::Builder::NormalizeLayer
* InferenceEngine::Builder::PriorBoxClusteredLayer
* InferenceEngine::Builder::MVNLayer
* InferenceEngine::Builder::PermuteLayer
* InferenceEngine::Builder::SimplerNMSLayer
* InferenceEngine::Builder::ConstLayer
* InferenceEngine::Builder::DeformableConvolutionLayer
* InferenceEngine::Builder::FullyConnectedLayer
* InferenceEngine::Builder::PriorBoxLayer
* InferenceEngine::Builder::SoftMaxLayer
* InferenceEngine::Builder::OutputLayer
* InferenceEngine::Builder::TileLayer
* InferenceEngine::Builder::SplitLayer
* InferenceEngine::Builder::PReLULayer
* InferenceEngine::Builder::RegionYoloLayer
* InferenceEngine::Builder::ReshapeLayer
* InferenceEngine::Builder::ConvolutionLayer
* InferenceEngine::Builder::DetectionOutputLayer
* InferenceEngine::Builder::ConcatLayer
* InferenceEngine::Builder::ELULayer
* InferenceEngine::Builder::GRNLayer
* InferenceEngine::Builder::LRNLayer
* InferenceEngine::Builder::ArgMaxLayer
* InferenceEngine::Builder::ReLU6Layer
* InferenceEngine::Builder::ScaleShiftLayer
* InferenceEngine::Builder::ProposalLayer
* InferenceEngine::Builder::SigmoidLayer
* InferenceEngine::Builder::ResampleLayer
* InferenceEngine::Builder::CTCGreedyDecoderLayer
* InferenceEngine::Builder::BatchNormalizationLayer
* InferenceEngine::Builder::LayerDecorator
* InferenceEngine::Builder::PowerLayer
* InferenceEngine::Builder::Network
* InferenceEngine::Builder::PortInfo
* InferenceEngine::Builder::Connection
* InferenceEngine::Builder::PortData
* InferenceEngine::Builder::Port
* InferenceEngine::Builder::ILayer
* InferenceEngine::Builder::INetworkIterator
* InferenceEngine::Builder::INetwork
* InferenceEngine::Builder::ILayer
**Plugin API:**
* InferenceEngine::InferencePlugin C++ plugin wrapper class
* InferenceEngine::IInferencePlugin plugin interface
* InferenceEngine::PluginDispatcher class
* InferenceEngine::InferenceEnginePluginPtr typedef
* InferenceEngine::ICNNNetReader reader interface
* InferenceEngine::CNNNetReader class
**Blob API:**
* Blob::element_size() const noexcept method
* Blob::buffer() noexcept method
* Blob::cbuffer() noexcept method
* MemoryBlob::buffer() noexcept method
* MemoryBlob::cbuffer() noexcept method
### Removed API
Removed all [Inference Engine API which deprecated in 2019'R2](https://docs.openvinotoolkit.org/2019_R3/_docs_IE_DG_API_Changes.html#deprecated_api)
## 2019 R3
### New API
**New supported layers:**
* InferenceEngine::SparseFillEmptyRowsLayer new class
* InferenceEngine::UniqueLayer new class
* InferenceEngine::NonMaxSuppressionLayer new class
* InferenceEngine::ScatterLayer new class
**FPGA plugin streaming support:**
* DLIA_METRIC_VALUE(INPUT_STREAMING) value to METRIC_KEY(OPTIMIZATION_CAPABILITIES)
* DLIA_CONFIG_KEY(ENABLE_STREAMING) config key
### Removed API
* InferenceEngine::EltwiseLayer::Select from InferenceEngine::EltwiseLayer::eOperation enumeration
## 2019 R2
### New API
**Inference Engine Core API:**
* Introduced InferenceEngine::Core high level class to manage devices
**Query API extensions to InferenceEngine::ExecutableNetwork and InferenceEngine::IExecutableNetwork:**
* InferenceEngine::ExecutableNetwork::SetConfig method
* InferenceEngine::ExecutableNetwork::GetConfig method
* InferenceEngine::ExecutableNetwork::GetMetric method
* InferenceEngine::IExecutableNetwork::SetConfig method
* InferenceEngine::IExecutableNetwork::GetConfig method
* InferenceEngine::IExecutableNetwork::GetMetric method
**Metrics and values for Query API:**
* METRIC_KEY(AVAILABLE_DEVICES)
* METRIC_KEY(SUPPORTED_METRICS)
* METRIC_KEY(SUPPORTED_CONFIG_KEYS)
* METRIC_KEY(FULL_DEVICE_NAME)
* METRIC_KEY(OPTIMIZATION_CAPABILITIES)
* METRIC_VALUE(FP32)
* METRIC_VALUE(FP16)
* METRIC_VALUE(INT8)
* METRIC_VALUE(BIN)
* METRIC_VALUE(WINOGRAD)
* DLIA_METRIC_VALUE(FP11)
* METRIC_KEY(RANGE_FOR_STREAMS)
* METRIC_KEY(NUMBER_OF_WAITING_INFER_REQUESTS)
* METRIC_KEY(NUMBER_OF_EXEC_INFER_REQUESTS)
* METRIC_KEY(DEVICE_THERMAL)
* METRIC_KEY(RANGE_FOR_ASYNC_INFER_REQUESTS)
* EXEC_NETWORK_METRIC_KEY(NETWORK_NAME)
* EXEC_NETWORK_METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)
**Common API:**
* CLDNN_CONFIG_KEY(INT8_ENABLED) config key
* CONFIG_KEY(GPU_THROUGHPUT_AUTO)
* CONFIG_KEY(GPU_THROUGHPUT_STREAMS)
* DLIA_CONFIG_KEY(IO_TRANSFORMATIONS_NATIVE) config key
* DLIA_CONFIG_KEY(DUMP_SUPPORTED_LAYERS_INFORMATION) config key
* GNA_CONFIG_VALUE(SW_FP32) config value for GNA_CONFIG_KEY(DEVICE_MODE) key
* MULTI_CONFIG_KEY(DEVICE_PRIORITIES) config key for `MULTI` device
* InferenceEngine::CNNNetReader::ReadNetwork(const std::wstring &filepath) new method
* InferenceEngine::CNNNetReader::ReadWeights(const std::wstring &filepath) new method
* InferenceEngine::ExecutableNetwork::ExecutableNetwork(IExecutableNetwork::Ptr actual, InferenceEnginePluginPtr plg) constructor with additional `plg` parameter
* InferenceEngine::InferRequest::InferRequest(IInferRequest::Ptr request, InferenceEnginePluginPtr plg) constructor with additional `plg` parameter
* InferenceEngine::Data::setName method
* InferenceEngine::QueryNetworkResult::supportedLayersMap
* InferenceEngine::Precision::I64 extension to InferenceEngine::Precision::ePrecision enumeration
**New supported primitives:**
* InferenceEngine::Builder::DeformableConvolutionLayer new class
* InferenceEngine::DeformableConvolutionLayer new class
* InferenceEngine::EltwiseLayer::Logical_NOT, InferenceEngine::EltwiseLayer::Mean, InferenceEngine::EltwiseLayer::Select extensions to InferenceEngine::EltwiseLayer::eOperation enumeration
* InferenceEngine::OneHotLayer new class
* InferenceEngine::SelectLayer new class
* InferenceEngine::BroadcastLayer new class
* InferenceEngine::MathLayer new class
* InferenceEngine::ReduceLayer new class
* InferenceEngine::TopKLayer new class
**Extensions to Blob creation API:**
* InferenceEngine::Blob::is method
* InferenceEngine::Blob::is const method
* InferenceEngine::Blob::as method
* InferenceEngine::Blob::as const method
* InferenceEngine::Blob::getAllocator abstract method
* InferenceEngine::Blob::getHandle abstract method
* InferenceEngine::MemoryBlob class
* InferenceEngine::ColorFormat enumeration
* InferenceEngine::PreProcessInfo::setColorFormat method
* InferenceEngine::PreProcessInfo::getColorFormat method
* InferenceEngine::CompoundBlob class to work with blobs consisting of several planes
* InferenceEngine::NV12Blob class representing NV12 blob with two planes
### Deprecated API
The methods listed below are deprecated and will be removed in 2019 R4 release:
**Common API:**
* InferenceEngine::InputInfo::getInputPrecision method
* InferenceEngine::InputInfo::setInputPrecision method
* InferenceEngine::InputInfo::getDims method
* InferenceEngine::CNNLayer::GetParamsAsBool method
* InferenceEngine::CNNNetwork::CNNNetwork(ICNNNetwork* actual) constructor
* InferenceEngine::CNNNetwork::setTargetDevice method
* HETERO_CONFIG_KEY(DUMP_DLA_MESSAGES) config key
* InferenceEngine::ILayerImplFactory::getShapes method
* InferenceEngine::IShapeInferImpl::inferShapes(const std::vector<SizeVector>&, const std::map<std::string, std::string>& , const std::map<std::string, Blob::Ptr>&, std::vector<SizeVector>&, ResponseDesc\*) method
* InferenceEngine::Data::setBatchSize method
* InferenceEngine::QueryNetworkResult::supportedLayers field
* InferenceEngine::ICNNNetwork::setBatchSize(const size_t size) method
* InferenceEngine::Blob::Resize method
* InferenceEngine::Blob::Reshape method
* InferenceEngine::TBlob::set method
**InferenceEngine::IInferencePlugin and InferenceEngine:InferencePlugin obsolete methods:**
* InferenceEngine::InferencePlugin::LoadNetwork(ICNNNetwork &network) method
* InferenceEngine::InferencePlugin::Infer method
* InferenceEngine::InferencePlugin::GetPerformanceCounts method
* InferenceEngine::InferencePlugin::QueryNetwork(const ICNNNetwork &network, QueryNetworkResult &res) const method
* InferenceEngine::IInferencePlugin::LoadNetwork(ICNNNetwork &network, ResponseDesc \*resp) method
* InferenceEngine::IInferencePlugin::Infer(const Blob &input, Blob &result, ResponseDesc \*resp) method
* InferenceEngine::IInferencePlugin::Infer(const BlobMap &input, BlobMap &result, ResponseDesc \*resp) method
* InferenceEngine::IInferencePlugin::GetPerformanceCounts method
* InferenceEngine::IInferencePlugin::QueryNetwork(const ICNNNetwork& network, QueryNetworkResult& res) const method
**Fields in InferenceEngine::Data class are replaced with appropriate methods:**
* InferenceEngine::Data::precision field
* InferenceEngine::Data::layout field
* InferenceEngine::Data::dims field
* InferenceEngine::Data::creatorLayer field
* InferenceEngine::Data::name field
* InferenceEngine::Data::inputTo field
* InferenceEngine::Data::userObject field
**Heterogeneous plugin:**
* InferenceEngine::IHeteroDeviceLoader class
* InferenceEngine::IHeteroInferencePlugin class
* InferenceEngine::HeteroPluginPtr class
* operator InferenceEngine::InferencePlugin::HeteroPluginPtr operator
**Blob creation API with dimensions in reverse order:**
* InferenceEngine::Blob::Blob(Precision p) constructor
* InferenceEngine::Blob::Blob(Precision p, Layout l) constructor
* InferenceEngine::Blob::Blob(Precision p, const SizeVector &dims) constructor
* InferenceEngine::Blob::Blob(Precision p, Layout l, const SizeVector &dims) constructor
* InferenceEngine::TBlob::TBlob(Precision p, Layout l) constructor
* InferenceEngine::TBlob::TBlob(Precision p, Layout l, const SizeVector& dims) constructor
* InferenceEngine::TBlob::TBlob(Precision p, Layout l, const SizeVector& dims, T* ptr, size_t data_size) constructor
* InferenceEngine::TBlob::TBlob(Precision p, Layout l, const SizeVector &dims, std::shared_ptr<IAllocator> alloc) constructor
* InferenceEngine::Blob::type() method
* InferenceEngine::Blob::precision() method
* InferenceEngine::Blob::layout() method
* InferenceEngine::Blob::dims() method
* InferenceEngine::make_shared_blob(Precision p, Layout l, const SizeVector &dims) function
* InferenceEngine::make_shared_blob(Precision p, const SizeVector &dims) function
* InferenceEngine::make_shared_blob(Precision p, Layout l, const TArg &arg) function
* InferenceEngine::make_shared_blob(Precision p, const TArg &arg) function
* InferenceEngine::make_shared_blob(TBlob<TypeTo> &&arg) function
* InferenceEngine::make_shared_blob(Precision p, Layout l) function
* InferenceEngine::make_shared_blob(Precision p, Layout l, SizeVector dims, const std::vector<TypeTo> &arg) function
* InferenceEngine::make_shared_blob(Precision p, Layout l, const std::vector<TypeTo> &arg) function
* InferenceEngine::make_shared_blob(Precision p, const std::vector<TypeTo> &arg) function
* InferenceEngine::make_shared_blob(Precision p, Layout l, const SizeVector &dims, TypeTo * ptr, size_t size) function
* InferenceEngine::make_shared_blob(Precision p, const SizeVector &dims, TypeTo * ptr, size_t size) function
* InferenceEngine::I_N variable
* InferenceEngine::I_C variable
* InferenceEngine::I_H variable
* InferenceEngine::I_W variable
* InferenceEngine::LayoutOffsetCounter class
* InferenceEngine::ConvertLayout function
**API working with device enumeration:**
* InferenceEngine::TargetDevice enumeration
* InferenceEngine::TargetDeviceInfo class
* InferenceEngine::getDeviceName function
* InferenceEngine::FindPluginRequest class
* InferenceEngine::FindPluginResponse class
* InferenceEngine::findPlugin(const FindPluginRequest &req, FindPluginResponse &result, ResponseDesc *resp) function
* InferenceEngine::ICNNNetwork::setTargetDevice method
* InferenceEngine::ICNNNetwork::getTargetDevice method
* InferenceEngine::PluginDispatcher::getPluginByDevice method
* InferenceEngine::PluginDispatcher::getSuitablePlugin method

View File

@@ -0,0 +1,90 @@
# Bfloat16 Inference {#openvino_docs_IE_DG_Bfloat16Inference}
## Disclaimer
Inference Engine with the bfloat16 inference implemented on CPU must support the `avx512_bf16` instruction and therefore the bfloat16 data format.
## Introduction
Bfloat16 computations (referred to as BF16) is the Brain Floating-Point format with 16 bits. This is a truncated 16-bit version of the 32-bit IEEE 754 single-precision floating-point format FP32. BF16 preserves 8 exponent bits as FP32 but reduces precision of the sign and mantissa from 24 bits to 8 bits.
![bf16_format]
Preserving the exponent bits keeps BF16 to the same range as the FP32 (~1e-38 to ~3e38). This simplifies conversion between two data types: you just need to skip or flush to zero 16 low bits.
Truncated mantissa leads to occasionally less precision, but according to [investigations](https://cloud.google.com/blog/products/ai-machine-learning/bfloat16-the-secret-to-high-performance-on-cloud-tpus), neural networks are more sensitive to the size of the exponent than the mantissa size. Also, in lots of models, precision is needed close to zero but not so much at the maximum range.
Another useful feature of BF16 is possibility to encode an INT8 in BF16 without loss of accuracy, because INT8 range completely fits in BF16 mantissa field. It reduces data flow in conversion from INT8 input image data to BF16 directly without intermediate representation in FP32, or in combination of [INT8 inference](Int8Inference.md) and BF16 layers.
See the [Intel's site](https://software.intel.com/sites/default/files/managed/40/8b/bf16-hardware-numerics-definition-white-paper.pdf) for more bfloat16 format details.
There are two ways to check if CPU device can support bfloat16 computations for models:
1. Query the instruction set via system `lscpu | grep avx512_bf16` or `cat /proc/cpuinfo | grep avx512_bf16`.
2. Use [Query API](InferenceEngine_QueryAPI.md) with `METRIC_KEY(OPTIMIZATION_CAPABILITIES)`, which should return `BF16` in the list of CPU optimization options:
```cpp
InferenceEngine::Core core;
auto cpuOptimizationCapabilities = core.GetMetric("CPU", METRIC_KEY(OPTIMIZATION_CAPABILITIES)).as<std::vector<std::string>>();
```
Current Inference Engine solution for bfloat16 inference uses Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) and supports inference of the following layers in BF16 computation mode:
* Convolution
* FullyConnected
* InnerProduct
* LRN
* Pooling
This means that BF16 inference can only be performed with the CPU plugin on the layers listed above. All other layers are executed in FP32.
## Lowering Inference Precision
Lowering precision to increase performance is [widely used](https://software.intel.com/content/www/us/en/develop/articles/lower-numerical-precision-deep-learning-inference-and-training.html) for optimization of inference. The bfloat16 data type usage on CPU for the first time opens the possibility of default optimization approach.
The embodiment of this approach is to use the optimization capabilities of the current platform to achieve maximum performance while maintaining the accuracy of calculations within the acceptable range.
Bfloat16 data usage provides the following benefits that increase performance:
1. Faster multiplication of two BF16 numbers because of shorter mantissa of bfloat16 data.
2. No need to support denormals and handling exceptions as this is a performance optimization.
3. Fast conversion of float32 to bfloat16 and vice versa.
4. Reduced size of data in memory, as a result, larger models fit in the same memory bounds.
5. Reduced amount of data that must be transferred, as a result, reduced data transition time.
For default optimization on CPU, source model converts from FP32 or FP16 to BF16 and executes internally on platforms with native BF16 support. In that case, `KEY_ENFORCE_BF16` is set to `YES`.
The code below demonstrates how to check if the key is set:
```cpp
InferenceEngine::Core core;
auto exeNetwork = core.LoadNetwork(network, "CPU");
auto enforceBF16 = exeNetwork.GetConfig(PluginConfigParams::KEY_ENFORCE_BF16).as<std::string>();
```
To disable BF16 internal transformations, set the `KEY_ENFORCE_BF16` to `NO`. In this case, the model infers AS IS without modifications with precisions that were set on each layer edge.
```cpp
InferenceEngine::Core core;
core.SetConfig({ { CONFIG_KEY(ENFORCE_BF16), CONFIG_VALUE(NO) } }, "CPU");
```
An exception with message `Platform doesn't support BF16 format` is formed in case of setting `KEY_ENFORCE_BF16` to `YES` on CPU without native BF16 support.
Low-Precision 8-bit integer models do not convert to BF16, even if bfloat16 optimization is set by default.
## Performance Counters
Information about layer precision is stored in the performance counters that are
available from the Inference Engine API. The layers have the following marks:
* Suffix `BF16` for layers that had bfloat16 data type input and were computed in BF16 precision
* Suffix `FP32` for layers computed in 32-bit precision
For example, the performance counters table for the Inception model can look as follows:
```
pool5 EXECUTED layerType: Pooling realTime: 143 cpu: 143 execType: jit_avx512_BF16
fc6 EXECUTED layerType: FullyConnected realTime: 47723 cpu: 47723 execType: jit_gemm_BF16
relu6 NOT_RUN layerType: ReLU realTime: 0 cpu: 0 execType: undef
fc7 EXECUTED layerType: FullyConnected realTime: 7558 cpu: 7558 execType: jit_gemm_BF16
relu7 NOT_RUN layerType: ReLU realTime: 0 cpu: 0 execType: undef
fc8 EXECUTED layerType: FullyConnected realTime: 2193 cpu: 2193 execType: jit_gemm_BF16
prob EXECUTED layerType: SoftMax realTime: 68 cpu: 68 execType: jit_avx512_FP32
```
The `execType` column of the table includes inference primitives with specific suffixes.
[bf16_format]: img/bf16_format.png

View File

@@ -0,0 +1,298 @@
Cross Check Tool {#openvino_docs_IE_DG_Cross_Check_Tool}
================
Cross Check Tool is a console application that enables comparing accuracy and performance metrics for two successive
model inferences that are performed
on two different supported Intel&reg; devices or with different precisions.
The Cross Check Tool can compare metrics per layer or all over the model.
On Linux* OS, before running the Cross Check Tool binary, make sure your application can find the
Deep Learning Inference Engine libraries.
Navigate to the `<INSTALL_DIR>/deployment_tools/inference_engine/bin` folder and run the `setvars.sh` script to
set all necessary environment variables:
```sh
source setvars.sh
```
## Running the Cross Check Tool
Cross Check Tool is distributed as a binary file and there is no need to build it. To run the Cross Check Tool,
execute the tool's binary file with necessary parameters. Please note that the Inference Engine assumes that weights
are in the same folder as the _.xml_ file.
You can get the list of all available options using the -h option:
```sh
$./cross_check_tool -h
InferenceEngine:
API version ............ 1.0
Build .................. ###
[ INFO ] Parsing input parameters
./cross_check_tool [OPTION]
Options:
-h Prints a usage message.
-i "<path>" Optional. Path to an input image file or multi-input file to infer. Generates input(s) from normal distribution if empty
-m "<path>" Required. Path to an .xml file that represents the first IR of the trained model to infer.
-l "<absolute_path>" Required for MKLDNN (CPU)-targeted custom layers. Absolute path to a shared library with the kernels implementation.
Or
-c "<absolute_path>" Required for clDNN (GPU)-targeted custom kernels. Absolute path to the xml file with the kernels description.
-conf "<path>" Optional. Path to config file for -d device plugin
-ref_conf "<path>" Optional. Path to config file for -ref_d device plugin
-pp "<path>" Optional. Path to a plugin folder.
-d "<device>" Required. The first target device to infer the model specified with the -m option. CPU, GPU, HDDL or MYRIAD is acceptable.
-ref_m "<path>" Optional. Path to an .xml file that represents the second IR in different precision to compare the metrics.
-ref_d "<device>" Required. The second target device to infer the model and compare the metrics. CPU, GPU, HDDL or MYRIAD is acceptable.
-layers "<options>" Defines layers to check. Options: all, None - for output layers check, list of comma-separated layer names to check. Default value is None.
-eps "<float>" Optional. Threshold for filtering out those blob statistics that do not statify the condition: max_abs_diff < eps.
-dump Enables blobs statistics dumping
-load "<path>" Path to a file to load blobs from
```
### Examples
1. To check per-layer accuracy and performance of inference in FP32 precision on the CPU against the GPU, run:
```sh
./cross_check_tool -i <path_to_input_image_or_multi_input_file> \
-m <path_to_FP32_xml> \
-d CPU \
-ref_d GPU \
-layers all
```
The output looks as follows:
```
InferenceEngine:
API version ............ 1.0
Build .................. ###
[ INFO ] Parsing input parameters
The same IR on both devices: <path_to_IR>
[ INFO ] No extensions provided
API version ............ 1.0
Build .................. lnx_20180510
Description ....... MKLDNNPlugin
API version ............ 0.1
Build .................. ci-main-03659
Description ....... clDNNPlugin
[ INFO ] Inputs detected: Placeholder
[ INFO ] Statistics will be dumped for X layers: <layer_1_name>, <layer_2_name>, ... , <layer_X_name>
[ INFO ] Layer <layer_1_name> statistics
Max absolute difference: 1.52588e-05
Min absolute difference: 0
Max relative difference: 0.000288028%
Min relative difference: 0%
Blob size: 1000
Devices: CPU_FP32 GPU_FP32
Status: EXECUTED EXECUTED
Layer type: Reshape Reshape
Real time, microsec: 20 154
Execution type: unknown GPU
Number of NAN: 0 0
Number of INF: 0 0
Number of ZERO: 0 0
...
<list_of_layer_statistics>
...
[ INFO ] Overall max absolute difference 2.81334e-05 was reached by <layer_name> layer
[ INFO ] Overall min absolute difference 0 was reached by <layer_name> layer
[ INFO ] Overall max relative difference 0.744893% was reached by <layer_name> layer
[ INFO ] Overall min relative difference -2.47948% was reached by <layer_name> layer
[ INFO ] Execution successful
```
2. To check the overall accuracy and performance of inference on the CPU in FP32 precision against the
Intel&reg; Movidius&trade; Myriad&trade; device in FP16 precision, run:
```sh
./cross_check_tool -i <path_to_input_image_or_multi_input_file> \
-m <path_to_FP16_xml> \
-ref_d CPU \
-ref_m <path_to_FP32_xml>\
-d MYRIAD \
```
The output looks as follows:
```
InferenceEngine:
API version ............ 1.0
Build .................. ###
[ INFO ] Parsing input parameters
[ INFO ] MYRIAD vs CPU
IR for MYRIAD : <path_to_FP16_xml>
IR for CPU : <path_to_FP32_xml>
[ INFO ] No extensions provided
[ INFO ] Loading plugins
API version ............ 0.1
Build .................. ###
Description ....... myriadPlugin
API version ............ 1.0
Build .................. ###
Description ....... MKLDNNPlugin
[ INFO ] Inputs detected: <list_of_input_layers>
[ INFO ] Statistics will be dumped for 1 layers: <output_layer_name(s)>
[ INFO ] Layer <output_layer_name> statistics
Max absolute difference: 0.003889
Min absolute difference: 2.49778e-12
Max relative difference: 290.98%
Min relative difference: 0.0327804%
Devices: MYRIAD_FP16 CPU_FP32
Real time, microsec: 69213.978946 4149.904940
[ INFO ] Execution successful
```
3. To dump layer statistics from specific list of layers, run:
```sh
./cross_check_tool -i <path_to_input_image_or_multi_input_file> \
-m <path_to_FP16_xml> \
-d MYRIAD \
-dump \
-layers <comma_separated_list_of_layers>
```
The output looks as follows:
```
InferenceEngine:
API version ............ 1.0
Build .................. ###
[ INFO ] Blob and statistics dumping enabled
[ INFO ] No extensions provided
API version ............ 0.1
Build .................. custom_releases/cvsdk-2018-r2_e28ec0278fb749d6b999c688a8e90a8a25c0f2b5
Description ....... myriadPlugin
[ INFO ] Inputs detected: <list_of_input_layers>
[ INFO ] Statistics will be dumped for X layers: <comma_separated_list_of_layers>
[ INFO ] Dump path: <path_where_dump_will_be_saved>
[ INFO ] <layer_1_name> layer processing
...
[ INFO ] <layer_X_name> layer processing
[ INFO ] Execution successful
```
If you do not provide the `-i` key, the Cross Check Tool generates an input from normal distributed noise and saves
it in a multi-input file format with the filename `<path_to_xml>_input_layers_dump.txt` in the same folder as the IR.
4. To check the overall accuracy and performance of inference on the CPU in FP32 precision against dumped results, run:
```sh
./cross_check_tool -i <path_to_input_image_or_multi_input_file> \
-m <path_to_FP32_xml> \
-d CPU \
-load <path_to_dump> \
-layers all
```
The output looks as follows:
```
InferenceEngine:
API version ............ 1.0
Build .................. ###
[ INFO ] Blob and statistics loading enabled. File /localdisk/models/FP16/icv_squeezenet_v1.0_MYRIAD_FP16_dump.txt
The same IR on both devices: <path_to_FP32_xml>
[ INFO ] No extensions provided
API version ............ 0.1
Build .................. ###
Description ....... myriadPlugin
[ INFO ] Inputs detected: <list_of_input_layers>
[ INFO ] Statistics will be dumped for X layers: <layer_1_name>, <layer_2_name>, ... , <layer_X_name>
[ INFO ] <layer_1_name> layer processing
[ INFO ] Layer <layer_1_name> statistics
Max absolute difference: 0
Min absolute difference: 0
Max relative difference: 0%
Min relative difference: 0%
Blob size: 1000
Devices: MYRIAD_FP16 MYRIAD_FP16_loaded
Status: EXECUTED EXECUTED
Layer type: SoftMax SoftMax
Real time, microsec: 43 43
Execution type: SoftMax SoftMax
Number of NAN: 0 0
Number of INF: 0 0
Number of ZERO: 0 0
...
<list_of_layer_statistics>
...
[ INFO ] Overall max absolute difference 0
[ INFO ] Overall min absolute difference 0 was reached by <layer_1_name> layer
[ INFO ] Overall max relative difference 0%
[ INFO ] Overall min relative difference 0% was reached by <layer_1_name> layer
[ INFO ] Execution successful
```
### Multi-input and dump file experimental format
Text file contains description of each layer in structure like this:
* 1<sup>st</sup> line is layer name (required)
* 2<sup>nd</sup> line is shape like "(1,224,224,3)" (required)
* 3<sup>rd</sup> line is a device and precision information like "CPU_FP32" (optional for multi-input file)
* 4<sup>th</sup> line is execution status Options are: EXECUTED, OPTIMIZED_OUT (optional for multi-input file)
* 5<sup>th</sup> line is type of layer (optional for multi-input file)
* 6<sup>th</sup> line is execution time in microseconds (optional for multi-input file)
* 7<sup>th</sup> line is type of execution (optional for multi-input file)
* 8<sup>th</sup> line is word "CONTENT" which means that the next line or lines are consisted of blob elements
* Next line or lines are for blob elements. They may be separated with one or several spaces, tabs and new lines.
#### Multi-input file example
```
Input_1
(1,10)
CONTENT
0 0.000628471375 0.00185108185
0.000580787659
0.00137138367
0.000561237335 0.0040473938 0 0 0
Input_2
(1,8)
CONTENT
0 0 0.00194549561 0.0017490387 7.73072243e-05 0.000135779381 0.000186920166 0 7.52806664e-05
```
#### Dump file example
```
Softmax
(1,10)
MYRIAD_FP16
EXECUTED
SoftMax
43
SoftMax
CONTENT
7.44462013e-05
0
0.000810623169
0.000361680984
0
9.14335251e-05
0
0
8.15987587e-05
0
```
### Configuration file
There is an option to pass configuration file to plugin by providing
`-conf` and/or `--ref_conf` keys.
Configuration file is a text file with content of pairs of keys and values.
Structure of configuration file:
```sh
KEY VALUE
ANOTHER_KEY ANOTHER_VALUE,VALUE_1
```

View File

@@ -0,0 +1,93 @@
# Inference Engine Developer Guide {#openvino_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide}
## Introduction to the OpenVINO™ Toolkit
The OpenVINO™ toolkit is a comprehensive toolkit that you can use to develop and deploy vision-oriented solutions on
Intel® platforms. Vision-oriented means the solutions use images or videos to perform specific tasks.
A few of the solutions use cases include autonomous navigation, digital surveillance cameras, robotics,
and mixed-reality headsets.
The OpenVINO™ toolkit:
* Enables CNN-based deep learning inference on the edge
* Supports heterogeneous execution across an Intel&reg; CPU, Intel&reg; Integrated Graphics, Intel&reg; Movidius&trade; Neural Compute Stick and Intel&reg; Neural Compute Stick 2
* Speeds time-to-market via an easy-to-use library of computer vision functions and pre-optimized kernels
* Includes optimized calls for computer vision standards including OpenCV\*, OpenCL&trade;, and OpenVX\*
The OpenVINO™ toolkit includes the following components:
* Intel® Deep Learning Deployment Toolkit (Intel® DLDT)
- [Deep Learning Model Optimizer](../MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md) — A cross-platform command-line tool for importing models and
preparing them for optimal execution with the Deep Learning Inference Engine. The Model Optimizer supports converting Caffe*,
TensorFlow*, MXNet*, Kaldi*, ONNX* models.
- [Deep Learning Inference Engine](inference_engine_intro.md) — A unified API to allow high performance inference on many hardware types
including Intel® CPU, Intel® Processor Graphics, Intel® FPGA, Intel® Neural Compute Stick 2.
- [nGraph](nGraph_Flow.md) — graph representation and manipulation engine which is used to represent a model inside Inference Engine and allows the run-time model construction without using Model Optimizer.
* [OpenCV](https://docs.opencv.org/) — OpenCV* community version compiled for Intel® hardware.
Includes PVL libraries for computer vision.
* Drivers and runtimes for OpenCL™ version 2.1
* [Intel® Media SDK](https://software.intel.com/en-us/media-sdk)
* [OpenVX*](https://software.intel.com/en-us/cvsdk-ovx-guide) — Intel's implementation of OpenVX*
optimized for running on Intel® hardware (CPU, GPU, IPU).
* [Demos and samples](Samples_Overview.md).
This Guide provides overview of the Inference Engine describing the typical workflow for performing
inference of a pre-trained and optimized deep learning model and a set of sample applications.
> **NOTES:**
> - Before you perform inference with the Inference Engine, your models should be converted to the Inference Engine format using the Model Optimizer or built directly in run-time using nGraph API. To learn about how to use Model Optimizer, refer to the [Model Optimizer Developer Guide](../MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md). To learn about the pre-trained and optimized models delivered with the OpenVINO™ toolkit, refer to [Pre-Trained Models](@ref omz_models_intel_index).
> - [Intel® System Studio](https://software.intel.com/en-us/system-studio) is an all-in-one, cross-platform tool suite, purpose-built to simplify system bring-up and improve system and IoT device application performance on Intel® platforms. If you are using the Intel® Distribution of OpenVINO™ with Intel® System Studio, go to [Get Started with Intel® System Studio](https://software.intel.com/en-us/articles/get-started-with-openvino-and-intel-system-studio-2019).
## Table of Contents
* [Introduction to Intel® Deep Learning Deployment Toolkit](Introduction.md)
* [Inference Engine API Changes History](API_Changes.md)
* [Introduction to Inference Engine](inference_engine_intro.md)
* [Introduction to nGraph Flow](nGraph_Flow.md)
* [Understanding Inference Engine Memory Primitives](Memory_primitives.md)
* [Introduction to Inference Engine Device Query API](InferenceEngine_QueryAPI.md)
* [Adding Your Own Layers to the Inference Engine](Extensibility_DG/Intro.md)
* [Integrating Inference Engine in Your Application](Integrate_with_customer_application_new_API.md)
* [Migration from Inference Engine Plugin API to Core API](Migration_CoreAPI.md)
* [Introduction to Performance Topics](Intro_to_Performance.md)
* [Inference Engine Python API Overview](../../inference-engine/ie_bridges/python/docs/api_overview.md)
* [Using Dynamic Batching feature](DynamicBatching.md)
* [Using Static Shape Infer feature](ShapeInference.md)
* [Using Low-Precision 8-bit Integer Inference](Int8Inference.md)
* [Using Bfloat16 Inference](Bfloat16Inference.md)
* Utilities to Validate Your Converted Model
* [Using Cross Check Tool for Per-Layer Comparison Between Plugins](../../inference-engine/tools/cross_check_tool/README.md)
* [Supported Devices](supported_plugins/Supported_Devices.md)
* [GPU](supported_plugins/CL_DNN.md)
* [CPU](supported_plugins/CPU.md)
* [FPGA](supported_plugins/FPGA.md)
* [VPU](supported_plugins/VPU.md)
* [MYRIAD](supported_plugins/MYRIAD.md)
* [HDDL](supported_plugins/HDDL.md)
* [Heterogeneous execution](supported_plugins/HETERO.md)
* [GNA](supported_plugins/GNA.md)
* **NEW!** [MULTI](supported_plugins/MULTI.md)
* [Pre-Trained Models](@ref omz_models_intel_index)
* [Known Issues](Known_Issues_Limitations.md)
**Typical Next Step:** [Introduction to Intel® Deep Learning Deployment Toolkit](Introduction.md)

View File

@@ -0,0 +1,83 @@
Using Dynamic Batching {#openvino_docs_IE_DG_DynamicBatching}
======================
Dynamic Batching feature allows you+ to dynamically change batch size for inference calls
within preset batch size limit.
This feature might be useful when batch size is unknown beforehand, and using extra large batch size is
undesired or impossible due to resource limitations.
For example, face detection with person age, gender, or mood recognition is a typical usage scenario.
## Usage
You can activate Dynamic Batching by setting <code>KEY_DYN_BATCH_ENABLED</code> flag to <code>YES</code> in a configuration map that is
passed to the plugin while loading a network.
This configuration creates an <code>ExecutableNetwork</code> object that will allow setting batch size
dynamically in all of its infer requests using <code>SetBatch()</code> method.
The batch size that was set in passed <code>CNNNetwork</code> object will be used as a maximum batch size limit.
Here is a code example:
```cpp
int dynBatchLimit = FLAGS_bl; //take dynamic batch limit from command line option
// Read network model
Core core;
CNNNetwork network = core.ReadNetwork(modelFileName, weightFileName);
// enable dynamic batching and prepare for setting max batch limit
const std::map<std::string, std::string> dyn_config =
{ { PluginConfigParams::KEY_DYN_BATCH_ENABLED, PluginConfigParams::YES } };
network.setBatchSize(dynBatchLimit);
// create executable network and infer request
auto executable_network = core.LoadNetwork(network, "CPU", dyn_config);
auto infer_request = executable_network.CreateInferRequest();
...
// process a set of images
// dynamically set batch size for subsequent Infer() calls of this request
size_t batchSize = imagesData.size();
infer_request.SetBatch(batchSize);
infer_request.Infer();
...
// process another set of images
batchSize = imagesData2.size();
infer_request.SetBatch(batchSize);
infer_request.Infer();
```
## Limitations
Currently, certain limitations for using Dynamic Batching exist:
* Use Dynamic Batching with CPU and GPU plugins only.
* Use Dynamic Batching on topologies that consist of certain layers only:
* Convolution
* Deconvolution
* Activation
* LRN
* Pooling
* FullyConnected
* SoftMax
* Split
* Concatenation
* Power
* Eltwise
* Crop
* BatchNormalization
* Copy
Do not use layers that might arbitrary change tensor shape (such as Flatten, Permute, Reshape),
layers specific to object detection topologies (ROIPooling, ProirBox, DetectionOutput), and
custom layers.
Topology analysis is performed during the process of loading a network into plugin, and if topology is
not applicable, an exception is generated.

View File

@@ -0,0 +1,89 @@
# Add Custom nGraph Operations {#openvino_docs_IE_DG_Extensibility_DG_AddingNGraphOps}
Inference Engine Extension API allows to register operation sets (opsets) with custom nGraph operations, it allows to support Networks with unknown operations.
## Operation Class
To add your custom nGraph operation, create a new class that extends `ngraph::Op`, which is in turn derived from `ngraph::Node`, the base class for all graph operations in nGraph. Follow the steps below:
1. Define a `NodeTypeInfo` object that identifies the type of the operation to the graph users and helps with dynamic type resolution. The type info of an nGraph operation currently consists of a string identifier and a version number, but this may change in the future.
2. Implement constructors that can optionally take the operation inputs and attributes as parameters.
3. Override the shape inference method `validate_and_infer_types`. This method is called multiple times during graph manipulations to determine the shapes and element types of the outputs of the operations. You can access the input shapes through the `get_input_partial_shape()` method and input element types through the `get_input_element_type()` method of `ngraph::Node`. Set the inferred shape and element type of the output using `set_output_type`.
4. Override the `clone_with_new_inputs` method, which allows graph manipulation routines to create copies of this operation and connect it to different nodes during optimization.
5. Override the `visit_attributes` method, which allows serialization and deserialization of attributes. An `AttributeVisitor` is passed to the method, and the implementation is expected to walk over all the attributes in the op using the type-aware `on_attribute` helper. Helpers are already implemented for standard C++ types like `int64_t`, `float`, `bool`, `vector` and for existing nGraph defined types.
Based on that, declaration of a operation class can look as follows:
@snippet op.hpp op:header
### Class Fields
The provided implementation has several fields:
* `add` of type `int64_t` is an attribute of custom operation
* `type_info` of type `ngraph::NodeTypeInfo` defines the type and version of operation
### Operation Constructors
nGraph operation contains two constructors: a default constructor, which allows to create operation without attributes and a constructor that creates and validates operation with specified inputs and attributes.
@snippet op.cpp op:ctor
### `validate_and_infer_types()`
`ngraph::Node::validate_and_infer_types` method validates operation attributes and calculates output shapes using attributes of operation.
@snippet op.cpp op:validate
### `clone_with_new_inputs()`
`ngraph::Node::clone_with_new_inputs` method creates a copy of nGraph operation with new inputs.
@snippet op.cpp op:copy
### `visit_attributes()`
`ngraph::Node::visit_attributes` method allows to visit all operation attributes.
@snippet op.cpp op:visit_attributes
## Register Custom Operations in Extension Class
To add custom operations to the [Extension](Extension.md) class, create an operation set with custom operations and implement the `InferenceEngine::IExtension::getOpSets` method:
@snippet extension.cpp extension:getOpSets
This method returns a map of opsets that exist in the extension library.
nGraph provides opsets mechanism for operation versioning. Different opsets distinguish between different versions of one operation.
When specifying opset names, follow the rules below:
* Use unique opset names.
* Do not use the following built-in opset names: `extension`, `experimental`, `opset1`, `opest2`.
* Make sure that the Model Optimizer and your extension use the same opset names.
* IR v10 layers have the mandatory `version` attribute specifying the opset.
* `opset1` is the name of default operations set.
Operations from the default opset cannot be redefined.
Use a custom opset to create a new operation or extend functionality of an existing operation from another opset.
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*

View File

@@ -0,0 +1,19 @@
# Build Extension Library Using CMake* {#openvino_docs_IE_DG_Extensibility_DG_Building}
Inference Engine build infrastructure provides the Inference Engine Package for application development.
To build an extension library, use the following CMake script:
@snippet CMakeLists.txt cmake:extension
This CMake script finds the Inference Engine and nGraph using the `find_package` CMake command.
To build an extension library, run the commands below:
```sh
$ cd template_extension
$ mkdir build
$ cd build
$ cmake -DInferenceEngine_DIR=[IE_DIR] -Dngraph_DIR=[NGRAPH_DIR] ../
$ cmake --build .
```

View File

@@ -0,0 +1,74 @@
# How to Implement Custom CPU Layers {#openvino_docs_IE_DG_Extensibility_DG_CPU_Kernel}
The primary vehicle for the performance of the CPU codepath in the Inference Engine is the Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN), and new CPU kernels extend the Inference Engine plugin for the Intel MKL-DNN. Implementing the InferenceEngine::ILayerExecImpl defines a general CPU-side extension. There are no Intel MKL-DNN specifics in the way you need to implement a kernel.
## Implementation Class
All custom kernels for the CPU plugin should be inherited from the InferenceEngine::ILayerExecImpl interface.
Based on that, declaration of a kernel implementation class can look as follows:
@snippet cpu_kernel.hpp cpu_implementation:header
### Class Fields
The provided implementation has several fields:
* `add` of the type `int64_t` is an attribute of a custom operation
* `inShape` of the type `ngraph::Shape` is an input shape
* `outShape` of the type `ngraph::Shape` is an output shape
* `error` of the type `std::string` is a field to handle errors from a constructor
### Constructor of Implementation
An implementation constructor checks parameters of nGraph operation, stores needed attributes, and stores an error message in the case of an error.
@snippet cpu_kernel.cpp cpu_implementation:ctor
### `getSupportedConfigurations`
InferenceEngine::ILayerExecImpl::getSupportedConfigurations method returns all supported configuration formats (input/output tensor layouts) for your implementation. To specify formats of data, use InferenceEngine::TensorDesc. Refer to the [Memory Primitives](../Memory_primitives.md) section for instructions on how to do it.
@snippet cpu_kernel.cpp cpu_implementation:getSupportedConfigurations
### `init`
InferenceEngine::ILayerExecImpl::init method gets a runtime-selected configuration from a vector that is populated from the `getSupportedConfigurations` method and checks the parameters:
@snippet cpu_kernel.cpp cpu_implementation:init
### `execute`
InferenceEngine::ILayerExecImpl::execute method accepts and processes the actual tenors as input/output blobs:
@snippet cpu_kernel.cpp cpu_implementation:execute
## Register Implementation in `Extension` Class
To register custom kernel implementation in the [Extension](Extension.md) class, implement the following methods:
* <a href="#getImpTypes">getImplTypes</a>
* <a href="#getImplementation">getImplementation</a>
### <a name="getImpTypes"><code>getImplTypes</code></a>
InferenceEngine::IExtension::getImplTypes returns a vector of implementation types for an operation.
@snippet extension.cpp extension:getImplTypes
### <a name="getImplementation"><code>getImplementation</code></a>
InferenceEngine::IExtension::getImplementation returns the kernel implementation with a specified type for an operation.
@snippet extension.cpp extension:getImplementation
## Load Extension with Executable Kernels to Plugin
Use the `AddExtension` method of the general plugin interface to load your primitives:
```cpp
InferenceEngine::Core core;
// Load CPU extension as a shared library
auto extension_ptr = make_so_pointer<InferenceEngine::IExtension>("<shared lib path>");
// Add extension to the CPU device
core.AddExtension(extension_ptr, "CPU");
```

View File

@@ -0,0 +1,25 @@
# Extension Library {#openvino_docs_IE_DG_Extensibility_DG_Extension}
Inference Engine provides an InferenceEngine::IExtension interface, which defines the interface for Inference Engine Extension libraries.
All extension libraries should be inherited from this interface.
Based on that, declaration of an extension class can look as follows:
@snippet extension.hpp extension:header
The extension library should contain and export the method InferenceEngine::CreateExtension, which creates an `Extension` class:
@snippet extension.cpp extension:CreateExtension
Also, an `Extension` object should implement the following methods:
* InferenceEngine::IExtension::Release deletes an extension object
* InferenceEngine::IExtension::GetVersion returns information about version of the library
@snippet extension.cpp extension:GetVersion
Implement the InferenceEngine::IExtension::getOpSets method if the extension contains custom layers.
Read the [guide about custom operations](AddingNGraphOps.md) for more information.
To understand how integrate execution kernels to the extension library, read the [guide about development of custom CPU kernels](CPU_Kernel.md).

View File

@@ -0,0 +1,250 @@
# How to Implement Custom GPU Layers {#openvino_docs_IE_DG_Extensibility_DG_GPU_Kernel}
The GPU codepath abstracts many details about OpenCL&trade;. You need to provide the kernel code in OpenCL C and the configuration file that connects the kernel and its parameters to the parameters of the layer.
There are two options of using custom layer configuration file:
* Include a section with your kernels into the global automatically-loaded `cldnn_global_custom_kernels/cldnn_global_custom_kernels.xml` file, which is hosted in the `<INSTALL_DIR>/deployment_tools/inference_engine/bin/intel64/{Debug/Release}` folder
* Call the `InferenceEngine::Core::SetConfig()` method from your application with the `InferenceEngine::PluginConfigParams::KEY_CONFIG_FILE` key and the configuration file name as a value before loading the network that uses custom layers to the plugin:
```cpp
InferenceEngine::Core core;
// Load GPU Extensions
core.SetConfig({ { InferenceEngine::PluginConfigParams::KEY_CONFIG_FILE, "<path_to_the_xml_file>" } }, "GPU");
```
All Inference Engine samples, except trivial `hello_classification`,
feature a dedicated command-line option `-c` to load custom kernels. For example, to load custom layers for the classification sample, run the command below:
```sh
$ ./classification_sample -m <path_to_model>/bvlc_alexnet_fp16.xml -i ./validation_set/daily/227x227/apron.bmp -d GPU
-c <absolute_path_to_config>/custom_layer_example.xml
```
## Configuration File Format <a name="config-file-format"></a>
The configuration file is expected to follow the `.xml` file structure
with a node of the type `CustomLayer` for every custom layer you provide.
The definitions described in the sections below use the following notations:
Notation | Description
---|---
(0/1) | Can have 0 or 1 instances of this node/attribute
(1) | Must have only 1 instance of this node/attribute
(0+) | Can have any number of instances of this node/attribute
(1+) | Can have 1 or more instances of this node/attribute
### CustomLayer Node and Sub-node Structure
`CustomLayer` node contains the entire configuration for a single custom
layer.
| Attribute Name |\# | Description |
|-----|-----|-----|
| `name` | (1) | The name of the layer type to be used. This name should be identical to the type used in the IR.|
| `type` | (1) | Must be `SimpleGPU`. |
| `version` | (1) | Must be `1`. |
**Sub-nodes**: `Kernel` (1), `Buffers` (1), `CompilerOptions` (0+),
`WorkSizes` (0/1)
### Kernel Node and Sub-node Structure
`Kernel` node contains all kernel source code configuration. No kernel
node structure exists.
**Sub-nodes**: `Source` (1+), `Define` (0+)
### Source Node and Sub-node Structure
`Source` node points to a single OpenCL source file.
| Attribute Name | \# ||
|-----|-----|-----|
| `filename` | (1) | Name of the file containing OpenCL source code. Notice that path is relative to your executable. Multiple source nodes will have their sources concatenated in order. |
**Sub-nodes**: None
### Define Node and Sub-node Structure
`Define` node configures a single `#&zwj;define` instruction to be added to
the sources during compilation (JIT).
| Attribute Name | \# | Description |
|------|-------|------|
| `name` | (1) | The name of the defined JIT. For static constants, this can include the value as well (taken as a string). |
| `param` | (0/1) | This parameter value is used as the value of this JIT definition. |
| `type` | (0/1) | The parameter type. Accepted values: `int`, `float`, and `int[]`, `float[]` for arrays. |
| `default` | (0/1) | The default value to be used if the specified parameters is missing from the layer in the IR. |
**Sub-nodes:** None
The resulting JIT has the following form:
`#&zwj;define [name] [type] [value/default]`.
### Buffers Node and Sub-node Structure
`Buffers` node configures all input/output buffers for the OpenCL entry
function. No buffers node structure exists.
**Sub-nodes:** `Data` (0+), `Tensor` (1+)
### Data Node and Sub-node Structure
`Data` node configures a single input with static data (for example,
weights or biases).
| Attribute Name | \# | Description |
|----|-----|------|
| `name` | (1) | Name of a blob attached to a layer in the IR |
| `arg-index` | (1) | 0-based index in the entry function arguments to be bound to |
**Sub-nodes**: None
### Tensor Node and Sub-node Structure
`Tensor` node configures a single input or output tensor.
| Attribute Name | \# | Description |
|------|-------|-------|
| `arg-index` | (1) | 0-based index in the entry function arguments to be bound to. |
| `type` | (1) | `input` or `output` |
| `port-index` | (1) | 0-based index in the layers input/output ports in the IR |
| `format` | (0/1) | Data layout declaration for the tensor. Accepted values: `BFYX`, `BYXF`, `YXFB`, `FYXB` (also in all lowercase). Default value: `BFYX` |
### CompilerOptions Node and Sub-node Structure
`CompilerOptions` node configures the compilation flags for the OpenCL
sources.
| Attribute Name | \# | Description |
|--------|-----|------|
| `options` | (1) | Options string to be passed to the OpenCL compiler |
**Sub-nodes**: None
### WorkSizes Node and Sub-node Structure
`WorkSizes` node configures the global/local work sizes to be used when
queuing the OpenCL program for execution.
| Attribute Name | \# | Description |
|-----|------|-----|
| `global`<br>`local` | (0/1)<br>(0/1) | An array of up to 3 integers (or formulas) for defining the OpenCL work-sizes to be used during execution.<br> The formulas can use the values of the B,F,Y,X dimensions and contain the operators: +,-,/,\*,% (all evaluated in integer arithmetic). <br>Default value: `global=”B*F*Y*X” local=””` |
| `dim` | (0/1) | A tensor to take the work size from. Accepted values: `input N`, `output`, where `N` is an index of input tensor starting with 0. Default value: `output` |
**Sub-nodes**: None
## Example Configuration File
The following code sample provides an example configuration file (in the
`.xml` format). For information on configuration file structure, see
[Configuration File Format](#config-file-format).
```xml
<CustomLayer name="ReLU" type="SimpleGPU" version="1">
<Kernel entry="example_relu_kernel">
<Source filename="custom_layer_kernel.cl"/>
<Define name="neg_slope" type="float" param="negative_slope" default="0.0"/>
</Kernel>
<Buffers>
<Tensor arg-index="0" type="input" port-index="0" format="BFYX"/>
<Tensor arg-index="1" type="output" port-index="0" format="BFYX"/>
</Buffers>
<CompilerOptions options="-cl-mad-enable"/>
<WorkSizes global="X,Y,B*F"/>
</CustomLayer>
```
## Built-In Defines for Custom Layers
The following table includes definitions that are attached before
the user sources, where `<TENSOR>` is the actual input and output, for
example, `INPUT0` or `OUTPUT0`.
For an example, see [Example Kernel](#example-kernel).
| Name | Value |
|---|---|
| `NUM_INPUTS` | Number of the input tensors bound to this kernel |
| `GLOBAL_WORKSIZE` | An array of global work sizes used to execute this kernel |
| `GLOBAL_WORKSIZE_SIZE` | The size of the `GLOBAL_WORKSIZE` array |
| `LOCAL_WORKSIZE` | An array of local work sizes used to execute this kernel |
| `LOCAL_WORKSIZE_SIZE` | The size of the `LOCAL_WORKSIZE` array |
| `<TENSOR>_DIMS`| An array of the tensor dimension sizes. Always ordered as `BFYX` |
| `<TENSOR>_DIMS_SIZE`| The size of the `<TENSOR>_DIMS` array.|
| `<TENSOR>_TYPE`| The datatype of the tensor: `float`, `half`, or `char`|
| `<TENSOR>_FORMAT_` | The format of the tensor, BFYX, BYXF, YXFB , FYXB, or ANY. The format is concatenated to the defined name. You can use the tensor format to define codepaths in your code with `#&zwj;ifdef/#&zwj;endif`. |
| `<TENSOR>_LOWER_PADDING` | An array of padding elements used for the tensor dimensions before they start. Always ordered as BFYX.|
| `<TENSOR>_ LOWER_PADDING_SIZE` | The size of the `<TENSOR>_LOWER_PADDING` array |
| `<TENSOR>_UPPER_PADDING` | An array of padding elements used for the tensor dimensions after they end. Always ordered as BFYX. |
| `<TENSOR>_UPPER_PADDING_SIZE` | The size of the `<TENSOR>_UPPER_PADDING` array |
| `<TENSOR>_PITCHES` | The number of elements between adjacent elements in each dimension. Always ordered as BFYX.|
| `<TENSOR>_PITCHES_SIZE`| The size of the `<TENSOR>_PITCHES` array |
| `<TENSOR>_OFFSET`| The number of elements from the start of the tensor to the first valid element (bypassing the lower padding) |
All `<TENSOR>` values are automatically defined for every tensor
bound to this layer (`INPUT0`, `INPUT1`, `OUTPUT0`, and so on), as shown
in the following for example:
```sh
#define INPUT0_DIMS_SIZE 4
#define INPUT0_DIMS (int []){ 1,96,55,55, }
```
## Example Kernel<a name="example-kernel"></a>
```c
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
__kernel void example_relu_kernel(
const __global INPUT0_TYPE* input0,
__global OUTPUT0_TYPE* output)
{
const uint idx = get_global_id(0);
const uint idy = get_global_id(1);
const uint idbf = get_global_id(2);//batches*features, as OpenCL supports 3D nd-ranges only
const uint feature = idbf%OUTPUT0_DIMS[1];
const uint batch = idbf/OUTPUT0_DIMS[1];
//notice that pitches are in elements, not in bytes!
const uint in_id = batch*INPUT0_PITCHES[0] + feature*INPUT0_PITCHES[1] + idy*INPUT0_PITCHES[2] + idx*INPUT0_PITCHES[3] + INPUT0_OFFSET;
const uint out_id = batch*OUTPUT0_PITCHES[0] + feature*OUTPUT0_PITCHES[1] + idy*OUTPUT0_PITCHES[2] + idx*OUTPUT0_PITCHES[3] + OUTPUT0_OFFSET;
INPUT0_TYPE value = input0[in_id];
//neg_slope (which is non-zero for leaky ReLU) is put automatically as #define, refer to the config xml
output[out_id] = value < 0 ? value * neg_slope : value;
}
```
> **NOTE:** As described in the previous section, all the things like
> `INPUT0_TYPE` are actually defined as OpenCL (pre-)compiler inputs by
> the Inference Engine for efficiency reasons. See [Debugging
> Tips](#debugging-tips) for information on debugging the results.
> **NOTE**: Several GPU-targeted kernels are also added to the binaries upon samples compilation
> so that the sample application can easy load them.
> Refer to the `cldnn_global_custom_kernels` folder in the GPU plugin installation directory.
## Debugging Tips<a name="debugging-tips"></a>
* **Dumping the Resulting Kernels**.
It is recommended to get a dump of the kernel with all of
the values set by the Inference Engine, such as tensor sizes,
floating-point, and integer kernel parameters. To get the dump, add the
following line to your code that configures the GPU plugin to output the
custom kernels:
```cpp
core.SetConfig({ { PluginConfigParams::KEY_DUMP_KERNELS, PluginConfigParams::YES } }, "GPU");
```
When the Inference Engine compiles the kernels for the specific network,
it also outputs the resulting code for the custom kernels. In the
directory of your executable, find files like
`clDNN_program0.cl`, `clDNN_program1.cl`. There are as many files as
distinct sets of parameters for your custom kernel: different input
tensor sizes and kernel parameters.
* **Using `printf` in the OpenCL™ Kernels**.
To debug the specific values, you can use `printf` in your kernels.
However, be careful: for instance, do not output excessively
as it would generate too much data. The `printf` output is typical, so
your output can be truncated to fit the buffer. Also, because of
buffering, you actually get an entire buffer of output when the
execution ends.<br>
For more information, refer to the [printf
Function](https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/printfFunction.html).

View File

@@ -0,0 +1,49 @@
# Inference Engine Extensibility Mechanism {#openvino_docs_IE_DG_Extensibility_DG_Intro}
Inference Engine Extensibility API allows to add support of custom operations to the Inference Engine.
Extension should contain operation sets with custom operations and execution kernels for custom operations.
Physically, an extension library can be represented as a dynamic library exporting the single `CreateExtension` function that allows to create a new extension instance.
Extensibility library can be loaded to the InferenceEngine::Core object using the InferenceEngine::Core::AddExtension method.
## Inference Engine Extension Library
Inference Engine Extension dynamic library contains several main components:
* [Extension class](Extension.md):
- Contains custom operation sets
- Provides CPU implementations for custom operations
* [Custom operations](Intro.md):
- Allows to use InferenceEngine::Core::ReadNetwork to read Intermediate Representation (IR) with unsupported operations
- Allows to create `ngraph::Function` with unsupported operations
- Provides shape inference mechanism for custom operations
> **NOTE**: This documentation is written based on the `Template extension`, which demonstrates extension
development details. Find the complete code of the `Template extension`, which is fully compilable and up-to-date,
at `<dldt source tree>/docs/template_extension`.
## Execution Kernels
The Inference Engine workflow involves the creation of custom kernels and either custom or existing operations.
An _Operation_ is a Network building block implemented in the training framework, for example, `Convolution` in Caffe*.
A _Kernel_ is defined as the corresponding implementation in the Inference Engine.
Refer to the [Custom Layers in the Model Optimizer](../../MO_DG/prepare_model/customize_model_optimizer/Customize_Model_Optimizer.md) section for details on how
mapping between framework layers and Inference Engine kernels is registered.
In short, you can plug your own kernel implementations into the Inference Engine and map them to the layers in the original framework.
The following pages describe how to integrate custom _kernels_ into the Inference Engine:
* [Introduction to development of custom CPU kernels](CPU_Kernel.md)
* [Introduction to development of custom GPU kernels](GPU_Kernel.md)
* [Introduction to development of custom VPU kernels](VPU_Kernel.md)
## Additional Resources
* [Build an extension library using CMake*](Building.md)
## See Also
* [Using Inference Engine Samples](../Samples_Overview.md)
* [Hello Shape Infer SSD sample](../../../inference-engine/samples/hello_reshape_ssd/README.md)

View File

@@ -0,0 +1,679 @@
# How to Implement Custom Layers for VPU (Intel® Neural Compute Stick 2) {#openvino_docs_IE_DG_Extensibility_DG_VPU_Kernel}
> **NOTE:** OpenCL™ custom layer support is available in the preview mode.
> **NOTE:** This section assumes you are familiar with developing kernels using OpenCL™.
To customize your topology with an OpenCL™ layer, follow the steps below:
1. Write and compile you OpenCL™ code with the standalone offline OpenCL™ compiler (`clc`).
2. Write a configuration file to bind the OpenCL™ kernel to the topology file (`.xml`) of the model IR.
3. Pass the configuration file to Inference engine with the model IR.
## Compile OpenCL™ code for VPU (Intel® Neural Compute Stick 2)
> **NOTE:** OpenCL compiler, targeting Intel® Neural Compute Stick 2 for the SHAVE* processor only, is redistributed with OpenVINO.
OpenCL support is provided by ComputeAorta*, and is distributed under a license agreement between Intel® and Codeplay* Software Ltd.
The OpenCL™ toolchain for the Intel® Neural Compute Stick 2 supports offline compilation only, so first compile OpenCL C code using the standalone `clc` compiler. You can find the compiler binary at `<INSTALL_DIR>/deployment_tools/tools/cl_compiler`.
> **NOTE:** By design, custom OpenCL layers support any OpenCL kernels written with 1.2 version assumed. It also supports half float
extension and is optimized for this type, because it is a native type for Intel® Movidius™ VPUs.
1. Prior to running a compilation, make sure that the following variables are set:
* `SHAVE_MA2X8XLIBS_DIR=<INSTALL_DIR>/deployment_tools/tools/cl_compiler/lib/`
* `SHAVE_LDSCRIPT_DIR=<INSTALL_DIR>/deployment_tools/tools/cl_compiler/ldscripts/`
* `SHAVE_MYRIAD_LD_DIR=<INSTALL_DIR>/deployment_tools/tools/cl_compiler/bin/`
* `SHAVE_MOVIASM_DIR=<INSTALL_DIR>/deployment_tools/tools/cl_compiler/bin/`
2. Run the compilation with the command below. You should use `--strip-binary-header` to make an OpenCL runtime-agnostic binary runnable with the Inference Engine.
```bash
cd <INSTALL_DIR>/deployment_tools/tools/cl_compiler/bin
./clc --strip-binary-header custom_layer.cl -o custom_layer.bin
```
## Write a Configuration File
To tie the topology IR for a layer you customize, prepare a configuration file, so that the Inference Engine can find parameters for your kernel and the execution work grid is described.
For example, given the following OpenCL kernel signature:
```cpp
__kernel void reorg_nhwc(__global const half *src, __global half *out, int w, int h, int c, int stride);
```
Configuration file for this kernel might be the following:
```xml
<CustomLayer name="ReorgYolo" type="MVCL" version="1">
<Kernel entry="reorg_nhwc">
<Source filename="reorg.bin"/>
</Kernel>
<Parameters>
<Tensor arg-name="src" type="input" port-index="0" format="BYXF"/>
<Tensor arg-name="out" type="output" port-index="0" format="BYXF"/>
<Scalar arg-name="w" type="int" port-index="0" source="I.X" />
<Scalar arg-name="h" type="int" port-index="0" source="I.Y" />
<Scalar arg-name="c" type="int" port-index="0" source="I.F" />
<Scalar arg-name="stride" type="int" source="stride" />
</Parameters>
<WorkSizes dim="input,0" global="(Y+7)/8*8,1,1" local="8,1,1"/>
</CustomLayer>
```
Each custom layer is described with the `CustomLayer` node. It has the following nodes and attributes:
- Root node `CustomLayer` contains the following attributes:
- `name` (Required) A name of the Inference Engine layer to bind the kernel with.
- `type` and `version` (Required) Reserved for future use. Set them to `MVCL` and `1` respectively.
- `max-shaves` (Optional) The maximum number of SHAVE cores that should be dedicated for the layer. It is useful for debugging concurrency issues or for resource saving if memory bound kernel does not scale well with the number of cores, so more resources can be left for the rest of a topology.
- Sub-node `Kernel` must contain the following attributes:
- `entry` A name of your kernel function as you defined it in a source file (in the example above, it is `reorg_nhwc`).
- Node `Source` must contain the following attributes:
- `filename` A path to a compiled binary relative to the `.xml` binding file.
- Sub-node `Parameters` Describes parameters bindings. For more information, see the description below.
- Sub-node `WorkSizes` Describes local and global work group sizes and the source for dimension deduction as a pair `direction,port`. In the example above, the work group is described relatively to the dimension of the input tensor that comes through port 0 in the IR. `global` and `local` work group configurations support any simple math expressions with +,-,\*,/, and () from `B`(batch), `Y`(height), `X`(width) and `F`(channels).
- Sub-node `Where` Allows to customize bindings with the `key="value"` attribute. For example, to substitute only 3x3 convolutions, write `<Where kernel="3,3"/>` in the binging xml.
Parameter description supports `Tensor` of one of tensor types such as `input`, `output`, `input_buffer`, `output_buffer` or `data`, `Scalar`, or `Data` nodes and has the following format:
- Each `Tensor` node of `input` or `output` type must contain the following attributes:
- `arg-name` A name of a kernel parameter in the kernel signature.
- `type` Node type: `input` or `output` as in the IR.
- `port-index` A number of input/output ports as in the IR.
- `format` The channel order in the tensor. Optional conversion layers are generated if the custom layer format is not compatible with formats of neighboring layers. `BFXY`, `BYXF`, and `ANY` formats are supported currently.
- Each `Tensor` node of `input_buffer` or `output_buffer` type must contain the following attributes:
- `arg-name` A name of a kernel parameter in the kernel signature.
- `type` Node type: `input_buffer` or `output_buffer`. Use the appropriate type to bind multiple kernels that correspond to different stages of the same layer.
- `port-index` The unique identifier to bind by.
- `dim` The dim source with the same `direction,port` format used for `WorkSizes` bindings.
- `size` Amount of bytes needed. Current expression syntax supports only expression over dimensions of over selected input/output tensor or constants and might be expended in the future.
Here is an example of multi-stage MVN layer binding:
```xml
<CustomLayer name="MVN" stage="0" type="MVCL" version="1">
<Kernel entry="reduction_mean">
<Source filename="mvn.bin"/>
</Kernel>
<Parameters>
<Tensor arg-name="src" type="input" port-index="0" format="BFYX"/>
<Tensor arg-name="mean" type="output_buffer" port-index="0" dim="output,0" size="Y*F*4"/>
<Tensor arg-name="variance" type="output_buffer" port-index="1" dim="output,0" size="Y*F*4"/>
<!--other parameters -->
</Parameters>
<WorkSizes dim="output,0" global="((Y+7)/8)*8,F,1" local="8,1,1"/>
</CustomLayer>
<CustomLayer name="MVN" stage="1" type="MVCL" version="1">
<Kernel entry="mvn_scale">
<Source filename="mvn_scale_changed_orded.bin"/>
</Kernel>
<Parameters>
<Tensor arg-name="src_data" type="input" port-index="0" format="BFYX"/>
<Tensor arg-name="dst_data" type="output" port-index="0" format="BFYX"/>
<Tensor arg-name="mean_part" type="input_buffer" port-index="0" dim="output,0" size="Y*F*4"/>
<Tensor arg-name="power_mean" type="input_buffer" port-index="1" dim="output,0" size="Y*F*4"/>
<!--other parameters -->
</Parameters>
<WorkSizes dim="output,0" global="((Y+7)/8)*8,F,1" local="8,1,1"/>
</CustomLayer>
```
- Each `Tensor` node that has the type `data` must contain the following attributes:
- `source` A name of the blob as it is in the IR (typical example is `weights` for convolution
- `format` Specifies the channel order in the tensor. Optional conversion layers are generated if the custom layer format is not.
```xml
<CustomLayer name="BinaryConvolution" type="MVCL" version="1">
<Kernel entry="binary_convolution">
<Source filename="binary_layers.bin"/>
</Kernel>
<Parameters>
<Tensor arg-name="src_data" type="input" port-index="0" format="BFYX"/>
<Data arg-name="weights_data" type="data" source="weights" format="ANY"/>
<Tensor arg-name="dst_data" type="output" port-index="0" format="BFYX"/>
<!--other parameters -->
</Parameters>
<WorkSizes dim="output,0" global="X,Y,F" local="1,1,1"/>
</CustomLayer>
```
- Each `Scalar` node must contain the following attributes:
- `arg-name` A name of a kernel parameter in the kernel signature.
- `type` `int` or `float` value. It is used for correct argument extraction from IR parameters.
- `source` Contains the name of the parameter in the IR file or input/output (`I`/`O`, `In`/`On`, where `n` is a port number)
followed by dimension `B`(batch), `Y`(height), `X`(width), or `F`(channels).
- Each `Data` node must contain the following attributes:
- `arg-name` A name of a kernel parameter in the kernel signature.
- `type` Node type. Currently, `local_data` is the only supported value, which defines buffer allocated in fast local on-chip memory. It is limited to 100K for all `__local` and
`__private` arrays defined inside the kernel as well as all `__local` parameters passed to the kernel. Please, consider that a manual-DMA extension requires double buffering.
If the custom layer is detected to run out of local memory, the inference fails.
- `dim` The dim source with the same `direction,port` format used for `WorkSizes` bindings.
- `size` Amount of bytes needed. The current expression syntax supports only expression over dimensions of over selected input/output tensor or constants and may be extended in the future.
The example binding below illustrates a kernel with two local buffers passed to the kernel.
```xml
<CustomLayer name="GRN" type="MVCL" version="1">
<Kernel entry="grn_NCHW">
<Source filename="grn.bin"/>
</Kernel>
<Parameters>
<Tensor arg-name="src_data" type="input" port-index="0" format="BFYX"/>
<Tensor arg-name="dst_data" type="output" port-index="0" format="BFYX"/>
<Data arg-name="src" type="local_data" dim="input,0" size="X*F*2" />
<Data arg-name="dst" type="local_data" dim="input,0" size="X*F*2" />
<Scalar arg-name="C" type="int" port-index="0" source="I.F" />
<Scalar arg-name="bias" type="float" source="bias" />
</Parameters>
<WorkSizes dim="input,0" global="X,Y,1" local="X,1,1"/>
</CustomLayer>
```
## Pass Configuration File to Inference Runtime
> **NOTE**: If both native and custom layer implementations are present, the custom kernel has a priority over the native one.
Before loading the network that features the custom layers, provide a separate configuration file and load it using the InferenceEngine::Core::SetConfig() method with the PluginConfigParams::KEY_CONFIG_FILE key and the configuration file name as a value:
```cpp
InferenceEngine::Core core;
// Load custom layers
core.SetConfig({ { InferenceEngine::PluginConfigParams::KEY_CONFIG_FILE, "<path to the xml file>" } }, "MYRIAD");
```
Optionally, set a path to a custom layers description with a pair of `VPU_CUSTOM_LAYERS` and `/path/to/your/customLayers.xml`
as a network configuration:
```cpp
InferenceEngine::Core core;
std::map<std::string, std::string> networkConfig;
config["VPU_CUSTOM_LAYERS"] = "/path/to/your/customLayers.xml";
// Load custom layers in network config
auto exeNetwork = core.LoadNetwork(cnnNetwork, "MYRIAD", networkConfig);
```
## Optimizing Kernels with OpenCL™ for VPU (Intel® Neural Compute Stick 2)
This section provides optimization guidelines on writing custom layers with OpenCL for VPU devices. Knowledge about general OpenCL
programming model and OpenCL kernel language is assumed and not a subject of this section. The OpenCL model mapping to VPU is described in the table below.
| OpenCL Model | VPU Mapping|
|-----|----|
| Device code | Executed on SHAVE cores |
| Private memory | Mapped to CMX internal memory, limited to 100KB per work group, valid only while the work group is executed |
| Local memory | Mapped to CMX internal memory, limited to 100KB per work group, valid only while the work group is executed |
| Global memory | Mapped to DDR, used to pass execution preserved parameters for inputs, outputs, and blobs |
| Work group | Executed on a single SHAVE core iterating over multiple work items |
Note that by the OpenCL specification, the work group execution order is not specified. This means that it is your
responsibility to ensure that race conditions among work groups are not introduced. Custom layer runtime spits evenly
work grid among available compute resources and executes them in an arbitrary order. This static scheduling approach works best if the load is evenly spread out across work groups, which is a typical case for Deep Learning kernels. The following guidelines are recommended to use for work group partitioning:
1. Split work evenly across work groups.
2. Adjust work group granularity to maintain equal workload for all compute codes.
3. Set the maximum number of cores (using the `max-shaves` attribute for the `CustomLayer` node). This keeps more resources for the rest of topology. It is also useful if the kernel scalability reached its limits, which may happen while optimizing memory bound kernels or kernels with poor parallelization.
4. Try an alternate data layout (`BFXY`/`BYXF`) for the kernel if it improves work group partitioning or data access patterns.
Consider full topology performance (not just specific layer boost) since data conversion layers would be automatically inserted
as appropriate.
Offline OpenCL compiler (`clc`) features automatic vectorization over `get_global_id(0)` usage, if uniform access is detected.
For example, the kernel below could be automatically vectorized:
```cpp
__kernel void cvtf32f16(__global float* restrict inImage, __global half* restrict outImage,
float scale, float bais)
{
int idx = get_global_id(0) + get_global_id(1) * get_global_size(0) + get_global_id(2) * get_global_size(0) * get_global_size(1);
outImage[idx] = convert_half(inImage[idx]*scale+bais);
}
```
However, this work-group based vectorizer (WGV) conflicts with the default LLVM vectorizer based on superword level parallelism
(SLP) for the current compiler version. Manual vectorization is recommended to provide the best performance for non-uniform code
patterns. WGV works if and only if vector types are not used in the code.
Here is a short list of optimization tips:
1. Help auto-vectorizer ensure non-aliasing pointers for kernel parameters by putting `restrict` where possible.
- This may give a performance boost, especially for kernels with unrolling, like `ocl_grn` from the example below.
- Place `restrict` markers for kernels with manually vectorized codes. In the `ocl_grn` kernel below, the unrolled version without `restrict` is up to 20% slower than the most optimal one, which combines unrolling and `restrict`.
2. Put `#&zwj;pragma unroll N` to your loop header. Since the compiler does not trigger unrolling by default, it is your responsibility to
annotate the code with pragmas as appropriate. The `ocl_grn` version with `#&zwj;pragma unroll 4` is up to 50% faster, most of which comes from unrolling the first loop, because LLVM, in general, is better in scheduling 3-stage loops (load-compute-store), while the fist loop
`variance += (float)(src_data[c*H*W + y*W + x] * src_data[c*H*W + y*W + x]);` is only 2-stage (load-compute). Please, pay
attention to unrolling such cases first. Unrolling factor is loop-dependent. Choose the smallest number that
still improves performance as an optimum between the kernel size and execution speed. For this specific kernel, changing the unroll factor from `4`to `6` results in the same performance, so unrolling factor equal to 4 is an optimum. For Intel® Neural Compute Stick 2, unrolling is conjugated with the automatic software pipelining for load, store, and compute stages:
```cpp
__kernel void ocl_grn(__global const half* restrict src_data, __global half* restrict dst_data, int C, float bias)
{
int x = get_global_id(0);
int W = get_global_size(0);
int y = get_global_id(1);
int H = get_global_size(1);
float variance = bias + 1e-9f;
#pragma unroll 4
for (int c = 0; c < C; c++)
variance += (float)(src_data[c*H*W + y*W + x] * src_data[c*H*W + y*W + x]);
variance = 1.f / native_sqrt(variance);
#pragma unroll 4
for (int c = 0; c < C; c++)
dst_data[c*H*W + y*W + x] = (half)((float)src_data[c*H*W + y*W + x] * variance);
}
```
To check the efficiency of WGV, you can compare performance of the kernel above with the kernel below, which is manually vectorized over width:
```cpp
__kernel void ocl_grn_line(__global const half* restrict src_data, __global half* restrict dst_data, int C, int W, float bias)
{
int y = get_global_id(1);
int H = get_global_size(1);
for (int x = 0; x < W/8; x++)
{
float8 variance = (float8)(bias+1e-9f);
#pragma unroll 4
for (int c = 0; c < C; c++)
{
__global const half8* restrict src_line = ((__global const half8 * restrict)(src_data + c*H*W + y*W));
half8 sh = src_line[x];
variance += convert_float8(sh*sh);
}
variance = 1.f/native_sqrt(variance);
#pragma unroll 4
for (int c = 0; c < C; c++)
{
__global const half8* restrict src_line = ((__global const half8 * restrict)(src_data + c*H*W + y*W));
__global half8* restrict dst_line = ((__global half8 * restrict)(dst_data + c*H*W + y*W));
dst_line[x] = convert_half8(convert_float8(src_line[x])*variance);
}
}
for (int x = W/8*8; x < W; x++)
{
float variance = bias+1e-9f;
#pragma unroll 4
for (int c = 0; c < C; c++)
variance += (float)(src_data[c*H*W + y*W + x]*src_data[c*H*W + y*W + x]);
variance = 1.f/native_sqrt(variance);
#pragma unroll 4
for (int c = 0; c < C; c++)
dst_data[c*H*W + y*W + x] = (float)src_data[c*H*W + y*W + x]*variance;
}
}
```
Both versions perform the same, but the second one has more complex code.
3. If it is easy to predict the work group size, you can also use the `reqd_work_group_size` kernel attribute to ask the compiler
to unroll the code up to local size of the work group. Please note that if the kernel is actually executed with the
different work group configuration, the result is undefined.
4. Prefer to use the `half` compute, if it keeps reasonable accuracy. 16-bit float is a native type for Intel® Neural Compute Stick 2, most of the functions `half_*` are mapped to a single hardware instruction.
Use the standard `native_*` function for the rest of types.
5. Prefer to use the `convert_half` function over `vstore_half` if conversion to 32-bit float is required. `convert_half` is mapped to a single hardware instruction. For the `cvtf32f16` kernel above, the line `outImage[idx] = convert_half(inImage[idx]*scale+bais);` is 8 times slower than the code with `vstore_half`.
6. Mind early exits. Early exit may be extremely costly for the current version of the `clc` compiler due to conflicts with the
auto-vectorizer. The generic advice would be to setup local size by `x` dimension equal to inputs or/and outputs width.
If it is impossible to define the work grid that exactly matches inputs or/and outputs to eliminate checks, for example,
`if (get_global_id(0) >= width) return`, use line-wise kernel variant with manual vectorization.
The kernel example below demonstrates the impact of early exits on kernel performance.
```cpp
// Initial version
__kernel void reorg(const __global half* restrict src, __global half* restrict out, int stride)
{
int w = get_global_id(0);
int W = get_global_size(0);
int h = get_global_id(1);
int H = get_global_size(1);
int c = get_global_id(2);
int C = get_global_size(2);
int C2 = C/(stride*stride);
int offset = c / C2;
int c2 = c - C2 * offset;
int H2 = H*stride;
int W2 = W*stride;
int h2 = h*stride + offset / stride;
int w2 = w*stride + offset - stride * (offset / stride);
out[W*H*c + W*h + w] = src[W2*H2*c2 + W2*h2 + w2];
}
```
This `reorg` kernel is auto-vectorizable, but an input for YOLO v2 topology is `NCHW=<1,64,26,26>` and it is not multiple of vector width (which is `8` for `half` data type). As a result, the Inference Engine does not select the auto-vectorized kernel.
To compare performance of auto-vectorized and scalar version of the kernel, change the input size to`NCHW=<1,64,26,32>`. This allows the auto-vectorized version to be selected by the Inference Engine and can give you about 30% uplift.
Since the auto-vectorized version is faster, it makes sense to enable it for the YOLO v2 topology input size by setting the local size multiple of vector (e.g. 32) and adjust global sizes accordingly. As a result, the execution work grid exceeds actual input dimension, so out-of-bound checks should be inserted. See the updated kernel version below:
```cpp
// Version with out-of-bound checks added
__kernel void reorg(const __global half* restrict src, __global half* restrict out, int W, int stride)
{
int w = get_global_id(0);
w = min(w, W-1);
int h = get_global_id(1);
int H = get_global_size(1);
int c = get_global_id(2);
int C = get_global_size(2);
int C2 = C/(stride*stride);
int offset = c / C2;
int c2 = c - C2 * offset;
int H2 = H*stride;
int W2 = W*stride;
int h2 = h*stride + offset / stride;
int w2 = w*stride + offset - stride * (offset / stride);
out[W*H*c + W*h + w] = src[W2*H2*c2 + W2*h2 + w2];
}
```
This code performs the same as the initial kernel above (scalar) due to branching overhead. If you replace min/max expression `w = min(w, W-1);` with `if (w >= W) return;`, runtime increases up to 2x against to code without branching (initial version).<br>
If branching is inevitable for your element-based kernel, it is recommended to change the scheme to line-based. See the kernel variant below:
```cpp
// Line-wise version
__kernel void reorg(const __global half* restrict src, __global half* restrict out, int H, int W, int stride)
{
int h = min((int)get_global_id(0), H-1);
int c = get_global_id(1);
int C = get_global_size(1);
int C2 = C/(stride*stride);
int offset = c / C2;
int c2 = c - C2 * offset;
int H2 = H*stride;
int W2 = W*stride;
for (int w = 0; w < W; ++w)
{
int h2 = h*stride + offset / stride;
int w2 = w*stride + offset - stride * (offset / stride);
out[W*H*c + W*h + w] = src[W2*H2*c2 + W2*h2 + w2];
}
}
```
This decreases the execution time up to 40% against the best performing vectorized kernel without early exits (initial version).
7. Reuse computations among work items by using line-based kernels or sharing values though `__local` memory.
8. Improve data access locality. Most of custom kernels are memory bound while convolution and fully connected layers are hardware-implemented. The code below demonstrates a further optimized version of the `reorg` kernel unrolled by `stride`:
```cpp
// Unrolled line-wise version
__kernel void reorg_unrolled_by_stride(const __global half* restrict src, __global half* restrict dst,
int H, int W, int stride)
{
int h = min((int)get_global_id(0), H-1);
int c2 = get_global_id(1);
int C2 = get_global_size(1);
int C = C2*stride*stride;
int H2 = H*stride;
int W2 = W*stride;
for (int stride_y = 0; stride_y < stride; stride_y++)
for (int stride_x = 0; stride_x < stride; stride_x++)
for (int w2 = 0, w = 0; w < W; w2 += stride, w++)
dst[W*H*C2*(stride_y*stride+stride_x) + W*H*c2 + W*h + w] = src[W2*H2*c2 + W2*h*stride + W2*stride_y + w2 + stride_x];
}
```
`scr` data in this case loaded only once. As the result, the cycle count drops up to 45% against the line-wise version.
9. Copy data from `__dlobal` to `__local` or `__private` memory if the data is accessed more than once. Access to
`__dlobal` memory is orders of magnitude slower than access to `__local`/`__private` due to statically scheduled pipeline, which
stalls completely on memory access without any prefetch. The same recommendation is applicable for scalar load/store
from/to a `__blobal` pointer since work-group copying could be done in a vector fashion.
10. Use a manual DMA extension. Local (on-chip) memory throughput is up to 24x higher than DDR throughput. Starting from OpenVINO™ 2020.1, VPU OpenCL features manual-DMA kernel extension to copy sub-tensor used by work group into local memory and performing compute without DDR evolved. Here is the simple GRN kernel implementation that runs over DDR. Local size is equal to (width of the input tensor, 1, 1) to define a large enough work group to get code automatically vectorized and unrolled, while global size is (width of the input tensor, height of the input tensor, 1):
```cpp
__kernel void grn_NCHW(
__global const half* restrict src_data,
__global half* restrict dst_data,
int C,
float bias)
{
float variance = bias + 1e-9f;
#pragma unroll 4
for (int c = 0; c < C; c++)
{
float val = (float) src_data[c*get_global_size(1)*get_global_size(0) + get_global_id(1)*get_global_size(0) + get_global_id(0)];
variance += val*val;
}
half hvariance = (half)(native_rsqrt((half)(variance/16.f))*0.25f);
#pragma unroll 4
for (int c = 0; c < C; c++)
{
dst_data[c*get_global_size(1)*get_global_size(0) + get_global_id(1)*get_global_size(0) + get_global_id(0)]
= src_data[c*get_global_size(1)*get_global_size(0) + get_global_id(1)*get_global_size(0) + get_global_id(0)] * hvariance;
}
}
```
This kernel can be rewritten to introduce special data binding `__dma_preload` and `__dma_postwrite intrinsics`. This means that instead of one kernel, a group of three kernels should be implemented: `kernelName`, `__dma_preload_kernelName` and `__dma_postwrite_kernelName`. `__dma_preload_kernelName` for a particular work group `n` is guaranteed to be executed before `n`-th work group itself, while `__dma_postwrite_kernelName` is guarantied to be executed after a corresponding work group. You can define one of those functions that are intended to be used to copy data from-to `__global` and `__local` memory. The syntactics requires exact functional signature match. The example below illustrates how to prepare your kernel for manual-DMA.
```cpp
__kernel void __dma_preload_grn_NCHW(
__global const half* restrict src,
__global half* restrict dst,
__local half* restrict local_src,
__local half* restrict local_dst,
int C,
float bias)
{
// ToDO: copy required piece of src tensor into local_src
}
__kernel void __dma_postwrite_grn_NCHW(
__global const half* restrict src,
__global half* restrict dst,
__local const half* restrict local_src,
__local half* restrict local_dst,
int C,
float bias)
{
// ToDO: copy back computed piece of local_dst into dst
}
__kernel void grn_NCHW(
__global const half* restrict src_data,
__global half* restrict dst_data,
__local half* restrict src,
__local half* restrict dst,
int C,
float bias)
{
// same as the example above
}
```
GRN kernel operates on channel-major tensors to compute average over full channel range and then normalizes input elements to produce the output.
As a part of manual DMA extension, a group of work group copy functions are introduced in addition to `async_work_group_copy`, which is also mapped to DMA call.
Here is the list of supported functions:
```cpp
// 2D sub-tensor copy
event_t WorkGroupDmaCreateStrideTransaction(
const local T *src,
global T *dst,
size_t src_width, // width of the line of source in bytes
size_t dst_width, // width of the line of destination in bytes
size_t src_stride, // stride between corresponding 2 consecutive lines of source in bytes
size_t dst_stride, // stride between corresponding 2 consecutive lines of destination in bytes
size_t size, // total number of bytes loaded for all lines from source to destination
event_t event) __OVERLOAD;
event_t WorkGroupDmaCreateStrideTransaction(
const global T *src,
local T *dst,
size_t src_width, // width of the line of source in bytes
size_t dst_width, // width of the line of destination in bytes
size_t src_stride, // stride between corresponding 2 consecutive lines of source in bytes
size_t dst_stride, // stride between corresponding 2 consecutive lines of destination in bytes
size_t size, // total number of bytes loaded for all lines from source to destination
event_t event) __OVERLOAD;
// 3D sub-tensor copy
event_t WorkGroupDmaCreate3DTransaction(
const local T *src,
global T *dst,
size_t src_width, // width of the line of source in bytes
size_t dst_width, // width of the line of destination in bytes
size_t src_stride, // stride between corresponding 2 consecutive lines of source in bytes
size_t dst_stride, // stride between corresponding 2 consecutive lines of destination in bytes
size_t num_planes, // number of planes to be copied
size_t src_plane_stride, // stride between corresponding 2 consecutive planes of source in bytes
size_t dst_plane_stride, // stride between corresponding 2 consecutive planes of destination in bytes
size_t size, // size of the loaded plane in bytes, analogues to the size in 2D case
event_t event) __OVERLOAD;
event_t WorkGroupDmaCreate3DTransaction(
const global T *src,
local T *dst,
size_t src_width, // width of the line of source in bytes
size_t dst_width, // width of the line of destination in bytes
size_t src_stride, // stride between corresponding 2 consecutive lines of source in bytes
size_t dst_stride, // stride between corresponding 2 consecutive lines of destination in bytes
size_t num_planes, // number of planes to be copied
size_t src_plane_stride, // stride between corresponding 2 consecutive planes of source in bytes
size_t dst_plane_stride, // stride between corresponding 2 consecutive planes of destination in bytes
size_t size, // size of the loaded plane in bytes, analogues to the size in 2D case
event_t event) __OVERLOAD;
```
where `T` can be `uchar`, `char`, `short`, `ushort`, `int`, `uint`, `long`, `ulong`, `half` or `float`.
Modified version of the GRN kernel could be the following:
```cpp
__kernel void __dma_preload_grn_NCHW(
__global const half* restrict src,
__global half* restrict dst,
__local half* restrict local_src,
__local half* restrict local_dst,
int C,
float bias)
{
WorkGroupDmaCreate3DTransaction(
src + get_group_id(0)*get_local_size(0)
+ get_group_id(1)*get_local_size(1)*get_global_size(0), // src
local_src, // dst
get_local_size(0) * sizeof(half), // src width
get_local_size(0) * sizeof(half), // dst width
get_global_size(0) * sizeof(half), // src stride
get_local_size(0) * sizeof(half), // dst stride
C, // num planes
get_global_size(0) * get_global_size(1) * sizeof(half), // src plane stride
get_local_size(0) * get_local_size(1) * sizeof(half), // dst plane stride
get_local_size(0) * get_local_size(1) * sizeof(half), // plane size
0);
}
__kernel void __dma_postwrite_grn_NCHW(
__global const half* restrict src,
__global half* restrict dst,
__local const half* restrict local_src,
__local half* restrict local_dst,
int C,
float bias)
{
WorkGroupDmaCreate3DTransaction(
local_dst, // src
dst + get_group_id(0)*get_local_size(0)
+ get_group_id(1)*get_local_size(1)*get_global_size(0), // dst
get_local_size(0) * sizeof(half), // src width
get_local_size(0) * sizeof(half), // dst width
get_local_size(0) * sizeof(half), // src stride
get_global_size(0) * sizeof(half), // dst stride
C, // num planes
get_local_size(0) * get_local_size(1) * sizeof(half), // src plane stride
get_global_size(0) * get_global_size(1) * sizeof(half), // dst plane stride
get_local_size(0) * get_local_size(1) * sizeof(half), // plane size
0);
}
__kernel void grn_NCHW(
__global const half* restrict src_data,
__global half* restrict dst_data,
__local half* restrict src,
__local half* restrict dst,
int C,
float bias)
{
float variance = bias + 1e-9f;
#pragma unroll 8
for (int c = 0; c < C; c++)
{
float val = (float) src[c*get_local_size(1)*get_local_size(0) + get_local_id(1)*get_local_size(0) + get_local_id(0)];
variance += val*val;
}
half hvariance = (half)(native_rsqrt((half)(variance/16.f))*0.25f);
#pragma unroll 8
for (int c = 0; c < C; c++)
{
dst[c*get_local_size(1)*get_local_size(0) + get_local_id(1)*get_local_size(0) + get_local_id(0)]
= src[c*get_local_size(1)*get_local_size(0) + get_local_id(1)*get_local_size(0) + get_local_id(0)] * hvariance;
}
}
```
Please note `get_local_size` and `get_local_id` usage inside the kernel. 21x speedup is expected for a kernel on enet-curbs setup since it was completely limited by memory usage.
An alternative method of using DMA is to use work item copy extension. Those functions are executed inside a kernel and requires work groups equal to single work item.
Here is the list of supported work item functions:
```cpp
item_dma_event_t WorkItemDmaCreateTransaction(
const global T *src,
private T *dst,
size_t size,
item_dma_event_t event) __OVERLOAD;
item_dma_event_t WorkItemDmaCreateTransaction(
const private T *src,
global T *dst,
size_t size,
item_dma_event_t event) __OVERLOAD;
item_dma_event_t WorkItemDmaCreateStrideTransaction(
const global T *src,
private T *dst,
size_t src_width,
size_t dst_width,
size_t src_stride,
size_t dst_stride,
size_t size,
item_dma_event_t event) __OVERLOAD;
item_dma_event_t WorkItemDmaCreateStrideTransaction(
const private T *src,
global T *dst,
size_t src_width,
size_t dst_width,
size_t src_stride,
size_t dst_stride,
size_t size,
item_dma_event_t event) __OVERLOAD;
item_dma_event_t WorkItemDmaCreate3DTransaction(
const global T *src,
private T *dst,
size_t src_width,
size_t dst_width,
size_t src_stride,
size_t dst_stride,
size_t num_planes,
size_t src_plane_stride,
size_t dst_plane_stride,
size_t size,
item_dma_event_t event) __OVERLOAD;
item_dma_event_t WorkItemDmaCreate3DTransaction(
const private T *src,
global T *dst,
size_t src_width,
size_t dst_width,
size_t src_stride,
size_t dst_stride,
size_t num_planes,
size_t src_plane_stride,
size_t dst_plane_stride,
size_t size,
item_dma_event_t event) __OVERLOAD;
```
where `T` can be `uchar`, `char`, `short`, `ushort`, `int`, `uint`, `long`, `ulong`, `half` or `float`.

View File

@@ -0,0 +1,43 @@
Using GPU Kernels Tuning {#openvino_docs_IE_DG_GPU_Kernels_Tuning}
======================
GPU Kernels Tuning allows you to tune models, so the heavy computational layers are configured to fit better into
hardware, which the tuning was done on. It is required to achieve best performance on GPU.
> **NOTE** Currently only convolution and fully connected layers undergo tuning process. It means that the performance boost depends on the amount of that layers in the model.
OpenVINO™ releases include the `<INSTALL_DIR>/inference_engine/bin/intel64/Release/cache.json` file with pretuned data for current state of the art models. It is highly recommended to do the
tuning for new kind of models, hardwares or drivers.
## Tuned data
GPU tuning data is saved in JSON format.
File's content is composed of 2 types of attributes and 1 type of value:
1. Execution units number - this attribute splits the content into different EU sections.
2. Hash - hashed tuned kernel data.
Key: Array with kernel name and kernel's mode index.
## Usage
---
You can activate Kernels Tuning process by setting `KEY_TUNING_MODE` flag to `TUNING_CREATE` and `KEY_TUNING_FILE` to `<"filename">` in a configuration map that is
passed to the plugin while loading a network.
This configuration modifies the behavior of the `ExecutableNetwork` object. Instead of standard network compilation, it will run the tuning process.
Please keep in mind that the tuning can be very time consuming. The bigger the network, the longer it will take.
File with tuned data is the result of this step.
> **NOTE** If a filename passed to `KEY_TUNING_FILE` points to existing tuned data and you are tuning a new model, then this file will be extended by new data. This allows you to extend existing `cache.json` provided in the OpenVINO™ release package.
The example below shows how to set and use the key files:
```cpp
Core ie;
ie.SetConfig({{ CONFIG_KEY(TUNING_MODE), CONFIG_VALUE(TUNING_CREATE) }}, "GPU");
ie.SetConfig({{ CONFIG_KEY(TUNING_FILE), "/path/to/tuning/file.json" }}, "GPU");
// Further LoadNetwork calls will use the specified tuning parameters
```
---
You can activate the inference with tuned data by setting `KEY_TUNING_MODE` flag to `TUNING_USE_EXISTING` and
`KEY_TUNING_FILE` flag to `<"filename">`.
GPU backend will process the content of the file during network compilation to configure the OpenCL kernels for the best performance.

87
docs/IE_DG/Glossary.md Normal file
View File

@@ -0,0 +1,87 @@
Glossary {#openvino_docs_IE_DG_Glossary}
=======
## Acronyms and Abbreviations
| Abbreviation | Description |
| :--- | :--- |
| API | Application Programming Interface |
| AVX | Advanced Vector Extensions |
| clDNN | Compute Library for Deep Neural Networks |
| CLI | Command Line Interface |
| CNN | Convolutional Neural Network |
| CPU | Central Processing Unit |
| CV | Computer Vision |
| DL | Deep Learning |
| DLDT | Intel(R) Deep Learning Deployment Toolkit |
| DLL | Dynamic Link Library |
| DNN | Deep Neural Networks |
| ELU | Exponential Linear rectification Unit |
| FCN | Fully Convolutional Network |
| FP | Floating Point |
| FPGA | Field-Programmable Gate Array |
| GCC | GNU Compiler Collection |
| GPU | Graphics Processing Unit |
| HD | High Definition |
| IE | Inference Engine |
| IR | Intermediate Representation |
| JIT | Just In Time |
| JTAG | Joint Test Action Group |
| LPR | License-Plate Recognition |
| LRN | Local Response Normalization |
| mAP | Mean Average Precision |
| Intel(R) MKL-DNN | Intel(R) Math Kernel Library Deep Neural Networks |
| MO | Model Optimizer |
| MVN | Mean Variance Normalization |
| NCDHW | Number of images, Channels, Depth, Height, Width |
| NCHW | Number of images, Channels, Height, Width |
| NHWC | Number of images, Height, Width, Channels |
| NMS | Non-Maximum Suppression |
| NN | Neural Network |
| NST | Neural Style Transfer |
| OD | Object Detection |
| OS | Operating System |
| PCI | Peripheral Component Interconnect |
| PReLU | Parametric Rectified Linear Unit |
| PSROI | Position Sensitive Region Of Interest |
| RCNN, R-CNN | Region-based Convolutional Neural Network |
| ReLU | Rectified Linear Unit |
| ROI | Region Of Interest |
| SDK | Software Development Kit |
| SSD | Single Shot multibox Detector |
| SSE | Streaming SIMD Extensions |
| USB | Universal Serial Bus |
| VGG | Visual Geometry Group |
| VOC | Visual Object Classes |
| WINAPI | Windows Application Programming Interface |
## Terms
Glossary of terms used in the Inference Engine
| Term | Description |
| :--- | :--- |
| Batch | Number of images to analyze during one call of infer. Maximum batch size is a property of the network and it is set before loading of the network to the plugin. In NHWC, NCHW and NCDHW image data layout representation, the N refers to the number of images in the batch |
| Blob | Memory container used for storing inputs, outputs of the network, weights and biases of the layers |
| Device (Affinitity) | A preferred Intel(R) hardware device to run the inference (CPU, GPU, FPGA, etc.) |
| Extensibility mechanism, Custom layers | The mechanism that provides you with capabilities to extend the Inference Engine and Model Optimizer so that they can work with topologies containing layers that are not yet supported |
| <code>ICNNNetwork</code> | An Interface of the Convolutional Neural Network that Inference Engine reads from IR. Consists of topology, weights and biases |
| <code>IExecutableNetwork</code> | An instance of the loaded network which allows the Inference Engine to request (several) infer requests and perform inference synchronously or asynchronously |
| <code>IInferRequest</code> | Interface that represents the end point of inference on the model loaded to the plugin and represented by executable network. Inputs are set here, outputs should be requested from this interface as well |
| <code>InferenceEngineProfileInfo</code> | Represents basic inference profiling information per layer |
| Inference Engine | A C++ library with a set of classes that you can use in your application to infer input data (images) and get the result |
| Inference Engine API | The basic default API for all supported devices, which allows you to load a model from Intermediate Representation, set input and output formats and execute the model on various devices |
| Inference Engine <code>Core<code> | Inference Engine Core is a software component that manages inference on certain Intel(R) hardware devices: CPU, GPU, MYRIAD, GNA, etc. |
| Layer catalog or Operations specification | A list of supported layers or operations and its parameters. Sets of supported layers are different for different plugins, please check the documentation on plugins to verify if the Inference Engine supports certain layer on the dedicated hardware |
| <code>Layout</code> | Image data layout refers to the representation of images batch. Layout shows a sequence of 4D or 5D tensor data in memory. A typical NCHW format represents pixel in horizontal direction, rows by vertical dimension, planes by channel and images into batch |
| <code>OutputsDataMap</code> | Structure which contains information about output precisions and layouts |
| Precision | Represents data precision. For example, FP32 is 32-bit floating point, FP16 is 16-bit floating point. Precision can be changed before loading the network to the plugin |
| <code>PreProcessInfo</code> | Class that represents input data for the network. It contains information about input precision, its layout, and pre-processing |
| <code>ResponseDesc</code> | Represents debug information for an error |
## See Also
* [Deep Learning Model Optimizer IR Operations Catalog](../ops/opset.md)
* [Inference Engine Memory primitives](Memory_primitives.md)
* [Terminology](supported_plugins/Supported_Devices.md)

View File

@@ -0,0 +1,49 @@
# Graph Debug Capabilities {#openvino_docs_IE_DG_Graph_debug_capabilities}
Inference Engine supports two different objects for a graph representation: the nGraph function and
CNNNetwork. Both representations provide an API to get detailed information about the graph structure.
## nGraph Function
To receive additional messages about applied graph modifications, rebuild the nGraph library with
the `-DNGRAPH_DEBUG_ENABLE=ON` option.
To visualize the nGraph function to the xDot format or to an image file, use the
`ngraph::pass::VisualizeTree` graph transformation pass:
```cpp
#include <ngraph/pass/visualize_tree.hpp>
std::shared_ptr<ngraph::Function> nGraph;
...
ngraph::pass::VisualizeTree("after.png").run_on_function(nGraph); // Visualize the nGraph function to an image
```
## CNNNetwork
To serialize the CNNNetwork to the Inference Engine Intermediate Representation (IR) format, use the
`CNNNetwork::serialize(...)` method:
```cpp
std::shared_ptr<ngraph::Function> nGraph;
...
CNNNetwork network(nGraph);
network.serialize("test_ir.xml", "test_ir.bin");
```
> **NOTE**: CNNNetwork created from the nGraph function might differ from the original nGraph
> function because the Inference Engine applies some graph transformation.
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*

View File

@@ -0,0 +1,102 @@
Introduction to Inference Engine Device Query API {#openvino_docs_IE_DG_InferenceEngine_QueryAPI}
===============================
This section provides a high-level description of the process of querying of different device properties and configuration values.
Refer to the [Hello Query Device Sample](../../inference-engine/samples/hello_query_device/README.md) sources and [Multi-Device Plugin guide](supported_plugins/MULTI.md) for example of using the Inference Engine Query API in user applications.
## Using the Inference Engine Query API in Your Code
The Inference Engine `Core` class provides the following API to query device information, set or get different device configuration properties:
* <code>InferenceEngine::Core::GetAvailableDevices</code> - Provides a list of available devices. If there are more than one instance of a specific device, the devices are enumerated with `.suffix` where `suffix` is a unique string identifier. The device name can be passed to all methods of the `InferenceEngine::Core` class that work with devices, for example `InferenceEngine::Core::LoadNetwork`.
* <code>InferenceEngine::Core::GetMetric</code> - Provides information about specific device.
<code>InferenceEngine::Core::GetConfig</code> - Gets the current value of a specific configuration key.
* <code>InferenceEngine::Core::SetConfig</code> - Sets a new value for the configuration key.
The `InferenceEngine::ExecutableNetwork` class is also extended to support the Query API:
* <code>InferenceEngine::ExecutableNetwork::GetMetric</code>
* <code>InferenceEngine::ExecutableNetwork::GetConfig</code>
* <code>InferenceEngine::ExecutableNetwork::SetConfig</code>
## Query API in the Core Class
### GetAvailableDevices
```cpp
InferenceEngine::Core core;
std::vector<std::string> availableDevices = ie.GetAvailableDevices();
```
The function returns list of available devices, for example:
```
MYRIAD.1.2-ma2480
MYRIAD.1.4-ma2480
FPGA.0
FPGA.1
CPU
GPU
...
```
Each device name can then be passed to:
* `InferenceEngine::Core::LoadNetwork` to load the network to a specific device.
* `InferenceEngine::Core::GetMetric` to get common or device specific metrics.
* All other methods of the `Core` class that accept `deviceName`.
### GetConfig()
The code below demonstrates how to understand whether `HETERO` device dumps `.dot` files with split graphs during the split stage:
```cpp
InferenceEngine::Core core;
bool dumpDotFile = core.GetConfig("HETERO", HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)).as<bool>();
```
For documentation about common configuration keys, refer to `ie_plugin_config.hpp`. Device specific configuration keys can be found in corresponding plugin folders.
### GetMetric()
* To extract device properties such as available device, device name, supported configuration keys, and others, use the `InferenceEngine::Core::GetMetric` method:
```cpp
InferenceEngine::Core core;
std::string cpuDeviceName = core.GetMetric("GPU", METRIC_KEY(FULL_DEVICE_NAME)).as<std::string>();
```
A returned value looks as follows: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`.
> **NOTE**: All metrics have specific type, which is specified during metric instantiation. The list of common device-agnostic metrics can be found in `ie_plugin_config.hpp`. Device specific metrics (for example, for `HDDL`, `MYRIAD` devices) can be found in corresponding plugin folders.
## Query API in the ExecutableNetwork Class
### GetMetric()
The method is used to get executable network specific metric such as `METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)`:
```cpp
InferenceEngine::Core core;
auto exeNetwork = core.LoadNetwork(network, "CPU");
auto nireq = exeNetwork.GetMetric(METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS)).as<unsigned int>();
```
Or the current temperature of `MYRIAD` device:
```cpp
InferenceEngine::Core core;
auto exeNetwork = core.LoadNetwork(network, "MYRIAD");
float temperature = exeNetwork.GetMetric(METRIC_KEY(DEVICE_THERMAL)).as<float>();
```
### GetConfig()
The method is used to get information about configuration values the executable network has been created with:
```cpp
InferenceEngine::Core core;
auto exeNetwork = core.LoadNetwork(network, "CPU");
auto ncores = exeNetwork.GetConfig(PluginConfigParams::KEY_CPU_THREADS_NUM).as<std::string>();
```
### SetConfig()
The only device that supports this method is [Multi-Device](supported_plugins/MULTI.md).

127
docs/IE_DG/Int8Inference.md Normal file
View File

@@ -0,0 +1,127 @@
# Low-Precision 8-bit Integer Inference {#openvino_docs_IE_DG_Int8Inference}
## Disclaimer
Inference Engine with low-precision 8-bit integer inference requires the following prerequisites to be satisfied:
- Inference Engine [CPU Plugin](supported_plugins/CPU.md) must be built with the Intel® Math Kernel Library (Intel® MKL) dependency. In the Intel® Distribution of OpenVINO™ it is
satisfied by default, this is mostly the requirement if you are using OpenVINO™ available in open source, because [open source version of OpenVINO™](https://github.com/openvinotoolkit/openvino) can be built with OpenBLAS* that is unacceptable if you want to use 8-bit integer inference.
- Intel® platforms that support at least one extension to x86 instruction set from the following list:
- Intel® Advanced Vector Extensions 512 (Intel® AVX-512)
- Intel® Advanced Vector Extensions 2.0 (Intel® AVX2)
- Intel® Streaming SIMD Extensions 4.2 (Intel® SSE4.2)
- A model must be quantized. To quantize the model, you can use the [Post-Training Optimization Tool](@ref pot_README) delivered with the Intel® Distribution of OpenVINO™ toolkit release package.
The 8-bit inference feature was validated on the following topologies:
* **Classification models:**
* Caffe\* DenseNet-121, DenseNet-161, DenseNet-169, DenseNet-201
* Caffe Inception v1, Inception v2, Inception v3, Inception v4
* Caffe YOLO v1 tiny, YOLO v3
* Caffe ResNet-50 v1, ResNet-101 v1, ResNet-152 v1, ResNet-269 v1
* Caffe ResNet-18
* Caffe MobileNet, MobileNet v2
* Caffe SE ResNeXt-50
* Caffe SqueezeNet v1.0, SqueezeNet v1.1
* Caffe VGG16, VGG19
* TensorFlow\* DenseNet-121, DenseNet-169
* TensorFlow Inception v1, Inception v2, Inception v3, Inception v4, Inception ResNet v2
* TensorFlow Lite Inception v1, Inception v2, Inception v3, Inception v4, Inception ResNet v2
* TensorFlow Lite MobileNet v1, MobileNet v2
* TensorFlow MobileNet v1, MobileNet v2
* TensorFlow ResNet-50 v1.5, ResNet-50 v1, ResNet-101 v1, ResNet-152 v1, ResNet-50 v2, ResNet-101 v2, ResNet-152 v2
* TensorFlow VGG16, VGG19
* TensorFlow YOLO v3
* MXNet\* CaffeNet
* MXNet DenseNet-121, DenseNet-161, DenseNet-169, DenseNet-201
* MXNet Inception v3, inception_v4
* MXNet Mobilenet, Mobilenet v2
* MXNet ResNet-101 v1, ResNet-152 v1, ResNet-101 v2, ResNet-152 v2
* MXNet ResNeXt-101
* MXNet SqueezeNet v1.1
* MXNet VGG16, VGG19
* **Object detection models:**
* Caffe SSD GoogLeNet
* Caffe SSD MobileNet
* Caffe SSD SqueezeNet
* Caffe SSD VGG16 300, SSD VGG16 512
* TensorFlow SSD MobileNet v1, SSD MobileNet v2
* MXNet SSD Inception v3 512
* MXNet SSD MobileNet 512
* MXNet SSD ResNet-50 512
* MXNet SSD VGG16 300
* ONNX\* SSD ResNet 34
* **Semantic segmentation models:**
* Unet2D
* **Recommendation system models:**
* NCF
## Introduction
A lot of investigation was made in the field of deep learning with the idea of using low precision computations during inference in order to boost deep learning pipelines and gather higher performance. For example, one of the popular approaches is to shrink the precision of activations and weights values from `fp32` precision to smaller ones, for example, to `fp11` or `int8`. For more information about this approach, refer to
**Brief History of Lower Precision in Deep Learning** section in [this whitepaper](https://software.intel.com/en-us/articles/lower-numerical-precision-deep-learning-inference-and-training).
8-bit computations (referred to as `int8`) offer better performance compared to the results of inference in higher precision (for example, `fp32`), because they allow loading more data into a single processor instruction. Usually the cost for significant boost is a reduced accuracy. However, it is proved that an accuracy drop can be negligible and depends on task requirements, so that the application engineer can set up the maximum accuracy drop that is acceptable.
Current Inference Engine solution for low-precision inference uses Intel MKL-DNN and supports inference of the following layers in 8-bit integer computation mode:
* Convolution
* FullyConnected
* ReLU
* ReLU6
* Reshape
* Permute
* Pooling
* Squeeze
* Eltwise
* Concat
* Resample
* MVN
This means that 8-bit inference can only be performed with the CPU plugin on the layers listed above. All other layers are executed in the format supported by the CPU plugin: 32-bit floating point format (`fp32`).
## Low-Precision 8-bit Integer Inference Workflow
For 8-bit integer computations, a model must be quantized. If the model is not quantized then you can use the [Post-Training Optimization Tool](@ref pot_README) to quantize the model. The quantization process adds `FakeQuantize` layers on activations and weights for most layers. Read more about mathematical computations under the hood in the [white paper](https://intel.github.io/mkl-dnn/ex_int8_simplenet.html).
8-bit inference pipeline includes two stages (also refer to the figure below):
1. *Offline stage*, or *model quantization*. During this stage, `FakeQuantize` layers are added before most layers to have quantized tensors before layers in a way that low-precision accuracy drop for 8-bit integer inference satisfies the specified threshold. The output of this stage is a quantized model. Quantized model precision is not changed, quantized tensors are in original precision range (`fp32`). `FakeQuantize` layer has `Quantization Levels` attribute whic defines quants count. Quants count defines precision which is used during inference. For `int8` range `Quantization Levels` attribute value has to be 255 or 256.
2. *Run-time stage*. This stage is an internal procedure of the [CPU Plugin](supported_plugins/CPU.md). During this stage, the quantized model is loaded to the plugin. The plugin updates each `FakeQuantize` layer on activations and weights to have `FakeQuantize` output tensor values in low precision range.
![int8_flow]
### Offline Stage: Model Quantization
To infer a layer in low precision and get maximum performance, the input tensor for the layer has to be quantized and each value has to be in the target low precision range. For this purpose, `FakeQuantize` layer is used in the OpenVINO™ intermediate representation file (IR). To quantize the model, you can use the [Post-Training Optimization Tool](@ref pot_README) delivered with the Intel® Distribution of OpenVINO™ toolkit release package.
When you pass the calibrated IR to the [CPU plugin](supported_plugins/CPU.md), the plugin automatically recognizes it as a quantized model and performs 8-bit inference. Note, if you pass a quantized model to another plugin that does not support 8-bit inference, the model is inferred in precision that this plugin supports.
### Run-Time Stage: Quantization
This is the second stage of the 8-bit integer inference. After you load the quantized model IR to a plugin, the pluing uses the `Low Precision Transformation` component to update the model to infer it in low precision:
* Updates `FakeQuantize` layers to have quantized output tensors in low precision range and add dequantization layers to compensate the update. Dequantization layers are pushed through as many layers as possible to have more layers in low precision. After that, most layers have quantized input tensors in low precision range and can be inferred in low precision. Ideally, dequantization layers should be fused in next `FakeQuantize` or `ScaleShift` layers.
* Weights are quantized and stored in `Const` layers.
* Biases are updated to avoid shifts in dequantization layers.
## Performance Counters
Information about layer precision is stored in the performance counters that are
available from the Inference Engine API. The layers have the following marks:
* Suffix `I8` for layers that had 8-bit data type input and were computed in 8-bit precision
* Suffix `FP32` for layers computed in 32-bit precision
For example, the performance counters table for the Inception model can look as follows:
```
inception_5b/5x5_reduce EXECUTED layerType: Convolution realTime: 417 cpu: 417 execType: gemm_blas_I8
inception_5b/output EXECUTED layerType: Concat realTime: 34 cpu: 34 execType: ref_I8
inception_5b/output_U8_nhw... EXECUTED layerType: Reorder realTime: 33092 cpu: 33092 execType: reorder_I8
inception_5b/output_oScale... EXECUTED layerType: ScaleShift realTime: 1390 cpu: 1390 execType: jit_avx2_FP32
inception_5b/output_oScale... EXECUTED layerType: Reorder realTime: 143 cpu: 143 execType: reorder_FP32
inception_5b/pool EXECUTED layerType: Pooling realTime: 59301 cpu: 59301 execType: ref_any_I8
```
The `execType` column of the table includes inference primitives with specific suffixes.
[int8_flow]: img/cpu_int8_flow.png

View File

@@ -0,0 +1,320 @@
Integrate the Inference Engine with Your Application {#openvino_docs_IE_DG_Integrate_with_customer_application_new_API}
===============================
This section provides a high-level description of the process of integrating the Inference Engine into your application.
Refer to the [Hello Classification Sample](../../inference-engine/samples/hello_classification/README.md) sources
for example of using the Inference Engine in applications.
> **NOTE**: For 2019 R2 Release, the new Inference Engine Core API is introduced. This guide is updated to reflect the new API approach.
> The Inference Engine Plugin API is still supported, but is going to be deprecated in future releases. Please, refer to [Migration from Inference Engine Plugin API to Core API](Migration_CoreAPI.md) guide to update your application.
## Use the Inference Engine API in Your Code
The core `libinference_engine.so` library implements loading and parsing a model Intermediate Representation (IR), and triggers inference using a specified device. The core library has the following API:
* `InferenceEngine::Core`
* `InferenceEngine::Blob`, `InferenceEngine::TBlob`,
`InferenceEngine::NV12Blob`
* `InferenceEngine::BlobMap`
* `InferenceEngine::InputsDataMap`, `InferenceEngine::InputInfo`,
* `InferenceEngine::OutputsDataMap`
C++ Inference Engine API wraps the capabilities of core library:
* `InferenceEngine::CNNNetwork`
* `InferenceEngine::ExecutableNetwork`
* `InferenceEngine::InferRequest`
## Integration Steps
Integration process includes the following steps:
![integration_process]
1) **Create Inference Engine Core** to manage available devices and read network objects:
```cpp
InferenceEngine::Core core;
```
2) **Read a model IR** created by the Model Optimizer (.xml is supported format):
```cpp
auto network = core.ReadNetwork("Model.xml");
```
**Or read the model from ONNX format** (.onnx and .prototxt are supported formats)
```cpp
auto network = core.ReadNetwork("model.onnx");
```
3) **Configure input and output**. Request input and output information using `InferenceEngine::CNNNetwork::getInputsInfo()`, and `InferenceEngine::CNNNetwork::getOutputsInfo()`
methods:
```cpp
/** Take information about all topology inputs **/
InferenceEngine::InputsDataMap input_info = network.getInputsInfo();
/** Take information about all topology outputs **/
InferenceEngine::OutputsDataMap output_info = network.getOutputsInfo();
```
Optionally, set the number format (precision) and memory layout for inputs and outputs. Refer to the
[Supported configurations](supported_plugins/Supported_Devices.md) chapter to choose the relevant configuration.
You can also allow input of any size. To do this, mark each input as resizable by setting a desired resize algorithm (e.g. `BILINEAR`) inside of the appropriate input info.
Basic color format conversions are supported as well. By default, the Inference Engine assumes
that the input color format is `BGR` and color format conversions are disabled. The Inference
Engine supports the following color format conversions:
* `RGB->BGR`
* `RGBX->BGR`
* `BGRX->BGR`
* `NV12->BGR`
where `X` is a channel that will be ignored during inference. To enable the conversions, set a
desired color format (for example, `RGB`) for each input inside of the appropriate input info.
If you want to run inference for multiple images at once, you can use the built-in batch
pre-processing functionality.
> **NOTE**: Batch pre-processing is not supported if input color format is set to `ColorFormat::NV12`.
You can use the following code snippet to configure input and output:
```cpp
/** Iterate over all input info**/
for (auto &item : input_info) {
auto input_data = item.second;
input_data->setPrecision(Precision::U8);
input_data->setLayout(Layout::NCHW);
input_data->getPreProcess().setResizeAlgorithm(RESIZE_BILINEAR);
input_data->getPreProcess().setColorFormat(ColorFormat::RGB);
}
/** Iterate over all output info**/
for (auto &item : output_info) {
auto output_data = item.second;
output_data->setPrecision(Precision::FP32);
output_data->setLayout(Layout::NC);
}
```
> **NOTE**: NV12 input color format pre-processing differs from other color conversions. In case of NV12,
> Inference Engine expects two separate image planes (Y and UV). You must use a specific
> `InferenceEngine::NV12Blob` object instead of default blob object and set this blob to
> the Inference Engine Infer Request using `InferenceEngine::InferRequest::SetBlob()`.
> Refer to [Hello NV12 Input Classification C++ Sample](../../inference-engine/samples/hello_nv12_input_classification/README.md)
> for more details.
If you skip this step, the default values are set:
* no resize algorithm is set for inputs
* input color format - `ColorFormat::RAW` meaning that input does not need color
conversions
* input and output precision - `Precision::FP32`
* input layout - `Layout::NCHW`
* output layout depends on number of its dimensions:
|Number of dimensions | 5 | 4 | 3 | 2 | 1 |
|:--------------------|-------|------|-----|----|----|
|Layout | NCDHW | NCHW | CHW | NC | C |
4) **Load the model** to the device using `InferenceEngine::Core::LoadNetwork()`:
```cpp
auto executable_network = core.LoadNetwork(network, "CPU");
```
It creates an executable network from a network object. The executable network is associated with single hardware device.
It is possible to create as many networks as needed and to use them simultaneously (up to the limitation of the hardware resources).
Third parameter is a configuration for plugin. It is map of pairs: (parameter name, parameter value). Choose device from
[Supported devices](supported_plugins/Supported_Devices.md) page for more details about supported configuration parameters.
```cpp
/** Optional config. E.g. this enables profiling of performance counters. **/
std::map<std::string, std::string> config = {{ PluginConfigParams::KEY_PERF_COUNT, PluginConfigParams::YES }};
auto executable_network = core.LoadNetwork(network, "CPU", config);
```
5) **Create an infer request**:
```cpp
auto infer_request = executable_network.CreateInferRequest();
```
6) **Prepare input**. You can use one of the following options to prepare input:
* **Optimal way for a single network.** Get blobs allocated by an infer request using `InferenceEngine::InferRequest::GetBlob()`
and feed an image and the input data to the blobs. In this case, input data must be aligned (resized manually) with a
given blob size and have a correct color format.
```cpp
/** Iterate over all input blobs **/
for (auto & item : inputInfo) {
auto input_name = item->first;
/** Get input blob **/
auto input = infer_request.GetBlob(input_name);
/** Fill input tensor with planes. First b channel, then g and r channels **/
...
}
```
* **Optimal way for a cascade of networks (output of one network is input for another).** Get output blob from the first
request using `InferenceEngine::InferRequest::GetBlob()` and set it as input for the second request using
`InferenceEngine::InferRequest::SetBlob()`.
```cpp
auto output = infer_request1->GetBlob(output_name);
infer_request2->SetBlob(input_name, output);
```
* **Optimal way to handle ROI (a ROI object located inside of input of one network is input for another).** It is
possible to re-use shared input by several networks. You do not need to allocate separate input blob for a network if
it processes a ROI object located inside of already allocated input of a previous network. For instance, when first
network detects objects on a video frame (stored as input blob) and second network accepts detected bounding boxes
(ROI inside of the frame) as input.
In this case, it is allowed to re-use pre-allocated input blob (used by first network) by second network and just crop
ROI without allocation of new memory using `InferenceEngine::make_shared_blob()` with passing of
`InferenceEngine::Blob::Ptr` and `InferenceEngine::ROI` as parameters.
```cpp
/** inputBlob points to input of a previous network and
cropROI contains coordinates of output bounding box **/
InferenceEngine::Blob::Ptr inputBlob;
InferenceEngine::ROI cropRoi;
...
/** roiBlob uses shared memory of inputBlob and describes cropROI
according to its coordinates **/
auto roiBlob = InferenceEngine::make_shared_blob(inputBlob, cropRoi);
infer_request2->SetBlob(input_name, roiBlob);
```
Make sure that shared input is kept valid during execution of each network. Otherwise, ROI blob may be corrupted if the
original input blob (that ROI is cropped from) has already been rewritten.
* Allocate input blobs of the appropriate types and sizes, feed an image and the input data to the blobs, and call
`InferenceEngine::InferRequest::SetBlob()` to set these blobs for an infer request:
```cpp
/** Iterate over all input blobs **/
for (auto & item : inputInfo) {
auto input_data = item->second;
/** Create input blob **/
InferenceEngine::TBlob<unsigned char>::Ptr input;
// assuming input precision was asked to be U8 in prev step
input = InferenceEngine::make_shared_blob<unsigned char, InferenceEngine::SizeVector>(InferenceEngine::Precision:U8, input_data->getDims());
input->allocate();
infer_request->SetBlob(item.first, input);
/** Fill input tensor with planes. First b channel, then g and r channels **/
...
}
```
A blob can be filled before and after `SetBlob()`.
> **NOTE:**
>
> * `SetBlob()` method compares precision and layout of an input blob with ones defined on step 3 and
> throws an exception if they do not match. It also compares a size of the input blob with input
> size of the read network. But if input was configured as resizable, you can set an input blob of
> any size (for example, any ROI blob). Input resize will be invoked automatically using resize
> algorithm configured on step 3. Similarly to the resize, color format conversions allow the color
> format of an input blob to differ from the color format of the read network. Color format
> conversion will be invoked automatically using color format configured on step 3.
>
> * `GetBlob()` logic is the same for pre-processable and not pre-processable input. Even if it is
> called with input configured as resizable or as having specific color format, a blob allocated by
> an infer request is returned. Its size and color format are already consistent with the
> corresponding values of the read network. No pre-processing will happen for this blob. If you
> call `GetBlob()` after `SetBlob()`, you will get the blob you set in `SetBlob()`.
7) **Do inference** by calling the `InferenceEngine::InferRequest::StartAsync` and `InferenceEngine::InferRequest::Wait`
methods for asynchronous request:
```cpp
infer_request->StartAsync();
infer_request.Wait(IInferRequest::WaitMode::RESULT_READY);
```
or by calling the `InferenceEngine::InferRequest::Infer` method for synchronous request:
```cpp
sync_infer_request->Infer();
```
`StartAsync` returns immediately and starts inference without blocking main thread, `Infer` blocks
main thread and returns when inference is completed.
Call `Wait` for waiting result to become available for asynchronous request.
There are three ways to use it:
* specify maximum duration in milliseconds to block for. The method is blocked until the specified timeout has elapsed,
or the result becomes available, whichever comes first.
* `InferenceEngine::IInferRequest::WaitMode::RESULT_READY` - waits until inference result becomes available
* `InferenceEngine::IInferRequest::WaitMode::STATUS_ONLY` - immediately returns request status.It does not
block or interrupts current thread.
Both requests are thread-safe: can be called from different threads without fearing corruption and failures.
Multiple requests for single `ExecutableNetwork` are executed sequentially one by one in FIFO order.
While request is ongoing, all its methods except `InferenceEngine::InferRequest::Wait` would throw an
exception.
8) Go over the output blobs and **process the results**.
Note that casting `Blob` to `TBlob` via `std::dynamic_pointer_cast` is not recommended way,
better to access data via `buffer()` and `as()` methods as follows:
```cpp
for (auto &item : output_info) {
auto output_name = item.first;
auto output = infer_request.GetBlob(output_name);
{
auto const memLocker = output->cbuffer(); // use const memory locker
// output_buffer is valid as long as the lifetime of memLocker
const float *output_buffer = memLocker.as<const float *>();
/** output_buffer[] - accessing output blob data **/
```
## Build Your Application
For details about building your application, refer to the CMake files for the sample applications.
All samples source code is located in the `<INSTALL_DIR>/openvino/inference_engine/samples` directory, where `INSTALL_DIR` is the OpenVINO™ installation directory.
### CMake project creation
1. **Create a structure** for the project:
``` sh
project/
├── CMakeLists.txt - CMake file to build
├── ... - Additional folders like includes/
└── src/ - source folder
└── main.cpp
build/ - build directory
...
```
2. **Include Inference Engine, nGraph and OpenCV libraries** in `project/CMakeLists.txt`
[OpenCV](https://docs.opencv.org/master/db/df5/tutorial_linux_gcc_cmake.html) integration is needed mostly for pre-processing input data and ngraph for more complex applications using [ngraph API](nGraph_Flow.md).
``` cmake
cmake_minimum_required(VERSION 3.0.0)
project(project_name)
find_package(ngraph REQUIRED)
find_package(InferenceEngine REQUIRED)
find_package(OpenCV REQUIRED)
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ${InferenceEngine_LIBRARIES} ${OpenCV_LIBS} ${NGRAPH_LIBRARIES})
```
3. **To build your project** using CMake with the default build tools currently available on your machine, execute the following commands:
> **NOTE**: Make sure **Set the Environment Variables** step in [OpenVINO Installation](../../inference-engine/samples/hello_nv12_input_classification/README.md) document is applied to your terminal, otherwise `InferenceEngine_DIR` and `OpenCV_DIR` variables won't be configured properly to pass `find_package` calls.
```sh
cd build/
cmake ../project
cmake --build .
```
It's allowed to specify additional build options (e.g. to build CMake project on Windows with a specific build tools). Please refer to the [CMake page](https://cmake.org/cmake/help/latest/manual/cmake.1.html#manual:cmake(1)) for details.
### Run Your Application
> **NOTE**: Before running, make sure you completed **Set the Environment Variables** section in [OpenVINO Installation](../../inference-engine/samples/hello_nv12_input_classification/README.md) document so that the application can find the libraries.
To run compiled applications on Microsoft* Windows* OS, make sure that Microsoft* Visual C++ 2017
Redistributable and Intel® C++ Compiler 2017 Redistributable packages are installed and
`<INSTALL_DIR>/bin/intel64/Release/*.dll` files are placed to the
application folder or accessible via `%PATH%` environment variable.
[integration_process]: img/integration_process.png
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*

View File

@@ -0,0 +1,99 @@
# Introduction to the Performance Topics {#openvino_docs_IE_DG_Intro_to_Performance}
This section is a shorter version of the
[Optimization Guide](supported_plugins/MULTI.md) for the Intel Deep Learning Deployment Toolkit.
## Precision
Inference precision directly affects the performance.
Model Optimizer can produce an IR with different precision. For example, float16 IR initially targets VPU and GPU devices, while, for example, the CPU can also execute regular float32.
Also, further device-specific inference precision settings are available, for example, [8-bit integer](Int8Inference.md) or [bfloat16](Bfloat16Inference.md) inference on the CPU.
Note that for [MULTI device](supported_plugins/MULTI.md) that supports automatic inference on multiple devices in parallel, you can use the FP16 IR.
You can find more information, including preferred data types for specific devices, in the
[Supported Devices](supported_plugins/Supported_Devices.md) section.
## Lowering Inference Precision
Default optimization is used for CPU and implies that inference is made with lower precision if it is possible on a given platform to reach better performance with acceptable range of accuracy.
This approach is used for CPU device if platform supports the AVX512_BF16 instruction. In this case, a regular float32 model is converted to [bfloat16](Bfloat16Inference.md) internal representation and inference is provided with bfloat16 layers usage.
Below is the example command line to disable this feature on the CPU device with the AVX512_BF16 instruction and execute regular float32.
```
$ benchmark_app -m <model.xml> -enforcebf16=false
```
## Latency vs. Throughput
One way to increase computational efficiency is batching, which combines many (potentially tens) of
input images to achieve optimal throughput. However, high batch size also comes with a
latency penalty. So, for more real-time oriented usages, lower batch sizes (as low as a single input) are used.
Refer to the [Benchmark App](../../inference-engine/samples/benchmark_app/README.md) sample, which allows latency vs. throughput measuring.
## Using Async API
To gain better performance on accelerators, such as VPU or FPGA, the Inference Engine uses the asynchronous approach (see
[Integrating Inference Engine in Your Application (current API)](Integrate_with_customer_application_new_API.md)).
The point is amortizing the costs of data transfers, by pipe-lining, see [Async API explained](@ref omz_demos_object_detection_demo_ssd_async_README).
Since the pipe-lining relies on the availability of the parallel slack, running multiple inference requests in parallel is essential.
Refer to the [Benchmark App](../../inference-engine/samples/benchmark_app/README.md) sample, which enables running a number of inference requests in parallel. Specifying different number of request produces different throughput measurements.
## Best Latency on the Multi-Socket CPUs
Note that when latency is of concern, there are additional tips for multi-socket systems.
When input is limited to the single image, the only way to achieve the best latency is to limit execution to the single socket.
The reason is that single image is simply not enough
to saturate more than one socket. Also NUMA overheads might dominate the execution time.
Below is the example command line that limits the execution to the single socket using numactl for the best *latency* value
(assuming the machine with 28 phys cores per socket):
```
limited to the single socket).
$ numactl -m 0 --physcpubind 0-27 benchmark_app -m <model.xml> -api sync -nthreads 28
```
Note that if you have more than one input, running as many inference requests as you have NUMA nodes (or sockets)
usually gives the same best latency as a single request on the single socket, but much higher throughput. Assuming two NUMA nodes machine:
```
$ benchmark_app -m <model.xml> -nstreams 2
```
Number of NUMA nodes on the machine can be queried via 'lscpu'.
Please see more on the NUMA support in the [Optimization Guide](supported_plugins/MULTI.md).
## Throughput Mode for CPU
Unlike most accelerators, CPU is perceived as an inherently latency-oriented device.
Since 2018 R5 release, the Inference Engine introduced the "throughput" mode, which allows the Inference Engine to efficiently run multiple inference requests on the CPU simultaneously, greatly improving the throughput.
Internally, the execution resources are split/pinned into execution "streams".
Using this feature gains much better performance for the networks that originally are not scaled well with a number of threads (for example, lightweight topologies). This is especially pronounced for the many-core server machines.
Run the [Benchmark App](../../inference-engine/samples/benchmark_app/README.md) and play with number of infer requests running in parallel, next section.
Try different values of the `-nstreams` argument from `1` to a number of CPU cores and find one that provides the best performance.
In addition to the number of streams, it is also possible to play with the batch size to find the throughput sweet-spot.
The throughput mode relaxes the requirement to saturate the CPU by using a large batch: running multiple independent inference requests in parallel often gives much better performance, than using a batch only.
This allows you to simplify the app-logic, as you don't need to combine multiple inputs into a batch to achieve good CPU performance.
Instead, it is possible to keep a separate infer request per camera or another source of input and process the requests in parallel using Async API.
## Benchmark App
[Benchmark App](../../inference-engine/samples/benchmark_app/README.md) sample is the best performance reference.
It has a lot of device-specific knobs, but the primary usage is as simple as:
```bash
$ ./benchmark_app d GPU m <model> -i <input>
```
to measure the performance of the model on the GPU.
Or
```bash
$ ./benchmark_app d CPU m <model> -i <input>
```
to execute on the CPU instead.
For example, for the CPU throughput mode from the previous section, you can play with number of streams (`-nstreams` command-line param).
Try different values of the `-nstreams` argument from `1` to a number of CPU cores and find one that provides the best performance. For example, on a 8-core CPU, compare the `-nstreams 1` (which is a latency-oriented scenario) to the `2`, `4` and `8` streams. Notice that `benchmark_app` automatically queries/creates/runs number of requests required to saturate the given number of streams.
Finally, notice that when you don't specify number of streams with `-nstreams`, "AUTO" value for the streams is used, e.g. for the CPU this is [CPU_THROUGHPUT_AUTO](supported_plugins/CPU.md). You can spot the actual value behind "AUTO" for your machine in the application output.
Notice that the "AUTO" number is not necessarily most optimal, so it is generally recommended to play either with the benchmark_app's "-nstreams" as described above, or via [new Workbench tool](@ref workbench_docs_Workbench_DG_Introduction).This allows you to simplify the app-logic, as you don't need to combine multiple inputs into a batch to achieve good CPU performance.
Instead, it is possible to keep a separate infer request per camera or another source of input and process the requests in parallel using Async API.
## Kernels Tuning for GPU
GPU backend comes with a feature, that allows models tuning, so the workload is configured to fit better into hardware.
Tuning is time consuming process, which internally execute every layer several (or even hundreds) times to find most performant configuration.
This configuration is saved into json-formatted file, whose name can be passed as plugin param to network. GPU backend will process this data to configure kernels for the best performance.
For more details about Kernels Tuning and How-To please refer to [GPU Kernels Tuning](GPU_Kernels_Tuning.md).

145
docs/IE_DG/Introduction.md Normal file
View File

@@ -0,0 +1,145 @@
# Introduction to Intel® Deep Learning Deployment Toolkit {#openvino_docs_IE_DG_Introduction}
## Deployment Challenges
Deploying deep learning networks from the training environment to embedded platforms for inference
might be a complex task that introduces a number of technical challenges that must be addressed:
* There are a number of deep learning frameworks widely used in the industry, such as Caffe*, TensorFlow*, MXNet*, Kaldi* etc.
* Typically the training of the deep learning networks is performed in data centers or server farms while the inference
might take place on embedded platforms, optimized for performance and power consumption. Such platforms are typically
limited both from software perspective (programming languages, third party dependencies, memory consumption,
supported operating systems), and from hardware perspective (different data types, limited power envelope),
so usually it is not recommended (and sometimes just impossible) to use original training framework for inference.
An alternative solution would be to use dedicated inference APIs that are well optimized for specific hardware platforms.
* Additional complications of the deployment process include supporting various layer types and networks that are getting
more and more complex. Obviously, ensuring the accuracy of the transforms networks is not trivial.
## Deployment Workflow
The process assumes that you have a network model trained using one of the [supported frameworks](#SupportedFW).
The scheme below illustrates the typical workflow for deploying a trained deep learning model:
![scheme]
The steps are:
1. [Configure Model Optimizer](../MO_DG/prepare_model/Config_Model_Optimizer.md) for the specific framework (used to train your model).
2. Run [Model Optimizer](#MO) to produce an optimized [Intermediate Representation (IR)](../MO_DG/IR_and_opsets.md)
of the model based on the trained network topology, weights and biases values, and other optional parameters.
3. Test the model in the IR format using the [Inference Engine](#IE) in the target environment with provided
[Inference Engine sample applications](Samples_Overview.md).
4. [Integrate Inference Engine](Integrate_with_customer_application_new_API.md) in your application to deploy the model in the target environment.
## Model Optimizer <a name = "MO"></a>
Model Optimizer is a cross-platform command line tool that facilitates the transition between the training and
deployment environment, performs static model analysis and automatically adjusts deep learning
models for optimal execution on end-point target devices.
Model Optimizer is designed to support multiple deep learning [supported frameworks and formats](#SupportedFW).
While running Model Optimizer you do not need to consider what target device you wish to use, the same output of the MO can be used in all targets.
### Model Optimizer Workflow
The process assumes that you have a network model trained using one of the [supported frameworks](#SupportedFW).
The Model Optimizer workflow can be described as following:
* [Configure Model Optimizer](../MO_DG/prepare_model/Config_Model_Optimizer.md) for one of the supported deep learning framework that was used to train the model.
* Provide as input a trained network that contains a certain network topology, and the adjusted weights and
biases (with some optional parameters).
* [Run Model Optimizer](../MO_DG/prepare_model/convert_model/Converting_Model.md) to perform specific model optimizations (for example, horizontal fusion of certain network layers). Exact optimizations
are framework-specific, refer to appropriate documentation pages: [Converting a Caffe Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_Caffe.md),
[Converting a TensorFlow Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_TensorFlow.md), [Converting a MXNet Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_MxNet.md), [Converting a Kaldi Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_Kaldi.md),
[Converting an ONNX Model](../MO_DG/prepare_model/convert_model/Convert_Model_From_ONNX.md).
* Model Optimizer produces as output an [Intermediate Representation (IR)](../MO_DG/IR_and_opsets.md) of the network which is used as an input for the Inference Engine on all targets.
### Supported Frameworks and Formats <a name = "SupportedFW"></a>
* Caffe* (most public branches)
* TensorFlow*
* MXNet*
* Kaldi*
* ONNX*
### Supported Models
For the list of supported models refer to the framework or format specific page:
* [Supported Caffe* models](../MO_DG/prepare_model/convert_model/Convert_Model_From_Caffe.md)
* [Supported TensorFlow* models](../MO_DG/prepare_model/convert_model/Convert_Model_From_TensorFlow.md)
* [Supported MXNet* models](../MO_DG/prepare_model/convert_model/Convert_Model_From_MxNet.md)
* [Supported ONNX* models](../MO_DG/prepare_model/convert_model/Convert_Model_From_ONNX.md)
* [Supported Kaldi* models](../MO_DG/prepare_model/convert_model/Convert_Model_From_Kaldi.md)
## Intermediate Representation
Intermediate representation describing a deep learning model plays an important role connecting the OpenVINO&trade; toolkit components.
The IR is a pair of files:
* `.xml`: The topology file - an XML file that describes the network topology
* `.bin`: The trained data file - a .bin file that contains the weights and biases binary data
Intermediate Representation (IR) files can be read, loaded and inferred with the [Inference Engine](#IE).
Inference Engine API offers a unified API across a number of [supported Intel® platforms](#SupportedTargets).
IR is also consumed, modified and written by Post-Training Optimization Tool which provides quantization capabilities.
Refer to a dedicated description about [Intermediate Representation and Operation Sets](../MO_DG/IR_and_opsets.md) for further details.
## nGraph Integration
OpenVINO toolkit is powered by nGraph capabilities for Graph construction API, Graph transformation engine and Reshape.
nGraph Function is used as an intermediate representation for a model in the run-time underneath the CNNNetwork API.
The conventional representation for CNNNetwork is still available if requested for backward compatibility when some conventional API methods are used.
Please refer to the [Overview of nGraph Flow](nGraph_Flow.md) describing the details of nGraph integration into the Inference Engine and co-existence with the conventional representation.
**Deprecation Notice**
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*
## Inference Engine <a name = "IE"></a>
Inference Engine is a runtime that delivers a unified API to integrate the inference with application logic:
* Takes as input the model. The model presented in the specific form of [Intermediate Representation (IR)](../MO_DG/IR_and_opsets.md)
produced by Model Optimizer.
* Optimizes inference execution for target hardware.
* Delivers inference solution with reduced footprint on embedded inference platforms.
The Inference Engine supports inference of multiple image classification networks,
including AlexNet, GoogLeNet, VGG and ResNet families of networks, fully convolutional networks like FCN8 used for image
segmentation, and object detection networks like Faster R-CNN.
For the full list of supported hardware, refer to the
[Supported Devices](supported_plugins/Supported_Devices.md) section.
For Intel® Distribution of OpenVINO™ toolkit, the Inference Engine package contains [headers](files.html), runtime libraries, and
[sample console applications](Samples_Overview.md) demonstrating how you can use
the Inference Engine in your applications.
The open source version is available in the [OpenVINO™ toolkit GitHub repository](https://github.com/openvinotoolkit/openvino) and can be built for supported platforms using the <a href="https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md">Inference Engine Build Instructions</a>.
## See Also
- [Inference Engine Samples](Samples_Overview.md)
- [Intel&reg; Deep Learning Deployment Toolkit Web Page](https://software.intel.com/en-us/computer-vision-sdk)
[scheme]: img/workflow_steps.png
#### Optimization Notice
<sup>For complete information about compiler optimizations, see our [Optimization Notice](https://software.intel.com/en-us/articles/optimization-notice#opt-en).</sup>

View File

@@ -0,0 +1,58 @@
# Known Issues and Limitations {#openvino_docs_IE_DG_Known_Issues_Limitations}
## Multiple OpenMP Loadings
If the application uses the Inference Engine with third-party components that depend on Intel OpenMP, multiple loadings of the libiomp library may occur and cause OpenMP runtime initialization conflicts. This may happen, for example, if the application uses Intel® Math Kernel Library (Intel® MKL) through the “Single Dynamic Library” (<code>libmkl_rt.so</code>) mechanism and calls Intel MKL after loading the Inference Engine plugin.
The error log looks as follows:
```sh
OMP: Error #15: Initializing libiomp5.so, but found libiomp5.so already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
```
Possible workarounds:
* Preload the OpenMP runtime using the <code>LD_PRELOAD</code> variable:
```sh
LD_PRELOAD=<path_to_libiomp5.so> <path_to your_executable>
```
This eliminates multiple loadings of libiomp, and makes all the components use this specific version of OpenMP.
* Alternatively, you can set <code>KMP_DUPLICATE_LIB_OK=TRUE</code>. However, performance degradation or results incorrectness may occur in this case.
## Old proto compiler breaks protobuf library
With python protobuf library version 3.5.1 the following incompatibility can happen.
The known case is for Cent OS 7.4
The error log looks as follows:
```sh
File "../lib64/python3.5/site-packages/google/protobuf/descriptor.py", line 829, in _new_
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: expected bytes, str found
```
Possible workaround is to upgrade default protobuf compiler (libprotoc 2.5.0) to newer version, for example
libprotoc 2.6.1.
[protobuf_issue]: https://github.com/google/protobuf/issues/4272
## Dynamic batching
Refer to the **Limitations** section of [Dynamic batching page](DynamicBatching.md)
## Static Shape Infer
Refer to the **Limitations** section of [Static Shape Infer page](ShapeInference.md)
## Image Pre-Processing Performance Optimization Issue
As described in [documentation for new API](Integrate_with_customer_application_new_API.md), you can set an image blob of any size to an
infer request using resizable input. Resize is executed during inference using configured resize algorithm.
But currently resize algorithms are not completely optimized. So expect performance degradation if resizable input is
specified and an input blob (to be resized) is set (`SetBlob()` is used). Required performance is met for
[CPU](supported_plugins/CPU.md) plugin only (because enabled openMP* provides parallelism).
Another limitation is that currently, resize algorithms support NCHW layout only. So if you set NHWC layout for an input
blob, NHWC is converted to NCHW before resize and back to NHWC after resize.

View File

@@ -0,0 +1,12 @@
# Legal Information {#openvino_docs_IE_DG_Legal_Information}
<sup>No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.</sup><br/>
<sup>Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.</sup><br/>
<sup>This document contains information on products, services and/or processes in development. All information provided here is subject to change without notice. Contact your Intel representative to obtain the latest forecast, schedule, specifications and roadmaps.</sup><br/>
<sup>The products and services described may contain defects or errors known as errata which may cause deviations from published specifications. Current characterized errata are available on request.</sup><br/>
<sup>Copies of documents which have an order number and are referenced in this document may be obtained by calling 1-800-548-4725 or by visiting [<b>www.intel.com/design/literature.htm</b>](http://www.intel.com/design/literature.htm).</sup><br/>
<sup>Intel, Intel logo, Intel Core, VTune, Xeon are trademarks of Intel Corporation in the U.S. and other countries.</sup><br/>
<sup>\* Other names and brands may be claimed as the property of others.</sup><br/>
<sup>Copyright © 2016-2018 Intel Corporation.</sup><br/>
<sup>This software and the related documents are Intel copyrighted materials, and your use of them is governed by the express license under which they were provided to you (License). Unless the License provides otherwise, you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related documents without Intel's prior written permission.</sup><br/>
<sup>This software and the related documents are provided as is, with no express or implied warranties, other than those that are expressly stated in the License.</sup><br/>

View File

@@ -0,0 +1,55 @@
Inference Engine Memory primitives {#openvino_docs_IE_DG_Memory_primitives}
=====================================================================
## Blobs
<code>InferenceEngine::Blob</code> is the main class intended for working with memory.
Using this class you can read and write memory, get information about the memory structure etc.
The right way to create <code>Blob</code> objects with a specific layout is to use constructors with <code>InferenceEngine::TensorDesc</code>.
<pre class="brush:cpp">
InferenceEngige::TensorDesc tdesc(FP32, {1, 3, 227, 227}, InferenceEngine::Layout::NCHW);
InferenceEngine::Blob::Ptr blob = InferenceEngine::make_shared_blob<float>(tdesc);
</pre>
## Layouts
<code>InferenceEngine::TensorDesc</code> is a special class that provides layout format description.
This class allows to create planar layouts using the standard formats (like <code>InferenceEngine::Layout::NCDHW</code>, <code>InferenceEngine::Layout::NCHW</code>, <code>InferenceEngine::Layout::NC</code>, <code>InferenceEngine::Layout::C</code> and etc) and also non-planar layouts using <code>InferenceEngine::BlockingDesc</code>.
In order to create a complex layout you should use <code>InferenceEngine::BlockingDesc</code> which allows to define the blocked memory with offsets and strides.
## Examples
1. You can define a blob with dimensions {N: 1, C: 25, H: 20, W: 20} and format NHWC with using next parameters:<br/>
<pre class="brush:cpp">
InferenceEngine::BlockingDesc({1, 20, 20, 25}, {0, 2, 3, 1}); // or
InferenceEngine::BlockingDesc({1, 20, 20, 25}, InferenceEngine::Layout::NHWC);
</pre>
2. If you have a memory with real dimensions {N: 1, C: 25, H: 20, W: 20} but with channels which are blocked by 8, you can define it using next parameters:<br/>
<pre class="brush:cpp">
InferenceEngine::BlockingDesc({1, 4, 20, 20, 8}, {0, 1, 2, 3, 1})
</pre>
3. Also you can set strides and offsets if layout contains it.
4. If you have a complex blob layout and you don't want to calculate the real offset to data you can use methods
<code>InferenceEngine::TensorDesc::offset(size_t l)</code> or <code>InferenceEngine::TensorDesc::offset(SizeVector v)</code>.<br/>
For example:
<pre class="brush:cpp">
InferenceEngine::BlockingDesc blk({1, 4, 20, 20, 8}, {0, 1, 2, 3, 1});
InferenceEngine::TensorDesc tdesc(FP32, {1, 25, 20, 20}, blk);
tdesc.offset(0); // = 0
tdesc.offset(1); // = 8
tdesc.offset({0, 0, 0, 2}); // = 16
tdesc.offset({0, 1, 0, 2}); // = 17
</pre>
5. If you would like to create a TensorDesc with a planar format and for N dimensions (N can be different 1, 2, 4 and etc), you can use the method
<code>InferenceEngine::TensorDesc::getLayoutByDims</code>.
<pre class="brush:cpp">
InferenceEngine::TensorDesc::getLayoutByDims({1}); // InferenceEngine::Layout::C
InferenceEngine::TensorDesc::getLayoutByDims({1, 2}); // InferenceEngine::Layout::NC
InferenceEngine::TensorDesc::getLayoutByDims({1, 2, 3, 4}); // InferenceEngine::Layout::NCHW
InferenceEngine::TensorDesc::getLayoutByDims({1, 2, 3}); // InferenceEngine::Layout::BLOCKED
InferenceEngine::TensorDesc::getLayoutByDims({1, 2, 3, 4, 5}); // InferenceEngine::Layout::NCDHW
InferenceEngine::TensorDesc::getLayoutByDims({1, 2, 3, 4, 5, ...}); // InferenceEngine::Layout::BLOCKED
</pre>

View File

@@ -0,0 +1,77 @@
Migration from Inference Engine Plugin API to Core API {#openvino_docs_IE_DG_Migration_CoreAPI}
===============================
For 2019 R2 Release, the new Inference Engine Core API is introduced. This guide is updated to reflect the new API approach. The Inference Engine Plugin API is still supported, but is going to be deprecated in future releases.
This section provides common steps to migrate your application written using the Inference Engine Plugin API (`InferenceEngine::InferencePlugin`) to the Inference Engine Core API (`InferenceEngine::Core`).
To learn how to write a new application using the Inference Engine, refer to [Integrate the Inference Engine Request API with Your Application](Integrate_with_customer_application_new_API.md) and [Inference Engine Samples Overview](Samples_Overview.md).
## Inference Engine Core Class
The Inference Engine Core class is implemented on top existing Inference Engine Plugin API and handles plugins internally.
The main responsibility of the `InferenceEngine::Core` class is to hide plugin specifics inside and provide a new layer of abstraction that works with devices (`InferenceEngine::Core::GetAvailableDevices`). Almost all methods of this class accept `deviceName` as an additional parameter that denotes an actual device you are working with. Plugins are listed in the `plugins.xml` file, which is loaded during constructing `InferenceEngine::Core` objects:
```bash
<ie>
<plugins>
<plugin name="CPU" location="libMKLDNNPlugin.so">
</plugin>
...
</ie>
```
## Migration Steps
Common migration process includes the following steps:
1. Migrate from the `InferenceEngine::InferencePlugin` initialization:
```cpp
InferenceEngine::InferencePlugin plugin = InferenceEngine::PluginDispatcher({ FLAGS_pp }).getPluginByDevice(FLAGS_d);
```
to the `InferenceEngine::Core` class initialization:
```cpp
InferenceEngine::Core core;
```
2. Instead of using `InferenceEngine::CNNNetReader` to read IR:
```cpp
CNNNetReader network_reader;
network_reader.ReadNetwork(fileNameToString(input_model));
network_reader.ReadWeights(fileNameToString(input_model).substr(0, input_model.size() - 4) + ".bin");
CNNNetwork network = network_reader.getNetwork();
```
read networks using the Core class:
```cpp
CNNNetwork network = core.ReadNetwork(input_model);
```
The Core class also allows reading models from ONNX format:
```cpp
CNNNetwork network = core.ReadNetwork("model.onnx");
```
3. Instead of adding CPU device extensions to the plugin:
```cpp
plugin.AddExtension(std::make_shared<Extensions::Cpu::CpuExtensions>());
```
add extensions to CPU device using the Core class:
```cpp
core.AddExtension(std::make_shared<Extensions::Cpu::CpuExtensions>(), "CPU");
```
4. Instead of setting configuration keys to a particular plugin, set (key, value) pairs via `InferenceEngine::Core::SetConfig`
```cpp
core.SetConfig({{PluginConfigParams::KEY_CONFIG_FILE, FLAGS_c}}, "GPU");
```
> **NOTE**: If `deviceName` is omitted as the last argument, configuration is set for all Inference Engine devices.
5. Migrate from loading the network to a particular plugin:
```cpp
auto execNetwork = plugin.LoadNetwork(network, { });
```
to `InferenceEngine::Core::LoadNetwork` to a particular device:
```cpp
auto execNetwork = core.LoadNetwork(network, deviceName, { });
```
After you have an instance of `InferenceEngine::ExecutableNetwork`, all other steps are as usual.

View File

@@ -0,0 +1,118 @@
# ONNX* Importer API Tutorial {#openvino_docs_IE_DG_OnnxImporterTutorial}
> **NOTE**: This tutorial is deprecated. Since OpenVINO™ 2020.4 version, Inference Engine enables reading ONNX models via the Inference Engine Core API
> and there is no need to use directly the low-level ONNX* Importer API anymore.
> To read ONNX\* models, it's recommended to use the `Core::ReadNetwork()` method that provide a uniform way to read models from IR or ONNX format.
This tutorial demonstrates how to use the ONNX\* Importer API.
This API makes it possible to create an nGraph `Function` object from an imported ONNX model.
All functions of the ONNX Importer API are in the [onnx.hpp][onnx_header] header file.
Two categories of API functions:
* Helper functions that check which ONNX ops are supported in a current version of the ONNX Importer
* Functions that read ONNX models from a stream or file and result in an nGraph function, which can be executed using the Inference Engine
## Check Which ONNX Ops Are Supported
To list all supported ONNX ops in a specific version and domain, use the `get_supported_operators`
as shown in the example below:
```cpp
const std::int64_t version = 12;
const std::string domain = "ai.onnx";
const std::set<std::string> supported_ops = ngraph::onnx_import::get_supported_operators(version, domain);
for(const auto& op : supported_ops)
{
std::cout << op << std::endl;
}
```
The above code produces a list of all the supported operators for the `version` and `domain` you specified and outputs a list similar to this:
```cpp
Abs
Acos
...
Xor
```
To determine whether a specific ONNX operator in a particular version and domain is supported by the importer, use the `is_operator_supported` function as shown in the example below:
```cpp
const std::string op_name = "Abs";
const std::int64_t version = 12;
const std::string domain = "ai.onnx";
const bool is_abs_op_supported = ngraph::onnx_import::is_operator_supported(op_name, version, domain);
std::cout << "Abs in version 12, domain `ai.onnx`is supported: " << (is_abs_op_supported ? "true" : "false") << std::endl;
```
## Import ONNX Model
To import an ONNX model, use the `import_onnx_model` function.
The method has two overloads:
* <a href="#stream">`import_onnx_model` takes a stream as an input</a>, for example, file stream, memory stream
* <a href="#path">`import_onnx_model` takes a file path as an input</a>
Refer to the sections below for details.
> **NOTE**: The examples below use the ONNX ResNet50 model, which is available at the [ONNX Model Zoo][onnx_model_zoo]:
> ```bash
> $ wget https://s3.amazonaws.com/download.onnx/models/opset_8/resnet50.tar.gz
> $ tar -xzvf resnet50.tar.gz
> ```
Once you create the `ng_function`, you can use it to run computation on the Inference Engine.
As it was shown in [Build a Model with nGraph Library](nGraphTutorial.md), `std::shared_ptr<ngraph::Function>` can be transformed into a `CNNNetwork`.
### <a name="stream">Stream as Input</a>
The code below shows how to convert the ONNX ResNet50 model to the nGraph function using `import_onnx_model` with the stream as an input:
```cpp
const std::string resnet50_path = "resnet50/model.onnx";
std::ifstream resnet50_stream(resnet50_path);
if(resnet50_stream.is_open())
{
try
{
const std::shared_ptr<ngraph::Function> ng_function = ngraph::onnx_import::import_onnx_model(resnet50_stream);
// Check shape of the first output, for example
std::cout << ng_function->get_output_shape(0) << std::endl;
// The output is Shape{1, 1000}
}
catch (const ngraph::ngraph_error& error)
{
std::cout << "Error when importing ONNX model: " << error.what() << std::endl;
}
}
resnet50_stream.close();
```
### <a name="path">Filepath as Input</a>
The code below shows how to convert the ONNX ResNet50 model to the nGraph function using `import_onnx_model` with the filepath as an input:
```cpp
const std::shared_ptr<ngraph::Function> ng_function = ngraph::onnx_import::import_onnx_model(resnet50_path);
```
[onnx_header]: https://github.com/NervanaSystems/ngraph/blob/master/src/ngraph/frontend/onnx_import/onnx.hpp
[onnx_model_zoo]: https://github.com/onnx/models
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*

View File

@@ -0,0 +1,3 @@
# Optimization Notice {#openvino_docs_IE_DG_Optimization_notice}
![Optimization_notice](img/opt-notice-en_080411.gif)

View File

@@ -0,0 +1,15 @@
OpenVINO™ Python* package {#openvino_docs_IE_DG_PythonPackage_Overview}
========================
OpenVINO™ Python\* package includes types to measure model and calibrate to low precision.
The OpenVINO™ Python\* package available in the `<INSTALL_DIR>/python/python3.X` directory.
The OpenVINO™ Python\* package includes the following sub-packages:
- [openvino.inference_engine](../../inference-engine/ie_bridges/python/docs/api_overview.md) - Python\* wrapper on OpenVINO™ Inference Engine.
- `openvino.tools.accuracy_checker` - Measure accuracy.
- `openvino.tools.benchmark` - Measure latency and throughput.
## See Also
* [Introduction to Intel's Deep Learning Inference Engine](Introduction.md)

View File

@@ -0,0 +1,184 @@
# Inference Engine Samples {#openvino_docs_IE_DG_Samples_Overview}
The Inference Engine sample applications are simple console applications that show how to utilize specific Inference Engine capabilities within an application, assist developers in executing specific tasks such as loading a model, running inference, querying specific device capabilities and etc.
After installation of Intel® Distribution of OpenVINO™ toolkit, С, C++ and Python* sample applications are available in the following directories, respectively:
* `<INSTALL_DIR>/inference_engine/samples/c`
* `<INSTALL_DIR>/inference_engine/samples/cpp`
* `<INSTALL_DIR>/inference_engine/samples/python`
Inference Engine sample applications include the following:
- **[Automatic Speech Recognition C++ Sample](../../inference-engine/samples/speech_sample/README.md)** Acoustic model inference based on Kaldi neural networks and speech feature vectors.
- **Benchmark Application** Estimates deep learning inference performance on supported devices for synchronous and asynchronous modes.
- [Benchmark C++ Application](../../inference-engine/samples/benchmark_app/README.md)
- [Benchmark Python Application](../../inference-engine/tools/benchmark_tool/README.md)
- **Hello Classification Sample** Inference of image classification networks like AlexNet and GoogLeNet using Synchronous Inference Request API. Input of any size and layout can be set to an infer request which will be pre-processed automatically during inference (the sample supports only images as inputs and supports Unicode paths).
- [Hello Classification C++ Sample](../../inference-engine/samples/hello_classification/README.md)
- [Hello Classification C Sample](../../inference-engine/ie_bridges/c/samples/hello_classification/README.md)
- **Hello NV12 Input Classification Sample** Input of any size and layout can be provided to an infer request. The sample transforms the input to the NV12 color format and pre-process it automatically during inference. The sample supports only images as inputs.
- [Hello NV12 Input Classification C++ Sample](../../inference-engine/samples/hello_nv12_input_classification/README.md)
- [Hello NV12 Input Classification C Sample](../../inference-engine/ie_bridges/c/samples/hello_nv12_input_classification/README.md)
- **Hello Query Device Sample** Query of available Inference Engine devices and their metrics, configuration values.
- [Hello Query Device C++ Sample](../../inference-engine/samples/hello_query_device/README.md)
- [Hello Query Device Python* Sample](../../inference-engine/ie_bridges/python/sample/hello_query_device/README.md)
- **[Hello Reshape SSD C++ Sample**](../../inference-engine/samples/hello_reshape_ssd/README.md)** Inference of SSD networks resized by ShapeInfer API according to an input size.
- **Image Classification Sample Async** Inference of image classification networks like AlexNet and GoogLeNet using Asynchronous Inference Request API (the sample supports only images as inputs).
- [Image Classification C++ Sample Async](../../inference-engine/samples/classification_sample_async/README.md)
- [Image Classification Python* Sample Async](../../inference-engine/ie_bridges/python/sample/classification_sample_async/README.md)
- **[Image Classification Python* Sample](../../inference-engine/ie_bridges/python/sample/classification_sample/README.md)** Inference of image classification networks like AlexNet and GoogLeNet using Synchronous Inference Request API (the sample supports only images as inputs).
- **Neural Style Transfer Sample** Style Transfer sample (the sample supports only images as inputs).
- [Neural Style Transfer C++ Sample](../../inference-engine/samples/style_transfer_sample/README.md)
- [Neural Style Transfer Python* Sample](../../inference-engine/ie_bridges/python/sample/style_transfer_sample/README.md)
- **[nGraph Function Creation C++ Sample](../../inference-engine/samples/ngraph_function_creation_sample/README.md)** Construction of the LeNet network using the nGraph function creation sample.
- **Object Detection for SSD Sample** Inference of object detection networks based on the SSD, this sample is simplified version that supports only images as inputs.
- [Object Detection for SSD C++ Sample](../../inference-engine/samples/object_detection_sample_ssd/README.md)
- [Object Detection for SSD C Sample](../../inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/README.md)
- [Object Detection for SSD Python* Sample](../../inference-engine/ie_bridges/python/sample/object_detection_sample_ssd/README.md)
## Media Files Available for Samples
To run the sample applications, you can use images and videos from the media files collection available at https://github.com/intel-iot-devkit/sample-videos.
## Samples that Support Pre-Trained Models
You can download the [pre-trained models](@ref omz_models_intel_index) using the OpenVINO [Model Downloader](@ref omz_tools_downloader_README) or from [https://download.01.org/opencv/](https://download.01.org/opencv/).
## Build the Sample Applications
### <a name="build_samples_linux"></a>Build the Sample Applications on Linux*
The officially supported Linux* build environment is the following:
* Ubuntu* 16.04 LTS 64-bit or CentOS* 7.4 64-bit
* GCC* 5.4.0 (for Ubuntu* 16.04) or GCC* 4.8.5 (for CentOS* 7.4)
* CMake* version 2.8.12 or higher
To build the C or C++ sample applications for Linux, go to the `<INSTALL_DIR>/inference_engine/samples/c` or `<INSTALL_DIR>/inference_engine/samples/cpp` directory, respectively, and run the `build_samples.sh` script:
```sh
build_samples.sh
```
Once the build is completed, you can find sample binaries in the following folders:
* C samples: `~/inference_engine_c_samples_build/intel64/Release`
* C++ samples: `~/inference_engine_cpp_samples_build/intel64/Release`
You can also build the sample applications manually:
> **NOTE**: If you have installed the product as a root user, switch to root mode before you continue: `sudo -i`
1. Navigate to a directory that you have write access to and create a samples build directory. This example uses a directory named `build`:
```sh
mkdir build
```
> **NOTE**: If you ran the Image Classification verification script during the installation, the C++ samples build directory was already created in your home directory: `~/inference_engine_samples_build/`
2. Go to the created directory:
```sh
cd build
```
3. Run CMake to generate the Make files for release or debug configuration. For example, for C++ samples:
- For release configuration:
```sh
cmake -DCMAKE_BUILD_TYPE=Release <INSTALL_DIR>/inference_engine/samples/cpp
```
- For debug configuration:
```sh
cmake -DCMAKE_BUILD_TYPE=Debug <INSTALL_DIR>/inference_engine/samples/cpp
```
4. Run `make` to build the samples:
```sh
make
```
For the release configuration, the sample application binaries are in `<path_to_build_directory>/intel64/Release/`;
for the debug configuration — in `<path_to_build_directory>/intel64/Debug/`.
### <a name="build_samples_windows"></a>Build the Sample Applications on Microsoft Windows* OS
The recommended Windows* build environment is the following:
* Microsoft Windows* 10
* Microsoft Visual Studio* 2017, or 2019
* CMake* version 2.8.12 or higher
> **NOTE**: If you want to use Microsoft Visual Studio 2019, you are required to install CMake 3.14.
To build the C or C++ sample applications on Windows, go to the `<INSTALL_DIR>\inference_engine\samples\c` or `<INSTALL_DIR>\inference_engine\samples\cpp` directory, respectively, and run the `build_samples_msvc.bat` batch file:
```sh
build_samples_msvc.bat
```
By default, the script automatically detects the highest Microsoft Visual Studio version installed on the machine and uses it to create and build
a solution for a sample code. Optionally, you can also specify the preferred Microsoft Visual Studio version to be used by the script. Supported
versions are `VS2017` and `VS2019`. For example, to build the C++ samples using the Microsoft Visual Studio 2017, use the following command:
```sh
<INSTALL_DIR>\inference_engine\samples\cpp\build_samples_msvc.bat VS2017
```
Once the build is completed, you can find sample binaries in the following folders:
* C samples: `C:\Users\<user>\Documents\Intel\OpenVINO\inference_engine_c_samples_build\intel64\Release`
* C++ samples: `C:\Users\<user>\Documents\Intel\OpenVINO\inference_engine_cpp_samples_build\intel64\Release`
You can also build a generated solution manually. For example, if you want to build C++ sample binaries in Debug configuration, run the appropriate version of the
Microsoft Visual Studio and open the generated solution file from the `C:\Users\<user>\Documents\Intel\OpenVINO\inference_engine_cpp_samples_build\Samples.sln`
directory.
## Get Ready for Running the Sample Applications
### Get Ready for Running the Sample Applications on Linux*
Before running compiled binary files, make sure your application can find the
Inference Engine and OpenCV libraries.
Run the `setupvars` script to set all necessary environment variables:
```sh
source <INSTALL_DIR>/bin/setupvars.sh
```
**(Optional)**: The OpenVINO environment variables are removed when you close the
shell. As an option, you can permanently set the environment variables as follows:
1. Open the `.bashrc` file in `<user_home_directory>`:
```sh
vi <user_home_directory>/.bashrc
```
2. Add this line to the end of the file:
```sh
source /opt/intel/openvino/bin/setupvars.sh
```
3. Save and close the file: press the **Esc** key, type `:wq` and press the **Enter** key.
4. To test your change, open a new terminal. You will see `[setupvars.sh] OpenVINO environment initialized`.
You are ready to run sample applications. To learn about how to run a particular
sample, read the sample documentation by clicking the sample name in the samples
list above.
### Get Ready for Running the Sample Applications on Windows*
Before running compiled binary files, make sure your application can find the
Inference Engine and OpenCV libraries.
Use the `setupvars` script, which sets all necessary environment variables:
```sh
<INSTALL_DIR>\bin\setupvars.bat
```
To debug or run the samples on Windows in Microsoft Visual Studio, make sure you
have properly configured **Debugging** environment settings for the **Debug**
and **Release** configurations. Set correct paths to the OpenCV libraries, and
debug and release versions of the Inference Engine libraries.
For example, for the **Debug** configuration, go to the project's
**Configuration Properties** to the **Debugging** category and set the `PATH`
variable in the **Environment** field to the following:
```sh
PATH=<INSTALL_DIR>\deployment_tools\inference_engine\bin\intel64\Debug;<INSTALL_DIR>\opencv\bin;%PATH%
```
where `<INSTALL_DIR>` is the directory in which the OpenVINO toolkit is installed.
You are ready to run sample applications. To learn about how to run a particular
sample, read the sample documentation by clicking the sample name in the samples
list above.
## See Also
* [Introduction to Intel's Deep Learning Inference Engine](Introduction.md)

View File

@@ -0,0 +1,129 @@
Using Shape Inference {#openvino_docs_IE_DG_ShapeInference}
==========================================
Inference Engine takes two kinds of model description as an input: [Intermediate Representation (IR)](../MO_DG/IR_and_opsets.md) and [nGraph::Function](nGraph_Flow.md) objects.
Both should have fixed input shapes to be successfully loaded to the Inference Engine.
To feed input data of a shape that is different from the model input shape, resize the model first.
Model resizing on the stage of <a href="_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html#when_to_specify_input_shapes">IR generation</a> or [nGraph::Function creation](nGraphTutorial.md) is the recommended approach.
OpenVINO™ provides the following experimental methods for runtime model reshaping:
1. Setting a new input shape with the `InferenceEngine::CNNNetwork::reshape` method
`InferenceEngine::CNNNetwork::reshape` method updates input shapes and propagates them down to the outputs of the model through all intermediate layers.
Shape propagation for `InferenceEngine::CNNNetwork` objects created from `nGraph::Function` or IR of the version 10 works through the `nGraph` shape inference mechanism.
`InferenceEngine::CNNNetwork` objects created from lower IR versions are considered deprecated and may be reshaped incorrectly or give unexpected results.
To keep the v10 IR resizable by the `InferenceEngine::CNNNetwork::reshape` method, convert the model with the additional Model Optimizer key `--keep_shape_ops`.
2. Setting a new batch dimension value with the `InferenceEngine::CNNNetwork::setBatchSize` method
The meaning of a model batch may vary depending on choices you made during the model designing.
The `InferenceEngine::CNNNetwork::setBatchSize` method deduces index of batch dimension relying only on the input rank.
This method does not work for models with a non-zero index batch placement or models with inputs without a batch dimension.
Batch-setting algorithm does not involve shape inference mechanism.
Batch of input and output shapes for all layers is set to a new batch value without layer validation.
It may cause both positive and negative side effects.
Due to the limitations described above, the current method is recommended for simple image processing models only.
Practically, some models are not ready to be resized. In this case, a new input shape cannot be set with the Model Optimizer or the `InferenceEngine::CNNNetwork::reshape` method.
## Troubleshooting Resize Errors
Operation semantics may impose restrictions on input shapes of the operation.
Shape collision during shape propagation may be a sign that a new shape does not satisfy the restrictions.
Changing the model input shape may result in intermediate operations shape collision.
Examples of such operations:
- <a href="_docs_MO_DG_prepare_model_convert_model_IR_V10_opset1.html#Reshape">`Reshape` operation</a> with a hard-coded output shape value
- <a href="_docs_MO_DG_prepare_model_convert_model_IR_V10_opset1.html#MatMul">`MatMul` operation</a> with the `Const` second input cannot be resized by spatial dimensions due to operation semantics
Model structure and logic should not change significantly after resizing.
- The Global Pooling operation is commonly used to reduce output feature map of classification models output.
Having the input of the shape [N, C, H, W], Global Pooling returns the output of the shape [N, C, 1, 1].
Model architects usually express Global Pooling with the help of the `Pooling` operation with the fixed kernel size [H, W].
During spatial reshape, having the input of the shape [N, C, H1, W1], Pooling with the fixed kernel size [H, W] returns the output of the shape [N, C, H2, W2], where H2 and W2 are commonly not equal to `1`.
It breaks the classification model structure.
For example, [publicly available Inception family models from TensorFlow*](https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models) have this issue.
- Resizing the model input shape may significantly affect its accuracy.
For example, Object Detection models from TensorFlow have resizing restrictions by design.
To keep the model valid after the reshape, choose a new input shape that satisfies conditions listed in the `pipeline.config` file.
For details, refer to the <a href="_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html#tf_od_custom_input_shape">Tensorflow Object Detection API models resizing techniques</a>.
## Usage of Reshape Method
The primary method of the feature is `InferenceEngine::CNNNetwork::reshape`.
It gets new input shapes and propagates it from input to output for all intermediates layers of the given network.
The method takes `InferenceEngine::ICNNNetwork::InputShapes` - a map of pairs: name of input data and its dimension.
The algorithm for resizing network is the following:
1) **Collect the map of input names and shapes from Intermediate Representation (IR)** using helper method `InferenceEngine::CNNNetwork::getInputShapes`
2) **Set new input shapes**
3) **Call reshape**
Here is a code example:
```cpp
InferenceEngine::Core core;
// ------------- 0. Read IR and image ----------------------------------------------
CNNNetwork network = core.ReadNetwork("path/to/IR/xml");
cv::Mat image = cv::imread("path/to/image");
// ---------------------------------------------------------------------------------
// ------------- 1. Collect the map of input names and shapes from IR---------------
auto input_shapes = network.getInputShapes();
// ---------------------------------------------------------------------------------
// ------------- 2. Set new input shapes -------------------------------------------
std::string input_name;
SizeVector input_shape;
std::tie(input_name, input_shape) = *input_shapes.begin(); // let's consider first input only
input_shape[0] = batch_size; // set batch size to the first input dimension
input_shape[2] = image.rows; // changes input height to the image one
input_shape[3] = image.cols; // changes input width to the image one
input_shapes[input_name] = input_shape;
// ---------------------------------------------------------------------------------
// ------------- 3. Call reshape ---------------------------------------------------
network.reshape(input_shapes);
// ---------------------------------------------------------------------------------
...
// ------------- 4. Loading model to the device ------------------------------------
std::string device = "CPU";
ExecutableNetwork executable_network = core.LoadNetwork(network, device);
// ---------------------------------------------------------------------------------
```
Shape Inference feature is used in [Smart classroom sample](@ref omz_demos_smart_classroom_demo_README).
## Extensibility
Inference Engine provides a special mechanism that allows to add the support of shape inference for custom operations.
This mechanism is described in the [Extensibility documentation](Extensibility_DG/Intro.md)
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*

View File

@@ -0,0 +1,17 @@
# OpenVINO™ Tools {#openvino_docs_IE_DG_Tools_Overview}
OpenVINO™ tools are C++ and Python\* console command line applications that can be used for models downloading, accuracy measurement, calibration and checking.
The OpenVINO™ toolkit installation includes the following tools:
|Tool | Location in the Installation Directory|
|-----------------------------------------------------------------------------|---------------------------------------|
|[Accuracy Checker Tool](@ref omz_tools_accuracy_checker_README) | `<INSTALL_DIR>/deployment_tools/tools/open_model_zoo/tools/accuracy_checker`|
|[Post-Training Optimization Tool](@ref pot_README) | `<INSTALL_DIR>/deployment_tools/tools/post_training_optimization_toolkit`|
|[Model Downloader](@ref omz_tools_downloader_README) | `<INSTALL_DIR>/deployment_tools/tools/model_downloader`|
|[Cross Check Tool](../../inference-engine/tools/cross_check_tool/README.md) | `<INSTALL_DIR>/deployment_tools/tools/cross_check_tool`|
|[Compile Tool](../../inference-engine/tools/compile_tool/README.md) | `<INSTALL_DIR>/deployment_tools/inference_engine/lib/intel64/`|
## See Also
* [Introduction to Deep Learning Inference Engine](Introduction.md)

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5389b6d0a25e8356002bd8c68526ceedf39f6c4efa5e7097b5ac0308fd42dee3
size 48611

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c416156d9ed77213ead230fc49c32a3c3918e52128ac2db442f56062e206bc01
size 708262

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce6fb1c626ac0858b411c86fa2e3a46c5ca0dc2e88692284ce4ec24edb141e7f
size 9326

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:80edd1da1c5673d18afa44bc2c0503ba9ecdcc37c2acb94960303b61c602ceee
size 12649

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3e8856aa175d6fcf940af57a53f962ff6c58acf0a3838bfccc6a093bff1756d
size 9015

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7d53ce33f180cf4d170bbeb69635ee7c49a67d3f6ee8b1c01ec12568fe1cca38
size 17157

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3965f4830c45518ee1dc169c2b1760cae83f8a8819023770a28893c6cef558c2
size 68441

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:25ed719bdd525dc0b606ef17a3fec5303ea032dfe6b2d167e1b19b6100b6fb37
size 16516

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:55c5fd6517ae9e3639f2214167665ffbb4b641cd2abef155ff816c68478915e2
size 54233

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5fbfb33c1a860978b8b99cf4dfbc04b5f7fbe0e20af03cd3e5ffd1d6a9f2db40
size 353490

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f0f329112b9c8227cbba3d394b778a6d219b4f3fc0d02cc5f2f8598c3d4eb51
size 151678

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0b46a1f89df96410a87f90801c9a86a28a6aacb39fa4677b434d856559f163fe
size 217954

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88745fd132531e943d59afe59ed6af8eaae6b62ba1fda2493dfef76080d31a25
size 7788

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9709bc83f903943b4d737d379babf80a391a72ad8eab98e71abcc0de5424fbfc
size 12361

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f6ff04de33684f00d0d2da8fed6d30b5162c566b35b8894e9e14f7921db70592
size 8598

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a453412cf37f06e1e5a63f5ff629d4e16ed1707fc55b5a63cc03e710807b33e
size 10151

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3be59a71703b640eac6ad99ce3d463141a36e58f5299bf21e4f6aba152d9ed6
size 9359

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:50f41274758a989c9ef43e558343d420d7e4e288c88ac2d19a2bf396d5ee573c
size 9937

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9fff52e5faaf108371db87e53959453216554152b15ca0432b1541f94def297e
size 19145

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d147adf801535e95d8b627a8a1d23f7b89dea1eabe06218235e756b0a9866fe
size 1636

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a9aae473dcc469ebdb5c2d9ac8067bf8c7caa11d4cdbc7e0dd0b2006621ce526
size 4267

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af2641e8e685b027123681ab542162932b008eff257ef5b7105950bfe8b4ade8
size 10373

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:02efdda675c16def7c2705e978964ce8bf65d1ec6cedfdb0a5afc837fb57abf0
size 5660

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e69242d80da7676311e20e5db67c01bd6562008ecf3a53df8fdedaefabb91b70
size 7226

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d4457dbe05630bf90294396c4185b280634a5bf1ac7a6ca1c5186be67eb1cc4a
size 54231

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3812efef32bd7f1bf40b130d5d522bc3df6aebd406bd1186699d214bca856722
size 43721

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e232c47e8500f42bd0e1f2b93f94f58e2d59caee149c687be3cdc3e8a5be59a
size 18417

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92d36b9527a3e316cd9eb2b6f5054c312466df004e4aa9c3458e165330bc6561
size 24157

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2adeca1e3512b9fe7b088a5412ce21592977a1f352a013735537ec92e895dc94
size 15653

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:37c7908d2379cc2ba1909965c58de7bc55d131a330c47e173321c718846d6745
size 7809

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5e22bc22d614c7335ae461a8ce449ea8695973d755faca718cf74b95972c94e2
size 19773

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5d909bcaa7f6ec95cb0e3bf1b676b031489e89afa411e6add1aa2faaf90e0b3
size 101557

View File

@@ -0,0 +1,115 @@
Introduction to Inference Engine {#openvino_docs_IE_DG_inference_engine_intro}
================================
After you have used the Model Optimizer to create an Intermediate Representation (IR), use the Inference Engine to infer the result for a given input data.
Inference Engine is a set of C++ libraries providing a common API to deliver inference solutions on the platform of your choice: CPU, GPU, VPU, or FPGA. Use the Inference Engine API to read the Intermediate Representation, set the input and output formats, and execute the model on devices. While the C++ libraries is the primary implementation, C libraries and Python bindings are also available.
For Intel® Distribution of OpenVINO™ toolkit, Inference Engine binaries are delivered within release packages.
The open source version is available in the [OpenVINO™ toolkit GitHub repository](https://github.com/openvinotoolkit/openvino) and can be built for supported platforms using the <a href="https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md">Inference Engine Build Instructions</a>.
To learn about how to use the Inference Engine API for your application, see the [Integrating Inference Engine in Your Application](Integrate_with_customer_application_new_API.md) documentation.
For complete API Reference, see the [API Reference](usergroup29.html) section.
Inference Engine uses a plugin architecture. Inference Engine plugin is a software component that contains complete implementation for inference on a certain Intel&reg; hardware device: CPU, GPU, VPU, FPGA, etc. Each plugin implements the unified API and provides additional hardware-specific APIs.
Modules in the Inference Engine component
---------------------------------------
### Core Inference Engine Libraries ###
Your application must link to the core Inference Engine libraries:
* Linux* OS:
- `libinference_engine.so`, which depends on `libinference_engine_transformations.so` and `libngraph.so`
- `libinference_engine_legacy.so`, which depends on `libtbb.so`
* Windows* OS:
- `inference_engine.dll`, which depends on `inference_engine_transformations.dll` and `ngraph.dll`
- `inference_engine_legacy.dll`, which depends on `tbb.dll`
The required C++ header files are located in the `include` directory.
This library contains the classes to:
* Create Inference Engine Core object to work with devices and read network (InferenceEngine::Core)
* Manipulate network information (InferenceEngine::CNNNetwork)
* Execute and pass inputs and outputs (InferenceEngine::ExecutableNetwork and InferenceEngine::InferRequest)
### Plugin Libraries to read a network object ###
Starting from 2020.4 release, Inference Engine introduced a concept of `CNNNetwork` reader plugins. Such plugins can be automatically dynamically loaded by Inference Engine in runtime depending on file format:
* Linux* OS:
- `libinference_engine_ir_reader.so` to read a network from IR
- `libinference_engine_onnx_reader.so` to read a network from ONNX model format
* Windows* OS:
- `inference_engine_ir_reader.dll` to read a network from IR
- `inference_engine_onnx_reader.dll` to read a network from ONNX model format
### Device-specific Plugin Libraries ###
For each supported target device, Inference Engine provides a plugin — a DLL/shared library that contains complete implementation for inference on this particular device. The following plugins are available:
| Plugin | Device Type |
| ------------- | ------------- |
|CPU| Intel® Xeon® with Intel® AVX2 and AVX512, Intel® Core™ Processors with Intel® AVX2, Intel® Atom® Processors with Intel® SSE |
|GPU| Intel® Processor Graphics, including Intel® HD Graphics and Intel® Iris® Graphics
|FPGA| Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA, Intel® Vision Accelerator Design with an Intel® Arria 10 FPGA (Speed Grade 2) |
|MYRIAD| Intel® Neural Compute Stick 2 powered by the Intel® Movidius™ Myriad™ X|
|GNA| Intel&reg; Speech Enabling Developer Kit, Amazon Alexa* Premium Far-Field Developer Kit, Intel&reg; Pentium&reg; Silver J5005 Processor, Intel&reg; Pentium&reg; Silver N5000 Processor, Intel&reg; Celeron&reg; J4005 Processor, Intel&reg; Celeron&reg; J4105 Processor, Intel&reg; Celeron&reg; Processor N4100, Intel&reg; Celeron&reg; Processor N4000, Intel&reg; Core&trade; i3-8121U Processor, Intel&reg; Core&trade; i7-1065G7 Processor, Intel&reg; Core&trade; i7-1060G7 Processor, Intel&reg; Core&trade; i5-1035G4 Processor, Intel&reg; Core&trade; i5-1035G7 Processor, Intel&reg; Core&trade; i5-1035G1 Processor, Intel&reg; Core&trade; i5-1030G7 Processor, Intel&reg; Core&trade; i5-1030G4 Processor, Intel&reg; Core&trade; i3-1005G1 Processor, Intel&reg; Core&trade; i3-1000G1 Processor, Intel&reg; Core&trade; i3-1000G4 Processor
|HETERO|Automatic splitting of a network inference between several devices (for example if a device doesn't support certain layers|
|MULTI| Simultaneous inference of the same network on several devices in parallel|
The table below shows the plugin libraries and additional dependencies for Linux and Windows platforms.
| Plugin | Library name for Linux | Dependency libraries for Linux | Library name for Windows | Dependency libraries for Windows |
|--------|------------------------|-------------------------------------------------|--------------------------|--------------------------------------------------------------------------------------------------------|
| CPU | `libMKLDNNPlugin.so` | `libinference_engine_lp_transformations.so` | `MKLDNNPlugin.dll` | `inference_engine_lp_transformations.dll` |
| GPU | `libclDNNPlugin.so` | `libinference_engine_lp_transformations.so`, `libOpenCL.so` | `clDNNPlugin.dll` | `OpenCL.dll`, `inference_engine_lp_transformations.dll` |
| FPGA | `libdliaPlugin.so` | `libdla_compiler_core.so`, `libdla_runtime_core.so`, `libcrypto.so`, `libalteracl.so`, `liblpsolve5525.so`, `libprotobuf.so`, `libacl_emulator_kernel_rt.so` | `dliaPlugin.dll` | `dla_compiler_core.dll`, `dla_runtime_core.dll`, `crypto.dll`, `alteracl.dll`, `lpsolve5525.dll`, `protobuf.dll`, `acl_emulator_kernel_rt.dll`
| MYRIAD | `libmyriadPlugin.so` | `libusb.so`, `libinference_engine_lp_transformations.so` | `myriadPlugin.dll` | `usb.dll`, `inference_engine_lp_transformations.dll` |
| HDDL | `libHDDLPlugin.so` | `libbsl.so`, `libhddlapi.so`, `libmvnc-hddl.so`, `libinference_engine_lp_transformations.so`| `HDDLPlugin.dll` | `bsl.dll`, `hddlapi.dll`, `json-c.dll`, `libcrypto-1_1-x64.dll`, `libssl-1_1-x64.dll`, `mvnc-hddl.dll`, `inference_engine_lp_transformations.dll` |
| GNA | `libGNAPlugin.so` | `libgna.so`, `libinference_engine_lp_transformations.so` | `GNAPlugin.dll` | `gna.dll`, `inference_engine_lp_transformations.dll` |
| HETERO | `libHeteroPlugin.so` | Same as for selected plugins | `HeteroPlugin.dll` | Same as for selected plugins |
| MULTI | `libMultiDevicePlugin.so` | Same as for selected plugins | `MultiDevicePlugin.dll` | Same as for selected plugins |
> **NOTE**: All plugin libraries also depend on core Inference Engine libraries.
Make sure those libraries are in your computer's path or in the place you pointed to in the plugin loader. Make sure each plugin's related dependencies are in the:
* Linux: `LD_LIBRARY_PATH`
* Windows: `PATH`
On Linux, use the script `bin/setupvars.sh` to set the environment variables.
On Windows, run the `bin\setupvars.bat` batch file to set the environment variables.
To learn more about supported devices and corresponding plugins, see the [Supported Devices](supported_plugins/Supported_Devices.md) chapter.
Common Workflow for Using the Inference Engine API
---------------------------
The common workflow contains the following steps:
1. **Create Inference Engine Core object** - Create an `InferenceEngine::Core` object to work with different devices, all device plugins are managed internally by the `Core` object. Register extensions with custom nGraph operations (`InferenceEngine::Core::AddExtension`).
2. **Read the Intermediate Representation** - Using the `InferenceEngine::Core` class, read an Intermediate Representation file into an object of the `InferenceEngine::CNNNetwork` class. This class represents the network in the host memory.
3. **Prepare inputs and outputs format** - After loading the network, specify input and output precision and the layout on the network. For these specification, use the `InferenceEngine::CNNNetwork::getInputsInfo()` and `InferenceEngine::CNNNetwork::getOutputsInfo()`.
4. Pass per device loading configurations specific to this device (`InferenceEngine::Core::SetConfig`), and register extensions to this device (`InferenceEngine::Core::AddExtension`).
4. **Compile and Load Network to device** - Use the `InferenceEngine::Core::LoadNetwork()` method with specific device (e.g. `CPU`, `GPU`, etc.) to compile and load the network on the device. Pass in the per-target load configuration for this compilation and load operation.
5. **Set input data** - With the network loaded, you have an `InferenceEngine::ExecutableNetwork` object. Use this object to create an `InferenceEngine::InferRequest` in which you signal the input buffers to use for input and output. Specify a device-allocated memory and copy it into the device memory directly, or tell the device to use your application memory to save a copy.
6. **Execute** - With the input and output memory now defined, choose your execution mode:
* Synchronously - `InferenceEngine::InferRequest::Infer()` method. Blocks until inference is completed.
* Asynchronously - `InferenceEngine::InferRequest::StartAsync()` method. Check status with the `InferenceEngine::InferRequest::Wait()` method (0 timeout), wait, or specify a completion callback.
7. **Get the output** - After inference is completed, get the output memory or read the memory you provided earlier. Do this with the `InferenceEngine::IInferRequest::GetBlob()` method.
Further Reading
---------------
For more details on the Inference Engine API, refer to the [Integrating Inference Engine in Your Application](Integrate_with_customer_application_new_API.md) documentation.

View File

@@ -0,0 +1,81 @@
# Build a Model with nGraph Library {#openvino_docs_IE_DG_nGraphTutorial}
This section illustrates how to construct an nGraph function
composed of operations from the `opset3` namespace. Once created,
it can wrap into a `CNNNetwork`, creating utility for data scientists
or app developers to define a deep-learning model in a neutral way
that does not depend on existing Deep Learning (DL) frameworks.
Operation Set `opsetX` integrates a list of nGraph pre-compiled operations that work
for this purpose. In other words, `opsetX` defines a set of operations for building a graph.
For a complete list of operation sets supported by Inference Engine, see [Available Operations Sets](../ops/opset.md).
To add custom nGraph operations to an existing `CNNNetwork`, see
the [Add Custom nGraph Operations](Extensibility_DG/Intro.md) document.
Now that you can build graphs with anything from the `opset3` definition, some
parameters for shape-relevant (or shape-specific) inputs can be added. The
following code prepares a graph for shape-relevant parameters.
> **NOTE**: `validate_nodes_and_infer_types(ops)` must be included for partial shape inference.
```cpp
#include "ngraph/opsets/opset.hpp"
#include "ngraph/opsets/opset3.hpp"
using namespace std;
using namespace ngraph;
auto arg0 = make_shared<opset3::Parameter>(element::f32, Shape{7});
auto arg1 = make_shared<opset3::Parameter>(element::f32, Shape{7});
// Create an 'Add' operation with two inputs 'arg0' and 'arg1'
auto add0 = make_shared<opset3::Add>(arg0, arg1);
auto abs0 = make_shared<opset3::Abs>(add0);
// Create a node whose inputs/attributes will be specified later
auto acos0 = make_shared<opset3::Acos>();
// Create a node using opset factories
auto add1 = shared_ptr<Node>(get_opset3().create("Add"));
// Set inputs to nodes explicitly
acos0->set_argument(0, add0);
add1->set_argument(0, acos0);
add1->set_argument(1, abs0);
// Run shape inference on the nodes
NodeVector ops{arg0, arg1, add0, abs0, acos0, add1};
validate_nodes_and_infer_types(ops);
// Create a graph with one output (add1) and four inputs (arg0, arg1)
auto ng_function = make_shared<Function>(OutputVector{add1}, ParameterVector{arg0, arg1});
```
To wrap it into a CNNNetwork, use:
```cpp
CNNNetwork net (ng_function);
```
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*
## See Also
* [Available Operation Sets](../ops/opset.md)
* [Operation Set `opset1` Specification](../ops/opset1.md)
* [Operation Set `opset2` Specification](../ops/opset2.md)
* [Operation Set `opset3` Specification](../ops/opset3.md)
* [Inference Engine Extensibility Developer Guide](Extensibility_DG/Intro.md)

158
docs/IE_DG/nGraph_Flow.md Normal file
View File

@@ -0,0 +1,158 @@
# Introduction to nGraph Flow in Inference Engine {#openvino_docs_IE_DG_nGraph_Flow}
## New Run-Time Intermediate Representation (IR): nGraph
Starting from the OpenVINO&trade; release 2020.1, the Inference Engine integrates the
nGraph Core.
That implies that the Inference Engine uses a new way to represent a model in run time underneath of
the conventional `CNNNetwork` API, which is an instance of `ngraph::Function`.
Besides the representation update, nGraph integration resulted in the following changes and new features:
1. New operations sets. When operations from the nGraph Core were combined with conventional layers
from `CNNNetwork`, there were created a [new sets of operations called `opset1`, `opset2` and etc.](../ops/opset.md),
which covered both interfaces except several not very important cases.
Operations from `opset3` are generated by the Model Optimizer and are accepted in the Inference Engine.
2. New version approach that attaches a version to each operation rather than to the entire IR file format.
IR is still versioned but has a different meaning. For details, see [Deep Learning Network Intermediate Representation and Operation Sets in OpenVINO™](../MO_DG/IR_and_opsets.md).
3. Creating models in run-time without loading IR from an xml/binary file. You can enable it by creating
`ngraph::Function` passing it to `CNNNetwork`.
4. Run-time reshape capability and constant folding are implemented through the nGraph code for more operations compared to previous releases.
As a result, more models can be reshaped. For details, see the [dedicated guide about the reshape capability](ShapeInference.md).
5. Loading model from ONNX format without converting it to the Inference Engine IR.
The conventional flow that is not based on nGraph is still available.
The complete picture of co-existence of legacy and new flows is presented below.
The rest of the document describes the coexistence of legacy and new flows showed in the picture below:
![](img/TopLevelNGraphFlow.png)
## Read the Intermediate Representation to `CNNNetwork`
As the new operation set is introduced, the Model Optimizer generates the IR version 10 using the new operations by default.
Each layer generated in the IR has a semantics matching to the corresponding operation from the nGraph namespace `opset3`.
The IR version 10 automatically triggers the nGraph flow inside the Inference Engine.
When such IR is read in an application, the Inference Engine IR reader produces `CNNNetwork` that encapsulates the `ngraph::Function` instance underneath.
Thus the OpenVINO IR becomes a new serialization format for the nGraph IR, and it can be deserialized reading the `CNNNetwork`.
> **IMPORTANT**: Conventional interfaces are used (`CNNNetwork`, the reader), so no changes required in most applications.
> **NOTE**: While you still can use old APIs, there is an independent process of continuous improvements in the Inference Engine API.
> These changes are independent of nGraph integration and do not enable or disable new features.
Interpretation of the IR version 10 differs from the old IR version.
Besides having a different operations set, the IR version 10 ignores the shapes and data types assigned to the ports in an XML file.
Both shapes and types are reinferred while loading to the Inference Engine using the nGraph shape and type propagation function that is a part of each nGraph operation.
### Legacy IR Versions
You can read old versions of the IR in the Inference Engine.
Each version below or equal to 7 is treated as an old one.
When the Inference Engine reader reads an old version of the IR, it does not use the nGraph representation.
There is no way to activate nGraph flow with an old IR version.
The rest of this document is not applied in this case.
Model Optimizer generates the IR version 10 by default, and there is the command line key `--generate_deprecated_IR_V7` which switches generation to the legacy IR version 7.
It is useful when the new nGraph flow does not work for some reason.
## Build a Model in the Application
Alternative method to feed the Inference Engine with a model is to create the model in the run time.
It is achieved by creation of the `ngraph::Function` construction using nGraph operation classes and optionally user-defined operations.
For details, see [Add Custom nGraph Operations](Extensibility_DG/AddingNGraphOps.md) and [examples](nGraphTutorial.md).
At this stage, the code is completely independent of the rest of the Inference Engine code and can be built separately.
After you construct an instance of `ngraph::Function`, you can use it to create `CNNNetwork` by passing it to the new constructor for this class.
Initializing `CNNNetwork` from the nGraph Function means encapsulating the object and not converting it to a conventional representation.
Going to low-level details, technically it is achieved by using another class for the `CNNNetwork` internals.
The old representation that is used for former versions of IR before version 10 uses `CNNNetworkImpl`.
The new representation that is built around nGraph uses `CNNNetworkNGraphImpl`.
![](img/NewAndOldCNNNetworkImpl.png)
## Automatic Conversion to the Old Representation
The old representation is still required in the cases listed below.
When old representation is required, the conversion from the `ngraph::Function` to the old representation is called automatically.
The following methods lead to the automatic conversion:
1. Using the old API, which is expected to produce an old representation. Guaranteed to be read-only. Once you call such a method, the original nGraph representation is preserved and continues to be used in the successive calls.
1.1. `CNNNetwork::serialize`. Dumps the old representation after automatically called conversion. Cannot be used to dump IR V10. For details, see [Graph Debug Capabilities](Graph_debug_capabilities.md).
2. Calling `CNNNetwork` methods that modify the model. After that nGraph representation is lost and cannot be used afterwards.
1.1. `CNNNetwork::addLayer`
1.2. CNNNetwork::setBatchSize. Still implemented through old logic for backward compatibility without using nGraph capabilities.
For details, see [Using Shape Inference](ShapeInference.md).
3. Using methods that return objects inside an old representation.
Using these methods does not mean modification of the model, but you are not limited by the API to make read-only changes.
These methods should be used in the read-only mode with respect to a model representation.
If the model is changed, for example attribute of some layer is changed or layers are reconnected, the modification is lost whenever any method that uses nGraph is called, including methods inside plugins like CNNNetwork::reshape.
It is hard to predict whether the nGraph function is used in a plugin or other methods of CNNNetworks, so modifying a network using the following methods is *strongly not recommended*.
This is an important limitation that is introduced for the old API calls listed below:
1.1. `Data::getInputTo`
1.2. `Data::getCreatorLayer`
1.3. `CNNNetwork::getLayerByName`
1.4. Iterating over `CNNLayer` objects in `CNNNetwork`: `CNNNetwork::begin`, `details::CNNNetworkIterator` class.
4. Using a conventional plugin that accepts the old representation only.
Though the conversion is always a one-way process, which means there is no method to convert back, there are important caveats.
In the cases [1] and [3], both representations are held underneath and you should use the old representation in the read-only mode only from the caller side.
It is hard to track from the Inference Engine side whether the API is used in the read-only mode or for modification of the model.
That is why when using potentially modifying methods listed in section [3] above, you should not modify the model via those methods.
Use a direct manipulation of the nGraph function instead.
## Conversion Function
Inference Engine implements the conversion function that is used when the nGraph function is transformed to the old `CNNNetworkImpl` representation.
This conversion function is hidden and you cannot call it directly from the application.
Nevertheless, it is an important component of the model transformation pipeline in the Inference Engine.
Some issues of models may be caught during the conversion process in this function.
Exceptions are thrown in this function, and you should know what this function does to find a root cause.
The conversion function performs the following steps:
1. Convert and decompose some operations as the first step of the nGraph function preparation for optimization.
Reduce operation set to easily optimize it at the next stages.
For example, decomposing of BatchNormInference happens at this stage.
2. Optimizing transformations that usually happen in the Model Optimizer are called here, because the nGraph function is not always read from an already optimized IR.
3. Changing operation set from `opsetX` to legacy layer semantics described in the [Legacy Layers Catalog](../MO_DG/prepare_model/convert_model/Legacy_IR_Layers_Catalog_Spec.md).
The model is still represented as the nGraph function at this stage, but the operation set is completely different.
4. One-to-one conversion of nGraph representation to the corresponding `CNNNetworkImpl` without changing its semantics.
You can see the result of the conversion by calling the `CNNNetwork::serialize` method, which produces legacy IR semantics, which is not nGraph-based even if it is applied to `CNNNetwork` constructed from the nGraph Function.
It may help in debugging, see [Graph Debug Capabilities](Graph_debug_capabilities.md) to view all options for dumping new and old IR representations.
## Deprecation Notice
<table>
<tr>
<td><strong>Deprecation Begins</strong></td>
<td>June 1, 2020</td>
</tr>
<tr>
<td><strong>Removal Date</strong></td>
<td>December 1, 2020</td>
</tr>
</table>
*Starting with the OpenVINO™ toolkit 2020.2 release, all of the features previously available through nGraph have been merged into the OpenVINO™ toolkit. As a result, all the features previously available through ONNX RT Execution Provider for nGraph have been merged with ONNX RT Execution Provider for OpenVINO™ toolkit.*
*Therefore, ONNX RT Execution Provider for nGraph will be deprecated starting June 1, 2020 and will be completely removed on December 1, 2020. Users are recommended to migrate to the ONNX RT Execution Provider for OpenVINO™ toolkit as the unified solution for all AI inferencing on Intel® hardware.*

View File

@@ -0,0 +1,71 @@
# Using Encrypted Models with OpenVINO&trade; {#openvino_docs_IE_DG_protecting_model_guide}
Deploying deep-learning capabilities to edge devices can present security
challenges. For example, ensuring inference integrity or providing copyright
protection of your deep-learning models.
One possible solution is to use cryptography to protect models as they are
deployed and stored on edge devices. Model encryption, decryption and
authentication are not provided by OpenVINO&trade; but can be implemented with
third-party tools, like OpenSSL\*. While implementing encryption, ensure that
you use the latest versions of tools and follow cryptography best practices.
This guide demonstrates how to use OpenVINO securely with protected models.
## Secure Model Deployment
After a model is optimized by the OpenVINO Model Optimizer, it's then deployed
to target devices in the Intermediate Representation (IR) format. An optimized
model is stored on an edge device and executed by the Inference Engine.
To protect deep-learning models, you can encrypt an optimized model before
deploying it to the edge device. The edge device should keep the stored model
protected at all times and have the model decrypted **in runtime only** for use
by the Inference Engine.
![deploy_encrypted_model]
## Loading Encrypted Models
The OpenVINO Inference Engine requires model decryption before loading. Allocate
a temporary memory block for model decryption, and use
`InferenceEngine::Core::ReadNetwork` method to load the model from memory buffer.
For more information, see the `InferenceEngine::Core` Class
Reference Documentation.
```cpp
std::vector<uint8_t> model;
std::vector<uint8_t> weights;
// Read model files and decrypt them into temporary memory block
decrypt_file(model_file, password, model);
decrypt_file(weights_file, password, weights);
```
Hardware-based protection, such as Intel&reg; Software Guard Extensions
(Intel&reg; SGX), can be utilized to protect decryption operation secrets and
bind them to a device. For more information, go to [Intel&reg; Software Guard
Extensions](https://software.intel.com/en-us/sgx).
Use `InferenceEngine::Core::ReadNetwork()` to set model representations and
weights respectively.
```cpp
Core core;
// Load model from temporary memory block
std::string strModel(model.begin(), model.end());
CNNNetwork network = core.ReadNetwork(strModel, make_shared_blob<uint8_t>({Precision::U8, {weights.size()}, C}, weights.data()));
```
[deploy_encrypted_model]: img/deploy_encrypted_model.png
## Additional Resources
- Intel® Distribution of OpenVINO™ toolkit home page: [https://software.intel.com/en-us/openvino-toolkit](https://software.intel.com/en-us/openvino-toolkit)
- OpenVINO™ toolkit online documentation: [https://docs.openvinotoolkit.org](https://docs.openvinotoolkit.org)
- Model Optimizer Developer Guide: [Model Optimizer Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html)
- Inference Engine Developer Guide: [Inference Engine Developer Guide](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html)
- For more information on Sample Applications, see the [Inference Engine Samples Overview](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_Samples_Overview.html)
- For information on a set of pre-trained models, see the [Overview of OpenVINO™ Toolkit Pre-Trained Models](@ref omz_models_intel_index)
- For information on Inference Engine Tutorials, see the [Inference Tutorials](https://github.com/intel-iot-devkit/inference-tutorials-generic)
- For IoT Libraries and Code Samples see the [Intel® IoT Developer Kit](https://github.com/intel-iot-devkit).

Some files were not shown because too many files have changed in this diff Show More