Skip to content

Commit

Permalink
Merge branch 'main' into rerank
Browse files Browse the repository at this point in the history
  • Loading branch information
openvino-dev-samples authored Mar 26, 2024
2 parents 56cf739 + e2ec5ab commit bbf1560
Show file tree
Hide file tree
Showing 42 changed files with 3,099 additions and 976 deletions.
2 changes: 1 addition & 1 deletion .ci/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# black==21.8 requires typing-extensions>3.10 which is incompatible
# with other packages
-r ../requirements.txt
black==21.7b0 # format Python code
black==24.3.0 # format Python code
isort # sort imports
jupyterlab-code-formatter # format code in notebooks in Jupyter Lab
jupyterlab-git # checkout and commit code in Jupyter Lab
Expand Down
4 changes: 3 additions & 1 deletion .ci/ignore_pip_conflicts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ notebooks/109-performance-tricks/109-throughput-tricks.ipynb # ultralytics<=8.0
notebooks/123-detectron2-to-openvino/123-detectron2-to-openvino.ipynb # detectron2@https://github.com/facebookresearch/detectron2
notebooks/122-quantizing-model-with-accuracy-control/122-yolov8-quantization-with-accuracy-control.ipynb # ultralytics==8.0.43
notebooks/204-segmenter-semantic-segmentation/204-segmenter-semantic-segmentation.ipynb # timm==0.4.12, install Segmenter requirements
notebooks/211-speech-to-text/211-speech-to-text.ipynb # numpy<1.24
notebooks/212-pyannote-speaker-diarization/212-pyannote-speaker-diarization.ipynb # pyannote-audio@https://github.com/eaidova/pyannote-audio
notebooks/230-yolov8-optimization/230-yolov8-instance-segmentation.ipynb # ultralytics==8.0.43
notebooks/230-yolov8-optimization/230-yolov8-keypoint-detection.ipynb # ultralytics==8.0.159
Expand All @@ -18,4 +19,5 @@ notebooks/273-stable-zephyr-3b-chatbot/273-stable-zephyr-3b-chatbot.ipynb # inst
notebooks/279-mobilevlm-language-assistant/279-mobilevlm-language-assistant.ipynb # transformers<4.35
notebooks/280-depth-anything/280-depth-anything.ipynb # install requirements.txt after clone repo
notebooks/285-surya-line-level-text-detection/285-surya-line-level-text-detection.ipynb # requires python >=3.9
notebooks/289-mobileclip-video-search/289-mobileclip-video-search.ipynb # install requirements.txt inside
notebooks/289-mobileclip-video-search/289-mobileclip-video-search.ipynb # install requirements.txt inside
notebooks/291-stable-diffusion-keras-cv/291-stable-diffusion-keras-cv.ipynb # requires python >=3.9
1 change: 1 addition & 0 deletions .ci/ignore_treon_docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
284-openvoice
285-surya-line-level-text-detection
286-instant-id
291-stable-diffusion-keras-cv
301-tensorflow-training-openvino
305-tensorflow-quantization-aware-training
404-style-transfer-webcam
1 change: 1 addition & 0 deletions .ci/ignore_treon_linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@
284-openvoice
285-surya-line-level-text-detection
286-instant-id
291-stable-diffusion-keras-cv
404-style-transfer-webcam
1 change: 1 addition & 0 deletions .ci/ignore_treon_mac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@
285-surya-line-level-text-detection
286-instant-id
288-grounded-segment-anything
291-stable-diffusion-keras-cv
404-style-transfer-webcam
1 change: 1 addition & 0 deletions .ci/ignore_treon_win.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@
284-openvoice
285-surya-line-level-text-detection
286-instant-id
291-stable-diffusion-keras-cv
4 changes: 4 additions & 0 deletions .ci/spellcheck/.pyspelling.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ activations
adaptively
adas
ADE
adversarially
aeroplane
affective
ai
Expand Down Expand Up @@ -209,6 +210,7 @@ enum
et
Evol
EVS
facto
fastcomposer
FastComposer
FastSAM
Expand Down Expand Up @@ -325,6 +327,7 @@ Kalman
kbps
KD
keras
KerasCV
keypoint
keypoints
KiTS
Expand Down Expand Up @@ -377,6 +380,7 @@ LSTM
Luo
LVLM
macOS
Magika
Mahalanobis
Mapillary
Markovian
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/treon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ jobs:
- name: Download long loading models
run: |
mkdir notebooks/203-meter-reader/model
curl -o notebooks/203-meter-reader/model/meter_det_model.tar.gz 'https://bj.bcebos.com/paddlex/examples2/meter_reader/meter_det_model.tar.gz'
curl -o notebooks/203-meter-reader/model/meter_seg_model.tar.gz 'https://bj.bcebos.com/paddlex/examples2/meter_reader/meter_seg_model.tar.gz'
curl -o notebooks/203-meter-reader/model/meter_det_model.tar.gz 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/meter-reader/meter_det_model.tar.gz'
curl -o notebooks/203-meter-reader/model/meter_seg_model.tar.gz 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/meter-reader/meter_seg_model.tar.gz'
mkdir notebooks/405-paddle-ocr-webcam/model
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_det_infer.tar 'https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar'
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_rec_infer.tar 'https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar'
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_det_infer.tar 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/paddle-ocr/ch_PP-OCRv3_det_infer.tar'
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_rec_infer.tar 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/paddle-ocr/ch_PP-OCRv3_rec_infer.tar'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/treon_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-20.04, windows-2019, macos-12]
python: ["3.8", "3.9", "3.10"]
python: ["3.10", "3.9", "3.8"]
steps:

#### Installation/preparation ####
Expand Down Expand Up @@ -157,11 +157,11 @@ jobs:
- name: Download long loading models
run: |
mkdir notebooks/203-meter-reader/model
curl -o notebooks/203-meter-reader/model/meter_det_model.tar.gz 'https://bj.bcebos.com/paddlex/examples2/meter_reader/meter_det_model.tar.gz'
curl -o notebooks/203-meter-reader/model/meter_seg_model.tar.gz 'https://bj.bcebos.com/paddlex/examples2/meter_reader/meter_seg_model.tar.gz'
curl -o notebooks/203-meter-reader/model/meter_det_model.tar.gz 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/meter-reader/meter_det_model.tar.gz'
curl -o notebooks/203-meter-reader/model/meter_seg_model.tar.gz 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/meter-reader/meter_seg_model.tar.gz'
mkdir notebooks/405-paddle-ocr-webcam/model
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_det_infer.tar 'https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar'
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_rec_infer.tar 'https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar'
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_det_infer.tar 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/paddle-ocr/ch_PP-OCRv3_det_infer.tar'
curl -o notebooks/405-paddle-ocr-webcam/model/ch_PP-OCRv3_rec_infer.tar 'https://storage.openvinotoolkit.org/repositories/openvino_notebooks/models/paddle-ocr/ch_PP-OCRv3_rec_infer.tar'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"This short tutorial shows how to convert a TensorFlow [MobileNetV3](https://docs.openvino.ai/2024/omz_models_model_mobilenet_v3_small_1_0_224_tf.html) image classification model to OpenVINO [Intermediate Representation](https://docs.openvino.ai/2024/documentation/openvino-ir-format/operation-sets.html) (OpenVINO IR) format, using [Model Conversion API](https://docs.openvino.ai/2024/openvino-workflow/model-preparation.html). After creating the OpenVINO IR, load the model in [OpenVINO Runtime](https://docs.openvino.ai/2024/openvino-workflow/running-inference.html) and do inference with a sample image. \n",
"\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 @@ -33,8 +34,20 @@
"metadata": {},
"outputs": [],
"source": [
"import platform\n",
"# Install openvino package\n",
"%pip install -q \"openvino>=2023.1.0\""
"%pip install -q \"openvino>=2023.1.0\" \"opencv-python\"\n",
"if platform.system() != \"Windows\":\n",
" %pip install -q \"matplotlib>=3.4\"\n",
"else:\n",
" %pip install -q \"matplotlib>=3.4,<3.7\"\n",
"%pip install -q \"tensorflow-macos>=2.5; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version > '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow-macos>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version <= '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow>=2.5; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version > '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version <= '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5; sys_platform != 'darwin' and python_version > '3.8'\"\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform != 'darwin' and python_version <= '3.8'\"\n",
"%pip install -q tf_keras tensorflow_hub"
]
},
{
Expand Down Expand Up @@ -66,9 +79,13 @@
}
],
"source": [
"import os\n",
"import time\n",
"from pathlib import Path\n",
"\n",
"os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"2\"\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\"\n",
"\n",
"import cv2\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
Expand Down Expand Up @@ -462,7 +479,7 @@
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -476,7 +493,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.4"
},
"openvino_notebooks": {
"imageUrl": "https://user-images.githubusercontent.com/36741649/127170593-86976dc3-e5e4-40be-b0a6-206379cd7df5.jpg",
Expand All @@ -494,4 +511,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ The notebook shows how to convert the [TensorFlow MobileNetV3 model](https://www

## Installation Instructions

If you have not installed all required dependencies, follow the [Installation Guide](../../README.md).
This is a self-contained example that relies solely on its own code.</br>
We recommend running the notebook in a virtual environment. You only need a Jupyter server to start.
For details, please refer to [Installation Guide](../../README.md).
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"metadata": {},
"source": [
"\n",
"#### Table of contents:\n\n",
"#### Table of contents:\n",
"\n",
"- [Settings](#Settings)\n",
"- [Imports](#Imports)\n",
" - [Setup image and device](#Setup-image-and-device)\n",
Expand Down Expand Up @@ -65,8 +66,20 @@
"metadata": {},
"outputs": [],
"source": [
"import platform\n",
"# Install openvino package\n",
"%pip install -q \"openvino>=2023.1.0\" tensorflow opencv-python matplotlib"
"%pip install -q \"openvino>=2023.1.0\" opencv-python\n",
"if platform.system() != \"Windows\":\n",
" %pip install -q \"matplotlib>=3.4\"\n",
"else:\n",
" %pip install -q \"matplotlib>=3.4,<3.7\"\n",
"\n",
"%pip install -q \"tensorflow-macos>=2.5; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version > '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow-macos>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version <= '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow>=2.5; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version > '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version <= '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5; sys_platform != 'darwin' and python_version > '3.8'\"\n",
"%pip install -q \"tensorflow>=2.5; sys_platform != 'darwin' and python_version <= '3.8'\"\n"
]
},
{
Expand Down Expand Up @@ -97,8 +110,12 @@
],
"source": [
"import time\n",
"import os\n",
"from pathlib import Path\n",
"\n",
"os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"2\"\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\"\n",
"\n",
"import cv2\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
Expand Down Expand Up @@ -789,7 +806,7 @@
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -803,7 +820,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.4"
},
"openvino_notebooks": {
"imageUrl": "",
Expand All @@ -827,4 +844,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
4 changes: 3 additions & 1 deletion notebooks/118-optimize-preprocessing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ The tutorial consists of the following steps:

## Installation Instructions

If you have not installed all required dependencies, follow the [Installation Guide](../../README.md).
This is a self-contained example that relies solely on its own code.</br>
We recommend running the notebook in a virtual environment. You only need a Jupyter server to start.
For details, please refer to [Installation Guide](../../README.md).
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@
"if platform.system() != \"Windows\":\n",
" %pip install -q \"matplotlib>=3.4\"\n",
"else:\n",
" %pip install -q \"matplotlib>=3.4,<3.7\""
" %pip install -q \"matplotlib>=3.4,<3.7\"\n",
"\n",
"%pip install -q \"tensorflow-macos>=2.5; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version > '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow-macos>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version <= '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow>=2.5; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version > '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version <= '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5; sys_platform != 'darwin' and python_version > '3.8'\"\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform != 'darwin' and python_version <= '3.8'\""
]
},
{
Expand Down Expand Up @@ -890,7 +897,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.4"
},
"openvino_notebooks": {
"imageUrl": "https://github.com/itrushkin/openvino_notebooks/assets/76161256/b0acc7bb-92c7-4c83-9484-84a8e1b798b7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@
"if platform.system() != \"Windows\":\n",
" %pip install -q \"matplotlib>=3.4\"\n",
"else:\n",
" %pip install -q \"matplotlib>=3.4,<3.7\""
" %pip install -q \"matplotlib>=3.4,<3.7\"\n",
"%pip install -q \"tensorflow-macos>=2.5; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version > '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow-macos>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version <= '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow>=2.5; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version > '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version <= '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5; sys_platform != 'darwin' and python_version > '3.8'\"\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform != 'darwin' and python_version <= '3.8'\""
]
},
{
Expand Down Expand Up @@ -920,7 +926,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.4"
},
"openvino_notebooks": {
"imageUrl": "https://github.com/openvinotoolkit/openvino_notebooks/assets/41733560/f9b59be1-1d2f-4e13-9678-67205be78841",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@
"ov_config = {}\n",
"if \"GPU\" in device.value or (\"AUTO\" in device.value and \"GPU\" in core.available_devices):\n",
" ov_config = {\"GPU_DISABLE_WINOGRAD_CONVOLUTION\": \"YES\"}\n",
"quantized_compiled_model = core.compile_model(model=quantized_model, device.value, ov_config)\n",
"compiled_ov_model = core.compile_model(model=ov_model, device.value, ov_config)\n",
"quantized_compiled_model = core.compile_model(quantized_model, device.value, ov_config)\n",
"compiled_ov_model = core.compile_model(ov_model, device.value, ov_config)\n",
"\n",
"pt_result = validation_ac(compiled_ov_model, data_loader, validator)\n",
"quantized_result = validation_ac(quantized_compiled_model, data_loader, validator)\n",
Expand Down
17 changes: 13 additions & 4 deletions notebooks/126-tensorflow-hub/126-tensorflow-hub.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,21 @@
"source": [
"import platform\n",
"\n",
"%pip install -q tensorflow_hub tensorflow pillow numpy\n",
"%pip install -q pillow numpy\n",
"%pip install -q \"openvino>=2023.2.0\"\n",
"\n",
"if platform.system() != \"Windows\":\n",
" %pip install -q \"matplotlib>=3.4\"\n",
"else:\n",
" %pip install -q \"matplotlib>=3.4,<3.7\""
" %pip install -q \"matplotlib>=3.4,<3.7\"\n",
"\n",
"%pip install -q \"tensorflow-macos>=2.5; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version > '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow-macos>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version <= '3.8'\" # macOS M1 and M2\n",
"%pip install -q \"tensorflow>=2.5; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version > '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform == 'darwin' and platform_machine != 'arm64' and python_version <= '3.8'\" # macOS x86\n",
"%pip install -q \"tensorflow>=2.5; sys_platform != 'darwin' and python_version > '3.8'\"\n",
"%pip install -q \"tensorflow>=2.5,<=2.12.0; sys_platform != 'darwin' and python_version <= '3.8'\"\n",
"%pip install -q tf_keras tensorflow_hub"
]
},
{
Expand All @@ -108,6 +116,7 @@
"import os\n",
"from urllib.request import urlretrieve\n",
"os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"2\"\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\"\n",
"\n",
"import tensorflow_hub as hub\n",
"import tensorflow as tf\n",
Expand Down Expand Up @@ -683,7 +692,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -697,7 +706,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.4"
},
"openvino_notebooks": {
"imageUrl": "",
Expand Down
Loading

0 comments on commit bbf1560

Please sign in to comment.