[DOCS] Merge Samples Articles Language Versions (#21661)

* Merge samples

* Update docs/articles_en/learn_openvino/openvino_samples/automatic_speech_recognition.rst

Co-authored-by: Maciej Smyk <maciejx.smyk@intel.com>

* Update docs/articles_en/learn_openvino/openvino_samples.rst

Co-authored-by: Maciej Smyk <maciejx.smyk@intel.com>

* Update docs/articles_en/learn_openvino/openvino_samples.rst

Co-authored-by: Maciej Smyk <maciejx.smyk@intel.com>

* additional resources

* Update docs/articles_en/learn_openvino/openvino_samples/model_creation.rst

Co-authored-by: Maciej Smyk <maciejx.smyk@intel.com>

* Update docs/articles_en/learn_openvino/openvino_samples/automatic_speech_recognition.rst

Co-authored-by: Maciej Smyk <maciejx.smyk@intel.com>

* reorganize contents of requirements

* remove api reference

* add links to READMEs on repo

* remove speech recognition sample

* removal of deprecation notice

* update conversion steps

* Revert remove speech recognition sample

* remove trailing spaces

* fix links

* Removed unwanted changes from submodules

* applying suggestions

* update api reference

* apply suggestions

---------

Co-authored-by: Maciej Smyk <maciejx.smyk@intel.com>
This commit is contained in:
Sebastian Golebiewski 2024-01-12 14:24:15 +01:00 committed by GitHub
parent 314eb0c6fb
commit 9ebacbb379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
112 changed files with 3919 additions and 4928 deletions

View File

@ -16,9 +16,7 @@ Test performance with the benchmark_app
You can run OpenVINO benchmarks in both C++ and Python APIs, yet the experience differs in each case.
The Python one is part of OpenVINO Runtime installation, while C++ is available as a code sample.
For a detailed description, see:
* :doc:`benchmark_app for C++ <openvino_inference_engine_samples_benchmark_app_README>`
* :doc:`benchmark_app for Python <openvino_inference_engine_tools_benchmark_tool_README>`.
For a detailed description, see: :doc:`benchmark_app <openvino_sample_benchmark_tool>`.
Make sure to install the latest release package with support for frameworks of the models you want to test.
For the most reliable performance benchmarks, :doc:`prepare the model for use with OpenVINO <openvino_docs_model_processing_introduction>`.
@ -87,7 +85,7 @@ slower than the subsequent ones, an aggregated value can be used for the executi
When comparing the OpenVINO Runtime performance with the framework or another reference code, make sure that both versions are as similar as possible:
- Wrap the exact inference execution (for examples, see :doc:`Benchmark app <openvino_inference_engine_samples_benchmark_app_README>`).
- Wrap the exact inference execution (for examples, see :doc:`Benchmark app <openvino_sample_benchmark_tool>`).
- Do not include model loading time.
- Ensure that the inputs are identical for OpenVINO Runtime and the framework. For example, watch out for random values that can be used to populate the inputs.
- In situations when any user-side pre-processing should be tracked separately, consider :doc:`image pre-processing and conversion <openvino_docs_OV_UG_Preprocessing_Overview>`.
@ -98,7 +96,7 @@ Internal Inference Performance Counters and Execution Graphs
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
More detailed insights into inference performance breakdown can be achieved with device-specific performance counters and/or execution graphs.
Both :doc:`C++ <openvino_inference_engine_samples_benchmark_app_README>` and :doc:`Python <openvino_inference_engine_tools_benchmark_tool_README>`
Both :doc:`C++ and Python <openvino_sample_benchmark_tool>`
versions of the *benchmark_app* support a ``-pc`` command-line parameter that outputs internal execution breakdown.
For example, the table shown below is part of performance counters for quantized

View File

@ -31,10 +31,8 @@ Performance Information F.A.Q.
All of the performance benchmarks are generated using the
open-source tool within the Intel® Distribution of OpenVINO™ toolkit
called ``benchmark_app``. This tool is available
:doc:`for C++ apps <openvino_inference_engine_samples_benchmark_app_README>`.
as well as
:doc:`for Python apps <openvino_inference_engine_tools_benchmark_tool_README>`.
called :doc:`benchmark_app <openvino_sample_benchmark_tool>`.
This tool is available for Python and C++ apps.
For a simple instruction on testing performance, see the :doc:`Getting Performance Numbers Guide <openvino_docs_MO_DG_Getting_Performance_Numbers>`.

View File

@ -194,5 +194,5 @@ See Also
* :doc:`OpenVINO Transformations <openvino_docs_transformations>`
* :doc:`Using OpenVINO Runtime Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Hello Shape Infer SSD sample <openvino_inference_engine_samples_hello_reshape_ssd_README>`
* :doc:`Hello Shape Infer SSD sample <openvino_sample_hello_reshape_ssd>`

View File

@ -329,7 +329,7 @@ After that you should quantize model by the :doc:`Model Quantizer <omz_tools_dow
Inference
+++++++++
The simplest way to infer the model and collect performance counters is :doc:`Benchmark Application <openvino_inference_engine_samples_benchmark_app_README>`.
The simplest way to infer the model and collect performance counters is :doc:`Benchmark Application <openvino_sample_benchmark_tool>`.
.. code-block:: sh

View File

@ -196,8 +196,8 @@ Try the :doc:`C++ Quick Start Example <openvino_docs_get_started_get_started_dem
Visit the :doc:`Samples <openvino_docs_OV_UG_Samples_Overview>` page for other C++ example applications to get you started with OpenVINO, such as:
* :doc:`Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README>`
* :doc:`Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README>`
* :doc:`Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd>`
* :doc:`Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition>`
Learn OpenVINO Development Tools
++++++++++++++++++++++++++++++++
@ -205,7 +205,7 @@ Learn OpenVINO Development Tools
* Explore a variety of pre-trained deep learning models in the :doc:`Open Model Zoo <model_zoo>` and deploy them in demo applications to see how they work.
* Want to import a model from another framework and optimize its performance with OpenVINO? Visit the :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` page.
* Accelerate your model's speed even further with quantization and other compression techniques using :doc:`Neural Network Compression Framework (NNCF) <ptq_introduction>`.
* Benchmark your model's inference speed with one simple command using the :doc:`Benchmark Tool <openvino_inference_engine_tools_benchmark_tool_README>`.
* Benchmark your model's inference speed with one simple command using the :doc:`Benchmark Tool <openvino_sample_benchmark_tool>`.
Additional Resources
####################

View File

@ -37,6 +37,4 @@ API 2.0
Additional Resources
####################
* :doc:`Hello Model Creation C++ Sample <openvino_inference_engine_samples_model_creation_sample_README>`
* :doc:`Hello Model Creation Python Sample <openvino_inference_engine_ie_bridges_python_sample_model_creation_sample_README>`
* :doc:`Hello Model Creation Sample <openvino_sample_model_creation>`

View File

@ -199,5 +199,5 @@ Additional Resources
####################
- :doc:`Preprocessing details <openvino_docs_OV_UG_Preprocessing_Details>`
- :doc:`NV12 classification sample <openvino_inference_engine_samples_hello_nv12_input_classification_README>`
- :doc:`NV12 classification sample <openvino_sample_hello_nv12_input_classification>`

View File

@ -34,7 +34,7 @@ Example: Running ASpIRE Chain TDNN Model with the Speech Recognition Sample
.. note::
Before you continue with this part of the article, get familiar with the
:doc:`Speech Recognition sample <openvino_inference_engine_samples_speech_sample_README>`.
:doc:`Speech Recognition sample <openvino_sample_automatic_speech_recognition>`.
In this example, the input data contains one utterance from one speaker.
@ -151,5 +151,5 @@ Run the Speech Recognition sample with the created ivector ``.ark`` file:
Results can be decoded as described in "Use of Sample in Kaldi Speech Recognition Pipeline"
in the :doc:`Speech Recognition Sample description <openvino_inference_engine_samples_speech_sample_README>` article.
in the :doc:`Speech Recognition Sample description <openvino_sample_automatic_speech_recognition>` article.

View File

@ -45,5 +45,5 @@ How to Run the Example
- ``-s``, ``--subset_size`` option. Defines subset size for calibration;
- ``-o``, ``--output`` option. Defines output folder for the quantized model.
3. Validate your INT8 model using ``./speech_example`` from the Inference Engine examples. Follow the :doc:`speech example description link <openvino_inference_engine_samples_speech_sample_README>` for details.
3. Validate your INT8 model using ``./speech_example`` from the Inference Engine examples. Follow the :doc:`speech example description link <openvino_sample_automatic_speech_recognition>` for details.

View File

@ -52,7 +52,7 @@ For more information about Model Conversion API, refer to its :doc:`documentatio
Performance Benchmarking of Full-Precision Models
#################################################
Check the performance of the full-precision model in the IR format using :doc:`Deep Learning Benchmark <openvino_inference_engine_tools_benchmark_tool_README>` tool:
Check the performance of the full-precision model in the IR format using :doc:`Deep Learning Benchmark <openvino_sample_benchmark_tool>` tool:
.. code-block:: sh
@ -206,7 +206,7 @@ Model Quantization
Performance Benchmarking of Quantized Model
###########################################
Check the performance of the quantized model using :doc:`Deep Learning Benchmark <openvino_inference_engine_tools_benchmark_tool_README>` tool:
Check the performance of the quantized model using :doc:`Deep Learning Benchmark <openvino_sample_benchmark_tool>` tool:
.. code-block:: sh

View File

@ -123,7 +123,7 @@ Pipeline and model configuration features in OpenVINO Runtime allow you to easil
* :doc:`Automatic Batching <openvino_docs_OV_UG_Automatic_Batching>` performs on-the-fly grouping of inference requests to maximize utilization of the target hardwares memory and processing cores.
* :doc:`Performance Hints <openvino_docs_OV_UG_Performance_Hints>` automatically adjust runtime parameters to prioritize for low latency or high throughput
* :doc:`Dynamic Shapes <openvino_docs_OV_UG_DynamicShapes>` reshapes models to accept arbitrarily-sized inputs, increasing flexibility for applications that encounter different data shapes
* :doc:`Benchmark Tool <openvino_inference_engine_tools_benchmark_tool_README>` characterizes model performance in various hardware and pipeline configurations
* :doc:`Benchmark Tool <openvino_sample_benchmark_tool>` characterizes model performance in various hardware and pipeline configurations
.. _additional-resources:

View File

@ -84,8 +84,8 @@ Now you are ready to try out OpenVINO™. You can use the following tutorials to
* Developing in C/C++:
* :doc:`Image Classification Async C++ Sample <openvino_inference_engine_samples_classification_sample_async_README>`
* :doc:`Hello Classification C++ Sample <openvino_inference_engine_samples_hello_classification_README>`
* :doc:`Hello Reshape SSD C++ Sample <openvino_inference_engine_samples_hello_reshape_ssd_README>`
* :doc:`Image Classification Async C++ Sample <openvino_sample_image_classification_async>`
* :doc:`Hello Classification C++ Sample <openvino_sample_hello_classification>`
* :doc:`Hello Reshape SSD C++ Sample <openvino_sample_hello_reshape_ssd>`

View File

@ -238,8 +238,8 @@ Learn more about how to integrate a model in OpenVINO applications by trying out
* Visit the :ref:`Samples <code samples>` page for other C++ example applications to get you started with OpenVINO, such as:
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README.html>`_
* `Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README.html>`_
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd.html>`_
* `Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition.html>`_
You can also try the following:

View File

@ -299,8 +299,8 @@ Learn more about how to integrate a model in OpenVINO applications by trying out
Visit the :doc:`Samples <openvino_docs_OV_UG_Samples_Overview>` page for other C++ example applications to get you started with OpenVINO, such as:
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README.html>`__
* `Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README.html>`__
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd.html>`__
* `Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition.html>`__

View File

@ -216,8 +216,8 @@ Learn more about how to integrate a model in OpenVINO applications by trying out
* Visit the :ref:`Samples <code samples>` page for other C++ example applications to get you started with OpenVINO, such as:
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README.html>`_
* `Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README.html>`_
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd.html>`_
* `Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition.html>`_
You can also try the following things:

View File

@ -173,8 +173,8 @@ Now that you've installed OpenVINO Runtime, you're ready to run your own machine
Visit the :ref:`Samples <code samples>` page for other C++ example applications to get you started with OpenVINO, such as:
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README.html>`_
* `Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README.html>`_
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd.html>`_
* `Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition.html>`_
Uninstalling Intel® Distribution of OpenVINO™ Toolkit
#####################################################

View File

@ -119,8 +119,8 @@ on building and running a basic image classification C++ application.
Visit the :doc:`Samples <openvino_docs_OV_UG_Samples_Overview>` page for other C++ example applications to get you started with OpenVINO, such as:
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README.html>`__
* `Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README.html>`__
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd.html>`__
* `Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition.html>`__

View File

@ -199,8 +199,8 @@ Now that you've installed OpenVINO Runtime, you're ready to run your own machine
Visit the :ref:`Samples <code samples>` page for other C++ example applications to get you started with OpenVINO, such as:
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_inference_engine_samples_hello_reshape_ssd_README.html>`_
* `Automatic speech recognition C++ sample <openvino_inference_engine_samples_speech_sample_README.html>`_
* `Basic object detection with the Hello Reshape SSD C++ sample <openvino_sample_hello_reshape_ssd.html>`_
* `Automatic speech recognition C++ sample <openvino_sample_automatic_speech_recognition.html>`_
.. _uninstall-from-windows:

View File

@ -7,106 +7,90 @@ OpenVINO™ Samples
.. _code samples:
.. meta::
:description: OpenVINO™ samples include a collection of simple console applications
that explain how to implement the capabilities and features of
:description: OpenVINO™ samples include a collection of simple console applications
that explain how to implement the capabilities and features of
OpenVINO API into an application.
.. toctree::
:maxdepth: 1
:hidden:
Get Started with C++ Samples <openvino_docs_get_started_get_started_demos>
openvino_inference_engine_samples_classification_sample_async_README
openvino_inference_engine_ie_bridges_python_sample_classification_sample_async_README
openvino_inference_engine_samples_hello_classification_README
openvino_inference_engine_ie_bridges_c_samples_hello_classification_README
openvino_inference_engine_ie_bridges_python_sample_hello_classification_README
openvino_inference_engine_samples_hello_reshape_ssd_README
openvino_inference_engine_ie_bridges_python_sample_hello_reshape_ssd_README
openvino_inference_engine_samples_hello_nv12_input_classification_README
openvino_inference_engine_ie_bridges_c_samples_hello_nv12_input_classification_README
openvino_inference_engine_samples_hello_query_device_README
openvino_inference_engine_ie_bridges_python_sample_hello_query_device_README
openvino_inference_engine_samples_model_creation_sample_README
openvino_inference_engine_ie_bridges_python_sample_model_creation_sample_README
openvino_inference_engine_samples_speech_sample_README
openvino_inference_engine_ie_bridges_python_sample_speech_sample_README
openvino_inference_engine_samples_sync_benchmark_README
openvino_inference_engine_ie_bridges_python_sample_sync_benchmark_README
openvino_inference_engine_samples_throughput_benchmark_README
openvino_inference_engine_ie_bridges_python_sample_throughput_benchmark_README
openvino_inference_engine_ie_bridges_python_sample_bert_benchmark_README
openvino_inference_engine_samples_benchmark_app_README
openvino_inference_engine_tools_benchmark_tool_README
openvino_sample_hello_classification
openvino_sample_hello_nv12_input_classification
openvino_sample_hello_query_device
openvino_sample_hello_reshape_ssd
openvino_sample_image_classification_async
openvino_sample_model_creation
openvino_sample_sync_benchmark
openvino_sample_throughput_benchmark
openvino_sample_bert_benchmark
openvino_sample_benchmark_tool
openvino_sample_automatic_speech_recognition
The OpenVINO™ samples are simple console applications that show how to utilize specific OpenVINO API capabilities within an application. They can assist you in executing specific tasks such as loading a model, running inference, querying specific device capabilities, etc.
The OpenVINO™ samples are simple console applications that show how to utilize
specific OpenVINO API capabilities within an application. They can assist you in
executing specific tasks such as loading a model, running inference, querying
specific device capabilities, etc.
The applications include:
.. important::
All C++ samples support input paths containing only ASCII characters, except for the Hello Classification Sample, which supports Unicode.
- **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 input and supports input paths containing only Unicode characters.
All C++ samples support input paths containing only ASCII characters, except
for the Hello Classification Sample, which supports Unicode.
- :doc:`Python Sample <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>`
- :doc:`C++ Sample <openvino_inference_engine_samples_hello_classification_README>`
- :doc:`C Sample <openvino_inference_engine_ie_bridges_c_samples_hello_classification_README>`
- :doc:`Hello Classification Sample <openvino_sample_hello_classification>` -
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 input and supports input paths containing
only Unicode characters.
- **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 input.
- :doc:`Hello NV12 Input Classification Sample <openvino_sample_hello_nv12_input_classification>` -
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 input.
- :doc:`C++ Sample <openvino_inference_engine_samples_hello_nv12_input_classification_README>`
- :doc:`C Sample <openvino_inference_engine_ie_bridges_c_samples_hello_nv12_input_classification_README>`
- :doc:`Hello Query Device Sample <openvino_sample_hello_query_device>` -
Query of available OpenVINO devices and their metrics, configuration values.
- **Hello Query Device Sample** Query of available OpenVINO devices and their metrics, configuration values.
- :doc:`Hello Reshape SSD Sample <openvino_sample_hello_reshape_ssd>` -
Inference of SSD networks resized by ShapeInfer API according to an input size.
- :doc:`Python* Sample <openvino_inference_engine_ie_bridges_python_sample_hello_query_device_README>`
- :doc:`C++ Sample <openvino_inference_engine_samples_hello_query_device_README>`
- :doc:`Image Classification Async Sample <openvino_sample_image_classification_async>` -
Inference of image classification networks like AlexNet and GoogLeNet using
Asynchronous Inference Request API. The sample supports only images as inputs.
- **Hello Reshape SSD Sample** Inference of SSD networks resized by ShapeInfer API according to an input size.
- :doc:`Python Sample** <openvino_inference_engine_ie_bridges_python_sample_hello_reshape_ssd_README>`
- :doc:`C++ Sample** <openvino_inference_engine_samples_hello_reshape_ssd_README>`
- **Image Classification Async Sample** Inference of image classification networks like AlexNet and GoogLeNet using Asynchronous Inference Request API. The sample supports only images as inputs.
- :doc:`Python* Sample <openvino_inference_engine_ie_bridges_python_sample_classification_sample_async_README>`
- :doc:`C++ Sample <openvino_inference_engine_samples_classification_sample_async_README>`
- **OpenVINO Model Creation Sample** Construction of the LeNet model using the OpenVINO model creation sample.
- :doc:`Python Sample <openvino_inference_engine_ie_bridges_python_sample_model_creation_sample_README>`
- :doc:`C++ Sample <openvino_inference_engine_samples_model_creation_sample_README>`
- :doc:`OpenVINO Model Creation Sample <openvino_sample_model_creation>` -
Construction of the LeNet model using the OpenVINO model creation sample.
- **Benchmark Samples** - Simple estimation of a model inference performance
- :doc:`Sync Python* Sample <openvino_inference_engine_ie_bridges_python_sample_sync_benchmark_README>`
- :doc:`Sync C++ Sample <openvino_inference_engine_samples_sync_benchmark_README>`
- :doc:`Throughput Python* Sample <openvino_inference_engine_ie_bridges_python_sample_throughput_benchmark_README>`
- :doc:`Throughput C++ Sample <openvino_inference_engine_samples_throughput_benchmark_README>`
- :doc:`Bert Python* Sample <openvino_inference_engine_ie_bridges_python_sample_bert_benchmark_README>`
- :doc:`Sync Samples <openvino_sample_sync_benchmark>`
- :doc:`Throughput Samples <openvino_sample_throughput_benchmark>`
- :doc:`Bert Python Sample <openvino_sample_bert_benchmark>`
- **Benchmark Application** Estimates deep learning inference performance on supported devices for synchronous and asynchronous modes.
- :doc:`Benchmark Application <openvino_sample_benchmark_tool>` - Estimates deep
learning inference performance on supported devices for synchronous and
asynchronous modes.
- :doc:`Benchmark Python Tool <openvino_inference_engine_tools_benchmark_tool_README>`
Python version of the benchmark tool is a core component of the OpenVINO
installation package and may be executed with the following command:
- Python version of the benchmark tool is a core component of the OpenVINO installation package and
may be executed with the following command: ``benchmark_app -m <model> -i <input> -d <device>``.
- :doc:`Benchmark C++ Tool <openvino_inference_engine_samples_benchmark_app_README>`
.. code-block:: console
benchmark_app -m <model> -i <input> -d <device>
- ``[DEPRECATED]`` :doc:`Automatic Speech Recognition Sample <openvino_sample_automatic_speech_recognition>` -
Acoustic model inference based on Kaldi neural networks and
speech feature vectors.
- **Automatic Speech Recognition Sample** - ``[DEPRECATED]`` Acoustic model inference based on Kaldi neural networks and speech feature vectors.
- :doc:`Python Sample <openvino_inference_engine_ie_bridges_python_sample_speech_sample_README>`
- :doc:`C++ Sample <openvino_inference_engine_samples_speech_sample_README>`
See Also
########
Additional Resources
####################
* :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
* :doc:`OpenVINO Runtime User Guide <openvino_docs_OV_UG_OV_Runtime_User_Guide>`

View File

@ -0,0 +1,596 @@
.. {#openvino_sample_automatic_speech_recognition}
[DEPRECATED] Automatic Speech Recognition Sample
====================================================
.. meta::
:description: Learn how to infer an acoustic model based on Kaldi
neural networks and speech feature vectors using Asynchronous
Inference Request (Python) API.
.. note::
This sample is now deprecated and will be removed with OpenVINO 2024.0.
The sample was mainly designed to demonstrate the features of the GNA plugin
and the use of models produced by the Kaldi framework. OpenVINO support for
these components is now deprecated and will be discontinued, making the sample
redundant.
This sample demonstrates how to do a Synchronous Inference of acoustic model based
on Kaldi neural models and speech feature vectors.
The sample works with Kaldi ARK or Numpy uncompressed NPZ files, so it does not
cover an end-to-end speech recognition scenario (speech to text), requiring additional
preprocessing (feature extraction) to get a feature vector from a speech signal,
as well as postprocessing (decoding) to produce text from scores. Before using the
sample, refer to the following requirements:
- The sample accepts any file format supported by ``core.read_model``.
- The sample has been validated with an acoustic model based on Kaldi neural models
(see :ref:`Model Preparation <model-preparation-speech>` section)
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
At startup, the sample application reads command-line parameters, loads a specified
model and input data to the OpenVINO™ Runtime plugin, performs synchronous inference
on all speech utterances stored in the input file, logging each step in a standard output stream.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/speech_sample/speech_sample.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/speech_sample/main.cpp
:language: cpp
You can see the explicit description ofeach sample step at
:doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
GNA-specific details
####################
Quantization
++++++++++++++++++++
If the GNA device is selected (for example, using the ``-d`` GNA flag), the GNA
OpenVINO™ Runtime plugin quantizes the model and input feature vector sequence
to integer representation before performing inference.
Several neural model quantization modes:
- *static* - The first utterance in the input file is scanned for dynamic range.
The scale factor (floating point scalar multiplier) required to scale the maximum
input value of the first utterance to 16384 (15 bits) is used for all subsequent
inputs. The model is quantized to accommodate the scaled input dynamic range.
- *user-defined* - The user may specify a scale factor via the ``-sf`` flag that
will be used for static quantization.
The ``-qb`` flag provides a hint to the GNA plugin regarding the preferred target weight resolution for all layers.
For example, when ``-qb 8`` is specified, the plugin will use 8-bit weights wherever possible in the
model.
.. note::
It is not always possible to use 8-bit weights due to GNA hardware limitations.
For example, convolutional layers always use 16-bit weights (GNA hardware version
1 and 2). This limitation will be removed in GNA hardware version 3 and higher.
.. _execution-modes:
Execution Modes
++++++++++++++++++++
Several execution modes are supported via the ``-d`` flag:
- ``CPU`` - All calculations are performed on CPU device using CPU Plugin.
- ``GPU`` - All calculations are performed on GPU device using GPU Plugin.
- ``NPU`` - All calculations are performed on NPU device using NPU Plugin.
- ``GNA_AUTO`` - GNA hardware is used if available and the driver is installed. Otherwise, the GNA device is emulated in fast-but-not-bit-exact mode.
- ``GNA_HW`` - GNA hardware is used if available and the driver is installed. Otherwise, an error will occur.
- ``GNA_SW`` - Deprecated. The GNA device is emulated in fast-but-not-bit-exact mode.
- ``GNA_SW_FP32`` - Substitutes parameters and calculations from low precision to floating point (FP32).
- ``GNA_SW_EXACT`` - GNA device is emulated in bit-exact mode.
Loading and Saving Models
+++++++++++++++++++++++++
The GNA plugin supports loading and saving of the GNA-optimized model (non-IR) via the ``-rg`` and ``-wg`` flags.
Thereby, it is possible to avoid the cost of full model quantization at run time.
The GNA plugin also supports export of firmware-compatible embedded model images
for the Intel® Speech Enabling Developer Kit and Amazon Alexa Premium Far-Field
Voice Development Kit via the ``-we`` flag (save only).
In addition to performing inference directly from a GNA model file, these options make it possible to:
- Convert from IR format to GNA format model file (``-m``, ``-wg``)
- Convert from IR format to embedded format model file (``-m``, ``-we``)
- Convert from GNA format to embedded format model file (``-rg``, ``-we``)
Running
####################
Run the application with the ``-h`` option to see the usage message:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python speech_sample.py -h
Usage message:
.. code-block:: console
usage: speech_sample.py [-h] (-m MODEL | -rg IMPORT_GNA_MODEL) -i INPUT [-o OUTPUT] [-r REFERENCE] [-d DEVICE] [-bs [1-8]]
[-layout LAYOUT] [-qb [8, 16]] [-sf SCALE_FACTOR] [-wg EXPORT_GNA_MODEL]
[-we EXPORT_EMBEDDED_GNA_MODEL] [-we_gen [GNA1, GNA3]]
[--exec_target [GNA_TARGET_2_0, GNA_TARGET_3_0]] [-pc] [-a [CORE, ATOM]] [-iname INPUT_LAYERS]
[-oname OUTPUT_LAYERS] [-cw_l CONTEXT_WINDOW_LEFT] [-cw_r CONTEXT_WINDOW_RIGHT] [-pwl_me PWL_ME]
optional arguments:
-m MODEL, --model MODEL
Path to an .xml file with a trained model (required if -rg is missing).
-rg IMPORT_GNA_MODEL, --import_gna_model IMPORT_GNA_MODEL
Read GNA model from file using path/filename provided (required if -m is missing).
Options:
-h, --help Show this help message and exit.
-i INPUT, --input INPUT
Required. Path(s) to input file(s).
Usage for a single file/layer: <input_file.ark> or <input_file.npz>.
Example of usage for several files/layers: <layer1>:<port_num1>=<input_file1.ark>,<layer2>:<port_num2>=<input_file2.ark>.
-o OUTPUT, --output OUTPUT
Optional. Output file name(s) to save scores (inference results).
Usage for a single file/layer: <output_file.ark> or <output_file.npz>.
Example of usage for several files/layers: <layer1>:<port_num1>=<output_file1.ark>,<layer2>:<port_num2>=<output_file2.ark>.
-r REFERENCE, --reference REFERENCE
Read reference score file(s) and compare inference results with reference scores.
Usage for a single file/layer: <reference_file.ark> or <reference_file.npz>.
Example of usage for several files/layers: <layer1>:<port_num1>=<reference_file1.ark>,<layer2>:<port_num2>=<reference_file2.ark>.
-d DEVICE, --device DEVICE
Optional. Specify a target device to infer on. CPU, GPU, NPU, GNA_AUTO, GNA_HW, GNA_SW_FP32,
GNA_SW_EXACT and HETERO with combination of GNA as the primary device and CPU as a secondary (e.g.
HETERO:GNA,CPU) are supported. The sample will look for a suitable plugin for device specified.
Default value is CPU.
-bs [1-8], --batch_size [1-8]
Optional. Batch size 1-8.
-layout LAYOUT Optional. Custom layout in format: "input0[value0],input1[value1]" or "[value]" (applied to all
inputs)
-qb [8, 16], --quantization_bits [8, 16]
Optional. Weight resolution in bits for GNA quantization: 8 or 16 (default 16).
-sf SCALE_FACTOR, --scale_factor SCALE_FACTOR
Optional. User-specified input scale factor for GNA quantization.
If the model contains multiple inputs, provide scale factors by separating them with commas.
For example: <layer1>:<sf1>,<layer2>:<sf2> or just <sf> to be applied to all inputs.
-wg EXPORT_GNA_MODEL, --export_gna_model EXPORT_GNA_MODEL
Optional. Write GNA model to file using path/filename provided.
-we EXPORT_EMBEDDED_GNA_MODEL, --export_embedded_gna_model EXPORT_EMBEDDED_GNA_MODEL
Optional. Write GNA embedded model to file using path/filename provided.
-we_gen [GNA1, GNA3], --embedded_gna_configuration [GNA1, GNA3]
Optional. GNA generation configuration string for embedded export. Can be GNA1 (default) or GNA3.
--exec_target [GNA_TARGET_2_0, GNA_TARGET_3_0]
Optional. Specify GNA execution target generation. By default, generation corresponds to the GNA HW
available in the system or the latest fully supported generation by the software. See the GNA
Plugin's GNA_EXEC_TARGET config option description.
-pc, --performance_counter
Optional. Enables performance report (specify -a to ensure arch accurate results).
-a [CORE, ATOM], --arch [CORE, ATOM]
Optional. Specify architecture. CORE, ATOM with the combination of -pc.
-cw_l CONTEXT_WINDOW_LEFT, --context_window_left CONTEXT_WINDOW_LEFT
Optional. Number of frames for left context windows (default is 0). Works only with context window
models. If you use the cw_l or cw_r flag, then batch size argument is ignored.
-cw_r CONTEXT_WINDOW_RIGHT, --context_window_right CONTEXT_WINDOW_RIGHT
Optional. Number of frames for right context windows (default is 0). Works only with context window
models. If you use the cw_l or cw_r flag, then batch size argument is ignored.
-pwl_me PWL_ME Optional. The maximum percent of error for PWL function. The value must be in <0, 100> range. The
default value is 1.0.
.. tab-item:: C++
:sync: cpp
.. code-block:: console
speech_sample -h
Usage message:
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Parsing input parameters
speech_sample [OPTION]
Options:
-h Print a usage message.
-i "<path>" Required. Path(s) to input file(s). Usage for a single file/layer: <input_file.ark> or <input_file.npz>. Example of usage for several files/layers: <layer1>:<port_num1>=<input_file1.ark>,<layer2>:<port_num2>=<input_file2.ark>.
-m "<path>" Required. Path to an .xml file with a trained model (required if -rg is missing).
-o "<path>" Optional. Output file name(s) to save scores (inference results). Example of usage for a single file/layer: <output_file.ark> or <output_file.npz>. Example of usage for several files/layers: <layer1>:<port_num1>=<output_file1.ark>,<layer2>:<port_num2>=<output_file2.ark>.
-d "<device>" Optional. Specify a target device to infer on. CPU, GPU, NPU, GNA_AUTO, GNA_HW, GNA_HW_WITH_SW_FBACK, GNA_SW_FP32, GNA_SW_EXACT and HETERO with combination of GNA as the primary device and CPU as a secondary (e.g. HETERO:GNA,CPU) are supported. The sample will look for a suitable plugin for device specified.
-pc Optional. Enables per-layer performance report.
-q "<mode>" Optional. Input quantization mode for GNA: static (default) or user defined (use with -sf).
-qb "<integer>" Optional. Weight resolution in bits for GNA quantization: 8 or 16 (default)
-sf "<double>" Optional. User-specified input scale factor for GNA quantization (use with -q user). If the model contains multiple inputs, provide scale factors by separating them with commas. For example: <layer1>:<sf1>,<layer2>:<sf2> or just <sf> to be applied to all inputs.
-bs "<integer>" Optional. Batch size 1-8 (default 1)
-r "<path>" Optional. Read reference score file(s) and compare inference results with reference scores. Usage for a single file/layer: <reference.ark> or <reference.npz>. Example of usage for several files/layers: <layer1>:<port_num1>=<reference_file1.ark>,<layer2>:<port_num2>=<reference_file2.ark>.
-rg "<path>" Read GNA model from file using path/filename provided (required if -m is missing).
-wg "<path>" Optional. Write GNA model to file using path/filename provided.
-we "<path>" Optional. Write GNA embedded model to file using path/filename provided.
-cw_l "<integer>" Optional. Number of frames for left context windows (default is 0). Works only with context window networks. If you use the cw_l or cw_r flag, then batch size argument is ignored.
-cw_r "<integer>" Optional. Number of frames for right context windows (default is 0). Works only with context window networks. If you use the cw_r or cw_l flag, then batch size argument is ignored.
-layout "<string>" Optional. Prompts how network layouts should be treated by application. For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input size.
-pwl_me "<double>" Optional. The maximum percent of error for PWL function.The value must be in <0, 100> range. The default value is 1.0.
-exec_target "<string>" Optional. Specify GNA execution target generation. May be one of GNA_TARGET_2_0, GNA_TARGET_3_0. By default, generation corresponds to the GNA HW available in the system or the latest fully supported generation by the software. See the GNA Plugin's GNA_EXEC_TARGET config option description.
-compile_target "<string>" Optional. Specify GNA compile target generation. May be one of GNA_TARGET_2_0, GNA_TARGET_3_0. By default, generation corresponds to the GNA HW available in the system or the latest fully supported generation by the software. See the GNA Plugin's GNA_COMPILE_TARGET config option description.
-memory_reuse_off Optional. Disables memory optimizations for compiled model.
Available target devices: CPU GNA GPU NPU
.. _model-preparation-speech:
Model Preparation
####################
You can use the following model conversion command to convert a Kaldi nnet1 or nnet2 model to OpenVINO Intermediate Representation (IR) format:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
mo --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir <OUTPUT_MODEL_DIR>
.. tab-item:: C++
:sync: cpp
.. code-block:: console
mo --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir <OUTPUT_MODEL_DIR>
The following pre-trained models are available:
- ``rm_cnn4a_smbr``
- ``rm_lstm4f``
- ``wsj_dnn5b_smbr``
All of them can be downloaded from `the storage <https://storage.openvinotoolkit.org/models_contrib/speech/2021.2>`__ .
Speech Inference
####################
Once the IR has been created, you can do inference on Intel® Processors with the GNA co-processor (or emulation library):
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python speech_sample.py -m wsj_dnn5b.xml -i dev93_10.ark -r dev93_scores_10.ark -d GNA_AUTO -o result.npz
.. tab-item:: C++
:sync: cpp
.. code-block:: console
speech_sample -m wsj_dnn5b.xml -i dev93_10.ark -r dev93_scores_10.ark -d GNA_AUTO -o result.ark
Here, the floating point Kaldi-generated reference neural network scores (``dev93_scores_10.ark``) corresponding to the input feature file (``dev93_10.ark``) are assumed to be available for comparison.
.. note::
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample supports input and output in numpy file format (.npz)
- When you specify single options multiple times, only the last value will be used. For example, the ``-m`` flag:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python classification_sample_async.py -m model.xml -m model2.xml
.. tab-item:: C++
:sync: cpp
.. code-block:: console
./speech_sample -m model.xml -m model2.xml
Sample Output
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The sample application logs each step in a standard output stream.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: /models/wsj_dnn5b_smbr_fp32.xml
[ INFO ] Using scale factor(s) calculated from first utterance
[ INFO ] For input 0 using scale factor of 2175.4322418
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ]
[ INFO ] Utterance 0:
[ INFO ] Total time in Infer (HW and SW): 6326.06ms
[ INFO ] Frames in utterance: 1294
[ INFO ] Average Infer time per frame: 4.89ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7051840
[ INFO ] avg error: 0.0448388
[ INFO ] avg rms error: 0.0582387
[ INFO ] stdev error: 0.0371650
[ INFO ]
[ INFO ] Utterance 1:
[ INFO ] Total time in Infer (HW and SW): 4526.57ms
[ INFO ] Frames in utterance: 1005
[ INFO ] Average Infer time per frame: 4.50ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7575974
[ INFO ] avg error: 0.0452166
[ INFO ] avg rms error: 0.0586013
[ INFO ] stdev error: 0.0372769
[ INFO ]
[ INFO ] Utterance 2:
[ INFO ] Total time in Infer (HW and SW): 6636.56ms
[ INFO ] Frames in utterance: 1471
[ INFO ] Average Infer time per frame: 4.51ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7191710
[ INFO ] avg error: 0.0472226
[ INFO ] avg rms error: 0.0612991
[ INFO ] stdev error: 0.0390846
[ INFO ]
[ INFO ] Utterance 3:
[ INFO ] Total time in Infer (HW and SW): 3927.01ms
[ INFO ] Frames in utterance: 845
[ INFO ] Average Infer time per frame: 4.65ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7436461
[ INFO ] avg error: 0.0477581
[ INFO ] avg rms error: 0.0621334
[ INFO ] stdev error: 0.0397457
[ INFO ]
[ INFO ] Utterance 4:
[ INFO ] Total time in Infer (HW and SW): 3891.49ms
[ INFO ] Frames in utterance: 855
[ INFO ] Average Infer time per frame: 4.55ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7071600
[ INFO ] avg error: 0.0449147
[ INFO ] avg rms error: 0.0585048
[ INFO ] stdev error: 0.0374897
[ INFO ]
[ INFO ] Utterance 5:
[ INFO ] Total time in Infer (HW and SW): 3378.61ms
[ INFO ] Frames in utterance: 699
[ INFO ] Average Infer time per frame: 4.83ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.8870468
[ INFO ] avg error: 0.0479243
[ INFO ] avg rms error: 0.0625490
[ INFO ] stdev error: 0.0401951
[ INFO ]
[ INFO ] Utterance 6:
[ INFO ] Total time in Infer (HW and SW): 4034.31ms
[ INFO ] Frames in utterance: 790
[ INFO ] Average Infer time per frame: 5.11ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7648273
[ INFO ] avg error: 0.0482702
[ INFO ] avg rms error: 0.0629734
[ INFO ] stdev error: 0.0404429
[ INFO ]
[ INFO ] Utterance 7:
[ INFO ] Total time in Infer (HW and SW): 2854.04ms
[ INFO ] Frames in utterance: 622
[ INFO ] Average Infer time per frame: 4.59ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7389560
[ INFO ] avg error: 0.0465543
[ INFO ] avg rms error: 0.0604941
[ INFO ] stdev error: 0.0386294
[ INFO ]
[ INFO ] Utterance 8:
[ INFO ] Total time in Infer (HW and SW): 2493.28ms
[ INFO ] Frames in utterance: 548
[ INFO ] Average Infer time per frame: 4.55ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.6680136
[ INFO ] avg error: 0.0439341
[ INFO ] avg rms error: 0.0574614
[ INFO ] stdev error: 0.0370353
[ INFO ]
[ INFO ] Utterance 9:
[ INFO ] Total time in Infer (HW and SW): 1654.67ms
[ INFO ] Frames in utterance: 368
[ INFO ] Average Infer time per frame: 4.50ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.6550579
[ INFO ] avg error: 0.0467643
[ INFO ] avg rms error: 0.0605045
[ INFO ] stdev error: 0.0383914
[ INFO ]
[ INFO ] Total sample time: 39722.60ms
[ INFO ] File result.npz was created!
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
.. tab-item:: C++
:sync: cpp
The sample application logs each step in a standard output stream.
.. code-block:: console
[ INFO ] OpenVINO runtime: OpenVINO Runtime version ......... 2022.1.0
[ INFO ] Build ........... 2022.1.0-6311-a90bb1ff017
[ INFO ]
[ INFO ] Parsing input parameters
[ INFO ] Loading model files:
[ INFO ] \test_data\models\wsj_dnn5b_smbr_fp32\wsj_dnn5b_smbr_fp32.xml
[ INFO ] Using scale factor of 2175.43 calculated from first utterance.
[ INFO ] Model loading time 0.0034 ms
[ INFO ] Loading model to the device GNA_AUTO
[ INFO ] Loading model to the device
[ INFO ] Number scores per frame : 3425
Utterance 0:
Total time in Infer (HW and SW): 5687.53 ms
Frames in utterance: 1294 frames
Average Infer time per frame: 4.39531 ms
max error: 0.705184
avg error: 0.0448388
avg rms error: 0.0574098
stdev error: 0.0371649
End of Utterance 0
[ INFO ] Number scores per frame : 3425
Utterance 1:
Total time in Infer (HW and SW): 4341.34 ms
Frames in utterance: 1005 frames
Average Infer time per frame: 4.31974 ms
max error: 0.757597
avg error: 0.0452166
avg rms error: 0.0578436
stdev error: 0.0372769
End of Utterance 1
...
End of Utterance X
[ INFO ] Execution successful
Use of C++ Sample in Kaldi Speech Recognition Pipeline
######################################################
The Wall Street Journal DNN model used in this example was prepared using the
Kaldi s5 recipe and the Kaldi Nnet (nnet1) framework. It is possible to recognize
speech by substituting the ``speech_sample`` for Kaldi's nnet-forward command.
Since the ``speech_sample`` does not yet use pipes, it is necessary to use temporary
files for speaker-transformed feature vectors and scores when running the Kaldi
speech recognition pipeline. The following operations assume that feature extraction
was already performed according to the ``s5`` recipe and that the working directory
within the Kaldi source tree is ``egs/wsj/s5``.
1. Prepare a speaker-transformed feature set, given that the feature transform
is specified in ``final.feature_transform`` and the feature files are specified in ``feats.scp``:
.. code-block:: console
nnet-forward --use-gpu=no final.feature_transform "ark,s,cs:copy-feats scp:feats.scp ark:- |" ark:feat.ark
2. Score the feature set, using the ``speech_sample``:
.. code-block:: console
./speech_sample -d GNA_AUTO -bs 8 -i feat.ark -m wsj_dnn5b.xml -o scores.ark
OpenVINO™ toolkit Intermediate Representation ``wsj_dnn5b.xml`` file was
generated in the previous :ref:`Model Preparation <model-preparation-speech>` section.
3. Run the Kaldi decoder to produce n-best text hypotheses and select most likely
text, given that the WFST (``HCLG.fst``), vocabulary (``words.txt``), and
TID/PID mapping (``final.mdl``) are specified:
.. code-block:: console
latgen-faster-mapped --max-active=7000 --max-mem=50000000 --beam=13.0 --lattice-beam=6.0 --acoustic-scale=0.0833 --allow-partial=true --word-symbol-table=words.txt final.mdl HCLG.fst ark:scores.ark ark:-| lattice-scale --inv-acoustic-scale=13 ark:- ark:- | lattice-best-path --word-symbol-table=words.txt ark:- ark,t:- > out.txt &
4. Run the word error rate tool to check accuracy, given that the vocabulary
(``words.txt``) and reference transcript (``test_filt.txt``) are specified:
.. code-block:: console
cat out.txt | utils/int2sym.pl -f 2- words.txt | sed s:\<UNK\>::g | compute-wer --text --mode=present ark:test_filt.txt ark,p:-
All of the files can be downloaded from `the storage <https://storage.openvinotoolkit.org/models_contrib/speech/2021.2/wsj_dnn5b_smbr>`__
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -0,0 +1,931 @@
.. {#openvino_sample_benchmark_tool}
Benchmark Tool
====================
.. meta::
:description: Learn how to use the Benchmark Tool (Python, C++) to
estimate deep learning inference performance on supported
devices.
This page demonstrates how to use the Benchmark Tool to estimate deep learning inference performance on supported devices.
.. note::
The Python version is recommended for benchmarking models that will be used
in Python applications, and the C++ version is recommended for benchmarking
models that will be used in C++ applications. Both tools have a similar
command interface and backend.
Basic Usage
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The Python ``benchmark_app`` is automatically installed when you install OpenVINO
using :doc:`PyPI <openvino_docs_install_guides_installing_openvino_pip>`.
Before running ``benchmark_app``, make sure the ``openvino_env`` virtual
environment is activated, and navigate to the directory where your model is located.
The benchmarking application works with models in the OpenVINO IR
(``model.xml`` and ``model.bin``) and ONNX (``model.onnx``) formats.
Make sure to :doc:`convert your models <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
if necessary.
To run benchmarking with default options on a model, use the following command:
.. code-block:: sh
benchmark_app -m model.xml
.. tab-item:: C++
:sync: cpp
To use the C++ ``benchmark_app``, you must first build it following the
:ref:`Build the Sample Applications <build-samples>` instructions and
then set up paths and environment variables by following the
:doc:`Get Ready for Running the Sample Applications <openvino_docs_OV_UG_Samples_Overview>`
instructions. Navigate to the directory where the ``benchmark_app`` C++ sample binary was built.
.. note::
If you installed OpenVINO Runtime using PyPI or Anaconda Cloud, only the
:doc:`Benchmark Python Tool <openvino_sample_benchmark_tool>` is available,
and you should follow the usage instructions on that page instead.
The benchmarking application works with models in the OpenVINO IR, TensorFlow,
TensorFlow Lite, PaddlePaddle, PyTorch and ONNX formats. If you need it,
OpenVINO also allows you to :doc:`convert your models <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
To run benchmarking with default options on a model, use the following command:
.. code-block:: sh
./benchmark_app -m model.xml
By default, the application will load the specified model onto the CPU and perform
inference on batches of randomly-generated data inputs for 60 seconds. As it loads,
it prints information about the benchmark parameters. When benchmarking is completed,
it reports the minimum, average, and maximum inference latency and the average throughput.
You may be able to improve benchmark results beyond the default configuration by
configuring some of the execution parameters for your model. For example, you can
use "throughput" or "latency" performance hints to optimize the runtime for higher
FPS or reduced inference time. Read on to learn more about the configuration
options available with ``benchmark_app``.
Configuration Options
#####################
The benchmark app provides various options for configuring execution parameters.
This section covers key configuration options for easily tuning benchmarking to
achieve better performance on your device. A list of all configuration options
is given in the :ref:`Advanced Usage <advanced-usage-benchmark>` section.
Performance hints: latency and throughput
+++++++++++++++++++++++++++++++++++++++++
The benchmark app allows users to provide high-level "performance hints" for
setting latency-focused or throughput-focused inference modes. This hint causes
the runtime to automatically adjust runtime parameters, such as the number of
processing streams and inference batch size, to prioritize for reduced latency
or high throughput.
The performance hints do not require any device-specific settings and they are
completely portable between devices. Parameters are automatically configured
based on whichever device is being used. This allows users to easily port
applications between hardware targets without having to re-determine the best
runtime parameters for the new device.
If not specified, throughput is used as the default. To set the hint explicitly,
use ``-hint latency`` or ``-hint throughput`` when running ``benchmark_app``:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
benchmark_app -m model.xml -hint latency
benchmark_app -m model.xml -hint throughput
.. tab-item:: C++
:sync: cpp
.. code-block:: console
./benchmark_app -m model.xml -hint latency
./benchmark_app -m model.xml -hint throughput
.. note::
It is up to the user to ensure the environment on which the benchmark is running is optimized for maximum performance. Otherwise, different results may occur when using the application in different environment settings (such as power optimization settings, processor overclocking, thermal throttling).
When you specify single options multiple times, only the last value will be used. For example, the ``-m`` flag:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
benchmark_app -m model.xml -m model2.xml
.. tab-item:: C++
:sync: cpp
.. code-block:: console
./benchmark_app -m model.xml -m model2.xml
Latency
--------------------
Latency is the amount of time it takes to process a single inference request.
In applications where data needs to be inferenced and acted on as quickly as
possible (such as autonomous driving), low latency is desirable. For conventional
devices, lower latency is achieved by reducing the amount of parallel processing
streams so the system can utilize as many resources as possible to quickly calculate
each inference request. However, advanced devices like multi-socket CPUs and modern
GPUs are capable of running multiple inference requests while delivering the same latency.
When ``benchmark_app`` is run with ``-hint latency``, it determines the optimal number
of parallel inference requests for minimizing latency while still maximizing the
parallelization capabilities of the hardware. It automatically sets the number of
processing streams and inference batch size to achieve the best latency.
Throughput
--------------------
Throughput is the amount of data an inference pipeline can process at once, and
it is usually measured in frames per second (FPS) or inferences per second. In
applications where large amounts of data needs to be inferenced simultaneously
(such as multi-camera video streams), high throughput is needed. To achieve high
throughput, the runtime focuses on fully saturating the device with enough data
to process. It utilizes as much memory and as many parallel streams as possible
to maximize the amount of data that can be processed simultaneously.
When ``benchmark_app`` is run with ``-hint throughput``, it maximizes the number of
parallel inference requests to utilize all the threads available on the device.
On GPU, it automatically sets the inference batch size to fill up the GPU memory available.
For more information on performance hints, see the
:doc:`High-level Performance Hints <openvino_docs_OV_UG_Performance_Hints>` page.
For more details on optimal runtime configurations and how they are automatically
determined using performance hints, see
:doc:`Runtime Inference Optimizations <openvino_docs_deployment_optimization_guide_dldt_optimization_guide>`.
Device
++++++++++++++++++++
To set which device benchmarking runs on, use the ``-d <device>`` argument. This
will tell ``benchmark_app`` to run benchmarking on that specific device. The benchmark
app supports CPU, GPU, and GNA devices. In order to use GPU, the system
must have the appropriate drivers installed. If no device is specified, ``benchmark_app``
will default to using ``CPU``.
For example, to run benchmarking on GPU, use:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
benchmark_app -m model.xml -d GPU
.. tab-item:: C++
:sync: cpp
.. code-block:: console
./benchmark_app -m model.xml -d GPU
You may also specify ``AUTO`` as the device, in which case the ``benchmark_app`` will
automatically select the best device for benchmarking and support it with the
CPU at the model loading stage. This may result in increased performance, thus,
should be used purposefully. For more information, see the
:doc:`Automatic device selection <openvino_docs_OV_UG_supported_plugins_AUTO>` page.
.. note::
If the latency or throughput hint is set, it will automatically configure streams
and batch sizes for optimal performance based on the specified device.)
Number of iterations
++++++++++++++++++++
By default, the benchmarking app will run for a predefined duration, repeatedly
performing inference with the model and measuring the resulting inference speed.
There are several options for setting the number of inference iterations:
* Explicitly specify the number of iterations the model runs, using the
``-niter <number_of_iterations>`` option.
* Set how much time the app runs for, using the ``-t <seconds>`` option.
* Set both of them (execution will continue until both conditions are met).
* If neither ``-niter`` nor ``-t`` are specified, the app will run for a
predefined duration that depends on the device.
The more iterations a model runs, the better the statistics will be for determining
average latency and throughput.
Inputs
++++++++++++++++++++
The benchmark tool runs benchmarking on user-provided input images in
``.jpg``, ``.bmp``, or ``.png`` formats. Use ``-i <PATH_TO_INPUT>`` to specify
the path to an image or a folder of images. For example, to run benchmarking on
an image named ``test1.jpg``, use:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
benchmark_app -m model.xml -i test1.jpg
.. tab-item:: C++
:sync: cpp
.. code-block:: sh
./benchmark_app -m model.xml -i test1.jpg
The tool will repeatedly loop through the provided inputs and run inference on
them for the specified amount of time or a number of iterations. If the ``-i``
flag is not used, the tool will automatically generate random data to fit the
input shape of the model.
Examples
++++++++++++++++++++
For more usage examples (and step-by-step instructions on how to set up a model for benchmarking),
see the :ref:`Examples of Running the Tool <examples-of-running-the-tool-python>` section.
.. _advanced-usage-benchmark:
Advanced Usage
####################
.. note::
By default, OpenVINO samples, tools and demos expect input with BGR channels
order. If you trained your model to work with RGB order, you need to manually
rearrange the default channel order in the sample or demo application or reconvert
your model using model conversion API with ``reverse_input_channels`` argument
specified. For more information about the argument, refer to When to Reverse
Input Channels section of Converting a Model to Intermediate Representation (IR).
Per-layer performance and logging
+++++++++++++++++++++++++++++++++
The application also collects per-layer Performance Measurement (PM) counters for
each executed infer request if you enable statistics dumping by setting the
``-report_type`` parameter to one of the possible values:
* ``no_counters`` report includes configuration options specified, resulting
FPS and latency.
* ``average_counters`` report extends the ``no_counters`` report and additionally
includes average PM counters values for each layer from the network.
* ``detailed_counters`` report extends the ``average_counters`` report and
additionally includes per-layer PM counters and latency for each executed infer request.
Depending on the type, the report is stored to ``benchmark_no_counters_report.csv``,
``benchmark_average_counters_report.csv``, or ``benchmark_detailed_counters_report.csv``
file located in the path specified in ``-report_folder``. The application also
saves executable graph information serialized to an XML file if you specify a
path to it with the ``-exec_graph_path`` parameter.
.. _all-configuration-options-python-benchmark:
All configuration options
+++++++++++++++++++++++++
Running the application with the ``-h`` or ``--help`` option yields the
following usage message:
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. code-block:: sh
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
usage: benchmark_app.py [-h [HELP]] [-i PATHS_TO_INPUT [PATHS_TO_INPUT ...]] -m PATH_TO_MODEL [-d TARGET_DEVICE]
[-hint {throughput,cumulative_throughput,latency,none}] [-niter NUMBER_ITERATIONS] [-t TIME] [-b BATCH_SIZE] [-shape SHAPE]
[-data_shape DATA_SHAPE] [-layout LAYOUT] [-extensions EXTENSIONS] [-c PATH_TO_CLDNN_CONFIG] [-cdir CACHE_DIR] [-lfile [LOAD_FROM_FILE]]
[-api {sync,async}] [-nireq NUMBER_INFER_REQUESTS] [-nstreams NUMBER_STREAMS] [-inference_only [INFERENCE_ONLY]]
[-infer_precision INFER_PRECISION] [-ip {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}]
[-op {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}] [-iop INPUT_OUTPUT_PRECISION] [--mean_values [R,G,B]] [--scale_values [R,G,B]]
[-nthreads NUMBER_THREADS] [-pin {YES,NO,NUMA,HYBRID_AWARE}] [-latency_percentile LATENCY_PERCENTILE]
[-report_type {no_counters,average_counters,detailed_counters}] [-report_folder REPORT_FOLDER] [-pc [PERF_COUNTS]]
[-pcsort {no_sort,sort,simple_sort}] [-pcseq [PCSEQ]] [-exec_graph_path EXEC_GRAPH_PATH] [-dump_config DUMP_CONFIG] [-load_config LOAD_CONFIG]
Options:
-h [HELP], --help [HELP]
Show this help message and exit.
-i PATHS_TO_INPUT [PATHS_TO_INPUT ...], --paths_to_input PATHS_TO_INPUT [PATHS_TO_INPUT ...]
Optional. Path to a folder with images and/or binaries or to specific image or binary file.It is also allowed to map files to model inputs:
input_1:file_1/dir1,file_2/dir2,input_4:file_4/dir4 input_2:file_3/dir3 Currently supported data types: bin, npy. If OPENCV is enabled, this
functionalityis extended with the following data types: bmp, dib, jpeg, jpg, jpe, jp2, png, pbm, pgm, ppm, sr, ras, tiff, tif.
-m PATH_TO_MODEL, --path_to_model PATH_TO_MODEL
Required. Path to an .xml/.onnx file with a trained model or to a .blob file with a trained compiled model.
-d TARGET_DEVICE, --target_device TARGET_DEVICE
Optional. Specify a target device to infer on (the list of available devices is shown below). Default value is CPU. Use '-d HETERO:<comma
separated devices list>' format to specify HETERO plugin. Use '-d MULTI:<comma separated devices list>' format to specify MULTI plugin. The
application looks for a suitable plugin for the specified device.
-hint {throughput,cumulative_throughput,latency,none}, --perf_hint {throughput,cumulative_throughput,latency,none}
Optional. Performance hint (latency or throughput or cumulative_throughput or none). Performance hint allows the OpenVINO device to select the
right model-specific settings. 'throughput': device performance mode will be set to THROUGHPUT. 'cumulative_throughput': device performance
mode will be set to CUMULATIVE_THROUGHPUT. 'latency': device performance mode will be set to LATENCY. 'none': no device performance mode will
be set. Using explicit 'nstreams' or other device-specific options, please set hint to 'none'
-niter NUMBER_ITERATIONS, --number_iterations NUMBER_ITERATIONS
Optional. Number of iterations. If not specified, the number of iterations is calculated depending on a device.
-t TIME, --time TIME Optional. Time in seconds to execute topology.
-api {sync,async}, --api_type {sync,async}
Optional. Enable using sync/async API. Default value is async.
Input shapes:
-b BATCH_SIZE, --batch_size BATCH_SIZE
Optional. Batch size value. If not specified, the batch size value is determined from Intermediate Representation
-shape SHAPE Optional. Set shape for input. For example, "input1[1,3,224,224],input2[1,4]" or "[1,3,224,224]" in case of one input size. This parameter
affect model Parameter shape, can be dynamic. For dynamic dimesions use symbol `?`, `-1` or range `low.. up`.
-data_shape DATA_SHAPE
Optional. Optional if model shapes are all static (original ones or set by -shape).Required if at least one input shape is dynamic and input
images are not provided.Set shape for input tensors. For example, "input1[1,3,224,224][1,3,448,448],input2[1,4][1,8]" or
"[1,3,224,224][1,3,448,448] in case of one input size.
-layout LAYOUT Optional. Prompts how model layouts should be treated by application. For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input
size.
Advanced options:
-extensions EXTENSIONS, --extensions EXTENSIONS
Optional. Path or a comma-separated list of paths to libraries (.so or .dll) with extensions.
-c PATH_TO_CLDNN_CONFIG, --path_to_cldnn_config PATH_TO_CLDNN_CONFIG
Optional. Required for GPU custom kernels. Absolute path to an .xml file with the kernels description.
-cdir CACHE_DIR, --cache_dir CACHE_DIR
Optional. Enable model caching to specified directory
-lfile [LOAD_FROM_FILE], --load_from_file [LOAD_FROM_FILE]
Optional. Loads model from file directly without read_model.
-nireq NUMBER_INFER_REQUESTS, --number_infer_requests NUMBER_INFER_REQUESTS
Optional. Number of infer requests. Default value is determined automatically for device.
-nstreams NUMBER_STREAMS, --number_streams NUMBER_STREAMS
Optional. Number of streams to use for inference on the CPU/GPU (for HETERO and MULTI device cases use format
<device1>:<nstreams1>,<device2>:<nstreams2> or just <nstreams>). Default value is determined automatically for a device. Please note that
although the automatic selection usually provides a reasonable performance, it still may be non - optimal for some cases, especially for very
small models. Also, using nstreams>1 is inherently throughput-oriented option, while for the best-latency estimations the number of streams
should be set to 1. See samples README for more details.
-inference_only [INFERENCE_ONLY], --inference_only [INFERENCE_ONLY]
Optional. If true inputs filling only once before measurements (default for static models), else inputs filling is included into loop
measurement (default for dynamic models)
-infer_precision INFER_PRECISION
Optional. Specifies the inference precision. Example #1: '-infer_precision bf16'. Example #2: '-infer_precision CPU:bf16,GPU:f32'
-exec_graph_path EXEC_GRAPH_PATH, --exec_graph_path EXEC_GRAPH_PATH
Optional. Path to a file where to store executable graph information serialized.
Preprocessing options:
-ip {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}, --input_precision {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}
Optional. Specifies precision for all input layers of the model.
-op {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}, --output_precision {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}
Optional. Specifies precision for all output layers of the model.
-iop INPUT_OUTPUT_PRECISION, --input_output_precision INPUT_OUTPUT_PRECISION
Optional. Specifies precision for input and output layers by name. Example: -iop "input:f16, output:f16". Notice that quotes are required.
Overwrites precision from ip and op options for specified layers.
--mean_values [R,G,B]
Optional. Mean values to be used for the input image per channel. Values to be provided in the [R,G,B] format. Can be defined for desired input
of the model, for example: "--mean_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the
original model was trained. Applying the values affects performance and may cause type conversion
--scale_values [R,G,B]
Optional. Scale values to be used for the input image per channel. Values are provided in the [R,G,B] format. Can be defined for desired input
of the model, for example: "--scale_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the
original model was trained. If both --mean_values and --scale_values are specified, the mean is subtracted first and then scale is applied
regardless of the order of options in command line. Applying the values affects performance and may cause type conversion
Device-specific performance options:
-nthreads NUMBER_THREADS, --number_threads NUMBER_THREADS
Number of threads to use for inference on the CPU, GNA (including HETERO and MULTI cases).
-pin {YES,NO,NUMA,HYBRID_AWARE}, --infer_threads_pinning {YES,NO,NUMA,HYBRID_AWARE}
Optional. Enable threads->cores ('YES' which is OpenVINO runtime's default for conventional CPUs), threads->(NUMA)nodes ('NUMA'),
threads->appropriate core types ('HYBRID_AWARE', which is OpenVINO runtime's default for Hybrid CPUs) or completely disable ('NO') CPU threads
pinning for CPU-involved inference.
Statistics dumping options:
-latency_percentile LATENCY_PERCENTILE, --latency_percentile LATENCY_PERCENTILE
Optional. Defines the percentile to be reported in latency metric. The valid range is [1, 100]. The default value is 50 (median).
-report_type {no_counters,average_counters,detailed_counters}, --report_type {no_counters,average_counters,detailed_counters}
Optional. Enable collecting statistics report. "no_counters" report contains configuration options specified, resulting FPS and latency.
"average_counters" report extends "no_counters" report and additionally includes average PM counters values for each layer from the model.
"detailed_counters" report extends "average_counters" report and additionally includes per-layer PM counters and latency for each executed
infer request.
-report_folder REPORT_FOLDER, --report_folder REPORT_FOLDER
Optional. Path to a folder where statistics report is stored.
-json_stats [JSON_STATS], --json_stats [JSON_STATS]
Optional. Enables JSON-based statistics output (by default reporting system will use CSV format). Should be used together with -report_folder option.
-pc [PERF_COUNTS], --perf_counts [PERF_COUNTS]
Optional. Report performance counters.
-pcsort {no_sort,sort,simple_sort}, --perf_counts_sort {no_sort,sort,simple_sort}
Optional. Report performance counters and analysis the sort hotpoint opts. sort: Analysis opts time cost, print by hotpoint order no_sort:
Analysis opts time cost, print by normal order simple_sort: Analysis opts time cost, only print EXECUTED opts by normal order
-pcseq [PCSEQ], --pcseq [PCSEQ]
Optional. Report latencies for each shape in -data_shape sequence.
-dump_config DUMP_CONFIG
Optional. Path to JSON file to dump OpenVINO parameters, which were set by application.
-load_config LOAD_CONFIG
Optional. Path to JSON file to load custom OpenVINO parameters.
Please note, command line parameters have higher priority then parameters from configuration file.
Example 1: a simple JSON file for HW device with primary properties.
{
"CPU": {"NUM_STREAMS": "3", "PERF_COUNT": "NO"}
}
Example 2: a simple JSON file for meta device(AUTO/MULTI) with HW device properties.
{
"AUTO": {
"PERFORMANCE_HINT": "THROUGHPUT",
"PERF_COUNT": "NO",
"DEVICE_PROPERTIES": "{CPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:3},GPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:5}}"
}
}
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. code-block:: sh
:force:
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
usage: benchmark_app [OPTION]
Options:
-h, --help Print the usage message
-m <path> Required. Path to an .xml/.onnx file with a trained model or to a .blob files with a trained compiled model.
-i <path> Optional. Path to a folder with images and/or binaries or to specific image or binary file.
In case of dynamic shapes models with several inputs provide the same number of files for each input (except cases with single file for any input) :"input1:1.jpg input2:1.bin", "input1:1.bin,2.bin input2:3.bin input3:4.bin,5.bin ". Also you can pass specific keys for inputs: "random" - for fillling input with random data, "image_info" - for filling input with image size.
You should specify either one files set to be used for all inputs (without providing input names) or separate files sets for every input of model (providing inputs names).
Currently supported data types: bmp, bin, npy.
If OPENCV is enabled, this functionality is extended with the following data types:
dib, jpeg, jpg, jpe, jp2, png, pbm, pgm, ppm, sr, ras, tiff, tif.
-d <device> Optional. Specify a target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. Use "-d MULTI:<comma-separated_devices_list>" format to specify MULTI plugin. The application looks for a suitable plugin for the specified device.
-hint <performance hint> (latency or throughput or cumulative_throughput or none) Optional. Performance hint allows the OpenVINO device to select the right model-specific settings.
'throughput' or 'tput': device performance mode will be set to THROUGHPUT.
'cumulative_throughput' or 'ctput': device performance mode will be set to CUMULATIVE_THROUGHPUT.
'latency': device performance mode will be set to LATENCY.
'none': no device performance mode will be set.
Using explicit 'nstreams' or other device-specific options, please set hint to 'none'
-niter <integer> Optional. Number of iterations. If not specified, the number of iterations is calculated depending on a device.
-t Optional. Time in seconds to execute topology.
Input shapes
-b <integer> Optional. Batch size value. If not specified, the batch size value is determined from Intermediate Representation.
-shape Optional. Set shape for model input. For example, "input1[1,3,224,224],input2[1,4]" or "[1,3,224,224]" in case of one input size. This parameter affect model input shape and can be dynamic. For dynamic dimensions use symbol `?` or '-1'. Ex. [?,3,?,?]. For bounded dimensions specify range 'min..max'. Ex. [1..10,3,?,?].
-data_shape Required for models with dynamic shapes. Set shape for input blobs. In case of one input size: "[1,3,224,224]" or "input1[1,3,224,224],input2[1,4] ". In case of several input sizes provide the same number for each input (except cases with single shape for any input): "[1,3,128,128][3,3,128,128][1,3,320,320]", "input1[1,1, 128,128][1,1,256,256],input2[80,1]" or "input1[1,192][1,384],input2[1,192][1,384],input3[1,192][1,384],input4[1,192][1,384]". If model shapes are all static specifying the option will cause an exception.
-layout Optional. Prompts how model layouts should be treated by application. For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input size.
Advanced options
-extensions <absolute_path> Required for custom layers (extensions). Absolute path to a shared library with the kernels implementations.
-c <absolute_path> Required for GPU custom kernels. Absolute path to an .xml file with the kernels description.
-cache_dir <path> Optional. Enables caching of loaded models to specified directory. List of devices which support caching is shown at the end of this message.
-load_from_file Optional. Loads model from file directly without read_model. All CNNNetwork options (like re-shape) will be ignored
-api <sync/async> Optional. Enable Sync/Async API. Default value is "async".
-nireq <integer> Optional. Number of infer requests. Default value is determined automatically for device.
-nstreams <integer> Optional. Number of streams to use for inference on the CPU or GPU devices (for HETERO and MULTI device cases use format <dev1>:<nstreams1>, <dev2>:<nstreams2> or just <nstreams>). Default value is determined automatically for a device.Please note that although the automatic selection usually provides a reasonable performance, it still may be non - optimal for some cases, especially for very small models. See sample's README for more details. Also, using nstreams>1 is inherently throughput-oriented option, while for the best-latency estimations the number of streams should be set to 1.
-inference_only Optional. Measure only inference stage. Default option for static models. Dynamic models are measured in full mode which includes inputs setup stage, inference only mode available for them with single input data shape only. To enable full mode for static models pass "false" value to this argument: ex. "-inference_only=false".
-infer_precision Optional. Specifies the inference precision. Example #1: '-infer_precision bf16'. Example #2: '-infer_precision CPU:bf16,GPU:f32'
Preprocessing options:
-ip <value> Optional. Specifies precision for all input layers of the model.
-op <value> Optional. Specifies precision for all output layers of the model.
-iop <value> Optional. Specifies precision for input and output layers by name.
Example: -iop "input:f16, output:f16".
Notice that quotes are required.
Overwrites precision from ip and op options for specified layers.
-mean_values [R,G,B] Optional. Mean values to be used for the input image per channel. Values to be provided in the [R,G,B] format. Can be defined for desired input of the model, for example: "--mean_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the original model was trained. Applying the values affects performance and may cause type conversion
-scale_values [R,G,B] Optional. Scale values to be used for the input image per channel. Values are provided in the [R,G,B] format. Can be defined for desired input of the model, for example: "--scale_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the original model was trained. If both --mean_values and --scale_values are specified, the mean is subtracted first and then scale is applied regardless of the order of options in command line. Applying the values affects performance and may cause type conversion
Device-specific performance options:
-nthreads <integer> Optional. Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
-pin <string> ("YES"|"CORE") / "HYBRID_AWARE" / ("NO"|"NONE") / "NUMA" Optional. Explicit inference threads binding options (leave empty to let the OpenVINO make a choice):
enabling threads->cores pinning("YES", which is already default for any conventional CPU),
letting the runtime to decide on the threads->different core types("HYBRID_AWARE", which is default on the hybrid CPUs)
threads->(NUMA)nodes("NUMA") or
completely disable("NO") CPU inference threads pinning
Statistics dumping options:
-latency_percentile Optional. Defines the percentile to be reported in latency metric. The valid range is [1, 100]. The default value is 50 (median).
-report_type <type> Optional. Enable collecting statistics report. "no_counters" report contains configuration options specified, resulting FPS and latency. "average_counters" report extends "no_counters" report and additionally includes average PM counters values for each layer from the model. "detailed_counters" report extends "average_counters" report and additionally includes per-layer PM counters and latency for each executed infer request.
-report_folder Optional. Path to a folder where statistics report is stored.
-json_stats Optional. Enables JSON-based statistics output (by default reporting system will use CSV format). Should be used together with -report_folder option.
-pc Optional. Report performance counters.
-pcsort Optional. Report performance counters and analysis the sort hotpoint opts. "sort" Analysis opts time cost, print by hotpoint order "no_sort" Analysis opts time cost, print by normal order "simple_sort" Analysis opts time cost, only print EXECUTED opts by normal order
-pcseq Optional. Report latencies for each shape in -data_shape sequence.
-exec_graph_path Optional. Path to a file where to store executable graph information serialized.
-dump_config Optional. Path to JSON file to dump IE parameters, which were set by application.
-load_config Optional. Path to JSON file to load custom IE parameters. Please note, command line parameters have higher priority then parameters from configuration file.
Example 1: a simple JSON file for HW device with primary properties.
{
"CPU": {"NUM_STREAMS": "3", "PERF_COUNT": "NO"}
}
Example 2: a simple JSON file for meta device(AUTO/MULTI) with HW device properties.
{
"AUTO": {
"PERFORMANCE_HINT": "THROUGHPUT",
"PERF_COUNT": "NO",
"DEVICE_PROPERTIES": "{CPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:3},GPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:5}}"
}
}
Running the application with the empty list of options yields the usage message given above and an error message.
More information on inputs
++++++++++++++++++++++++++
The benchmark tool supports topologies with one or more inputs. If a topology is
not data sensitive, you can skip the input parameter, and the inputs will be filled
with random values. If a model has only image input(s), provide a folder with images
or a path to an image as input. If a model has some specific input(s) (besides images),
prepare a binary file(s) or numpy array(s) that is filled with data of appropriate
precision and provide a path to it as input. If a model has mixed input types, the
input folder should contain all required files. Image inputs are filled with image
files one by one. Binary inputs are filled with binary inputs one by one.
.. _examples-of-running-the-tool-python:
Examples of Running the Tool
############################
This section provides step-by-step instructions on how to run the Benchmark Tool
with the ``asl-recognition`` Intel model on CPU or GPU devices. It uses random data as the input.
.. note::
Internet access is required to execute the following steps successfully. If you
have access to the Internet through a proxy server only, please make sure that
it is configured in your OS environment.
Run the tool, specifying the location of the OpenVINO Intermediate Representation
(IR) model ``.xml`` file, the device to perform inference on, and a performance hint.
The following commands demonstrate examples of how to run the Benchmark Tool
in latency mode on CPU and throughput mode on GPU devices:
* On CPU (latency mode):
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
.. tab-item:: C++
:sync: cpp
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
* On GPU (throughput mode):
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d GPU -hint throughput
.. tab-item:: C++
:sync: cpp
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d GPU -hint throughput
The application outputs the number of executed iterations, total duration of execution,
latency, and throughput. Additionally, if you set the ``-report_type`` parameter,
the application outputs a statistics report. If you set the ``-pc`` parameter,
the application outputs performance counters. If you set ``-exec_graph_path``,
the application reports executable graph information serialized. All measurements
including per-layer PM counters are reported in milliseconds.
An example of the information output when running ``benchmark_app`` on CPU in
latency mode is shown below:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
.. code-block:: sh
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
[ INFO ] Input command: /home/openvino/tools/benchmark_tool/benchmark_app.py -m omz_models/intel/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
[ INFO ] Read model took 147.82 ms
[ INFO ] Original model I/O parameters:
[ INFO ] Model inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Model outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 5/11] Resizing model to match image sizes and given batch
[ INFO ] Model batch size: 1
[Step 6/11] Configuring input of the model
[ INFO ] Model inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Model outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 7/11] Loading the model to the device
[ INFO ] Compile model took 974.64 ms
[Step 8/11] Querying optimal runtime parameters
[ INFO ] Model:
[ INFO ] NETWORK_NAME: torch-jit-export
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 2
[ INFO ] NUM_STREAMS: 2
[ INFO ] AFFINITY: Affinity.CORE
[ INFO ] INFERENCE_NUM_THREADS: 0
[ INFO ] PERF_COUNT: False
[ INFO ] INFERENCE_PRECISION_HINT: <Type: 'float32'>
[ INFO ] PERFORMANCE_HINT: PerformanceMode.LATENCY
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'input'!. This input will be filled with random values!
[ INFO ] Fill input 'input' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 2 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 38.41 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 5380 iterations
[ INFO ] Duration: 60036.78 ms
[ INFO ] Latency:
[ INFO ] Median: 22.04 ms
[ INFO ] Average: 22.09 ms
[ INFO ] Min: 20.78 ms
[ INFO ] Max: 33.51 ms
[ INFO ] Throughput: 89.61 FPS
.. tab-item:: C++
:sync: cpp
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
.. code-block:: sh
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
[ INFO ] Input command: /home/openvino/bin/intel64/DEBUG/benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Device(CPU) performance hint is set to LATENCY
[Step 4/11] Reading model files
[ INFO ] Loading model files
[ INFO ] Read model took 141.11 ms
[ INFO ] Original model I/O parameters:
[ INFO ] Network inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Network outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 5/11] Resizing model to match image sizes and given batch
[ INFO ] Model batch size: 0
[Step 6/11] Configuring input of the model
[ INFO ] Model batch size: 1
[ INFO ] Network inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Network outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 7/11] Loading the model to the device
[ INFO ] Compile model took 989.62 ms
[Step 8/11] Querying optimal runtime parameters
[ INFO ] Model:
[ INFO ] NETWORK_NAME: torch-jit-export
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 2
[ INFO ] NUM_STREAMS: 2
[ INFO ] AFFINITY: CORE
[ INFO ] INFERENCE_NUM_THREADS: 0
[ INFO ] PERF_COUNT: NO
[ INFO ] INFERENCE_PRECISION_HINT: f32
[ INFO ] PERFORMANCE_HINT: LATENCY
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given: all inputs will be filled with random values!
[ INFO ] Test Config 0
[ INFO ] input ([N,C,D,H,W], f32, {1, 3, 16, 224, 224}, static): random (binary data is expected)
[Step 10/11] Measuring performance (Start inference asynchronously, 2 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 37.27 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 5470 iterations
[ INFO ] Duration: 60028.56 ms
[ INFO ] Latency:
[ INFO ] Median: 21.79 ms
[ INFO ] Average: 21.92 ms
[ INFO ] Min: 20.60 ms
[ INFO ] Max: 37.19 ms
[ INFO ] Throughput: 91.12 FPS
The Benchmark Tool can also be used with dynamically shaped networks to measure
expected inference time for various input data shapes. See the ``-shape`` and
``-data_shape`` argument descriptions in the :ref:`All configuration options <all-configuration-options-python-benchmark>`
section to learn more about using dynamic shapes. Here is a command example for
using ``benchmark_app`` with dynamic networks and a portion of the resulting output:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -shape [-1,3,16,224,224] -data_shape [1,3,16,224,224][2,3,16,224,224][4,3,16,224,224] -pcseq
.. code-block:: sh
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'input'!. This input will be filled with random values!
[ INFO ] Fill input 'input' with random values
[ INFO ] Defined 3 tensor groups:
[ INFO ] input: {1, 3, 16, 224, 224}
[ INFO ] input: {2, 3, 16, 224, 224}
[ INFO ] input: {4, 3, 16, 224, 224}
[Step 10/11] Measuring performance (Start inference asynchronously, 11 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in full mode (inputs filling are included in measurement loop).
[ INFO ] First inference took 201.15 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 2811 iterations
[ INFO ] Duration: 60271.71 ms
[ INFO ] Latency:
[ INFO ] Median: 207.70 ms
[ INFO ] Average: 234.56 ms
[ INFO ] Min: 85.73 ms
[ INFO ] Max: 773.55 ms
[ INFO ] Latency for each data shape group:
[ INFO ] 1. input: {1, 3, 16, 224, 224}
[ INFO ] Median: 118.08 ms
[ INFO ] Average: 115.05 ms
[ INFO ] Min: 85.73 ms
[ INFO ] Max: 339.25 ms
[ INFO ] 2. input: {2, 3, 16, 224, 224}
[ INFO ] Median: 207.25 ms
[ INFO ] Average: 205.16 ms
[ INFO ] Min: 166.98 ms
[ INFO ] Max: 545.55 ms
[ INFO ] 3. input: {4, 3, 16, 224, 224}
[ INFO ] Median: 384.16 ms
[ INFO ] Average: 383.48 ms
[ INFO ] Min: 305.51 ms
[ INFO ] Max: 773.55 ms
[ INFO ] Throughput: 108.82 FPS
.. tab-item:: C++
:sync: cpp
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -shape [-1,3,16,224,224] -data_shape [1,3,16,224,224][2,3,16,224,224][4,3,16,224,224] -pcseq
.. code-block:: sh
[Step 9/11] Creating infer requests and preparing input tensors
[ INFO ] Test Config 0
[ INFO ] input ([N,C,D,H,W], f32, {1, 3, 16, 224, 224}, dyn:{?,3,16,224,224}): random (binary data is expected)
[ INFO ] Test Config 1
[ INFO ] input ([N,C,D,H,W], f32, {2, 3, 16, 224, 224}, dyn:{?,3,16,224,224}): random (binary data is expected)
[ INFO ] Test Config 2
[ INFO ] input ([N,C,D,H,W], f32, {4, 3, 16, 224, 224}, dyn:{?,3,16,224,224}): random (binary data is expected)
[Step 10/11] Measuring performance (Start inference asynchronously, 11 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in full mode (inputs filling are included in measurement loop).
[ INFO ] First inference took 204.40 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 2783 iterations
[ INFO ] Duration: 60326.29 ms
[ INFO ] Latency:
[ INFO ] Median: 208.20 ms
[ INFO ] Average: 237.47 ms
[ INFO ] Min: 85.06 ms
[ INFO ] Max: 743.46 ms
[ INFO ] Latency for each data shape group:
[ INFO ] 1. input: {1, 3, 16, 224, 224}
[ INFO ] Median: 120.36 ms
[ INFO ] Average: 117.19 ms
[ INFO ] Min: 85.06 ms
[ INFO ] Max: 348.66 ms
[ INFO ] 2. input: {2, 3, 16, 224, 224}
[ INFO ] Median: 207.81 ms
[ INFO ] Average: 206.39 ms
[ INFO ] Min: 167.19 ms
[ INFO ] Max: 578.33 ms
[ INFO ] 3. input: {4, 3, 16, 224, 224}
[ INFO ] Median: 387.40 ms
[ INFO ] Average: 388.99 ms
[ INFO ] Min: 327.50 ms
[ INFO ] Max: 743.46 ms
[ INFO ] Throughput: 107.61 FPS
Additional Resources
####################
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -0,0 +1,69 @@
.. {#openvino_sample_bert_benchmark}
Bert Benchmark Python Sample
============================
.. meta::
:description: Learn how to estimate performance of a Bert model using Asynchronous Inference Request (Python) API.
This sample demonstrates how to estimate performance of a Bert model using Asynchronous
Inference Request API. Unlike :doc:`demos <omz_demos>` this sample does not have
configurable command line arguments. Feel free to modify sample's source code to
try out different options.
How It Works
####################
The sample downloads a model and a tokenizer, exports the model to ONNX format, reads the
exported model and reshapes it to enforce dynamic input shapes. Then, it compiles the
resulting model, downloads a dataset and runs a benchmark on the dataset.
.. scrollbox::
.. doxygensnippet:: samples/python/benchmark/bert_benchmark/bert_benchmark.py
:language: python
You can see the explicit description of each sample step at
:doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
1. Install the ``openvino`` Python package:
.. code-block:: console
python -m pip install openvino
2. Install packages from ``requirements.txt``:
.. code-block:: console
python -m pip install -r requirements.txt
3. Run the sample
.. code-block:: console
python bert_benchmark.py
Sample Output
####################
The sample outputs how long it takes to process a dataset.
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `Bert Benchmark Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/benchmark/bert_benchmark/README.md>`__

View File

@ -1,157 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_c_samples_hello_classification_README}
Hello Classification C Sample
=============================
.. meta::
:description: Learn how to do inference of image
classification models, such as alexnet and googlenet-v1, using
Synchronous Inference Request (C) API.
This sample demonstrates how to execute an inference of image classification networks like AlexNet and GoogLeNet using Synchronous Inference Request API and input auto-resize feature.
.. tab-set::
.. tab-item:: Requirements
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Options | Values |
+============================+============================================================================================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, :doc:`googlenet-v1 <omz_models_model_googlenet_v1>` |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Format | Inference Engine Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Validated images | The sample uses OpenCV\* to `read input image <https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56>`__ (\*.bmp, \*.png) |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_hello_classification_README>`, :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>` |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: C API
Hello Classification C sample application demonstrates how to use the C API from OpenVINO in applications.
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Feature | API | Description |
+=====================================+=============================================================+=========================================================================================================================================================================================+
| OpenVINO Runtime Version | ``ov_get_openvino_version`` | Get Openvino API version |
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Basic Infer Flow | ``ov_core_create``, | Common API to do inference: read and compile a model, create an infer request, configure input and output tensors |
| | ``ov_core_read_model``, | |
| | ``ov_core_compile_model``, | |
| | ``ov_compiled_model_create_infer_request``, | |
| | ``ov_infer_request_set_input_tensor_by_index``, | |
| | ``ov_infer_request_get_output_tensor_by_index`` | |
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Synchronous Infer | ``ov_infer_request_infer`` | Do synchronous inference |
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Operations | ``ov_model_const_input``, | Get inputs and outputs of a model |
| | ``ov_model_const_output`` | +
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Tensor Operations | ``ov_tensor_create_from_host_ptr`` | Create a tensor shape |
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Preprocessing | ``ov_preprocess_prepostprocessor_create``, | Set image of the original size as input for a model with other input size. Resize and layout conversions are performed automatically by the corresponding plugin just before inference. |
| | ``ov_preprocess_prepostprocessor_get_input_info_by_index``, | |
| | ``ov_preprocess_input_info_get_tensor_info``, | |
| | ``ov_preprocess_input_tensor_info_set_from``, | |
| | ``ov_preprocess_input_tensor_info_set_layout``, | |
| | ``ov_preprocess_input_info_get_preprocess_steps``, | |
| | ``ov_preprocess_preprocess_steps_resize``, | |
| | ``ov_preprocess_input_model_info_set_layout``, | |
| | ``ov_preprocess_output_set_element_type``, | |
| | ``ov_preprocess_prepostprocessor_build`` | |
+-------------------------------------+-------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/c/hello_classification/main.c
:language: c
How It Works
############
Upon the start-up, the sample application reads command line parameters, loads specified network and an image to the Inference Engine plugin.
Then, the sample creates an synchronous inference request object. When inference is done, the application outputs data to the standard output stream.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in Inference Engine Samples guide.
Running
#######
To run the sample, you need specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and Demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using ``mo`` with `reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the Inference Engine format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing.
Example
+++++++
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader):
.. code-block:: console
python <path_to_omz_tools>/downloader.py --name alexnet
2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script:
.. code-block:: console
python <path_to_omz_tools>/converter.py --name alexnet
3. Perform inference of ``car.bmp`` using ``alexnet`` model on a ``GPU``, for example:
.. code-block:: console
<path_to_sample>/hello_classification_c <path_to_model>/alexnet.xml <path_to_image>/car.bmp GPU
Sample Output
#############
The application outputs top-10 inference results.
.. code-block:: console
Top 10 results:
Image /opt/intel/openvino/samples/scripts/car.png
classid probability
------- -----------
656 0.666479
654 0.112940
581 0.068487
874 0.033385
436 0.026132
817 0.016731
675 0.010980
511 0.010592
569 0.008178
717 0.006336
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate OpenVINO™ into Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- :doc:`C API Reference <pot_compression_api_README>`

View File

@ -1,147 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_c_samples_hello_nv12_input_classification_README}
Hello NV12 Input Classification C Sample
========================================
.. meta::
:description: Learn how to do inference of an image
classification model with images in NV12 color format using
Synchronous Inference Request (C) API.
This sample demonstrates how to execute an inference of image classification networks like AlexNet with images in NV12 color format using Synchronous Inference Request API.
Hello NV12 Input Classification C Sample demonstrates how to use the NV12 automatic input pre-processing API in your applications.
.. tab-set::
.. tab-item:: Requirements
+-----------------------------------------+---------------------------------------------------------------------------------------+
| Options | Values |
+=========================================+=======================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>` |
+-----------------------------------------+---------------------------------------------------------------------------------------+
| Model Format | Inference Engine Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
+-----------------------------------------+---------------------------------------------------------------------------------------+
| Validated images | An uncompressed image in the NV12 color format - \*.yuv |
+-----------------------------------------+---------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+-----------------------------------------+---------------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_hello_nv12_input_classification_README>` |
+-----------------------------------------+---------------------------------------------------------------------------------------+
.. tab-item:: C API
+-----------------------------------------+-----------------------------------------------------------+--------------------------------------------------------+
| Feature | API | Description |
+=========================================+===========================================================+========================================================+
| Node Operations | ``ov_port_get_any_name`` | Get a layer name |
+-----------------------------------------+-----------------------------------------------------------+--------------------------------------------------------+
| Infer Request Operations | ``ov_infer_request_set_tensor``, | Operate with tensors |
| | ``ov_infer_request_get_output_tensor_by_index`` | |
+-----------------------------------------+-----------------------------------------------------------+--------------------------------------------------------+
| Preprocessing | ``ov_preprocess_input_tensor_info_set_color_format``, | Change the color format of the input data |
| | ``ov_preprocess_preprocess_steps_convert_element_type``, | |
| | ``ov_preprocess_preprocess_steps_convert_color`` | |
+-----------------------------------------+-----------------------------------------------------------+--------------------------------------------------------+
Basic Inference Engine API is covered by :doc:`Hello Classification C sample <openvino_inference_engine_ie_bridges_c_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/c/hello_nv12_input_classification/main.c
:language: c
How It Works
############
Upon the start-up, the sample application reads command-line parameters, loads specified network and an image in the NV12 color format to an Inference Engine plugin. Then, the sample creates an synchronous inference request object. When inference is done, the application outputs data to the standard output stream.
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in Inference Engine Samples guide.
Running
#######
To run the sample, you need specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
The sample accepts an uncompressed image in the NV12 color format. To run the sample, you need to convert your BGR/RGB image to NV12. To do this, you can use one of the widely available tools such as FFmpeg\* or GStreamer\*. The following command shows how to convert an ordinary image into an uncompressed NV12 image using FFmpeg:
.. code-block:: sh
ffmpeg -i cat.jpg -pix_fmt nv12 cat.yuv
.. note::
- Because the sample reads raw image files, you should provide a correct image size along with the image path. The sample expects the logical size of the image, not the buffer size. For example, for 640x480 BGR/RGB image the corresponding NV12 logical image size is also 640x480, whereas the buffer size is 640x720.
- By default, this sample expects that network input has BGR channels order. If you trained your model to work with RGB order, you need to reconvert your model using ``mo`` with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the Inference Engine format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
+++++++
1. Download a pre-trained model using :doc:`Model Downloader <omz_tools_downloader>`:
.. code-block:: console
python <path_to_omz_tools>/downloader.py --name alexnet
2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script:
.. code-block:: console
python <path_to_omz_tools>/converter.py --name alexnet
3. Perform inference of NV12 image using `alexnet` model on a `CPU`, for example:
.. code-block:: console
<path_to_sample>/hello_nv12_input_classification_c <path_to_model>/alexnet.xml <path_to_image>/cat.yuv 300x300 CPU
Sample Output
#############
The application outputs top-10 inference results.
.. code-block:: console
Top 10 results:
Image ./cat.yuv
classid probability
------- -----------
435 0.091733
876 0.081725
999 0.069305
587 0.043726
666 0.038957
419 0.032892
285 0.030309
700 0.029941
696 0.021628
855 0.020339
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ into Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `C API Reference <https://docs.openvino.ai/2023.3/api/api_reference.html>`__

View File

@ -1,419 +0,0 @@
.. {#openvino_inference_engine_samples_benchmark_app_README}
Benchmark C++ Tool
==================
.. meta::
:description: Learn how to use the Benchmark C++ Tool to
estimate deep learning inference performance on supported
devices.
This page demonstrates how to use the Benchmark C++ Tool to estimate deep learning inference performance on supported devices.
.. note::
This page describes usage of the C++ implementation of the Benchmark Tool. For the Python implementation, refer to the :doc:`Benchmark Python Tool <openvino_inference_engine_tools_benchmark_tool_README>` page. The Python version is recommended for benchmarking models that will be used in Python applications, and the C++ version is recommended for benchmarking models that will be used in C++ applications. Both tools have a similar command interface and backend.
Basic Usage
####################
To use the C++ benchmark_app, you must first build it following the :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` instructions and then set up paths and environment variables by following the :doc:`Get Ready for Running the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` instructions. Navigate to the directory where the benchmark_app C++ sample binary was built.
.. note::
If you installed OpenVINO Runtime using PyPI or Anaconda Cloud, only the :doc:`Benchmark Python Tool <openvino_inference_engine_tools_benchmark_tool_README>` is available, and you should follow the usage instructions on that page instead.
The benchmarking application works with models in the OpenVINO IR, TensorFlow, TensorFlow Lite, PaddlePaddle, PyTorch and ONNX formats. If you need it, OpenVINO also allows you to :doc:`convert your models <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
To run benchmarking with default options on a model, use the following command:
.. code-block:: sh
./benchmark_app -m model.xml
By default, the application will load the specified model onto the CPU and perform inferencing on batches of randomly-generated data inputs for 60 seconds. As it loads, it prints information about benchmark parameters. When benchmarking is completed, it reports the minimum, average, and maximum inferencing latency and average the throughput.
You may be able to improve benchmark results beyond the default configuration by configuring some of the execution parameters for your model. For example, you can use "throughput" or "latency" performance hints to optimize the runtime for higher FPS or reduced inferencing time. Read on to learn more about the configuration options available with benchmark_app.
Configuration Options
#####################
The benchmark app provides various options for configuring execution parameters. This section covers key configuration options for easily tuning benchmarking to achieve better performance on your device. A list of all configuration options is given in the :ref:`Advanced Usage <advanced-usage-cpp-benchmark>` section.
Performance hints: latency and throughput
+++++++++++++++++++++++++++++++++++++++++
The benchmark app allows users to provide high-level "performance hints" for setting latency-focused or throughput-focused inference modes. This hint causes the runtime to automatically adjust runtime parameters, such as the number of processing streams and inference batch size, to prioritize for reduced latency or high throughput.
The performance hints do not require any device-specific settings and they are completely portable between devices. Parameters are automatically configured based on whichever device is being used. This allows users to easily port applications between hardware targets without having to re-determine the best runtime parameters for the new device.
If not specified, throughput is used as the default. To set the hint explicitly, use ``-hint latency`` or ``-hint throughput`` when running benchmark_app:
.. code-block:: sh
./benchmark_app -m model.xml -hint latency
./benchmark_app -m model.xml -hint throughput
.. note::
It is up to the user to ensure the environment on which the benchmark is running is optimized for maximum performance. Otherwise, different results may occur when using the application in different environment settings (such as power optimization settings, processor overclocking, thermal throttling).
Stating flags that take only single option like `-m` multiple times, for example `./benchmark_app -m model.xml -m model2.xml`, results in only the first value being used.
Latency
--------------------
Latency is the amount of time it takes to process a single inference request. In applications where data needs to be inferenced and acted on as quickly as possible (such as autonomous driving), low latency is desirable. For conventional devices, lower latency is achieved by reducing the amount of parallel processing streams so the system can utilize as many resources as possible to quickly calculate each inference request. However, advanced devices like multi-socket CPUs and modern GPUs are capable of running multiple inference requests while delivering the same latency.
When benchmark_app is run with ``-hint latency``, it determines the optimal number of parallel inference requests for minimizing latency while still maximizing the parallelization capabilities of the hardware. It automatically sets the number of processing streams and inference batch size to achieve the best latency.
Throughput
--------------------
Throughput is the amount of data an inferencing pipeline can process at once, and it is usually measured in frames per second (FPS) or inferences per second. In applications where large amounts of data needs to be inferenced simultaneously (such as multi-camera video streams), high throughput is needed. To achieve high throughput, the runtime focuses on fully saturating the device with enough data to process. It utilizes as much memory and as many parallel streams as possible to maximize the amount of data that can be processed simultaneously.
When benchmark_app is run with ``-hint throughput``, it maximizes the number of parallel inference requests to utilize all the threads available on the device. On GPU, it automatically sets the inference batch size to fill up the GPU memory available.
For more information on performance hints, see the :doc:`High-level Performance Hints <openvino_docs_OV_UG_Performance_Hints>` page. For more details on optimal runtime configurations and how they are automatically determined using performance hints, see :doc:`Runtime Inference Optimizations <openvino_docs_deployment_optimization_guide_dldt_optimization_guide>`.
Device
++++++++++++++++++++
To set which device benchmarking runs on, use the ``-d <device>`` argument. This will tell benchmark_app to run benchmarking on that specific device. The benchmark app supports "CPU", "GPU", and "GNA" devices. In order to use the GPU or GNA, the system must have the appropriate drivers installed. If no device is specified, benchmark_app will default to using CPU.
For example, to run benchmarking on GPU, use:
.. code-block:: sh
./benchmark_app -m model.xml -d GPU
You may also specify "AUTO" as the device, in which case the benchmark_app will automatically select the best device for benchmarking and support it with the CPU at the model loading stage. This may result in increased performance, thus, should be used purposefully. For more information, see the :doc:`Automatic device selection <openvino_docs_OV_UG_supported_plugins_AUTO>` page.
(Note: If the latency or throughput hint is set, it will automatically configure streams and batch sizes for optimal performance based on the specified device.)
Number of iterations
++++++++++++++++++++
By default, the benchmarking app will run for a predefined duration, repeatedly performing inferencing with the model and measuring the resulting inference speed. There are several options for setting the number of inference iterations:
* Explicitly specify the number of iterations the model runs using the ``-niter <number_of_iterations>`` option.
* Set how much time the app runs for using the ``-t <seconds>`` option.
* Set both of them (execution will continue until both conditions are met).
* If neither -niter nor -t are specified, the app will run for a predefined duration that depends on the device.
The more iterations a model runs, the better the statistics will be for determining average latency and throughput.
Inputs
++++++++++++++++++++
The benchmark tool runs benchmarking on user-provided input images in ``.jpg``, ``.bmp``, or ``.png`` format. Use ``-i <PATH_TO_INPUT>`` to specify the path to an image, or folder of images. For example, to run benchmarking on an image named ``test1.jpg``, use:
.. code-block:: sh
./benchmark_app -m model.xml -i test1.jpg
The tool will repeatedly loop through the provided inputs and run inferencing on them for the specified amount of time or number of iterations. If the ``-i`` flag is not used, the tool will automatically generate random data to fit the input shape of the model.
Examples
++++++++++++++++++++
For more usage examples (and step-by-step instructions on how to set up a model for benchmarking), see the :ref:`Examples of Running the Tool <examples-of-running-the-tool-cpp>` section.
.. _advanced-usage-cpp-benchmark:
Advanced Usage
####################
.. note::
By default, OpenVINO samples, tools and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channel order in the sample or demo application or reconvert your model using ``mo`` with ``reverse_input_channels`` argument specified. For more information about the argument, refer to When to Reverse Input Channels section of Converting a Model to Intermediate Representation (IR).
Per-layer performance and logging
+++++++++++++++++++++++++++++++++
The application also collects per-layer Performance Measurement (PM) counters for each executed infer request if you enable statistics dumping by setting the ``-report_type`` parameter to one of the possible values:
* ``no_counters`` report includes configuration options specified, resulting FPS and latency.
* ``average_counters`` report extends the ``no_counters`` report and additionally includes average PM counters values for each layer from the network.
* ``detailed_counters`` report extends the ``average_counters`` report and additionally includes per-layer PM counters and latency for each executed infer request.
Depending on the type, the report is stored to benchmark_no_counters_report.csv, benchmark_average_counters_report.csv, or benchmark_detailed_counters_report.csv file located in the path specified in -report_folder. The application also saves executable graph information serialized to an XML file if you specify a path to it with the -exec_graph_path parameter.
.. _all-configuration-options-cpp-benchmark:
All configuration options
+++++++++++++++++++++++++
Running the application with the ``-h`` or ``--help`` option yields the following usage message:
.. scrollbox::
.. code-block:: sh
:force:
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
usage: benchmark_app [OPTION]
Options:
-h, --help Print the usage message
-m <path> Required. Path to an .xml/.onnx file with a trained model or to a .blob files with a trained compiled model.
-i <path> Optional. Path to a folder with images and/or binaries or to specific image or binary file.
In case of dynamic shapes models with several inputs provide the same number of files for each input (except cases with single file for any input) :"input1:1.jpg input2:1.bin", "input1:1.bin,2.bin input2:3.bin input3:4.bin,5.bin ". Also you can pass specific keys for inputs: "random" - for fillling input with random data, "image_info" - for filling input with image size.
You should specify either one files set to be used for all inputs (without providing input names) or separate files sets for every input of model (providing inputs names).
Currently supported data types: bmp, bin, npy.
If OPENCV is enabled, this functionality is extended with the following data types:
dib, jpeg, jpg, jpe, jp2, png, pbm, pgm, ppm, sr, ras, tiff, tif.
-d <device> Optional. Specify a target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. Use "-d MULTI:<comma-separated_devices_list>" format to specify MULTI plugin. The application looks for a suitable plugin for the specified device.
-hint <performance hint> (latency or throughput or cumulative_throughput or none) Optional. Performance hint allows the OpenVINO device to select the right model-specific settings.
'throughput' or 'tput': device performance mode will be set to THROUGHPUT.
'cumulative_throughput' or 'ctput': device performance mode will be set to CUMULATIVE_THROUGHPUT.
'latency': device performance mode will be set to LATENCY.
'none': no device performance mode will be set.
Using explicit 'nstreams' or other device-specific options, please set hint to 'none'
-niter <integer> Optional. Number of iterations. If not specified, the number of iterations is calculated depending on a device.
-t Optional. Time in seconds to execute topology.
Input shapes
-b <integer> Optional. Batch size value. If not specified, the batch size value is determined from Intermediate Representation.
-shape Optional. Set shape for model input. For example, "input1[1,3,224,224],input2[1,4]" or "[1,3,224,224]" in case of one input size. This parameter affect model input shape and can be dynamic. For dynamic dimensions use symbol `?` or '-1'. Ex. [?,3,?,?]. For bounded dimensions specify range 'min..max'. Ex. [1..10,3,?,?].
-data_shape Required for models with dynamic shapes. Set shape for input blobs. In case of one input size: "[1,3,224,224]" or "input1[1,3,224,224],input2[1,4] ". In case of several input sizes provide the same number for each input (except cases with single shape for any input): "[1,3,128,128][3,3,128,128][1,3,320,320]", "input1[1,1, 128,128][1,1,256,256],input2[80,1]" or "input1[1,192][1,384],input2[1,192][1,384],input3[1,192][1,384],input4[1,192][1,384]". If model shapes are all static specifying the option will cause an exception.
-layout Optional. Prompts how model layouts should be treated by application. For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input size.
Advanced options
-extensions <absolute_path> Required for custom layers (extensions). Absolute path to a shared library with the kernels implementations.
-c <absolute_path> Required for GPU custom kernels. Absolute path to an .xml file with the kernels description.
-cache_dir <path> Optional. Enables caching of loaded models to specified directory. List of devices which support caching is shown at the end of this message.
-load_from_file Optional. Loads model from file directly without read_model. All CNNNetwork options (like re-shape) will be ignored
-api <sync/async> Optional. Enable Sync/Async API. Default value is "async".
-nireq <integer> Optional. Number of infer requests. Default value is determined automatically for device.
-nstreams <integer> Optional. Number of streams to use for inference on the CPU or GPU devices (for HETERO and MULTI device cases use format <dev1>:<nstreams1>, <dev2>:<nstreams2> or just <nstreams>). Default value is determined automatically for a device.Please note that although the automatic selection usually provides a reasonable performance, it still may be non - optimal for some cases, especially for very small models. See sample's README for more details. Also, using nstreams>1 is inherently throughput-oriented option, while for the best-latency estimations the number of streams should be set to 1.
-inference_only Optional. Measure only inference stage. Default option for static models. Dynamic models are measured in full mode which includes inputs setup stage, inference only mode available for them with single input data shape only. To enable full mode for static models pass "false" value to this argument: ex. "-inference_only=false".
-infer_precision Optional. Specifies the inference precision. Example #1: '-infer_precision bf16'. Example #2: '-infer_precision CPU:bf16,GPU:f32'
Preprocessing options:
-ip <value> Optional. Specifies precision for all input layers of the model.
-op <value> Optional. Specifies precision for all output layers of the model.
-iop <value> Optional. Specifies precision for input and output layers by name.
Example: -iop "input:f16, output:f16".
Notice that quotes are required.
Overwrites precision from ip and op options for specified layers.
-mean_values [R,G,B] Optional. Mean values to be used for the input image per channel. Values to be provided in the [R,G,B] format. Can be defined for desired input of the model, for example: "--mean_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the original model was trained. Applying the values affects performance and may cause type conversion
-scale_values [R,G,B] Optional. Scale values to be used for the input image per channel. Values are provided in the [R,G,B] format. Can be defined for desired input of the model, for example: "--scale_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the original model was trained. If both --mean_values and --scale_values are specified, the mean is subtracted first and then scale is applied regardless of the order of options in command line. Applying the values affects performance and may cause type conversion
Device-specific performance options:
-nthreads <integer> Optional. Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
-pin <string> ("YES"|"CORE") / "HYBRID_AWARE" / ("NO"|"NONE") / "NUMA" Optional. Explicit inference threads binding options (leave empty to let the OpenVINO make a choice):
enabling threads->cores pinning("YES", which is already default for any conventional CPU),
letting the runtime to decide on the threads->different core types("HYBRID_AWARE", which is default on the hybrid CPUs)
threads->(NUMA)nodes("NUMA") or
completely disable("NO") CPU inference threads pinning
Statistics dumping options:
-latency_percentile Optional. Defines the percentile to be reported in latency metric. The valid range is [1, 100]. The default value is 50 (median).
-report_type <type> Optional. Enable collecting statistics report. "no_counters" report contains configuration options specified, resulting FPS and latency. "average_counters" report extends "no_counters" report and additionally includes average PM counters values for each layer from the model. "detailed_counters" report extends "average_counters" report and additionally includes per-layer PM counters and latency for each executed infer request.
-report_folder Optional. Path to a folder where statistics report is stored.
-json_stats Optional. Enables JSON-based statistics output (by default reporting system will use CSV format). Should be used together with -report_folder option.
-pc Optional. Report performance counters.
-pcsort Optional. Report performance counters and analysis the sort hotpoint opts. "sort" Analysis opts time cost, print by hotpoint order "no_sort" Analysis opts time cost, print by normal order "simple_sort" Analysis opts time cost, only print EXECUTED opts by normal order
-pcseq Optional. Report latencies for each shape in -data_shape sequence.
-exec_graph_path Optional. Path to a file where to store executable graph information serialized.
-dump_config Optional. Path to JSON file to dump IE parameters, which were set by application.
-load_config Optional. Path to JSON file to load custom IE parameters. Please note, command line parameters have higher priority then parameters from configuration file.
Example 1: a simple JSON file for HW device with primary properties.
{
"CPU": {"NUM_STREAMS": "3", "PERF_COUNT": "NO"}
}
Example 2: a simple JSON file for meta device(AUTO/MULTI) with HW device properties.
{
"AUTO": {
"PERFORMANCE_HINT": "THROUGHPUT",
"PERF_COUNT": "NO",
"DEVICE_PROPERTIES": "{CPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:3},GPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:5}}"
}
}
Running the application with the empty list of options yields the usage message given above and an error message.
More information on inputs
++++++++++++++++++++++++++
The benchmark tool supports topologies with one or more inputs. If a topology is not data sensitive, you can skip the input parameter, and the inputs will be filled with random values. If a model has only image input(s), provide a folder with images or a path to an image as input. If a model has some specific input(s) (besides images), please prepare a binary file(s) or numpy array(s) that is filled with data of appropriate precision and provide a path to it as input. If a model has mixed input types, the input folder should contain all required files. Image inputs are filled with image files one by one. Binary inputs are filled with binary inputs one by one.
.. _examples-of-running-the-tool-cpp:
Examples of Running the Tool
############################
This section provides step-by-step instructions on how to run the Benchmark Tool with the ``asl-recognition`` model from the :doc:`Open Model Zoo <model_zoo>` on CPU or GPU devices. It uses random data as the input.
.. note::
Internet access is required to execute the following steps successfully. If you have access to the Internet through a proxy server only, please make sure that it is configured in your OS environment.
1. Install OpenVINO Development Tools (if it hasn't been installed already):
.. code-block:: sh
pip install openvino-dev
2. Download the model using ``omz_downloader``, specifying the model name and directory to download the model to:
.. code-block:: sh
omz_downloader --name asl-recognition-0004 --precisions FP16 --output_dir omz_models
3. Run the tool, specifying the location of the model .xml file, the device to perform inference on, and with a performance hint. The following commands demonstrate examples of how to run the Benchmark Tool in latency mode on CPU and throughput mode on GPU devices:
* On CPU (latency mode):
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
* On GPU (throughput mode):
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d GPU -hint throughput
The application outputs the number of executed iterations, total duration of execution, latency, and throughput.
Additionally, if you set the ``-report_type`` parameter, the application outputs a statistics report. If you set the ``-pc`` parameter, the application outputs performance counters. If you set ``-exec_graph_path``, the application reports executable graph information serialized. All measurements including per-layer PM counters are reported in milliseconds.
An example of the information output when running benchmark_app on CPU in latency mode is shown below:
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
.. code-block:: sh
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
[ INFO ] Input command: /home/openvino/bin/intel64/DEBUG/benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Device(CPU) performance hint is set to LATENCY
[Step 4/11] Reading model files
[ INFO ] Loading model files
[ INFO ] Read model took 141.11 ms
[ INFO ] Original model I/O parameters:
[ INFO ] Network inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Network outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 5/11] Resizing model to match image sizes and given batch
[ INFO ] Model batch size: 0
[Step 6/11] Configuring input of the model
[ INFO ] Model batch size: 1
[ INFO ] Network inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Network outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 7/11] Loading the model to the device
[ INFO ] Compile model took 989.62 ms
[Step 8/11] Querying optimal runtime parameters
[ INFO ] Model:
[ INFO ] NETWORK_NAME: torch-jit-export
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 2
[ INFO ] NUM_STREAMS: 2
[ INFO ] AFFINITY: CORE
[ INFO ] INFERENCE_NUM_THREADS: 0
[ INFO ] PERF_COUNT: NO
[ INFO ] INFERENCE_PRECISION_HINT: f32
[ INFO ] PERFORMANCE_HINT: LATENCY
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given: all inputs will be filled with random values!
[ INFO ] Test Config 0
[ INFO ] input ([N,C,D,H,W], f32, {1, 3, 16, 224, 224}, static): random (binary data is expected)
[Step 10/11] Measuring performance (Start inference asynchronously, 2 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 37.27 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 5470 iterations
[ INFO ] Duration: 60028.56 ms
[ INFO ] Latency:
[ INFO ] Median: 21.79 ms
[ INFO ] Average: 21.92 ms
[ INFO ] Min: 20.60 ms
[ INFO ] Max: 37.19 ms
[ INFO ] Throughput: 91.12 FPS
The Benchmark Tool can also be used with dynamically shaped networks to measure expected inference time for various input data shapes. See the ``-shape`` and ``-data_shape`` argument descriptions in the :ref:`All configuration options <all-configuration-options-cpp-benchmark>` section to learn more about using dynamic shapes. Here is a command example for using benchmark_app with dynamic networks and a portion of the resulting output:
.. code-block:: sh
./benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -shape [-1,3,16,224,224] -data_shape [1,3,16,224,224][2,3,16,224,224][4,3,16,224,224] -pcseq
.. code-block:: sh
[Step 9/11] Creating infer requests and preparing input tensors
[ INFO ] Test Config 0
[ INFO ] input ([N,C,D,H,W], f32, {1, 3, 16, 224, 224}, dyn:{?,3,16,224,224}): random (binary data is expected)
[ INFO ] Test Config 1
[ INFO ] input ([N,C,D,H,W], f32, {2, 3, 16, 224, 224}, dyn:{?,3,16,224,224}): random (binary data is expected)
[ INFO ] Test Config 2
[ INFO ] input ([N,C,D,H,W], f32, {4, 3, 16, 224, 224}, dyn:{?,3,16,224,224}): random (binary data is expected)
[Step 10/11] Measuring performance (Start inference asynchronously, 11 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in full mode (inputs filling are included in measurement loop).
[ INFO ] First inference took 204.40 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 2783 iterations
[ INFO ] Duration: 60326.29 ms
[ INFO ] Latency:
[ INFO ] Median: 208.20 ms
[ INFO ] Average: 237.47 ms
[ INFO ] Min: 85.06 ms
[ INFO ] Max: 743.46 ms
[ INFO ] Latency for each data shape group:
[ INFO ] 1. input: {1, 3, 16, 224, 224}
[ INFO ] Median: 120.36 ms
[ INFO ] Average: 117.19 ms
[ INFO ] Min: 85.06 ms
[ INFO ] Max: 348.66 ms
[ INFO ] 2. input: {2, 3, 16, 224, 224}
[ INFO ] Median: 207.81 ms
[ INFO ] Average: 206.39 ms
[ INFO ] Min: 167.19 ms
[ INFO ] Max: 578.33 ms
[ INFO ] 3. input: {4, 3, 16, 224, 224}
[ INFO ] Median: 387.40 ms
[ INFO ] Average: 388.99 ms
[ INFO ] Min: 327.50 ms
[ INFO ] Max: 743.46 ms
[ INFO ] Throughput: 107.61 FPS
See Also
####################
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
* :doc:`Model Downloader <omz_tools_downloader>`

View File

@ -1,308 +0,0 @@
.. {#openvino_inference_engine_samples_speech_sample_README}
Automatic Speech Recognition C++ Sample
=======================================
.. meta::
:description: Learn how to infer an acoustic model based on Kaldi
neural networks and speech feature vectors using Asynchronous
Inference Request (C++) API.
.. note::
This sample is now deprecated and will be removed with OpenVINO 2024.0.
The sample was mainly designed to demonstrate the features of the GNA plugin
and the use of models produced by the Kaldi framework. OpenVINO support for
these components is now deprecated and will be discontinued, making the sample
redundant.
This sample demonstrates how to execute an Asynchronous Inference of acoustic model based on Kaldi\* neural networks and speech feature vectors.
The sample works with Kaldi ARK or Numpy* uncompressed NPZ files, so it does not cover an end-to-end speech recognition scenario (speech to text), requiring additional preprocessing (feature extraction) to get a feature vector from a speech signal, as well as postprocessing (decoding) to produce text from scores.
.. tab-set::
.. tab-item:: Requirements
+-------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Options | Values |
+=============================================================+===============================================================================================================================================================+
| Validated Models | Acoustic model based on Kaldi\* neural networks (see :ref:`Model Preparation <model-preparation-speech>` section) |
+-------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (*.xml + *.bin) |
+-------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Supported devices | See :ref:`Execution Modes <execution-modes-speech>` section below and :doc:`List Supported Devices <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+-------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Feature | API | Description |
+=============================================================+=============================================================================================================+==============================================================================+
| Available Devices | ``ov::Core::get_available_devices``, ``ov::Core::get_property`` | Get information of the devices for inference |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Import/Export Model | ``ov::Core::import_model``, ``ov::CompiledModel::export_model`` | The GNA plugin supports loading and saving of the GNA-optimized model |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Model Operations | ``ov::set_batch``, ``ov::Model::add_output``, ``ov::CompiledModel::inputs``, ``ov::CompiledModel::outputs`` | Managing of model: configure batch_size, input and output tensors |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Node Operations | ``ov::OutputVector::size``, ``ov::Output::get_shape`` | Get node shape |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Asynchronous Infer | ``ov::InferRequest::start_async``, ``ov::InferRequest::wait`` | Do asynchronous inference and waits until inference result becomes available |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| InferRequest Operations | ``ov::InferRequest::query_state``, ``ov::VariableState::reset`` | Gets and resets CompiledModel state control |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Tensor Operations | ``ov::Tensor::get_size``, ``ov::Tensor::data``, ``ov::InferRequest::get_tensor`` | Get a tensor, its size and data |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
| Profiling | ``ov::InferRequest::get_profiling_info`` | Get infer request profiling info |
+-------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/speech_sample/main.cpp
:language: cpp
How It Works
############
At startup, the sample application reads command-line parameters, loads a specified model and input data to the OpenVINO™ Runtime plugin, performs inference on all speech utterances stored in the input file(s), logging each step in a standard output stream.
If the ``-r`` option is given, error statistics are provided for each speech utterance as shown above.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
GNA-specific details
++++++++++++++++++++
Quantization
------------
If the GNA device is selected (for example, using the ``-d`` GNA flag), the GNA OpenVINO™ Runtime plugin quantizes the model and input feature vector sequence to integer representation before performing inference.
Several parameters control neural network quantization. The ``-q`` flag determines the quantization mode.
Two modes are supported:
- *static* - The first utterance in the input file is scanned for dynamic range. The scale factor (floating point scalar multiplier) required to scale the maximum input value of the first utterance to 16384 (15 bits) is used for all subsequent inputs. The neural network is quantized to accommodate the scaled input dynamic range.
- *user-defined* - The user may specify a scale factor via the ``-sf`` flag that will be used for static quantization.
The ``-qb`` flag provides a hint to the GNA plugin regarding the preferred target weight resolution for all layers. For example, when ``-qb 8`` is specified, the plugin will use 8-bit weights wherever possible in the
network.
.. note::
It is not always possible to use 8-bit weights due to GNA hardware limitations. For example, convolutional layers always use 16-bit weights (GNA hardware version 1 and 2). This limitation will be removed in GNA hardware version 3 and higher.
.. _execution-modes-speech:
Execution Modes
---------------
Several execution modes are supported via the ``-d`` flag:
- ``CPU`` - All calculations are performed on CPU device using CPU Plugin.
- ``GPU`` - All calculations are performed on GPU device using GPU Plugin.
- ``NPU`` - All calculations are performed on NPU device using NPU Plugin.
- ``GNA_AUTO`` - GNA hardware is used if available and the driver is installed. Otherwise, the GNA device is emulated in fast-but-not-bit-exact mode.
- ``GNA_HW`` - GNA hardware is used if available and the driver is installed. Otherwise, an error will occur.
- ``GNA_SW`` - Deprecated. The GNA device is emulated in fast-but-not-bit-exact mode.
- ``GNA_SW_FP32`` - Substitutes parameters and calculations from low precision to floating point (FP32).
- ``GNA_SW_EXACT`` - GNA device is emulated in bit-exact mode.
Loading and Saving Models
-------------------------
The GNA plugin supports loading and saving of the GNA-optimized model (non-IR) via the ``-rg`` and ``-wg`` flags. Thereby, it is possible to avoid the cost of full model quantization at run time. The GNA plugin also supports export of firmware-compatible embedded model images for the Intel® Speech Enabling Developer Kit and Amazon Alexa* Premium Far-Field Voice Development Kit via the ``-we`` flag (save only).
In addition to performing inference directly from a GNA model file, these combinations of options make it possible to:
- Convert from IR format to GNA format model file (``-m``, ``-wg``)
- Convert from IR format to embedded format model file (``-m``, ``-we``)
- Convert from GNA format to embedded format model file (``-rg``, ``-we``)
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
Run the application with the -h option to see the usage message:
.. code-block:: sh
speech_sample -h
Usage message:
.. code-block:: sh
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Parsing input parameters
speech_sample [OPTION]
Options:
-h Print a usage message.
-i "<path>" Required. Path(s) to input file(s). Usage for a single file/layer: <input_file.ark> or <input_file.npz>. Example of usage for several files/layers: <layer1>:<port_num1>=<input_file1.ark>,<layer2>:<port_num2>=<input_file2.ark>.
-m "<path>" Required. Path to an .xml file with a trained model (required if -rg is missing).
-o "<path>" Optional. Output file name(s) to save scores (inference results). Example of usage for a single file/layer: <output_file.ark> or <output_file.npz>. Example of usage for several files/layers: <layer1>:<port_num1>=<output_file1.ark>,<layer2>:<port_num2>=<output_file2.ark>.
-d "<device>" Optional. Specify a target device to infer on. CPU, GPU, NPU, GNA_AUTO, GNA_HW, GNA_HW_WITH_SW_FBACK, GNA_SW_FP32, GNA_SW_EXACT and HETERO with combination of GNA as the primary device and CPU as a secondary (e.g. HETERO:GNA,CPU) are supported. The sample will look for a suitable plugin for device specified.
-pc Optional. Enables per-layer performance report.
-q "<mode>" Optional. Input quantization mode for GNA: static (default) or user defined (use with -sf).
-qb "<integer>" Optional. Weight resolution in bits for GNA quantization: 8 or 16 (default)
-sf "<double>" Optional. User-specified input scale factor for GNA quantization (use with -q user). If the model contains multiple inputs, provide scale factors by separating them with commas. For example: <layer1>:<sf1>,<layer2>:<sf2> or just <sf> to be applied to all inputs.
-bs "<integer>" Optional. Batch size 1-8 (default 1)
-r "<path>" Optional. Read reference score file(s) and compare inference results with reference scores. Usage for a single file/layer: <reference.ark> or <reference.npz>. Example of usage for several files/layers: <layer1>:<port_num1>=<reference_file1.ark>,<layer2>:<port_num2>=<reference_file2.ark>.
-rg "<path>" Read GNA model from file using path/filename provided (required if -m is missing).
-wg "<path>" Optional. Write GNA model to file using path/filename provided.
-we "<path>" Optional. Write GNA embedded model to file using path/filename provided.
-cw_l "<integer>" Optional. Number of frames for left context windows (default is 0). Works only with context window networks. If you use the cw_l or cw_r flag, then batch size argument is ignored.
-cw_r "<integer>" Optional. Number of frames for right context windows (default is 0). Works only with context window networks. If you use the cw_r or cw_l flag, then batch size argument is ignored.
-layout "<string>" Optional. Prompts how network layouts should be treated by application. For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input size.
-pwl_me "<double>" Optional. The maximum percent of error for PWL function.The value must be in <0, 100> range. The default value is 1.0.
-exec_target "<string>" Optional. Specify GNA execution target generation. May be one of GNA_TARGET_2_0, GNA_TARGET_3_0. By default, generation corresponds to the GNA HW available in the system or the latest fully supported generation by the software. See the GNA Plugin's GNA_EXEC_TARGET config option description.
-compile_target "<string>" Optional. Specify GNA compile target generation. May be one of GNA_TARGET_2_0, GNA_TARGET_3_0. By default, generation corresponds to the GNA HW available in the system or the latest fully supported generation by the software. See the GNA Plugin's GNA_COMPILE_TARGET config option description.
-memory_reuse_off Optional. Disables memory optimizations for compiled model.
Available target devices: CPU GNA GPU NPU
.. _model-preparation-speech:
Model Preparation
+++++++++++++++++
You can use the following model conversion command to convert a Kaldi nnet1 or nnet2 neural model to OpenVINO™ toolkit Intermediate Representation format:
.. code-block:: sh
mo --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir <OUTPUT_MODEL_DIR>
The following pre-trained models are available:
- rm_cnn4a_smbr
- rm_lstm4f
- wsj_dnn5b_smbr
All of them can be downloaded from `the storage <https://storage.openvinotoolkit.org/models_contrib/speech/2021.2>`__.
Speech Inference
++++++++++++++++
Once the IR is created, you can do inference on Intel® Processors with the GNA co-processor (or emulation library):
.. code-block:: sh
speech_sample -m wsj_dnn5b.xml -i dev93_10.ark -r dev93_scores_10.ark -d GNA_AUTO -o result.ark
Here, the floating point Kaldi-generated reference neural network scores (``dev93_scores_10.ark``) corresponding to the input feature file (``dev93_10.ark``) are assumed to be available for comparison.
.. note::
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample supports input and output in numpy file format (.npz)
- Stating flags that take only single option like `-m` multiple times, for example `./speech_sample -m model.xml -m model2.xml`, results in only the first value being used.
Sample Output
#############
The sample application logs each step in a standard output stream.
.. code-block:: sh
[ INFO ] OpenVINO runtime: OpenVINO Runtime version ......... 2022.1.0
[ INFO ] Build ........... 2022.1.0-6311-a90bb1ff017
[ INFO ]
[ INFO ] Parsing input parameters
[ INFO ] Loading model files:
[ INFO ] \test_data\models\wsj_dnn5b_smbr_fp32\wsj_dnn5b_smbr_fp32.xml
[ INFO ] Using scale factor of 2175.43 calculated from first utterance.
[ INFO ] Model loading time 0.0034 ms
[ INFO ] Loading model to the device GNA_AUTO
[ INFO ] Loading model to the device
[ INFO ] Number scores per frame : 3425
Utterance 0:
Total time in Infer (HW and SW): 5687.53 ms
Frames in utterance: 1294 frames
Average Infer time per frame: 4.39531 ms
max error: 0.705184
avg error: 0.0448388
avg rms error: 0.0574098
stdev error: 0.0371649
End of Utterance 0
[ INFO ] Number scores per frame : 3425
Utterance 1:
Total time in Infer (HW and SW): 4341.34 ms
Frames in utterance: 1005 frames
Average Infer time per frame: 4.31974 ms
max error: 0.757597
avg error: 0.0452166
avg rms error: 0.0578436
stdev error: 0.0372769
End of Utterance 1
...
End of Utterance X
[ INFO ] Execution successful
Use of Sample in Kaldi* Speech Recognition Pipeline
###################################################
The Wall Street Journal DNN model used in this example was prepared using the Kaldi s5 recipe and the Kaldi Nnet (nnet1) framework. It is possible to recognize speech by substituting the ``speech_sample`` for
Kaldi's nnet-forward command. Since the ``speech_sample`` does not yet use pipes, it is necessary to use temporary files for speaker-transformed feature vectors and scores when running the Kaldi speech recognition pipeline. The following operations assume that feature extraction was already performed according to the ``s5`` recipe and that the working directory within the Kaldi source tree is ``egs/wsj/s5``.
1. Prepare a speaker-transformed feature set given the feature transform specified in ``final.feature_transform`` and the feature files specified in ``feats.scp``:
.. code-block:: sh
nnet-forward --use-gpu=no final.feature_transform "ark,s,cs:copy-feats scp:feats.scp ark:- |" ark:feat.ark
2. Score the feature set using the ``speech_sample``:
.. code-block:: sh
./speech_sample -d GNA_AUTO -bs 8 -i feat.ark -m wsj_dnn5b.xml -o scores.ark
OpenVINO™ toolkit Intermediate Representation ``wsj_dnn5b.xml`` file was generated in the previous :ref:`Model Preparation <model-preparation-speech>` section.
3. Run the Kaldi decoder to produce n-best text hypotheses and select most likely text given the WFST (``HCLG.fst``), vocabulary (``words.txt``), and TID/PID mapping (``final.mdl``):
.. code-block:: sh
latgen-faster-mapped --max-active=7000 --max-mem=50000000 --beam=13.0 --lattice-beam=6.0 --acoustic-scale=0.0833 --allow-partial=true --word-symbol-table=words.txt final.mdl HCLG.fst ark:scores.ark ark:-| lattice-scale --inv-acoustic-scale=13 ark:- ark:- | lattice-best-path --word-symbol-table=words.txt ark:- ark,t:- > out.txt &
4. Run the word error rate tool to check accuracy given the vocabulary (``words.txt``) and reference transcript (``test_filt.txt``):
.. code-block:: sh
cat out.txt | utils/int2sym.pl -f 2- words.txt | sed s:\<UNK\>::g | compute-wer --text --mode=present ark:test_filt.txt ark,p:-
All of mentioned files can be downloaded from `the storage <https://storage.openvinotoolkit.org/models_contrib/speech/2021.2/wsj_dnn5b_smbr>`__
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,174 +0,0 @@
.. {#openvino_inference_engine_samples_hello_classification_README}
Hello Classification C++ Sample
===============================
.. meta::
:description: Learn how to do inference of image
classification models using Synchronous Inference Request
(C++) API.
This sample demonstrates how to do inference of image classification models using Synchronous Inference Request API.
Models with only one input and output are supported.
.. tab-set::
.. tab-item:: Requirements
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Options | Values |
+=====================================+=======================================================================================================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, :doc:`googlenet-v1 <omz_models_model_googlenet_v1>` |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`C <openvino_inference_engine_ie_bridges_c_samples_hello_classification_README>`, :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>` |
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Feature | API | Description |
+=====================================+================================================================+=========================================================================================================================================================================================+
| OpenVINO Runtime Version | ``ov::get_openvino_version`` | Get Openvino API version |
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Basic Infer Flow | ``ov::Core::read_model``, | Common API to do inference: read and compile a model, create an infer request, configure input and output tensors |
| | ``ov::Core::compile_model``, | |
| | ``ov::CompiledModel::create_infer_request``, | |
| | ``ov::InferRequest::set_input_tensor``, | |
| | ``ov::InferRequest::get_output_tensor`` | |
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Synchronous Infer | ``ov::InferRequest::infer`` | Do synchronous inference |
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Operations | ``ov::Model::inputs``, | Get inputs and outputs of a model |
| | ``ov::Model::outputs`` | |
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Tensor Operations | ``ov::Tensor::get_shape`` | Get a tensor shape |
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Preprocessing | ``ov::preprocess::InputTensorInfo::set_element_type``, | Set image of the original size as input for a model with other input size. Resize and layout conversions are performed automatically by the corresponding plugin just before inference. |
| | ``ov::preprocess::InputTensorInfo::set_layout``, | |
| | ``ov::preprocess::InputTensorInfo::set_spatial_static_shape``, | |
| | ``ov::preprocess::PreProcessSteps::resize``, | |
| | ``ov::preprocess::InputModelInfo::set_layout``, | |
| | ``ov::preprocess::OutputTensorInfo::set_element_type``, | |
| | ``ov::preprocess::PrePostProcessor::build`` | |
+-------------------------------------+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/hello_classification/main.cpp
:language: cpp
How It Works
############
At startup, the sample application reads command line parameters, prepares input data, loads a specified model and image to the OpenVINO™ Runtime plugin and performs synchronous inference. Then processes output data and write it to a standard output stream.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
.. code-block:: console
hello_classification <path_to_model> <path_to_image> <device_name>
To run the sample, you need to specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and Demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using ``mo`` with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
+++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: console
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model using:
.. code-block:: console
omz_downloader --name googlenet-v1
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: console
omz_converter --name googlenet-v1
4. Perform inference of ``car.bmp`` using the ``googlenet-v1`` model on a ``GPU``, for example:
.. code-block:: console
hello_classification googlenet-v1.xml car.bmp GPU
Sample Output
#############
The application outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Loading model files: /models/googlenet-v1.xml
[ INFO ] model name: GoogleNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 224, 224}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
Top 10 results:
Image /images/car.bmp
classid probability
------- -----------
656 0.8139648
654 0.0550537
468 0.0178375
436 0.0165405
705 0.0111694
817 0.0105820
581 0.0086823
575 0.0077515
734 0.0064468
785 0.0043983
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,171 +0,0 @@
.. {#openvino_inference_engine_samples_hello_nv12_input_classification_README}
Hello NV12 Input Classification C++ Sample
==========================================
.. meta::
:description: Learn how to do inference of image
classification models with images in NV12 color format using
Synchronous Inference Request (C++) API.
This sample demonstrates how to execute an inference of image classification models with images in NV12 color format using Synchronous Inference Request API.
.. tab-set::
.. tab-item:: Requirements
+-------------------------------------+--------------------------------------------------------------------------------------------------+
| Options | Values |
+=====================================+==================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>` |
+-------------------------------------+--------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
+-------------------------------------+--------------------------------------------------------------------------------------------------+
| Validated images | An uncompressed image in the NV12 color format - \*.yuv |
+-------------------------------------+--------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+-------------------------------------+--------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`C <openvino_inference_engine_ie_bridges_c_samples_hello_nv12_input_classification_README>` |
+-------------------------------------+--------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+-------------------------------------+-------------------------------------------------------------+-------------------------------------------+
| Feature | API | Description |
+=====================================+=============================================================+===========================================+
| Node Operations | ``ov::Output::get_any_name`` | Get a layer name |
+-------------------------------------+-------------------------------------------------------------+-------------------------------------------+
| Infer Request Operations | ``ov::InferRequest::set_tensor``, | Operate with tensors |
| | ``ov::InferRequest::get_tensor`` | |
+-------------------------------------+-------------------------------------------------------------+-------------------------------------------+
| Preprocessing | ``ov::preprocess::InputTensorInfo::set_color_format``, | Change the color format of the input data |
| | ``ov::preprocess::PreProcessSteps::convert_element_type``, | |
| | ``ov::preprocess::PreProcessSteps::convert_color`` | |
+-------------------------------------+-------------------------------------------------------------+-------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/hello_nv12_input_classification/main.cpp
:language: cpp
How It Works
############
At startup, the sample application reads command line parameters, loads the specified model and an image in the NV12 color format to an OpenVINO™ Runtime plugin. Then, the sample creates an synchronous inference request object. When inference is done, the application outputs data to the standard output stream. You can place labels in .labels file near the model to get pretty output.
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
.. code-block:: console
hello_nv12_input_classification <path_to_model> <path_to_image> <image_size> <device_name>
To run the sample, you need to specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
The sample accepts an uncompressed image in the NV12 color format. To run the sample, you need to convert your BGR/RGB image to NV12. To do this, you can use one of the widely available tools such as FFmpeg\* or GStreamer\*. The following command shows how to convert an ordinary image into an uncompressed NV12 image using FFmpeg:
.. code-block:: sh
ffmpeg -i cat.jpg -pix_fmt nv12 car.yuv
.. note::
- Because the sample reads raw image files, you should provide a correct image size along with the image path. The sample expects the logical size of the image, not the buffer size. For example, for 640x480 BGR/RGB image the corresponding NV12 logical image size is also 640x480, whereas the buffer size is 640x720.
- By default, this sample expects that model input has BGR channels order. If you trained your model to work with RGB order, you need to reconvert your model using ``mo`` with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
+++++++
1. Install openvino-dev python package if you don't have it to use Open Model Zoo Tools:
.. code-block:: console
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model:
.. code-block:: console
omz_downloader --name alexnet
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: console
omz_converter --name alexnet
4. Perform inference of NV12 image using ``alexnet`` model on a ``CPU``, for example:
.. code-block:: console
hello_nv12_input_classification alexnet.xml car.yuv 300x300 CPU
Sample Output
#############
The application outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Loading model files: \models\alexnet.xml
[ INFO ] model name: AlexNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 227, 227}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
Top 10 results:
Image \images\car.yuv
classid probability
------- -----------
656 0.6668988
654 0.1125269
581 0.0679280
874 0.0340229
436 0.0257744
817 0.0169367
675 0.0110199
511 0.0106134
569 0.0083373
717 0.0061734
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,126 +0,0 @@
.. {#openvino_inference_engine_samples_hello_query_device_README}
Hello Query Device C++ Sample
=============================
.. meta::
:description: Learn how to show metrics and default
configuration values of inference devices using Query
Device (C++) API feature.
This sample demonstrates how to execute an query OpenVINO™ Runtime devices, prints their metrics and default configuration values, using :doc:`Properties API <openvino_docs_OV_UG_query_api>`.
.. tab-set::
.. tab-item:: Requirements
+----------------------------------------+----------------------------------------------------------------------------------------------+
| Options | Values |
+========================================+==============================================================================================+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+----------------------------------------+----------------------------------------------------------------------------------------------+
| Other language realization | :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_hello_query_device_README>` |
+----------------------------------------+----------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+----------------------------------------+---------------------------------------+-------------------------------------------------------------------+
| Feature | API | Description |
+========================================+=======================================+===================================================================+
| Available Devices | ``ov::Core::get_available_devices``, | Get available devices information and configuration for inference |
| | ``ov::Core::get_property`` | |
+----------------------------------------+---------------------------------------+-------------------------------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/hello_query_device/main.cpp
:language: cpp
How It Works
############
The sample queries all available OpenVINO™ Runtime devices, prints their supported metrics and plugin configuration parameters.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
To see quired information, run the following:
.. code-block:: console
hello_query_device
Sample Output
#############
The application prints all available devices with their supported metrics and default values for configuration parameters:
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Available devices:
[ INFO ] CPU
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES : [ ]
[ INFO ] FULL_DEVICE_NAME : Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
[ INFO ] OPTIMIZATION_CAPABILITIES : [ FP32 FP16 INT8 BIN ]
[ INFO ] RANGE_FOR_ASYNC_INFER_REQUESTS : { 1, 1, 1 }
[ INFO ] RANGE_FOR_STREAMS : { 1, 8 }
[ INFO ] IMPORT_EXPORT_SUPPORT : true
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] CACHE_DIR : ""
[ INFO ] CPU_BIND_THREAD : NO
[ INFO ] CPU_THREADS_NUM : 0
[ INFO ] CPU_THROUGHPUT_STREAMS : 1
[ INFO ] DUMP_EXEC_GRAPH_AS_DOT : ""
[ INFO ] ENFORCE_BF16 : NO
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS : NO
[ INFO ] PERFORMANCE_HINT : ""
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS : 0
[ INFO ] PERF_COUNT : NO
[ INFO ]
[ INFO ] GNA
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES : [ GNA_SW_EXACT ]
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS : 1
[ INFO ] FULL_DEVICE_NAME : GNA_SW_EXACT
[ INFO ] GNA_LIBRARY_FULL_VERSION : 3.0.0.1455
[ INFO ] IMPORT_EXPORT_SUPPORT : true
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS : NO
[ INFO ] GNA_COMPACT_MODE : YES
[ INFO ] GNA_COMPILE_TARGET : ""
[ INFO ] GNA_DEVICE_MODE : GNA_SW_EXACT
[ INFO ] GNA_EXEC_TARGET : ""
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE : ""
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE_GENERATION : ""
[ INFO ] GNA_LIB_N_THREADS : 1
[ INFO ] GNA_PRECISION : I16
[ INFO ] GNA_PWL_MAX_ERROR_PERCENT : 1.000000
[ INFO ] GNA_PWL_UNIFORM_DESIGN : NO
[ INFO ] GNA_SCALE_FACTOR : 1.000000
[ INFO ] GNA_SCALE_FACTOR_0 : 1.000000
[ INFO ] LOG_LEVEL : LOG_NONE
[ INFO ] PERF_COUNT : NO
[ INFO ] SINGLE_THREAD : YES
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`

View File

@ -1,162 +0,0 @@
.. {#openvino_inference_engine_samples_hello_reshape_ssd_README}
Hello Reshape SSD C++ Sample
============================
.. meta::
:description: Learn how to do inference of object
detection models using shape inference feature and Synchronous
Inference Request (C++) API.
This sample demonstrates how to do synchronous inference of object detection models using :doc:`input reshape feature <openvino_docs_OV_UG_ShapeInference>`.
Models with only one input and output are supported.
.. tab-set::
.. tab-item:: Requirements
+----------------------------------+---------------------------------------------------------------------------------------------+
| Options | Values |
+==================================+=============================================================================================+
| Validated Models | :doc:`person-detection-retail-0013 <omz_models_model_person_detection_retail_0013>` |
+----------------------------------+---------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
+----------------------------------+---------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+----------------------------------+---------------------------------------------------------------------------------------------+
| Other language realization | :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_hello_reshape_ssd_README>` |
+----------------------------------+---------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+----------------------------------+-------------------------------------------------------------+------------------------------------------------+
| Feature | API | Description |
+==================================+=============================================================+================================================+
| Node operations | ``ov::Node::get_type_info``, | Get a node info |
| | ``ngraph::op::DetectionOutput::get_type_info_static``, | |
| | ``ov::Output::get_any_name``, | |
| | ``ov::Output::get_shape`` | |
+----------------------------------+-------------------------------------------------------------+------------------------------------------------+
| Model Operations | ``ov::Model::get_ops``, | Get model nodes, reshape input |
| | ``ov::Model::reshape`` | |
+----------------------------------+-------------------------------------------------------------+------------------------------------------------+
| Tensor Operations | ``ov::Tensor::data`` | Get a tensor data |
+----------------------------------+-------------------------------------------------------------+------------------------------------------------+
| Preprocessing | ``ov::preprocess::PreProcessSteps::convert_element_type``, | Model input preprocessing |
| | ``ov::preprocess::PreProcessSteps::convert_layout`` | |
+----------------------------------+-------------------------------------------------------------+------------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/hello_reshape_ssd/main.cpp
:language: cpp
How It Works
############
Upon the start-up the sample application reads command line parameters, loads specified network and image to the Inference
Engine plugin. Then, the sample creates an synchronous inference request object. When inference is done, the application creates output image and output data to the standard output stream.
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
.. code-block:: console
hello_reshape_ssd <path_to_model> <path_to_image> <device>
To run the sample, you need to specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and Demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using ``mo`` with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing.
Example
+++++++
1. Install openvino-dev python package if you don't have it to use Open Model Zoo Tools:
.. code-block:: console
python -m pip install openvino-dev
2. Download a pre-trained model using:
.. code-block:: console
omz_downloader --name person-detection-retail-0013
3. ``person-detection-retail-0013`` does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use another model that is not in the IR or ONNX format, you can convert it using the model converter script:
.. code-block:: console
omz_converter --name <model_name>
4. Perform inference of ``person_detection.bmp`` using ``person-detection-retail-0013`` model on a ``GPU``, for example:
.. code-block:: console
hello_reshape_ssd person-detection-retail-0013.xml person_detection.bmp GPU
Sample Output
#############
The application renders an image with detected objects enclosed in rectangles. It outputs the list of classes of the detected objects along with the respective confidence values and the coordinates of the rectangles to the standard output stream.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Loading model files: \models\person-detection-retail-0013.xml
[ INFO ] model name: ResMobNet_v4 (LReLU) with single SSD head
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 320, 544}
[ INFO ] outputs
[ INFO ] output name: detection_out
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1, 200, 7}
Reshape network to the image size = [960x1699]
[ INFO ] model name: ResMobNet_v4 (LReLU) with single SSD head
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 960, 1699}
[ INFO ] outputs
[ INFO ] output name: detection_out
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1, 200, 7}
[0,1] element, prob = 0.716309, (852,187)-(983,520)
The resulting image was saved in the file: hello_reshape_ssd_output.bmp
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,222 +0,0 @@
.. {#openvino_inference_engine_samples_classification_sample_async_README}
Image Classification Async C++ Sample
=====================================
.. meta::
:description: Learn how to do inference of image
classification models using Asynchronous Inference Request
(C++) API.
This sample demonstrates how to do inference of image classification models using Asynchronous Inference Request API.
Models with only one input and output are supported.
In addition to regular images, the sample also supports single-channel ``ubyte`` images as an input for LeNet model.
.. tab-set::
.. tab-item:: Requirements
+----------------------------+-------------------------------------------------------------------------------------------------------+
| Options | Values |
+============================+=======================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, :doc:`googlenet-v1 <omz_models_model_googlenet_v1>` |
+----------------------------+-------------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
+----------------------------+-------------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+----------------------------+-------------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_classification_sample_async_README>` |
+----------------------------+-------------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+--------------------------+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
| Feature | API | Description |
+==========================+=======================================================================+========================================================================================+
| Asynchronous Infer | ``ov::InferRequest::start_async``, ``ov::InferRequest::set_callback`` | Do asynchronous inference with callback. |
+--------------------------+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
| Model Operations | ``ov::Output::get_shape``, ``ov::set_batch`` | Manage the model, operate with its batch size. Set batch size using input image count. |
+--------------------------+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
| Infer Request Operations | ``ov::InferRequest::get_input_tensor`` | Get an input tensor. |
+--------------------------+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
| Tensor Operations | ``ov::shape_size``, ``ov::Tensor::data`` | Get a tensor shape size and its data. |
+--------------------------+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/classification_sample_async/main.cpp
:language: cpp
How It Works
############
At startup, the sample application reads command line parameters and loads the specified model and input images (or a
folder with images) to the OpenVINO™ Runtime plugin. The batch size of the model is set according to the number of read images. The batch mode is an independent attribute on the asynchronous mode. Asynchronous mode works efficiently with any batch size.
Then, the sample creates an inference request object and assigns completion callback for it. In scope of the completion callback handling the inference request is executed again.
After that, the application starts inference for the first infer request and waits of 10th inference request execution being completed. The asynchronous mode might increase the throughput of the pictures.
When inference is done, the application outputs data to the standard output stream. You can place labels in .labels file near the model to get pretty output.
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
Run the application with the ``-h`` option to see the usage instructions:
.. code-block:: sh
classification_sample_async -h
Usage instructions:
.. code-block:: sh
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
classification_sample_async [OPTION]
Options:
-h Print usage instructions.
-m "<path>" Required. Path to an .xml file with a trained model.
-i "<path>" Required. Path to a folder with images or path to image files: a .ubyte file for LeNet and a .bmp file for other models.
-d "<device>" Optional. Specify the target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma_separated_devices_list>" format to specify the HETERO plugin. Sample will look for a suitable plugin for the device specified.
Available target devices: <devices>
To run the sample, you need to specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available `here <https://storage.openvinotoolkit.org/data/test_data>`.
.. note::
- By default, OpenVINO™ Toolkit Samples and Demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using ``mo`` with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
- Stating flags that take only single option like `-m` multiple times, for example `./classification_sample_async -m model.xml -m model2.xml`, results in only the first value being used.
- The sample supports NCHW model layout only.
Example
+++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: sh
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model using:
.. code-block:: sh
omz_downloader --name googlenet-v1
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: sh
omz_converter --name googlenet-v1
4. Perform inference of ``dog.bmp`` using ``googlenet-v1`` model on a ``GPU``, for example:
.. code-block:: sh
classification_sample_async -m googlenet-v1.xml -i dog.bmp -d GPU
Sample Output
#############
.. code-block:: sh
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /images/dog.bmp
[ INFO ] Loading model files:
[ INFO ] /models/googlenet-v1.xml
[ INFO ] model name: GoogleNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 224, 224}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
[ INFO ] Read input images
[ INFO ] Set batch size 1
[ INFO ] model name: GoogleNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: u8
[ INFO ] input shape: {1, 224, 224, 3}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
[ INFO ] Loading model to the device GPU
[ INFO ] Create infer request
[ INFO ] Start inference (asynchronous executions)
[ INFO ] Completed 1 async request execution
[ INFO ] Completed 2 async request execution
[ INFO ] Completed 3 async request execution
[ INFO ] Completed 4 async request execution
[ INFO ] Completed 5 async request execution
[ INFO ] Completed 6 async request execution
[ INFO ] Completed 7 async request execution
[ INFO ] Completed 8 async request execution
[ INFO ] Completed 9 async request execution
[ INFO ] Completed 10 async request execution
[ INFO ] Completed async requests execution
Top 10 results:
Image /images/dog.bmp
classid probability
------- -----------
156 0.8935547
218 0.0608215
215 0.0217133
219 0.0105667
212 0.0018835
217 0.0018730
152 0.0018730
157 0.0015745
154 0.0012817
220 0.0010099
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,238 +0,0 @@
.. {#openvino_inference_engine_samples_model_creation_sample_README}
Model Creation C++ Sample
=========================
.. meta::
:description: Learn how to create a model on the fly with a
provided weights file and infer it later using Synchronous
Inference Request (C++) API.
This sample demonstrates how to execute an synchronous inference using :doc:`model <openvino_docs_OV_UG_Model_Representation>` built on the fly which uses weights from LeNet classification model, which is known to work well on digit classification tasks.
You do not need an XML file to create a model. The API of ov::Model allows creating a model on the fly from the source code.
.. tab-set::
.. tab-item:: Requirements
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
| Options | Values |
+=========================================================+=================================================================================================+
| Validated Models | LeNet |
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
| Model Format | model weights file (\*.bin) |
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
| Validated images | single-channel ``MNIST ubyte`` images |
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_model_creation_sample_README>` |
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+------------------------------------------+-----------------------------------------+---------------------------------------+
| Feature | API | Description |
+==========================================+=========================================+=======================================+
| OpenVINO Runtime Info | ``ov::Core::get_versions`` | Get device plugins versions |
+------------------------------------------+-----------------------------------------+---------------------------------------+
| Shape Operations | ``ov::Output::get_shape``, | Operate with shape |
| | ``ov::Shape::size``, | |
| | ``ov::shape_size`` | |
+------------------------------------------+-----------------------------------------+---------------------------------------+
| Tensor Operations | ``ov::Tensor::get_byte_size``, | Get tensor byte size and its data |
| | ``ov::Tensor:data`` | |
+------------------------------------------+-----------------------------------------+---------------------------------------+
| Model Operations | ``ov::set_batch`` | Operate with model batch size |
+------------------------------------------+-----------------------------------------+---------------------------------------+
| Infer Request Operations | ``ov::InferRequest::get_input_tensor`` | Get a input tensor |
+------------------------------------------+-----------------------------------------+---------------------------------------+
| Model creation objects | ``ov::opset8::Parameter``, | Used to construct an OpenVINO model |
| | ``ov::Node::output``, | |
| | ``ov::opset8::Constant``, | |
| | ``ov::opset8::Convolution``, | |
| | ``ov::opset8::Add``, | |
| | ``ov::opset1::MaxPool``, | |
| | ``ov::opset8::Reshape``, | |
| | ``ov::opset8::MatMul``, | |
| | ``ov::opset8::Relu``, | |
| | ``ov::opset8::Softmax``, | |
| | ``ov::descriptor::Tensor::set_names``, | |
| | ``ov::opset8::Result``, | |
| | ``ov::Model``, | |
| | ``ov::ParameterVector::vector`` | |
+------------------------------------------+-----------------------------------------+---------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/model_creation_sample/main.cpp
:language: cpp
How It Works
############
At startup, the sample application does the following:
- Reads command line parameters
- :doc:`Build a Model <openvino_docs_OV_UG_Model_Representation>` and passed weights file
- Loads the model and input data to the OpenVINO™ Runtime plugin
- Performs synchronous inference and processes output data, logging each step in a standard output stream
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
########
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
#######
.. code-block:: console
model_creation_sample <path_to_lenet_weights> <device>
.. note::
- you can use LeNet model weights in the sample folder: ``lenet.bin`` with FP32 weights file
- The ``lenet.bin`` with FP32 weights file was generated by :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` from the public LeNet model with the ``input_shape [64,1,28,28]`` parameter specified.
The original model is available in the `Caffe* repository <https://github.com/BVLC/caffe/tree/master/examples/mnist>`__ on GitHub\*.
You can do inference of an image using a pre-trained model on a GPU using the following command:
.. code-block:: console
model_creation_sample lenet.bin GPU
Sample Output
#############
The sample application logs each step in a standard output stream and outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Intel GPU plugin version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ]
[ INFO ] Create model from weights: lenet.bin
[ INFO ] model name: lenet
[ INFO ] inputs
[ INFO ] input name: NONE
[ INFO ] input type: f32
[ INFO ] input shape: {64, 1, 28, 28}
[ INFO ] outputs
[ INFO ] output name: output_tensor
[ INFO ] output type: f32
[ INFO ] output shape: {64, 10}
[ INFO ] Batch size is 10
[ INFO ] model name: lenet
[ INFO ] inputs
[ INFO ] input name: NONE
[ INFO ] input type: u8
[ INFO ] input shape: {10, 28, 28, 1}
[ INFO ] outputs
[ INFO ] output name: output_tensor
[ INFO ] output type: f32
[ INFO ] output shape: {10, 10}
[ INFO ] Compiling a model for the GPU device
[ INFO ] Create infer request
[ INFO ] Combine images in batch and set to input tensor
[ INFO ] Start sync inference
[ INFO ] Processing output tensor
Top 1 results:
Image 0
classid probability label
------- ----------- -----
0 1.0000000 0
Image 1
classid probability label
------- ----------- -----
1 1.0000000 1
Image 2
classid probability label
------- ----------- -----
2 1.0000000 2
Image 3
classid probability label
------- ----------- -----
3 1.0000000 3
Image 4
classid probability label
------- ----------- -----
4 1.0000000 4
Image 5
classid probability label
------- ----------- -----
5 1.0000000 5
Image 6
classid probability label
------- ----------- -----
6 1.0000000 6
Image 7
classid probability label
------- ----------- -----
7 1.0000000 7
Image 8
classid probability label
------- ----------- -----
8 1.0000000 8
Image 9
classid probability label
------- ----------- -----
9 1.0000000 9
Deprecation Notice
##################
+--------------------+------------------+
| Deprecation Begins | June 1, 2020 |
+====================+==================+
| Removal Date | December 1, 2020 |
+--------------------+------------------+
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,145 +0,0 @@
.. {#openvino_inference_engine_samples_sync_benchmark_README}
Sync Benchmark C++ Sample
=========================
.. meta::
:description: Learn how to estimate performance of a model using Synchronous Inference Request (C++) API.
This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike :doc:`demos <omz_demos>` this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options.
.. tab-set::
.. tab-item:: Requirements
+--------------------------------+------------------------------------------------------------------------------------------------+
| Options | Values |
+================================+================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, |
| | :doc:`googlenet-v1 <omz_models_model_googlenet_v1>`, |
| | :doc:`yolo-v3-tf <omz_models_model_yolo_v3_tf>`, |
| | :doc:`face-detection-0200 <omz_models_model_face_detection_0200>` |
+--------------------------------+------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation |
| | (\*.xml + \*.bin), ONNX (\*.onnx) |
+--------------------------------+------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+--------------------------------+------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_sync_benchmark_README>` |
+--------------------------------+------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
+--------------------------+----------------------------------------------+----------------------------------------------+
| Feature | API | Description |
+==========================+==============================================+==============================================+
| OpenVINO Runtime Version | ``ov::get_openvino_version`` | Get Openvino API version. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Basic Infer Flow | ``ov::Core``, ``ov::Core::compile_model``, | Common API to do inference: compile a model, |
| | ``ov::CompiledModel::create_infer_request``, | create an infer request, |
| | ``ov::InferRequest::get_tensor`` | configure input tensors. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Synchronous Infer | ``ov::InferRequest::infer``, | Do synchronous inference. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Model Operations | ``ov::CompiledModel::inputs`` | Get inputs of a model. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Tensor Operations | ``ov::Tensor::get_shape``, | Get a tensor shape and its data. |
| | ``ov::Tensor::data`` | |
+--------------------------+----------------------------------------------+----------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/benchmark/sync_benchmark/main.cpp
:language: cpp
How It Works
####################
The sample compiles a model for a given device, randomly generates input data, performs synchronous inference multiple times for a given number of seconds. Then processes and reports performance results.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
####################
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
####################
.. code-block:: sh
sync_benchmark <path_to_model> <device_name>(default: CPU)
To run the sample, you need to specify a model:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
.. note::
Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
++++++++++++++++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: sh
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model using:
.. code-block:: sh
omz_downloader --name googlenet-v1
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: sh
omz_converter --name googlenet-v1
4. Perform benchmarking using the ``googlenet-v1`` model on a ``CPU``:
.. code-block:: sh
sync_benchmark googlenet-v1.xml
Sample Output
####################
The application outputs performance results.
.. code-block:: sh
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 992 iterations
[ INFO ] Duration: 15009.8 ms
[ INFO ] Latency:
[ INFO ] Median: 14.00 ms
[ INFO ] Average: 15.13 ms
[ INFO ] Min: 9.33 ms
[ INFO ] Max: 53.60 ms
[ INFO ] Throughput: 66.09 FPS
See Also
####################
* :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Model Downloader <omz_tools_downloader>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,150 +0,0 @@
.. {#openvino_inference_engine_samples_throughput_benchmark_README}
Throughput Benchmark C++ Sample
===============================
.. meta::
:description: Learn how to estimate performance of a model using Asynchronous Inference Request (C++) API in throughput mode.
This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike :doc:`demos <omz_demos>` this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options.
The reported results may deviate from what :doc:`benchmark_app <openvino_inference_engine_samples_benchmark_app_README>` reports. One example is model input precision for computer vision tasks. benchmark_app sets ``uint8``, while the sample uses default model precision which is usually ``float32``.
.. tab-set::
.. tab-item:: Requirements
+--------------------------------+------------------------------------------------------------------------------------------------+
| Options | Values |
+================================+================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, |
| | :doc:`googlenet-v1 <omz_models_model_googlenet_v1>`, |
| | :doc:`yolo-v3-tf <omz_models_model_yolo_v3_tf>`, |
| | :doc:`face-detection-0200 <omz_models_model_face_detection_0200>` |
+--------------------------------+------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation |
| | (\*.xml + \*.bin), ONNX (\*.onnx) |
+--------------------------------+------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+--------------------------------+------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`Python <openvino_inference_engine_ie_bridges_python_sample_throughput_benchmark_README>` |
+--------------------------------+------------------------------------------------------------------------------------------------+
.. tab-item:: C++ API
The following C++ API is used in the application:
+--------------------------+----------------------------------------------+----------------------------------------------+
| Feature | API | Description |
+==========================+==============================================+==============================================+
| OpenVINO Runtime Version | ``ov::get_openvino_version`` | Get Openvino API version. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Basic Infer Flow | ``ov::Core``, ``ov::Core::compile_model``, | Common API to do inference: compile a model, |
| | ``ov::CompiledModel::create_infer_request``, | create an infer request, |
| | ``ov::InferRequest::get_tensor`` | configure input tensors. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Asynchronous Infer | ``ov::InferRequest::start_async``, | Do asynchronous inference with callback. |
| | ``ov::InferRequest::set_callback`` | |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Model Operations | ``ov::CompiledModel::inputs`` | Get inputs of a model. |
+--------------------------+----------------------------------------------+----------------------------------------------+
| Tensor Operations | ``ov::Tensor::get_shape``, | Get a tensor shape and its data. |
| | ``ov::Tensor::data`` | |
+--------------------------+----------------------------------------------+----------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/cpp/benchmark/throughput_benchmark/main.cpp
:language: cpp
How It Works
####################
The sample compiles a model for a given device, randomly generates input data, performs asynchronous inference multiple times for a given number of seconds. Then processes and reports performance results.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Building
####################
To build the sample, please use instructions available at :doc:`Build the Sample Applications <openvino_docs_OV_UG_Samples_Overview>` section in OpenVINO™ Toolkit Samples guide.
Running
####################
.. code-block:: sh
throughput_benchmark <path_to_model> <device_name>(default: CPU)
To run the sample, you need to specify a model:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
.. note::
Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
++++++++++++++++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: sh
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model using:
.. code-block:: sh
omz_downloader --name googlenet-v1
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: sh
omz_converter --name googlenet-v1
4. Perform benchmarking using the ``googlenet-v1`` model on a ``CPU``:
.. code-block:: sh
throughput_benchmark googlenet-v1.xml
Sample Output
####################
The application outputs performance results.
.. code-block:: sh
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 1577 iterations
[ INFO ] Duration: 15024.2 ms
[ INFO ] Latency:
[ INFO ] Median: 38.02 ms
[ INFO ] Average: 38.08 ms
[ INFO ] Min: 25.23 ms
[ INFO ] Max: 49.16 ms
[ INFO ] Throughput: 104.96 FPS
See Also
####################
* :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Model Downloader <omz_tools_downloader>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,7 +1,7 @@
.. {#openvino_docs_get_started_get_started_demos}
Get Started with C++ Samples
============================
Get Started with Samples
========================
.. meta::
@ -9,7 +9,7 @@ Get Started with C++ Samples
toolkit, and how to run inference, using provided code samples.
To use OpenVINO samples, install OpenVINO using one of the following distributions:
To use OpenVINO samples, install OpenVINO using one of the following distributions:
* Archive files (recommended) - :doc:`Linux <openvino_docs_install_guides_installing_openvino_from_archive_linux>` | :doc:`Windows <openvino_docs_install_guides_installing_openvino_from_archive_windows>` | :doc:`macOS <openvino_docs_install_guides_installing_openvino_from_archive_macos>`
* :doc:`APT <openvino_docs_install_guides_installing_openvino_apt>` or :doc:`YUM <openvino_docs_install_guides_installing_openvino_yum>` for Linux
@ -32,7 +32,7 @@ Before you build samples, refer to the :doc:`system requirements <system_require
3. :ref:`Download a suitable model <download-model>`.
4. :ref:`Download media files used as input, if necessary <download-media>`.
Once you perform all the steps, you can :ref:`run inference with the chosen sample application <run-inference>` to see the results.
Once you perform all the steps, you can :ref:`run inference with the chosen sample application <run-inference>` to see the results.
.. _build-samples:
@ -43,7 +43,7 @@ Select a sample you want to use from the :doc:`OpenVINO Samples <openvino_docs_O
.. note::
Some samples may also require `OpenCV <https://github.com/opencv/opencv/wiki/BuildOpenCV4OpenVINO>`__ to run properly. Make sure to install it for use with vision-oriented samples.
Some samples may also require `OpenCV <https://github.com/opencv/opencv/wiki/BuildOpenCV4OpenVINO>`__ to run properly. Make sure to install it for use with vision-oriented samples.
Instructions below show how to build sample applications with CMake. If you are interested in building them from source, check the `build instructions on GitHub <https://github.com/openvinotoolkit/openvino/blob/master/docs/dev/build.md>`__ .
@ -57,58 +57,63 @@ Instructions below show how to build sample applications with CMake. If you are
.. tab-item:: Python
:sync: python
Python samples do not require building. You can run the code samples in your development environment.
Each Python sample directory contains the ``requirements.txt`` file, which you must install before running the sample:
.. code-block:: sh
cd <INSTALL_DIR>/samples/python/<SAMPLE_DIR>
python3 -m pip install -r ./requirements.txt
.. tab-item:: C and C++
:sync: cpp
To build the C or C++ sample applications for Linux, go to the ``<INSTALL_DIR>/samples/c`` or ``<INSTALL_DIR>/samples/cpp`` directory, respectively, and run the ``build_samples.sh`` script:
.. code-block:: sh
build_samples.sh
Once the build is completed, you can find sample binaries in the following folders:
* C samples: ``~/openvino_c_samples_build/<architecture>/Release``
* C++ samples: ``~/openvino_cpp_samples_build/<architecture>/Release`` where the <architecture> is the output of ``uname -m``, for example, ``intel64``, ``armhf``, or ``aarch64``.
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``:
.. code-block:: sh
mkdir build
.. note::
.. note::
If you ran the Image Classification verification script during the installation, the C++ samples build directory is created in your home directory: ``~/openvino_cpp_samples_build/``
2. Go to the created directory:
.. code-block:: sh
cd build
3. Run CMake to generate the Make files for release configuration. For example, for C++ samples:
.. code-block:: sh
cmake -DCMAKE_BUILD_TYPE=Release <INSTALL_DIR>/samples/cpp
4. Run ``make`` to build the samples:
.. code-block:: sh
cmake -DCMAKE_BUILD_TYPE=Release <INSTALL_DIR>/samples/cpp
4. Run ``make`` to build the samples:
.. code-block:: sh
cmake --build . --parallel
For the release configuration, the sample application binaries are in ``<path_to_build_directory>/<architecture>/Release/``;
for the debug configuration — in ``<path_to_build_directory>/<architecture>/Debug/``.
@ -119,29 +124,34 @@ Instructions below show how to build sample applications with CMake. If you are
.. tab-item:: Python
:sync: python
Python samples do not require building. You can run the code samples in your development environment.
Each Python sample directory contains the ``requirements.txt`` file, which you must install before running the sample:
.. code-block:: sh
cd <INSTALL_DIR>\samples\python\<SAMPLE_DIR>
python -m pip install -r requirements.txt
.. tab-item:: C and C++
:sync: c-cpp
.. note::
If you want to use Microsoft Visual Studio 2019, you are required to install CMake 3.14 or higher.
To build the C or C++ sample applications on Windows, go to the ``<INSTALL_DIR>\samples\c`` or ``<INSTALL_DIR>\samples\cpp`` directory, respectively, and run the ``build_samples_msvc.bat`` batch file:
.. code-block:: 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
Once the build is completed, you can find sample binaries in the following folders:
* C samples: ``C:\Users\<user>\Documents\Intel\OpenVINO\openvino_c_samples_build\<architecture>\Release``
* C++ samples: ``C:\Users\<user>\Documents\Intel\OpenVINO\openvino_cpp_samples_build\<architecture>\Release`` where the <architecture> is the output of ``echo PROCESSOR_ARCHITECTURE%``, for example, ``intel64`` (AMD64), or ``arm64``.
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\openvino_cpp_samples_build\Samples.sln`` directory.
.. tab-item:: macOS
@ -151,69 +161,74 @@ Instructions below show how to build sample applications with CMake. If you are
.. tab-item:: Python
:sync: python
Python samples do not require building. You can run the code samples in your development environment.
Each Python sample directory contains the ``requirements.txt`` file, which you must install before running the sample:
.. code-block:: sh
cd <INSTALL_DIR>/samples/python/<SAMPLE_DIR>
python3 -m pip install -r ./requirements.txt
.. tab-item:: C and C++
:sync: cpp
.. note::
.. note::
For building samples from the open-source version of OpenVINO toolkit, see the `build instructions on GitHub <https://github.com/openvinotoolkit/openvino/blob/master/docs/dev/build.md>`__ .
To build the C or C++ sample applications for macOS, go to the ``<INSTALL_DIR>/samples/c`` or ``<INSTALL_DIR>/samples/cpp`` directory, respectively, and run the ``build_samples.sh`` script:
.. code-block:: sh
build_samples.sh
Once the build is completed, you can find sample binaries in the following folders:
* C samples: ``~/openvino_c_samples_build/<architecture>/Release``
* C++ samples: ``~/openvino_cpp_samples_build/<architecture>/Release``
You can also build the sample applications manually. Before proceeding, make sure you have OpenVINO™ environment set correctly. This can be done manually by:
.. code-block:: sh
cd <INSTALL_DIR>/
source setupvars.sh
.. 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``:
.. code-block:: sh
mkdir build
.. note::
.. note::
If you ran the Image Classification verification script during the installation, the C++ samples build directory was already created in your home directory: ``~/openvino_cpp_samples_build/``
2. Go to the created directory:
.. code-block:: sh
cd build
3. Run CMake to generate the Make files for release configuration. For example, for C++ samples:
.. code-block:: sh
cmake -DCMAKE_BUILD_TYPE=Release <INSTALL_DIR>/samples/cpp
4. Run ``make`` to build the samples:
.. code-block:: sh
make
For the release configuration, the sample application binaries are in ``<path_to_build_directory>/<architecture>/Release/``; for the debug configuration — in ``<path_to_build_directory>/<architecture>/Debug/``.
.. _select-sample:
@ -227,7 +242,7 @@ First, select a sample from the :doc:`Sample Overview <openvino_docs_OV_UG_Sampl
Download the Models
--------------------
You need a model that is specific for your inference task. You can get it from one of model repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
You need a model that is specific for your inference task. You can get it from one of model repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
Convert the Model
@ -309,57 +324,57 @@ To run the code sample with an input image using the IR model:
.. tab-set::
.. tab-item:: Python
:sync: python
.. tab-set::
.. tab-item:: Linux
:sync: linux
.. code-block:: sh
python <sample.py file> -m <path_to_model> -i <path_to_media> -d <target_device>
.. tab-item:: Windows
:sync: windows
.. code-block:: bat
python <sample.py file> -m <path_to_model> -i <path_to_media> -d <target_device>
.. tab-item:: macOS
:sync: macos
.. code-block:: sh
python <sample.py file> -m <path_to_model> -i <path_to_media> -d <target_device>
.. tab-item:: C++
:sync: cpp
.. tab-set::
.. tab-item:: Linux
:sync: linux
.. code-block:: sh
<sample.exe file> -i <path_to_media> -m <path_to_model> -d <target_device>
.. tab-item:: Windows
:sync: windows
.. code-block:: bat
<sample.exe file> -i <path_to_media> -m <path_to_model> -d <target_device>
.. tab-item:: macOS
:sync: macos
.. code-block:: sh
<sample.exe file> -i <path_to_media> -m <path_to_model> -d <target_device>
@ -373,7 +388,7 @@ The following command shows how to run the Image Classification Code Sample usin
.. note::
* Running inference on Intel® Processor Graphics (GPU) requires :doc:`additional hardware configuration steps <openvino_docs_install_guides_configurations_for_intel_gpu>`, as described earlier on this page.
* Running inference on Intel® Processor Graphics (GPU) requires :doc:`additional hardware configuration steps <openvino_docs_install_guides_configurations_for_intel_gpu>`, as described earlier on this page.
* Running on GPU is not compatible with macOS.
.. tab-set::
@ -382,52 +397,52 @@ The following command shows how to run the Image Classification Code Sample usin
:sync: python
.. tab-set::
.. tab-item:: Linux
:sync: linux
.. code-block:: sh
python classification_sample_async.py -m ~/ir/googlenet-v1.xml -i ~/Downloads/dog.bmp -d CPU
.. tab-item:: Windows
:sync: windows
.. code-block:: bat
python classification_sample_async.py -m %USERPROFILE%\Documents\ir\googlenet-v1.xml -i %USERPROFILE%\Downloads\dog.bmp -d CPU
.. tab-item:: macOS
:sync: macos
.. code-block:: sh
python classification_sample_async.py -m ~/ir/googlenet-v1.xml -i ~/Downloads/dog.bmp -d CPU
.. tab-item:: C++
:sync: cpp
.. tab-set::
.. tab-item:: Linux
:sync: linux
.. code-block:: sh
./classification_sample_async -i ~/Downloads/dog.bmp -m ~/ir/googlenet-v1.xml -d CPU
.. tab-item:: Windows
:sync: windows
.. code-block:: bat
.\classification_sample_async.exe -i %USERPROFILE%\Downloads\dog.bmp -m %USERPROFILE%\Documents\ir\googlenet-v1.xml -d CPU
.. tab-item:: macOS
:sync: macos
.. code-block:: sh
./classification_sample_async -i ~/Downloads/dog.bmp -m ~/ir/googlenet-v1.xml -d CPU
@ -458,5 +473,5 @@ When the sample application is complete, you are given the label and confidence
Other Samples
================================
Articles in this section describe all sample applications provided with OpenVINO. They will give you more information on how each of them works, giving you a convenient starting point for your own application.
Articles in this section describe all sample applications provided with OpenVINO. They will give you more information on how each of them works, giving you a convenient starting point for your own application.

View File

@ -0,0 +1,267 @@
.. {#openvino_sample_hello_classification}
Hello Classification Sample
===========================
.. meta::
:description: Learn how to do inference of image classification
models using Synchronous Inference Request API (Python, C++, C).
This sample demonstrates how to do inference of image classification models using
Synchronous Inference Request API. Before using the sample, refer to the following requirements:
- Models with only one input and output are supported.
- The sample accepts any file format supported by ``core.read_model``.
- The sample has been validated with: :doc:`alexnet <omz_models_model_alexnet>`,
:doc:`googlenet-v1 <omz_models_model_googlenet_v1>` models.
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
At startup, the sample application reads command-line parameters, prepares input data,
loads a specified model and image to the OpenVINO™ Runtime plugin, performs synchronous
inference, and processes output data, logging each step in a standard output stream.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/hello_classification/hello_classification.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/hello_classification/main.cpp
:language: cpp
.. tab-item:: C
:sync: c
.. scrollbox::
.. doxygensnippet:: samples/c/hello_classification/main.c
:language: c
You can see the explicit description of each sample step at
:doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python hello_classification.py <path_to_model> <path_to_image> <device_name>
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_classification <path_to_model> <path_to_image> <device_name>
.. tab-item:: C
:sync: c
.. code-block:: console
hello_classification_c <path_to_model> <path_to_image> <device_name>
To run the sample, you need to specify a model and an image:
- You can get a model specific for your inference task from one of model
repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
- You can use images from the media files collection available at
`the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and demos expect input with BGR
channels order. If you trained your model to work with RGB order, you need
to manually rearrange the default channels order in the sample or demo
application or reconvert your model using model conversion API with
``reverse_input_channels`` argument specified. For more information about
the argument, refer to **When to Reverse Input Channels** section of
:doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is
converted to the intermediate representation (IR) format (\*.xml + \*.bin)
using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
++++++++++++++++++++
1. Download a pre-trained model.
2. You can convert it by using:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: python
import openvino as ov
ov_model = ov.convert_model('./models/alexnet')
# or, when model is a Python model object
ov_model = ov.convert_model(alexnet)
.. tab-item:: CLI
:sync: cli
.. code-block:: console
ovc ./models/alexnet
3. Perform inference of an image, using a model on a ``GPU``, for example:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python hello_classification.py ./models/alexnet/alexnet.xml ./images/banana.jpg GPU
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_classification ./models/googlenet-v1.xml ./images/car.bmp GPU
.. tab-item:: C
:sync: c
.. code-block:: console
hello_classification_c alexnet.xml ./opt/intel/openvino/samples/scripts/car.png GPU
Sample Output
#############
.. tab-set::
.. tab-item:: Python
:sync: python
The sample application logs each step in a standard output stream and
outputs top-10 inference results.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: /models/alexnet/alexnet.xml
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Image path: /images/banana.jpg
[ INFO ] Top 10 results:
[ INFO ] class_id probability
[ INFO ] --------------------
[ INFO ] 954 0.9703885
[ INFO ] 666 0.0219518
[ INFO ] 659 0.0033120
[ INFO ] 435 0.0008246
[ INFO ] 809 0.0004433
[ INFO ] 502 0.0003852
[ INFO ] 618 0.0002906
[ INFO ] 910 0.0002848
[ INFO ] 951 0.0002427
[ INFO ] 961 0.0002213
[ INFO ]
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
.. tab-item:: C++
:sync: cpp
The application outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Loading model files: /models/googlenet-v1.xml
[ INFO ] model name: GoogleNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 224, 224}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
Top 10 results:
Image /images/car.bmp
classid probability
------- -----------
656 0.8139648
654 0.0550537
468 0.0178375
436 0.0165405
705 0.0111694
817 0.0105820
581 0.0086823
575 0.0077515
734 0.0064468
785 0.0043983
.. tab-item:: C
:sync: c
The application outputs top-10 inference results.
.. code-block:: console
Top 10 results:
Image /opt/intel/openvino/samples/scripts/car.png
classid probability
------- -----------
656 0.666479
654 0.112940
581 0.068487
874 0.033385
436 0.026132
817 0.016731
675 0.010980
511 0.010592
569 0.008178
717 0.006336
This sample is an API example, for any performance measurements use the dedicated benchmark_app tool.
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- :doc:`C API Reference <pot_compression_api_README>`
- `Hello Classification Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/hello_classification/README.md>`__
- `Hello Classification C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/hello_classification/README.md>`__
- `Hello Classification C Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/c/hello_classification/README.md>`__

View File

@ -0,0 +1,218 @@
.. {#openvino_sample_hello_nv12_input_classification}
Hello NV12 Input Classification Sample
======================================
.. meta::
:description: Learn how to do inference of image
classification models with images in NV12 color format using
Synchronous Inference Request (C++) API.
This sample demonstrates how to execute an inference of image classification models
with images in NV12 color format using Synchronous Inference Request API. Before
using the sample, refer to the following requirements:
- The sample accepts any file format supported by ``ov::Core::read_model``.
- The sample has been validated with: :doc:`alexnet <omz_models_model_alexnet>` model and
uncompressed images in the NV12 color format - \*.yuv
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
At startup, the sample application reads command line parameters, loads the
specified model and an image in the NV12 color format to an OpenVINO™ Runtime
plugin. Then, the sample creates an synchronous inference request object. When
inference is done, the application outputs data to the standard output stream.
You can place labels in ``.labels`` file near the model to get pretty output.
.. tab-set::
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/hello_nv12_input_classification/main.cpp
:language: cpp
.. tab-item:: C
:sync: c
.. scrollbox::
.. doxygensnippet:: samples/c/hello_nv12_input_classification/main.c
:language: c
You can see the explicit description of each sample step at
:doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. tab-set::
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_nv12_input_classification <path_to_model> <path_to_image> <image_size> <device_name>
.. tab-item:: C
:sync: c
.. code-block:: console
hello_nv12_input_classification_c <path_to_model> <path_to_image> <device_name>
To run the sample, you need to specify a model and an image:
- You can get a model specific for your inference task from one of model
repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
- You can use images from the media files collection available at
`the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
The sample accepts an uncompressed image in the NV12 color format. To run the
sample, you need to convert your BGR/RGB image to NV12. To do this, you can use
one of the widely available tools such as FFmpeg or GStreamer. Using FFmpeg and
the following command, you can convert an ordinary image to an uncompressed NV12 image:
.. code-block:: sh
ffmpeg -i cat.jpg -pix_fmt nv12 cat.yuv
.. note::
- Because the sample reads raw image files, you should provide a correct image
size along with the image path. The sample expects the logical size of the
image, not the buffer size. For example, for 640x480 BGR/RGB image the
corresponding NV12 logical image size is also 640x480, whereas the buffer
size is 640x720.
- By default, this sample expects that model input has BGR channels order. If
you trained your model to work with RGB order, you need to reconvert your
model using model conversion API with ``reverse_input_channels`` argument
specified. For more information about the argument, refer to **When to Reverse
Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is
converted to the intermediate representation (IR) format (\*.xml + \*.bin)
using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
+++++++
1. Download a pre-trained model.
2. You can convert it by using:
.. code-block:: console
ovc ./models/alexnet
3. Perform inference of an NV12 image, using a model on a ``CPU``, for example:
.. tab-set::
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_nv12_input_classification ./models/alexnet.xml ./images/cat.yuv 300x300 CPU
.. tab-item:: C
:sync: c
.. code-block:: console
hello_nv12_input_classification_c ./models/alexnet.xml ./images/cat.yuv 300x300 CPU
Sample Output
#############
.. tab-set::
.. tab-item:: C++
:sync: cpp
The application outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Loading model files: \models\alexnet.xml
[ INFO ] model name: AlexNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 227, 227}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
Top 10 results:
Image \images\car.yuv
classid probability
------- -----------
656 0.6668988
654 0.1125269
581 0.0679280
874 0.0340229
436 0.0257744
817 0.0169367
675 0.0110199
511 0.0106134
569 0.0083373
717 0.0061734
.. tab-item:: C
:sync: c
The application outputs top-10 inference results.
.. code-block:: console
Top 10 results:
Image ./cat.yuv
classid probability
------- -----------
435 0.091733
876 0.081725
999 0.069305
587 0.043726
666 0.038957
419 0.032892
285 0.030309
700 0.029941
696 0.021628
855 0.020339
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `API Reference <https://docs.openvino.ai/2023.2/api/api_reference.html>`__
- `Hello NV12 Input Classification C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/hello_nv12_input_classification/README.md>`__
- `Hello NV12 Input Classification C Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/c/hello_nv12_input_classification/README.md>`__

View File

@ -0,0 +1,191 @@
.. {#openvino_sample_hello_query_device}
Hello Query Device Sample
=========================
.. meta::
:description: Learn how to show metrics and default
configuration values of inference devices using Query
Device API feature (Python, C++).
This sample demonstrates how to show OpenVINO™ Runtime devices and prints their
metrics and default configuration values using :doc:`Query Device API feature <openvino_docs_OV_UG_query_api>`.
To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
The sample queries all available OpenVINO™ Runtime devices and prints their
supported metrics and plugin configuration parameters.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/hello_query_device/hello_query_device.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/hello_query_device/main.cpp
:language: cpp
Running
####################
The sample has no command-line parameters. To see the report, run the following command:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python hello_query_device.py
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_query_device
Sample Output
####################
The application prints all available devices with their supported metrics and
default values for configuration parameters.
For example:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
[ INFO ] Available devices:
[ INFO ] CPU :
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES:
[ INFO ] FULL_DEVICE_NAME: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
[ INFO ] OPTIMIZATION_CAPABILITIES: FP32, FP16, INT8, BIN
[ INFO ] RANGE_FOR_ASYNC_INFER_REQUESTS: 1, 1, 1
[ INFO ] RANGE_FOR_STREAMS: 1, 8
[ INFO ] IMPORT_EXPORT_SUPPORT: True
[ INFO ]
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] CACHE_DIR:
[ INFO ] CPU_BIND_THREAD: NO
[ INFO ] CPU_THREADS_NUM: 0
[ INFO ] CPU_THROUGHPUT_STREAMS: 1
[ INFO ] DUMP_EXEC_GRAPH_AS_DOT:
[ INFO ] ENFORCE_BF16: NO
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS: NO
[ INFO ] PERFORMANCE_HINT:
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[ INFO ] PERF_COUNT: NO
[ INFO ]
[ INFO ] GNA :
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES: GNA_SW
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 1
[ INFO ] FULL_DEVICE_NAME: GNA_SW
[ INFO ] GNA_LIBRARY_FULL_VERSION: 3.0.0.1455
[ INFO ] IMPORT_EXPORT_SUPPORT: True
[ INFO ]
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS: NO
[ INFO ] GNA_COMPACT_MODE: YES
[ INFO ] GNA_COMPILE_TARGET:
[ INFO ] GNA_DEVICE_MODE: GNA_SW_EXACT
[ INFO ] GNA_EXEC_TARGET:
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE:
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE_GENERATION:
[ INFO ] GNA_LIB_N_THREADS: 1
[ INFO ] GNA_PRECISION: I16
[ INFO ] GNA_PWL_MAX_ERROR_PERCENT: 1.000000
[ INFO ] GNA_PWL_UNIFORM_DESIGN: NO
[ INFO ] GNA_SCALE_FACTOR: 1.000000
[ INFO ] GNA_SCALE_FACTOR_0: 1.000000
[ INFO ] LOG_LEVEL: LOG_NONE
[ INFO ] PERF_COUNT: NO
[ INFO ] SINGLE_THREAD: YES
.. tab-item:: C++
:sync: cpp
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Available devices:
[ INFO ] CPU
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES : [ ]
[ INFO ] FULL_DEVICE_NAME : Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
[ INFO ] OPTIMIZATION_CAPABILITIES : [ FP32 FP16 INT8 BIN ]
[ INFO ] RANGE_FOR_ASYNC_INFER_REQUESTS : { 1, 1, 1 }
[ INFO ] RANGE_FOR_STREAMS : { 1, 8 }
[ INFO ] IMPORT_EXPORT_SUPPORT : true
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] CACHE_DIR : ""
[ INFO ] CPU_BIND_THREAD : NO
[ INFO ] CPU_THREADS_NUM : 0
[ INFO ] CPU_THROUGHPUT_STREAMS : 1
[ INFO ] DUMP_EXEC_GRAPH_AS_DOT : ""
[ INFO ] ENFORCE_BF16 : NO
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS : NO
[ INFO ] PERFORMANCE_HINT : ""
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS : 0
[ INFO ] PERF_COUNT : NO
[ INFO ]
[ INFO ] GNA
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES : [ GNA_SW_EXACT ]
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS : 1
[ INFO ] FULL_DEVICE_NAME : GNA_SW_EXACT
[ INFO ] GNA_LIBRARY_FULL_VERSION : 3.0.0.1455
[ INFO ] IMPORT_EXPORT_SUPPORT : true
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS : NO
[ INFO ] GNA_COMPACT_MODE : YES
[ INFO ] GNA_COMPILE_TARGET : ""
[ INFO ] GNA_DEVICE_MODE : GNA_SW_EXACT
[ INFO ] GNA_EXEC_TARGET : ""
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE : ""
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE_GENERATION : ""
[ INFO ] GNA_LIB_N_THREADS : 1
[ INFO ] GNA_PRECISION : I16
[ INFO ] GNA_PWL_MAX_ERROR_PERCENT : 1.000000
[ INFO ] GNA_PWL_UNIFORM_DESIGN : NO
[ INFO ] GNA_SCALE_FACTOR : 1.000000
[ INFO ] GNA_SCALE_FACTOR_0 : 1.000000
[ INFO ] LOG_LEVEL : LOG_NONE
[ INFO ] PERF_COUNT : NO
[ INFO ] SINGLE_THREAD : YES
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- `Hello Query Device Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/hello_query_device/README.md>`__
- `Hello Query Device C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/hello_query_device/README.md>`__

View File

@ -0,0 +1,213 @@
.. {#openvino_sample_hello_reshape_ssd}
Hello Reshape SSD Sample
========================
.. meta::
:description: Learn how to do inference of object detection
models using shape inference feature and Synchronous
Inference Request API (Python, C++).
This sample demonstrates how to do synchronous inference of object detection models
using :doc:`Shape Inference feature <openvino_docs_OV_UG_ShapeInference>`. Before
using the sample, refer to the following requirements:
- Models with only one input and output are supported.
- The sample accepts any file format supported by ``core.read_model``.
- The sample has been validated with: :doc:`mobilenet-ssd <omz_models_model_mobilenet_ssd>`,
:doc:`person-detection-retail-0013 <omz_models_model_person_detection_retail_0013>`
models and the NCHW layout format.
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
At startup, the sample application reads command-line parameters, prepares input data, loads a specified model and image to the OpenVINO™ Runtime plugin, performs synchronous inference, and processes output data.
As a result, the program creates an output image, logging each step in a standard output stream.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/hello_reshape_ssd/hello_reshape_ssd.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/hello_reshape_ssd/main.cpp
:language: cpp
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python hello_reshape_ssd.py <path_to_model> <path_to_image> <device_name>
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_reshape_ssd <path_to_model> <path_to_image> <device_name>
To run the sample, you need to specify a model and an image:
- You can get a model specific for your inference task from one of model
repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
- You can use images from the media files collection available at
`the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and demos expect input with BGR channels
order. If you trained your model to work with RGB order, you need to manually
rearrange the default channels order in the sample or demo application or
reconvert your model using model conversion API with ``reverse_input_channels``
argument specified. For more information about the argument, refer to
**When to Reverse Input Channels** section of
:doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is
converted to the intermediate representation (IR) format (\*.xml + \*.bin)
using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
++++++++++++++++++++
1. Download a pre-trained model:
2. You can convert it by using:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: python
import openvino as ov
ov_model = ov.convert_model('./test_data/models/mobilenet-ssd')
# or, when model is a Python model object
ov_model = ov.convert_model(mobilenet-ssd)
.. tab-item:: CLI
:sync: cli
.. code-block:: console
ovc ./test_data/models/mobilenet-ssd
4. Perform inference of an image, using a model on a ``GPU``, for example:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python hello_reshape_ssd.py ./test_data/models/mobilenet-ssd.xml banana.jpg GPU
.. tab-item:: C++
:sync: cpp
.. code-block:: console
hello_reshape_ssd ./models/person-detection-retail-0013.xml person_detection.bmp GPU
Sample Output
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The sample application logs each step in a standard output stream and
creates an output image, drawing bounding boxes for inference results
with an over 50% confidence.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: C:/test_data/models/mobilenet-ssd.xml
[ INFO ] Reshaping the model to the height and width of the input image
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Found: class_id = 52, confidence = 0.98, coords = (21, 98), (276, 210)
[ INFO ] Image out.bmp was created!
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
.. tab-item:: C++
:sync: cpp
The application renders an image with detected objects enclosed in rectangles.
It outputs the list of classes of the detected objects along with the
respective confidence values and the coordinates of the rectangles to the
standard output stream.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Loading model files: \models\person-detection-retail-0013.xml
[ INFO ] model name: ResMobNet_v4 (LReLU) with single SSD head
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 320, 544}
[ INFO ] outputs
[ INFO ] output name: detection_out
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1, 200, 7}
Reshape network to the image size = [960x1699]
[ INFO ] model name: ResMobNet_v4 (LReLU) with single SSD head
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 960, 1699}
[ INFO ] outputs
[ INFO ] output name: detection_out
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1, 200, 7}
[0,1] element, prob = 0.716309, (852,187)-(983,520)
The resulting image was saved in the file: hello_reshape_ssd_output.bmp
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `Hello Reshape SSD Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/hello_reshape_ssd/README.md>`__
- `Hello Reshape SSD C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/hello_reshape_ssd/README.md>`__

View File

@ -0,0 +1,334 @@
.. {#openvino_sample_image_classification_async}
Image Classification Async Sample
=================================
.. meta::
:description: Learn how to do inference of image classification models
using Asynchronous Inference Request API (Python, C++).
This sample demonstrates how to do inference of image classification models
using Asynchronous Inference Request API. Before using the sample, refer to the
following requirements:
- Models with only one input and output are supported.
- The sample accepts any file format supported by ``core.read_model``.
- The sample has been validated with: :doc:`alexnet <omz_models_model_alexnet>`, :doc:`googlenet-v1 <omz_models_model_googlenet_v1>` models.
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
At startup, the sample application reads command-line parameters, prepares input data, and
loads a specified model and an image to the OpenVINO™ Runtime plugin.
The batch size of the model is set according to the number of read images. The
batch mode is an independent attribute on the asynchronous mode.
The asynchronous mode works efficiently with any batch size.
Then, the sample creates an inference request object and assigns completion callback
for it. In scope of the completion callback handling, the inference request is executed again.
After that, the application starts inference for the first infer request and waits
until 10th inference request execution has been completed.
The asynchronous mode might increase the throughput of the pictures.
When inference is done, the application outputs data to the standard output stream.
You can place labels in ``.labels`` file near the model to get pretty output.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/classification_sample_async/classification_sample_async.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/classification_sample_async/main.cpp
:language: cpp
You can see the explicit description of each sample step at
:doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
Run the application with the ``-h`` option to see the usage message:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python classification_sample_async.py -h
Usage message:
.. code-block:: console
usage: classification_sample_async.py [-h] -m MODEL -i INPUT [INPUT ...]
[-d DEVICE]
Options:
-h, --help Show this help message and exit.
-m MODEL, --model MODEL
Required. Path to an .xml or .onnx file with a trained
model.
-i INPUT [INPUT ...], --input INPUT [INPUT ...]
Required. Path to an image file(s).
-d DEVICE, --device DEVICE
Optional. Specify the target device to infer on; CPU,
GPU or HETERO: is acceptable. The sample
will look for a suitable plugin for device specified.
Default value is CPU.
.. tab-item:: C++
:sync: cpp
.. code-block:: console
classification_sample_async -h
Usage instructions:
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
classification_sample_async [OPTION]
Options:
-h Print usage instructions.
-m "<path>" Required. Path to an .xml file with a trained model.
-i "<path>" Required. Path to a folder with images or path to image files: a .ubyte file for LeNet and a .bmp file for other models.
-d "<device>" Optional. Specify the target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma_separated_devices_list>" format to specify the HETERO plugin. Sample will look for a suitable plugin for the device specified.
Available target devices: <devices>
To run the sample, you need to specify a model and an image:
- You can get a model specific for your inference task from one of model
repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
- You can use images from the media files collection available at
`the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using model conversion API with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
- The sample supports NCHW model layout only.
- When you specify single options multiple times, only the last value will be used. For example, the ``-m`` flag:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python classification_sample_async.py -m model.xml -m model2.xml
.. tab-item:: C++
:sync: cpp
.. code-block:: console
./classification_sample_async -m model.xml -m model2.xml
Example
++++++++++++++++++++
1. Download a pre-trained model:
2. You can convert it by using:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: python
import openvino as ov
ov_model = ov.convert_model('./models/alexnet')
# or, when model is a Python model object
ov_model = ov.convert_model(alexnet)
.. tab-item:: CLI
:sync: cli
.. code-block:: console
ovc ./models/alexnet
4. Perform inference of image files, using a model on a ``GPU``, for example:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python classification_sample_async.py -m ./models/alexnet.xml -i ./test_data/images/banana.jpg ./test_data/images/car.bmp -d GPU
.. tab-item:: C++
:sync: cpp
.. code-block:: console
classification_sample_async -m ./models/googlenet-v1.xml -i ./images/dog.bmp -d GPU
Sample Output
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The sample application logs each step in a standard output stream and
outputs top-10 inference results.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: C:/test_data/models/alexnet.xml
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in asynchronous mode
[ INFO ] Image path: /test_data/images/banana.jpg
[ INFO ] Top 10 results:
[ INFO ] class_id probability
[ INFO ] --------------------
[ INFO ] 954 0.9707602
[ INFO ] 666 0.0216788
[ INFO ] 659 0.0032558
[ INFO ] 435 0.0008082
[ INFO ] 809 0.0004359
[ INFO ] 502 0.0003860
[ INFO ] 618 0.0002867
[ INFO ] 910 0.0002866
[ INFO ] 951 0.0002410
[ INFO ] 961 0.0002193
[ INFO ]
[ INFO ] Image path: /test_data/images/car.bmp
[ INFO ] Top 10 results:
[ INFO ] class_id probability
[ INFO ] --------------------
[ INFO ] 656 0.5120340
[ INFO ] 874 0.1142275
[ INFO ] 654 0.0697167
[ INFO ] 436 0.0615163
[ INFO ] 581 0.0552262
[ INFO ] 705 0.0304179
[ INFO ] 675 0.0151660
[ INFO ] 734 0.0151582
[ INFO ] 627 0.0148493
[ INFO ] 757 0.0120964
[ INFO ]
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
.. tab-item:: C++
:sync: cpp
The sample application logs each step in a standard output stream and
outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] /images/dog.bmp
[ INFO ] Loading model files:
[ INFO ] /models/googlenet-v1.xml
[ INFO ] model name: GoogleNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: f32
[ INFO ] input shape: {1, 3, 224, 224}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
[ INFO ] Read input images
[ INFO ] Set batch size 1
[ INFO ] model name: GoogleNet
[ INFO ] inputs
[ INFO ] input name: data
[ INFO ] input type: u8
[ INFO ] input shape: {1, 224, 224, 3}
[ INFO ] outputs
[ INFO ] output name: prob
[ INFO ] output type: f32
[ INFO ] output shape: {1, 1000}
[ INFO ] Loading model to the device GPU
[ INFO ] Create infer request
[ INFO ] Start inference (asynchronous executions)
[ INFO ] Completed 1 async request execution
[ INFO ] Completed 2 async request execution
[ INFO ] Completed 3 async request execution
[ INFO ] Completed 4 async request execution
[ INFO ] Completed 5 async request execution
[ INFO ] Completed 6 async request execution
[ INFO ] Completed 7 async request execution
[ INFO ] Completed 8 async request execution
[ INFO ] Completed 9 async request execution
[ INFO ] Completed 10 async request execution
[ INFO ] Completed async requests execution
Top 10 results:
Image /images/dog.bmp
classid probability
------- -----------
156 0.8935547
218 0.0608215
215 0.0217133
219 0.0105667
212 0.0018835
217 0.0018730
152 0.0018730
157 0.0015745
154 0.0012817
220 0.0010099
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `Image Classification Async Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/classification_sample_async/README.md>`__
- `Image Classification Async C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/classification_sample_async/README.md>`__

View File

@ -0,0 +1,299 @@
.. {#openvino_sample_model_creation}
Model Creation Sample
=====================
.. meta::
:description: Learn how to create a model on the fly with a
provided weights file and infer it later using Synchronous
Inference Request API (Python, C++).
This sample demonstrates how to run inference using a :doc:`model <openvino_docs_OV_UG_Model_Representation>`
built on the fly that uses weights from the LeNet classification model, which is
known to work well on digit classification tasks. You do not need an XML file,
the model is created from the source code on the fly. Before using the sample,
refer to the following requirements:
- The sample accepts a model weights file (\*.bin).
- The sample has been validated with a LeNet model.
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
At startup, the sample application reads command-line parameters, :doc:`builds a model <openvino_docs_OV_UG_Model_Representation>`
and passes the weights file. Then, it loads the model and input data to the OpenVINO™
Runtime plugin. Finally, it performs synchronous inference and processes output
data, logging each step in a standard output stream.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/model_creation_sample/model_creation_sample.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/model_creation_sample/main.cpp
:language: cpp
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
To run the sample, you need to specify model weights and a device.
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python model_creation_sample.py <path_to_weights_file> <device_name>
.. tab-item:: C++
:sync: cpp
.. code-block:: console
model_creation_sample <path_to_weights_file> <device_name>
.. note::
- This sample supports models with FP32 weights only.
- The ``lenet.bin`` weights file is generated by
:doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
from the public LeNet model, with the ``input_shape [64,1,28,28]`` parameter specified.
- The original model is available in the
`Caffe repository <https://github.com/BVLC/caffe/tree/master/examples/mnist>`__ on GitHub.
Example
++++++++++++++++++++
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python model_creation_sample.py lenet.bin GPU
.. tab-item:: C++
:sync: cpp
.. code-block:: console
model_creation_sample lenet.bin GPU
Sample Output
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The sample application logs each step in a standard output stream and outputs 10 inference results.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Loading the model using ngraph function with weights from lenet.bin
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Top 1 results:
[ INFO ] Image 0
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 0 1.0000000 0
[ INFO ]
[ INFO ] Image 1
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 1 1.0000000 1
[ INFO ]
[ INFO ] Image 2
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 2 1.0000000 2
[ INFO ]
[ INFO ] Image 3
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 3 1.0000000 3
[ INFO ]
[ INFO ] Image 4
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 4 1.0000000 4
[ INFO ]
[ INFO ] Image 5
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 5 1.0000000 5
[ INFO ]
[ INFO ] Image 6
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 6 1.0000000 6
[ INFO ]
[ INFO ] Image 7
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 7 1.0000000 7
[ INFO ]
[ INFO ] Image 8
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 8 1.0000000 8
[ INFO ]
[ INFO ] Image 9
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 9 1.0000000 9
[ INFO ]
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
.. tab-item:: C++
:sync: cpp
The sample application logs each step in a standard output stream and outputs top-10 inference results.
.. code-block:: console
[ INFO ] OpenVINO Runtime version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Intel GPU plugin version ......... <version>
[ INFO ] Build ........... <build>
[ INFO ]
[ INFO ]
[ INFO ] Create model from weights: lenet.bin
[ INFO ] model name: lenet
[ INFO ] inputs
[ INFO ] input name: NONE
[ INFO ] input type: f32
[ INFO ] input shape: {64, 1, 28, 28}
[ INFO ] outputs
[ INFO ] output name: output_tensor
[ INFO ] output type: f32
[ INFO ] output shape: {64, 10}
[ INFO ] Batch size is 10
[ INFO ] model name: lenet
[ INFO ] inputs
[ INFO ] input name: NONE
[ INFO ] input type: u8
[ INFO ] input shape: {10, 28, 28, 1}
[ INFO ] outputs
[ INFO ] output name: output_tensor
[ INFO ] output type: f32
[ INFO ] output shape: {10, 10}
[ INFO ] Compiling a model for the GPU device
[ INFO ] Create infer request
[ INFO ] Combine images in batch and set to input tensor
[ INFO ] Start sync inference
[ INFO ] Processing output tensor
Top 1 results:
Image 0
classid probability label
------- ----------- -----
0 1.0000000 0
Image 1
classid probability label
------- ----------- -----
1 1.0000000 1
Image 2
classid probability label
------- ----------- -----
2 1.0000000 2
Image 3
classid probability label
------- ----------- -----
3 1.0000000 3
Image 4
classid probability label
------- ----------- -----
4 1.0000000 4
Image 5
classid probability label
------- ----------- -----
5 1.0000000 5
Image 6
classid probability label
------- ----------- -----
6 1.0000000 6
Image 7
classid probability label
------- ----------- -----
7 1.0000000 7
Image 8
classid probability label
------- ----------- -----
8 1.0000000 8
Image 9
classid probability label
------- ----------- -----
9 1.0000000 9
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `Model Creation Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/model_creation_sample/README.md>`__
- `Model Creation C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/model_creation_sample/README.md>`__

View File

@ -1,501 +0,0 @@
.. {#openvino_inference_engine_tools_benchmark_tool_README}
Benchmark Python Tool
=====================
.. meta::
:description: Learn how to use the Benchmark Python Tool to
estimate deep learning inference performance on supported
devices.
This page demonstrates how to use the Benchmark Python Tool to estimate deep learning inference performance on supported devices.
.. note::
This page describes usage of the Python implementation of the Benchmark Tool. For the C++ implementation, refer to the :doc:`Benchmark C++ Tool <openvino_inference_engine_samples_benchmark_app_README>` page. The Python version is recommended for benchmarking models that will be used in Python applications, and the C++ version is recommended for benchmarking models that will be used in C++ applications. Both tools have a similar command interface and backend.
Basic Usage
####################
The Python benchmark_app is automatically installed when you install OpenVINO Developer Tools using :doc:`PyPI <openvino_docs_install_guides_installing_openvino_pip>`. Before running ``benchmark_app``, make sure the ``openvino_env`` virtual environment is activated, and navigate to the directory where your model is located.
The benchmarking application works with models in the OpenVINO IR (``model.xml`` and ``model.bin``) and ONNX (``model.onnx``) formats.
Make sure to :doc:`convert your models <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` if necessary.
To run benchmarking with default options on a model, use the following command:
.. code-block:: sh
benchmark_app -m model.xml
By default, the application will load the specified model onto the CPU and perform inferencing on batches of randomly-generated data inputs for 60 seconds. As it loads, it prints information about benchmark parameters. When benchmarking is completed, it reports the minimum, average, and maximum inferencing latency and average the throughput.
You may be able to improve benchmark results beyond the default configuration by configuring some of the execution parameters for your model. For example, you can use "throughput" or "latency" performance hints to optimize the runtime for higher FPS or reduced inferencing time. Read on to learn more about the configuration options available with benchmark_app.
Configuration Options
#####################
The benchmark app provides various options for configuring execution parameters. This section covers key configuration options for easily tuning benchmarking to achieve better performance on your device. A list of all configuration options is given in the :ref:`Advanced Usage <advanced-usage-python-benchmark>` section.
Performance hints: latency and throughput
+++++++++++++++++++++++++++++++++++++++++
The benchmark app allows users to provide high-level "performance hints" for setting latency-focused or throughput-focused inference modes. This hint causes the runtime to automatically adjust runtime parameters, such as the number of processing streams and inference batch size, to prioritize for reduced latency or high throughput.
The performance hints do not require any device-specific settings and they are completely portable between devices. Parameters are automatically configured based on whichever device is being used. This allows users to easily port applications between hardware targets without having to re-determine the best runtime parameters for the new device.
If not specified, throughput is used as the default. To set the hint explicitly, use ``-hint latency`` or ``-hint throughput`` when running benchmark_app:
.. code-block:: sh
benchmark_app -m model.xml -hint latency
benchmark_app -m model.xml -hint throughput
.. note::
It is up to the user to ensure the environment on which the benchmark is running is optimized for maximum performance. Otherwise, different results may occur when using the application in different environment settings (such as power optimization settings, processor overclocking, thermal throttling).
Stating flags that take only single option like `-m` multiple times, for example `benchmark_app -m model.xml -m model2.xml`, results in only the last value being used.
Latency
--------------------
Latency is the amount of time it takes to process a single inference request. In applications where data needs to be inferenced and acted on as quickly as possible (such as autonomous driving), low latency is desirable. For conventional devices, lower latency is achieved by reducing the amount of parallel processing streams so the system can utilize as many resources as possible to quickly calculate each inference request. However, advanced devices like multi-socket CPUs and modern GPUs are capable of running multiple inference requests while delivering the same latency.
When benchmark_app is run with ``-hint latency``, it determines the optimal number of parallel inference requests for minimizing latency while still maximizing the parallelization capabilities of the hardware. It automatically sets the number of processing streams and inference batch size to achieve the best latency.
Throughput
--------------------
Throughput is the amount of data an inferencing pipeline can process at once, and it is usually measured in frames per second (FPS) or inferences per second. In applications where large amounts of data needs to be inferenced simultaneously (such as multi-camera video streams), high throughput is needed. To achieve high throughput, the runtime focuses on fully saturating the device with enough data to process. It utilizes as much memory and as many parallel streams as possible to maximize the amount of data that can be processed simultaneously.
When benchmark_app is run with ``-hint throughput``, it maximizes the number of parallel inference requests to utilize all the threads available on the device. On GPU, it automatically sets the inference batch size to fill up the GPU memory available.
For more information on performance hints, see the :doc:`High-level Performance Hints <openvino_docs_OV_UG_Performance_Hints>` page. For more details on optimal runtime configurations and how they are automatically determined using performance hints, see :doc:`Runtime Inference Optimizations <openvino_docs_deployment_optimization_guide_dldt_optimization_guide>`.
Device
++++++++++++++++++++
To set which device benchmarking runs on, use the ``-d <device>`` argument. This will tell benchmark_app to run benchmarking on that specific device. The benchmark app supports "CPU", "GPU", and GNA devices. In order to use the GPU, the system must have the appropriate drivers installed. If no device is specified, benchmark_app will default to using CPU.
For example, to run benchmarking on GPU, use:
.. code-block:: sh
benchmark_app -m model.xml -d GPU
You may also specify "AUTO" as the device, in which case the benchmark_app will automatically select the best device for benchmarking and support it with the CPU at the model loading stage. This may result in increased performance, thus, should be used purposefully. For more information, see the :doc:`Automatic device selection <openvino_docs_OV_UG_supported_plugins_AUTO>` page.
(Note: If the latency or throughput hint is set, it will automatically configure streams and batch sizes for optimal performance based on the specified device.)
Number of iterations
++++++++++++++++++++
By default, the benchmarking app will run for a predefined duration, repeatedly performing inferencing with the model and measuring the resulting inference speed. There are several options for setting the number of inference iterations:
* Explicitly specify the number of iterations the model runs using the ``-niter <number_of_iterations>`` option
* Set how much time the app runs for using the ``-t <seconds>`` option
* Set both of them (execution will continue until both conditions are met)
* If neither -niter nor -t are specified, the app will run for a predefined duration that depends on the device
The more iterations a model runs, the better the statistics will be for determining average latency and throughput.
Inputs
++++++++++++++++++++
The benchmark tool runs benchmarking on user-provided input images in ``.jpg``, ``.bmp``, or ``.png`` format. Use ``-i <PATH_TO_INPUT>`` to specify the path to an image, or folder of images. For example, to run benchmarking on an image named ``test1.jpg``, use:
.. code-block:: sh
./benchmark_app -m model.xml -i test1.jpg
The tool will repeatedly loop through the provided inputs and run inferencing on them for the specified amount of time or number of iterations. If the ``-i`` flag is not used, the tool will automatically generate random data to fit the input shape of the model.
Examples
++++++++++++++++++++
For more usage examples (and step-by-step instructions on how to set up a model for benchmarking), see the :ref:`Examples of Running the Tool <examples-of-running-the-tool-python>` section.
.. _advanced-usage-python-benchmark:
Advanced Usage
####################
.. note::
By default, OpenVINO samples, tools and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channel order in the sample or demo application or reconvert your model using Model Conversion API with ``reverse_input_channels`` argument specified. For more information about the argument, refer to When to Reverse Input Channels section of Converting a Model to Intermediate Representation (IR).
Per-layer performance and logging
+++++++++++++++++++++++++++++++++
The application also collects per-layer Performance Measurement (PM) counters for each executed infer request if you enable statistics dumping by setting the ``-report_type`` parameter to one of the possible values:
* ``no_counters`` report includes configuration options specified, resulting FPS and latency.
* ``average_counters`` report extends the ``no_counters`` report and additionally includes average PM counters values for each layer from the network.
* ``detailed_counters`` report extends the ``average_counters`` report and additionally includes per-layer PM counters and latency for each executed infer request.
Depending on the type, the report is stored to ``benchmark_no_counters_report.csv``, ``benchmark_average_counters_report.csv``, or ``benchmark_detailed_counters_report.csv`` file located in the path specified in ``-report_folder``. The application also saves executable graph information serialized to an XML file if you specify a path to it with the ``-exec_graph_path`` parameter.
.. _all-configuration-options-python-benchmark:
All configuration options
+++++++++++++++++++++++++
Running the application with the ``-h`` or ``--help`` option yields the following usage message:
.. scrollbox::
.. code-block:: sh
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
usage: benchmark_app.py [-h [HELP]] [-i PATHS_TO_INPUT [PATHS_TO_INPUT ...]] -m PATH_TO_MODEL [-d TARGET_DEVICE]
[-hint {throughput,cumulative_throughput,latency,none}] [-niter NUMBER_ITERATIONS] [-t TIME] [-b BATCH_SIZE] [-shape SHAPE]
[-data_shape DATA_SHAPE] [-layout LAYOUT] [-extensions EXTENSIONS] [-c PATH_TO_CLDNN_CONFIG] [-cdir CACHE_DIR] [-lfile [LOAD_FROM_FILE]]
[-api {sync,async}] [-nireq NUMBER_INFER_REQUESTS] [-nstreams NUMBER_STREAMS] [-inference_only [INFERENCE_ONLY]]
[-infer_precision INFER_PRECISION] [-ip {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}]
[-op {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}] [-iop INPUT_OUTPUT_PRECISION] [--mean_values [R,G,B]] [--scale_values [R,G,B]]
[-nthreads NUMBER_THREADS] [-pin {YES,NO,NUMA,HYBRID_AWARE}] [-latency_percentile LATENCY_PERCENTILE]
[-report_type {no_counters,average_counters,detailed_counters}] [-report_folder REPORT_FOLDER] [-pc [PERF_COUNTS]]
[-pcsort {no_sort,sort,simple_sort}] [-pcseq [PCSEQ]] [-exec_graph_path EXEC_GRAPH_PATH] [-dump_config DUMP_CONFIG] [-load_config LOAD_CONFIG]
Options:
-h [HELP], --help [HELP]
Show this help message and exit.
-i PATHS_TO_INPUT [PATHS_TO_INPUT ...], --paths_to_input PATHS_TO_INPUT [PATHS_TO_INPUT ...]
Optional. Path to a folder with images and/or binaries or to specific image or binary file.It is also allowed to map files to model inputs:
input_1:file_1/dir1,file_2/dir2,input_4:file_4/dir4 input_2:file_3/dir3 Currently supported data types: bin, npy. If OPENCV is enabled, this
functionalityis extended with the following data types: bmp, dib, jpeg, jpg, jpe, jp2, png, pbm, pgm, ppm, sr, ras, tiff, tif.
-m PATH_TO_MODEL, --path_to_model PATH_TO_MODEL
Required. Path to an .xml/.onnx file with a trained model or to a .blob file with a trained compiled model.
-d TARGET_DEVICE, --target_device TARGET_DEVICE
Optional. Specify a target device to infer on (the list of available devices is shown below). Default value is CPU. Use '-d HETERO:<comma
separated devices list>' format to specify HETERO plugin. Use '-d MULTI:<comma separated devices list>' format to specify MULTI plugin. The
application looks for a suitable plugin for the specified device.
-hint {throughput,cumulative_throughput,latency,none}, --perf_hint {throughput,cumulative_throughput,latency,none}
Optional. Performance hint (latency or throughput or cumulative_throughput or none). Performance hint allows the OpenVINO device to select the
right model-specific settings. 'throughput': device performance mode will be set to THROUGHPUT. 'cumulative_throughput': device performance
mode will be set to CUMULATIVE_THROUGHPUT. 'latency': device performance mode will be set to LATENCY. 'none': no device performance mode will
be set. Using explicit 'nstreams' or other device-specific options, please set hint to 'none'
-niter NUMBER_ITERATIONS, --number_iterations NUMBER_ITERATIONS
Optional. Number of iterations. If not specified, the number of iterations is calculated depending on a device.
-t TIME, --time TIME Optional. Time in seconds to execute topology.
-api {sync,async}, --api_type {sync,async}
Optional. Enable using sync/async API. Default value is async.
Input shapes:
-b BATCH_SIZE, --batch_size BATCH_SIZE
Optional. Batch size value. If not specified, the batch size value is determined from Intermediate Representation
-shape SHAPE Optional. Set shape for input. For example, "input1[1,3,224,224],input2[1,4]" or "[1,3,224,224]" in case of one input size. This parameter
affect model Parameter shape, can be dynamic. For dynamic dimesions use symbol `?`, `-1` or range `low.. up`.
-data_shape DATA_SHAPE
Optional. Optional if model shapes are all static (original ones or set by -shape).Required if at least one input shape is dynamic and input
images are not provided.Set shape for input tensors. For example, "input1[1,3,224,224][1,3,448,448],input2[1,4][1,8]" or
"[1,3,224,224][1,3,448,448] in case of one input size.
-layout LAYOUT Optional. Prompts how model layouts should be treated by application. For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input
size.
Advanced options:
-extensions EXTENSIONS, --extensions EXTENSIONS
Optional. Path or a comma-separated list of paths to libraries (.so or .dll) with extensions.
-c PATH_TO_CLDNN_CONFIG, --path_to_cldnn_config PATH_TO_CLDNN_CONFIG
Optional. Required for GPU custom kernels. Absolute path to an .xml file with the kernels description.
-cdir CACHE_DIR, --cache_dir CACHE_DIR
Optional. Enable model caching to specified directory
-lfile [LOAD_FROM_FILE], --load_from_file [LOAD_FROM_FILE]
Optional. Loads model from file directly without read_model.
-nireq NUMBER_INFER_REQUESTS, --number_infer_requests NUMBER_INFER_REQUESTS
Optional. Number of infer requests. Default value is determined automatically for device.
-nstreams NUMBER_STREAMS, --number_streams NUMBER_STREAMS
Optional. Number of streams to use for inference on the CPU/GPU (for HETERO and MULTI device cases use format
<device1>:<nstreams1>,<device2>:<nstreams2> or just <nstreams>). Default value is determined automatically for a device. Please note that
although the automatic selection usually provides a reasonable performance, it still may be non - optimal for some cases, especially for very
small models. Also, using nstreams>1 is inherently throughput-oriented option, while for the best-latency estimations the number of streams
should be set to 1. See samples README for more details.
-inference_only [INFERENCE_ONLY], --inference_only [INFERENCE_ONLY]
Optional. If true inputs filling only once before measurements (default for static models), else inputs filling is included into loop
measurement (default for dynamic models)
-infer_precision INFER_PRECISION
Optional. Specifies the inference precision. Example #1: '-infer_precision bf16'. Example #2: '-infer_precision CPU:bf16,GPU:f32'
-exec_graph_path EXEC_GRAPH_PATH, --exec_graph_path EXEC_GRAPH_PATH
Optional. Path to a file where to store executable graph information serialized.
Preprocessing options:
-ip {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}, --input_precision {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}
Optional. Specifies precision for all input layers of the model.
-op {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}, --output_precision {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}
Optional. Specifies precision for all output layers of the model.
-iop INPUT_OUTPUT_PRECISION, --input_output_precision INPUT_OUTPUT_PRECISION
Optional. Specifies precision for input and output layers by name. Example: -iop "input:f16, output:f16". Notice that quotes are required.
Overwrites precision from ip and op options for specified layers.
--mean_values [R,G,B]
Optional. Mean values to be used for the input image per channel. Values to be provided in the [R,G,B] format. Can be defined for desired input
of the model, for example: "--mean_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the
original model was trained. Applying the values affects performance and may cause type conversion
--scale_values [R,G,B]
Optional. Scale values to be used for the input image per channel. Values are provided in the [R,G,B] format. Can be defined for desired input
of the model, for example: "--scale_values data[255,255,255],info[255,255,255]". The exact meaning and order of channels depend on how the
original model was trained. If both --mean_values and --scale_values are specified, the mean is subtracted first and then scale is applied
regardless of the order of options in command line. Applying the values affects performance and may cause type conversion
Device-specific performance options:
-nthreads NUMBER_THREADS, --number_threads NUMBER_THREADS
Number of threads to use for inference on the CPU, GNA (including HETERO and MULTI cases).
-pin {YES,NO,NUMA,HYBRID_AWARE}, --infer_threads_pinning {YES,NO,NUMA,HYBRID_AWARE}
Optional. Enable threads->cores ('YES' which is OpenVINO runtime's default for conventional CPUs), threads->(NUMA)nodes ('NUMA'),
threads->appropriate core types ('HYBRID_AWARE', which is OpenVINO runtime's default for Hybrid CPUs) or completely disable ('NO') CPU threads
pinning for CPU-involved inference.
Statistics dumping options:
-latency_percentile LATENCY_PERCENTILE, --latency_percentile LATENCY_PERCENTILE
Optional. Defines the percentile to be reported in latency metric. The valid range is [1, 100]. The default value is 50 (median).
-report_type {no_counters,average_counters,detailed_counters}, --report_type {no_counters,average_counters,detailed_counters}
Optional. Enable collecting statistics report. "no_counters" report contains configuration options specified, resulting FPS and latency.
"average_counters" report extends "no_counters" report and additionally includes average PM counters values for each layer from the model.
"detailed_counters" report extends "average_counters" report and additionally includes per-layer PM counters and latency for each executed
infer request.
-report_folder REPORT_FOLDER, --report_folder REPORT_FOLDER
Optional. Path to a folder where statistics report is stored.
-json_stats [JSON_STATS], --json_stats [JSON_STATS]
Optional. Enables JSON-based statistics output (by default reporting system will use CSV format). Should be used together with -report_folder option.
-pc [PERF_COUNTS], --perf_counts [PERF_COUNTS]
Optional. Report performance counters.
-pcsort {no_sort,sort,simple_sort}, --perf_counts_sort {no_sort,sort,simple_sort}
Optional. Report performance counters and analysis the sort hotpoint opts. sort: Analysis opts time cost, print by hotpoint order no_sort:
Analysis opts time cost, print by normal order simple_sort: Analysis opts time cost, only print EXECUTED opts by normal order
-pcseq [PCSEQ], --pcseq [PCSEQ]
Optional. Report latencies for each shape in -data_shape sequence.
-dump_config DUMP_CONFIG
Optional. Path to JSON file to dump OpenVINO parameters, which were set by application.
-load_config LOAD_CONFIG
Optional. Path to JSON file to load custom OpenVINO parameters.
Please note, command line parameters have higher priority then parameters from configuration file.
Example 1: a simple JSON file for HW device with primary properties.
{
"CPU": {"NUM_STREAMS": "3", "PERF_COUNT": "NO"}
}
Example 2: a simple JSON file for meta device(AUTO/MULTI) with HW device properties.
{
"AUTO": {
"PERFORMANCE_HINT": "THROUGHPUT",
"PERF_COUNT": "NO",
"DEVICE_PROPERTIES": "{CPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:3},GPU:{INFERENCE_PRECISION_HINT:f32,NUM_STREAMS:5}}"
}
}
Running the application with the empty list of options yields the usage message given above and an error message.
More information on inputs
++++++++++++++++++++++++++
The benchmark tool supports topologies with one or more inputs. If a topology is not data sensitive, you can skip the input parameter, and the inputs will be filled with random values. If a model has only image input(s), provide a folder with images or a path to an image as input. If a model has some specific input(s) (besides images), please prepare a binary file(s) or numpy array(s) that is filled with data of appropriate precision and provide a path to it as input. If a model has mixed input types, the input folder should contain all required files. Image inputs are filled with image files one by one. Binary inputs are filled with binary inputs one by one.
.. _examples-of-running-the-tool-python:
Examples of Running the Tool
############################
This section provides step-by-step instructions on how to run the Benchmark Tool with the ``asl-recognition`` Intel model on CPU or GPU devices. It uses random data as the input.
.. note::
Internet access is required to execute the following steps successfully. If you have access to the Internet through a proxy server only, please make sure that it is configured in your OS environment.
1. Install OpenVINO Development Tools (if it hasn't been installed already):
.. code-block:: sh
pip install openvino-dev
2. Download the model using ``omz_downloader``, specifying the model name and directory to download the model to:
.. code-block:: sh
omz_downloader --name asl-recognition-0004 --precisions FP16 --output_dir omz_models
3. Run the tool, specifying the location of the model .xml file, the device to perform inference on, and with a performance hint. The following commands demonstrate examples of how to run the Benchmark Tool in latency mode on CPU and throughput mode on GPU devices:
* On CPU (latency mode):
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
* On GPU (throughput mode):
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d GPU -hint throughput
The application outputs the number of executed iterations, total duration of execution, latency, and throughput.
Additionally, if you set the ``-report_type`` parameter, the application outputs a statistics report. If you set the ``-pc`` parameter, the application outputs performance counters. If you set ``-exec_graph_path``, the application reports executable graph information serialized. All measurements including per-layer PM counters are reported in milliseconds.
An example of the information output when running benchmark_app on CPU in latency mode is shown below:
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
.. code-block:: sh
[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters
[ INFO ] Input command: /home/openvino/tools/benchmark_tool/benchmark_app.py -m omz_models/intel/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -hint latency
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2022.3.0-7750-c1109a7317e-feature/py_cpp_align
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
[ INFO ] Read model took 147.82 ms
[ INFO ] Original model I/O parameters:
[ INFO ] Model inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Model outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 5/11] Resizing model to match image sizes and given batch
[ INFO ] Model batch size: 1
[Step 6/11] Configuring input of the model
[ INFO ] Model inputs:
[ INFO ] input (node: input) : f32 / [N,C,D,H,W] / {1,3,16,224,224}
[ INFO ] Model outputs:
[ INFO ] output (node: output) : f32 / [...] / {1,100}
[Step 7/11] Loading the model to the device
[ INFO ] Compile model took 974.64 ms
[Step 8/11] Querying optimal runtime parameters
[ INFO ] Model:
[ INFO ] NETWORK_NAME: torch-jit-export
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 2
[ INFO ] NUM_STREAMS: 2
[ INFO ] AFFINITY: Affinity.CORE
[ INFO ] INFERENCE_NUM_THREADS: 0
[ INFO ] PERF_COUNT: False
[ INFO ] INFERENCE_PRECISION_HINT: <Type: 'float32'>
[ INFO ] PERFORMANCE_HINT: PerformanceMode.LATENCY
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'input'!. This input will be filled with random values!
[ INFO ] Fill input 'input' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 2 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 38.41 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 5380 iterations
[ INFO ] Duration: 60036.78 ms
[ INFO ] Latency:
[ INFO ] Median: 22.04 ms
[ INFO ] Average: 22.09 ms
[ INFO ] Min: 20.78 ms
[ INFO ] Max: 33.51 ms
[ INFO ] Throughput: 89.61 FPS
The Benchmark Tool can also be used with dynamically shaped networks to measure expected inference time for various input data shapes. See the ``-shape`` and ``-data_shape`` argument descriptions in the :ref:`All configuration options <all-configuration-options-python-benchmark>` section to learn more about using dynamic shapes. Here is a command example for using benchmark_app with dynamic networks and a portion of the resulting output:
.. code-block:: sh
benchmark_app -m omz_models/intel/asl-recognition-0004/FP16/asl-recognition-0004.xml -d CPU -shape [-1,3,16,224,224] -data_shape [1,3,16,224,224][2,3,16,224,224][4,3,16,224,224] -pcseq
.. code-block:: sh
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'input'!. This input will be filled with random values!
[ INFO ] Fill input 'input' with random values
[ INFO ] Defined 3 tensor groups:
[ INFO ] input: {1, 3, 16, 224, 224}
[ INFO ] input: {2, 3, 16, 224, 224}
[ INFO ] input: {4, 3, 16, 224, 224}
[Step 10/11] Measuring performance (Start inference asynchronously, 11 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in full mode (inputs filling are included in measurement loop).
[ INFO ] First inference took 201.15 ms
[Step 11/11] Dumping statistics report
[ INFO ] Count: 2811 iterations
[ INFO ] Duration: 60271.71 ms
[ INFO ] Latency:
[ INFO ] Median: 207.70 ms
[ INFO ] Average: 234.56 ms
[ INFO ] Min: 85.73 ms
[ INFO ] Max: 773.55 ms
[ INFO ] Latency for each data shape group:
[ INFO ] 1. input: {1, 3, 16, 224, 224}
[ INFO ] Median: 118.08 ms
[ INFO ] Average: 115.05 ms
[ INFO ] Min: 85.73 ms
[ INFO ] Max: 339.25 ms
[ INFO ] 2. input: {2, 3, 16, 224, 224}
[ INFO ] Median: 207.25 ms
[ INFO ] Average: 205.16 ms
[ INFO ] Min: 166.98 ms
[ INFO ] Max: 545.55 ms
[ INFO ] 3. input: {4, 3, 16, 224, 224}
[ INFO ] Median: 384.16 ms
[ INFO ] Average: 383.48 ms
[ INFO ] Min: 305.51 ms
[ INFO ] Max: 773.55 ms
[ INFO ] Throughput: 108.82 FPS
See Also
####################
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
* :doc:`Model Downloader <omz_tools_downloader>`

View File

@ -1,401 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_speech_sample_README}
Automatic Speech Recognition Python Sample
==========================================
.. meta::
:description: Learn how to infer an acoustic model based on Kaldi
neural networks and speech feature vectors using Asynchronous
Inference Request (Python) API.
.. note::
This sample is now deprecated and will be removed with OpenVINO 2024.0.
The sample was mainly designed to demonstrate the features of the GNA plugin
and the use of models produced by the Kaldi framework. OpenVINO support for
these components is now deprecated and will be discontinued, making the sample
redundant.
This sample demonstrates how to do a Synchronous Inference of acoustic model based on Kaldi\* neural models and speech feature vectors.
The sample works with Kaldi ARK or Numpy* uncompressed NPZ files, so it does not cover an end-to-end speech recognition scenario (speech to text), requiring additional preprocessing (feature extraction) to get a feature vector from a speech signal, as well as postprocessing (decoding) to produce text from scores.
.. tab-set::
.. tab-item:: Requirements
+----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Options | Values |
+======================================================================+======================================================================================================================================================================+
| Validated Models | Acoustic model based on Kaldi* neural models (see :ref:`Model Preparation <model-preparation-speech-python>` section) |
+----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (.xml + .bin) |
+----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Supported devices | See :ref:`Execution Modes <execution-modes-speech-python>` section below and :doc:`List Supported Devices <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_speech_sample_README>` |
+----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: Python API
Automatic Speech Recognition Python sample application demonstrates how to use the following Python API in applications:
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| Feature | API | Description |
+===================================================================+================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+=======================================================================+
| Import/Export Model | `openvino.runtime.Core.import_model <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.import_model>`__ , `openvino.runtime.CompiledModel.export_model <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.CompiledModel.html#openvino.runtime.CompiledModel.export_model>`__ | The GNA plugin supports loading and saving of the GNA-optimized model |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| Model Operations | `openvino.runtime.Model.add_outputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.add_outputs>`__ , `openvino.runtime.set_batch <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.html#openvino.runtime.set_batch>`__ , `openvino.runtime.CompiledModel.inputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.CompiledModel.html#openvino.runtime.CompiledModel.inputs>`__ , `openvino.runtime.CompiledModel.outputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.CompiledModel.html#openvino.runtime.CompiledModel.outputs>`__ , `openvino.runtime.ConstOutput.any_name <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.ConstOutput.html#openvino.runtime.ConstOutput.any_name>`__ | Managing of model: configure batch_size, input and output tensors |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| Synchronous Infer | `openvino.runtime.CompiledModel.create_infer_request <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.CompiledModel.html#openvino.runtime.CompiledModel.create_infer_request>`__ , `openvino.runtime.InferRequest.infer <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.infer>`__ | Do synchronous inference |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| InferRequest Operations | `openvino.runtime.InferRequest.get_input_tensor <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.get_input_tensor>`__ , `openvino.runtime.InferRequest.model_outputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.model_outputs>`__ , `openvino.runtime.InferRequest.model_inputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.model_inputs>`__ , | Get info about model using infer request API |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| InferRequest Operations | `openvino.runtime.InferRequest.query_state <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.query_state>`__ , `openvino.runtime.VariableState.reset <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.inference_engine.VariableState.html#openvino.inference_engine.VariableState.reset>`__ | Gets and resets CompiledModel state control |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
| Profiling | `openvino.runtime.InferRequest.profiling_info <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.profiling_info>`__ , `openvino.runtime.ProfilingInfo.real_time <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.ProfilingInfo.html#openvino.runtime.ProfilingInfo.real_time>`__ | Get infer request profiling info |
+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification Python* Sample <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/speech_sample/speech_sample.py
:language: python
How It Works
############
At startup, the sample application reads command-line parameters, loads a specified model and input data to the OpenVINO™ Runtime plugin, performs synchronous inference on all speech utterances stored in the input file, logging each step in a standard output stream.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
GNA-specific details
####################
Quantization
++++++++++++
If the GNA device is selected (for example, using the ``-d`` GNA flag), the GNA OpenVINO™ Runtime plugin quantizes the model and input feature vector sequence to integer representation before performing inference.
Several neural model quantization modes:
- *static* - The first utterance in the input file is scanned for dynamic range. The scale factor (floating point scalar multiplier) required to scale the maximum input value of the first utterance to 16384 (15 bits) is used for all subsequent inputs. The neural model is quantized to accommodate the scaled input dynamic range.
- *user-defined* - The user may specify a scale factor via the ``-sf`` flag that will be used for static quantization.
The ``-qb`` flag provides a hint to the GNA plugin regarding the preferred target weight resolution for all layers.
For example, when ``-qb 8`` is specified, the plugin will use 8-bit weights wherever possible in the
model.
.. note::
It is not always possible to use 8-bit weights due to GNA hardware limitations. For example, convolutional layers always use 16-bit weights (GNA hardware version 1 and 2). This limitation will be removed in GNA hardware version 3 and higher.
.. _execution-modes-speech-python:
Execution Modes
+++++++++++++++
Several execution modes are supported via the ``-d`` flag:
- ``CPU`` - All calculations are performed on CPU device using CPU Plugin.
- ``GPU`` - All calculations are performed on GPU device using GPU Plugin.
- ``NPU`` - All calculations are performed on NPU device using NPU Plugin.
- ``GNA_AUTO`` - GNA hardware is used if available and the driver is installed. Otherwise, the GNA device is emulated in fast-but-not-bit-exact mode.
- ``GNA_HW`` - GNA hardware is used if available and the driver is installed. Otherwise, an error will occur.
- ``GNA_SW`` - Deprecated. The GNA device is emulated in fast-but-not-bit-exact mode.
- ``GNA_SW_FP32`` - Substitutes parameters and calculations from low precision to floating point (FP32).
- ``GNA_SW_EXACT`` - GNA device is emulated in bit-exact mode.
Loading and Saving Models
+++++++++++++++++++++++++
The GNA plugin supports loading and saving of the GNA-optimized model (non-IR) via the ``-rg`` and ``-wg`` flags.
Thereby, it is possible to avoid the cost of full model quantization at run time.
The GNA plugin also supports export of firmware-compatible embedded model images for the Intel® Speech Enabling Developer Kit and Amazon Alexa* Premium Far-Field Voice Development Kit via the ``-we`` flag (save only).
In addition to performing inference directly from a GNA model file, these options make it possible to:
- Convert from IR format to GNA format model file (``-m``, ``-wg``)
- Convert from IR format to embedded format model file (``-m``, ``-we``)
- Convert from GNA format to embedded format model file (``-rg``, ``-we``)
Running
#######
Run the application with the ``-h`` option to see the usage message:
.. code-block:: sh
python speech_sample.py -h
Usage message:
.. code-block:: console
usage: speech_sample.py [-h] (-m MODEL | -rg IMPORT_GNA_MODEL) -i INPUT [-o OUTPUT] [-r REFERENCE] [-d DEVICE] [-bs [1-8]]
[-layout LAYOUT] [-qb [8, 16]] [-sf SCALE_FACTOR] [-wg EXPORT_GNA_MODEL]
[-we EXPORT_EMBEDDED_GNA_MODEL] [-we_gen [GNA1, GNA3]]
[--exec_target [GNA_TARGET_2_0, GNA_TARGET_3_0]] [-pc] [-a [CORE, ATOM]] [-iname INPUT_LAYERS]
[-oname OUTPUT_LAYERS] [-cw_l CONTEXT_WINDOW_LEFT] [-cw_r CONTEXT_WINDOW_RIGHT] [-pwl_me PWL_ME]
optional arguments:
-m MODEL, --model MODEL
Path to an .xml file with a trained model (required if -rg is missing).
-rg IMPORT_GNA_MODEL, --import_gna_model IMPORT_GNA_MODEL
Read GNA model from file using path/filename provided (required if -m is missing).
Options:
-h, --help Show this help message and exit.
-i INPUT, --input INPUT
Required. Path(s) to input file(s).
Usage for a single file/layer: <input_file.ark> or <input_file.npz>.
Example of usage for several files/layers: <layer1>:<port_num1>=<input_file1.ark>,<layer2>:<port_num2>=<input_file2.ark>.
-o OUTPUT, --output OUTPUT
Optional. Output file name(s) to save scores (inference results).
Usage for a single file/layer: <output_file.ark> or <output_file.npz>.
Example of usage for several files/layers: <layer1>:<port_num1>=<output_file1.ark>,<layer2>:<port_num2>=<output_file2.ark>.
-r REFERENCE, --reference REFERENCE
Read reference score file(s) and compare inference results with reference scores.
Usage for a single file/layer: <reference_file.ark> or <reference_file.npz>.
Example of usage for several files/layers: <layer1>:<port_num1>=<reference_file1.ark>,<layer2>:<port_num2>=<reference_file2.ark>.
-d DEVICE, --device DEVICE
Optional. Specify a target device to infer on. CPU, GPU, NPU, GNA_AUTO, GNA_HW, GNA_SW_FP32,
GNA_SW_EXACT and HETERO with combination of GNA as the primary device and CPU as a secondary (e.g.
HETERO:GNA,CPU) are supported. The sample will look for a suitable plugin for device specified.
Default value is CPU.
-bs [1-8], --batch_size [1-8]
Optional. Batch size 1-8.
-layout LAYOUT Optional. Custom layout in format: "input0[value0],input1[value1]" or "[value]" (applied to all
inputs)
-qb [8, 16], --quantization_bits [8, 16]
Optional. Weight resolution in bits for GNA quantization: 8 or 16 (default 16).
-sf SCALE_FACTOR, --scale_factor SCALE_FACTOR
Optional. User-specified input scale factor for GNA quantization.
If the model contains multiple inputs, provide scale factors by separating them with commas.
For example: <layer1>:<sf1>,<layer2>:<sf2> or just <sf> to be applied to all inputs.
-wg EXPORT_GNA_MODEL, --export_gna_model EXPORT_GNA_MODEL
Optional. Write GNA model to file using path/filename provided.
-we EXPORT_EMBEDDED_GNA_MODEL, --export_embedded_gna_model EXPORT_EMBEDDED_GNA_MODEL
Optional. Write GNA embedded model to file using path/filename provided.
-we_gen [GNA1, GNA3], --embedded_gna_configuration [GNA1, GNA3]
Optional. GNA generation configuration string for embedded export. Can be GNA1 (default) or GNA3.
--exec_target [GNA_TARGET_2_0, GNA_TARGET_3_0]
Optional. Specify GNA execution target generation. By default, generation corresponds to the GNA HW
available in the system or the latest fully supported generation by the software. See the GNA
Plugin's GNA_EXEC_TARGET config option description.
-pc, --performance_counter
Optional. Enables performance report (specify -a to ensure arch accurate results).
-a [CORE, ATOM], --arch [CORE, ATOM]
Optional. Specify architecture. CORE, ATOM with the combination of -pc.
-cw_l CONTEXT_WINDOW_LEFT, --context_window_left CONTEXT_WINDOW_LEFT
Optional. Number of frames for left context windows (default is 0). Works only with context window
models. If you use the cw_l or cw_r flag, then batch size argument is ignored.
-cw_r CONTEXT_WINDOW_RIGHT, --context_window_right CONTEXT_WINDOW_RIGHT
Optional. Number of frames for right context windows (default is 0). Works only with context window
models. If you use the cw_l or cw_r flag, then batch size argument is ignored.
-pwl_me PWL_ME Optional. The maximum percent of error for PWL function. The value must be in <0, 100> range. The
default value is 1.0.
.. _model-preparation-speech-python:
Model Preparation
#################
You can use the following model conversion command to convert a Kaldi nnet1 or nnet2 neural model to OpenVINO™ toolkit Intermediate Representation format:
.. code-block:: sh
mo --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir <OUTPUT_MODEL_DIR>
The following pre-trained models are available:
- rm_cnn4a_smbr
- rm_lstm4f
- wsj_dnn5b_smbr
All of them can be downloaded from `the storage <https://storage.openvinotoolkit.org/models_contrib/speech/2021.2>`.
Speech Inference
################
You can do inference on Intel® Processors with the GNA co-processor (or emulation library):
.. code-block:: sh
python speech_sample.py -m wsj_dnn5b.xml -i dev93_10.ark -r dev93_scores_10.ark -d GNA_AUTO -o result.npz
.. note::
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample supports input and output in numpy file format (.npz)
- Stating flags that take only single option like `-m` multiple times, for example `python classification_sample_async.py -m model.xml -m model2.xml`, results in only the last value being used.
Sample Output
#############
The sample application logs each step in a standard output stream.
.. code-block:: sh
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: /models/wsj_dnn5b_smbr_fp32.xml
[ INFO ] Using scale factor(s) calculated from first utterance
[ INFO ] For input 0 using scale factor of 2175.4322418
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ]
[ INFO ] Utterance 0:
[ INFO ] Total time in Infer (HW and SW): 6326.06ms
[ INFO ] Frames in utterance: 1294
[ INFO ] Average Infer time per frame: 4.89ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7051840
[ INFO ] avg error: 0.0448388
[ INFO ] avg rms error: 0.0582387
[ INFO ] stdev error: 0.0371650
[ INFO ]
[ INFO ] Utterance 1:
[ INFO ] Total time in Infer (HW and SW): 4526.57ms
[ INFO ] Frames in utterance: 1005
[ INFO ] Average Infer time per frame: 4.50ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7575974
[ INFO ] avg error: 0.0452166
[ INFO ] avg rms error: 0.0586013
[ INFO ] stdev error: 0.0372769
[ INFO ]
[ INFO ] Utterance 2:
[ INFO ] Total time in Infer (HW and SW): 6636.56ms
[ INFO ] Frames in utterance: 1471
[ INFO ] Average Infer time per frame: 4.51ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7191710
[ INFO ] avg error: 0.0472226
[ INFO ] avg rms error: 0.0612991
[ INFO ] stdev error: 0.0390846
[ INFO ]
[ INFO ] Utterance 3:
[ INFO ] Total time in Infer (HW and SW): 3927.01ms
[ INFO ] Frames in utterance: 845
[ INFO ] Average Infer time per frame: 4.65ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7436461
[ INFO ] avg error: 0.0477581
[ INFO ] avg rms error: 0.0621334
[ INFO ] stdev error: 0.0397457
[ INFO ]
[ INFO ] Utterance 4:
[ INFO ] Total time in Infer (HW and SW): 3891.49ms
[ INFO ] Frames in utterance: 855
[ INFO ] Average Infer time per frame: 4.55ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7071600
[ INFO ] avg error: 0.0449147
[ INFO ] avg rms error: 0.0585048
[ INFO ] stdev error: 0.0374897
[ INFO ]
[ INFO ] Utterance 5:
[ INFO ] Total time in Infer (HW and SW): 3378.61ms
[ INFO ] Frames in utterance: 699
[ INFO ] Average Infer time per frame: 4.83ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.8870468
[ INFO ] avg error: 0.0479243
[ INFO ] avg rms error: 0.0625490
[ INFO ] stdev error: 0.0401951
[ INFO ]
[ INFO ] Utterance 6:
[ INFO ] Total time in Infer (HW and SW): 4034.31ms
[ INFO ] Frames in utterance: 790
[ INFO ] Average Infer time per frame: 5.11ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7648273
[ INFO ] avg error: 0.0482702
[ INFO ] avg rms error: 0.0629734
[ INFO ] stdev error: 0.0404429
[ INFO ]
[ INFO ] Utterance 7:
[ INFO ] Total time in Infer (HW and SW): 2854.04ms
[ INFO ] Frames in utterance: 622
[ INFO ] Average Infer time per frame: 4.59ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.7389560
[ INFO ] avg error: 0.0465543
[ INFO ] avg rms error: 0.0604941
[ INFO ] stdev error: 0.0386294
[ INFO ]
[ INFO ] Utterance 8:
[ INFO ] Total time in Infer (HW and SW): 2493.28ms
[ INFO ] Frames in utterance: 548
[ INFO ] Average Infer time per frame: 4.55ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.6680136
[ INFO ] avg error: 0.0439341
[ INFO ] avg rms error: 0.0574614
[ INFO ] stdev error: 0.0370353
[ INFO ]
[ INFO ] Utterance 9:
[ INFO ] Total time in Infer (HW and SW): 1654.67ms
[ INFO ] Frames in utterance: 368
[ INFO ] Average Infer time per frame: 4.50ms
[ INFO ]
[ INFO ] Output blob name: affinetransform14
[ INFO ] Number scores per frame: 3425
[ INFO ]
[ INFO ] max error: 0.6550579
[ INFO ] avg error: 0.0467643
[ INFO ] avg rms error: 0.0605045
[ INFO ] stdev error: 0.0383914
[ INFO ]
[ INFO ] Total sample time: 39722.60ms
[ INFO ] File result.npz was created!
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,83 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_bert_benchmark_README}
Bert Benchmark Python Sample
============================
.. meta::
:description: Learn how to estimate performance of a Bert model using Asynchronous Inference Request (Python) API.
This sample demonstrates how to estimate performance of a Bert model using Asynchronous Inference Request API. Unlike :doc:`demos <omz_demos>` this sample doesn't have configurable command line arguments. Feel free to modify sample's source code to try out different options.
The following Python API is used in the application:
.. tab-set::
.. tab-item:: Python API
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Feature | API | Description |
+================================+=================================================+==============================================+
| OpenVINO Runtime Version | [openvino.runtime.get_version] | Get Openvino API version. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Basic Infer Flow | [openvino.runtime.Core], | Common API to do inference: compile a model. |
| | [openvino.runtime.Core.compile_model] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Asynchronous Infer | [openvino.runtime.AsyncInferQueue], | Do asynchronous inference. |
| | [openvino.runtime.AsyncInferQueue.start_async], | |
| | [openvino.runtime.AsyncInferQueue.wait_all] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Model Operations | [openvino.runtime.CompiledModel.inputs] | Get inputs of a model. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/benchmark/bert_benchmark/bert_benchmark.py
:language: python
How It Works
####################
The sample downloads a model and a tokenizer, export the model to onnx, reads the exported model and reshapes it to enforce dynamic input shapes, compiles the resulting model, downloads a dataset and runs benchmarking on the dataset.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
Install the ``openvino`` Python package:
.. code-block:: sh
python -m pip install openvino
Install packages from ``requirements.txt``:
.. code-block:: sh
python -m pip install -r requirements.txt
Run the sample
.. code-block:: sh
python bert_benchmark.py
Sample Output
####################
The sample outputs how long it takes to process a dataset.
See Also
####################
* :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Model Downloader <omz_tools_downloader>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,151 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_hello_classification_README}
Hello Classification Python Sample
==================================
.. meta::
:description: Learn how to do inference of image classification
models using Synchronous Inference Request (Python) API.
This sample demonstrates how to do inference of image classification models using Synchronous Inference Request API.
Models with only 1 input and output are supported.
.. tab-set::
.. tab-item:: Requirements
+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Options | Values |
+===================================+===================================================================================================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, :doc:`googlenet-v1 <omz_models_model_googlenet_v1>` |
+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (.xml + .bin), ONNX (.onnx) |
+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_hello_classification_README>`, :doc:`C <openvino_inference_engine_ie_bridges_c_samples_hello_classification_README>` |
+-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: Python API
The following Python API is used in the application:
+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Feature | API | Description |
+=============================+===========================================================================================================================================================================================================================================+============================================================================================================================================================================================+
| Basic Infer Flow | `openvino.runtime.Core <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Core.html>`__ , | |
| | `openvino.runtime.Core.read_model <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.read_model>`__ , | |
| | `openvino.runtime.Core.compile_model <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.compile_model>`__ | Common API to do inference |
+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Synchronous Infer | `openvino.runtime.CompiledModel.infer_new_request <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.CompiledModel.html#openvino.runtime.CompiledModel.infer_new_request>`__ | Do synchronous inference |
+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Model Operations | `openvino.runtime.Model.inputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.inputs>`__ , | Managing of model |
| | `openvino.runtime.Model.outputs <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.outputs>`__ | |
+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Preprocessing | `openvino.preprocess.PrePostProcessor <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.PrePostProcessor.html>`__ , | Set image of the original size as input for a model with other input size. Resize and layout conversions will be performed automatically by the corresponding plugin just before inference |
| | `openvino.preprocess.InputTensorInfo.set_element_type <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.InputTensorInfo.html#openvino.preprocess.InputTensorInfo.set_element_type>`__ , | |
| | `openvino.preprocess.InputTensorInfo.set_layout <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.InputTensorInfo.html#openvino.preprocess.InputTensorInfo.set_layout>`__ , | |
| | `openvino.preprocess.InputTensorInfo.set_spatial_static_shape <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.InputTensorInfo.html#openvino.preprocess.InputTensorInfo.set_spatial_static_shape>`__ , | |
| | `openvino.preprocess.PreProcessSteps.resize <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.PreProcessSteps.html#openvino.preprocess.PreProcessSteps.resize>`__ , | |
| | `openvino.preprocess.InputModelInfo.set_layout <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.InputModelInfo.html#openvino.preprocess.InputModelInfo.set_layout>`__ , | |
| | `openvino.preprocess.OutputTensorInfo.set_element_type <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.OutputTensorInfo.html#openvino.preprocess.OutputTensorInfo.set_element_type>`__ , | |
| | `openvino.preprocess.PrePostProcessor.build <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.preprocess.PrePostProcessor.html#openvino.preprocess.PrePostProcessor.build>`__ | |
+-----------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/hello_classification/hello_classification.py
:language: python
How It Works
############
At startup, the sample application reads command-line parameters, prepares input data, loads a specified model and image to the OpenVINO™ Runtime plugin, performs synchronous inference, and processes output data, logging each step in a standard output stream.
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
#######
.. code-block:: console
python hello_classification.py <path_to_model> <path_to_image> <device_name>
To run the sample, you need to specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`__.
.. note::
- By default, OpenVINO™ Toolkit Samples and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using model conversion API with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
+++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: console
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model:
.. code-block:: console
omz_downloader --name alexnet
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: console
omz_converter --name alexnet
4. Perform inference of ``banana.jpg`` using the ``alexnet`` model on a ``GPU``, for example:
.. code-block:: console
python hello_classification.py alexnet.xml banana.jpg GPU
Sample Output
#############
The sample application logs each step in a standard output stream and outputs top-10 inference results.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: /models/alexnet/alexnet.xml
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Image path: /images/banana.jpg
[ INFO ] Top 10 results:
[ INFO ] class_id probability
[ INFO ] --------------------
[ INFO ] 954 0.9703885
[ INFO ] 666 0.0219518
[ INFO ] 659 0.0033120
[ INFO ] 435 0.0008246
[ INFO ] 809 0.0004433
[ INFO ] 502 0.0003852
[ INFO ] 618 0.0002906
[ INFO ] 910 0.0002848
[ INFO ] 951 0.0002427
[ INFO ] 961 0.0002213
[ INFO ]
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,121 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_hello_query_device_README}
Hello Query Device Python Sample
================================
.. meta::
:description: Learn how to show metrics and default
configuration values of inference devices using Query
Device (Python) API feature.
This sample demonstrates how to show OpenVINO™ Runtime devices and prints their metrics and default configuration values using :doc:`Query Device API feature <openvino_docs_OV_UG_query_api>`.
.. tab-set::
.. tab-item:: Requirements
+-------------------------------------------------------+--------------------------------------------------------------------------+
| Options | Values |
+=======================================================+==========================================================================+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+-------------------------------------------------------+--------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_hello_query_device_README>` |
+-------------------------------------------------------+--------------------------------------------------------------------------+
.. tab-item:: Python API
The following Python API is used in the application:
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+
| Feature | API | Description |
+=======================================+============================================================================================================================================================================================+========================================+
| Basic | `openvino.runtime.Core <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Core.html>`__ | Common API |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+
| Query Device | `openvino.runtime.Core.available_devices <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.available_devices>`__ , | Get device properties |
| | `openvino.runtime.Core.get_metric <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.inference_engine.IECore.html#openvino.inference_engine.IECore.get_metric>`__ , | |
| | `openvino.runtime.Core.get_config <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.inference_engine.IECore.html#openvino.inference_engine.IECore.get_config>`__ | |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/hello_query_device/hello_query_device.py
:language: python
How It Works
############
The sample queries all available OpenVINO™ Runtime devices and prints their supported metrics and plugin configuration parameters.
Running
#######
The sample has no command-line parameters. To see the report, run the following command:
.. code-block:: console
python hello_query_device.py
Sample Output
#############
The application prints all available devices with their supported metrics and default values for configuration parameters.
For example:
.. code-block:: console
[ INFO ] Available devices:
[ INFO ] CPU :
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES:
[ INFO ] FULL_DEVICE_NAME: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
[ INFO ] OPTIMIZATION_CAPABILITIES: FP32, FP16, INT8, BIN
[ INFO ] RANGE_FOR_ASYNC_INFER_REQUESTS: 1, 1, 1
[ INFO ] RANGE_FOR_STREAMS: 1, 8
[ INFO ] IMPORT_EXPORT_SUPPORT: True
[ INFO ]
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] CACHE_DIR:
[ INFO ] CPU_BIND_THREAD: NO
[ INFO ] CPU_THREADS_NUM: 0
[ INFO ] CPU_THROUGHPUT_STREAMS: 1
[ INFO ] DUMP_EXEC_GRAPH_AS_DOT:
[ INFO ] ENFORCE_BF16: NO
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS: NO
[ INFO ] PERFORMANCE_HINT:
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[ INFO ] PERF_COUNT: NO
[ INFO ]
[ INFO ] GNA :
[ INFO ] SUPPORTED_METRICS:
[ INFO ] AVAILABLE_DEVICES: GNA_SW
[ INFO ] OPTIMAL_NUMBER_OF_INFER_REQUESTS: 1
[ INFO ] FULL_DEVICE_NAME: GNA_SW
[ INFO ] GNA_LIBRARY_FULL_VERSION: 3.0.0.1455
[ INFO ] IMPORT_EXPORT_SUPPORT: True
[ INFO ]
[ INFO ] SUPPORTED_CONFIG_KEYS (default values):
[ INFO ] EXCLUSIVE_ASYNC_REQUESTS: NO
[ INFO ] GNA_COMPACT_MODE: YES
[ INFO ] GNA_COMPILE_TARGET:
[ INFO ] GNA_DEVICE_MODE: GNA_SW_EXACT
[ INFO ] GNA_EXEC_TARGET:
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE:
[ INFO ] GNA_FIRMWARE_MODEL_IMAGE_GENERATION:
[ INFO ] GNA_LIB_N_THREADS: 1
[ INFO ] GNA_PRECISION: I16
[ INFO ] GNA_PWL_MAX_ERROR_PERCENT: 1.000000
[ INFO ] GNA_PWL_UNIFORM_DESIGN: NO
[ INFO ] GNA_SCALE_FACTOR: 1.000000
[ INFO ] GNA_SCALE_FACTOR_0: 1.000000
[ INFO ] LOG_LEVEL: LOG_NONE
[ INFO ] PERF_COUNT: NO
[ INFO ] SINGLE_THREAD: YES
See Also
########
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`

View File

@ -1,134 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_hello_reshape_ssd_README}
Hello Reshape SSD Python Sample
===============================
.. meta::
:description: Learn how to do inference of object detection
models using shape inference feature and Synchronous
Inference Request (Python) API.
This sample demonstrates how to do synchronous inference of object detection models using :doc:`Shape Inference feature <openvino_docs_OV_UG_ShapeInference>`.
Models with only 1 input and output are supported.
.. tab-set::
.. tab-item:: Requirements
+------------------------------------+---------------------------------------------------------------------------+
| Options | Values |
+====================================+===========================================================================+
| Validated Models | :doc:`mobilenet-ssd <omz_models_model_mobilenet_ssd>` |
+------------------------------------+---------------------------------------------------------------------------+
| Validated Layout | NCHW |
+------------------------------------+---------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (.xml + .bin), ONNX (.onnx) |
+------------------------------------+---------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+------------------------------------+---------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_hello_reshape_ssd_README>` |
+------------------------------------+---------------------------------------------------------------------------+
.. tab-item:: Python API
The following Python API is used in the application:
+------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
| Feature | API | Description |
+====================================+================================================================================================================================================================================+======================================+
| Model Operations | `openvino.runtime.Model.reshape <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.reshape>`__ , | Managing of model |
| | `openvino.runtime.Model.input <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.input>`__ , | |
| | `openvino.runtime.Output.get_any_name <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Output.html#openvino.runtime.Output.get_any_name>`__ , | |
| | `openvino.runtime.PartialShape <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.PartialShape.html>`__ | |
+------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification Python* Sample <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/hello_reshape_ssd/hello_reshape_ssd.py
:language: python
How It Works
############
At startup, the sample application reads command-line parameters, prepares input data, loads a specified model and image to the OpenVINO™ Runtime plugin, performs synchronous inference, and processes output data.
As a result, the program creates an output image, logging each step in a standard output stream.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
#######
.. code-block:: console
python hello_reshape_ssd.py <path_to_model> <path_to_image> <device_name>
To run the sample, you need to specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available at `the storage <https://storage.openvinotoolkit.org/data/test_data>`.
.. note::
- By default, OpenVINO™ Toolkit Samples and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using model conversion API with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
+++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: console
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model:
.. code-block:: console
omz_downloader --name mobilenet-ssd
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: console
omz_converter --name mobilenet-ssd
4. Perform inference of ``banana.jpg`` using ``ssdlite_mobilenet_v2`` model on a ``GPU``, for example:
.. code-block:: console
python hello_reshape_ssd.py mobilenet-ssd.xml banana.jpg GPU
Sample Output
#############
The sample application logs each step in a standard output stream and creates an output image, drawing bounding boxes for inference results with an over 50% confidence.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: C:/test_data/models/mobilenet-ssd.xml
[ INFO ] Reshaping the model to the height and width of the input image
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Found: class_id = 52, confidence = 0.98, coords = (21, 98), (276, 210)
[ INFO ] Image out.bmp was created!
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,188 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_classification_sample_async_README}
Image Classification Async Python Sample
========================================
.. meta::
:description: Learn how to do inference of image classification models
using Asynchronous Inference Request (Python) API.
This sample demonstrates how to do inference of image classification models using Asynchronous Inference Request API.
Models with only 1 input and output are supported.
.. tab-set::
.. tab-item:: Requirements
+----------------------------+-----------------------------------------------------------------------------------+
| Options | Values |
+============================+===================================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>` |
+----------------------------+-----------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation (.xml + .bin), ONNX (.onnx) |
+----------------------------+-----------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+----------------------------+-----------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_classification_sample_async_README>` |
+----------------------------+-----------------------------------------------------------------------------------+
.. tab-item:: Python API
The following Python API is used in the application:
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------+
| Feature | API | Description |
+====================+===========================================================================================================================================================================================================+===========================+
| Asynchronous Infer | `openvino.runtime.AsyncInferQueue <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html>`__ , | Do asynchronous inference |
| | `openvino.runtime.AsyncInferQueue.set_callback <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html#openvino.runtime.AsyncInferQueue.set_callback>`__ , | |
| | `openvino.runtime.AsyncInferQueue.start_async <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html#openvino.runtime.AsyncInferQueue.start_async>`__ , | |
| | `openvino.runtime.AsyncInferQueue.wait_all <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html#openvino.runtime.AsyncInferQueue.wait_all>`__ , | |
| | `openvino.runtime.InferRequest.results <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.results>`__ | |
+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification Python Sample <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/classification_sample_async/classification_sample_async.py
:language: python
How It Works
############
At startup, the sample application reads command-line parameters, prepares input data, loads a specified model and image(s) to the OpenVINO™ Runtime plugin, performs synchronous inference, and processes output data, logging each step in a standard output stream.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
#######
Run the application with the ``-h`` option to see the usage message:
.. code-block:: sh
python classification_sample_async.py -h
Usage message:
.. code-block:: sh
usage: classification_sample_async.py [-h] -m MODEL -i INPUT [INPUT ...]
[-d DEVICE]
Options:
-h, --help Show this help message and exit.
-m MODEL, --model MODEL
Required. Path to an .xml or .onnx file with a trained
model.
-i INPUT [INPUT ...], --input INPUT [INPUT ...]
Required. Path to an image file(s).
-d DEVICE, --device DEVICE
Optional. Specify the target device to infer on; CPU,
GPU or HETERO: is acceptable. The sample
will look for a suitable plugin for device specified.
Default value is CPU.
To run the sample, you need specify a model and image:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
- You can use images from the media files collection available `here <https://storage.openvinotoolkit.org/data/test_data>`__ .
.. note::
- By default, OpenVINO™ Toolkit Samples and demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the sample or demo application or reconvert your model using model conversion API with ``reverse_input_channels`` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`.
- Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
- The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
- Stating flags that take only single option like `-m` multiple times, for example `python classification_sample_async.py -m model.xml -m model2.xml`, results in only the last value being used.
- The sample supports NCHW model layout only.
Example
+++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: sh
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model:
.. code-block:: sh
omz_downloader --name alexnet
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: sh
omz_converter --name alexnet
4. Perform inference of ``banana.jpg`` and ``car.bmp`` using the ``alexnet`` model on a ``GPU``, for example:
.. code-block:: sh
python classification_sample_async.py -m alexnet.xml -i banana.jpg car.bmp -d GPU
Sample Output
#############
The sample application logs each step in a standard output stream and outputs top-10 inference results.
.. code-block:: sh
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Reading the model: C:/test_data/models/alexnet.xml
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in asynchronous mode
[ INFO ] Image path: /test_data/images/banana.jpg
[ INFO ] Top 10 results:
[ INFO ] class_id probability
[ INFO ] --------------------
[ INFO ] 954 0.9707602
[ INFO ] 666 0.0216788
[ INFO ] 659 0.0032558
[ INFO ] 435 0.0008082
[ INFO ] 809 0.0004359
[ INFO ] 502 0.0003860
[ INFO ] 618 0.0002867
[ INFO ] 910 0.0002866
[ INFO ] 951 0.0002410
[ INFO ] 961 0.0002193
[ INFO ]
[ INFO ] Image path: /test_data/images/car.bmp
[ INFO ] Top 10 results:
[ INFO ] class_id probability
[ INFO ] --------------------
[ INFO ] 656 0.5120340
[ INFO ] 874 0.1142275
[ INFO ] 654 0.0697167
[ INFO ] 436 0.0615163
[ INFO ] 581 0.0552262
[ INFO ] 705 0.0304179
[ INFO ] 675 0.0151660
[ INFO ] 734 0.0151582
[ INFO ] 627 0.0148493
[ INFO ] 757 0.0120964
[ INFO ]
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,177 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_model_creation_sample_README}
Model Creation Python Sample
============================
.. meta::
:description: Learn how to create a model on the fly with a
provided weights file and infer it later using Synchronous
Inference Request (Python) API.
This sample demonstrates how to run inference using a :doc:`model <openvino_docs_OV_UG_Model_Representation>` built on the fly that uses weights from the LeNet classification model, which is known to work well on digit classification tasks. You do not need an XML file, the model is created from the source code on the fly.
.. tab-set::
.. tab-item:: Requirements
+------------------------------------------------+-----------------------------------------------------------------------------+
| Options | Values |
+================================================+=============================================================================+
| Validated Models | LeNet |
+------------------------------------------------+-----------------------------------------------------------------------------+
| Model Format | Model weights file (\*.bin) |
+------------------------------------------------+-----------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+------------------------------------------------+-----------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_model_creation_sample_README>` |
+------------------------------------------------+-----------------------------------------------------------------------------+
.. tab-item:: Python API
The following OpenVINO Python API is used in the application:
+------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| Feature | API | Description |
+==========================================+==============================================================================================================================================================+====================================================================================+
| Model Operations | `openvino.runtime.Model <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__ , | Managing of model |
| | `openvino.runtime.set_batch <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.set_batch.html>`__ , | |
| | `openvino.runtime.Model.input <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.input>`__ | |
+------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
| Opset operations | `openvino.runtime.op.Parameter <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.op.Parameter.html>`__ , | Description of a model topology using OpenVINO Python API |
| | `openvino.runtime.op.Constant <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.op.Constant.html>`__ , | |
| | `openvino.runtime.opset8.convolution <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.convolution.html>`__ , | |
| | `openvino.runtime.opset8.add <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.add.html>`__ , | |
| | `openvino.runtime.opset1.max_pool <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset1.max_pool.html>`__ , | |
| | `openvino.runtime.opset8.reshape <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.reshape.html>`__ , | |
| | `openvino.runtime.opset8.matmul <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.matmul.html>`__ , | |
| | `openvino.runtime.opset8.relu <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.relu.html>`__ , | |
| | `openvino.runtime.opset8.softmax <https://docs.openvino.ai/2023.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.softmax.html>`__ | |
+------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification Python* Sample <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>`.
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/model_creation_sample/model_creation_sample.py
:language: python
How It Works
############
At startup, the sample application does the following:
- Reads command line parameters
- :doc:`Build a Model <openvino_docs_OV_UG_Model_Representation>` and passed weights file
- Loads the model and input data to the OpenVINO™ Runtime plugin
- Performs synchronous inference and processes output data, logging each step in a standard output stream
You can see the explicit description of each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
#######
To run the sample, you need to specify model weights and device.
.. code-block:: console
python model_creation_sample.py <path_to_model> <device_name>
.. note::
- This sample supports models with FP32 weights only.
- The ``lenet.bin`` weights file was generated by :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` from the public LeNet model with the ``input_shape [64,1,28,28]`` parameter specified.
- The original model is available in the `Caffe* repository <https://github.com/BVLC/caffe/tree/master/examples/mnist>`__ on GitHub\*.
For example:
.. code-block:: console
python model_creation_sample.py lenet.bin GPU
Sample Output
#############
The sample application logs each step in a standard output stream and outputs 10 inference results.
.. code-block:: console
[ INFO ] Creating OpenVINO Runtime Core
[ INFO ] Loading the model using ngraph function with weights from lenet.bin
[ INFO ] Loading the model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Top 1 results:
[ INFO ] Image 0
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 0 1.0000000 0
[ INFO ]
[ INFO ] Image 1
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 1 1.0000000 1
[ INFO ]
[ INFO ] Image 2
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 2 1.0000000 2
[ INFO ]
[ INFO ] Image 3
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 3 1.0000000 3
[ INFO ]
[ INFO ] Image 4
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 4 1.0000000 4
[ INFO ]
[ INFO ] Image 5
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 5 1.0000000 5
[ INFO ]
[ INFO ] Image 6
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 6 1.0000000 6
[ INFO ]
[ INFO ] Image 7
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 7 1.0000000 7
[ INFO ]
[ INFO ] Image 8
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 8 1.0000000 8
[ INFO ]
[ INFO ] Image 9
[ INFO ]
[ INFO ] classid probability label
[ INFO ] -------------------------
[ INFO ] 9 1.0000000 9
[ INFO ]
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
See Also
########
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Using OpenVINO™ Toolkit Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Model Downloader <omz_tools_downloader>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,142 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_sync_benchmark_README}
Sync Benchmark Python Sample
============================
.. meta::
:description: Learn how to estimate performance of a model using Synchronous Inference Request (Python) API.
This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike :doc:`demos <omz_demos>` this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options.
.. tab-set::
.. tab-item:: Requirements
+--------------------------------+------------------------------------------------------------------------------+
| Options | Values |
+================================+==============================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, |
| | :doc:`googlenet-v1 <omz_models_model_googlenet_v1>`, |
| | :doc:`yolo-v3-tf <omz_models_model_yolo_v3_tf>`, |
| | :doc:`face-detection-0200 <omz_models_model_face_detection_0200>` |
+--------------------------------+------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation |
| | (\*.xml + \*.bin), ONNX (\*.onnx) |
+--------------------------------+------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+--------------------------------+------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_sync_benchmark_README>` |
+--------------------------------+------------------------------------------------------------------------------+
.. tab-item:: Python API
The following Python API is used in the application:
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Feature | API | Description |
+================================+=================================================+==============================================+
| OpenVINO Runtime Version | [openvino.runtime.get_version] | Get Openvino API version. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Basic Infer Flow | [openvino.runtime.Core], | Common API to do inference: compile a model, |
| | [openvino.runtime.Core.compile_model], | configure input tensors. |
| | [openvino.runtime.InferRequest.get_tensor] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Synchronous Infer | [openvino.runtime.InferRequest.infer], | Do synchronous inference. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Model Operations | [openvino.runtime.CompiledModel.inputs] | Get inputs of a model. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Tensor Operations | [openvino.runtime.Tensor.get_shape], | Get a tensor shape and its data. |
| | [openvino.runtime.Tensor.data] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/benchmark/sync_benchmark/sync_benchmark.py
:language: python
How It Works
####################
The sample compiles a model for a given device, randomly generates input data, performs synchronous inference multiple times for a given number of seconds. Then processes and reports performance results.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. code-block:: sh
python sync_benchmark.py <path_to_model> <device_name>(default: CPU)
To run the sample, you need to specify a model:
- You can use :doc:`public <omz_models_group_public>` or doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
.. note::
Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
++++++++++++++++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: sh
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model using:
.. code-block:: sh
omz_downloader --name googlenet-v1
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: sh
omz_converter --name googlenet-v1
4. Perform benchmarking using the ``googlenet-v1`` model on a ``CPU``:
.. code-block:: sh
python sync_benchmark.py googlenet-v1.xml
Sample Output
####################
The application outputs performance results.
.. code-block:: sh
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 2333 iterations
[ INFO ] Duration: 10003.59 ms
[ INFO ] Latency:
[ INFO ] Median: 3.90 ms
[ INFO ] Average: 4.29 ms
[ INFO ] Min: 3.30 ms
[ INFO ] Max: 10.11 ms
[ INFO ] Throughput: 233.22 FPS
See Also
####################
* :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Model Downloader <omz_tools_downloader>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -1,148 +0,0 @@
.. {#openvino_inference_engine_ie_bridges_python_sample_throughput_benchmark_README}
Throughput Benchmark Python Sample
==================================
.. meta::
:description: Learn how to estimate performance of a model using Asynchronous Inference Request (Python) API in throughput mode.
This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike :doc:`demos <omz_demos>` this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options.
The reported results may deviate from what :doc:`benchmark_app <openvino_inference_engine_tools_benchmark_tool_README>` reports. One example is model input precision for computer vision tasks. benchmark_app sets uint8, while the sample uses default model precision which is usually float32.
.. tab-set::
.. tab-item:: Requirements
+--------------------------------+------------------------------------------------------------------------------+
| Options | Values |
+================================+==============================================================================+
| Validated Models | :doc:`alexnet <omz_models_model_alexnet>`, |
| | :doc:`googlenet-v1 <omz_models_model_googlenet_v1>`, |
| | :doc:`yolo-v3-tf <omz_models_model_yolo_v3_tf>`, |
| | :doc:`face-detection-0200 <omz_models_model_face_detection_0200>` |
+--------------------------------+------------------------------------------------------------------------------+
| Model Format | OpenVINO™ toolkit Intermediate Representation |
| | (\*.xml + \*.bin), ONNX (\*.onnx) |
+--------------------------------+------------------------------------------------------------------------------+
| Supported devices | :doc:`All <openvino_docs_OV_UG_supported_plugins_Supported_Devices>` |
+--------------------------------+------------------------------------------------------------------------------+
| Other language realization | :doc:`C++ <openvino_inference_engine_samples_throughput_benchmark_README>` |
+--------------------------------+------------------------------------------------------------------------------+
.. tab-item:: Python API
The following Python API is used in the application:
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Feature | API | Description |
+================================+=================================================+==============================================+
| OpenVINO Runtime Version | [openvino.runtime.get_version] | Get Openvino API version. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Basic Infer Flow | [openvino.runtime.Core], | Common API to do inference: compile a model, |
| | [openvino.runtime.Core.compile_model] | configure input tensors. |
| | [openvino.runtime.InferRequest.get_tensor] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Asynchronous Infer | [openvino.runtime.AsyncInferQueue], | Do asynchronous inference. |
| | [openvino.runtime.AsyncInferQueue.start_async], | |
| | [openvino.runtime.AsyncInferQueue.wait_all], | |
| | [openvino.runtime.InferRequest.results] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Model Operations | [openvino.runtime.CompiledModel.inputs] | Get inputs of a model. |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
| Tensor Operations | [openvino.runtime.Tensor.get_shape], | Get a tensor shape and its data. |
| | [openvino.runtime.Tensor.data] | |
+--------------------------------+-------------------------------------------------+----------------------------------------------+
.. tab-item:: Sample Code
.. doxygensnippet:: samples/python/benchmark/throughput_benchmark/throughput_benchmark.py
:language: python
How It Works
####################
The sample compiles a model for a given device, randomly generates input data, performs asynchronous inference multiple times for a given number of seconds. Then processes and reports performance results.
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>` section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. code-block:: sh
python throughput_benchmark.py <path_to_model> <device_name>(default: CPU)
To run the sample, you need to specify a model:
- You can use :doc:`public <omz_models_group_public>` or :doc:`Intel's <omz_models_group_intel>` pre-trained models from the Open Model Zoo. The models can be downloaded using the :doc:`Model Downloader <omz_tools_downloader>`.
.. note::
Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using :doc:`model conversion API <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
Example
++++++++++++++++++++
1. Install the ``openvino-dev`` Python package to use Open Model Zoo Tools:
.. code-block:: sh
python -m pip install openvino-dev[caffe]
2. Download a pre-trained model using:
.. code-block:: sh
omz_downloader --name googlenet-v1
3. If a model is not in the IR or ONNX format, it must be converted. You can do this using the model converter:
.. code-block:: sh
omz_converter --name googlenet-v1
4. Perform benchmarking using the ``googlenet-v1`` model on a ``CPU``:
.. code-block:: sh
python throughput_benchmark.py googlenet-v1.xml
Sample Output
####################
The application outputs performance results.
.. code-block:: sh
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 2817 iterations
[ INFO ] Duration: 10012.65 ms
[ INFO ] Latency:
[ INFO ] Median: 13.80 ms
[ INFO ] Average: 14.10 ms
[ INFO ] Min: 8.35 ms
[ INFO ] Max: 28.38 ms
[ INFO ] Throughput: 281.34 FPS
See Also
####################
* :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
* :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Model Downloader <omz_tools_downloader>`
* :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`

View File

@ -0,0 +1,174 @@
.. {#openvino_sample_sync_benchmark}
Sync Benchmark Sample
=====================
.. meta::
:description: Learn how to estimate performance of a model using Synchronous Inference Request API (Python, C++).
This sample demonstrates how to estimate performance of a model using Synchronous
Inference Request API. It makes sense to use synchronous inference only in latency
oriented scenarios. Models with static input shapes are supported. Unlike
:doc:`demos <omz_demos>` this sample does not have other configurable command-line
arguments. Feel free to modify sample's source code to try out different options.
Before using the sample, refer to the following requirements:
- The sample accepts any file format supported by ``core.read_model``.
- The sample has been validated with: :doc:`alexnet <omz_models_model_alexnet>`,
:doc:`googlenet-v1 <omz_models_model_googlenet_v1>`, :doc:`yolo-v3-tf <omz_models_model_yolo_v3_tf>`,
:doc:`face-detection-0200 <omz_models_model_face_detection_0200>` models.
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
The sample compiles a model for a given device, randomly generates input data,
performs synchronous inference multiple times for a given number of seconds.
Then, it processes and reports performance results.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/benchmark/sync_benchmark/sync_benchmark.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/benchmark/sync_benchmark/main.cpp
:language: cpp
You can see the explicit description of
each sample step at :doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python sync_benchmark.py <path_to_model> <device_name>(default: CPU)
.. tab-item:: C++
:sync: cpp
.. code-block:: console
sync_benchmark <path_to_model> <device_name>(default: CPU)
To run the sample, you need to specify a model. You can get a model specific for
your inference task from one of model repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
Example
++++++++++++++++++++
1. Download a pre-trained model.
2. You can convert it by using:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: python
import openvino as ov
ov_model = ov.convert_model('./models/googlenet-v1')
# or, when model is a Python model object
ov_model = ov.convert_model(googlenet-v1)
.. tab-item:: CLI
:sync: cli
.. code-block:: console
ovc ./models/googlenet-v1
3. Perform benchmarking, using the ``googlenet-v1`` model on a ``CPU``:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python sync_benchmark.py googlenet-v1.xml
.. tab-item:: C++
:sync: cpp
.. code-block:: console
sync_benchmark googlenet-v1.xml
Sample Output
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The application outputs performance results.
.. code-block:: console
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 2333 iterations
[ INFO ] Duration: 10003.59 ms
[ INFO ] Latency:
[ INFO ] Median: 3.90 ms
[ INFO ] Average: 4.29 ms
[ INFO ] Min: 3.30 ms
[ INFO ] Max: 10.11 ms
[ INFO ] Throughput: 233.22 FPS
.. tab-item:: C++
:sync: cpp
The application outputs performance results.
.. code-block:: console
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 992 iterations
[ INFO ] Duration: 15009.8 ms
[ INFO ] Latency:
[ INFO ] Median: 14.00 ms
[ INFO ] Average: 15.13 ms
[ INFO ] Min: 9.33 ms
[ INFO ] Max: 53.60 ms
[ INFO ] Throughput: 66.09 FPS
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `Sync Benchmark Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/benchmark/sync_benchmark/README.md>`__
- `Sync Benchmark C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/benchmark/sync_benchmark/README.md>`__

View File

@ -0,0 +1,179 @@
.. {#openvino_sample_throughput_benchmark}
Throughput Benchmark Sample
===========================
.. meta::
:description: Learn how to estimate performance of a model using Asynchronous Inference Request API in throughput mode (Python, C++).
This sample demonstrates how to estimate performance of a model using Asynchronous
Inference Request API in throughput mode. Unlike :doc:`demos <omz_demos>` this sample
does not have other configurable command-line arguments. Feel free to modify sample's
source code to try out different options.
The reported results may deviate from what :doc:`benchmark_app <openvino_sample_benchmark_tool>`
reports. One example is model input precision for computer vision tasks. benchmark_app
sets ``uint8``, while the sample uses default model precision which is usually ``float32``.
Before using the sample, refer to the following requirements:
- The sample accepts any file format supported by ``core.read_model``.
- The sample has been validated with: :doc:`alexnet <omz_models_model_alexnet>`,
:doc:`googlenet-v1 <omz_models_model_googlenet_v1>`, :doc:`yolo-v3-tf <omz_models_model_yolo_v3_tf>`,
:doc:`face-detection-0200 <omz_models_model_face_detection_0200>` models.
- To build the sample, use instructions available at :ref:`Build the Sample Applications <build-samples>`
section in "Get Started with Samples" guide.
How It Works
####################
The sample compiles a model for a given device, randomly generates input data,
performs asynchronous inference multiple times for a given number of seconds.
Then, it processes and reports performance results.
.. tab-set::
.. tab-item:: Python
:sync: python
.. scrollbox::
.. doxygensnippet:: samples/python/benchmark/throughput_benchmark/throughput_benchmark.py
:language: python
.. tab-item:: C++
:sync: cpp
.. scrollbox::
.. doxygensnippet:: samples/cpp/benchmark/throughput_benchmark/main.cpp
:language: cpp
You can see the explicit description of each sample step at
:doc:`Integration Steps <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
section of "Integrate OpenVINO™ Runtime with Your Application" guide.
Running
####################
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python throughput_benchmark.py <path_to_model> <device_name>(default: CPU)
.. tab-item:: C++
:sync: cpp
.. code-block:: console
throughput_benchmark <path_to_model> <device_name>(default: CPU)
To run the sample, you need to specify a model. You can get a model specific for
your inference task from one of model repositories, such as TensorFlow Zoo, HuggingFace, or TensorFlow Hub.
Example
++++++++++++++++++++
1. Download a pre-trained model.
2. You can convert it by using:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: python
import openvino as ov
ov_model = ov.convert_model('./models/googlenet-v1')
# or, when model is a Python model object
ov_model = ov.convert_model(googlenet-v1)
.. tab-item:: CLI
:sync: cli
.. code-block:: console
ovc ./models/googlenet-v1
3. Perform benchmarking, using the ``googlenet-v1`` model on a ``CPU``:
.. tab-set::
.. tab-item:: Python
:sync: python
.. code-block:: console
python throughput_benchmark.py ./models/googlenet-v1.xml
.. tab-item:: C++
:sync: cpp
.. code-block:: console
throughput_benchmark ./models/googlenet-v1.xml
Sample Output
####################
.. tab-set::
.. tab-item:: Python
:sync: python
The application outputs performance results.
.. code-block:: console
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 2817 iterations
[ INFO ] Duration: 10012.65 ms
[ INFO ] Latency:
[ INFO ] Median: 13.80 ms
[ INFO ] Average: 14.10 ms
[ INFO ] Min: 8.35 ms
[ INFO ] Max: 28.38 ms
[ INFO ] Throughput: 281.34 FPS
.. tab-item:: C++
:sync: cpp
The application outputs performance results.
.. code-block:: console
[ INFO ] OpenVINO:
[ INFO ] Build ................................. <version>
[ INFO ] Count: 1577 iterations
[ INFO ] Duration: 15024.2 ms
[ INFO ] Latency:
[ INFO ] Median: 38.02 ms
[ INFO ] Average: 38.08 ms
[ INFO ] Min: 25.23 ms
[ INFO ] Max: 49.16 ms
[ INFO ] Throughput: 104.96 FPS
Additional Resources
####################
- :doc:`Integrate the OpenVINO™ Runtime with Your Application <openvino_docs_OV_UG_Integrate_OV_with_your_application>`
- :doc:`Get Started with Samples <openvino_docs_get_started_get_started_demos>`
- :doc:`Using OpenVINO Samples <openvino_docs_OV_UG_Samples_Overview>`
- :doc:`Convert a Model <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
- `Throughput Benchmark Python Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/python/benchmark/throughput_benchmark/README.md>`__
- `Throughput Benchmark C++ Sample on Github <https://github.com/openvinotoolkit/openvino/blob/master/samples/cpp/benchmark/throughput_benchmark/README.md>`__

View File

@ -59,7 +59,7 @@ For more details on plugin-specific feature limitations, see the corresponding p
Enumerating Available Devices
#######################################
The OpenVINO Runtime API features dedicated methods of enumerating devices and their capabilities. See the :doc:`Hello Query Device C++ Sample <openvino_inference_engine_samples_hello_query_device_README>`. This is an example output from the sample (truncated to device names only):
The OpenVINO Runtime API features dedicated methods of enumerating devices and their capabilities. See the :doc:`Hello Query Device C++ Sample <openvino_sample_hello_query_device>`. This is an example output from the sample (truncated to device names only):
.. code-block:: sh

View File

@ -64,7 +64,7 @@ CPU plugin supports the following data types as inference precision of internal
- ``i8`` (Intel® x86-64)
- ``u1`` (Intel® x86-64)
:doc:`Hello Query Device C++ Sample <openvino_inference_engine_samples_hello_query_device_README>` can be used to print out supported data types for all detected devices.
:doc:`Hello Query Device C++ Sample <openvino_sample_hello_query_device>` can be used to print out supported data types for all detected devices.
Quantized Data Types Specifics

View File

@ -75,7 +75,7 @@ For optimal work with POT quantized models, which include 2D convolutions on GNA
* Choose a compile target with priority on: cross-platform execution, performance, memory, or power optimization.
* To check interoperability in your application use: ``ov::intel_gna::execution_target`` and ``ov::intel_gna::compile_target``.
:doc:`Speech C++ Sample <openvino_inference_engine_samples_speech_sample_README>` can be used for experiments (see the ``-exec_target`` and ``-compile_target`` command line options).
:doc:`Speech C++ Sample <openvino_sample_automatic_speech_recognition>` can be used for experiments (see the ``-exec_target`` and ``-compile_target`` command line options).
Software Emulation Mode
@ -148,7 +148,7 @@ This mode is going to be deprecated soon. GNA supports the ``i16`` and ``i8`` qu
GNA users are encouraged to use the :doc:`Post-Training Optimization Tool <pot_introduction>` to get a model with
quantization hints based on statistics for the provided dataset.
:doc:`Hello Query Device C++ Sample <openvino_inference_engine_samples_hello_query_device_README>` can be used to print out supported data types for all detected devices.
:doc:`Hello Query Device C++ Sample <openvino_sample_hello_query_device>` can be used to print out supported data types for all detected devices.
:doc:`POT API Usage sample for GNA <pot_example_speech_README>` demonstrates how a model can be quantized for GNA, using POT API in two modes:
@ -219,7 +219,7 @@ Import model:
To compile a model, use either :ref:`compile Tool <openvino_ecosystem>` or
:doc:`Speech C++ Sample <openvino_inference_engine_samples_speech_sample_README>`.
:doc:`Speech C++ Sample <openvino_sample_automatic_speech_recognition>`.
Stateful Models
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@ -35,7 +35,7 @@ Device Naming Convention
* If the system does not have an integrated GPU, devices are enumerated, starting from 0.
* For GPUs with multi-tile architecture (multiple sub-devices in OpenCL terms), a specific tile may be addressed as ``GPU.X.Y``, where ``X,Y={0, 1, 2,...}``, ``X`` - id of the GPU device, ``Y`` - id of the tile within device ``X``
For demonstration purposes, see the :doc:`Hello Query Device C++ Sample <openvino_inference_engine_samples_hello_query_device_README>` that can print out the list of available devices with associated indices. Below is an example output (truncated to the device names only):
For demonstration purposes, see the :doc:`Hello Query Device C++ Sample <openvino_sample_hello_query_device>` that can print out the list of available devices with associated indices. Below is an example output (truncated to the device names only):
.. code-block:: sh
@ -135,7 +135,7 @@ Floating-point precision of a GPU primitive is selected based on operation preci
The newer generation Intel Iris Xe and Xe MAX GPUs provide accelerated performance for i8/u8 models. Hardware acceleration for ``i8``/``u8`` precision may be unavailable on older generation platforms. In such cases, a model is executed in the floating-point precision taken from IR.
Hardware support of ``u8``/``i8`` acceleration can be queried via the ``ov::device::capabilities`` property.
:doc:`Hello Query Device C++ Sample<openvino_inference_engine_samples_hello_query_device_README>` can be used to print out the supported data types for all detected devices.
:doc:`Hello Query Device C++ Sample <openvino_sample_hello_query_device>` can be used to print out the supported data types for all detected devices.
Supported Features

View File

@ -33,7 +33,7 @@ of ``ov::available_devices``, the string name of ``AVAILABLE_DEVICES`` and the t
static constexpr Property<std::vector<std::string>, PropertyMutability::RO> available_devices{"AVAILABLE_DEVICES"};
Refer to the :doc:`Hello Query Device C++ Sample <openvino_inference_engine_samples_hello_query_device_README>` sources and
Refer to the :doc:`Hello Query Device С++ Sample <openvino_sample_hello_query_device>` sources and
the :doc:`Multi-Device execution <openvino_docs_OV_UG_Running_on_multiple_devices>` documentation for examples of using
setting and getting properties in user applications.

View File

@ -153,7 +153,7 @@ When using the ``reshape`` method, you may take one of the approaches:
You can find the usage scenarios of the ``reshape`` method in
:doc:`Hello Reshape SSD Samples <openvino_inference_engine_samples_hello_reshape_ssd_README>`.
:doc:`Hello Reshape SSD Samples <openvino_sample_hello_reshape_ssd>`.
.. note::

View File

@ -62,7 +62,7 @@ Below are example-codes for the regular and async-based approaches to compare:
The technique can be generalized to any available parallel slack. For example, you can do inference and simultaneously encode the resulting or previous frames or run further inference, like emotion detection on top of the face detection results.
Refer to the `Object Detection C++ Demo <https://docs.openvino.ai/2023.3/omz_demos_object_detection_demo_cpp.html>`__ , `Object Detection Python Demo <https://docs.openvino.ai/2023.3/omz_demos_object_detection_demo_python.html>`__ (latency-oriented Async API showcase) and :doc:`Benchmark App Sample <openvino_inference_engine_samples_benchmark_app_README>` for complete examples of the Async API in action.
Refer to the `Object Detection C++ Demo <https://docs.openvino.ai/2023.3/omz_demos_object_detection_demo_cpp.html>`__ , `Object Detection Python Demo <https://docs.openvino.ai/2023.3/omz_demos_object_detection_demo_python.html>`__ (latency-oriented Async API showcase) and :doc:`Benchmark App Sample <openvino_sample_benchmark_tool>` for complete examples of the Async API in action.
.. note::

View File

@ -163,7 +163,7 @@ For example, use ``ov::hint::PerformanceMode::THROUGHPUT`` to prepare a general
Testing Performance of the Hints with the Benchmark_App
#######################################################
The ``benchmark_app``, that exists in both :doc:`C++ <openvino_inference_engine_samples_benchmark_app_README>` and :doc:`Python <openvino_inference_engine_tools_benchmark_tool_README>` versions, is the best way to evaluate the functionality of the performance hints for a particular device:
Using the :doc:`benchmark_app sample <openvino_sample_benchmark_tool>`is the best way to evaluate the functionality of the performance hints for a particular device:
* benchmark_app **-hint tput** -d 'device' -m 'path to your model'
* benchmark_app **-hint latency** -d 'device' -m 'path to your model'

View File

@ -309,7 +309,7 @@ The ``ov::hint::performance_mode`` property enables you to specify a performance
The THROUGHPUT and CUMULATIVE_THROUGHPUT hints below only improve performance in an asynchronous inference pipeline. For information on asynchronous inference, see the :doc:`Async API documentation <openvino_docs_OV_UG_Infer_request>` . The following notebooks provide examples of how to set up an asynchronous pipeline:
* :doc:`Image Classification Async Sample <openvino_inference_engine_samples_classification_sample_async_README>`
* :doc:`Image Classification Async Sample <openvino_sample_image_classification_async>`
* `Notebook - Asynchronous Inference with OpenVINO™ <notebooks/115-async-api-with-output.html>`__
* `Notebook - Automatic Device Selection with OpenVINO <notebooks/106-auto-device-with-output.html>`__
@ -492,7 +492,7 @@ For limited device choice:
benchmark_app d AUTO:CPU,GPU,GNA m <model> -i <input> -niter 1000
For more information, refer to the :doc:`C++ <openvino_inference_engine_samples_benchmark_app_README>` or :doc:`Python <openvino_inference_engine_tools_benchmark_tool_README>` version instructions.
For more information, refer to the :doc:`Benchmark Tool <openvino_sample_benchmark_tool>` article.
.. note::

View File

@ -206,7 +206,7 @@ The following are limitations of the current AUTO Batching implementations:
Testing Performance with Benchmark_app
######################################
The ``benchmark_app`` sample, that has both :doc:`C++ <openvino_inference_engine_samples_benchmark_app_README>` and :doc:`Python <openvino_inference_engine_tools_benchmark_tool_README>` versions, is the best way to evaluate the performance of Automatic Batching:
Using the :doc:`benchmark_app sample <openvino_sample_benchmark_tool>` is the best way to evaluate the performance of Automatic Batching:
- The most straightforward way is using the performance hints:

View File

@ -123,7 +123,7 @@ Here is an example command to evaluate performance of CPU + GPU:
./benchmark_app d MULTI:CPU,GPU m <model> -i <input> -niter 1000
For more information, refer to the :doc:`C++ <openvino_inference_engine_samples_benchmark_app_README>` or :doc:`Python <openvino_inference_engine_tools_benchmark_tool_README>` version instructions.
For more information, refer to the :doc:`Benchmark Tool <openvino_sample_benchmark_tool>` article.
.. note::

View File

@ -156,7 +156,7 @@ When you are running several inference requests in parallel, a device can proces
Use weak reference of infer_request (``ov::InferRequest*``, ``ov::InferRequest&``, ``std::weal_ptr<ov::InferRequest>``, etc.) in the callback. It is necessary to avoid cyclic references.
For more details, see the :doc:`Classification Async Sample <openvino_inference_engine_samples_classification_sample_async_README>`.
For more details, see the :doc:`Classification Async Sample <openvino_sample_image_classification_async>`.
You can use the ``ov::InferRequest::cancel`` method if you want to abort execution of the current inference request:

View File

@ -77,7 +77,7 @@ If installation was successful, you will see the list of available devices.
|------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [OpenVINO Runtime](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_OV_Runtime_User_Guide.html) | `openvino package` |**OpenVINO Runtime** is a set of C++ libraries with C and Python bindings providing a common API to deliver inference solutions on the platform of your choice. Use the OpenVINO Runtime API to read PyTorch\*, TensorFlow\*, TensorFlow Lite\*, ONNX\*, and PaddlePaddle\* models and execute them on preferred devices. OpenVINO Runtime uses a plugin architecture and includes the following plugins: [CPU](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_CPU.html), [GPU](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_GPU.html), [Auto Batch](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_Automatic_Batching.html), [Auto](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_AUTO.html), [Hetero](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_Hetero_execution.html).
| [OpenVINO Model Converter (OVC)](https://docs.openvino.ai/2023.3/openvino_docs_model_processing_introduction.html#convert-a-model-in-cli-ovc) | `ovc` |**OpenVINO Model Converter** converts models that were trained in popular frameworks to a format usable by OpenVINO components. <br>Supported frameworks include ONNX\*, TensorFlow\*, TensorFlow Lite\*, and PaddlePaddle\*. |
| [Benchmark Tool](https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html)| `benchmark_app` | **Benchmark Application** allows you to estimate deep learning inference performance on supported devices for synchronous and asynchronous modes. |
| [Benchmark Tool](https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html)| `benchmark_app` | **Benchmark Application** allows you to estimate deep learning inference performance on supported devices for synchronous and asynchronous modes. |
## Troubleshooting

View File

@ -329,7 +329,7 @@ Timing
Measure the time it takes to do inference on thousand images. This gives
an indication of performance. For more accurate benchmarking, use the
`Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
in OpenVINO. Note that many optimizations are possible to improve the
performance.

View File

@ -509,7 +509,7 @@ Performance Comparison
Measure the time it takes to do inference on twenty images. This gives
an indication of performance. For more accurate benchmarking, use the
`Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__.
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
Keep in mind that many optimizations are possible to improve the
performance.

View File

@ -406,7 +406,7 @@ Measure the time it takes to do inference on fifty images and compare
the result. The timing information gives an indication of performance.
For a fair comparison, we include the time it takes to process the
image. For more accurate benchmarking, use the `OpenVINO benchmark
tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__.
tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
Note that many optimizations are possible to improve the performance.
.. code:: ipython3

View File

@ -532,7 +532,7 @@ Frames Per Second (FPS) for images.
Finally, measure the inference performance of OpenVINO ``FP32`` and
``INT8`` models. For this purpose, use `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
in OpenVINO.
**Note**: The ``benchmark_app`` tool is able to measure the

View File

@ -623,7 +623,7 @@ Compare Performance of the Original and Quantized Models
--------------------------------------------------------
`Benchmark
Tool <https://docs.openvino.ai/latest/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/latest/openvino_sample_benchmark_tool.html>`__
is used to measure the inference performance of the ``FP16`` and
``INT8`` models.

View File

@ -75,7 +75,7 @@ run to compare GPU performance in different configurations. It also
provides the code for a basic end-to-end application that compiles a
model on GPU and uses it to run inference.
Introduction
Introduction
------------------------------------------------------
Originally, graphic processing units (GPUs) began as specialized chips,
@ -102,14 +102,14 @@ instructions <https://docs.openvino.ai/2023.3/openvino_docs_install_guides_confi
to configure OpenVINO to work with your GPU. Then, read on to learn how
to accelerate inference with GPUs in OpenVINO!
Install required packages
Install required packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
%pip install -q "openvino-dev>=2023.1.0"
%pip install -q tensorflow
# Fetch `notebook_utils` module
import urllib.request
urllib.request.urlretrieve(
@ -126,13 +126,13 @@ Install required packages
Checking GPUs with Query Device
Checking GPUs with Query Device
-------------------------------------------------------------------------
In this section, we will see how to list the available GPUs and check
their properties. Some of the key properties will also be defined.
List GPUs with core.available_devices
List GPUs with core.available_devices
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OpenVINO Runtime provides the ``available_devices`` method for checking
@ -143,7 +143,7 @@ appear.
.. code:: ipython3
import openvino as ov
core = ov.Core()
core.available_devices
@ -171,7 +171,7 @@ appear in the list, follow the steps described
to configure your GPU drivers to work with OpenVINO. Once we have the
GPUs working with OpenVINO, we can proceed with the next sections.
Check Properties with core.get_property
Check Properties with core.get_property
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get information about the GPUs, we can use device properties. In
@ -185,7 +185,7 @@ To get the value of a property, such as the device name, we can use the
.. code:: ipython3
device = "GPU"
core.get_property(device, "FULL_DEVICE_NAME")
@ -209,7 +209,7 @@ for that property.
print(f"{device} SUPPORTED_PROPERTIES:\n")
supported_properties = core.get_property(device, "SUPPORTED_PROPERTIES")
indent = len(max(supported_properties, key=len))
for property_key in supported_properties:
if property_key not in ('SUPPORTED_METRICS', 'SUPPORTED_CONFIG_KEYS', 'SUPPORTED_PROPERTIES'):
try:
@ -222,7 +222,7 @@ for that property.
.. parsed-literal::
GPU SUPPORTED_PROPERTIES:
AVAILABLE_DEVICES : ['0']
RANGE_FOR_ASYNC_INFER_REQUESTS: (1, 2, 1)
RANGE_FOR_STREAMS : (1, 2)
@ -245,7 +245,7 @@ for that property.
GPU_QUEUE_PRIORITY : Priority.MEDIUM
GPU_QUEUE_THROTTLE : Priority.MEDIUM
GPU_ENABLE_LOOP_UNROLLING : True
CACHE_DIR :
CACHE_DIR :
PERFORMANCE_HINT : PerformanceMode.LATENCY
COMPILATION_NUM_THREADS : 20
NUM_STREAMS : 1
@ -254,7 +254,7 @@ for that property.
DEVICE_ID : 0
Brief Descriptions of Key Properties
Brief Descriptions of Key Properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Each device has several properties as seen in the last command. Some of
@ -282,7 +282,7 @@ To learn more about devices and properties, see the `Query Device
Properties <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_query_api.html>`__
page.
Compiling a Model on GPU
Compiling a Model on GPU
------------------------------------------------------------------
Now, we know how to list the GPUs in the system and check their
@ -290,7 +290,7 @@ properties. We can easily use one for compiling and running models with
OpenVINO `GPU
plugin <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_GPU.html>`__.
Download and Convert a Model
Download and Convert a Model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This tutorial uses the ``ssdlite_mobilenet_v2`` model. The
@ -300,7 +300,7 @@ was trained on `Common Objects in Context
categories of object. For details, see the
`paper <https://arxiv.org/abs/1801.04381>`__.
Download and unpack the Model
Download and unpack the Model
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Use the ``download_file`` function from the ``notebook_utils`` to
@ -313,23 +313,23 @@ package is already downloaded.
import sys
import tarfile
from pathlib import Path
sys.path.append("../utils")
import notebook_utils as utils
# A directory where the model will be downloaded.
base_model_dir = Path("./model").expanduser()
model_name = "ssdlite_mobilenet_v2"
archive_name = Path(f"{model_name}_coco_2018_05_09.tar.gz")
# Download the archive
downloaded_model_path = base_model_dir / archive_name
if not downloaded_model_path.exists():
model_url = f"http://download.tensorflow.org/models/object_detection/{archive_name}"
utils.download_file(model_url, downloaded_model_path.name, downloaded_model_path.parent)
# Unpack the model
tf_model_path = base_model_dir / archive_name.with_suffix("").stem / "frozen_inference_graph.pb"
if not tf_model_path.exists():
@ -350,14 +350,14 @@ package is already downloaded.
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_msg_rate_limit`.
Current values:
NotebookApp.iopub_msg_rate_limit=1000.0 (msgs/sec)
NotebookApp.rate_limit_window=3.0 (secs)
Convert the Model to OpenVINO IR format
Convert the Model to OpenVINO IR format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To convert the model to OpenVINO IR with ``FP16`` precision, use model
@ -368,15 +368,15 @@ directory. For more details about model conversion, see this
.. code:: ipython3
from openvino.tools.mo.front import tf as ov_tf_front
precision = 'FP16'
# The output path for the conversion.
model_path = base_model_dir / 'ir_model' / f'{model_name}_{precision.lower()}.xml'
trans_config_path = Path(ov_tf_front.__file__).parent / "ssd_v2_support.json"
pipeline_config = base_model_dir / archive_name.with_suffix("").stem / "pipeline.config"
model = None
if not model_path.exists():
model = ov.tools.mo.convert_model(input_model=tf_model_path,
@ -402,7 +402,7 @@ directory. For more details about model conversion, see this
IR model saved to model/ir_model/ssdlite_mobilenet_v2_fp16.xml
Compile with Default Configuration
Compile with Default Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When the model is ready, first we need to read it, using the
@ -424,7 +424,7 @@ Selection <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins
page as well as the `AUTO device
tutorial <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/106-auto-device>`__.
Reduce Compile Time through Model Caching
Reduce Compile Time through Model Caching
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Depending on the model used, device-specific optimizations and network
@ -440,17 +440,17 @@ following:
import time
from pathlib import Path
# Create cache folder
cache_folder = Path("cache")
cache_folder.mkdir(exist_ok=True)
start = time.time()
core = Core()
# Set cache folder
core.set_property({'CACHE_DIR': cache_folder})
# Compile the model as before
model = core.read_model(model=model_path)
compiled_model = core.compile_model(model, device)
@ -473,7 +473,7 @@ compile times with caching enabled and disabled as follows:
model = core.read_model(model=model_path)
compiled_model = core.compile_model(model, device)
print(f"Cache enabled - compile time: {time.time() - start}s")
start = time.time()
core = Core()
model = core.read_model(model=model_path)
@ -493,7 +493,7 @@ optimizing an application. To read more about this, see the `Model
Caching <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_Model_caching_overview.html>`__
docs.
Throughput and Latency Performance Hints
Throughput and Latency Performance Hints
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To simplify device and pipeline configuration, OpenVINO provides
@ -523,7 +523,7 @@ available memory.
compiled_model = core.compile_model(model, device, {"PERFORMANCE_HINT": "THROUGHPUT"})
Using Multiple GPUs with Multi-Device and Cumulative Throughput
Using Multiple GPUs with Multi-Device and Cumulative Throughput
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The latency and throughput hints mentioned above are great and can make
@ -565,7 +565,7 @@ manually specify devices to use. Below is an example showing how to use
in OpenVINO as well as the `Asynchronous Inference
notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/115-async-api>`__.
Performance Comparison with benchmark_app
Performance Comparison with benchmark_app
-----------------------------------------------------------------------------------
Given all the different options available when compiling a model, it may
@ -585,7 +585,7 @@ Note that benchmark_app only requires the model path to run but both the
device and hint arguments will be useful to us. For more advanced
usages, the tool itself has other options that can be checked by running
``benchmark_app -h`` or reading the
`docs <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__.
`docs <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
The following example shows how to benchmark a simple model, using a GPU
with a latency focus:
@ -601,12 +601,12 @@ with a latency focus:
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
@ -635,7 +635,7 @@ with a latency focus:
[ INFO ] GPU_QUEUE_PRIORITY: Priority.MEDIUM
[ INFO ] GPU_QUEUE_THROTTLE: Priority.MEDIUM
[ INFO ] GPU_ENABLE_LOOP_UNROLLING: True
[ INFO ] CACHE_DIR:
[ INFO ] CACHE_DIR:
[ INFO ] PERFORMANCE_HINT: PerformanceMode.LATENCY
[ INFO ] COMPILATION_NUM_THREADS: 20
[ INFO ] NUM_STREAMS: 1
@ -644,7 +644,7 @@ with a latency focus:
[ INFO ] DEVICE_ID: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'image_tensor'!. This input will be filled with random values!
[ INFO ] Fill input 'image_tensor' with random values
[ INFO ] Fill input 'image_tensor' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 1 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 6.17 ms
@ -665,7 +665,7 @@ performance may depend on the hardware used. Generally, we should expect
GPU to be better than CPU, whereas multiple GPUs should be better than a
single GPU as long as there is enough work for each of them.
CPU vs GPU with Latency Hint
CPU vs GPU with Latency Hint
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: ipython3
@ -680,12 +680,12 @@ CPU vs GPU with Latency Hint
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
@ -717,7 +717,7 @@ CPU vs GPU with Latency Hint
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'image_tensor'!. This input will be filled with random values!
[ INFO ] Fill input 'image_tensor' with random values
[ INFO ] Fill input 'image_tensor' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 1 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 4.42 ms
@ -744,12 +744,12 @@ CPU vs GPU with Latency Hint
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
@ -778,7 +778,7 @@ CPU vs GPU with Latency Hint
[ INFO ] GPU_QUEUE_PRIORITY: Priority.MEDIUM
[ INFO ] GPU_QUEUE_THROTTLE: Priority.MEDIUM
[ INFO ] GPU_ENABLE_LOOP_UNROLLING: True
[ INFO ] CACHE_DIR:
[ INFO ] CACHE_DIR:
[ INFO ] PERFORMANCE_HINT: PerformanceMode.LATENCY
[ INFO ] COMPILATION_NUM_THREADS: 20
[ INFO ] NUM_STREAMS: 1
@ -787,7 +787,7 @@ CPU vs GPU with Latency Hint
[ INFO ] DEVICE_ID: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'image_tensor'!. This input will be filled with random values!
[ INFO ] Fill input 'image_tensor' with random values
[ INFO ] Fill input 'image_tensor' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 1 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 8.79 ms
@ -802,7 +802,7 @@ CPU vs GPU with Latency Hint
[ INFO ] Throughput: 189.21 FPS
CPU vs GPU with Throughput Hint
CPU vs GPU with Throughput Hint
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: ipython3
@ -817,12 +817,12 @@ CPU vs GPU with Throughput Hint
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] CPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
@ -854,7 +854,7 @@ CPU vs GPU with Throughput Hint
[ INFO ] PERFORMANCE_HINT_NUM_REQUESTS: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'image_tensor'!. This input will be filled with random values!
[ INFO ] Fill input 'image_tensor' with random values
[ INFO ] Fill input 'image_tensor' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 5 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 8.15 ms
@ -881,12 +881,12 @@ CPU vs GPU with Throughput Hint
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[Step 4/11] Reading model files
[ INFO ] Loading model files
@ -915,7 +915,7 @@ CPU vs GPU with Throughput Hint
[ INFO ] GPU_QUEUE_PRIORITY: Priority.MEDIUM
[ INFO ] GPU_QUEUE_THROTTLE: Priority.MEDIUM
[ INFO ] GPU_ENABLE_LOOP_UNROLLING: True
[ INFO ] CACHE_DIR:
[ INFO ] CACHE_DIR:
[ INFO ] PERFORMANCE_HINT: PerformanceMode.THROUGHPUT
[ INFO ] COMPILATION_NUM_THREADS: 20
[ INFO ] NUM_STREAMS: 2
@ -924,7 +924,7 @@ CPU vs GPU with Throughput Hint
[ INFO ] DEVICE_ID: 0
[Step 9/11] Creating infer requests and preparing input tensors
[ WARNING ] No input files were given for input 'image_tensor'!. This input will be filled with random values!
[ INFO ] Fill input 'image_tensor' with random values
[ INFO ] Fill input 'image_tensor' with random values
[Step 10/11] Measuring performance (Start inference asynchronously, 4 inference requests, limits: 60000 ms duration)
[ INFO ] Benchmarking in inference only mode (inputs filling are not included in measurement loop).
[ INFO ] First inference took 9.17 ms
@ -939,7 +939,7 @@ CPU vs GPU with Throughput Hint
[ INFO ] Throughput: 326.34 FPS
Single GPU vs Multiple GPUs
Single GPU vs Multiple GPUs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: ipython3
@ -954,12 +954,12 @@ Single GPU vs Multiple GPUs
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Device GPU.1 does not support performance hint property(-hint).
[ ERROR ] Config for device with 1 ID is not registered in GPU plugin
@ -983,14 +983,14 @@ Single GPU vs Multiple GPUs
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] AUTO
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ] GPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Device GPU.1 does not support performance hint property(-hint).
[Step 4/11] Reading model files
@ -1030,14 +1030,14 @@ Single GPU vs Multiple GPUs
[Step 2/11] Loading OpenVINO Runtime
[ INFO ] OpenVINO:
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ] Device info:
[ INFO ] GPU
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ] MULTI
[ INFO ] Build ................................. 2022.3.0-9052-9752fafe8eb-releases/2022/3
[ INFO ]
[ INFO ]
[ INFO ]
[ INFO ]
[Step 3/11] Setting device configuration
[ WARNING ] Device GPU.1 does not support performance hint property(-hint).
[Step 4/11] Reading model files
@ -1065,7 +1065,7 @@ Single GPU vs Multiple GPUs
RuntimeError: Config for device with 1 ID is not registered in GPU plugin
Basic Application Using GPUs
Basic Application Using GPUs
----------------------------------------------------------------------
We will now show an end-to-end object detection example using GPUs in
@ -1077,19 +1077,19 @@ found in each frame. The detections are then drawn on their
corresponding frame and saved as a video, which is displayed at the end
of the application.
Import Necessary Packages
Import Necessary Packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
import time
from pathlib import Path
import cv2
import numpy as np
from IPython.display import Video
from openvino.runtime import AsyncInferQueue, Core, InferRequest
# Instantiate OpenVINO Runtime
core = Core()
core.available_devices
@ -1103,7 +1103,7 @@ Import Necessary Packages
Compile the Model
Compile the Model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
@ -1112,11 +1112,11 @@ Compile the Model
model = core.read_model(model=model_path)
device_name = "GPU"
compiled_model = core.compile_model(model=model, device_name=device_name, config={"PERFORMANCE_HINT": "THROUGHPUT"})
# Get the input and output nodes
input_layer = compiled_model.input(0)
output_layer = compiled_model.output(0)
# Get the input size
num, height, width, channels = input_layer.shape
print('Model input shape:', num, height, width, channels)
@ -1127,7 +1127,7 @@ Compile the Model
Model input shape: 1 300 300 3
Load and Preprocess Video Frames
Load and Preprocess Video Frames
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
@ -1136,7 +1136,7 @@ Load and Preprocess Video Frames
video_file = "https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/video/Coco%20Walking%20in%20Berkeley.mp4"
video = cv2.VideoCapture(video_file)
framebuf = []
# Go through every frame of video and resize it
print('Loading video...')
while video.isOpened():
@ -1145,18 +1145,18 @@ Load and Preprocess Video Frames
print('Video loaded!')
video.release()
break
# Preprocess frames - convert them to shape expected by model
input_frame = cv2.resize(src=frame, dsize=(width, height), interpolation=cv2.INTER_AREA)
input_frame = np.expand_dims(input_frame, axis=0)
# Append frame to framebuffer
framebuf.append(input_frame)
print('Frame shape: ', framebuf[0].shape)
print('Number of frames: ', len(framebuf))
# Show original video file
# If the video does not display correctly inside the notebook, please open it with your favorite media player
Video(video_file)
@ -1170,7 +1170,7 @@ Load and Preprocess Video Frames
Number of frames: 288
Define Model Output Classes
Define Model Output Classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
@ -1191,10 +1191,10 @@ Define Model Output Classes
"teddy bear", "hair drier", "toothbrush", "hair brush"
]
Set up Asynchronous Pipeline
Set up Asynchronous Pipeline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Callback Definition
Callback Definition
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: ipython3
@ -1204,14 +1204,14 @@ Callback Definition
global frame_number
stop_time = time.time()
frame_number += 1
predictions = next(iter(infer_request.results.values()))
results[frame_id] = predictions[:10] # Grab first 10 predictions for this frame
total_time = stop_time - start_time
frame_fps[frame_id] = frame_number / total_time
Create Async Pipeline
Create Async Pipeline
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: ipython3
@ -1220,7 +1220,7 @@ Create Async Pipeline
infer_queue = AsyncInferQueue(compiled_model)
infer_queue.set_callback(completion_callback)
Perform Inference
Perform Inference
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
@ -1232,14 +1232,14 @@ Perform Inference
start_time = time.time()
for i, input_frame in enumerate(framebuf):
infer_queue.start_async({0: input_frame}, i)
infer_queue.wait_all() # Wait until all inference requests in the AsyncInferQueue are completed
stop_time = time.time()
# Calculate total inference time and FPS
total_time = stop_time - start_time
fps = len(framebuf) / total_time
time_per_frame = 1 / fps
time_per_frame = 1 / fps
print(f'Total time to infer all frames: {total_time:.3f}s')
print(f'Time per frame: {time_per_frame:.6f}s ({fps:.3f} FPS)')
@ -1250,27 +1250,27 @@ Perform Inference
Time per frame: 0.004744s (210.774 FPS)
Process Results
Process Results
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: ipython3
# Set minimum detection threshold
min_thresh = .6
# Load video
video = cv2.VideoCapture(video_file)
# Get video parameters
frame_width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
frame_height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = int(video.get(cv2.CAP_PROP_FPS))
fourcc = int(video.get(cv2.CAP_PROP_FOURCC))
# Create folder and VideoWriter to save output video
Path('./output').mkdir(exist_ok=True)
output = cv2.VideoWriter('output/output.mp4', fourcc, fps, (frame_width, frame_height))
# Draw detection results on every frame of video and save as a new video file
while video.isOpened():
current_frame = int(video.get(cv2.CAP_PROP_POS_FRAMES))
@ -1280,12 +1280,12 @@ Process Results
output.release()
video.release()
break
# Draw info at the top left such as current fps, the devices and the performance hint being used
cv2.putText(frame, f"fps {str(round(frame_fps[current_frame], 2))}", (5, 20), cv2.FONT_ITALIC, 0.6, (0, 0, 0), 1, cv2.LINE_AA)
cv2.putText(frame, f"device {device_name}", (5, 40), cv2.FONT_ITALIC, 0.6, (0, 0, 0), 1, cv2.LINE_AA)
cv2.putText(frame, f"device {device_name}", (5, 40), cv2.FONT_ITALIC, 0.6, (0, 0, 0), 1, cv2.LINE_AA)
cv2.putText(frame, f"hint {compiled_model.get_property('PERFORMANCE_HINT').name}", (5, 60), cv2.FONT_ITALIC, 0.6, (0, 0, 0), 1, cv2.LINE_AA)
# prediction contains [image_id, label, conf, x_min, y_min, x_max, y_max] according to model
for prediction in np.squeeze(results[current_frame]):
if prediction[2] > min_thresh:
@ -1294,13 +1294,13 @@ Process Results
x_max = int(prediction[5] * frame_width)
y_max = int(prediction[6] * frame_height)
label = classes[int(prediction[1])]
# Draw a bounding box with its label above it
cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), (0, 255, 0), 1, cv2.LINE_AA)
cv2.putText(frame, label, (x_min, y_min - 10), cv2.FONT_ITALIC, 1, (255, 0, 0), 1, cv2.LINE_AA)
output.write(frame)
# Show output video file
# If the video does not display correctly inside the notebook, please open it with your favorite media player
Video("output/output.mp4", width=800, embed=True)
@ -1322,7 +1322,7 @@ Process Results
Conclusion
Conclusion
----------------------------------------------------
This tutorial demonstrates how easy it is to use one or more GPUs in
@ -1334,19 +1334,11 @@ detected bounding boxes.
To read more about any of these topics, feel free to visit their
corresponding documentation:
- `GPU
Plugin <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_GPU.html>`__
- `AUTO
Plugin <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_AUTO.html>`__
- `Model
Caching <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_Model_caching_overview.html>`__
- `MULTI Device
Mode <https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Running_on_multiple_devices.html>`__
- `Query Device
Properties <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_query_api.html>`__
- `Configurations for GPUs with
OpenVINO <https://docs.openvino.ai/2023.3/openvino_docs_install_guides_configurations_for_intel_gpu.html>`__
- `Benchmark Python
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
- `Asynchronous
Inferencing <https://docs.openvino.ai/2023.3/openvino_docs_ov_plugin_dg_async_infer_request.html>`__
- `GPU Plugin <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_GPU.html>`__
- `AUTO Plugin <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_AUTO.html>`__
- `Model Caching <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_Model_caching_overview.html>`__
- `MULTI Device Mode <https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Running_on_multiple_devices.html>`__
- `Query Device Properties <https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_query_api.html>`__
- `Configurations for GPUs with OpenVINO <https://docs.openvino.ai/2023.3/openvino_docs_install_guides_configurations_for_intel_gpu.html>`__
- `Benchmark Python Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- `Asynchronous Inferencing <https://docs.openvino.ai/2023.3/openvino_docs_ov_plugin_dg_async_infer_request.html>`__

View File

@ -678,6 +678,6 @@ object detection model. Even if you experience much better performance
after running this notebook, please note this may not be valid for every
hardware or every model. For the most accurate results, please use
``benchmark_app`` `command-line
tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_benchmark_app_README.html>`__.
tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
Note that ``benchmark_app`` cannot measure the impact of some tricks
above, e.g., shared memory.

View File

@ -725,6 +725,6 @@ object detection model. Even if you experience much better performance
after running this notebook, please note this may not be valid for every
hardware or every model. For the most accurate results, please use
``benchmark_app`` `command-line
tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_benchmark_app_README.html>`__.
tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
Note that ``benchmark_app`` cannot measure the impact of some tricks
above.

View File

@ -127,7 +127,7 @@ Benchmark Model Performance
---------------------------------------------------------------------
To measure the inference performance of the IR model, use `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- an inference performance measurement tool in OpenVINO. Benchmark tool
is a command-line application that can be run in the notebook with
``! benchmark_app`` or ``%sx benchmark_app`` commands.

View File

@ -639,7 +639,7 @@ Compare Performance of the FP32 IR Model and Quantized Models
To measure the inference performance of the ``FP32`` and ``INT8``
models, we use `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- OpenVINOs inference performance measurement tool. Benchmark tool is a
command line application, part of OpenVINO development tools, that can
be run in the notebook with ``! benchmark_app`` or

View File

@ -738,7 +738,7 @@ IV. Compare performance of INT8 model and FP32 model in OpenVINO
Finally, measure the inference performance of the ``FP32`` and ``INT8``
models, using `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- an inference performance measurement tool in OpenVINO. By default,
Benchmark Tool runs inference for 60 seconds in asynchronous mode on
CPU. It returns inference speed as latency (milliseconds per image) and

View File

@ -382,7 +382,7 @@ Compare Performance of the Original and Quantized Models
Finally, measure the inference performance of the ``FP32`` and ``INT8``
models, using `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- an inference performance measurement tool in OpenVINO.
**NOTE**: For more accurate performance, it is recommended to run

View File

@ -235,7 +235,7 @@ Estimate Model Performance
--------------------------
`Benchmark
Tool <https://docs.openvino.ai/latest/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/latest/openvino_sample_benchmark_tool.html>`__
is used to measure the inference performance of the model on CPU and
GPU.

View File

@ -568,7 +568,7 @@ Benchmarking performance of converted model
Finally, use the OpenVINO `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
to measure the inference performance of the model.
NOTE: For more accurate performance, it is recommended to run

View File

@ -514,7 +514,7 @@ Benchmark the converted OpenVINO model using benchmark app
The OpenVINO toolkit provides a benchmarking application to gauge the
platform specific runtime performance that can be obtained under optimal
configuration parameters for a given model. For more details refer to:
https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html
https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html
Here, we use the benchmark application to obtain performance estimates
under optimal configuration for the knowledge graph model inference. We

View File

@ -933,8 +933,8 @@ advance and fill it in as the inference requests are executed.
Lets compare the models and plot the results.
**Note**: To get a more accurate benchmark, use the `Benchmark Python
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Note: To get a more accurate benchmark, use the `Benchmark Python
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
.. code:: ipython3

View File

@ -996,7 +996,7 @@ Compare Performance of the Original and Quantized Models
Finally, use the OpenVINO `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
to measure the inference performance of the ``FP32`` and ``INT8``
models.

View File

@ -981,13 +981,8 @@ Compare the Original and Quantized Models
-----------------------------------------
Compare performance of the Original and Quantized Models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Finally, use the OpenVINO
`Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Finally, use the OpenVINO `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
to measure the inference performance of the ``FP32`` and ``INT8``
models.

View File

@ -973,13 +973,8 @@ Compare the Original and Quantized Models
-----------------------------------------
Compare performance of the Original and Quantized Models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Finally, use the OpenVINO
`Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Finally, use the OpenVINO `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
to measure the inference performance of the ``FP32`` and ``INT8``
models.

View File

@ -949,7 +949,7 @@ Compare performance object detection models
Finally, use the OpenVINO `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
to measure the inference performance of the ``FP32`` and ``INT8``
models.

View File

@ -1526,9 +1526,9 @@ Run ``INT8`` model in automatic mask generation mode
Compare Performance of the Original and Quantized Models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Finally, use the OpenVINO
`Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Finally, use the OpenVINO `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
to measure the inference performance of the ``FP32`` and ``INT8``
models.

View File

@ -736,7 +736,7 @@ Compare performance time of the converted and optimized models
To measure the inference performance of OpenVINO FP16 and INT8 models,
use `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__.
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
**NOTE**: For more accurate performance, run ``benchmark_app`` in a
terminal/command prompt after closing other applications. Run

View File

@ -630,7 +630,7 @@ Compare Inference Speed
Measure inference speed with the `OpenVINO Benchmark
App <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__.
App <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__.
Benchmark App is a command line tool that measures raw inference
performance for a specified OpenVINO IR model. Run
@ -640,7 +640,7 @@ the ``-m`` parameter with asynchronous inference on CPU, for one minute.
Use the ``-d`` parameter to test performance on a different device, for
example an Intel integrated Graphics (iGPU), and ``-t`` to set the
number of seconds to run inference. See the
`documentation <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
`documentation <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
for more information.
This tutorial uses a wrapper function from `Notebook

View File

@ -718,7 +718,7 @@ Benchmark Model Performance by Computing Inference Time
Finally, measure the inference performance of the ``FP32`` and ``INT8``
models, using `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- inference performance measurement tool in OpenVINO. By default,
Benchmark Tool runs inference for 60 seconds in asynchronous mode on
CPU. It returns inference speed as latency (milliseconds per image) and

View File

@ -477,7 +477,7 @@ Benchmark Model Performance by Computing Inference Time
Finally, measure the inference performance of the ``FP32`` and ``INT8``
models, using `Benchmark
Tool <https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html>`__
Tool <https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html>`__
- an inference performance measurement tool in OpenVINO. By default,
Benchmark Tool runs inference for 60 seconds in asynchronous mode on
CPU. It returns inference speed as latency (milliseconds per image) and

View File

@ -2,7 +2,7 @@
This sample demonstrates how to execute an inference of image classification networks like AlexNet and GoogLeNet using Synchronous Inference Request API and input auto-resize feature.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_c_samples_hello_classification_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html)
## Requirements
@ -12,8 +12,8 @@ For more detailed information on how this sample works, check the dedicated [art
| Model Format | Inference Engine Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
| Validated images | The sample uses OpenCV\* to [read input image](https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56) (\*.bmp, \*.png) |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [C++](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_classification_README.html), |
| | [Python](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_python_sample_hello_classification_README.html) |
| Other language realization | [C++](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html), |
| | [Python](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html) |
Hello Classification C sample application demonstrates how to use the C API from OpenVINO in applications.

View File

@ -4,7 +4,7 @@ This sample demonstrates how to execute an inference of image classification net
Hello NV12 Input Classification C Sample demonstrates how to use the NV12 automatic input pre-processing API in your applications.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_c_samples_hello_nv12_input_classification_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_hello_nv12_input_classification.html)
## Requirements
@ -14,7 +14,7 @@ For more detailed information on how this sample works, check the dedicated [art
| Model Format | Inference Engine Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
| Validated images | An uncompressed image in the NV12 color format - \*.yuv |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [C++](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_nv12_input_classification_README.html) |
| Other language realization | [C++](https://docs.openvino.ai/2023.3/openvino_sample_hello_nv12_input_classification.html) |
The following C++ API is used in the application:
@ -28,6 +28,6 @@ The following C++ API is used in the application:
| | ``ov_preprocess_preprocess_steps_convert_color`` | |
Basic Inference Engine API is covered by [Hello Classification C sample](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_c_samples_hello_classification_README.html).
Basic Inference Engine API is covered by [Hello Classification C sample](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html).

View File

@ -2,7 +2,7 @@
This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike [demos](https://docs.openvino.ai/2023.3/omz_demos.html) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_sync_benchmark_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_sync_benchmark.html)
## Requirements
@ -15,7 +15,7 @@ For more detailed information on how this sample works, check the dedicated [art
| Model Format | OpenVINO™ toolkit Intermediate Representation |
| | (\*.xml + \*.bin), ONNX (\*.onnx) |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_python_sample_sync_benchmark_README.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_sample_sync_benchmark.html) |
The following C++ API is used in the application:

View File

@ -2,9 +2,9 @@
This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike [demos](https://docs.openvino.ai/2023.3/omz_demos.html) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options.
The reported results may deviate from what [benchmark_app](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_benchmark_app_README.html) reports. One example is model input precision for computer vision tasks. benchmark_app sets ``uint8``, while the sample uses default model precision which is usually ``float32``.
The reported results may deviate from what [benchmark_app](https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html) reports. One example is model input precision for computer vision tasks. benchmark_app sets ``uint8``, while the sample uses default model precision which is usually ``float32``.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_throughput_benchmark_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_throughput_benchmark.html)
## Requirements
@ -17,7 +17,7 @@ For more detailed information on how this sample works, check the dedicated [art
| Model Format | OpenVINO™ toolkit Intermediate Representation |
| | (\*.xml + \*.bin), ONNX (\*.onnx) |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_python_sample_throughput_benchmark_README.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_sample_throughput_benchmark.html) |
The following C++ API is used in the application:

View File

@ -2,14 +2,14 @@
This page demonstrates how to use the Benchmark C++ Tool to estimate deep learning inference performance on supported devices.
> **NOTE**: This page describes usage of the C++ implementation of the Benchmark Tool. For the Python implementation, refer to the [Benchmark Python Tool](https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html) page. The Python version is recommended for benchmarking models that will be used in Python applications, and the C++ version is recommended for benchmarking models that will be used in C++ applications. Both tools have a similar command interface and backend.
> **NOTE**: This page describes usage of the C++ implementation of the Benchmark Tool. For the Python implementation, refer to the [Benchmark Python Tool](https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html) page. The Python version is recommended for benchmarking models that will be used in Python applications, and the C++ version is recommended for benchmarking models that will be used in C++ applications. Both tools have a similar command interface and backend.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_benchmark_app_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html)
## Requriements
To use the C++ benchmark_app, you must first build it following the [Build the Sample Applications](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_Samples_Overview.html) instructions and then set up paths and environment variables by following the [Get Ready for Running the Sample Applications](https://docs.openvino.ai/2023.3/openvino_docs_get_started_get_started_demos.html) instructions. Navigate to the directory where the benchmark_app C++ sample binary was built.
> **NOTE**: If you installed OpenVINO Runtime using PyPI or Anaconda Cloud, only the [Benchmark Python Tool](https://docs.openvino.ai/2023.3/openvino_inference_engine_tools_benchmark_tool_README.html) is available, and you should follow the usage instructions on that page instead.
> **NOTE**: If you installed OpenVINO Runtime using PyPI or Anaconda Cloud, only the [Benchmark Python Tool](https://docs.openvino.ai/2023.3/openvino_sample_benchmark_tool.html) is available, and you should follow the usage instructions on that page instead.
The benchmarking application works with models in the OpenVINO IR, TensorFlow, TensorFlow Lite, PaddlePaddle, PyTorch and ONNX formats. If you need it, OpenVINO also allows you to [convert your models](https://docs.openvino.ai/2023.3/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html).

View File

@ -6,7 +6,7 @@ Models with only one input and output are supported.
In addition to regular images, the sample also supports single-channel ``ubyte`` images as an input for LeNet model.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_classification_sample_async_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_image_classification_async.html)
## Requirements
@ -16,7 +16,7 @@ For more detailed information on how this sample works, check the dedicated [art
| | [googlenet-v1](https://docs.openvino.ai/2023.3/omz_models_model_googlenet_v1.html) |
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_python_sample_classification_sample_async_README.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_sample_image_classification_async.html) |
The following C++ API is used in the application:

View File

@ -4,7 +4,7 @@ This sample demonstrates how to do inference of image classification models usin
Models with only one input and output are supported.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_classification_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html)
## Requirements
@ -14,8 +14,7 @@ For more detailed information on how this sample works, check the dedicated [art
| | [googlenet-v1](https://docs.openvino.ai/2023.3/omz_models_model_googlenet_v1.html) |
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [C](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_c_samples_hello_classification_README.html), |
| | [Python](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_python_sample_hello_classification_README.html) |
| Other language realization | [Python, C](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html), |
The following C++ API is used in the application:

View File

@ -2,7 +2,7 @@
This sample demonstrates how to execute an inference of image classification models with images in NV12 color format using Synchronous Inference Request API.
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_nv12_input_classification_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_hello_nv12_input_classification.html)
## Requirements
@ -12,7 +12,7 @@ For more detailed information on how this sample works, check the dedicated [art
| Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) |
| Validated images | An uncompressed image in the NV12 color format - \*.yuv |
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [C](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_c_samples_hello_nv12_input_classification_README.html) |
| Other language realization | [C](https://docs.openvino.ai/2023.3/openvino_sample_hello_nv12_input_classification.html) |
The following C++ API is used in the application:
@ -27,5 +27,5 @@ The following C++ API is used in the application:
| | ``ov::preprocess::PreProcessSteps::convert_color`` | |
Basic OpenVINO™ Runtime API is covered by [Hello Classification C++ sample](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_classification_README.html).
Basic OpenVINO™ Runtime API is covered by [Hello Classification C++ sample](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html).

View File

@ -2,14 +2,14 @@
This sample demonstrates how to execute an query OpenVINO™ Runtime devices, prints their metrics and default configuration values, using [Properties API](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_query_api.html).
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_query_device_README.html)
For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2023.3/openvino_sample_hello_query_device.html)
## Requirements
| Options | Values |
| ------------------------------| ----------------------------------------------------------------------------------------------------------------------------|
| Supported devices | [All](https://docs.openvino.ai/2023.3/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_inference_engine_ie_bridges_python_sample_hello_query_device_README.html) |
| Other language realization | [Python](https://docs.openvino.ai/2023.3/openvino_sample_hello_query_device.html) |
The following C++ API is used in the application:
@ -18,4 +18,4 @@ The following C++ API is used in the application:
| Available Devices | ``ov::Core::get_available_devices``, | Get available devices information and configuration for inference |
| | ``ov::Core::get_property`` | |
Basic OpenVINO™ Runtime API is covered by [Hello Classification C++ sample](https://docs.openvino.ai/2023.3/openvino_inference_engine_samples_hello_classification_README.html).
Basic OpenVINO™ Runtime API is covered by [Hello Classification C++ sample](https://docs.openvino.ai/2023.3/openvino_sample_hello_classification.html).

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