Skip to content

Commit

Permalink
Updating notebooks (openvinotoolkit#20865)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgolebiewski-intel authored Nov 6, 2023
1 parent 7d74dac commit a554611
Show file tree
Hide file tree
Showing 480 changed files with 30,170 additions and 18,377 deletions.
517 changes: 318 additions & 199 deletions docs/articles_en/learn_openvino/tutorials.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/nbdoc/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

repo_branch = "tree/main"

artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20230815220807/dist/rst_files/"
artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20231030220807/dist/rst_files/"

blacklisted_extensions = ['.xml', '.bin']

Expand Down
90 changes: 60 additions & 30 deletions docs/notebooks/001-hello-world-with-output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,52 @@ 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-with-output.html>`__
tutorial.
tutorial.

**Table of contents:**

- `Imports <#imports>`__
- `Download the Model and data samples <#download-the-model-and-data-samples>`__
- `Select inference device <#select-inference-device>`__
- `Load the Model <#load-the-model>`__
- `Load an Image <#load-an-image>`__
- `Do Inference <#do-inference>`__

- `Imports <#imports>`__
- `Download the Model and data samples <#download-the-model-and-data-samples>`__
- `Select inference device <#select-inference-device>`__
- `Load the Model <#load-the-model>`__
- `Load an Image <#load-an-image>`__
- `Do Inference <#do-inference>`__

.. code:: ipython3
# Install openvino package
!pip install -q "openvino==2023.1.0.dev20230811"
%pip install -q "openvino>=2023.1.0"
.. parsed-literal::
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
openvino-dev 2023.0.0 requires openvino==2023.0.0, but you have openvino 2023.1.0.dev20230811 which is incompatible.
Note: you may need to restart the kernel to use updated packages.
Imports
############################################
Imports
-------------------------------------------------

.. code:: ipython3
from pathlib import Path
import sys
import cv2
import matplotlib.pyplot as plt
import numpy as np
import openvino as ov
sys.path.append("../utils")
# Fetch `notebook_utils` module
import urllib.request
urllib.request.urlretrieve(
url='https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/main/notebooks/utils/notebook_utils.py',
filename='notebook_utils.py'
)
from notebook_utils import download_file
Download the Model and data samples
########################################################################
Download the Model and data samples
-----------------------------------------------------------------------------

.. code:: ipython3
Expand Down Expand Up @@ -84,10 +89,10 @@ Download the Model and data samples
artifacts/v3-small_224_1.0_float.bin: 0%| | 0.00/4.84M [00:00<?, ?B/s]
Select inference device
############################################################
Select inference device
-----------------------------------------------------------------

Select device from dropdown list for running inference using OpenVINO:
select device from dropdown list for running inference using OpenVINO

.. code:: ipython3
Expand All @@ -112,8 +117,8 @@ Select device from dropdown list for running inference using OpenVINO:
Load the Model
###################################################
Load the Model
--------------------------------------------------------

.. code:: ipython3
Expand All @@ -123,13 +128,19 @@ Load the Model
output_layer = compiled_model.output(0)
Load an Image
##################################################
Load an Image
-------------------------------------------------------

.. code:: ipython3
# Download the image from the openvino_notebooks storage
image_filename = download_file(
"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/coco.jpg",
directory="data"
)
# The MobileNet model expects images in RGB format.
image = cv2.cvtColor(cv2.imread(filename="../data/image/coco.jpg"), code=cv2.COLOR_BGR2RGB)
image = cv2.cvtColor(cv2.imread(filename=str(image_filename)), code=cv2.COLOR_BGR2RGB)
# Resize to MobileNet image shape.
input_image = cv2.resize(src=image, dsize=(224, 224))
Expand All @@ -140,11 +151,17 @@ Load an Image
.. image:: 001-hello-world-with-output_files/001-hello-world-with-output_11_0.png
.. parsed-literal::
data/coco.jpg: 0%| | 0.00/202k [00:00<?, ?B/s]
.. image:: 001-hello-world-with-output_files/001-hello-world-with-output_11_1.png

Do Inference
#################################################

Do Inference
------------------------------------------------------

.. code:: ipython3
Expand All @@ -153,9 +170,22 @@ Do Inference
.. code:: ipython3
# Convert the inference result to a class name.
imagenet_classes = open("../data/datasets/imagenet/imagenet_2012.txt").read().splitlines()
imagenet_filename = download_file(
"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/datasets/imagenet/imagenet_2012.txt",
directory="data"
)
imagenet_classes = imagenet_filename.read_text().splitlines()
.. parsed-literal::
data/imagenet_2012.txt: 0%| | 0.00/30.9k [00:00<?, ?B/s]
.. code:: ipython3
# The model description states that for this model, class 0 is a background.
# Therefore, a background must be added at the beginning of imagenet_classes.
imagenet_classes = ['background'] + imagenet_classes
Expand Down
6 changes: 3 additions & 3 deletions docs/notebooks/001-hello-world-with-output_files/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head><title>Index of /projects/ov-notebook/0.1.0-latest/20230815220807/dist/rst_files/001-hello-world-with-output_files/</title></head>
<head><title>Index of /projects/ov-notebook/0.1.0-latest/20231030220807/dist/rst_files/001-hello-world-with-output_files/</title></head>
<body bgcolor="white">
<h1>Index of /projects/ov-notebook/0.1.0-latest/20230815220807/dist/rst_files/001-hello-world-with-output_files/</h1><hr><pre><a href="../">../</a>
<a href="001-hello-world-with-output_10_0.png">001-hello-world-with-output_10_0.png</a> 16-Aug-2023 01:31 387941
<h1>Index of /projects/ov-notebook/0.1.0-latest/20231030220807/dist/rst_files/001-hello-world-with-output_files/</h1><hr><pre><a href="../">../</a>
<a href="001-hello-world-with-output_11_1.png">001-hello-world-with-output_11_1.png</a> 31-Oct-2023 00:35 387941
</pre><hr></body>
</html>
Loading

0 comments on commit a554611

Please sign in to comment.