[DOCS] New notebooks update for master (#24134)

Updating interactive tutorials and documentation. Applying new naming
convention for notebooks.
This commit is contained in:
Sebastian Golebiewski 2024-04-29 11:29:29 +02:00 committed by GitHub
parent 057f41c138
commit 1261e98ff8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
773 changed files with 64535 additions and 63919 deletions

View File

@ -232,18 +232,18 @@ Jupyter Notebooks
The following notebooks have been updated or newly added:
* `Mobile language assistant with MobileVLM <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/279-mobilevlm-language-assistant>`__
* `Depth estimation with DepthAnything <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/280-depth-anything>`__
* `Kosmos-2 <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/281-kosmos2-multimodal-large-language-model>`__
* `Zero-shot Image Classification with SigLIP <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/282-siglip-zero-shot-image-classification>`__
* `Personalized image generation with PhotoMaker <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/283-photo-maker>`__
* `Voice tone cloning with OpenVoice <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/284-openvoice>`__
* `Line-level text detection with Surya <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/285-surya-line-level-text-detection>`__
* `InstantID: Zero-shot Identity-Preserving Generation using OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/286-instant-id>`__
* `Tutorial for Big Image Transfer (BIT) model quantization using NNCF <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/127-big-transfer-quantization>`__
* `Tutorial for OpenVINO Tokenizers integration into inference pipelines <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/128-openvino-tokenizers>`__
* `LLM chatbot <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/254-llm-chatbot/254-llm-chatbot.ipynb>`__ and
`LLM RAG pipeline <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/254-llm-chatbot/254-rag-chatbot.ipynb>`__
* `Mobile language assistant with MobileVLM <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/mobilevlm-language-assistant>`__
* `Depth estimation with DepthAnything <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/depth-anything>`__
* `Kosmos-2 <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/kosmos2-multimodal-large-language-model>`__
* `Zero-shot Image Classification with SigLIP <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/siglip-zero-shot-image-classification>`__
* `Personalized image generation with PhotoMaker <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/photo-maker>`__
* `Voice tone cloning with OpenVoice <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/openvoice>`__
* `Line-level text detection with Surya <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/surya-line-level-text-detection>`__
* `InstantID: Zero-shot Identity-Preserving Generation using OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/instant-id>`__
* `Tutorial for Big Image Transfer (BIT) model quantization using NNCF <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/big-transfer-quantization>`__
* `Tutorial for OpenVINO Tokenizers integration into inference pipelines <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/openvino-tokenizers>`__
* `LLM chatbot <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/llm-chatbot/llm-chatbot.ipynb>`__ and
`LLM RAG pipeline <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/llm-chatbot/rag-chatbot.ipynb>`__
have received integration with new models: minicpm-2b-dpo, gemma-7b-it, qwen1.5-7b-chat, baichuan2-7b-chat

View File

@ -176,13 +176,13 @@ Get started with Python
.. image:: ../../_static/images/get_started_with_python.gif
:width: 400
Try the `Python Quick Start Example <../../notebooks/201-vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
Try the `Python Quick Start Example <../../notebooks/vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
Visit the :doc:`Tutorials <../../learn-openvino/interactive-tutorials-python>` page for more Jupyter Notebooks to get you started with OpenVINO, such as:
* `OpenVINO Python API Tutorial <../../notebooks/002-openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/001-hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/205-vision-background-removal-with-output.html>`__
* `OpenVINO Python API Tutorial <../../notebooks/openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/vision-background-removal-with-output.html>`__
Get started with C++
++++++++++++++++++++

View File

@ -76,7 +76,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <[legacy]-supported-model-formats/[legacy]-convert-pytorch>`
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/102-pytorch-onnx-to-openvino-with-output.html>`__
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/pytorch-onnx-to-openvino-with-output.html>`__
on this topic.
.. tab-item:: TensorFlow
@ -115,14 +115,14 @@ Here are code examples of how to use these methods with different model formats:
import openvino
from openvino.tools.mo import convert_model
core = openvino.Core()
ov_model = convert_model("saved_model.pb")
compiled_model = core.compile_model(ov_model, "AUTO")
For more details on conversion, refer to the
:doc:`guide <[legacy]-supported-model-formats/[legacy]-convert-tensorflow>`
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/101-tensorflow-to-openvino-with-output.html>`__
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/tensorflow-to-openvino-with-output.html>`__
on this topic.
* The ``read_model()`` and ``compile_model()`` methods:
@ -227,7 +227,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <[legacy]-supported-model-formats/[legacy]-convert-tensorflow>`
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/119-tflite-to-openvino-with-output.html>`__
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/tflite-to-openvino-with-output.html>`__
on this topic.
@ -260,7 +260,7 @@ Here are code examples of how to use these methods with different model formats:
:force:
import openvino
core = openvino.Core()
compiled_model = core.compile_model("<INPUT_MODEL>.tflite", "AUTO")
@ -355,7 +355,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <[legacy]-supported-model-formats/[legacy]-convert-onnx>`
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/102-pytorch-onnx-to-openvino-with-output.html>`__
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/pytorch-onnx-to-openvino-with-output.html>`__
on this topic.
@ -486,7 +486,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <[legacy]-supported-model-formats/[legacy]-convert-paddle>`
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/103-paddle-to-openvino-classification-with-output.html>`__
and an example `tutorial <https://docs.openvino.ai/nightly/notebooks/paddle-to-openvino-classification-with-output.html>`__
on this topic.
* The ``read_model()`` method:

View File

@ -24,7 +24,7 @@ GET STARTED
<link rel="stylesheet" type="text/css" href="_static/css/getstarted_style.css">
<p id="GSG_introtext">Welcome to OpenVINO! This guide introduces installation and learning materials for Intel® Distribution of OpenVINO™ toolkit. The guide walks through the following steps:<br />
<a href="notebooks/201-vision-monodepth-with-output.html" >Quick Start Example</a>
<a href="notebooks/vision-monodepth-with-output.html" >Quick Start Example</a>
<a href="get-started/install-openvino.html" >Install OpenVINO</a>
<a href="#learn-openvino" >Learn OpenVINO</a>
</p>
@ -43,7 +43,7 @@ For a quick reference, check out
.. image:: https://user-images.githubusercontent.com/15709723/127752390-f6aa371f-31b5-4846-84b9-18dd4f662406.gif
:width: 400
Try out OpenVINO's capabilities with this `quick start example <notebooks/201-vision-monodepth-with-output.html>`__ that estimates depth in a scene using an OpenVINO monodepth model to quickly see how to load a model, prepare an image, inference the image, and display the result.
Try out OpenVINO's capabilities with this `quick start example <notebooks/vision-monodepth-with-output.html>`__ that estimates depth in a scene using an OpenVINO monodepth model to quickly see how to load a model, prepare an image, inference the image, and display the result.
.. _install-openvino-gsg:
@ -75,10 +75,10 @@ Interactive Tutorials - Jupyter Notebooks
Start with :doc:`interactive Python <learn-openvino/interactive-tutorials-python>` that show the basics of model inferencing, the OpenVINO API, how to convert models to OpenVINO format, and more.
* `Hello Image Classification <notebooks/001-hello-world-with-output.html>`__ - Load an image classification model in OpenVINO and use it to apply a label to an image
* `OpenVINO Runtime API Tutorial <notebooks/002-openvino-api-with-output.html>`__ - Learn the basic Python API for working with models in OpenVINO
* `Convert TensorFlow Models to OpenVINO <notebooks/101-tensorflow-classification-to-openvino-with-output.html>`__
* `Convert PyTorch Models to OpenVINO <notebooks/102-pytorch-onnx-to-openvino-with-output.html>`__
* `Hello Image Classification <notebooks/hello-world-with-output.html>`__ - Load an image classification model in OpenVINO and use it to apply a label to an image
* `OpenVINO Runtime API Tutorial <notebooks/openvino-api-with-output.html>`__ - Learn the basic Python API for working with models in OpenVINO
* `Convert TensorFlow Models to OpenVINO <notebooks/tensorflow-classification-to-openvino-with-output.html>`__
* `Convert PyTorch Models to OpenVINO <notebooks/pytorch-onnx-to-openvino-with-output.html>`__
.. _code-samples:
@ -106,8 +106,8 @@ Model Compression and Quantization
Use OpenVINOs model compression tools to reduce your models latency and memory footprint while maintaining good accuracy.
* Tutorial - `Quantization-Aware Training in TensorFlow with OpenVINO NNCF <notebooks/305-tensorflow-quantization-aware-training-with-output>`__
* Tutorial - `Quantization-Aware Training in PyTorch with NNCF <notebooks/302-pytorch-quantization-aware-training-with-output>`__
* Tutorial - `Quantization-Aware Training in TensorFlow with OpenVINO NNCF <notebooks/tensorflow-quantization-aware-training-with-output>`__
* Tutorial - `Quantization-Aware Training in PyTorch with NNCF <notebooks/pytorch-quantization-aware-training-with-output>`__
* :doc:`Model Optimization Guide <openvino-workflow/model-optimization>`
Automated Device Configuration

View File

@ -283,7 +283,7 @@ Learn more about how to integrate a model in OpenVINO applications by trying out
.. tab-item:: Get started with Python
:sync: get-started-py
Try the `Python Quick Start Example <../../notebooks/201-vision-monodepth-with-output.html>`__
Try the `Python Quick Start Example <../../notebooks/vision-monodepth-with-output.html>`__
to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
.. image:: https://user-images.githubusercontent.com/15709723/127752390-f6aa371f-31b5-4846-84b9-18dd4f662406.gif
@ -291,9 +291,9 @@ Learn more about how to integrate a model in OpenVINO applications by trying out
Visit the :doc:`Tutorials <../../../learn-openvino/interactive-tutorials-python>` page for more Jupyter Notebooks to get you started with OpenVINO, such as:
* `OpenVINO Python API Tutorial <../../notebooks/002-openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/001-hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/205-vision-background-removal-with-output.html>`__
* `OpenVINO Python API Tutorial <../../notebooks/openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/vision-background-removal-with-output.html>`__
.. tab-item:: Get started with C++

View File

@ -156,16 +156,16 @@ Now that you've installed OpenVINO Runtime, you're ready to run your own machine
.. tab-item:: Get started with Python
:sync: get-started-py
Try the `Python Quick Start Example <../../notebooks/201-vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
Try the `Python Quick Start Example <../../notebooks/vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
.. image:: https://user-images.githubusercontent.com/15709723/127752390-f6aa371f-31b5-4846-84b9-18dd4f662406.gif
:width: 400
Visit the :doc:`Tutorials <../../../learn-openvino/interactive-tutorials-python>` page for more Jupyter Notebooks to get you started with OpenVINO, such as:
* `OpenVINO Python API Tutorial <../../notebooks/002-openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/001-hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/205-vision-background-removal-with-output.html>`__
* `OpenVINO Python API Tutorial <../../notebooks/openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/vision-background-removal-with-output.html>`__
.. tab-item:: Get started with C++
:sync: get-started-cpp

View File

@ -194,16 +194,16 @@ Now that you've installed OpenVINO Runtime, you're ready to run your own machine
.. tab-item:: Get started with Python
:sync: get-started-py
Try the `Python Quick Start Example <../../notebooks/201-vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
Try the `Python Quick Start Example <../../notebooks/vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
.. image:: https://user-images.githubusercontent.com/15709723/127752390-f6aa371f-31b5-4846-84b9-18dd4f662406.gif
:width: 400
Visit the :doc:`Tutorials <../../../learn-openvino/interactive-tutorials-python>` page for more Jupyter Notebooks to get you started with OpenVINO, such as:
* `OpenVINO Python API Tutorial <../../notebooks/002-openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/001-hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/205-vision-background-removal-with-output.html>`__
* `OpenVINO Python API Tutorial <../../notebooks/openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <../../notebooks/hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <../../notebooks/vision-background-removal-with-output.html>`__
.. tab-item:: Get started with C++
:sync: get-started-cpp

View File

@ -135,16 +135,16 @@ Now that you've installed OpenVINO Runtime, you're ready to run your own machine
.. image:: https://user-images.githubusercontent.com/15709723/127752390-f6aa371f-31b5-4846-84b9-18dd4f662406.gif
:width: 400
Try the `Python Quick Start Example <https://docs.openvino.ai/2024/notebooks/201-vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
Try the `Python Quick Start Example <https://docs.openvino.ai/2024/notebooks/vision-monodepth-with-output.html>`__ to estimate depth in a scene using an OpenVINO monodepth model in a Jupyter Notebook inside your web browser.
Get started with Python
+++++++++++++++++++++++
Visit the :doc:`Tutorials <../../../learn-openvino/interactive-tutorials-python>` page for more Jupyter Notebooks to get you started with OpenVINO, such as:
* `OpenVINO Python API Tutorial <https://docs.openvino.ai/2024/notebooks/002-openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <https://docs.openvino.ai/2024/notebooks/001-hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <https://docs.openvino.ai/2024/notebooks/205-vision-background-removal-with-output.html>`__
* `OpenVINO Python API Tutorial <https://docs.openvino.ai/2024/notebooks/openvino-api-with-output.html>`__
* `Basic image classification program with Hello Image Classification <https://docs.openvino.ai/2024/notebooks/hello-world-with-output.html>`__
* `Convert a PyTorch model and use it for image background removal <https://docs.openvino.ai/2024/notebooks/vision-background-removal-with-output.html>`__

View File

@ -43,7 +43,7 @@ on how to run and manage the notebooks on your system.
Additional Resources
######################
* `OpenVINO™ Notebooks - Github Repository <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/README.md>`_
* `OpenVINO™ Notebooks - Github Repository <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/README.md>`_
* `Binder documentation <https://mybinder.readthedocs.io/en/latest/>`_
* `Google Colab <https://colab.research.google.com/>`__

View File

@ -175,7 +175,7 @@ Installing prerequisites
.. code-block:: sh
:caption: Source: https://github.com/openvinotoolkit/openvino_notebooks/blob/main/Dockerfile
:caption: Source: https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/Dockerfile
FROM quay.io/thoth-station/s2i-thoth-ubi8-py38:v0.29.0
@ -485,7 +485,7 @@ If you want to launch only one notebook, such as the *Monodepth* notebook, run t
.. code:: bash
jupyter lab notebooks/201-vision-monodepth/201-vision-monodepth.ipynb
jupyter lab notebooks/vision-monodepth/vision-monodepth.ipynb
Launch All Notebooks
++++++++++++++++++++
@ -605,7 +605,7 @@ or create an
Additional Resources
####################
* `OpenVINO™ Notebooks - Github Repository <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/README.md>`_
* `OpenVINO™ Notebooks - Github Repository <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/README.md>`_
.. |launch-jupyter| image:: https://user-images.githubusercontent.com/15709723/120527271-006fd200-c38f-11eb-9935-2d36d50bab9f.gif

View File

@ -171,15 +171,15 @@ parameters.
Below are some examples of using Optimum-Intel for model conversion and inference:
* `Instruction following using Databricks Dolly 2.0 and OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/240-dolly-2-instruction-following/240-dolly-2-instruction-following.ipynb>`__
* `Create an LLM-powered Chatbot using OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/254-llm-chatbot/254-llm-chatbot.ipynb>`__
* `Instruction following using Databricks Dolly 2.0 and OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/dolly-2-instruction-following/dolly-2-instruction-following.ipynb>`__
* `Create an LLM-powered Chatbot using OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/llm-chatbot/llm-chatbot.ipynb>`__
.. note::
Optimum-Intel can be used for other generative AI models. See
`Stable Diffusion v2.1 using Optimum-Intel OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/236-stable-diffusion-v2/236-stable-diffusion-v2-optimum-demo.ipynb>`__
`Stable Diffusion v2.1 using Optimum-Intel OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/stable-diffusion-v2/stable-diffusion-v2-optimum-demo.ipynb>`__
and
`Image generation with Stable Diffusion XL and OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/248-stable-diffusion-xl/248-stable-diffusion-xl.ipynb>`__
`Image generation with Stable Diffusion XL and OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/stable-diffusion-xl/stable-diffusion-xl.ipynb>`__
for more examples.
Inference Example

View File

@ -25,7 +25,7 @@ tokenizer conversion for seamless integration into your project. With OpenVINO T
* Convert Hugging Face tokenizers into OpenVINO tokenizer and detokenizer for efficient deployment across different environments. See the `conversion example <https://github.com/openvinotoolkit/openvino_tokenizers?tab=readme-ov-file#convert-huggingface-tokenizer>`__ for more details.
* Combine OpenVINO models into a single model. Recommended for specific models, like classifiers or RAG Embedders, where both tokenizer and a model are used once in each pipeline inference. For more information, see the `OpenVINO Tokenizers Notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/128-openvino-tokenizers>`__.
* Combine OpenVINO models into a single model. Recommended for specific models, like classifiers or RAG Embedders, where both tokenizer and a model are used once in each pipeline inference. For more information, see the `OpenVINO Tokenizers Notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/openvino-tokenizers>`__.
* Add greedy decoding pipeline to text generation models.
@ -273,7 +273,7 @@ Convert Tokenizers:
tokenizer, detokenizer = compile_model(ov_tokenizer), compile_model(ov_detokenizer)
The result is two OpenVINO models: ``ov_tokenizer`` and ``ov_detokenizer``.
You can find more information and code snippets in the `OpenVINO Tokenizers Notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/128-openvino-tokenizers>`__.
You can find more information and code snippets in the `OpenVINO Tokenizers Notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/openvino-tokenizers>`__.
2. Tokenize and Prepare Inputs
+++++++++++++++++++++++++++++++
@ -337,7 +337,7 @@ Additional Resources
####################
* `OpenVINO Tokenizers repo <https://github.com/openvinotoolkit/openvino_tokenizers>`__
* `OpenVINO Tokenizers Notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/128-openvino-tokenizers>`__
* `OpenVINO Tokenizers Notebook <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/openvino-tokenizers>`__
* `Text generation C++ samples that support most popular models like LLaMA 2 <https://github.com/openvinotoolkit/openvino.genai/tree/master/text_generation/causal_lm/cpp>`__
* `OpenVINO GenAI Repo <https://github.com/openvinotoolkit/openvino.genai>`__

View File

@ -30,8 +30,8 @@ NNCF Quick Start Examples
See the following Jupyter Notebooks for step-by-step examples showing how to add model compression to a PyTorch or Tensorflow training pipeline with NNCF:
- `Quantization Aware Training with NNCF and PyTorch <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/302-pytorch-quantization-aware-training>`__.
- `Quantization Aware Training with NNCF and TensorFlow <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/305-tensorflow-quantization-aware-training>`__.
- `Quantization Aware Training with NNCF and PyTorch <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/pytorch-quantization-aware-training>`__.
- `Quantization Aware Training with NNCF and TensorFlow <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/tensorflow-quantization-aware-training>`__.
Installation
####################
@ -111,6 +111,6 @@ Additional Resources
- :doc:`Quantizing Models Post-training <quantizing-models-post-training>`
- `NNCF GitHub repository <https://github.com/openvinotoolkit/nncf>`__
- `NNCF FAQ <https://github.com/openvinotoolkit/nncf/blob/develop/docs/FAQ.md>`__
- `Quantization Aware Training with NNCF and PyTorch <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/302-pytorch-quantization-aware-training>`__.
- `Quantization Aware Training with NNCF and TensorFlow <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/305-tensorflow-quantization-aware-training>`__.
- `Quantization Aware Training with NNCF and PyTorch <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/pytorch-quantization-aware-training>`__.
- `Quantization Aware Training with NNCF and TensorFlow <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/tensorflow-quantization-aware-training>`__.

View File

@ -228,7 +228,7 @@ required in this case. For more details, see the corresponding :doc:`documentati
Examples
####################
* `Quantizing PyTorch model with NNCF <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/302-pytorch-quantization-aware-training>`__
* `Quantizing PyTorch model with NNCF <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/pytorch-quantization-aware-training>`__
* `Quantizing TensorFlow model with NNCF <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/305-tensorflow-quantization-aware-training>`__
* `Quantizing TensorFlow model with NNCF <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/tensorflow-quantization-aware-training>`__

View File

@ -124,8 +124,8 @@ If your model has a ``dict`` input, such as, ``{"x": a, "y": b, "z": c}``, it wi
Check out more examples of model conversion with non-tensor data types in the following tutorials:
* `Video Subtitle Generation using Whisper and OpenVINO™ <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/227-whisper-subtitles-generation>`__
* `Visual Question Answering and Image Captioning using BLIP and OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/233-blip-visual-language-processing>`__
* `Video Subtitle Generation using Whisper and OpenVINO™ <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/whisper-subtitles-generation>`__
* `Visual Question Answering and Image Captioning using BLIP and OpenVINO <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/blip-visual-language-processing>`__
Input and output names of the model
###################################

View File

@ -61,7 +61,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <convert-model-pytorch>`
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/102-pytorch-to-openvino/102-pytorch-onnx-to-openvino.ipynb>`__
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/pytorch-to-openvino/pytorch-onnx-to-openvino.ipynb>`__
on this topic.
.. tab-item:: TensorFlow
@ -105,7 +105,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <convert-model-tensorflow>`
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/101-tensorflow-classification-to-openvino>`__
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/tensorflow-classification-to-openvino>`__
on this topic.
* The ``read_model()`` and ``compile_model()`` methods:
@ -211,7 +211,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <convert-model-tensorflow-lite>`
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/119-tflite-to-openvino/119-tflite-to-openvino.ipynb>`__
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/tflite-to-openvino/tflite-to-openvino.ipynb>`__
on this topic.
@ -336,7 +336,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <convert-model-onnx>`
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/102-pytorch-to-openvino/102-pytorch-onnx-to-openvino.ipynb>`__
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/pytorch-to-openvino/pytorch-onnx-to-openvino.ipynb>`__
on this topic.
@ -464,7 +464,7 @@ Here are code examples of how to use these methods with different model formats:
For more details on conversion, refer to the
:doc:`guide <convert-model-paddle>`
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/103-paddle-to-openvino/103-paddle-to-openvino-classification.ipynb>`__
and an example `tutorial <https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/paddle-to-openvino/paddle-to-openvino-classification.ipynb>`__
on this topic.
* The ``read_model()`` method:

View File

@ -314,8 +314,8 @@ asynchronous inference pipeline. For information on asynchronous inference, see
The following notebooks provide examples of how to set up an asynchronous pipeline:
* :doc:`Image Classification Async Sample <../../../learn-openvino/openvino-samples/image-classification-async>`
* `Notebook - Asynchronous Inference with OpenVINO™ <./../../../notebooks/115-async-api-with-output.html>`__
* `Notebook - Automatic Device Selection with OpenVINO <./../../../notebooks/106-auto-device-with-output.html>`__
* `Notebook - Asynchronous Inference with OpenVINO™ <./../../../notebooks/async-api-with-output.html>`__
* `Notebook - Automatic Device Selection with OpenVINO <./../../../notebooks/auto-device-with-output.html>`__
LATENCY
--------------------

View File

@ -153,7 +153,7 @@ guaranteed.
Additional Resources
#############################
* `Vision colorization Notebook <notebooks/222-vision-image-colorization-with-output.html>`__
* `Vision colorization Notebook <notebooks/vision-image-colorization-with-output.html>`__
* `Classification Benchmark C++ Demo <https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/classification_benchmark_demo/cpp>`__
* `3D Human Pose Estimation Python Demo <https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/3d_segmentation_demo/python>`__
* `Object Detection C++ Demo <https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/object_detection_demo/cpp>`__

View File

@ -141,5 +141,5 @@ sequences.
You can find more examples demonstrating how to work with states in other articles:
* `LLM Chatbot notebook <../../notebooks/273-stable-zephyr-3b-chatbot-with-output.html>`__
* `LLM Chatbot notebook <../../notebooks/stable-zephyr-3b-chatbot-with-output.html>`__
* :doc:`Serving Stateful Models with OpenVINO Model Server <../../ovms_docs_stateful_models>`

View File

@ -6,11 +6,11 @@ repo_directory = "notebooks"
repo_owner = "openvinotoolkit"
repo_name = "openvino_notebooks"
repo_branch = "tree/main"
artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20240312220809/dist/rst_files/"
artifacts_link = "http://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/20240417220808/dist/rst_files/"
blacklisted_extensions = ['.xml', '.bin']
notebooks_repo = "https://github.com/openvinotoolkit/openvino_notebooks/blob/main/"
notebooks_repo = "https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/"
notebooks_binder = "https://mybinder.org/v2/gh/openvinotoolkit/openvino_notebooks/HEAD?filepath="
notebooks_colab = "https://colab.research.google.com/github/openvinotoolkit/openvino_notebooks/blob/main/"
notebooks_colab = "https://colab.research.google.com/github/openvinotoolkit/openvino_notebooks/blob/latest/"
file_with_binder_notebooks = Path('../../docs/notebooks/notebooks_with_binder_buttons.txt').resolve(strict=True)
file_with_colab_notebooks = Path('../../docs/notebooks/notebooks_with_colab_buttons.txt').resolve(strict=True)
openvino_notebooks_ipynb_list = Path('../../docs/notebooks/all_notebooks_paths.txt').resolve(strict=True)

View File

@ -37,8 +37,6 @@ import os
import re
import sys
matching_notebooks_paths = []
def fetch_binder_list(binder_list_file) -> list:
"""Function that fetches list of notebooks with binder buttons
@ -127,25 +125,6 @@ class NbProcessor:
def __init__(self, nb_path: str = notebooks_path):
self.nb_path = nb_path
with open(openvino_notebooks_ipynb_list, 'r+', encoding='cp437') as ipynb_file:
openvino_notebooks_paths_list = ipynb_file.readlines()
for notebook_name in [
nb for nb in os.listdir(self.nb_path) if
verify_notebook_name(nb)
]:
if not os.path.exists(openvino_notebooks_ipynb_list):
raise FileNotFoundError("all_notebooks_paths.txt is not found")
else:
ipynb_list = [x for x in openvino_notebooks_paths_list if re.match("notebooks/[0-9]{3}.*\.ipynb$", x)]
notebook_with_ext = notebook_name[:-16] + ".ipynb"
matching_notebooks = [re.sub('[\n]', '', match) for match in ipynb_list if notebook_with_ext in match]
if matching_notebooks is not None:
for n in matching_notebooks:
matching_notebooks_paths.append(n)
def add_binder(self, buttons_list: list, cbuttons_list: list, template_with_colab_and_binder: str = binder_colab_template, template_without_binder: str = no_binder_template):
"""A function working as an example of how to add Binder or Google Colab buttons to existing RST files.
@ -161,22 +140,30 @@ class NbProcessor:
"""
for notebook_file, nb_path in zip([
nb for nb in os.listdir(self.nb_path) if verify_notebook_name(nb)
], matching_notebooks_paths):
if not os.path.exists(openvino_notebooks_ipynb_list):
raise FileNotFoundError("all_notebooks_paths.txt is not found")
else:
with open(openvino_notebooks_ipynb_list, 'r+', encoding='cp437') as ipynb_file:
openvino_notebooks_paths_list = ipynb_file.read()
for notebook_file in [nb for nb in os.listdir(self.nb_path) if verify_notebook_name(nb)]:
notebook_ipynb_ext = notebook_file[:-16] + ".ipynb"
nb_path_match = [line for line in openvino_notebooks_paths_list.split('\n') if notebook_ipynb_ext in line]
nb_repo_path = ''.join(nb_path_match)
notebook_item = '-'.join(notebook_file.split('-')[:-2])
local_install = ".. |installation_link| raw:: html\n\n <a href='https://github.com/" + \
repo_owner + "/" + repo_name + "#-installation-guide' target='_blank' title='Install " + \
notebook_item + " locally'>local installation</a> \n\n"
binder_badge = ".. raw:: html\n\n <a href='" + notebooks_binder + \
nb_path + "' target='_blank' title='Launch " + notebook_item + \
nb_repo_path + "' target='_blank' title='Launch " + notebook_item + \
" in Binder'><img src='data:image/svg+xml;base64," + binder_image_base64 + "' class='notebook-badge' alt='Binder'></a>\n\n"
colab_badge = ".. raw:: html\n\n <a href='" + notebooks_colab + \
nb_path + "' target='_blank' title='Open " + notebook_item + \
nb_repo_path + "' target='_blank' title='Open " + notebook_item + \
" in Google Colab'><img src='data:image/svg+xml;base64," + colab_image_base64 + "' class='notebook-badge'alt='Google Colab'></a>\n\n"
github_badge = ".. raw:: html\n\n <a href='" + notebooks_repo + \
nb_path + "' target='_blank' title='View " + notebook_item + \
nb_repo_path + "' target='_blank' title='View " + notebook_item + \
" on Github'><img src='data:image/svg+xml;base64," + github_image_base64 + "' class='notebook-badge' alt='Github'></a><br><br>\n\n"
binder_data = {

View File

@ -47,11 +47,11 @@ def verify_notebook_name(notebook_name: str) -> bool:
"""Verification based on notebook name
:param notebook_name: Notebook name by default keeps convention:
[3 digit]-name-with-dashes-with-output.rst,
example: 001-hello-world-with-output.rst
name-with-dashes-with-output.rst,
example: hello-world-with-output.rst
:type notebook_name: str
:returns: Return if notebook meets requirements
:rtype: bool
"""
return notebook_name[:3].isdigit() and notebook_name[-4:] == ".rst"
return notebook_name[-16:] == "-with-output.rst"

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5712bd24e962ae0e0267607554ebe1f2869c223b108876ce10e5d20fe6285126
size 387941

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:96f0eb3a9535d57b8784be4b717dc9f280e4bf107e5b61d7cf51b36e142e4c7a
size 249032

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:caef59a6c15a5a1d512f4dd22395b12fbd754bba264ea5f0deae323ff8edee39
size 20550

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6a3137d9359a44fb19e1900e6b808f9e7e7ded0ba209abe8c4bd90fcf37b1c6a
size 260045

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c7a830fedc5653fd506c656144decc048cad5a7651c8e498024f0eb0ab8c8e96
size 305482

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:edb00cb4f0e2c42cd9e0f90939afbd6352ca40c90866821898f2c42c1fd9df64
size 457214

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5712bd24e962ae0e0267607554ebe1f2869c223b108876ce10e5d20fe6285126
size 387941

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:085fc2e0ffdf71311eed99aebb0c6efafffe33ab3f01ca34c44f99feba46a565
size 465692

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fe706f0dda105330b25a3a8d1679019ef40d88c86b28a5aa2ca77449800ec939
size 465695

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:085fc2e0ffdf71311eed99aebb0c6efafffe33ab3f01ca34c44f99feba46a565
size 465692

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99b8398ef76f2959d210e2d30bb44420f8d34a885a4480bc26e2af6627ba7119
size 120883

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1381e5922057c6bc70eb4ba9a04f3164382ad01191d320c1acbc819e7261f8c1
size 224886

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1381e5922057c6bc70eb4ba9a04f3164382ad01191d320c1acbc819e7261f8c1
size 224886

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1381e5922057c6bc70eb4ba9a04f3164382ad01191d320c1acbc819e7261f8c1
size 224886

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1381e5922057c6bc70eb4ba9a04f3164382ad01191d320c1acbc819e7261f8c1
size 224886

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ce150e30514fd5c85f9d29b953b41d9cbd0c4f58c2289513286a4aef99c3984
size 26193

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7b1eaf56574fadd9331d380d2f057dd74775ebacdaa34fff9a1af2fe382128ab
size 40039

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5d89934369311be59343b18178462948179f2338b011e203bd44ba12f2c5f415
size 52981

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fd3c5e32a2fa420855d0c3afbe63b2766bea7945af42dc014a2c4ef0511b34e9
size 62481

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:343ba28303ca515ea1d2e7a3a11fc71f2da545414422d023c6bb0bf6e5f0d33c
size 387909

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9990baa1e4f121781deb249b7534c8f31f26ca9b37afd3f269ca50ec0318e7d4
size 14855

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93643954352f7013007d0c5a7b47097cbdf533cf5b4aae690069ca9b78625ce2
size 30425

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5712bd24e962ae0e0267607554ebe1f2869c223b108876ce10e5d20fe6285126
size 387941

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90f5ec228ab4ebfbb7bbf584f3eb86452f97261c08225f0fd2cb0b4bceadacb1
size 395346

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:50bd4a35af276f9e1ead8973e69ac3ae780beb2087b477c4d20929bf2f61b93f
size 389505

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90f5ec228ab4ebfbb7bbf584f3eb86452f97261c08225f0fd2cb0b4bceadacb1
size 395346

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7c3ef737ce7f0e16dd9d3a392c533b542f408fe58f47c9bcc2b28f8d54e67d8
size 391878

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ee75a57191b0022ebefe5c73eb05071f8c949587cabd740436929ed0e1cc5da
size 59201

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58984d873a9bf772f576c037fdf50e015947a691e82eff7b2459c145a83501ef
size 509755

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5d80a14442c132a885cab814c149f7a93b3a53a743cf9370e64a4024a79e1999
size 55628

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:73833360f08fdb6c5ff39faa0735fd718cb7a36175bfc1b87ef3031ac7139029
size 458385

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a12219cd1386fa59a98712d2e6145f3ebf5e3e52282b0ab6b65fb2d49b8dc36a
size 87576

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:57f2b4a6d2402555f9d88c6e19274f79d1408419d193457c2983cbb20ebacfe9
size 385522

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e37cfa9b4d60c9d0ecfb0d50e4ce014a53aa5277f65ad1f38c1c86f89bd57583
size 385520

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b0fae96c93f954f1b2eed2f3d236f96f1b4300f8b8f50599a01ba45d46b9de32
size 203738

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc8e4a16cad1ae9fcabdb459a6d05280ee9c3dc7974c0a10517d9ec9723c95b4
size 538743

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b34292be5a7f36c97469fb2faade2c42313b9aca447b82000dc7f200c27d6936
size 959858

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1f3ddf966495258f0b36306e712331bb834c9942b673c30732869fe36a7b2870
size 272963

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:302db7065eda5e95c2a5ace7947e0b249607176f03c675cbecb4444863f61bda
size 356735

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b67df1028d23d7d8fb290ba823cf2aaa90e8f85cb7f12b4369b6e33097c60598
size 2896276

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08c5ae3bb47e095d707bdaa7f8008bed7eeb1f672c82ae4d63334e665ec3e4d8
size 170121

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6433ef738eeb00f8d0dc4343ab289073c76321d2e12fe46318fbe374b0f745e2
size 190271

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d67df91f05c9aeb0442a1c4aaef7527cf27e9be0938642eed807f8b5342aa7b
size 26914

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:50b9f932b844d99b59b51f2c6947dd048f96bf1553fe36de3975d3a3ad1715e4
size 8966

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad7114f80f8925643c865222d0fe0e05d4f65ab54e0b0d354edebe3e5c1ade7c
size 170338

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6b3a7a7dc706211aa7a85dec17f006f5387589e36e4a8059d8193b00f5f55e86
size 1810982

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e6c2fe95f40761617ff964a0f27a1eae819ca534ef0d8df795d33e6a7f8fd4d
size 1931637

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cf8ac482631fd4e8ab0b7e5e91ef98b2537a71d76510abc48048cc5f4e904451
size 436999

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a597c2a365347925dd30285744d1df1b9e09471f5a8379195d8485356e2902b
size 476190

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c7a830fedc5653fd506c656144decc048cad5a7651c8e498024f0eb0ab8c8e96
size 305482

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:22ee79964a8f86115b19c6abe0969a93ef5df9882bc35485f3b1f25d7199a622
size 923631

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ce052db324821165a2b1bc5dea9d05588886c1794c0f217aaa47b8442c76aad
size 53571

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ce052db324821165a2b1bc5dea9d05588886c1794c0f217aaa47b8442c76aad
size 53571

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:85a88d984f2c72176c252c6777e74f0bf780da5cfe217d8c19f7fef84cdbd467
size 7969

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:85a88d984f2c72176c252c6777e74f0bf780da5cfe217d8c19f7fef84cdbd467
size 7969

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:985a899cbc892c4758ca25c58bbaa86bc0c2a27e75abae8a177ab93aa0a12e47
size 43095

View File

@ -1,750 +0,0 @@
The attention center model with OpenVINO™
=========================================
This notebook demonstrates how to use the `attention center
model <https://github.com/google/attention-center/tree/main>`__ with
OpenVINO. This model is in the `TensorFlow Lite
format <https://www.tensorflow.org/lite>`__, which is supported in
OpenVINO now by TFLite frontend.
Eye tracking is commonly used in visual neuroscience and cognitive
science to answer related questions such as visual attention and
decision making. Computational models that predict where to look have
direct applications to a variety of computer vision tasks. The attention
center model takes an RGB image as input and return a 2D point as
output. This 2D point is the predicted center of human attention on the
image i.e. the most salient part of images, on which people pay
attention fist to. This allows find the most visually salient regions
and handle it as early as possible. For example, it could be used for
the latest generation image format (such as `JPEG
XL <https://github.com/libjxl/libjxl>`__), which supports encoding the
parts that you pay attention to fist. It can help to improve user
experience, image will appear to load faster.
Attention center model architecture is: > The attention center model is
a deep neural net, which takes an image as input, and uses a pre-trained
classification network, e.g, ResNet, MobileNet, etc., as the backbone.
Several intermediate layers that output from the backbone network are
used as input for the attention center prediction module. These
different intermediate layers contain different information e.g.,
shallow layers often contain low level information like
intensity/color/texture, while deeper layers usually contain higher and
more semantic information like shape/object. All are useful for the
attention prediction. The attention center prediction applies
convolution, deconvolution and/or resizing operator together with
aggregation and sigmoid function to generate a weighting map for the
attention center. And then an operator (the Einstein summation operator
in our case) can be applied to compute the (gravity) center from the
weighting map. An L2 norm between the predicted attention center and the
ground-truth attention center can be computed as the training loss.
Source: `Google AI blog
post <https://opensource.googleblog.com/2022/12/open-sourcing-attention-center-model.html>`__.
.. figure:: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxLCDJHzJNjB_von-vFlq8TJJFA41aB85T-QE3ZNxW8kshAf3HOEyIEJ4uggXjbJmZhsdj7j6i6mvvmXtyaxXJPm3JHuKILNRTPfX9KvICbFBRD8KNuDVmLABzYuhQci3BT2BqV-wM54IxaoAV1YDBbnpJC92UZfEBGvakLusiqND2AaPpWPr2gJV1/s1600/image4.png
:alt: drawing
drawing
The attention center model has been trained with images from the `COCO
dataset <https://cocodataset.org/#home>`__ annotated with saliency from
the `SALICON dataset <http://salicon.net/>`__.
Table of contents:
^^^^^^^^^^^^^^^^^^
- `Imports <#imports>`__
- `Download the attention-center
model <#download-the-attention-center-model>`__
- `Convert Tensorflow Lite model to OpenVINO IR
format <#convert-tensorflow-lite-model-to-openvino-ir-format>`__
- `Select inference device <#select-inference-device>`__
- `Prepare image to use with attention-center
model <#prepare-image-to-use-with-attention-center-model>`__
- `Load input image <#load-input-image>`__
- `Get result with OpenVINO IR
model <#get-result-with-openvino-ir-model>`__
.. code:: ipython3
import platform
%pip install "openvino>=2023.2.0"
if platform.system() != "Windows":
%pip install -q "matplotlib>=3.4"
else:
%pip install -q "matplotlib>=3.4,<3.7"
.. parsed-literal::
Requirement already satisfied: openvino>=2023.2.0 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-632/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (2024.0.0)
Requirement already satisfied: numpy>=1.16.6 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-632/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino>=2023.2.0) (1.23.5)
Requirement already satisfied: openvino-telemetry>=2023.2.1 in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-632/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino>=2023.2.0) (2023.2.1)
Requirement already satisfied: packaging in /opt/home/k8sworker/ci-ai/cibuilds/ov-notebook/OVNotebookOps-632/.workspace/scm/ov-notebook/.venv/lib/python3.8/site-packages (from openvino>=2023.2.0) (24.0)
.. parsed-literal::
DEPRECATION: pytorch-lightning 1.6.5 has a non-standard dependency specifier torch>=1.8.*. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pytorch-lightning or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
.. parsed-literal::
Note: you may need to restart the kernel to use updated packages.
.. parsed-literal::
DEPRECATION: pytorch-lightning 1.6.5 has a non-standard dependency specifier torch>=1.8.*. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pytorch-lightning or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
.. parsed-literal::
Note: you may need to restart the kernel to use updated packages.
Imports
-------
.. code:: ipython3
import cv2
import numpy as np
import tensorflow as tf
from pathlib import Path
import matplotlib.pyplot as plt
import openvino as ov
.. parsed-literal::
2024-03-12 23:28:02.634827: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-03-12 23:28:02.669284: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
.. parsed-literal::
2024-03-12 23:28:03.239575: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Download the attention-center model
-----------------------------------
Download the model as part of `attention-center
repo <https://github.com/google/attention-center/tree/main>`__. The repo
include model in folder ``./model``.
.. code:: ipython3
if not Path('./attention-center').exists():
! git clone https://github.com/google/attention-center
.. parsed-literal::
Cloning into 'attention-center'...
.. parsed-literal::
remote: Enumerating objects: 168, done.
remote: Counting objects: 0% (1/168)
remote: Counting objects: 1% (2/168)
remote: Counting objects: 2% (4/168)
remote: Counting objects: 3% (6/168)
remote: Counting objects: 4% (7/168)
remote: Counting objects: 5% (9/168)
remote: Counting objects: 6% (11/168)
remote: Counting objects: 7% (12/168)
remote: Counting objects: 8% (14/168)
remote: Counting objects: 9% (16/168)
remote: Counting objects: 10% (17/168)
remote: Counting objects: 11% (19/168)
remote: Counting objects: 12% (21/168)
remote: Counting objects: 13% (22/168)
remote: Counting objects: 14% (24/168)
remote: Counting objects: 15% (26/168)
remote: Counting objects: 16% (27/168)
remote: Counting objects: 17% (29/168)
remote: Counting objects: 18% (31/168)
remote: Counting objects: 19% (32/168)
remote: Counting objects: 20% (34/168)
remote: Counting objects: 21% (36/168)
remote: Counting objects: 22% (37/168)
remote: Counting objects: 23% (39/168)
remote: Counting objects: 24% (41/168)
remote: Counting objects: 25% (42/168)
remote: Counting objects: 26% (44/168)
remote: Counting objects: 27% (46/168)
remote: Counting objects: 28% (48/168)
remote: Counting objects: 29% (49/168)
remote: Counting objects: 30% (51/168)
remote: Counting objects: 31% (53/168)
remote: Counting objects: 32% (54/168)
remote: Counting objects: 33% (56/168)
remote: Counting objects: 34% (58/168)
remote: Counting objects: 35% (59/168)
remote: Counting objects: 36% (61/168)
remote: Counting objects: 37% (63/168)
remote: Counting objects: 38% (64/168)
remote: Counting objects: 39% (66/168)
remote: Counting objects: 40% (68/168)
remote: Counting objects: 41% (69/168)
remote: Counting objects: 42% (71/168)
remote: Counting objects: 43% (73/168)
remote: Counting objects: 44% (74/168)
remote: Counting objects: 45% (76/168)
remote: Counting objects: 46% (78/168)
remote: Counting objects: 47% (79/168)
remote: Counting objects: 48% (81/168)
remote: Counting objects: 49% (83/168)
remote: Counting objects: 50% (84/168)
remote: Counting objects: 51% (86/168)
remote: Counting objects: 52% (88/168)
remote: Counting objects: 53% (90/168)
remote: Counting objects: 54% (91/168)
remote: Counting objects: 55% (93/168)
remote: Counting objects: 56% (95/168)
remote: Counting objects: 57% (96/168)
remote: Counting objects: 58% (98/168)
remote: Counting objects: 59% (100/168)
remote: Counting objects: 60% (101/168)
remote: Counting objects: 61% (103/168)
remote: Counting objects: 62% (105/168)
remote: Counting objects: 63% (106/168)
remote: Counting objects: 64% (108/168)
remote: Counting objects: 65% (110/168)
remote: Counting objects: 66% (111/168)
remote: Counting objects: 67% (113/168)
remote: Counting objects: 68% (115/168)
remote: Counting objects: 69% (116/168)
remote: Counting objects: 70% (118/168)
remote: Counting objects: 71% (120/168)
remote: Counting objects: 72% (121/168)
remote: Counting objects: 73% (123/168)
remote: Counting objects: 74% (125/168)
remote: Counting objects: 75% (126/168)
remote: Counting objects: 76% (128/168)
remote: Counting objects: 77% (130/168)
remote: Counting objects: 78% (132/168)
remote: Counting objects: 79% (133/168)
remote: Counting objects: 80% (135/168)
remote: Counting objects: 81% (137/168)
remote: Counting objects: 82% (138/168)
.. parsed-literal::
remote: Counting objects: 83% (140/168)
remote: Counting objects: 84% (142/168)
remote: Counting objects: 85% (143/168)
remote: Counting objects: 86% (145/168)
remote: Counting objects: 87% (147/168)
remote: Counting objects: 88% (148/168)
remote: Counting objects: 89% (150/168)
remote: Counting objects: 90% (152/168)
remote: Counting objects: 91% (153/168)
remote: Counting objects: 92% (155/168)
remote: Counting objects: 93% (157/168)
remote: Counting objects: 94% (158/168)
remote: Counting objects: 95% (160/168)
remote: Counting objects: 96% (162/168)
remote: Counting objects: 97% (163/168)
remote: Counting objects: 98% (165/168)
remote: Counting objects: 99% (167/168)
remote: Counting objects: 100% (168/168)
remote: Counting objects: 100% (168/168), done.
remote: Compressing objects: 0% (1/132)
remote: Compressing objects: 1% (2/132)
remote: Compressing objects: 2% (3/132)
remote: Compressing objects: 3% (4/132)
remote: Compressing objects: 4% (6/132)
remote: Compressing objects: 5% (7/132)
remote: Compressing objects: 6% (8/132)
remote: Compressing objects: 7% (10/132)
remote: Compressing objects: 8% (11/132)
remote: Compressing objects: 9% (12/132)
remote: Compressing objects: 10% (14/132)
.. parsed-literal::
remote: Compressing objects: 11% (15/132)
remote: Compressing objects: 12% (16/132)
remote: Compressing objects: 13% (18/132)
remote: Compressing objects: 14% (19/132)
.. parsed-literal::
remote: Compressing objects: 15% (20/132)
remote: Compressing objects: 16% (22/132)
.. parsed-literal::
remote: Compressing objects: 17% (23/132)
remote: Compressing objects: 18% (24/132)
.. parsed-literal::
remote: Compressing objects: 19% (26/132)
remote: Compressing objects: 20% (27/132)
remote: Compressing objects: 21% (28/132)
.. parsed-literal::
remote: Compressing objects: 22% (30/132)
remote: Compressing objects: 23% (31/132)
remote: Compressing objects: 24% (32/132)
.. parsed-literal::
remote: Compressing objects: 25% (33/132)
remote: Compressing objects: 26% (35/132)
remote: Compressing objects: 27% (36/132)
remote: Compressing objects: 28% (37/132)
remote: Compressing objects: 29% (39/132)
remote: Compressing objects: 30% (40/132)
remote: Compressing objects: 31% (41/132)
remote: Compressing objects: 32% (43/132)
remote: Compressing objects: 33% (44/132)
remote: Compressing objects: 34% (45/132)
remote: Compressing objects: 35% (47/132)
remote: Compressing objects: 36% (48/132)
remote: Compressing objects: 37% (49/132)
remote: Compressing objects: 38% (51/132)
remote: Compressing objects: 39% (52/132)
remote: Compressing objects: 40% (53/132)
remote: Compressing objects: 41% (55/132)
remote: Compressing objects: 42% (56/132)
remote: Compressing objects: 43% (57/132)
remote: Compressing objects: 44% (59/132)
remote: Compressing objects: 45% (60/132)
remote: Compressing objects: 46% (61/132)
remote: Compressing objects: 47% (63/132)
remote: Compressing objects: 48% (64/132)
remote: Compressing objects: 49% (65/132)
remote: Compressing objects: 50% (66/132)
remote: Compressing objects: 51% (68/132)
remote: Compressing objects: 52% (69/132)
remote: Compressing objects: 53% (70/132)
remote: Compressing objects: 54% (72/132)
remote: Compressing objects: 55% (73/132)
remote: Compressing objects: 56% (74/132)
remote: Compressing objects: 57% (76/132)
remote: Compressing objects: 58% (77/132)
remote: Compressing objects: 59% (78/132)
remote: Compressing objects: 60% (80/132)
remote: Compressing objects: 61% (81/132)
remote: Compressing objects: 62% (82/132)
remote: Compressing objects: 63% (84/132)
remote: Compressing objects: 64% (85/132)
remote: Compressing objects: 65% (86/132)
remote: Compressing objects: 66% (88/132)
remote: Compressing objects: 67% (89/132)
remote: Compressing objects: 68% (90/132)
remote: Compressing objects: 69% (92/132)
remote: Compressing objects: 70% (93/132)
remote: Compressing objects: 71% (94/132)
remote: Compressing objects: 72% (96/132)
remote: Compressing objects: 73% (97/132)
remote: Compressing objects: 74% (98/132)
remote: Compressing objects: 75% (99/132)
remote: Compressing objects: 76% (101/132)
remote: Compressing objects: 77% (102/132)
remote: Compressing objects: 78% (103/132)
remote: Compressing objects: 79% (105/132)
remote: Compressing objects: 80% (106/132)
remote: Compressing objects: 81% (107/132)
.. parsed-literal::
remote: Compressing objects: 82% (109/132)
remote: Compressing objects: 83% (110/132)
remote: Compressing objects: 84% (111/132)
remote: Compressing objects: 85% (113/132)
remote: Compressing objects: 86% (114/132)
remote: Compressing objects: 87% (115/132)
remote: Compressing objects: 88% (117/132)
remote: Compressing objects: 89% (118/132)
remote: Compressing objects: 90% (119/132)
remote: Compressing objects: 91% (121/132)
remote: Compressing objects: 92% (122/132)
remote: Compressing objects: 93% (123/132)
remote: Compressing objects: 94% (125/132)
remote: Compressing objects: 95% (126/132)
remote: Compressing objects: 96% (127/132)
remote: Compressing objects: 97% (129/132)
remote: Compressing objects: 98% (130/132)
remote: Compressing objects: 99% (131/132)
remote: Compressing objects: 100% (132/132)
remote: Compressing objects: 100% (132/132), done.
Receiving objects: 0% (1/168)
Receiving objects: 1% (2/168)
Receiving objects: 2% (4/168)
Receiving objects: 3% (6/168)
Receiving objects: 4% (7/168)
Receiving objects: 5% (9/168)
Receiving objects: 6% (11/168)
Receiving objects: 7% (12/168)
Receiving objects: 8% (14/168)
Receiving objects: 9% (16/168)
Receiving objects: 10% (17/168)
Receiving objects: 11% (19/168)
Receiving objects: 12% (21/168)
Receiving objects: 13% (22/168)
Receiving objects: 14% (24/168)
Receiving objects: 15% (26/168)
Receiving objects: 16% (27/168)
Receiving objects: 17% (29/168)
Receiving objects: 18% (31/168)
Receiving objects: 19% (32/168)
Receiving objects: 20% (34/168)
Receiving objects: 21% (36/168)
Receiving objects: 22% (37/168)
Receiving objects: 23% (39/168)
.. parsed-literal::
Receiving objects: 24% (41/168)
Receiving objects: 25% (42/168)
Receiving objects: 26% (44/168)
Receiving objects: 27% (46/168)
Receiving objects: 28% (48/168)
Receiving objects: 29% (49/168)
Receiving objects: 30% (51/168)
Receiving objects: 31% (53/168)
Receiving objects: 32% (54/168)
.. parsed-literal::
Receiving objects: 33% (56/168), 1.60 MiB | 3.19 MiB/s
Receiving objects: 34% (58/168), 1.60 MiB | 3.19 MiB/s
Receiving objects: 35% (59/168), 1.60 MiB | 3.19 MiB/s
.. parsed-literal::
Receiving objects: 36% (61/168), 1.60 MiB | 3.19 MiB/s
.. parsed-literal::
Receiving objects: 37% (63/168), 1.60 MiB | 3.19 MiB/s
Receiving objects: 38% (64/168), 1.60 MiB | 3.19 MiB/s
Receiving objects: 39% (66/168), 1.60 MiB | 3.19 MiB/s
Receiving objects: 39% (66/168), 12.00 MiB | 11.99 MiB/s
.. parsed-literal::
Receiving objects: 40% (68/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 41% (69/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 42% (71/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 43% (73/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 44% (74/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 45% (76/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 46% (78/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 47% (79/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 48% (81/168), 12.00 MiB | 11.99 MiB/s
.. parsed-literal::
Receiving objects: 49% (83/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 50% (84/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 51% (86/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 52% (88/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 53% (90/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 54% (91/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 55% (93/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 56% (95/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 57% (96/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 58% (98/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 59% (100/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 60% (101/168), 12.00 MiB | 11.99 MiB/s
Receiving objects: 61% (103/168), 12.00 MiB | 11.99 MiB/s
.. parsed-literal::
Receiving objects: 62% (105/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 63% (106/168), 22.22 MiB | 14.29 MiB/s
.. parsed-literal::
remote: Total 168 (delta 73), reused 114 (delta 28), pack-reused 0
Receiving objects: 64% (108/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 65% (110/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 66% (111/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 67% (113/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 68% (115/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 69% (116/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 70% (118/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 71% (120/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 72% (121/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 73% (123/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 74% (125/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 75% (126/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 76% (128/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 77% (130/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 78% (132/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 79% (133/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 80% (135/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 81% (137/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 82% (138/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 83% (140/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 84% (142/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 85% (143/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 86% (145/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 87% (147/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 88% (148/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 89% (150/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 90% (152/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 91% (153/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 92% (155/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 93% (157/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 94% (158/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 95% (160/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 96% (162/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 97% (163/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 98% (165/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 99% (167/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 100% (168/168), 22.22 MiB | 14.29 MiB/s
Receiving objects: 100% (168/168), 26.22 MiB | 15.49 MiB/s, done.
Resolving deltas: 0% (0/73)
Resolving deltas: 1% (1/73)
Resolving deltas: 13% (10/73)
Resolving deltas: 21% (16/73)
Resolving deltas: 31% (23/73)
Resolving deltas: 45% (33/73)
Resolving deltas: 60% (44/73)
Resolving deltas: 61% (45/73)
Resolving deltas: 63% (46/73)
Resolving deltas: 68% (50/73)
Resolving deltas: 71% (52/73)
Resolving deltas: 72% (53/73)
Resolving deltas: 73% (54/73)
Resolving deltas: 79% (58/73)
Resolving deltas: 84% (62/73)
Resolving deltas: 98% (72/73)
Resolving deltas: 100% (73/73)
Resolving deltas: 100% (73/73), done.
Convert Tensorflow Lite model to OpenVINO IR format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The attention-center model is pre-trained model in TensorFlow Lite
format. In this Notebook the model will be converted to OpenVINO IR
format with model conversion API. For more information about model
conversion, see this
`page <https://docs.openvino.ai/2024/openvino-workflow/model-preparation.html>`__.
This step is also skipped if the model is already converted.
Also TFLite models format is supported in OpenVINO by TFLite frontend,
so the model can be passed directly to ``core.read_model()``. You can
find example in
`002-openvino-api <https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/002-openvino-api>`__.
.. code:: ipython3
tflite_model_path = Path("./attention-center/model/center.tflite")
ir_model_path = Path("./model/ir_center_model.xml")
core = ov.Core()
if not ir_model_path.exists():
model = ov.convert_model(tflite_model_path, input=[('image:0', [1,480,640,3], ov.Type.f32)])
ov.save_model(model, ir_model_path)
print("IR model saved to {}".format(ir_model_path))
else:
print("Read IR model from {}".format(ir_model_path))
model = core.read_model(ir_model_path)
.. parsed-literal::
IR model saved to model/ir_center_model.xml
Select inference device
-----------------------
select device from dropdown list for running inference using OpenVINO
.. code:: ipython3
import ipywidgets as widgets
device = widgets.Dropdown(
options=core.available_devices + ["AUTO"],
value='AUTO',
description='Device:',
disabled=False,
)
device
.. parsed-literal::
Dropdown(description='Device:', index=1, options=('CPU', 'AUTO'), value='AUTO')
.. code:: ipython3
if "GPU" in device.value:
core.set_property(device_name=device.value, properties={'INFERENCE_PRECISION_HINT': ov.Type.f32})
compiled_model = core.compile_model(model=model, device_name=device.value)
Prepare image to use with attention-center model
------------------------------------------------
The attention-center model takes an RGB image with shape (480, 640) as
input.
.. code:: ipython3
class Image():
def __init__(self, model_input_image_shape, image_path=None, image=None):
self.model_input_image_shape = model_input_image_shape
self.image = None
self.real_input_image_shape = None
if image_path is not None:
self.image = cv2.imread(str(image_path))
self.real_input_image_shape = self.image.shape
elif image is not None:
self.image = image
self.real_input_image_shape = self.image.shape
else:
raise Exception("Sorry, image can't be found, please, specify image_path or image")
def prepare_image_tensor(self):
rgb_image = cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB)
resized_image = cv2.resize(rgb_image, (self.model_input_image_shape[1], self.model_input_image_shape[0]))
image_tensor = tf.constant(np.expand_dims(resized_image, axis=0),
dtype=tf.float32)
return image_tensor
def scalt_center_to_real_image_shape(self, predicted_center):
new_center_y = round(predicted_center[0] * self.real_input_image_shape[1] / self.model_input_image_shape[1])
new_center_x = round(predicted_center[1] * self.real_input_image_shape[0] / self.model_input_image_shape[0])
return (int(new_center_y), int(new_center_x))
def draw_attention_center_point(self, predicted_center):
image_with_circle = cv2.circle(self.image,
predicted_center,
radius=10,
color=(3, 3, 255),
thickness=-1)
return image_with_circle
def print_image(self, predicted_center=None):
image_to_print = self.image
if predicted_center is not None:
image_to_print = self.draw_attention_center_point(predicted_center)
plt.imshow(cv2.cvtColor(image_to_print, cv2.COLOR_BGR2RGB))
Load input image
----------------
Upload input image using file loading button
.. code:: ipython3
import ipywidgets as widgets
load_file_widget = widgets.FileUpload(
accept="image/*", multiple=False, description="Image file",
)
load_file_widget
.. parsed-literal::
FileUpload(value=(), accept='image/*', description='Image file')
.. code:: ipython3
import io
import PIL
from urllib.request import urlretrieve
img_path = Path("data/coco.jpg")
img_path.parent.mkdir(parents=True, exist_ok=True)
urlretrieve(
"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/coco.jpg",
img_path,
)
# read uploaded image
image = PIL.Image.open(io.BytesIO(list(load_file_widget.value.values())[-1]['content'])) if load_file_widget.value else PIL.Image.open(img_path)
image.convert("RGB")
input_image = Image((480, 640), image=(np.ascontiguousarray(image)[:, :, ::-1]).astype(np.uint8))
image_tensor = input_image.prepare_image_tensor()
input_image.print_image()
.. parsed-literal::
2024-03-12 23:28:11.205498: E tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc:266] failed call to cuInit: CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE: forward compatibility was attempted on non supported HW
2024-03-12 23:28:11.205530: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:168] retrieving CUDA diagnostic information for host: iotg-dev-workstation-07
2024-03-12 23:28:11.205534: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:175] hostname: iotg-dev-workstation-07
2024-03-12 23:28:11.205690: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:199] libcuda reported version is: 470.223.2
2024-03-12 23:28:11.205706: I tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:203] kernel reported version is: 470.182.3
2024-03-12 23:28:11.205709: E tensorflow/compiler/xla/stream_executor/cuda/cuda_diagnostics.cc:312] kernel version 470.182.3 does not match DSO version 470.223.2 -- cannot find working devices in this configuration
.. image:: 216-attention-center-with-output_files/216-attention-center-with-output_15_1.png
Get result with OpenVINO IR model
---------------------------------
.. code:: ipython3
output_layer = compiled_model.output(0)
# make inference, get result in input image resolution
res = compiled_model([image_tensor])[output_layer]
# scale point to original image resulution
predicted_center = input_image.scalt_center_to_real_image_shape(res[0])
print(f'Prediction attention center point {predicted_center}')
input_image.print_image(predicted_center)
.. parsed-literal::
Prediction attention center point (292, 277)
.. image:: 216-attention-center-with-output_files/216-attention-center-with-output_17_1.png

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5712bd24e962ae0e0267607554ebe1f2869c223b108876ce10e5d20fe6285126
size 387941

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cd48ceba3733fc5b2050e969f2fb278e9f9d826604f23be5405c05358888beb0
size 387905

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d7694af95a9b442cc193ef929e580051c778d45a318b2258a060f0c0ac1d35b
size 172680

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:59b84bcb1a2004cfb5a192c6801e818fe1a15a881c97dd2d310266e8e654e941
size 19599

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7175d7bc58325a7c169a5c632a71bb01aa27685020ade9b53bcd8fb6d55c013f
size 175941

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9aa9eeb946249859a5cfcbd1fe51e653540df65edf0aa7fc6df5ce2b6ec24873
size 415784

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c1cdd9c25b0b4a2fb4d93dcea24e9de9796e95d97c50c69fceee25f713cc7a50
size 284968

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b222b97c1acc37d19b21ac6e8d0d4b234cb9701428683054cd4aea230d974dcb
size 64438

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e0fab55322d09f8862ac70abfeb925177be0ffa6621b46d3803e44a6bbe8f92
size 566882

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e56f878a1bac66ee2b415ee5a99c934d391780cc7e3233f225a65bab65a7eb59
size 63349

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bf12caffa24f9d0454d80d200e9428cf7d15ca4331345141e7d6d0b018679f72
size 572283

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f8e0864d313aab7f8ae6af7dff01c4e8cdd07e201a4a4bf7271883e32afdbce3
size 63448

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5b835cdb94aa77319ba68e76d462cef01ec81c71c846d26b44837be7071485f6
size 572078

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0dc96d6ea30eb847e9bb4d21746a7023fb9c65bec9e541a9ee6a3285e29e303f
size 81079

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:860af64994d31c78cca5b135d123b43fa6ce242e7c9a9d405af71f6378ca8371
size 790288

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a8d24361c768d325a0e2312d6017b2a6009acd74016c474210321b4b4b9abcec
size 104433

Some files were not shown because too many files have changed in this diff Show More