- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to run the Python person tracking example from the OpenVINO website and I get a syntax error from
! $download_command
If I put the whole line into quotes, there is no error. But then the script doesn't download the model files. How can I download the files for the example? The whole code until the error:
import collections
import sys
import time
import numpy as np
import cv2
#from IPython import display
import matplotlib.pyplot as plt
from openvino.runtime import Core
from Model import Model
#sys.path.append("../utils")
#import notebook_utils as utils
from deep_sort.deep_sort.tracker import Tracker
from deep_sort.deep_sort.nn_matching import NearestNeighborDistanceMetric
from deep_sort.deep_sort.detection import Detection
# A directory where the model will be downloaded.
base_model_dir = "Downloads"
precision = "FP16"
# The name of the model from Open Model Zoo
detection_model_name = "person-detection-0203"
download_command = f"omz_downloader " \
f"--name {detection_model_name} " \
f"--precisions {precision} " \
f"--output_dir {base_model_dir} " \
f"--cache_dir {base_model_dir}"
! $download_command
detection_model_path = f"Downloads/intel/{detection_model_name}/{precision}/{detection_model_name}.xml"
reidentification_model_name = "person-reidentification-retail-0277"
download_command = f"omz_downloader " \
f"--name {reidentification_model_name} " \
f"--precisions {precision} " \
f"--output_dir {base_model_dir} " \
f"--cache_dir {base_model_dir}"
! $download_command
reidentification_model_path = f"Downloads/intel/{reidentification_model_name}/{precision}/{reidentification_model_name}.xml"
detector = Model(detection_model_path)
# since the number of detection object is uncertain, the input batch size of reid model should be dynamic
extractor = Model(reidentification_model_path, -1)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jvkloc,
Thank you for reaching out to us.
For your information, the Python example is from our OpenVINO Notebook tutorials. Please install Jupyter Notebook following this installation guide to run the tutorial.
Next, run the following command to start the 407-person-tracking-webcam notebook:
jupyter lab notebooks\407-person-tracking-webcam\407-person-tracking.ipynb
Hope this helps.
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
Thank you for your reply. My aim is to use person tracking as part of another program and Notebook is not an option. How can I download the model files for OpenVINO? I'm using Python 3.9 and Ubuntu 22.04.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jvkloc,
The models used for the example are person-detection-0202 and person-reidentification-retail-0287 which are mentioned in Download the Model section.
Install OpenVINO Development Tools and run the following command in a terminal to download the respective models:
omz_downloader --name person-detection-0202
omz_downloader --name person-reidentification-retail-0287
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great, thank you! I got the downloads to right folders but now line 42 of my code (in the first post)
detector = Model(detection_model_path)
gives
builtins.RuntimeError: Check 'false' failed at C:\Jenkins\workspace\private-ci\ie\build-windows-vs2019\b\repos\openvino\src\inference\src\core.cpp:100:
Model file Downloads/intel/person-detection-0203/FP16/person-detection-0203.xml cannot be opened!
This is the example code of Model class up to the line 17 which causes the error above.
ie_core = Core()
class Model:
"""
This class represents a OpenVINO model object.
"""
def __init__(self, model_path, batchsize=1, device="AUTO"):
"""
Initialize the model object
Parameters
----------
model_path: path of inference model
batchsize: batch size of input data
device: device used to run inference
"""
self.model = ie_core.read_model(model=model_path)
How can this be fixed?
EDIT: I have checked the files and folders, they're in the right place.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jvkloc,
Please provide the full script of your example to us so that we can investigate this issue further.
Furthermore, please share the list of your installed pip modules with us. Run the following command to print the list of installed modules:
pip list
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
here is the pip list:
Package Version
------------------- -----------
addict 2.4.0
asttokens 2.2.1
backcall 0.2.0
beautifulsoup4 4.12.2
certifi 2023.5.7
charset-normalizer 3.1.0
colorama 0.4.6
comm 0.1.3
contourpy 1.1.0
cycler 0.11.0
dearpygui 1.9.1
debugpy 1.6.7
decorator 5.1.1
defusedxml 0.7.1
executing 1.2.0
filelock 3.12.2
filterpy 1.4.5
fonttools 4.40.0
gdown 4.7.1
gitdb 4.0.10
GitPython 3.1.31
idna 3.4
importlib-metadata 6.7.0
importlib-resources 5.12.0
ipyfilechooser 0.6.0
ipykernel 6.23.3
ipython 8.14.0
ipywidgets 8.0.6
jedi 0.18.2
Jinja2 3.1.2
jstyleson 0.0.2
jupyter_client 8.3.0
jupyter_core 5.3.1
jupyterlab-widgets 3.0.7
kiwisolver 1.4.4
loguru 0.7.0
MarkupSafe 2.1.3
matplotlib 3.7.1
matplotlib-inline 0.1.6
motmetrics 1.4.0
motrackers 0.0.1
mpmath 1.3.0
nest-asyncio 1.5.6
networkx 2.8.8
numpy 1.23.1
opencv-python 4.8.0.74
openvino 2023.0.0
openvino-dev 2023.0.0
openvino-telemetry 2023.0.0
osc4py3 1.0.8
packaging 23.1
pandas 2.0.3
parso 0.8.3
pickleshare 0.7.5
Pillow 9.5.0
pip 23.1.2
platformdirs 3.8.0
prompt-toolkit 3.0.38
psutil 5.9.5
pure-eval 0.2.2
Pygments 2.15.1
pyparsing 3.1.0
pyrealsense2 2.54.1.5217
PySocks 1.7.1
python-dateutil 2.8.2
pytz 2023.3
pywin32 306
PyYAML 6.0
pyzmq 25.1.0
requests 2.31.0
scipy 1.11.0
setuptools 56.0.0
six 1.16.0
smmap 5.0.0
soupsieve 2.4.1
stack-data 0.6.2
sympy 1.12
texttable 1.6.7
torch 2.0.1
torchvision 0.15.2
tornado 6.3.2
tqdm 4.65.0
traitlets 5.9.0
typing_extensions 4.7.1
tzdata 2023.3
urllib3 2.0.3
wcwidth 0.2.6
widgetsnbextension 4.0.7
win32-setctime 1.1.0
xmltodict 0.13.0
xsensdeviceapi 2022.0.0
zipp 3.15.0
The full script is already posted in this topic. The error is caused by line 42 of the script in the first post. Module class is in my previous post where I declared the error. Both of them are from the OpenVINO website example linked in the first post. I commented out the few Notebook - related imports.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jvkloc,
Please ensure the location of the model folder are in the same directory as your sample script in the following configuration:
/sample_script.py
/model
--/intel
--/person-detection-0202
--/FP16
--/person-detection-0202.xml
--/person-detection-0202.bin
--/person-reidentification-retail-0287
--/FP16
--/person-reidentification-retail-0287.xml
--/person-reidentification-retail-0287.bin
Please note that the Person Tracking with OpenVINO™ code is written specifically for Jupyter Notebook and might not work correctly outside of a Jupyter Notebook environment.
I'd suggest for you to try out our Multi Camera Multi Target Python* Demo from Open Model Zoo which can also be used for person tracking and be ran directly from a terminal.
Here is the command to run the Multi Camera Multi Target Python Demo:
python multi_camera_multi_target_tracking_demo.py --m_detector person-detection-retail-0013.xml --m_reid person-reidentification-retail-0287.xml -i <input_sources> --config configs\person.py
Regards,
Hairul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I added the extra folder (model) to the path just to be sure to get the same error. And I did get the same error. I'll try your example suggestion and post a new topic if I encounter problems with that. Thank you for your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jvkloc,
Feel free to open up a new question if you face any issue and we'll be happy to assist you.
This thread will no longer be monitored since we have provided information. If you need any additional information from Intel, please submit a new question.
Regards,
Hairul
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page