Skip to content

Commit 6fef4a0

Browse files
[DOCS] Update notebooks section for master (#26331)
Updating notebook section with new content.
1 parent 01ddcd2 commit 6fef4a0

File tree

230 files changed

+10943
-14820
lines changed

Some content is hidden

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

230 files changed

+10943
-14820
lines changed

docs/nbdoc/consts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
repo_owner = "openvinotoolkit"
77
repo_name = "openvino_notebooks"
88
repo_branch = "tree/main"
9-
artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20240806220807/dist/rst_files/"
9+
artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20240827220813/dist/rst_files/"
1010
blacklisted_extensions = ['.xml', '.bin']
1111
notebooks_repo = "https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/"
1212
notebooks_binder = "https://mybinder.org/v2/gh/openvinotoolkit/openvino_notebooks/HEAD?filepath="

docs/notebooks/3D-pose-estimation-with-output.rst

+105-112
Large diffs are not rendered by default.

docs/notebooks/3D-segmentation-point-clouds-with-output.rst

+29-36
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ Guide <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/README.
4646
.. code:: ipython3
4747
4848
import platform
49-
49+
5050
%pip install -q "openvino>=2023.1.0" "tqdm"
51-
51+
5252
if platform.system() != "Windows":
5353
%pip install -q "matplotlib>=3.4"
5454
else:
@@ -73,16 +73,16 @@ Imports
7373
import numpy as np
7474
import matplotlib.pyplot as plt
7575
import openvino as ov
76-
76+
7777
# Fetch `notebook_utils` module
7878
import requests
79-
79+
8080
r = requests.get(
8181
url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py",
8282
)
8383
open("notebook_utils.py", "w").write(r.text)
84-
85-
from notebook_utils import download_file
84+
85+
from notebook_utils import download_file, device_widget
8686
8787
Prepare the Model
8888
-----------------
@@ -120,9 +120,9 @@ API, see this
120120
.. code:: ipython3
121121
122122
ir_model_xml = onnx_model_path.with_suffix(".xml")
123-
123+
124124
core = ov.Core()
125-
125+
126126
if not ir_model_xml.exists():
127127
# Convert model to OpenVINO Model
128128
model = ov.convert_model(onnx_model_path)
@@ -142,37 +142,37 @@ Data Processing Module
142142
def load_data(point_file: Union[str, Path]):
143143
"""
144144
Load the point cloud data and convert it to ndarray
145-
145+
146146
Parameters:
147147
point_file: string, path of .pts data
148148
Returns:
149149
point_set: point clound represented in np.array format
150150
"""
151-
151+
152152
point_set = np.loadtxt(point_file).astype(np.float32)
153-
153+
154154
# normailization
155155
point_set = point_set - np.expand_dims(np.mean(point_set, axis=0), 0) # center
156156
dist = np.max(np.sqrt(np.sum(point_set**2, axis=1)), 0)
157157
point_set = point_set / dist # scale
158-
158+
159159
return point_set
160-
161-
160+
161+
162162
def visualize(point_set: np.ndarray):
163163
"""
164164
Create a 3D view for data visualization
165-
165+
166166
Parameters:
167167
point_set: np.ndarray, the coordinate data in X Y Z format
168168
"""
169-
169+
170170
fig = plt.figure(dpi=192, figsize=(4, 4))
171171
ax = fig.add_subplot(111, projection="3d")
172172
X = point_set[:, 0]
173173
Y = point_set[:, 2]
174174
Z = point_set[:, 1]
175-
175+
176176
# Scale the view of each axis to adapt to the coordinate data distribution
177177
max_range = np.array([X.max() - X.min(), Y.max() - Y.min(), Z.max() - Z.min()]).max() * 0.5
178178
mid_x = (X.max() + X.min()) * 0.5
@@ -181,12 +181,12 @@ Data Processing Module
181181
ax.set_xlim(mid_x - max_range, mid_x + max_range)
182182
ax.set_ylim(mid_y - max_range, mid_y + max_range)
183183
ax.set_zlim(mid_z - max_range, mid_z + max_range)
184-
184+
185185
plt.tick_params(labelsize=5)
186186
ax.set_xlabel("X", fontsize=10)
187187
ax.set_ylabel("Y", fontsize=10)
188188
ax.set_zlabel("Z", fontsize=10)
189-
189+
190190
return ax
191191
192192
Visualize the original 3D data
@@ -206,7 +206,7 @@ chair for example.
206206
"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/pts/chair.pts",
207207
directory="data",
208208
)
209-
209+
210210
points = load_data(str(point_data))
211211
X = points[:, 0]
212212
Y = points[:, 2]
@@ -226,7 +226,7 @@ chair for example.
226226
227227
.. parsed-literal::
228228
229-
/tmp/ipykernel_3716970/2434168836.py:12: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
229+
/tmp/ipykernel_56852/2434168836.py:12: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
230230
ax.scatter3D(X, Y, Z, s=5, cmap="jet", marker="o", label="chair")
231231
232232
@@ -249,11 +249,11 @@ each input point.
249249
250250
# Parts of a chair
251251
classes = ["back", "seat", "leg", "arm"]
252-
252+
253253
# Preprocess the input data
254254
point = points.transpose(1, 0)
255255
point = np.expand_dims(point, axis=0)
256-
256+
257257
# Print info about model input and output shape
258258
print(f"input shape: {model.input(0).partial_shape}")
259259
print(f"output shape: {model.output(0).partial_shape}")
@@ -274,15 +274,8 @@ select device from dropdown list for running inference using OpenVINO
274274

275275
.. code:: ipython3
276276
277-
import ipywidgets as widgets
278-
279-
device = widgets.Dropdown(
280-
options=core.available_devices + ["AUTO"],
281-
value="AUTO",
282-
description="Device:",
283-
disabled=False,
284-
)
285-
277+
device = device_widget()
278+
286279
device
287280
288281
@@ -300,7 +293,7 @@ select device from dropdown list for running inference using OpenVINO
300293
compiled_model = core.compile_model(model=model, device_name=device.value)
301294
output_layer = compiled_model.output(0)
302295
result = compiled_model([point])[output_layer]
303-
296+
304297
# Find the label map for all points of chair with highest confidence
305298
pred = np.argmax(result[0], axis=1)
306299
ax = visualize(point)
@@ -316,18 +309,18 @@ select device from dropdown list for running inference using OpenVINO
316309
XCur = np.array(XCur)
317310
YCur = np.array(YCur)
318311
ZCur = np.array(ZCur)
319-
312+
320313
# add current point of the part
321314
ax.scatter(XCur, YCur, ZCur, s=5, cmap="jet", marker="o", label=classes[i])
322-
315+
323316
ax.set_title("3D Segmentation Visualization")
324317
plt.legend(loc="upper right", fontsize=8)
325318
plt.show()
326319
327320
328321
.. parsed-literal::
329322
330-
/tmp/ipykernel_3716970/2804603389.py:23: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
323+
/tmp/ipykernel_56852/2804603389.py:23: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
331324
ax.scatter(XCur, YCur, ZCur, s=5, cmap="jet", marker="o", label=classes[i])
332325
333326

0 commit comments

Comments
 (0)