Skip to content

Commit 60f4797

Browse files
Proofreading new notebooks (openvinotoolkit#928)
* proofreading * update * 110 * 115 * 116 * proofreading * resolve proofreading * proofreading update * 110 * 115 * 116 * proofreading * proofreading update * Update notebooks/118-optimize-preprocessing/118-optimize-preprocessing.ipynb * Update notebooks/218-vehicle-detection-and-recognition/218-vehicle-detection-and-recognition.ipynb * relative link to readme * Update notebooks/116-sparsity-optimization/116-sparsity-optimization.ipynb * revert * resolve proofreading * proofreading update * 110 * 115 * 116 * proofreading * proofreading * update * 110 * proofreading * proofreading update * relative link to readme * Update notebooks/118-optimize-preprocessing/118-optimize-preprocessing.ipynb * Update notebooks/218-vehicle-detection-and-recognition/218-vehicle-detection-and-recognition.ipynb * Update notebooks/116-sparsity-optimization/116-sparsity-optimization.ipynb * revert * Update README.md
1 parent 7347198 commit 60f4797

File tree

87 files changed

+1262
-866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1262
-866
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ or create an [issue](https://github.com/openvinotoolkit/openvino_notebooks/issue
267267
Please run it after activating the `openvino_env` virtual environment.
268268
- If you get an `ImportError`, doublecheck that you installed the Jupyter kernel. If necessary, choose the openvino\_env kernel from the _Kernel->Change Kernel_ menu) in Jupyter Lab or Jupyter Notebook
269269
- If OpenVINO is installed globally, do not run installation commands in a terminal where setupvars.bat or setupvars.sh are sourced.
270-
- For Windows installation, we recommend using _Command Prompt (cmd.exe)_, not _PowerShell_.
270+
- For Windows installation, it is recommended to use _Command Prompt (cmd.exe)_, not _PowerShell_.
271271

272272
[![-----------------------------------------------------](https://user-images.githubusercontent.com/10940214/155750931-fc094349-b6ec-4e1f-9f9a-113e67941119.jpg)](#-contributors)
273273
<div id='-contributors'/>

notebooks/002-openvino-api/002-openvino-api.ipynb

+3-1
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@
733733
]
734734
},
735735
{
736+
"attachments": {},
736737
"cell_type": "markdown",
737738
"id": "a9657dc5-9713-4d2b-a324-c8cd6195e79a",
738739
"metadata": {},
@@ -779,11 +780,12 @@
779780
]
780781
},
781782
{
783+
"attachments": {},
782784
"cell_type": "markdown",
783785
"id": "48e0a860-c93c-4b93-a684-f53cd66ec2e3",
784786
"metadata": {},
785787
"source": [
786-
"After running the previous cell, we know the model exists in the cache directory. We delete the compiled model and load it again. We measure the time it takes now."
788+
"After running the previous cell, we know the model exists in the cache directory. Then, we delete the compiled model and load it again. Now, we measure the time it takes now."
787789
]
788790
},
789791
{

notebooks/102-pytorch-onnx-to-openvino/102-pytorch-onnx-to-openvino.ipynb

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"This tutorial demonstrates step-by-step instructions on how to do inference on a PyTorch semantic segmentation model, using OpenVINO Runtime.\n",
1414
"\n",
1515
"First, the PyTorch model is exported in [ONNX](https://onnx.ai/) format and then converted to OpenVINO IR. Then the respective ONNX and OpenVINO IR models are loaded into OpenVINO Runtime to show model predictions.\n",
16-
"In this tutorial we will use LR-ASPP model with MobileNetV3 backbone. \n",
16+
"In this tutorial, we will use LR-ASPP model with MobileNetV3 backbone.\n",
1717
"\n",
1818
"According to the paper, [Searching for MobileNetV3](https://arxiv.org/pdf/1905.02244.pdf), LR-ASPP or Lite Reduced Atrous Spatial Pyramid Pooling has a lightweight and efficient segmentation decoder architecture. The diagram below illustrates the model architecture:\n",
1919
"\n",
@@ -70,7 +70,7 @@
7070
"source": [
7171
"### Settings\n",
7272
"\n",
73-
"Set a name for the model, then define width and height of the image that will be used by the network during inference. According to the input transforms function, the model is pretrained on images with a height of 520 and width of 780."
73+
"Set a name for the model, then define width and height of the image that will be used by the network during inference. According to the input transforms function, the model is pre-trained on images with a height of 520 and width of 780."
7474
]
7575
},
7676
{
@@ -104,12 +104,12 @@
104104
"### Load Model\n",
105105
"\n",
106106
"Generally, PyTorch models represent an instance of `torch.nn.Module` class, initialized by a state dictionary with model weights.\n",
107-
"Typical steps for getting a pretrained model:\n",
107+
"Typical steps for getting a pre-trained model:\n",
108108
"1. Create instance of model class\n",
109-
"2. Load checkpoint state dict, which contains pretrained model weights\n",
109+
"2. Load checkpoint state dict, which contains pre-trained model weights\n",
110110
"3. Turn model to evaluation for switching some operations to inference mode\n",
111-
" \n",
112-
"The `torchvision` module provides a ready to use set of functions for model class initialization. We will use `torchvision.models.segmentation.lraspp_mobilenet_v3_large`. You can directly pass pretrained model weights to the model initialization function using weights enum `LRASPP_MobileNet_V3_Large_Weights.COCO_WITH_VOC_LABELS_V1`. However, for demonstration purposes, we will create it separately. Download pretrained weights and load the model. This may take some time if you have not downloaded the model before."
111+
"\n",
112+
"The `torchvision` module provides a ready to use set of functions for model class initialization. We will use `torchvision.models.segmentation.lraspp_mobilenet_v3_large`. You can directly pass pre-trained model weights to the model initialization function using weights enum `LRASPP_MobileNet_V3_Large_Weights.COCO_WITH_VOC_LABELS_V1`. However, for demonstration purposes, we will create it separately. Download the pre-trained weights and load the model. This may take some time if you have not downloaded the model before."
113113
]
114114
},
115115
{
@@ -150,9 +150,9 @@
150150
"\n",
151151
"### Convert PyTorch model to ONNX\n",
152152
"\n",
153-
"OpenVINO supports PyTorch\\* models that are exported in ONNX\\* format. We will use the `torch.onnx.export` function to obtain the ONNX model, you can learn more about this feature in the [PyTorch documentation](https://pytorch.org/docs/stable/onnx.html), We need to provide a model object, example input for model tracing and path where the model will be saved. When providing example input, it is not necessary to use real data, dummy input data with specified shape is sufficient. Optionally, we can provide a target onnx opset for conversion and/or other parameters specified in documentation (e.g. input and output names or dynamic shapes).\n",
153+
"OpenVINO supports PyTorch models that are exported in ONNX format. We will use the `torch.onnx.export` function to obtain the ONNX model, you can learn more about this feature in the [PyTorch documentation](https://pytorch.org/docs/stable/onnx.html). We need to provide a model object, example input for model tracing and path where the model will be saved. When providing example input, it is not necessary to use real data, dummy input data with specified shape is sufficient. Optionally, we can provide a target onnx opset for conversion and/or other parameters specified in documentation (e.g. input and output names or dynamic shapes).\n",
154154
"\n",
155-
"Sometimes a warning will be shown, but in most cases it's harmless, so let's just filter it out. When the conversion is successful, the last line of the output will read: `ONNX model exported to model/lraspp_mobilenet_v3_large.onnx.` "
155+
"Sometimes a warning will be shown, but in most cases it is harmless, so let us just filter it out. When the conversion is successful, the last line of the output will read: `ONNX model exported to model/lraspp_mobilenet_v3_large.onnx.`"
156156
]
157157
},
158158
{

notebooks/102-pytorch-onnx-to-openvino/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ This notebook demonstrates how to do inference on a PyTorch semantic segmentatio
99

1010
## Notebook Contents
1111

12-
The notebook uses [Model Optimizer](https://docs.openvino.ai/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) to convert the open-source Lite-RASPP semantic segmentation model with a MoblieNet V3 Large backbone from [torchvision](https://pytorch.org/vision/main/models/lraspp.html), trained on [COCO](https://cocodataset.org) dataset images using 20 categories that are present in the [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html) dataset, to OpenVINO IR. It also shows how to do segmentation inference on an image, using [OpenVINO Runtime](https://docs.openvino.ai/latest/openvino_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html) and compares the results of the PyTorch model with the OpenVINO IR model.
12+
The notebook uses [Model Optimizer](https://docs.openvino.ai/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) to convert the open-source Lite-RASPP semantic segmentation model with a MobileNet V3 Large backbone from [torchvision](https://pytorch.org/vision/main/models/lraspp.html), trained on [COCO](https://cocodataset.org) dataset images using 20 categories that are present in the [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html) dataset, to OpenVINO IR. It also shows how to do segmentation inference on an image, using [OpenVINO Runtime](https://docs.openvino.ai/latest/openvino_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html) and compares the results of the PyTorch model with the OpenVINO IR model.
1313

1414
## Installation Instructions
1515

16-
If you have not installed all required dependencies, follow the [Installation Guide](../../README.md).
16+
If you have not installed all required dependencies, follow the [Installation Guide](../../README.md).

notebooks/103-paddle-to-openvino/103-paddle-to-openvino-classification.ipynb

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"id": "38c66e13",
67
"metadata": {
@@ -9,7 +10,7 @@
910
"source": [
1011
"# Convert a PaddlePaddle Model to OpenVINO™ IR\n",
1112
"\n",
12-
"This notebook shows how to convert a MobileNetV3 model from [PaddleHub](https://github.com/PaddlePaddle/PaddleHub), pretrained on the [ImageNet](https://www.image-net.org) dataset, to OpenVINO IR. It also shows how to perform classification inference on a sample image using [OpenVINO Runtime](https://docs.openvino.ai/latest/openvino_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html) and compares the results of the [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) model with the IR model. \n",
13+
"This notebook shows how to convert a MobileNetV3 model from [PaddleHub](https://github.com/PaddlePaddle/PaddleHub), pre-trained on the [ImageNet](https://www.image-net.org) dataset, to OpenVINO IR. It also shows how to perform classification inference on a sample image, using [OpenVINO Runtime](https://docs.openvino.ai/latest/openvino_docs_IE_DG_Deep_Learning_Inference_Engine_DevGuide.html) and compares the results of the [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) model with the IR model.\n",
1314
"\n",
1415
"Source of the [model](https://www.paddlepaddle.org.cn/hubdetail?name=mobilenet_v3_large_imagenet_ssld&en_category=ImageClassification)."
1516
]
@@ -58,6 +59,7 @@
5859
]
5960
},
6061
{
62+
"attachments": {},
6163
"cell_type": "markdown",
6264
"id": "137ef187",
6365
"metadata": {},
@@ -94,13 +96,14 @@
9496
]
9597
},
9698
{
99+
"attachments": {},
97100
"cell_type": "markdown",
98101
"id": "f42abed1",
99102
"metadata": {},
100103
"source": [
101104
"## Show Inference on PaddlePaddle Model\n",
102105
"\n",
103-
"In the next cell, we load the model, load and display an image, do inference on that image, and then show the top 3 prediction results."
106+
"In the next cell, we load the model, load and display an image, do inference on that image, and then show the top three prediction results."
104107
]
105108
},
106109
{
@@ -121,11 +124,12 @@
121124
]
122125
},
123126
{
127+
"attachments": {},
124128
"cell_type": "markdown",
125129
"id": "510082f7",
126130
"metadata": {},
127131
"source": [
128-
"`classifier.predict()` takes an image file name, reads the image, preprocesses the input, then returns the class labels and scores of the image. Preprocessing the image is done behind the scenes. The classification model returns an array with floating point values for each of the 1000 ImageNet classes. The higher the value, the more confident the network is that the class number corresponding to that value (the index of that value in the network output array) is the class number for the image. \n",
132+
"`classifier.predict()` takes an image file name, reads the image, preprocesses the input, then returns the class labels and scores of the image. Preprocessing the image is done behind the scenes. The classification model returns an array with floating point values for each of the 1000 ImageNet classes. The higher the value, the more confident the network is that the class number corresponding to that value (the index of that value in the network output array) is the class number for the image.\n",
129133
"\n",
130134
"To see PaddlePaddle's implementation for the classification function and for loading and preprocessing data, uncomment the next two cells."
131135
]
@@ -151,11 +155,12 @@
151155
]
152156
},
153157
{
158+
"attachments": {},
154159
"cell_type": "markdown",
155160
"id": "ec080a4d",
156161
"metadata": {},
157162
"source": [
158-
"The `classifier.get_config()` module shows the preprocessing configuration for the model. It should show that images are normalized, resized and cropped, and that the BGR image is converted to RGB before propagating it through the network. In the next cell, we get the `classifier.predictror.preprocess_ops` property that returns list of preprocessing operations to do inference on the OpenVINO IR model using the same method. "
163+
"The `classifier.get_config()` module shows the preprocessing configuration for the model. It should show that images are normalized, resized and cropped, and that the BGR image is converted to RGB before propagating it through the network. In the next cell, we get the `classifier.predictror.preprocess_ops` property that returns list of preprocessing operations to do inference on the OpenVINO IR model using the same method."
159164
]
160165
},
161166
{
@@ -175,11 +180,12 @@
175180
]
176181
},
177182
{
183+
"attachments": {},
178184
"cell_type": "markdown",
179185
"id": "f5e47e1f",
180186
"metadata": {},
181187
"source": [
182-
"It is useful to show the output of the `process_image()` function, to see the effect of cropping and resizing. Because of the normalization, the colors will look strange, and matplotlib will warn about clipping values. "
188+
"It is useful to show the output of the `process_image()` function, to see the effect of cropping and resizing. Because of the normalization, the colors will look strange, and matplotlib will warn about clipping values."
183189
]
184190
},
185191
{
@@ -197,6 +203,7 @@
197203
]
198204
},
199205
{
206+
"attachments": {},
200207
"cell_type": "markdown",
201208
"id": "597bbd42-7706-4b96-a6e7-75cc391d00f4",
202209
"metadata": {},
@@ -221,13 +228,14 @@
221228
]
222229
},
223230
{
231+
"attachments": {},
224232
"cell_type": "markdown",
225233
"id": "205deec3",
226234
"metadata": {},
227235
"source": [
228236
"## Convert the Model to OpenVINO IR Format\n",
229237
"\n",
230-
"Call the OpenVINO Model Optimizer tool to convert the PaddlePaddle model to OpenVINO IR, with FP32 precision. The models are saved to the current directory. We can add the mean values to the model with `--mean_values` and scale the output with the standard deviation with `--scale_values`. With these options, it is not necessary to normalize input data before propagating it through the network. However, to get the exact same output as the PaddlePaddle model, it is necessary to preprocess in the image in the same way. For this tutorial, we therefore do not add the mean and scale values to the model, and we use the `process_image` function, as described in the previous section, to ensure that both the IR and the PaddlePaddle model use the same preprocessing methods. We do show how to get the mean and scale values of the PaddleGAN model, so you can add them to the Model Optimizer command if you want. See the [PyTorch/ONNX to OpenVINO](../102-pytorch-onnx-to-openvino/102-pytorch-onnx-to-openvino.ipynb) notebook for a notebook where these options are used.\n",
238+
"Call the OpenVINO Model Optimizer tool to convert the PaddlePaddle model to OpenVINO IR, with FP32 precision. The models are saved to the current directory. You can add the mean values to the model with `--mean_values` and scale the output with the standard deviation with `--scale_values`. With these options, it is not necessary to normalize input data before propagating it through the network. However, to get the exact same output as the PaddlePaddle model, it is necessary to preprocess in the image in the same way. Therefore, for this tutorial, you do not add the mean and scale values to the model, and you use the `process_image` function, as described in the previous section, to ensure that both the IR and the PaddlePaddle model use the same preprocessing methods. It is explained how to get the mean and scale values of the PaddleGAN model, so you can add them to the Model Optimizer command if you want. See the [PyTorch/ONNX to OpenVINO](../102-pytorch-onnx-to-openvino/102-pytorch-onnx-to-openvino.ipynb) notebook, where these options are used.\n",
231239
"\n",
232240
"Run `! mo --help` in a code cell to show an overview of command line options for Model Optimizer. See the [Model Optimizer Developer Guide](https://docs.openvino.ai/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) for more information about Model Optimizer.\n",
233241
"\n",
@@ -295,6 +303,7 @@
295303
]
296304
},
297305
{
306+
"attachments": {},
298307
"cell_type": "markdown",
299308
"id": "7d249c27",
300309
"metadata": {},

notebooks/104-model-tools/104-model-tools.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,12 @@
260260
]
261261
},
262262
{
263+
"attachments": {},
263264
"cell_type": "markdown",
264265
"id": "7ea7e868-fd2d-4d11-9c87-7aa1f1301083",
265266
"metadata": {},
266267
"source": [
267-
"Having information of the model in a JSON file allows extracting the path to the model directory, and building the path to the OpenVINO IR file."
268+
"Having information of the model in a JSON file enables extraction of the path to the model directory, and building the path to the OpenVINO IR file."
268269
]
269270
},
270271
{

notebooks/105-language-quantize-bert/105-language-quantize-bert.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,15 @@
330330
]
331331
},
332332
{
333+
"attachments": {},
333334
"cell_type": "markdown",
334335
"id": "71c867d3",
335336
"metadata": {
336337
"id": "Re9-YhbBddh3"
337338
},
338339
"source": [
339340
"## Define Accuracy Metric Calculation\n",
340-
"In this step the `Metric` interface for MRPC task metrics is implemented. It is used for validating the accuracy of the models."
341+
"In this step, the `Metric` interface for MRPC task metrics is implemented. It is used for validating the accuracy of the models."
341342
]
342343
},
343344
{

notebooks/105-language-quantize-bert/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ The tutorial consists of the following steps:
1616
* Preparing the model for quantization.
1717
* Running optimization pipeline.
1818
* Comparing performance of the original and quantized models.
19+
20+
## Installation Instructions
21+
22+
If you have not installed all required dependencies, follow the [Installation Guide](../../README.md).

notebooks/106-auto-device/106-auto-device.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@
100100
]
101101
},
102102
{
103+
"attachments": {},
103104
"cell_type": "markdown",
104105
"id": "ee513ee2",
105106
"metadata": {},
106107
"source": [
107108
"## Convert the model to OpenVINO IR format\n",
108109
"\n",
109-
"Use Model Optimizer to convert the caffe model to OpenVINO IR with `FP16` precision. The models are saved to the `model/ir_model/` directory. For more information about Model Optimizer, see the [Model Optimizer Developer Guide](https://docs.openvino.ai/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html)."
110+
"Use Model Optimizer to convert the Caffe model to OpenVINO IR with `FP16` precision. The models are saved to the `model/ir_model/` directory. For more information about Model Optimizer, see the [Model Optimizer Developer Guide](https://docs.openvino.ai/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html)."
110111
]
111112
},
112113
{

0 commit comments

Comments
 (0)