Community
cancel
Showing results for 
Search instead for 
Did you mean: 
NMitr2
Beginner
360 Views

How to run two models in NCS2

 

hello all,

I have trained my custom models (Tensorflow) and everything works fine in NCS2 for each model, my question is :

How can I run two models object-detection, let me say Model1 and Model 2 at same time using just a NCS2?

I seen that it is possible, but it is not very clear to me, I don't know how to add the second model into the file "object_detection_demo_ssd_async.py", I think I need to works on "parse.add_argument( "-m", "--model" ........ )"..... anyone has some clear examples how to do that??

many thanks

Regards

Nicola

0 Kudos
10 Replies
346 Views

Hello NMitr2,


Thanks for reaching out.


Kindly refer to security_barrier_camera_demo and action recognition demo (python), which supports multiple models in async mode and can also be deployed on a single Intel NCS2.


Also, you can check this discussion or this thread. Hope this helps!


Regards,

Randall.


NMitr2
Beginner
333 Views

Hi Randall,

many thanks for you replay, I have a look your examples you sent to me soon and let you know If I find some problem about that.....

many thanks

Regards

Nicola

NMitr2
Beginner
326 Views

Hi Randall,

I went into the link action_recognition_demo and I downloaded all files needed and saved all it in a same folder on my Desk (action-recognition-0001-decoder.bin, action-recognition-0001-decoder.xml, action-recognition-0001-encoder.bin, action-recognition-0001-encoder.xml, driver-action-recognition-adas-0002-decoder.bin, driver-cation-recognition-adas-0002-decoder.xml, driver-action-recognition-adas-0002-encoder.bin, driver-action-recognition-adas-0002-encored.xml and I made copy and paste of file action_recognition.py), when I try to run it I seen on github instruction https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos/python_demos/action_recognition that:

python3 action_recognition.py -m_en models/driver_action_recognition_tsd_0002_encoder.xml \
    -m_de models/driver_action_recognition_tsd_0002_decoder.xml \
    -i <path_to_video>/inputVideo.mp4 \
    -lb driver_actions.txt

here comes used "_tsd_" and not _"asad_" , anyway I tried to run the file with _asad_  and _"tsd_" but I get this problem:

eggnicola@eggnicola-System-Product-Name:~/Desktop/action_recognition_demo$ python3 action_recognition.py -m_en ~/Desktop/action_recognition_demo/driver_action_recognition_adas_0002_encoder.xml -m_de ~/Desktop/action_recognition_demo/driver_action_recognition_adas_0002_decoder.xml -i cam -d MYRIAD
/usr/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.7 of module 'openvino.inference_engine.ie_api' does not match runtime version 3.6
return f(*args, **kwds)
Traceback (most recent call last):
File "action_recognition.py", line 22, in <module>
from action_recognition_demo.models import IEModel, DummyDecoder
ModuleNotFoundError: No module named 'action_recognition_demo'

 

do you have any tips how to solve it??

many thanks

Regards

Nicola

310 Views

Hello Nicola,


What happens if you try to run again with Python 3.7 version, are you get the same error?


Looks like that some packages in your environment are incompatible, make sure your environment variables are set up.


Regards,

Randall.


NMitr2
Beginner
304 Views

Hi Randall,

thank you for your help,

I tried to run with python 3.7 I show you below:

eggnicola@eggnicola-System-Product-Name:~/Desktop/action_recognition_demo$ python3.7 action_recognition.py -m_en ~/Desktop/action_recognition_demo/driver-action-recognition-adas-0002-encoder.xml -m_de ~/Deskotp/action_recognition_demo/driver-action-recognition-adas-0002-decoder.xml -i cam -d MYRIAD
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: cannot import name 'multiarray' from 'numpy.core' (/usr/lib/python3/dist-packages/numpy/core/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "action_recognition.py", line 19, in <module>
import numpy as np
File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/lib/python3/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python3/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib/python3/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray' from 'numpy.core' (/usr/lib/python3/dist-packages/numpy/core/__init__.py)

 

my version of nuppy is 1.14.5 , the environment variables should be fine....

below my pip list I don't know if it can be helpful for understend my problem

 

many thanks

Regards

Nicola

eggnicola@eggnicola-System-Product-Name:~/Desktop/action_recognition_demo$ pip list
Package Version
---------------------- -------------------
absl-py 0.8.1
apturl 0.5.2
asn1crypto 0.24.0
astor 0.8.0
attrs 19.1.0
backcall 0.1.0
bleach 1.5.0
Brlapi 0.6.6
certifi 2019.9.11
chardet 3.0.4
command-not-found 0.3
contextlib2 0.6.0
cryptography 2.1.4
cupshelpers 1.0
cycler 0.10.0
Cython 0.29.13
decorator 4.4.0
defer 1.0.6
defusedxml 0.6.0
distro-info 0.18ubuntu0.18.04.1
entrypoints 0.3
enum34 1.1.6
gast 0.3.2
google-pasta 0.1.7
graphviz 0.8.4
grpcio 1.24.1
h5py 2.10.0
html5lib 0.9999999
httplib2 0.9.2
idna 2.8
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
ipywidgets 7.5.1
jedi 0.15.1
Jinja2 2.10.1
joblib 0.13.2
jsonschema 3.0.2
jupyter 1.0.0
jupyter-client 5.3.3
jupyter-console 6.0.0
jupyter-core 4.4.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
keyring 10.6.0
keyrings.alt 3.0
kiwisolver 1.1.0
language-selector 0.1
launchpadlib 1.10.6
lazr.restfulclient 0.13.5
lazr.uri 1.0.3
louis 3.5.0
lxml 4.4.1
macaroonbakery 1.1.3
Mako 1.0.7
Markdown 3.1.1
MarkupSafe 1.0
matplotlib 2.1.0
mistune 0.8.4
mock 3.0.5
mxnet 1.3.1
nbconvert 5.6.0
nbformat 4.4.0
netifaces 0.10.4
networkx 2.3
notebook 6.0.1
numpy 1.14.5
oauth 1.0.1
object-detection 0.1
olefile 0.45.1
onnx 1.5.0
opt-einsum 3.1.0
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
pbr 5.4.3
pexpect 4.2.1
pickleshare 0.7.5
Pillow 5.1.0
pip 19.2.3
prometheus-client 0.7.1
prompt-toolkit 2.0.9
protobuf 3.10.0
ptyprocess 0.6.0
pycairo 1.16.2
pycocotools 2.0
pycrypto 2.6.1
pycups 1.9.73
Pygments 2.4.2
pygobject 3.26.1
pymacaroons 0.13.0
PyNaCl 1.1.2
pyparsing 2.4.2
pyRFC3339 1.0
pyrsistent 0.15.4
python-apt 1.6.5+ubuntu0.2
python-dateutil 2.6.1
python-debian 0.1.32
pytz 2018.3
pyxdg 0.25
PyYAML 5.1.2
pyzmq 18.1.0
qtconsole 4.5.5
reportlab 3.4.0
requests 2.22.0
requests-unixsocket 0.1.5
scikit-learn 0.21.3
scipy 1.3.1
seaborn 0.9.0
SecretStorage 2.3.1
Send2Trash 1.5.0
setuptools 41.4.0
simplejson 3.13.2
six 1.12.0
sklearn 0.0
snap 0.5
system-service 0.3
systemd-python 234
tensorboard 1.14.0
tensorflow 1.14.0
tensorflow-estimator 1.14.0
tensorflow-tensorboard 0.4.0
termcolor 1.1.0
terminado 0.8.2
test-generator 0.1.1
testpath 0.4.2
testresources 2.0.1
tornado 6.0.3
traitlets 4.3.2
typing 3.7.4.1
typing-extensions 3.7.4
ubuntu-drivers-common 0.0.0
ufw 0.36
unattended-upgrades 0.1
urllib3 1.25.3
usb-creator 0.3.3
virtualenv 15.1.0
wadllib 1.3.2
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
widgetsnbextension 3.5.1
wrapt 1.11.2
xkit 0.0.0
zope.interface 4.3.2

 

297 Views

Hi Nicola,


Hope you are doing well!


I noticed on the original issue that you used an action-recognition-0001-decoder pre-trained model, which isn't supported by MYRIAD, you can run this sample using -d CPU. Check here the demos that support Pre-trained models and the devices supported.


Regards,

Randall.


NMitr2
Beginner
293 Views

many thanks Randall,

I tried to run this demo as you suggest with -d CPU, but noting I got the same error above, also with python3.7 as well.....

I don't understand what I'm wronging for run this demo, anyway my goal is to run two my own models at the same time on stick NCS2 and raspberry, if I run each my own model it works fine but I don't know how to run both at the same time....

there some file.py that can help me for understand how to do that?

 

many thanks

Ragards

Nicola

285 Views

Hi Nicola,


I recommend you use the latest version of the OpenVINO toolkit. Regarding the original inquiry, in addition to my first comment, you can check the python demos ( whiteboard_inpainting_demo, action_recognition and asl_recognition_demo) with more of one model supported on MYRIAD. 


Also, you can check the full list of inference-engine-demos; however, the majority demos that run multiple models on NCS2 its on C++.


Hope this helps!


Regards,

Randall.


NMitr2
Beginner
272 Views

Hi Randall,

many thanks for your tips, in the next  days I try to have a look in the link you sent to me.... If I'll find some problem I'll keep in touch with you....

 

Thanks

Regards

Nicola 

236 Views

Hi Nicola,


If you need any additional information, please submit a new question as this thread will no longer being monitored.


Regards,

Randall.