DOCS shift to rst - Model Creation C++ Sample & Model Creation Python* Sample (#16637)
This commit is contained in:
parent
bb20151c9d
commit
950b46ecad
@ -1,183 +1,220 @@
|
||||
# Model Creation C++ Sample {#openvino_inference_engine_samples_model_creation_sample_README}
|
||||
|
||||
This sample demonstrates how to execute an synchronous inference using [model](../../../docs/OV_Runtime_UG/model_representation.md) built on the fly which uses weights from LeNet classification model, which is known to work well on digit classification tasks.
|
||||
@sphinxdirective
|
||||
|
||||
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.
|
||||
|
||||
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`, `ov::Shape::size`, `ov::shape_size`| Operate with shape |
|
||||
| Tensor Operations | `ov::Tensor::get_byte_size`, `ov::Tensor:data` | Get tensor byte size and its 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`, `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` | Used to construct an OpenVINO model |
|
||||
+------------------------------------------+-----------------------------------------+---------------------------------------+
|
||||
| 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 [Hello Classification C++ sample](../hello_classification/README.md).
|
||||
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification C++ sample <openvino_inference_engine_samples_hello_classification_README>`.
|
||||
|
||||
| Options | Values |
|
||||
| :--- | :--- |
|
||||
| Validated Models | LeNet |
|
||||
| Model Format | model weights file (\*.bin) |
|
||||
| Validated images | single-channel `MNIST ubyte` images |
|
||||
| Supported devices | [All](../../../docs/OV_Runtime_UG/supported_plugins/Supported_Devices.md) |
|
||||
| Other language realization | [Python](../../../samples/python/model_creation_sample/README.md) |
|
||||
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
| 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>` |
|
||||
+---------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
|
||||
## How It Works
|
||||
How It Works
|
||||
############
|
||||
|
||||
At startup, the sample application does the following:
|
||||
|
||||
- Reads command line parameters
|
||||
- [Build a Model](../../../docs/OV_Runtime_UG/model_representation.md) and passed weights file
|
||||
- :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 [Integration Steps](../../../docs/OV_Runtime_UG/integrate_with_your_application.md) section of "Integrate OpenVINO™ Runtime with Your Application" guide.
|
||||
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
|
||||
Building
|
||||
########
|
||||
|
||||
To build the sample, please use instructions available at [Build the Sample Applications](../../../docs/OV_Runtime_UG/Samples_Overview.md) section in OpenVINO™ Toolkit Samples guide.
|
||||
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
|
||||
Running
|
||||
#######
|
||||
|
||||
```
|
||||
model_creation_sample <path_to_lenet_weights> <device>
|
||||
```
|
||||
.. code-block:: console
|
||||
|
||||
> **NOTES**:
|
||||
>
|
||||
> - 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 the [Model Optimizer](../../../docs/MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md) tool 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\*.
|
||||
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 the :doc:`Model Optimizer <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` tool 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:
|
||||
|
||||
```
|
||||
model_creation_sample lenet.bin GPU
|
||||
```
|
||||
.. code-block:: console
|
||||
|
||||
model_creation_sample lenet.bin GPU
|
||||
|
||||
## Sample Output
|
||||
Sample Output
|
||||
#############
|
||||
|
||||
The sample application logs each step in a standard output stream and outputs top-10 inference results.
|
||||
|
||||
```
|
||||
[ 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
|
||||
.. 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
|
||||
|
||||
|
||||
Top 1 results:
|
||||
|
||||
Image 0
|
||||
Deprecation Notice
|
||||
##################
|
||||
|
||||
classid probability label
|
||||
------- ----------- -----
|
||||
0 1.0000000 0
|
||||
+--------------------+------------------+
|
||||
| Deprecation Begins | June 1, 2020 |
|
||||
+====================+==================+
|
||||
| Removal Date | December 1, 2020 |
|
||||
+--------------------+------------------+
|
||||
|
||||
Image 1
|
||||
See Also
|
||||
########
|
||||
|
||||
classid probability label
|
||||
------- ----------- -----
|
||||
1 1.0000000 1
|
||||
- :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 Optimizer <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
|
||||
|
||||
Image 2
|
||||
@endsphinxdirective
|
||||
|
||||
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
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><strong>Deprecation Begins</strong></td>
|
||||
<td>June 1, 2020</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Removal Date</strong></td>
|
||||
<td>December 1, 2020</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## See Also
|
||||
|
||||
- [Integrate the OpenVINO™ Runtime with Your Application](../../../docs/OV_Runtime_UG/integrate_with_your_application.md)
|
||||
- [Using OpenVINO™ Toolkit Samples](../../../docs/OV_Runtime_UG/Samples_Overview.md)
|
||||
- [Model Optimizer](../../../docs/MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md)
|
||||
|
@ -1,146 +1,160 @@
|
||||
# Model Creation Python* Sample {#openvino_inference_engine_ie_bridges_python_sample_model_creation_sample_README}
|
||||
|
||||
This sample demonstrates how to run inference using a [model](../../../docs/OV_Runtime_UG/model_representation.md) 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.
|
||||
@sphinxdirective
|
||||
|
||||
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.
|
||||
|
||||
The following OpenVINO Python API is used in the application:
|
||||
|
||||
| Feature | API | Description |
|
||||
| :--------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------ |
|
||||
| Model Operations | [openvino.runtime.Model], [openvino.runtime.set_batch], [openvino.runtime.Model.input] | Managing of model |
|
||||
| Opset operations | [openvino.runtime.op.Parameter], [openvino.runtime.op.Constant], [openvino.runtime.opset8.convolution], [openvino.runtime.opset8.add], [openvino.runtime.opset1.max_pool], [openvino.runtime.opset8.reshape], [openvino.runtime.opset8.matmul], [openvino.runtime.opset8.relu], [openvino.runtime.opset8.softmax] | Description of a model topology using OpenVINO Python API |
|
||||
+------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
||||
| Feature | API | Description |
|
||||
+==========================================+==============================================================================================================================================================+====================================================================================+
|
||||
| Model Operations | `openvino.runtime.Model <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__ , | Managing of model |
|
||||
| | `openvino.runtime.set_batch <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.set_batch.html>`__ , | |
|
||||
| | `openvino.runtime.Model.input <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.input>`__ | |
|
||||
+------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
||||
| Opset operations | `openvino.runtime.op.Parameter <https://docs.openvino.ai/2022.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/2022.3/api/ie_python_api/_autosummary/openvino.runtime.op.Constant.html>`__ , | |
|
||||
| | `openvino.runtime.opset8.convolution <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.convolution.html>`__ , | |
|
||||
| | `openvino.runtime.opset8.add <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.add.html>`__ , | |
|
||||
| | `openvino.runtime.opset1.max_pool <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset1.max_pool.html>`__ , | |
|
||||
| | `openvino.runtime.opset8.reshape <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.reshape.html>`__ , | |
|
||||
| | `openvino.runtime.opset8.matmul <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.matmul.html>`__ , | |
|
||||
| | `openvino.runtime.opset8.relu <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.relu.html>`__ , | |
|
||||
| | `openvino.runtime.opset8.softmax <https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.softmax.html>`__ | |
|
||||
+------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
||||
|
||||
Basic OpenVINO™ Runtime API is covered by [Hello Classification Python* Sample](../hello_classification/README.md).
|
||||
Basic OpenVINO™ Runtime API is covered by :doc:`Hello Classification Python* Sample <openvino_inference_engine_ie_bridges_python_sample_hello_classification_README>`.
|
||||
|
||||
| Options | Values |
|
||||
| :------------------------- | :-------------------------------------------------------------------- |
|
||||
| Validated Models | LeNet |
|
||||
| Model Format | Model weights file (\*.bin) |
|
||||
| Supported devices | [All](../../../docs/OV_Runtime_UG/supported_plugins/Supported_Devices.md) |
|
||||
| Other language realization | [C++](../../../samples/cpp/model_creation_sample/README.md) |
|
||||
+------------------------------------------------+-----------------------------------------------------------------------------+
|
||||
| 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>` |
|
||||
+------------------------------------------------+-----------------------------------------------------------------------------+
|
||||
|
||||
## How It Works
|
||||
How It Works
|
||||
############
|
||||
|
||||
At startup, the sample application does the following:
|
||||
|
||||
- Reads command line parameters
|
||||
- [Build a Model](../../../docs/OV_Runtime_UG/model_representation.md) and passed weights file
|
||||
- :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 [Integration Steps](../../../docs/OV_Runtime_UG/integrate_with_your_application.md) section of "Integrate OpenVINO™ Runtime with Your Application" guide.
|
||||
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
|
||||
Running
|
||||
#######
|
||||
|
||||
To run the sample, you need to specify model weights and device.
|
||||
|
||||
```
|
||||
python model_creation_sample.py <path_to_model> <device_name>
|
||||
```
|
||||
.. 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 the [Model Optimizer](../../../docs/MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md) tool 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\*.
|
||||
.. note::
|
||||
|
||||
- This sample supports models with FP32 weights only.
|
||||
|
||||
- The ``lenet.bin`` weights file was generated by the :doc:`Model Optimizer <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` tool 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:
|
||||
|
||||
```
|
||||
python model_creation_sample.py lenet.bin GPU
|
||||
```
|
||||
.. code-block:: console
|
||||
|
||||
python model_creation_sample.py lenet.bin GPU
|
||||
|
||||
## Sample Output
|
||||
Sample Output
|
||||
#############
|
||||
|
||||
The sample application logs each step in a standard output stream and outputs 10 inference results.
|
||||
|
||||
```
|
||||
[ 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
|
||||
```
|
||||
.. 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
|
||||
See Also
|
||||
########
|
||||
|
||||
- [Integrate the OpenVINO™ Runtime with Your Application](../../../docs/OV_Runtime_UG/integrate_with_your_application.md)
|
||||
- [Using OpenVINO™ Toolkit Samples](../../../docs/OV_Runtime_UG/Samples_Overview.md)
|
||||
- [Model Downloader](@ref omz_tools_downloader)
|
||||
- [Model Optimizer](../../../docs/MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md)
|
||||
- :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:`Model Optimizer <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`
|
||||
|
||||
@endsphinxdirective
|
||||
|
||||
[openvino.runtime.Model]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html
|
||||
[openvino.runtime.set_batch]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.set_batch.html
|
||||
[openvino.runtime.Model.input]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.input
|
||||
[openvino.runtime.op.Parameter]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.op.Parameter.html
|
||||
[openvino.runtime.op.Constant]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.op.Constant.html
|
||||
[openvino.runtime.opset8.convolution]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.convolution.html
|
||||
[openvino.runtime.opset8.add]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.add.html
|
||||
[openvino.runtime.opset1.max_pool]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset1.max_pool.html
|
||||
[openvino.runtime.opset8.reshape]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.reshape.html
|
||||
[openvino.runtime.opset8.matmul]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.matmul.html
|
||||
[openvino.runtime.opset8.relu]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.relu.html
|
||||
[openvino.runtime.opset8.softmax]:https://docs.openvino.ai/2022.3/api/ie_python_api/_autosummary/openvino.runtime.opset8.softmax.html
|
||||
|
Loading…
Reference in New Issue
Block a user