[IE Samples Docs] Add rows with model download and conversion (#6626)

* Add information about model preparation

* Add the missed file extension for the onnx model

* [c] Add information about model preparation

* [cpp] Add information about model preparation

* Update the string about model converter

* Specify a model name at steps 1 and 2 of the running example
This commit is contained in:
Dmitry Pigasin authored and GitHub committed 2021-07-14 12:07:34 +03:00
1 parent 2378593bd5
commit 1cfe27ae1f
20 files changed
+399 -239

No files matched your search

@@ -60,8 +60,8 @@ To run the sample, you need specify a model and image:
Running the application with the `-h` option yields the following usage message:
```sh
./classification_sample_async -h
```
<path_to_sample>/classification_sample_async -h
InferenceEngine:
API version ............ <version>
Build .................. <build>
@@ -85,33 +85,43 @@ Options:
Running the application with the empty list of options yields the usage message given above and an error message.
You can do inference of an image using a trained [AlexNet network](https://docs.openvinotoolkit.org/latest/omz_models_model_alexnet.html) on GPU using the following command:
### Example
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README):
```
python <path_to_omz_tools>/downloader.py --name alexnet
```
```sh
./classification_sample_async -m <path_to_model>/alexnet_fp32.xml -i <path_to_image>/cat.bmp -d GPU
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:
```
python <path_to_omz_tools>/converter.py --name alexnet
```
3. Perform inference of `car.bmp` using `alexnet` model on a `GPU`, for example:
```
<path_to_sample>/classification_sample_async -m <path_to_model>/alexnet.xml -i <path_to_image>/car.bmp -d GPU
```
## Sample Output
By default the application outputs top-10 inference results for each infer request.
```sh
classification_sample_async -m alexnet_fp32/alexnet.xml -i car_1.bmp -d GPU
```
[ INFO ] InferenceEngine:
API version ............
Build ..................
Description ....... API
[ INFO ] Parsing input parameters
IE version ......... 2021.4.0
Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4
[ INFO ] Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] car_1.bmp
[ INFO ] C:\images\car.bmp
[ INFO ] Loading Inference Engine
[ INFO ] Device info:
GPU
clDNNPlugin version ......... <version>
Build ........... <build>
clDNNPlugin version ......... 2021.4.0
Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4
[ INFO ] Loading network files:
alexnet_fp32/alexnet.xml
[ INFO ] C:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\alexnet\FP32\alexnet.xml
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (749, 637) to (227, 227)
[ INFO ] Batch size is 1
@@ -132,20 +142,20 @@ classification_sample_async -m alexnet_fp32/alexnet.xml -i car_1.bmp -d GPU
Top 10 results:
Image car_1.bmp
Image C:\images\car.bmp
classid probability
------- -----------
656 0.5491584
874 0.1101241
654 0.0559816
436 0.0488046
581 0.0330480
705 0.0307707
734 0.0185521
627 0.0162536
675 0.0145008
757 0.0125437
656 0.6645315
654 0.1121185
581 0.0698451
874 0.0334973
436 0.0259718
817 0.0173190
675 0.0109321
511 0.0109075
569 0.0083093
717 0.0063173
[ INFO ] Execution successful
@@ -47,33 +47,45 @@ To run the sample, you need specify a model and image:
>
> - The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
You can do inference of an image using a trained AlexNet network on a GPU using the following command:
### Example
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README):
```
python <path_to_omz_tools>/downloader.py --name alexnet
```
```sh
./hello_classification <path_to_model>/alexnet_fp32.xml <path_to_image>/car.png GPU
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:
```
python <path_to_omz_tools>/converter.py --name alexnet
```
3. Perform inference of `car.bmp` using `alexnet` model on a `GPU`, for example:
```
<path_to_sample>/hello_classification <path_to_model>/alexnet.xml <path_to_image>/car.bmp GPU
```
## Sample Output
The application outputs top-10 inference results.
```sh
```
Top 10 results:
Image /opt/intel/openvino/deployment_tools/demo/car.png
Image C:\images\car.bmp
classid probability
------- -----------
479 0.7562194
511 0.0760387
436 0.0724114
817 0.0462140
656 0.0301230
661 0.0056171
581 0.0031623
468 0.0029917
717 0.0023081
627 0.0016193
656 0.6664789
654 0.1129405
581 0.0684867
874 0.0333845
436 0.0261321
817 0.0167310
675 0.0109796
511 0.0105919
569 0.0081782
717 0.0063356
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
```
@@ -64,17 +64,29 @@ ffmpeg -i cat.jpg -pix_fmt nv12 cat.yuv
>
> - The sample accepts models in ONNX format (.onnx) that do not require preprocessing.
You can perform inference on an NV12 image using a trained AlexNet network on CPU with the following command:
### Example
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README):
```
python <path_to_omz_tools>/downloader.py --name alexnet
```
```sh
./hello_nv12_input_classification <path_to_model>/alexnet_fp32.xml <path_to_image>/cat.yuv 300x300 CPU
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:
```
python <path_to_omz_tools>/converter.py --name alexnet
```
3. Perform inference of NV12 image using `alexnet` model on a `CPU`, for example:
```
<path_to_sample>/hello_nv12_input_classification <path_to_model>/alexnet.xml <path_to_image>/cat.yuv 300x300 CPU
```
## Sample Output
The application outputs top-10 inference results.
```sh
```
[ INFO ] Files were added: 1
[ INFO ] ./cat.yuv
Batch size is 1
@@ -27,8 +27,8 @@ To build the sample, please use instructions available at [Build the Sample Appl
To see quired information, run the following:
```sh
./hello_query_device -h
```
<path_to_sample>/hello_query_device -h
Usage : hello_query_device
```
@@ -36,8 +36,7 @@ Usage : hello_query_device
The application prints all available devices with their supported metrics and default values for configuration parameters:
```sh
./hello_query_device
```
Available devices:
Device: CPU
Metrics:
@@ -51,14 +51,26 @@ To run the sample, you need specify a model and image:
You can use the following command to do inference on CPU of an image using a trained SSD network:
```sh
hello_reshape_ssd <path_to_model> <path_to_image> <device> <batch>
```
<path_to_sample>/hello_reshape_ssd <path_to_model> <path_to_image> <device> <batch>
```
with one image and [person-detection-retail-0013](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0013_description_person_detection_retail_0013.html) model
### Example
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README):
```
python <path_to_omz_tools>/downloader.py --name person-detection-retail-0013
```
```sh
hello_reshape_ssd <path_to_model>/person-detection-retail-0013.xml <path_to_image>/inputImage.bmp CPU 1
2. `person-detection-retail-0013` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script:
```
python <path_to_omz_tools>/converter.py --name <model_name>
```
3. Perform inference of `person_detection.png` using `person-detection-retail-0013` model on a `GPU`, for example:
```
<path_to_sample>/hello_reshape_ssd <path_to_model>/person-detection-retail-0013.xml <path_to_image>/person_detection.png GPU 1
```
## Sample Output
@@ -67,13 +79,11 @@ The application renders an image with detected objects enclosed in rectangles. I
of the detected objects along with the respective confidence values and the coordinates of the
rectangles to the standard output stream.
```sh
hello_reshape_ssd person-detection-retail-0013/FP16/person-detection-retail-0013.xml person_detection.png CPU 1
```
Resizing network to the image size = [960x1699] with batch = 1
Resulting input shape = [1,3,960,1699]
Resulting output shape = [1,1,200,7]
[0,1] element, prob = 0.721457, bbox = (852.37,187.54)-(983.326,520.672), batch id = 0
[0,1] element, prob = 0.722292, bbox = (852.382,187.756)-(983.352,520.733), batch id = 0
The resulting image was saved in the file: hello_reshape_ssd_output.jpg
This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool
@@ -50,7 +50,7 @@ To run the sample, you need specify a model wights and ubyte image:
Running the application with the `-h` option yields the following usage message:
```sh
```
ngraph_function_creation_sample -h
[ INFO ] InferenceEngine:
API version ............<version>
@@ -75,8 +75,8 @@ Running the application with the empty list of options yields the usage message
You can do inference of an image using a pre-trained model on a GPU using the following command:
```sh
./ngraph_function_creation_sample -m <path_to_weights_file>/lenet.bin -i <path_to_image> -d GPU
```
<path_to_sample>/ngraph_function_creation_sample -m <path_to_weights_file>/lenet.bin -i <path_to_image> -d GPU
```
## Sample Output
@@ -41,9 +41,9 @@ To run the sample, you need specify a model and image:
- you can use [public](@ref omz_models_public_index) or [Intel's](@ref omz_models_intel_index) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader_README).
- you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data.
Running the application with the <code>-h</code> option yields the following usage message:
Running the application with the `-h` option yields the following usage message:
```sh
```
./object_detection_sample_ssd -h
InferenceEngine:
API version ............ <version>
@@ -75,18 +75,30 @@ Running the application with the empty list of options yields the usage message
>
> - The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing.
For example, to do inference on a CPU with the OpenVINO&trade; toolkit person detection SSD models, run one of the following commands:
### Example
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README):
```
python <path_to_omz_tools>/downloader.py --name person-detection-retail-0013
```
2. `person-detection-retail-0013` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script:
```
python <path_to_omz_tools>/converter.py --name <model_name>
```
3. For example, to do inference on a CPU with the OpenVINO&trade; toolkit person detection SSD models, run one of the following commands:
- with one image and [person-detection-retail-0013](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0013_description_person_detection_retail_0013.html) model
```sh
./object_detection_sample_ssd -m <path_to_model>/person-detection-retail-0013.xml -i <path_to_image>/inputImage.bmp -d CPU
```
<path_to_sample>/object_detection_sample_ssd -m <path_to_model>/person-detection-retail-0013.xml -i <path_to_image>/person_detection.png -d CPU
```
- with one image and [person-detection-retail-0002](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0002_description_person_detection_retail_0002.html) model
```sh
./object_detection_sample_ssd -m <path_to_model>/person-detection-retail-0002.xml -i <path_to_image>/inputImage.jpg -d GPU
```
<path_to_sample>/object_detection_sample_ssd -m <path_to_model>/person-detection-retail-0002.xml -i <path_to_image>/person_detection.png -d GPU
```
## Sample Output
@@ -95,7 +107,7 @@ The application outputs an image (`out_0.bmp`) with detected objects enclosed in
of the detected objects along with the respective confidence values and the coordinates of the
rectangles to the standard output stream.
```sh
```
object_detection_sample_ssd -m person-detection-retail-0013\FP16\person-detection-retail-0013.xml -i person_detection.png
[ INFO ] InferenceEngine:
API version ............ <version>
@@ -87,8 +87,7 @@ To build the sample, please use instructions available at [Build the Sample Appl
Running the application with the `-h` option yields the following usage message:
```sh
./speech_sample -h
```
[ INFO ] InferenceEngine:
API version ............ <version>
Build .................. <number>
@@ -132,8 +131,8 @@ Running the application with the empty list of options yields the usage message
You can use the following model optimizer command to convert a Kaldi nnet1 or nnet2 neural network to Inference Engine Intermediate Representation format:
```sh
python mo.py --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir <OUTPUT_MODEL_DIR>
```
python <path_to_mo>/mo.py --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir <OUTPUT_MODEL_DIR>
```
Assuming that the model optimizer (`mo.py`), Kaldi-trained neural network, `wsj_dnn5b.nnet`, and Kaldi class counts file, `wsj_dnn5b.counts`, are in the working directory this produces
@@ -151,8 +150,8 @@ All of them can be downloaded from [https://storage.openvinotoolkit.org/models_c
Once the IR is created, you can use the following command to do inference on Intel&reg; Processors with the GNA co-processor (or emulation library):
```sh
./speech_sample -d GNA_AUTO -bs 2 -i dev93_10.ark -m wsj_dnn5b.xml -o scores.ark -r dev93_scores_10.ark
```
<path_to_sample>/speech_sample -d GNA_AUTO -bs 2 -i <path_to_ark>/dev93_10.ark -m <path_to_model>/wsj_dnn5b.xml -o scores.ark -r <path_to_ark>/dev93_scores_10.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
@@ -170,7 +169,7 @@ All of them can be downloaded from [https://storage.openvinotoolkit.org/models_c
The acoustic log likelihood sequences for all utterances are stored in the file. Example `scores.ark` or `scores.npz`. If the `-r` option is used, a report on the statistical score error is generated for each utterance such as
the following:
```sh
```
./speech_sample -d GNA_AUTO -bs 2 -i dev93_10.ark -m wsj_dnn5b.xml -o scores.ark -r dev93_scores_10.ark
[ INFO ] InferenceEngine:
API version ............ <version>
@@ -40,10 +40,9 @@ To run the sample, you need specify a model and image:
- you can use [public](@ref omz_models_public_index) or [Intel's](@ref omz_models_intel_index) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader_README).
- you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data.
Running the application with the <code>-h</code> option yields the following usage message:
Running the application with the `-h` option yields the following usage message:
```sh
./style_transfer_sample -h
```
[ INFO ] InferenceEngine:
API version ............<version>
Build ..................<build>
@@ -65,7 +64,6 @@ Options:
-mean_val_b Mean values. Required if the model needs mean values for preprocessing and postprocessing.
Available target devices: <devices>
```
Running the application with the empty list of options yields the usage message given above and an error message.
@@ -78,37 +76,47 @@ Running the application with the empty list of options yields the usage message
>
> - The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing.
To perform inference of an image using a trained model of fast-neural-style-mosaic-onnx network on Intel® CPUs, use the following command:
### Example
1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README):
```
python <path_to_omz_tools>/downloader.py --name fast-neural-style-mosaic-onnx
```
```sh
./style_transfer_sample -i <path_to_image>/cat.bmp -m <path_to_model>/fast-neural-style-mosaic-onnx.onnx
2. `fast-neural-style-mosaic-onnx` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script:
```
python <path_to_omz_tools>/converter.py --name <model_name>
```
3. Perform inference of `car.bmp` and `cat.jpg` using `fast-neural-style-mosaic-onnx` model on a `GPU`, for example:
```
<path_to_sample>/style_transfer_sample -m <path_to_model>/fast-neural-style-mosaic-onnx.onnx -i <path_to_image>/car.bmp <path_to_image>/cat.jpg -d GPU
```
## Sample Output
The sample application logs each step in a standard output stream and creates an image (`out1.bmp`) or a sequence of images (`out1.bmp`, ..., `out<N>.bmp`) which are redrawn in style of the style transfer model used for the sample.
```sh
style_transfer_sample -m fast-neural-style-mosaic-onnx.onnx -i car.png car_1.bmp
```
[ INFO ] InferenceEngine:
API version ............ <version>
Build .................. <build>
Description ....... API
IE version ......... 2021.4.0
Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4
[ INFO ] Parsing input parameters
[ INFO ] Files were added: 2
[ INFO ] car.png
[ INFO ] car_1.bmp
[ INFO
[ INFO ] C:\images\car.bmp
[ INFO ] C:\images\cat.jpg
[ INFO ] Loading Inference Engine
[ INFO ] Device info:
CPU
MKLDNNPlugin version ......... <version>
Build ........... <build>
GPU
clDNNPlugin version ......... 2021.4.0
Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4
[ INFO ] Loading network files
[ INFO ] fast-neural-style-mosaic-onnx.onnx
[ INFO ] Loading network files:
[ INFO ] C:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\fast-neural-style-mosaic-onnx\fast-neural-style-mosaic-onnx.onnx
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (787, 259) to (224, 224)
[ WARNING ] Image is resized from (749, 637) to (224, 224)
[ WARNING ] Image is resized from (300, 300) to (224, 224)
[ INFO ] Batch size is 2
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the device