[DOCS] Removal of mentions of deprecated articles (#22509)
Removed remaining mentions of deprecated solutions in docs. --------- Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
This commit is contained in:
parent
28f61e7dae
commit
4da25b4de3
File diff suppressed because it is too large
Load Diff
|
|
@ -163,7 +163,6 @@ Operating systems and developer environment
|
|||
.. tab-item:: DL frameworks versions:
|
||||
|
||||
* TensorFlow 1.15, 2.12
|
||||
* MxNet 1.9.0
|
||||
* ONNX 1.14.1
|
||||
* PaddlePaddle 2.4
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Documentation
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Explore the OpenVINO toolkit workflow that entails preparing,
|
||||
:description: Explore the OpenVINO toolkit workflow that entails preparing,
|
||||
optimizing and deploying models in deep learning applications.
|
||||
|
||||
|
||||
|
|
@ -14,8 +14,8 @@ Documentation
|
|||
:hidden:
|
||||
|
||||
API Reference <api/api_reference>
|
||||
OpenVINO IR format and Operation Sets <openvino_ir>
|
||||
Legacy Features <openvino_legacy_features>
|
||||
OpenVINO IR format and Operation Sets <openvino_ir>
|
||||
Legacy Features <openvino_legacy_features>
|
||||
Tool Ecosystem <openvino_ecosystem>
|
||||
OpenVINO Extensibility <openvino_docs_Extensibility_UG_Intro>
|
||||
OpenVINO™ Security <openvino_docs_security_guide_introduction>
|
||||
|
|
@ -24,14 +24,14 @@ Documentation
|
|||
This section provides reference documents that guide you through the OpenVINO toolkit workflow, from preparing models, optimizing them, to deploying them in your own deep learning applications.
|
||||
|
||||
| :doc:`API Reference doc path <api/api_reference>`
|
||||
| A collection of reference articles for OpenVINO C++, C, and Python APIs.
|
||||
| A collection of reference articles for OpenVINO C++, C, and Python APIs.
|
||||
|
||||
| :doc:`OpenVINO Ecosystem <openvino_ecosystem>`
|
||||
| Apart from the core components, OpenVINO offers tools, plugins, and expansions revolving around it, even if not constituting necessary parts of its workflow. This section gives you an overview of what makes up the OpenVINO toolkit.
|
||||
|
||||
| :doc:`OpenVINO Extensibility Mechanism <openvino_docs_Extensibility_UG_Intro>`
|
||||
| The Intel® Distribution of OpenVINO™ toolkit supports neural network models trained with various frameworks, including TensorFlow, PyTorch, ONNX, TensorFlow Lite, and PaddlePaddle (OpenVINO support for Apache MXNet, Caffe, and Kaldi is being deprecated and will be removed in the future). Learn how to extend OpenVINO functionality with custom settings.
|
||||
| The Intel® Distribution of OpenVINO™ toolkit supports neural network models trained with various frameworks, including TensorFlow, PyTorch, ONNX, TensorFlow Lite, and PaddlePaddle. Learn how to extend OpenVINO functionality with custom settings.
|
||||
|
||||
| :doc:`OpenVINO™ Security <openvino_docs_security_guide_introduction>`
|
||||
| Learn how to use OpenVINO securely and protect your data to meet specific security and privacy requirements.
|
||||
| Learn how to use OpenVINO securely and protect your data to meet specific security and privacy requirements.
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ OpenVINO Extensibility Mechanism
|
|||
|
||||
|
||||
The Intel® Distribution of OpenVINO™ toolkit supports neural-network models trained with various frameworks, including
|
||||
TensorFlow, PyTorch, ONNX, TensorFlow Lite, and PaddlePaddle (OpenVINO support for Apache MXNet, Caffe, and Kaldi is currently
|
||||
being deprecated and will be removed entirely in the future). The list of supported operations is different for each of the supported frameworks.
|
||||
TensorFlow, PyTorch, ONNX, TensorFlow Lite, and PaddlePaddle. The list of supported operations is different for each of the supported frameworks.
|
||||
To see the operations supported by your framework, refer to :doc:`Supported Framework Operations <openvino_resources_supported_operations_frontend>`.
|
||||
|
||||
Custom operations, which are not included in the list, are not recognized by OpenVINO out-of-the-box. The need for custom operation may appear in two cases:
|
||||
|
|
@ -57,15 +56,15 @@ You might prefer implementing a custom operation class if you already have a gen
|
|||
Mapping from Framework Operation
|
||||
################################
|
||||
|
||||
Mapping of custom operation is implemented differently, depending on model format used for import. You may choose one of the following:
|
||||
Mapping of custom operation is implemented differently, depending on model format used for import.
|
||||
If a model is represented in the ONNX (including models exported from PyTorch in ONNX), TensorFlow Lite, PaddlePaddle or
|
||||
TensorFlow formats, then one of the classes from :doc:`Frontend Extension API <openvino_docs_Extensibility_UG_Frontend_Extensions>`
|
||||
should be used. It consists of several classes available in C++ which can be used with the ``--extensions`` option in Model Optimizer
|
||||
or when a model is imported directly to OpenVINO runtime using the ``read_model`` method.
|
||||
Python API is also available for runtime model import.
|
||||
|
||||
1. If a model is represented in the ONNX (including models exported from PyTorch in ONNX), TensorFlow Lite, PaddlePaddle or TensorFlow formats, then one of the classes from :doc:`Frontend Extension API <openvino_docs_Extensibility_UG_Frontend_Extensions>` should be used. It consists of several classes available in C++ which can be used with the ``--extensions`` option in Model Optimizer or when a model is imported directly to OpenVINO runtime using the ``read_model`` method. Python API is also available for runtime model import.
|
||||
|
||||
2. If a model is represented in the Caffe, Kaldi or MXNet formats (as legacy frontends), then :doc:`[Legacy] Model Optimizer Extensions <openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer>` should be used. This approach is available for model conversion in Model Optimizer only.
|
||||
|
||||
Existing of two approaches simultaneously is explained by two different types of frontends used for model conversion in OpenVINO: new frontends (ONNX, PaddlePaddle, TensorFlow Lite, and TensorFlow) and legacy frontends (Caffe, Kaldi, and Apache MXNet). Model Optimizer can use both frontends in contrast to the direct import of model with ``read_model`` method which can use new frontends only. Follow one of the appropriate guides referenced above to implement mappings depending on framework frontend.
|
||||
|
||||
If you are implementing extensions for new ONNX, PaddlePaddle, TensorFlow Lite or TensorFlow frontends and plan to use the ``--extensions`` option in Model Optimizer for model conversion, then the extensions should be:
|
||||
If you are implementing extensions for new ONNX, PaddlePaddle, TensorFlow Lite or TensorFlow frontends and plan to use the ``--extensions``
|
||||
option in Model Optimizer for model conversion, then the extensions should be:
|
||||
|
||||
1. Implemented in C++ only.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ ReLU
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Learn about ReLU-1 - an element-wise, activation operation, which
|
||||
:description: Learn about ReLU-1 - an element-wise, activation operation, which
|
||||
can be performed on a single tensor in OpenVINO.
|
||||
|
||||
**Versioned name**: *ReLU-1*
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Convolution
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Learn about Convolution-1 - a 1D, 2D or 3D convolution operation, which
|
||||
:description: Learn about Convolution-1 - a 1D, 2D or 3D convolution operation, which
|
||||
can be performed on input and kernel tensors in OpenVINO.
|
||||
|
||||
**Versioned name**: *Convolution-1*
|
||||
|
|
@ -19,33 +19,33 @@ Convolution
|
|||
For the convolutional layer, the number of output features in each dimension is calculated using the formula:
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
n_{out} = \left ( \frac{n_{in} + 2p - k}{s} \right ) + 1
|
||||
|
||||
The receptive field in each layer is calculated using the formulas:
|
||||
|
||||
* Jump in the output feature map:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
j_{out} = j_{in} \cdot s
|
||||
|
||||
|
||||
* Size of the receptive field of output feature:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
r_{out} = r_{in} + ( k - 1 ) \cdot j_{in}
|
||||
|
||||
|
||||
* Center position of the receptive field of the first output feature:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
start_{out} = start_{in} + ( \frac{k - 1}{2} - p ) \cdot j_{in}
|
||||
|
||||
|
||||
* Output is calculated using the following formula:
|
||||
|
||||
|
||||
.. math::
|
||||
|
||||
|
||||
out = \sum_{i = 0}^{n}w_{i}x_{i} + b
|
||||
|
||||
**Attributes**:
|
||||
|
|
@ -83,7 +83,7 @@ The receptive field in each layer is calculated using the formulas:
|
|||
* *auto_pad*
|
||||
|
||||
* **Description**: *auto_pad* how the padding is calculated. Possible values:
|
||||
|
||||
|
||||
* *explicit* - use explicit padding values from *pads_begin* and *pads_end*.
|
||||
* *same_upper* - the input is padded to match the output size. In case of odd padding value an extra padding is added at the end.
|
||||
* *same_lower* - the input is padded to match the output size. In case of odd padding value an extra padding is added at the beginning.
|
||||
|
|
@ -98,7 +98,7 @@ The receptive field in each layer is calculated using the formulas:
|
|||
* **1**: Input tensor of type *T* and rank 3, 4 or 5. Layout is ``[N, C_IN, Z, Y, X]`` (number of batches, number of channels, spatial axes Z, Y, X). **Required.**
|
||||
* **2**: Kernel tensor of type *T* and rank 3, 4 or 5. Layout is ``[C_OUT, C_IN, Z, Y, X]`` (number of output channels, number of input channels, spatial axes Z, Y, X). **Required.**
|
||||
* **Note**: Type of the convolution (1D, 2D or 3D) is derived from the rank of the input tensors and not specified by any attribute:
|
||||
|
||||
|
||||
* 1D convolution (input tensors rank 3) means that there is only one spatial axis X
|
||||
* 2D convolution (input tensors rank 4) means that there are two spatial axes Y, X
|
||||
* 3D convolution (input tensors rank 5) means that there are three spatial axes Z, Y, X
|
||||
|
|
@ -117,7 +117,7 @@ The receptive field in each layer is calculated using the formulas:
|
|||
|
||||
.. code-block:: xml
|
||||
:force:
|
||||
|
||||
|
||||
<layer type="Convolution" ...>
|
||||
<data dilations="1" pads_begin="0" pads_end="0" strides="2" auto_pad="valid"/>
|
||||
<input>
|
||||
|
|
@ -146,7 +146,7 @@ The receptive field in each layer is calculated using the formulas:
|
|||
|
||||
.. code-block:: xml
|
||||
:force:
|
||||
|
||||
|
||||
<layer type="Convolution" ...>
|
||||
<data dilations="1,1" pads_begin="2,2" pads_end="2,2" strides="1,1" auto_pad="explicit"/>
|
||||
<input>
|
||||
|
|
@ -177,7 +177,7 @@ The receptive field in each layer is calculated using the formulas:
|
|||
|
||||
.. code-block:: xml
|
||||
:force:
|
||||
|
||||
|
||||
<layer type="Convolution" ...>
|
||||
<data dilations="2,2,2" pads_begin="0,0,0" pads_end="0,0,0" strides="3,3,3" auto_pad="explicit"/>
|
||||
<input>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ DeformablePSROIPooling
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Learn about DeformablePSROIPooling-1 - an object detection operation, which
|
||||
:description: Learn about DeformablePSROIPooling-1 - an object detection operation, which
|
||||
can be performed on two or three input tensors in OpenVINO.
|
||||
|
||||
**Versioned name**: *DeformablePSROIPooling-1*
|
||||
|
|
@ -110,7 +110,7 @@ This operation is compatible with `Apache MXNet DeformablePSROIPooling <https://
|
|||
|
||||
.. code-block:: xml
|
||||
:force:
|
||||
|
||||
|
||||
<layer ... type="DeformablePSROIPooling" ... >
|
||||
<data spatial_scale="0.0625" output_dim="882" group_size="3" mode="bilinear_deformable" spatial_bins_x="4" spatial_bins_y="4" trans_std="0.0" part_size="3"/>
|
||||
<input>
|
||||
|
|
@ -140,7 +140,7 @@ This operation is compatible with `Apache MXNet DeformablePSROIPooling <https://
|
|||
|
||||
.. code-block:: xml
|
||||
:force:
|
||||
|
||||
|
||||
<layer ... type="DeformablePSROIPooling" ... >
|
||||
<data group_size="7" mode="bilinear_deformable" output_dim="8" part_size="7" spatial_bins_x="4" spatial_bins_y="4" spatial_scale="0.0625" trans_std="0.1"/>
|
||||
<input>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Proposal
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Learn about Proposal-1 - an object detection operation,
|
||||
:description: Learn about Proposal-1 - an object detection operation,
|
||||
which can be performed on three required input tensors.
|
||||
|
||||
**Versioned name**: *Proposal-1*
|
||||
|
|
@ -134,7 +134,7 @@ Proposal
|
|||
|
||||
* **Description**: *framework* specifies how the box coordinates are calculated.
|
||||
* **Range of values**:
|
||||
|
||||
|
||||
* "" (empty string) - calculate box coordinates like in Caffe
|
||||
* *tensorflow* - calculate box coordinates like in the TensorFlow* Object Detection API models
|
||||
* **Type**: string
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Proposal
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Learn about Proposal-4 - an object detection operation,
|
||||
:description: Learn about Proposal-4 - an object detection operation,
|
||||
which can be performed on three required input tensors.
|
||||
|
||||
**Versioned name**: *Proposal-4*
|
||||
|
|
@ -31,7 +31,7 @@ the second optional tensor of shape ``[batch_size * post_nms_topn]`` with probab
|
|||
|
||||
* pins anchor boxes to the image according to the second input tensor that contains four deltas for each box: for *x* and *y* of center, for *width* and for *height*
|
||||
* finds out score in the first input tensor
|
||||
|
||||
|
||||
3. Filters out boxes with size less than *min_size*
|
||||
4. Sorts all proposals (*box*, *score*) by score from highest to lowest
|
||||
5. Takes top *pre_nms_topn* proposals
|
||||
|
|
|
|||
|
|
@ -60,26 +60,24 @@ offering.
|
|||
| :doc:`See the Open Model ZOO documentation <model_zoo>`
|
||||
| `Check the OMZ GitHub project <https://github.com/openvinotoolkit/open_model_zoo>`__
|
||||
|
||||
|
||||
| **Apache MXNet, Caffe, and Kaldi model formats**
|
||||
| *New solution:* conversion to ONNX via external tools
|
||||
| *Old solution:* model support discontinued with OpenVINO 2024.0
|
||||
|
|
||||
| `See the previous conversion instructions <https://docs.openvino.ai/2023.3/mxnet_caffe_kaldi.html>`__
|
||||
| `The last version supporting Apache MXNet, Caffe, and Kaldi model formats <https://docs.openvino.ai/2023.3/mxnet_caffe_kaldi.html>`__
|
||||
| :doc:`See the currently supported frameworks <openvino_docs_model_processing_introduction>`
|
||||
|
||||
|
||||
| **Post-training Optimization Tool (POT)**
|
||||
| *New solution:* NNCF extended in OpenVINO 2023.0
|
||||
| *Old solution:* POT discontinuation planned for 2024.0
|
||||
| *Old solution:* POT discontinued with OpenVINO 2024.0
|
||||
|
|
||||
| Neural Network Compression Framework (NNCF) now offers the same functionality as POT,
|
||||
apart from its original feature set. It is currently the default tool for performing
|
||||
both, post-training and quantization optimizations, while POT is considered deprecated.
|
||||
apart from its original feature set.
|
||||
|
||||
| :doc:`See how to use NNCF for model optimization <openvino_docs_model_optimization_guide>`
|
||||
| `Check the NNCF GitHub project, including documentation <https://github.com/openvinotoolkit/nncf>`__
|
||||
|
||||
|
||||
| **Inference API 1.0**
|
||||
| *New solution:* API 2.0 launched in OpenVINO 2022.1
|
||||
| *Old solution:* discontinued with OpenVINO 2024.0
|
||||
|
|
@ -93,21 +91,21 @@ offering.
|
|||
| Compile tool is now deprecated. If you need to compile a model for inference on
|
||||
a specific device, use the following script:
|
||||
|
||||
.. tab-set::
|
||||
.. tab-set::
|
||||
|
||||
.. tab-item:: Python
|
||||
:sync: py
|
||||
.. tab-item:: Python
|
||||
:sync: py
|
||||
|
||||
.. doxygensnippet:: docs/snippets/export_compiled_model.py
|
||||
:language: python
|
||||
:fragment: [export_compiled_model]
|
||||
.. doxygensnippet:: docs/snippets/export_compiled_model.py
|
||||
:language: python
|
||||
:fragment: [export_compiled_model]
|
||||
|
||||
.. tab-item:: C++
|
||||
:sync: cpp
|
||||
.. tab-item:: C++
|
||||
:sync: cpp
|
||||
|
||||
.. doxygensnippet:: docs/snippets/export_compiled_model.cpp
|
||||
:language: cpp
|
||||
:fragment: [export_compiled_model]
|
||||
.. doxygensnippet:: docs/snippets/export_compiled_model.cpp
|
||||
:language: cpp
|
||||
:fragment: [export_compiled_model]
|
||||
|
||||
| :doc:`see which devices support import / export <openvino_docs_OV_UG_Working_with_devices>`
|
||||
| :doc:`Learn more on preprocessing steps <openvino_docs_OV_UG_Preprocessing_Overview>`
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ OpenVINO Development Tools is a set of utilities that make it easy to develop an
|
|||
* Model conversion API
|
||||
* Benchmark Tool
|
||||
* Accuracy Checker and Annotation Converter
|
||||
* Post-Training Optimization Tool
|
||||
* Model Downloader and other Open Model Zoo tools
|
||||
|
||||
The instructions on this page show how to install OpenVINO Development Tools. If you are a Python developer, it only takes a few simple steps to install the tools with PyPI. If you are developing in C/C++, OpenVINO Runtime must be installed separately before installing OpenVINO Development Tools.
|
||||
|
|
@ -138,7 +137,7 @@ To install and configure the components of the development package together with
|
|||
|
||||
|
||||
where the ``extras`` parameter specifies the source deep learning framework for the input model
|
||||
and is one or more of the following values separated with "," : ``caffe``, ``kaldi``, ``mxnet``, ``onnx``, ``pytorch``, ``tensorflow``, ``tensorflow2``.
|
||||
and is one or more of the following values separated with "," : ``onnx``, ``pytorch``, ``tensorflow``, ``tensorflow2``.
|
||||
|
||||
For example, to install and configure dependencies required for working with TensorFlow 2.x and ONNX models, use the following command:
|
||||
|
||||
|
|
|
|||
|
|
@ -860,7 +860,6 @@ Supported Frameworks in MO vs OVC
|
|||
#################################
|
||||
|
||||
ov.convert_model() and OVC tool support conversion from PyTorch, TF, TF Lite, ONNX, PaddlePaddle.
|
||||
The following frameworks are supported only in MO and mo.convert_model(): Caffe, MxNet, Kaldi.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
==========================================
|
||||
|
||||
.. meta::
|
||||
:description: Learn about various base classes for front, middle and back phase
|
||||
:description: Learn about various base classes for front, middle and back phase
|
||||
transformations applied during model conversion with Model Optimizer.
|
||||
|
||||
.. danger::
|
||||
|
||||
The code described here has been **deprecated!** Do not use it to avoid working with a legacy solution. It will be kept for some time to ensure backwards compatibility, but **you should not use** it in contemporary applications.
|
||||
|
||||
This guide describes a deprecated TensorFlow conversion method. The guide on the new and recommended method, using a new frontend, can be found in the :doc:`Frontend Extensions <openvino_docs_Extensibility_UG_Frontend_Extensions>` article.
|
||||
This guide describes a deprecated TensorFlow conversion method. The guide on the new and recommended method, using a new frontend, can be found in the :doc:`Frontend Extensions <openvino_docs_Extensibility_UG_Frontend_Extensions>` article.
|
||||
|
||||
Model Optimizer provides various base classes to implement :ref:`Front Phase Transformations <mo_front_phase_transformations>`,
|
||||
:ref:`Middle Phase Transformations <mo_middle_phase_transformations>`, and :ref:`Back Phase Transformations <mo_back_phase_transformations>`.
|
||||
|
|
@ -26,7 +26,7 @@ All classes have the following common class attributes and methods:
|
|||
7. Method ``run_before()`` returns a list of transformation classes which this transformation should be executed before.
|
||||
8. Method ``run_after()`` returns a list of transformation classes which this transformation should be executed after.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
Some of the transformation types have specific class attributes and methods, which are explained in the corresponding sections of this document.
|
||||
|
||||
Model Optimizer builds a graph of dependencies between registered transformations and executes them in the topological
|
||||
|
|
@ -39,7 +39,7 @@ The diagram below shows anchor transformations, some of built-in transformations
|
|||
User-defined transformations are executed after the corresponding ``Start`` and before the corresponding ``Finish`` anchor
|
||||
transformations by default (if ``run_before()`` and ``run_after()`` methods have not been overridden).
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
The ``PreMiddleStart`` and ``PostMiddleStart`` anchors were introduced due to historical reasons to refactor the Model Optimizer pipeline, which initially had a hardcoded order of transformations.
|
||||
|
||||
.. _mo_front_phase_transformations:
|
||||
|
|
@ -53,7 +53,7 @@ There are several types of a front phase transformation:
|
|||
1. :ref:`Pattern-Defined Front Phase Transformations <pattern_defined_front_phase_transformations>` triggered for each sub-graph of the original graph isomorphic to the specified pattern.
|
||||
2. :ref:`Specific Operation Front Phase Transformations <specific_operation_front_phase_transformations>` triggered for the node with a specific ``op`` attribute value.
|
||||
3. :ref:`Generic Front Phase Transformations <generic_front_phase_transformations>`.
|
||||
4. Manually enabled transformation, defined with a JSON configuration file (for TensorFlow, ONNX, Apache MXNet, and PaddlePaddle models), specified using the ``--transformations_config`` command-line parameter:
|
||||
4. Manually enabled transformation, defined with a JSON configuration file (for TensorFlow, ONNX, and PaddlePaddle models), specified using the ``--transformations_config`` command-line parameter:
|
||||
|
||||
1. :ref:`Node Name Pattern Front Phase Transformations <node_name_pattern_front_phase_transformations>`.
|
||||
2. :ref:`Front Phase Transformations Using Start and End Points <start_end_points_front_phase_transformations>`.
|
||||
|
|
@ -72,7 +72,7 @@ This type of transformation is implemented using ``mo.front.common.replacement.F
|
|||
3. Model Optimizer executes the defined function performing graph transformation for each instance of a matched sub-graph. You can override different functions in the base transformation class so the Model Optimizer works differently:
|
||||
|
||||
1. The ``replace_sub_graph(self, graph, match)`` override the method. In this case Model Optimizer only executes the overridden function, pass the ``graph`` object and a dictionary describing the matched sub-graph. You are required to write the transformation and connect the newly created nodes to the rest of the graph.
|
||||
2. The ``generate_sub_graph(self, graph, match)`` override the method. This case is not recommended for use because it is the most complicated approach. It can be effectively replaced with one of two previous approaches.
|
||||
2. The ``generate_sub_graph(self, graph, match)`` override the method. This case is not recommended for use because it is the most complicated approach. It can be effectively replaced with one of two previous approaches.
|
||||
|
||||
The sub-graph pattern is defined in the ``pattern()`` function. This function should return a dictionary with two keys:
|
||||
``nodes`` and ``edges``:
|
||||
|
|
@ -100,17 +100,17 @@ operation:
|
|||
from openvino.tools.mo.front.common.replacement import FrontReplacementSubgraph
|
||||
from openvino.tools.mo.front.subgraph_matcher import SubgraphMatch
|
||||
from openvino.tools.mo.graph.graph import Graph, rename_nodes
|
||||
|
||||
|
||||
|
||||
|
||||
class MishFusion(FrontReplacementSubgraph):
|
||||
"""
|
||||
The transformation looks for the pattern with Softplus defining the Mish function: Mish(x) = x * tanh(SoftPlus(x)).
|
||||
"""
|
||||
enabled = True # Transformation is enabled.
|
||||
|
||||
|
||||
def run_after(self): # Run this transformation after "SoftplusFusion" transformation.
|
||||
return [SoftplusFusion]
|
||||
|
||||
|
||||
def pattern(self): # Define pattern according to formulae x * tanh(SoftPlus(x)).
|
||||
return dict(
|
||||
nodes=[
|
||||
|
|
@ -122,23 +122,23 @@ operation:
|
|||
('softplus', 'tanh'),
|
||||
('tanh', 'mul'),
|
||||
])
|
||||
|
||||
|
||||
def replace_sub_graph(self, graph: Graph, match: [dict, SubgraphMatch]): # Entry point for the transformation.
|
||||
mul = match['mul'] # Get the Node corresponding to matched "mul" node.
|
||||
mul_name = mul.soft_get('name', mul.id)
|
||||
softplus = match['softplus'] # Get the Node corresponding to the matched "softplus" node.
|
||||
|
||||
|
||||
# Determine the input port of Mul which gets the 'input' node output.
|
||||
input_port_idx = int(mul.in_port(0).get_connection().get_source().node.soft_get('op') == 'Tanh')
|
||||
|
||||
|
||||
# Check that the same tensor is provided as input to Mul and SoftPlus.
|
||||
if mul.in_port(input_port_idx).get_source() != softplus.in_port(0).get_source():
|
||||
return
|
||||
|
||||
|
||||
mish = Mish(graph, {}).create_node() # Create Mish operation.
|
||||
mish.in_port(0).connect(mul.in_port(input_port_idx).get_source()) # Connect input to the Mish.
|
||||
mul.out_port(0).get_connection().set_source(mish.out_port(0)) # Reconnect outgoing edge from "mul" to Mish.
|
||||
|
||||
|
||||
# Rename the created Mish operation to have the name of the "mul" node, which produced the value equal to the
|
||||
# Mish output.
|
||||
rename_nodes([(mul, mul_name + '/TBR'), (mish, mul_name)])
|
||||
|
|
@ -167,31 +167,31 @@ the TensorFlow:
|
|||
|
||||
.. code-block:: py
|
||||
:force:
|
||||
|
||||
|
||||
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
|
||||
from openvino.tools.mo.front.common.replacement import FrontReplacementOp
|
||||
from openvino.tools.mo.front.tf.graph_utils import create_op_with_const_inputs
|
||||
from openvino.tools.mo.graph.graph import Node, Graph, rename_nodes
|
||||
from openvino.tools.mo.ops.concat import Concat
|
||||
from openvino.tools.mo.ops.unsqueeze import Unsqueeze
|
||||
|
||||
|
||||
|
||||
|
||||
class Pack(FrontReplacementOp):
|
||||
op = "Pack" # Trigger transformation for all nodes in the graph with the op = "Pack" attribute
|
||||
op = "Pack" # Trigger transformation for all nodes in the graph with the op = "Pack" attribute
|
||||
enabled = True # Transformation is enabled.
|
||||
|
||||
|
||||
def replace_op(self, graph: Graph, node: Node): # Entry point for the transformation.
|
||||
# Create a Concat operation with a number of inputs equal to a number of inputs to Pack.
|
||||
out_node = Concat(graph, {'axis': node.axis, 'in_ports_count': len(node.in_ports())}).create_node()
|
||||
pack_name = node.soft_get('name', node.id)
|
||||
|
||||
|
||||
for ind in node.in_ports():
|
||||
# Add dimension of size 1 to all inputs of the Pack operation and add them as Concat inputs.
|
||||
unsqueeze_node = create_op_with_const_inputs(graph, Unsqueeze, {1: int64_array([node.axis])},
|
||||
{'name': node.soft_get('name', node.id) + '/Unsqueeze'})
|
||||
node.in_port(ind).get_connection().set_destination(unsqueeze_node.in_port(0))
|
||||
unsqueeze_node.out_port(0).connect(out_node.in_port(ind))
|
||||
|
||||
|
||||
# Rename the created Concat operation to have the name of the "pack" node, which produced the value equal to the
|
||||
# Concat output.
|
||||
rename_nodes([(node, pack_name + '/TBR'), (out_node, pack_name)])
|
||||
|
|
@ -205,7 +205,7 @@ Generic Front Phase Transformations
|
|||
|
||||
Model Optimizer provides a mechanism to implement generic front phase transformation. This type of transformation is
|
||||
implemented using ``mo.front.common.replacement.FrontReplacementSubgraph`` or
|
||||
``mo.front.common.replacement.FrontReplacementPattern`` as base classes. Make sure the transformation is enabled before trying to execute it.
|
||||
``mo.front.common.replacement.FrontReplacementPattern`` as base classes. Make sure the transformation is enabled before trying to execute it.
|
||||
Then, Model Optimizer executes the ``find_and_replace_pattern(self, graph)`` method and
|
||||
provides a ``Graph`` object as an input.
|
||||
|
||||
|
|
@ -219,21 +219,21 @@ specification.
|
|||
:force:
|
||||
|
||||
import logging as log
|
||||
|
||||
|
||||
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
|
||||
from openvino.tools.mo.front.common.replacement import FrontReplacementPattern
|
||||
from openvino.tools.mo.graph.graph import Graph
|
||||
from openvino.tools.mo.ops.const import Const
|
||||
from openvino.tools.mo.utils.error import Error
|
||||
|
||||
|
||||
|
||||
|
||||
class SqueezeNormalize(FrontReplacementPattern):
|
||||
"""
|
||||
Normalizes inputs of the Squeeze layers. The layers should have two inputs: the input with data and input with the
|
||||
dimensions to squeeze. If the second input is omitted then all dimensions of size 1 should be removed.
|
||||
"""
|
||||
enabled = True # The transformation is enabled.
|
||||
|
||||
|
||||
def find_and_replace_pattern(self, graph: Graph): # The function is called unconditionally.
|
||||
for squeeze_node in graph.get_op_nodes(op='Squeeze'): # Iterate over all nodes with op='Squeeze'.
|
||||
# If the operation has only 1 input node and no 'squeeze_dims' Node attribute, then convert the attribute to
|
||||
|
|
@ -272,7 +272,7 @@ Consider a situation when these Inception blocks are implemented extremely effic
|
|||
Engine operation called ``InceptionBlock`` and these blocks in the model need to be replaced with instances of this operation.
|
||||
Model Optimizer provides mechanism to trigger the transformation for a sub-graph of operations defined by the node name
|
||||
regular expressions (scope). In this particular case, some of the patterns are: ``.*InceptionV4/Mixed_5b``,
|
||||
``.*InceptionV4/Mixed_5c`` and ``.*InceptionV4/Mixed_5d``. Each pattern starts with ``.*``, because the ``InceptionV4`` prefix
|
||||
``.*InceptionV4/Mixed_5c`` and ``.*InceptionV4/Mixed_5d``. Each pattern starts with ``.*``, because the ``InceptionV4`` prefix
|
||||
is added to all nodes names during a model freeze.
|
||||
|
||||
This type of transformation is implemented using ``mo.front.tf.replacement.FrontReplacementFromConfigFileSubGraph`` as a
|
||||
|
|
@ -371,7 +371,7 @@ contains one list corresponding to this tensor. Four input nodes of the sub-grap
|
|||
|
||||
The order of items in the internal list describing nodes does not matter, but the order of elements in the top-level
|
||||
list is important. This order defines how Model Optimizer attaches input tensors to a new generated
|
||||
node if the sub-graph is replaced with a single node. The ``i``-th input node of the sub-graph is obtained using
|
||||
node if the sub-graph is replaced with a single node. The ``i``-th input node of the sub-graph is obtained using
|
||||
``match.single_input_node(i)`` call in the sub-graph transformation code. More information about API is given below. If it is
|
||||
necessary to change the order of input tensors, the configuration file can be edited in the text editor.
|
||||
|
||||
|
|
@ -406,7 +406,7 @@ The example of a JSON configuration file for a transformation with start and end
|
|||
``extensions/front/tf/ssd_support_api_v1.15.json``:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
|
||||
[
|
||||
{
|
||||
"custom_attributes": {
|
||||
|
|
@ -443,10 +443,10 @@ the value of the ``match_kind`` parameter, which should be equal to the ``points
|
|||
which should be a dictionary with two keys ``start_points`` and ``end_points``, defining start and end node names
|
||||
respectively.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
The ``include_inputs_to_sub_graph`` and ``include_outputs_to_sub_graph`` parameters are redundant and should be always equal to ``true``.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
This sub-graph match algorithm has a limitation that each start node must have only one input. Therefore, it is not possible to specify, for example, the :doc:`Convolution <openvino_docs_ops_convolution_Convolution_1>` node as input because it has two inputs: data tensor and tensor with weights.
|
||||
|
||||
For other examples of transformations with points, refer to the
|
||||
|
|
@ -463,14 +463,14 @@ but require a JSON configuration file to enable it similarly to
|
|||
:ref:`Front Phase Transformations Using Start and End Points <start_end_points_front_phase_transformations>`.
|
||||
|
||||
The base class for this type of transformation is
|
||||
``mo.front.common.replacement.FrontReplacementFromConfigFileGeneral``. Model Optimizer executes the
|
||||
``mo.front.common.replacement.FrontReplacementFromConfigFileGeneral``. Model Optimizer executes the
|
||||
``transform_graph(self, graph, replacement_descriptions)`` method and provides the ``Graph`` object and dictionary with values
|
||||
parsed from the `custom_attributes` attribute of the provided JSON configuration file.
|
||||
|
||||
The example of the configuration file for this type of transformation is ``extensions/front/tf/yolo_v1_tiny.json``:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
|
||||
[
|
||||
{
|
||||
"id": "TFYOLO",
|
||||
|
|
@ -488,7 +488,7 @@ and the corresponding transformation file is ``./extensions/front/YOLO.py``:
|
|||
|
||||
.. code-block:: py
|
||||
:force:
|
||||
|
||||
|
||||
from openvino.tools.mo.front.no_op_eraser import NoOpEraser
|
||||
from openvino.tools.mo.front.standalone_const_eraser import StandaloneConstEraser
|
||||
from openvino.tools.mo.ops.regionyolo import RegionYoloOp
|
||||
|
|
@ -496,18 +496,18 @@ and the corresponding transformation file is ``./extensions/front/YOLO.py``:
|
|||
from openvino.tools.mo.graph.graph import Node, Graph
|
||||
from openvino.tools.mo.ops.result import Result
|
||||
from openvino.tools.mo.utils.error import Error
|
||||
|
||||
|
||||
|
||||
|
||||
class YoloRegionAddon(FrontReplacementFromConfigFileGeneral):
|
||||
"""
|
||||
Replaces all Result nodes in graph with YoloRegion->Result nodes chain.
|
||||
YoloRegion node attributes are taken from configuration file
|
||||
"""
|
||||
replacement_id = 'TFYOLO' # The identifier matching the "id" attribute in the JSON file.
|
||||
|
||||
|
||||
def run_after(self):
|
||||
return [NoOpEraser, StandaloneConstEraser]
|
||||
|
||||
|
||||
def transform_graph(self, graph: Graph, replacement_descriptions):
|
||||
op_outputs = [n for n, d in graph.nodes(data=True) if 'op' in d and d['op'] == 'Result']
|
||||
for op_output in op_outputs:
|
||||
|
|
@ -572,7 +572,7 @@ There are two types of back phase transformations:
|
|||
1. :ref:`Pattern-Defined Back Phase Transformations <pattern_defined_back_phase_transformations>` triggered for each sub-graph of the original graph, isomorphic to the specified pattern.
|
||||
2. :ref:`Generic Back Phase Transformations <generic_back_phase_transformations>`.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
The graph layout during the back phase is always NCHW. However, during the front and middle phases it could be NHWC if the original model was using it. For more details, refer to :ref:`Model Conversion Pipeline <mo_model_conversion_pipeline>`.
|
||||
|
||||
.. _pattern_defined_back_phase_transformations:
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ where you can participate in a free forum discussion.
|
|||
|
||||
.. warning::
|
||||
|
||||
Note that OpenVINO support for Apache MXNet, Caffe, and Kaldi is currently being deprecated.
|
||||
As legacy formats, they will not be supported as actively as the main frontends and will be removed entirely in the future.
|
||||
Note that OpenVINO support for Apache MXNet, Caffe, and Kaldi has been discontinued.
|
||||
|
||||
.. _question-1:
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
The code described here has been **deprecated!** Do not use it to avoid working with a legacy solution. It will be kept for some time to ensure backwards compatibility, but **you should not use** it in contemporary applications.
|
||||
|
||||
This guide describes a deprecated conversion method. The guide on the new and recommended method can be found in the :doc:`Supported Model Formats <openvino_docs_model_processing_introduction>` article.
|
||||
This guide describes a deprecated conversion method. The guide on the new and recommended method can be found in the :doc:`Supported Model Formats <openvino_docs_model_processing_introduction>` article.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
|
@ -26,16 +26,16 @@
|
|||
|
||||
**OpenVINO IR (Intermediate Representation)** - the proprietary and default format of OpenVINO, benefiting from the full extent of its features. All other supported model formats, as listed below, are converted to :doc:`OpenVINO IR <openvino_ir>` to enable inference. Consider storing your model in this format to minimize first-inference latency, perform model optimization, and, in some cases, save space on your drive.
|
||||
|
||||
**PyTorch, TensorFlow, ONNX, and PaddlePaddle** - can be used with OpenVINO Runtime API directly,
|
||||
**PyTorch, TensorFlow, ONNX, and PaddlePaddle** - can be used with OpenVINO Runtime API directly,
|
||||
which means you do not need to save them as OpenVINO IR before including them in your application.
|
||||
OpenVINO can read, compile, and convert them automatically, as part of its pipeline.
|
||||
|
||||
In the Python API, these options are provided as three separate methods:
|
||||
In the Python API, these options are provided as three separate methods:
|
||||
``read_model()``, ``compile_model()``, and ``convert_model()``.
|
||||
The ``convert_model()`` method enables you to perform additional adjustments
|
||||
to the model, such as setting shapes, changing model input types or layouts,
|
||||
cutting parts of the model, freezing inputs, etc. For a detailed description
|
||||
of the conversion process, see the
|
||||
The ``convert_model()`` method enables you to perform additional adjustments
|
||||
to the model, such as setting shapes, changing model input types or layouts,
|
||||
cutting parts of the model, freezing inputs, etc. For a detailed description
|
||||
of the conversion process, see the
|
||||
:doc:`model conversion guide <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
|
||||
|
||||
Here are code examples of how to use these methods with different model formats:
|
||||
|
|
@ -544,16 +544,15 @@ Here are code examples of how to use these methods with different model formats:
|
|||
:doc:`article <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Paddle>`.
|
||||
|
||||
|
||||
**MXNet, Caffe, and Kaldi** are legacy formats that need to be converted explicitly to OpenVINO IR or ONNX before running inference.
|
||||
As OpenVINO is currently proceeding **to deprecate these formats** and **remove their support entirely in the future**,
|
||||
converting them to ONNX for use with OpenVINO should be considered the default path.
|
||||
As OpenVINO support for **MXNet, Caffe, and Kaldi formats** has been **discontinued**, converting these legacy formats
|
||||
to OpenVINO IR or ONNX before running inference should be considered the default path for use with OpenVINO.
|
||||
|
||||
.. note::
|
||||
|
||||
If you want to keep working with the legacy formats the old way, refer to a previous
|
||||
If you want to keep working with the legacy formats the old way, refer to a previous
|
||||
`OpenVINO LTS version and its documentation <https://docs.openvino.ai/2022.3/Supported_Model_Formats.html>`__ .
|
||||
|
||||
OpenVINO versions of 2023 are mostly compatible with the old instructions,
|
||||
|
||||
OpenVINO versions of 2023 are mostly compatible with the old instructions,
|
||||
through a deprecated MO tool, installed with the deprecated OpenVINO Developer Tools package.
|
||||
|
||||
`OpenVINO 2023.0 <https://docs.openvino.ai/2023.3/Supported_Model_Formats_MO_DG.html>`__ is the last
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
.. meta::
|
||||
:description: Get to know conversion methods for specific TensorFlow, ONNX, PyTorch, MXNet, and Kaldi models.
|
||||
:description: Get to know conversion methods for specific TensorFlow, ONNX, and PyTorch models.
|
||||
|
||||
|
||||
.. danger::
|
||||
|
|
@ -45,19 +45,17 @@
|
|||
|
||||
This guide describes a deprecated conversion method. The guide on the new and recommended method can be found in the :doc:`Python tutorials <tutorials>`.
|
||||
|
||||
This section provides a set of tutorials that demonstrate conversion methods for specific
|
||||
TensorFlow, ONNX, and PyTorch models. Note that these instructions do not cover all use
|
||||
This section provides a set of tutorials that demonstrate conversion methods for specific
|
||||
TensorFlow, ONNX, and PyTorch models. Note that these instructions do not cover all use
|
||||
cases and may not reflect your particular needs.
|
||||
Before studying the tutorials, try to convert the model out-of-the-box by specifying only the
|
||||
Before studying the tutorials, try to convert the model out-of-the-box by specifying only the
|
||||
``--input_model`` parameter in the command line.
|
||||
|
||||
.. note::
|
||||
|
||||
Apache MXNet, Caffe, and Kaldi are no longer directly supported by OpenVINO.
|
||||
They will remain available for some time, so make sure to transition to other
|
||||
frameworks before they are fully discontinued.
|
||||
|
||||
You will find a collection of :doc:`Python tutorials <tutorials>` written for running on Jupyter notebooks
|
||||
that provide an introduction to the OpenVINO™ toolkit and explain how to use the Python API and tools for
|
||||
Apache MXNet, Caffe, and Kaldi are no longer directly supported by OpenVINO.
|
||||
|
||||
You will find a collection of :doc:`Python tutorials <tutorials>` written for running on Jupyter notebooks
|
||||
that provide an introduction to the OpenVINO™ toolkit and explain how to use the Python API and tools for
|
||||
optimized deep learning inference.
|
||||
|
||||
|
|
|
|||
|
|
@ -254,13 +254,3 @@ Additional Resources
|
|||
* Pre-trained deep learning models: :ref:`Overview of OpenVINO™ Toolkit Pre-Trained Models <model zoo>`
|
||||
* IoT libraries and code samples in the GitHUB repository: `Intel® IoT Developer Kit <https://github.com/intel-iot-devkit>`__
|
||||
|
||||
<!---
|
||||
To learn more about converting models from specific frameworks, go to:
|
||||
* :ref:`Convert Your Caffe Model <convert model caffe>`
|
||||
* :ref:`Convert Your TensorFlow Model <convert model tf>`
|
||||
* :ref:`Convert Your TensorFlow Lite Model <convert model tfl>`
|
||||
* :ref:`Convert Your Apache MXNet Model <convert model mxnet>`
|
||||
* :ref:`Convert Your Kaldi Model <convert model kaldi>`
|
||||
* :ref:`Convert Your ONNX Model <convert model onnx>`
|
||||
--->
|
||||
|
||||
|
|
|
|||
|
|
@ -113,12 +113,6 @@ Tutorials that explain how to optimize and quantize models with OpenVINO tools.
|
|||
|
||||
Use Neural Network Compression Framework (NNCF) to quantize PyTorch model in post-training mode (without model fine-tuning).
|
||||
|
||||
.. showcase::
|
||||
:title: 111-yolov5-quantization-migration
|
||||
:img: _static/images/notebook_eye.png
|
||||
|
||||
Migrate YOLOv5 POT API based quantization pipeline on Neural Network Compression Framework (NNCF).
|
||||
|
||||
.. showcase::
|
||||
:title: 110-ct-segmentation-quantize-nncf
|
||||
:img: _static/images/notebook_eye.png
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Quantizing Models Post-training
|
|||
|
||||
basic_quantization_flow
|
||||
quantization_w_accuracy_control
|
||||
|
||||
|
||||
|
||||
Post-training model optimization is the process of applying special methods that transform the model into a more hardware-friendly representation without retraining or fine-tuning. The most popular and widely-spread method here is 8-bit post-training quantization because it is:
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ Post-training model optimization is the process of applying special methods that
|
|||
|
||||
.. image:: _static/images/quantization_picture.svg
|
||||
|
||||
`Neural Network Compression Framework (NNCF) <https://github.com/openvinotoolkit/nncf>`__ provides a post-training quantization API available in Python that is aimed at reusing the code for model training or validation that is usually available with the model in the source framework, for example, PyTorch or TensroFlow. The NNCF API is cross-framework and currently supports models in the following frameworks: OpenVINO, PyTorch, TensorFlow 2.x, and ONNX. Currently, post-training quantization for models in OpenVINO Intermediate Representation is the most mature in terms of supported methods and models coverage.
|
||||
`Neural Network Compression Framework (NNCF) <https://github.com/openvinotoolkit/nncf>`__ provides a post-training quantization API available in Python that is aimed at reusing the code for model training or validation that is usually available with the model in the source framework, for example, PyTorch or TensroFlow. The NNCF API is cross-framework and currently supports models in the following frameworks: OpenVINO, PyTorch, TensorFlow 2.x, and ONNX. Currently, post-training quantization for models in OpenVINO Intermediate Representation is the most mature in terms of supported methods and models coverage.
|
||||
|
||||
NNCF API has two main capabilities to apply 8-bit post-training quantization:
|
||||
|
||||
|
|
@ -35,5 +35,4 @@ Additional Resources
|
|||
|
||||
* :doc:`Optimizing Models at Training Time <tmo_introduction>`
|
||||
* `NNCF GitHub <https://github.com/openvinotoolkit/nncf>`__
|
||||
* `Tutorial: Migrate quantization from POT API to NNCF API <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/111-yolov5-quantization-migration>`__
|
||||
|
||||
|
|
|
|||
|
|
@ -152,4 +152,3 @@ Additional Resources
|
|||
* `3D Human Pose Estimation Python Demo <https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/3d_segmentation_demo/python>`__
|
||||
* `Object Detection C++ Demo <https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/object_detection_demo/cpp>`__
|
||||
* `Object Detection Python Demo <https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/object_detection_demo/python>`__
|
||||
* `POT-specific sample with sparse resnet-50 generation <https://github.com/openvinotoolkit/openvino/tree/master/tools/pot/openvino/tools/pot/api/samples/prune_and_quantize>`__
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,3 +0,0 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cf96b8c432fd043883f1adf03e2e5f554812455814af6245b9a13eacf0e39696
|
||||
size 33477
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8bbf27a2ad6605dcb53802f06b329b5189988d317d7770f689d6ff8ba6b450e3
|
||||
size 773347
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<html>
|
||||
<head><title>Index of /projects/ov-notebook/0.1.0-latest/20240125220808/dist/rst_files/111-yolov5-quantization-migration-with-output_files/</title></head>
|
||||
<body bgcolor="white">
|
||||
<h1>Index of /projects/ov-notebook/0.1.0-latest/20240125220808/dist/rst_files/111-yolov5-quantization-migration-with-output_files/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="111-yolov5-quantization-migration-with-output_34_0.png">111-yolov5-quantization-migration-with-output_3..></a> 26-Jan-2024 01:05 33477
|
||||
<a href="111-yolov5-quantization-migration-with-output_40_0.png">111-yolov5-quantization-migration-with-output_4..></a> 26-Jan-2024 01:05 773347
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
|
|
@ -79,7 +79,7 @@ documentation.
|
|||
.. code:: ipython3
|
||||
|
||||
# OVC CLI tool parameters description
|
||||
|
||||
|
||||
! ovc --help
|
||||
|
||||
|
||||
|
|
@ -88,12 +88,12 @@ documentation.
|
|||
usage: ovc INPUT_MODEL... [-h] [--output_model OUTPUT_MODEL]
|
||||
[--compress_to_fp16 [True | False]] [--version] [--input INPUT]
|
||||
[--output OUTPUT] [--extension EXTENSION] [--verbose]
|
||||
|
||||
|
||||
positional arguments:
|
||||
INPUT_MODEL Input model file(s) from TensorFlow, ONNX,
|
||||
PaddlePaddle. Use openvino.convert_model in Python to
|
||||
convert models from PyTorch.
|
||||
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--output_model OUTPUT_MODEL
|
||||
|
|
@ -152,7 +152,7 @@ This notebook uses two models for conversion examples:
|
|||
.. code:: ipython3
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# create a directory for models files
|
||||
MODEL_DIRECTORY_PATH = Path("model")
|
||||
MODEL_DIRECTORY_PATH.mkdir(exist_ok=True)
|
||||
|
|
@ -165,9 +165,9 @@ NLP model from Hugging Face and export it in ONNX format:
|
|||
|
||||
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
||||
from transformers.onnx import export, FeaturesManager
|
||||
|
||||
|
||||
ONNX_NLP_MODEL_PATH = MODEL_DIRECTORY_PATH / "distilbert.onnx"
|
||||
|
||||
|
||||
# download model
|
||||
hf_model = AutoModelForSequenceClassification.from_pretrained(
|
||||
"distilbert-base-uncased-finetuned-sst-2-english"
|
||||
|
|
@ -176,14 +176,14 @@ NLP model from Hugging Face and export it in ONNX format:
|
|||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
"distilbert-base-uncased-finetuned-sst-2-english"
|
||||
)
|
||||
|
||||
|
||||
# get model onnx config function for output feature format sequence-classification
|
||||
model_kind, model_onnx_config = FeaturesManager.check_supported_model_or_raise(
|
||||
hf_model, feature="sequence-classification"
|
||||
)
|
||||
# fill onnx config based on pytorch model config
|
||||
onnx_config = model_onnx_config(hf_model.config)
|
||||
|
||||
|
||||
# export to onnx format
|
||||
export(
|
||||
preprocessor=tokenizer,
|
||||
|
|
@ -227,7 +227,7 @@ CV classification model from torchvision:
|
|||
.. code:: ipython3
|
||||
|
||||
from torchvision.models import resnet50, ResNet50_Weights
|
||||
|
||||
|
||||
# create model object
|
||||
pytorch_model = resnet50(weights=ResNet50_Weights.DEFAULT)
|
||||
# switch model from training to inference mode
|
||||
|
|
@ -423,9 +423,9 @@ Convert PyTorch model to ONNX format:
|
|||
|
||||
import torch
|
||||
import warnings
|
||||
|
||||
|
||||
ONNX_CV_MODEL_PATH = MODEL_DIRECTORY_PATH / "resnet.onnx"
|
||||
|
||||
|
||||
if ONNX_CV_MODEL_PATH.exists():
|
||||
print(f"ONNX model {ONNX_CV_MODEL_PATH} already exists.")
|
||||
else:
|
||||
|
|
@ -452,11 +452,11 @@ To convert a model to OpenVINO IR, use the following API:
|
|||
.. code:: ipython3
|
||||
|
||||
import openvino as ov
|
||||
|
||||
|
||||
# ov.convert_model returns an openvino.runtime.Model object
|
||||
print(ONNX_NLP_MODEL_PATH)
|
||||
ov_model = ov.convert_model(ONNX_NLP_MODEL_PATH)
|
||||
|
||||
|
||||
# then model can be serialized to *.xml & *.bin files
|
||||
ov.save_model(ov_model, MODEL_DIRECTORY_PATH / "distilbert.xml")
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ documentation.
|
|||
.. code:: ipython3
|
||||
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(
|
||||
ONNX_NLP_MODEL_PATH, input=[("input_ids", [1, 128]), ("attention_mask", [1, 128])]
|
||||
)
|
||||
|
|
@ -549,7 +549,7 @@ conversion API parameter as ``-1`` or ``?`` when using ``ovc``:
|
|||
.. code:: ipython3
|
||||
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(
|
||||
ONNX_NLP_MODEL_PATH, input=[("input_ids", [1, -1]), ("attention_mask", [1, -1])]
|
||||
)
|
||||
|
|
@ -590,10 +590,10 @@ sequence length dimension:
|
|||
.. code:: ipython3
|
||||
|
||||
import openvino as ov
|
||||
|
||||
|
||||
|
||||
|
||||
sequence_length_dim = ov.Dimension(10, 128)
|
||||
|
||||
|
||||
ov_model = ov.convert_model(
|
||||
ONNX_NLP_MODEL_PATH, input=[("input_ids", [1, sequence_length_dim]), ("attention_mask", [1, sequence_length_dim])]
|
||||
)
|
||||
|
|
@ -636,7 +636,7 @@ disabled by setting ``compress_to_fp16`` flag to ``False``:
|
|||
.. code:: ipython3
|
||||
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(ONNX_NLP_MODEL_PATH)
|
||||
ov.save_model(ov_model, MODEL_DIRECTORY_PATH / 'distilbert.xml', compress_to_fp16=False)
|
||||
|
||||
|
|
@ -675,9 +675,9 @@ frameworks conversion guides.
|
|||
|
||||
import openvino as ov
|
||||
import torch
|
||||
|
||||
|
||||
example_input = torch.rand(1, 3, 224, 224)
|
||||
|
||||
|
||||
ov_model = ov.convert_model(pytorch_model, example_input=example_input, input=example_input.shape)
|
||||
|
||||
|
||||
|
|
@ -690,10 +690,10 @@ frameworks conversion guides.
|
|||
|
||||
import openvino as ov
|
||||
import tensorflow_hub as hub
|
||||
|
||||
|
||||
model = hub.load("https://www.kaggle.com/models/google/movenet/frameworks/TensorFlow2/variations/singlepose-lightning/versions/4")
|
||||
movenet = model.signatures['serving_default']
|
||||
|
||||
|
||||
ov_model = ov.convert_model(movenet)
|
||||
|
||||
|
||||
|
|
@ -747,9 +747,9 @@ Resnet50 model that was exported to the ONNX format:
|
|||
|
||||
# Converter API
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(ONNX_CV_MODEL_PATH)
|
||||
|
||||
|
||||
prep = ov.preprocess.PrePostProcessor(ov_model)
|
||||
prep.input('input.1').model().set_layout(ov.Layout("nchw"))
|
||||
ov_model = prep.build()
|
||||
|
|
@ -758,7 +758,7 @@ Resnet50 model that was exported to the ONNX format:
|
|||
|
||||
# Legacy Model Optimizer API
|
||||
from openvino.tools import mo
|
||||
|
||||
|
||||
ov_model = mo.convert_model(ONNX_CV_MODEL_PATH, layout="nchw")
|
||||
|
||||
|
||||
|
|
@ -787,9 +787,9 @@ and the layout of an original model:
|
|||
|
||||
# Converter API
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(ONNX_CV_MODEL_PATH)
|
||||
|
||||
|
||||
prep = ov.preprocess.PrePostProcessor(ov_model)
|
||||
prep.input('input.1').tensor().set_layout(ov.Layout("nhwc"))
|
||||
prep.input('input.1').model().set_layout(ov.Layout("nchw"))
|
||||
|
|
@ -799,9 +799,9 @@ and the layout of an original model:
|
|||
|
||||
# Legacy Model Optimizer API
|
||||
from openvino.tools import mo
|
||||
|
||||
|
||||
ov_model = mo.convert_model(ONNX_CV_MODEL_PATH, layout="nchw->nhwc")
|
||||
|
||||
|
||||
# alternatively use source_layout and target_layout parameters
|
||||
ov_model = mo.convert_model(
|
||||
ONNX_CV_MODEL_PATH, source_layout="nchw", target_layout="nhwc"
|
||||
|
|
@ -823,22 +823,22 @@ for more examples.
|
|||
|
||||
# Converter API
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(ONNX_CV_MODEL_PATH)
|
||||
|
||||
|
||||
prep = ov.preprocess.PrePostProcessor(ov_model)
|
||||
prep.input("input.1").tensor().set_layout(ov.Layout("nchw"))
|
||||
prep.input("input.1").preprocess().mean([255 * x for x in [0.485, 0.456, 0.406]])
|
||||
prep.input("input.1").preprocess().scale([255 * x for x in [0.229, 0.224, 0.225]])
|
||||
|
||||
|
||||
ov_model = prep.build()
|
||||
|
||||
.. code:: ipython3
|
||||
|
||||
# Legacy Model Optimizer API
|
||||
from openvino.tools import mo
|
||||
|
||||
|
||||
|
||||
|
||||
ov_model = mo.convert_model(
|
||||
ONNX_CV_MODEL_PATH,
|
||||
mean_values=[255 * x for x in [0.485, 0.456, 0.406]],
|
||||
|
|
@ -860,9 +860,9 @@ the color channels before inference.
|
|||
|
||||
# Converter API
|
||||
import openvino as ov
|
||||
|
||||
|
||||
ov_model = ov.convert_model(ONNX_CV_MODEL_PATH)
|
||||
|
||||
|
||||
prep = ov.preprocess.PrePostProcessor(ov_model)
|
||||
prep.input('input.1').tensor().set_layout(ov.Layout("nchw"))
|
||||
prep.input('input.1').preprocess().reverse_channels()
|
||||
|
|
@ -872,7 +872,7 @@ the color channels before inference.
|
|||
|
||||
# Legacy Model Optimizer API
|
||||
from openvino.tools import mo
|
||||
|
||||
|
||||
ov_model = mo.convert_model(ONNX_CV_MODEL_PATH, reverse_input_channels=True)
|
||||
|
||||
Cutting Off Parts of a Model
|
||||
|
|
|
|||
Loading…
Reference in New Issue