Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Can't load network to Movidius2, when on Movidius 1 it works well.

Bench__Andriy
Beginner
402 Views

OpenVINO version 2019 R1

I converted TF neural network http://download.tensorflow.org/models/inception_v1_224_quant_20181026.tgz
to inference engine representation using following commands on win10 computer :

call c:\IntelSWTools\openvino\bin\setupvars.bat
python c:\IntelSWTools\openvino\deployment_tools\model_optimizer\mo.py --input_model inception_v1_224_quant_frozen.pb --input input --input_shape [1,224,224,3] --data_type FP16

After described below test script was executed on Raspberry Pi as well as on Win 10).
It works well for Movidius 1 and caused problems with Movidius 2 (see output below ).

How to fix that problem?

----------------------------------
Output for Movidius 2:

pi@raspberrypi:~/Coral_experiments $ source /opt/intel/openvino/bin/setupvars.sh 
[setupvars.sh] OpenVINO environment initialized
pi@raspberrypi:~/Coral_experiments $ python3 openvino_myriad_test.py 
Files quantity: 21
input
Shape: 21 3 224 224
Plugin loading
Traceback (most recent call last):
  File "openvino_myriad_test.py", line 85, in <module>
    exec_net = plugin.load(network=net, num_requests=1)
  File "ie_api.pyx", line 395, in openvino.inference_engine.ie_api.IEPlugin.load
  File "ie_api.pyx", line 406, in openvino.inference_engine.ie_api.IEPlugin.load
RuntimeError: AssertionFailed: node_stats_it != stats.end()
pi@raspberrypi:~/Coral_experiments $ 
---------------------------------------
Output for Movidius 1:

pi@raspberrypi:~/Coral_experiments $ python3 openvino_myriad_test.py 
Files quantity: 21
input
Shape: 21 3 224 224
Plugin loading
Start recognition
(21, 1001)
512_Amplifier.jpg : CD player
512_Ball.jpg : soccer ball
512_Cellphone.jpg : cellular telephone, cellular phone, cellphone, cell, mobile phone
512_ElectricGuitar.jpg : electric guitar
512_InkjetPrinter.jpg : printer
512_LaserPrinter.jpg : photocopier
512_Monitor.jpg : screen, CRT screen
512_Phone.jpg : dial telephone, dial phone
512_Sink.jpg : washbasin, handbasin, washbowl, lavabo, wash-hand basin
512_Slippers.jpg : clog, geta, patten, sabot
cat.jpg : tabby, tabby cat
nps_acoustic_guitar.png : acoustic guitar
nps_backpack.png : backpack, back pack, knapsack, packsack, rucksack, haversack
nps_baseball.png : baseball
nps_chair.png : folding chair
nps_electric_guitar.png : electric guitar
nps_guac.png : cup
nps_keyboard.png : remote control, remote
nps_mouse.png : mouse, computer mouse
nps_mug.png : coffee mug
Search time:2.312596082687378
(21, 1001)
512_Amplifier.jpg : CD player
512_Ball.jpg : soccer ball
512_Cellphone.jpg : cellular telephone, cellular phone, cellphone, cell, mobile phone
512_ElectricGuitar.jpg : electric guitar
512_InkjetPrinter.jpg : printer
512_LaserPrinter.jpg : photocopier
512_Monitor.jpg : screen, CRT screen
512_Phone.jpg : dial telephone, dial phone
512_Sink.jpg : washbasin, handbasin, washbowl, lavabo, wash-hand basin
512_Slippers.jpg : clog, geta, patten, sabot
cat.jpg : tabby, tabby cat
nps_acoustic_guitar.png : acoustic guitar
nps_backpack.png : backpack, back pack, knapsack, packsack, rucksack, haversack
nps_baseball.png : baseball
nps_chair.png : folding chair
nps_electric_guitar.png : electric guitar
nps_guac.png : cup
nps_keyboard.png : remote control, remote
nps_mouse.png : mouse, computer mouse
nps_mug.png : coffee mug
Search time:2.2944040298461914
(21, 1001)
512_Amplifier.jpg : CD player
512_Ball.jpg : soccer ball
512_Cellphone.jpg : cellular telephone, cellular phone, cellphone, cell, mobile phone
512_ElectricGuitar.jpg : electric guitar
512_InkjetPrinter.jpg : printer
512_LaserPrinter.jpg : photocopier
512_Monitor.jpg : screen, CRT screen
512_Phone.jpg : dial telephone, dial phone
512_Sink.jpg : washbasin, handbasin, washbowl, lavabo, wash-hand basin
512_Slippers.jpg : clog, geta, patten, sabot
cat.jpg : tabby, tabby cat
nps_acoustic_guitar.png : acoustic guitar
nps_backpack.png : backpack, back pack, knapsack, packsack, rucksack, haversack
nps_baseball.png : baseball
nps_chair.png : folding chair
nps_electric_guitar.png : electric guitar
nps_guac.png : cup
nps_keyboard.png : remote control, remote
nps_mouse.png : mouse, computer mouse
nps_mug.png : coffee mug
Search time:2.293445110321045
pi@raspberrypi:~/Coral_experiments $ 

-----------------------------------------
Environment variables:

pi@raspberrypi:~/Coral_experiments $ export
declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
declare -x DESKTOP_SESSION="LXDE-pi"
declare -x DISPLAY=":0.0"
declare -x GDMSESSION="lightdm-xsession"
declare -x GPG_AGENT_INFO="/run/user/1000/gnupg/S.gpg-agent:0:1"
declare -x HDDL_INSTALL_DIR="/opt/intel/openvino/deployment_tools/inference_engine/external/hddl"
declare -x HOME="/home/pi"
declare -x INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="10"
declare -x INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="true"
declare -x INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="100"
declare -x INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="25"
declare -x INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE="0"
declare -x INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE="0"
declare -x INFINALITY_FT_BRIGHTNESS="0"
declare -x INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="0"
declare -x INFINALITY_FT_CONTRAST="0"
declare -x INFINALITY_FT_FILTER_PARAMS="11 22 38 22 11"
declare -x INFINALITY_FT_FRINGE_FILTER_STRENGTH="0"
declare -x INFINALITY_FT_GAMMA_CORRECTION="0 100"
declare -x INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE="0"
declare -x INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE="0"
declare -x INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="0"
declare -x INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="25"
declare -x INFINALITY_FT_STEM_FITTING_STRENGTH="25"
declare -x INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="40"
declare -x INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="true"
declare -x INFINALITY_FT_USE_VARIOUS_TWEAKS="true"
declare -x INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="10"
declare -x INTEL_CVSDK_DIR="/opt/intel/openvino"
declare -x INTEL_OPENVINO_DIR="/opt/intel/openvino"
declare -x InferenceEngine_DIR="/opt/intel/openvino/deployment_tools/inference_engine/share"
declare -x LANG="uk_UA.UTF-8"
declare -x LANGUAGE="uk_UA.UTF-8"
declare -x LC_ALL="uk_UA.UTF-8"
declare -x LD_LIBRARY_PATH="/opt/intel/openvino/opencv/lib:/opt/intel/opencl:/opt/intel/openvino/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino/deployment_tools/inference_engine/lib/armv7l:/opt/intel/openvino/opencv/lib:/opt/intel/opencl:/opt/intel/openvino/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino/deployment_tools/inference_engine/lib/armv7l:/opt/intel/openvino/opencv/lib:/opt/intel/opencl:/opt/intel/openvino/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino/deployment_tools/inference_engine/lib/armv7l:/opt/intel/openvino/opencv/lib:/opt/intel/opencl:/opt/intel/openvino/deployment_tools/inference_engine/external/hddl/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/gna/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/mkltiny_lnx/lib:/opt/intel/openvino/deployment_tools/inference_engine/external/tbb/lib:/opt/intel/openvino/deployment_tools/inference_engine/lib/armv7l:"
declare -x LOGNAME="pi"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"
declare -x NO_AT_BRIDGE="1"
declare -x OLDPWD
declare -x OpenCV_DIR="/opt/intel/openvino/opencv/cmake"
declare -x PATH="/opt/intel/openvino/deployment_tools/model_optimizer:/opt/intel/openvino/deployment_tools/model_optimizer:/opt/intel/openvino/deployment_tools/model_optimizer:/opt/intel/openvino/deployment_tools/model_optimizer:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
declare -x PWD="/home/pi/Coral_experiments"
declare -x PYTHONPATH="/opt/intel/openvino/python/python3.5/armv7l:/opt/intel/openvino/deployment_tools/model_optimizer:/opt/intel/openvino/python/python3.5/armv7l:/opt/intel/openvino/deployment_tools/model_optimizer:/opt/intel/openvino/python/python3.5/armv7l:/opt/intel/openvino/deployment_tools/model_optimizer:/opt/intel/openvino/python/python3.5/armv7l:/opt/intel/openvino/deployment_tools/model_optimizer:"
declare -x QT_QPA_PLATFORMTHEME="qt5ct"
declare -x SAL_USE_VCLPLUGIN="gtk"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AGENT_PID="525"
declare -x SSH_AUTH_SOCK="/tmp/ssh-l004r7YYHYxK/agent.476"
declare -x TERM="xterm"
declare -x TEXTDOMAIN="Linux-PAM"
declare -x USER="pi"
declare -x XAUTHORITY="/home/pi/.Xauthority"
declare -x XDG_CONFIG_DIRS="/etc/xdg"
declare -x XDG_CONFIG_HOME="/home/pi/.config"
declare -x XDG_CURRENT_DESKTOP="LXDE"
declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share/raspi-ui-overrides:/usr/share:/usr/share/gdm:/var/lib/menu-xdg"
declare -x XDG_GREETER_DATA_DIR="/var/lib/lightdm/data/pi"
declare -x XDG_MENU_PREFIX="lxde-pi-"
declare -x XDG_RUNTIME_DIR="/run/user/1000"
declare -x XDG_SEAT="seat0"
declare -x XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
declare -x XDG_SESSION_DESKTOP="lightdm-xsession"
declare -x XDG_SESSION_ID="c1"
declare -x XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session0"
declare -x XDG_SESSION_TYPE="x11"
declare -x XDG_VTNR="7"
declare -x _LXSESSION_PID="476"
pi@raspberrypi:~/Coral_experiments $ 

---------------------------------------------------
#
# Test script source
#

import time
import sys
import cv2
import numpy as np
from openvino.inference_engine import IENetwork, IEPlugin

#
# load labels
#

labels_file="imagenet_labels.txt"

with open(labels_file,'r') as f:
    pairs = (l.strip().split(maxsplit=1) for l in f.readlines())
    labels = dict((int(k),v) for k,v in pairs)

#
# load images
#

start_dir = 'images'
images_list = [
                "512_Amplifier.jpg",
                "512_Ball.jpg",
                "512_Cellphone.jpg",
                "512_ElectricGuitar.jpg",
                "512_InkjetPrinter.jpg",
                "512_LaserPrinter.jpg",
                "512_Monitor.jpg",
                "512_Phone.jpg",                
                "512_Sink.jpg",
                "512_Slippers.jpg",
                "cat.jpg",
                "nps_acoustic_guitar.png",
                "nps_backpack.png",
                "nps_baseball.png",
                "nps_chair.png",
                "nps_electric_guitar.png",
                "nps_guac.png",
                "nps_keyboard.png",
                "nps_mouse.png",
                "nps_mug.png",
                "nps_screwdriver.png"
                ]
    

file_name = '{dir_name}/{f_name}'
im_files = []

for picture in images_list:
    fl=file_name.format(dir_name=start_dir, f_name=picture)
    im_files.append(fl)
print("Files quantity: {}".format(len(im_files)))


weights_file="nets/under_test/inception_v1_224_quant_20181026/inception_v1_224_quant_frozen.bin"
model_file="nets/under_test/inception_v1_224_quant_20181026/inception_v1_224_quant_frozen.xml"

#
# Prepare neural network


plugin = IEPlugin(device="MYRIAD")
time.sleep(10)
net = IENetwork(model=model_file, weights=weights_file)

net.batch_size = len(im_files)
#  Preprocessing is neural network dependent maybe we don't show this
input_blob_name = next(iter(net.inputs))
print(input_blob_name)
n, c, h, w = net.inputs[input_blob_name].shape
print("Shape: {} {} {} {}".format(n, c, h, w))

net.batch_size = len(im_files)
images = np.ndarray(shape=(net.batch_size, c, h, w))
for i,fl in enumerate(im_files):
    #print(fl)
    image = cv2.imread(fl)
    image = cv2.resize(image, (w, h))
    image = image.transpose((2, 0, 1))  # Change data layout from HWC to CHW
    images = image/255

print("Plugin loading")        
exec_net = plugin.load(network=net, num_requests=1)

#
# Run recognition test
#

print("Start recognition")  
for i in range(3):
    start=time.time()
    res = exec_net.infer({'input': images})
    duration=time.time()-start
    print(res["InceptionV1/Logits/Predictions/Softmax"].shape)
    recognized=np.argmax(res["InceptionV1/Logits/Predictions/Softmax"], axis=1)
    for j in range(len(recognized)-1):
        print(images_list,":",labels[recognized])    
    print("Search time:{}".format(duration))

0 Kudos
2 Replies
Allan__Alasdair
Beginner
402 Views

Also running into this problem, my current guess here is that it's a because the model has been quantized so it can be run with TensorFlow Lite. But I'm still investigating.

0 Kudos
Shubha_R_Intel
Employee
402 Views

Dear folks, would this post (relating to Tensorflow Lite) help you ?

https://github.com/opencv/dldt/issues/131

Thanks for using OpenVino !

Shubha

0 Kudos
Reply