Skip to content

Commit

Permalink
update script and notebooks without table of content (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Feb 9, 2024
1 parent 56027ae commit 19567a3
Show file tree
Hide file tree
Showing 152 changed files with 1,031 additions and 495 deletions.
11 changes: 9 additions & 2 deletions .ci/table_of_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def remove_old_tc(cell, idx):

def get_tc_line(title, title_for_tc, link, tc_list, titles_list):
# calc indents for Table of content
indents_num = (title.index(" ") - 2) * 4
try:
indents_num = (title.index(" ") - 2) * 4
except:
indents_num = -1

if len(tc_list) == 0 or indents_num < 0:
# when first list item have more than 1 indents the alignment would be broken
indents_num = 0
Expand Down Expand Up @@ -92,6 +96,9 @@ def generate_table_of_content(notebook_path: pathlib.Path):
with open(notebook_path, 'r', encoding='utf-8') as notebook_file:
notebook_json = json.load(notebook_file)

if not notebook_json["cells"]:
return

table_of_content_cell, table_of_content_cell_idx =\
find_tc_in_cell(notebook_json["cells"][0])

Expand Down Expand Up @@ -128,7 +135,7 @@ def generate_table_of_content(notebook_path: pathlib.Path):
table_of_content.append(new_line)
all_titles.append(title)

table_of_content = ["\n", "#### Table of contents:\n"] + table_of_content
table_of_content = ["\n", "#### Table of contents:\n\n"] + table_of_content + ["\n"]

if table_of_content_cell is not None:
table_of_content_cell = remove_old_tc(table_of_content_cell, table_of_content_cell_idx)
Expand Down
8 changes: 5 additions & 3 deletions notebooks/001-hello-world/001-hello-world.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"\n",
"A pre-trained [MobileNetV3 model](https://docs.openvino.ai/2023.3/omz_models_model_mobilenet_v3_small_1_0_224_tf.html) from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used in this tutorial. For more information about how OpenVINO IR models are created, refer to the [TensorFlow to OpenVINO](../101-tensorflow-classification-to-openvino/101-tensorflow-classification-to-openvino.ipynb) tutorial.\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Imports](#Imports)\n",
"- [Download the Model and data samples](#Download-the-Model-and-data-samples)\n",
"- [Select inference device](#Select-inference-device)\n",
"- [Load the Model](#Load-the-Model)\n",
"- [Load an Image](#Load-an-Image)\n",
"- [Do Inference](#Do-Inference)\n"
"- [Do Inference](#Do-Inference)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -330,4 +332,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
8 changes: 5 additions & 3 deletions notebooks/002-openvino-api/002-openvino-api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"\n",
"The notebook is divided into sections with headers. The next cell contains global requirements for installation and imports. Each section is standalone and does not depend on any previous sections. All models used in this tutorial are provided as examples. These model files can be replaced with your own models. The exact outputs will be different, but the process is the same. \n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Loading OpenVINO Runtime and Showing Info](#Loading-OpenVINO-Runtime-and-Showing-Info)\n",
"- [Loading a Model](#Loading-a-Model)\n",
" - [OpenVINO IR Model](#OpenVINO-IR-Model)\n",
Expand All @@ -27,7 +28,8 @@
"- [Reshaping and Resizing](#Reshaping-and-Resizing)\n",
" - [Change Image Size](#Change-Image-Size)\n",
" - [Change Batch Size](#Change-Batch-Size)\n",
"- [Caching a Model](#Caching-a-Model)\n"
"- [Caching a Model](#Caching-a-Model)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -1478,4 +1480,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
8 changes: 5 additions & 3 deletions notebooks/003-hello-segmentation/003-hello-segmentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@
"\n",
"In this tutorial, a pre-trained [road-segmentation-adas-0001](https://docs.openvino.ai/2023.3/omz_models_model_road_segmentation_adas_0001.html) model from the [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used. ADAS stands for Advanced Driver Assistance Services. The model recognizes four classes: background, road, curb and mark.\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Imports](#Imports)\n",
"- [Download model weights](#Download-model-weights)\n",
"- [Select inference device](#Select-inference-device)\n",
"- [Load the Model](#Load-the-Model)\n",
"- [Load an Image](#Load-an-Image)\n",
"- [Do Inference](#Do-Inference)\n",
"- [Prepare Data for Visualization](#Prepare-Data-for-Visualization)\n",
"- [Visualize data](#Visualize-data)\n"
"- [Visualize data](#Visualize-data)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -429,4 +431,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
8 changes: 5 additions & 3 deletions notebooks/004-hello-detection/004-hello-detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
"The [horizontal-text-detection-0001](https://docs.openvino.ai/2023.3/omz_models_model_horizontal_text_detection_0001.html) model from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used. It detects horizontal text in images and returns a blob of data in the shape of `[100, 5]`. Each detected text box is stored in the `[x_min, y_min, x_max, y_max, conf]` format, where the\n",
"`(x_min, y_min)` are the coordinates of the top left bounding box corner, `(x_max, y_max)` are the coordinates of the bottom right bounding box corner and `conf` is the confidence for the predicted class.\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Imports](#Imports)\n",
"- [Download model weights](#Download-model-weights)\n",
"- [Select inference device](#Select-inference-device)\n",
"- [Load the Model](#Load-the-Model)\n",
"- [Load an Image](#Load-an-Image)\n",
"- [Do Inference](#Do-Inference)\n",
"- [Visualize Results](#Visualize-Results)\n"
"- [Visualize Results](#Visualize-Results)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -405,4 +407,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"\n",
"This short tutorial shows how to convert a TensorFlow [MobileNetV3](https://docs.openvino.ai/2023.3/omz_models_model_mobilenet_v3_small_1_0_224_tf.html) image classification model to OpenVINO [Intermediate Representation](https://docs.openvino.ai/2023.3/openvino_docs_MO_DG_IR_and_opsets.html) (OpenVINO IR) format, using [Model Conversion API](https://docs.openvino.ai/2023.3/openvino_docs_model_processing_introduction.html). After creating the OpenVINO IR, load the model in [OpenVINO Runtime](https://docs.openvino.ai/nightly/openvino_docs_OV_UG_OV_Runtime_User_Guide.html) and do inference with a sample image. \n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Imports](#Imports)\n",
"- [Settings](#Settings)\n",
"- [Download model](#Download-model)\n",
Expand All @@ -22,7 +23,8 @@
" - [Get Model Information](#Get-Model-Information)\n",
" - [Load an Image](#Load-an-Image)\n",
" - [Do Inference](#Do-Inference)\n",
"- [Timing](#Timing)\n"
"- [Timing](#Timing)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -492,4 +494,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"\n",
"More information about the model is available in the [torchvision documentation](https://pytorch.org/vision/main/models/lraspp.html)\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Preparation](#Preparation)\n",
" - [Imports](#Imports)\n",
" - [Settings](#Settings)\n",
Expand All @@ -40,7 +41,8 @@
" - [Select inference device](#Select-inference-device)\n",
"- [PyTorch Comparison](#PyTorch-Comparison)\n",
"- [Performance Comparison](#Performance-Comparison)\n",
"- [References](#References)\n"
"- [References](#References)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -907,4 +909,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"\n",
"The RegNet model was proposed in [Designing Network Design Spaces](https://arxiv.org/abs/2003.13678) by Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollár. The authors design search spaces to perform Neural Architecture Search (NAS). They first start from a high dimensional search space and iteratively reduce the search space by empirically applying constraints based on the best-performing models sampled by the current search space. Instead of focusing on designing individual network instances, authors design network design spaces that parametrize populations of networks. The overall process is analogous to the classic manual design of networks but elevated to the design space level. The RegNet design space provides simple and fast networks that work well across a wide range of flop regimes.\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Prerequisites](#Prerequisites)\n",
"- [Load PyTorch Model](#Load-PyTorch-Model)\n",
" - [Prepare Input Data](#Prepare-Input-Data)\n",
Expand All @@ -39,7 +40,8 @@
" - [Traced Model](#Traced-Model)\n",
" - [Benchmark Traced Model Inference](#Benchmark-Traced-Model-Inference)\n",
" - [Convert PyTorch Traced Model to OpenVINO Intermediate Representation](#Convert-PyTorch-Traced-Model-to-OpenVINO-Intermediate-Representation)\n",
" - [Benchmark OpenVINO Model Inference Converted From Traced Model](#Benchmark-OpenVINO-Model-Inference-Converted-From-Traced-Model)\n"
" - [Benchmark OpenVINO Model Inference Converted From Traced Model](#Benchmark-OpenVINO-Model-Inference-Converted-From-Traced-Model)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -1166,4 +1168,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"\n",
"Source of the [model](https://www.paddlepaddle.org.cn/hubdetail?name=mobilenet_v3_large_imagenet_ssld&en_category=ImageClassification).\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Preparation](#Preparation)\n",
" - [Imports](#Imports)\n",
" - [Settings](#Settings)\n",
Expand All @@ -23,7 +24,8 @@
"- [Show Inference on OpenVINO Model](#Show-Inference-on-OpenVINO-Model)\n",
"- [Timing and Comparison](#Timing-and-Comparison)\n",
"- [Select inference device](#Select-inference-device)\n",
"- [References](#References)\n"
"- [References](#References)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -739,4 +741,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
8 changes: 5 additions & 3 deletions notebooks/104-model-tools/104-model-tools.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"# Working with Open Model Zoo Models\n",
"This tutorial shows how to download a model from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo), convert it to OpenVINO™ IR format, show information about the model, and benchmark the model.\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [OpenVINO and Open Model Zoo Tools](#OpenVINO-and-Open-Model-Zoo-Tools)\n",
"- [Preparation](#Preparation)\n",
" - [Model Name](#Model-Name)\n",
Expand All @@ -18,7 +19,8 @@
"- [Convert a Model to OpenVINO IR format](#Convert-a-Model-to-OpenVINO-IR-format)\n",
"- [Get Model Information](#Get-Model-Information)\n",
"- [Run Benchmark Tool](#Run-Benchmark-Tool)\n",
" - [Benchmark with Different Settings](#Benchmark-with-Different-Settings)\n"
" - [Benchmark with Different Settings](#Benchmark-with-Different-Settings)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -732,4 +734,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"id": "d89f8a6b",
"metadata": {},
"source": [
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Imports](#Imports)\n",
"- [Settings](#Settings)\n",
"- [Prepare the Model](#Prepare-the-Model)\n",
Expand All @@ -32,7 +33,8 @@
"- [Load and Test OpenVINO Model](#Load-and-Test-OpenVINO-Model)\n",
" - [Select inference device](#Select-inference-device)\n",
"- [Compare F1-score of FP32 and INT8 models](#Compare-F1-score-of-FP32-and-INT8-models)\n",
"- [Compare Performance of the Original, Converted and Quantized Models](#Compare-Performance-of-the-Original,-Converted-and-Quantized-Models)\n"
"- [Compare Performance of the Original, Converted and Quantized Models](#Compare-Performance-of-the-Original,-Converted-and-Quantized-Models)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -970,4 +972,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
8 changes: 5 additions & 3 deletions notebooks/106-auto-device/106-auto-device.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"\n",
"![auto](https://user-images.githubusercontent.com/15709723/161451847-759e2bdb-70bc-463d-9818-400c0ccf3c16.png)\n",
"\n",
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Import modules and create Core](#Import-modules-and-create-Core)\n",
"- [Convert the model to OpenVINO IR format](#Convert-the-model-to-OpenVINO-IR-format)\n",
"- [(1) Simplify selection logic](#(1)-Simplify-selection-logic)\n",
Expand All @@ -32,7 +33,8 @@
" - [Class and callback definition](#Class-and-callback-definition)\n",
" - [Inference with THROUGHPUT hint](#Inference-with-THROUGHPUT-hint)\n",
" - [Inference with LATENCY hint](#Inference-with-LATENCY-hint)\n",
" - [Difference in FPS and latency](#Difference-in-FPS-and-latency)\n"
" - [Difference in FPS and latency](#Difference-in-FPS-and-latency)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -820,4 +822,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"id": "664ecf1e",
"metadata": {},
"source": [
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Download and prepare model](#Download-and-prepare-model)\n",
" - [Obtain Pytorch model representation](#Obtain-Pytorch-model-representation)\n",
" - [Convert model to OpenVINO Intermediate Representation](#Convert-model-to-OpenVINO-Intermediate-Representation)\n",
Expand All @@ -32,7 +33,8 @@
"- [Quantization](#Quantization)\n",
"- [Check INT8 model inference result](#Check-INT8-model-inference-result)\n",
"- [Compare Performance of the Original and Quantized Models](#Compare-Performance-of-the-Original-and-Quantized-Models)\n",
"- [Compare Accuracy of the Original and Quantized Models](#Compare-Accuracy-of-the-Original-and-Quantized-Models)\n"
"- [Compare Accuracy of the Original and Quantized Models](#Compare-Accuracy-of-the-Original-and-Quantized-Models)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -1043,4 +1045,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
"id": "b6bb1c0f",
"metadata": {},
"source": [
"#### Table of contents:\n",
"\n",
"#### Table of contents:\n\n",
"- [Imports](#Imports)\n",
"- [Settings](#Settings)\n",
"- [Prepare the Model](#Prepare-the-Model)\n",
"- [Prepare LibriSpeech Dataset](#Prepare-LibriSpeech-Dataset)\n",
"- [Run Quantization](#Run-Quantization)\n",
"- [Model Usage Example with Inference Pipeline](#Model-Usage-Example-with-Inference-Pipeline)\n",
"- [Validate model accuracy on dataset](#Validate-model-accuracy-on-dataset)\n",
"- [Compare Performance of the Original and Quantized Models](#Compare-Performance-of-the-Original-and-Quantized-Models)\n"
"- [Compare Performance of the Original and Quantized Models](#Compare-Performance-of-the-Original-and-Quantized-Models)\n",
"\n"
]
},
{
Expand Down Expand Up @@ -916,4 +918,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading

0 comments on commit 19567a3

Please sign in to comment.