* Extensibility guide with FE extensions and remove OV_FRAMEWORK_MAP from docs * Rework of Extensibility Intro, adopted examples to missing OPENVINO_FRAMEWORK_MAP * Removed OPENVINO_FRAMEWORK_MAP reference * Frontend extension detailed documentation * Fixed distributed snippets * Fixed snippet inclusion in FE extension document and chapter headers * Fixed wrong name in a snippet reference * Fixed test for template extension due to changed number of loaded extensions * Update docs/Extensibility_UG/frontend_extensions.md Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> * Minor fixes in extension snippets * Small grammar fix Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> * DOCS: transition banner (#10973) * transition banner * minor fix * update transition banner * updates * update custom.js * updates * updates * Documentation fixes (#11044) * Benchmark app usage * Fixed link to the devices * More fixes * Update docs/OV_Runtime_UG/multi_device.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Removed several hardcoded links Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Updated documentation for compile_tool (#11049) * Added deployment guide (#11060) * Added deployment guide * Added local distribution * Updates * Fixed more indentations * Removed obsolete code snippets (#11061) * Removed obsolete code snippets * NCC style * Fixed NCC for BA * Add a troubleshooting issue for PRC installation (#11074) * updates * adding gna to linux * add missing reference * update * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * update * minor updates * add gna item to yum and apt * add gna to get started page * update reference formatting * merge commit * add a troubleshooting issue * update * update * fix CVS-71846 Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * DOCS: fixed hardcoded links (#11100) * Fixes * Use links * applying reviewers comments to the Opt Guide (#11093) * applying reviewrs comments * fixed refs, more structuring (bold, bullets, etc) * refactoring tput/latency sections * next iteration (mostly latency), also brushed the auto-batching and other sections * updates sync/async images * common opts brushed * WIP tput redesigned * minor brushing of common and auto-batching * Tput fully refactored * fixed doc name in the link * moved int8 perf counters to the right section * fixed links * fixed broken quotes * fixed more links * add ref to the internals to the TOC * Added a note on the batch size Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com> * [80085] New images for docs (#11114) * change doc structure * fix manager tools * fix manager tools 3 step * fix manager tools 3 step * new img * new img for OV Runtime * fix steps * steps * fix intendents * change list * fix space * fix space * code snippets fix * change display * Benchmarks 2022 1 (#11130) * Minor fixes * Updates for 2022.1 * Edits according to the review * Edits according to review comments * Edits according to review comments * Edits according to review comments * Fixed table * Edits according to review comments * Removed config for Intel® Core™ i7-11850HE * Removed forward-tacotron-duration-prediction-241 graph * Added resnet-18-pytorch * Add info about Docker images in Deployment guide (#11136) * Renamed user guides (#11137) * fix screenshot (#11140) * More conservative recommendations on dynamic shapes usage in docs (#11161) * More conservative recommendations about using dynamic shapes * Duplicated statement from C++ part to Python part of reshape doc (no semantical changes) * Update ShapeInference.md (#11168) * Benchmarks 2022 1 updates (#11180) * Updated graphs * Quick fix for TODO in Dynamic Shapes article * Anchor link fixes * Fixed DM config (#11199) * DOCS: doxy sphinxtabs (#11027) * initial implementation of doxy sphinxtabs * fixes * fixes * fixes * fixes * fixes * WA for ignored visibility attribute * Fixes Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com> Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> Co-authored-by: Nikolay Tyukaev <nikolay.tyukaev@intel.com> Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> Co-authored-by: Yuan Xu <yuan1.xu@intel.com> Co-authored-by: Maxim Shevtsov <maxim.y.shevtsov@intel.com> Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com> Co-authored-by: Tatiana Savina <tatiana.savina@intel.com> Co-authored-by: Ilya Naumov <ilya.naumov@intel.com> Co-authored-by: Evgenya Stepyreva <evgenya.stepyreva@intel.com>
120 lines
8.9 KiB
Markdown
120 lines
8.9 KiB
Markdown
# Hello Classification Python* Sample {#openvino_inference_engine_ie_bridges_python_sample_hello_classification_README}
|
|
|
|
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.
|
|
|
|
The following Python API is used in the application:
|
|
|
|
| Feature | API | Description |
|
|
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| Basic Infer Flow | [openvino.runtime.Core], [openvino.runtime.Core.read_model], [openvino.runtime.Core.compile_model] | Common API to do inference |
|
|
| Synchronous Infer | [openvino.runtime.CompiledModel.infer_new_request] | Do synchronous inference |
|
|
| Model Operations | [openvino.runtime.Model.inputs], [openvino.runtime.Model.outputs] | Managing of model |
|
|
| Preprocessing | [openvino.preprocess.PrePostProcessor], [openvino.preprocess.InputTensorInfo.set_element_type],[openvino.preprocess.InputTensorInfo.set_layout],[openvino.preprocess.InputTensorInfo.set_spatial_static_shape],[openvino.preprocess.PreProcessSteps.resize],[openvino.preprocess.InputModelInfo.set_layout],[openvino.preprocess.OutputTensorInfo.set_element_type],[openvino.preprocess.PrePostProcessor.build] | 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 |
|
|
|
|
| Options | Values |
|
|
| :------------------------- | :------------------------------------------------------------------------------------------------------ |
|
|
| Validated Models | [alexnet](@ref omz_models_model_alexnet), [googlenet-v1](@ref omz_models_model_googlenet_v1) |
|
|
| Model Format | OpenVINO™ toolkit Intermediate Representation (.xml + .bin), ONNX (.onnx) |
|
|
| Supported devices | [All](../../../docs/OV_Runtime_UG/supported_plugins/Supported_Devices.md) |
|
|
| Other language realization | [C++](../../../samples/cpp/hello_classification/README.md), [C](../../c/hello_classification/README.md) |
|
|
|
|
## 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 [Integration Steps](../../../docs/OV_Runtime_UG/integrate_with_your_application.md) section of "Integrate OpenVINO™ Runtime with Your Application" guide.
|
|
|
|
## Running
|
|
|
|
```
|
|
python hello_classification.py <path_to_model> <path_to_image> <device_name>
|
|
```
|
|
|
|
To run the sample, you need specify a model and image:
|
|
- you can use [public](@ref omz_models_group_public) or [Intel's](@ref omz_models_group_intel) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader).
|
|
- you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data.
|
|
|
|
> **NOTES**:
|
|
>
|
|
> - 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 the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Embedding Preprocessing Computation](../../../docs/MO_DG/prepare_model/convert_model/Converting_Model.md).
|
|
>
|
|
> - Before running the sample with a trained model, make sure the model is converted to the intermediate representation (IR) format (\*.xml + \*.bin) using the [Model Optimizer tool](../../../docs/MO_DG/Deep_Learning_Model_Optimizer_DevGuide.md).
|
|
>
|
|
> - 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:
|
|
|
|
```
|
|
python -m pip install openvino-dev[caffe,onnx,tensorflow2,pytorch,mxnet]
|
|
```
|
|
|
|
2. Download a pre-trained model:
|
|
```
|
|
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:
|
|
|
|
```
|
|
omz_converter --name alexnet
|
|
```
|
|
|
|
4. Perform inference of `banana.jpg` using the `alexnet` model on a `GPU`, for example:
|
|
|
|
```
|
|
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.
|
|
|
|
```
|
|
[ 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
|
|
|
|
- [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)
|
|
|
|
<!-- [openvino.runtime.Core]:
|
|
[openvino.runtime.Core.read_model]:
|
|
[openvino.runtime.Core.compile_model]:
|
|
[openvino.runtime.CompiledModel.infer_new_request]:
|
|
[openvino.runtime.Model.inputs]:
|
|
[openvino.runtime.Model.outputs]:
|
|
[openvino.preprocess.PrePostProcessor]:
|
|
[openvino.preprocess.InputTensorInfo.set_element_type]:
|
|
[openvino.preprocess.InputTensorInfo.set_layout]:
|
|
[openvino.preprocess.InputTensorInfo.set_spatial_static_shape]:
|
|
[openvino.preprocess.PreProcessSteps.resize]:
|
|
[openvino.preprocess.InputModelInfo.set_layout]:
|
|
[openvino.preprocess.OutputTensorInfo.set_element_type]:
|
|
[openvino.preprocess.PrePostProcessor.build]: -->
|