Skip to content

Fix model download issue: Download both .xml and .bin files #3012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: latest
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions notebooks/person-tracking-webcam/person-tracking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,34 @@
"# A directory where the model will be downloaded.\n",
Copy link
Collaborator

@aleksandr-mokrov aleksandr-mokrov Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #15.        download_ir_model(download_det_model_xml_url, Path(base_model_dir) / detection_model_name / precision)

download_ir_model accepts xml url, and then download bin and xml files. It checks separately if each of them already exists and downloads if not. So, it is enough to removeif not detection_model_path.exists(): and if not reidentification_model_path.exists():


Reply via ReviewNB

"base_model_dir = \"model\"\n",
"precision = \"FP16\"\n",
"\n",
"# The name of the model from Open Model Zoo\n",
"detection_model_name = \"person-detection-0202\"\n",
"download_det_model_url = (\n",
" f\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1/{detection_model_name}/{precision}/{detection_model_name}.xml\"\n",
")\n",
"detection_model_path = Path(base_model_dir) / detection_model_name / precision / f\"{detection_model_name}.xml\"\n",
"detection_model_bin_path = Path(base_model_dir) / detection_model_name / precision / f\"{detection_model_name}.bin\"\n",
"\n",
"# Download both .xml and .bin files for detection model\n",
"if not detection_model_path.exists():\n",
" download_det_model_xml_url = f\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1/{detection_model_name}/{precision}/{detection_model_name}.xml\"\n",
" download_ir_model(download_det_model_xml_url, Path(base_model_dir) / detection_model_name / precision)\n",
"\n",
" download_ir_model(download_det_model_url, Path(base_model_dir) / detection_model_name / precision)\n",
"if not detection_model_bin_path.exists():\n",
" download_det_model_bin_url = f\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1/{detection_model_name}/{precision}/{detection_model_name}.bin\"\n",
" download_ir_model(download_det_model_bin_url, Path(base_model_dir) / detection_model_name / precision)\n",
"\n",
"# The reidentification model\n",
"reidentification_model_name = \"person-reidentification-retail-0287\"\n",
"download_reid_model_url = f\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1/{reidentification_model_name}/{precision}/{reidentification_model_name}.xml\"\n",
"reidentification_model_path = Path(base_model_dir) / reidentification_model_name / precision / f\"{reidentification_model_name}.xml\"\n",
"reidentification_model_bin_path = Path(base_model_dir) / reidentification_model_name / precision / f\"{reidentification_model_name}.bin\"\n",
"\n",
"# Download both .xml and .bin files for reidentification model\n",
"if not reidentification_model_path.exists():\n",
" download_ir_model(download_reid_model_url, Path(base_model_dir) / reidentification_model_name / precision)"
" download_reid_model_xml_url = f\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1/{reidentification_model_name}/{precision}/{reidentification_model_name}.xml\"\n",
" download_ir_model(download_reid_model_xml_url, Path(base_model_dir) / reidentification_model_name / precision)\n",
"\n",
"if not reidentification_model_bin_path.exists():\n",
" download_reid_model_bin_url = f\"https://storage.openvinotoolkit.org/repositories/open_model_zoo/2023.0/models_bin/1/{reidentification_model_name}/{precision}/{reidentification_model_name}.bin\"\n",
" download_ir_model(download_reid_model_bin_url, Path(base_model_dir) / reidentification_model_name / precision)"
]
},
{
Expand Down Expand Up @@ -723,7 +734,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "openvino_env",
"language": "python",
"name": "python3"
},
Expand All @@ -737,7 +748,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.12.7"
},
"openvino_notebooks": {
"imageUrl": "https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/person-tracking-webcam/person-tracking.gif?raw=true",
Expand All @@ -752,11 +763,6 @@
]
}
},
"vscode": {
"interpreter": {
"hash": "1c707170576399eaaed0c4f2e01a2d1b61ba791ba1842c47e5b3e4f6f79b82ab"
}
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
Expand All @@ -767,4 +773,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}