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.

Run LSTM with NCS2

klekovkin__vladislav
967 Views

Hello!

I'm working in Ubuntu and using Python API

I'm trying to run LSTM model in Neural Compute Stick 2.

This is my model summary(model is nonfrozen): 

Model: "model_2"

_________________________________________________________________

Layer (type)        Output Shape        Param #

=================================================================

input_1 (InputLayer)        (None, 5, 2048)        0

_________________________________________________________________

lstm_1 (LSTM)        (None, 256)        2360320

_________________________________________________________________

dense_1 (Dense)        (None, 2)        514

=================================================================

Total params: 2,360,834

Trainable params: 2,360,834

Non-trainable params: 0

When i make model optimization I have success 

sudo python3 mo_tf.py  --input_meta_graph /home/vladislav/tf_model_rnn_2019.09.10/rnn_model.meta --data_type FP16 --output dense_1/Softmax --output_dir /home/vladislav/MIRIAD/ANOTHER/ --input input_1 --input_shape [1,5,2048]

[ SUCCESS ] Generated IR model.
[ SUCCESS ] XML file: /home/vladislav/MIRIAD/ANOTHER/rnn_model.xml
[ SUCCESS ] BIN file: /home/vladislav/MIRIAD/ANOTHER/rnn_model.bin
[ SUCCESS ] Total execution time: 2.89 seconds. 

Then i'm working with Python API

from openvino.inference_engine import IECore, IEPlugin, IENetwork

path_to_xml_file_rnn = '/home/vladislav/MIRIAD/ANOTHER/rnn_model.xml'
path_to_bin_file_rnn = '/home/vladislav/MIRIAD/ANOTHER/rnn_model.bin'

plugin = IEPlugin(device='MYRIAD') 

net_rnn = IENetwork(model=path_to_xml_file_rnn, weights=path_to_bin_file_rnn)
exec_net_rnn = plugin.load(network = net_rnn)

i have this error in last line:

RuntimeError Traceback (most recent call last)

<ipython-input-74-843eb4157227> in <module>

   5 #rnn

   6 net_rnn = IENetwork(model=path_to_xml_file_rnn, weights=path_to_bin_file_rnn)

   ----> 7 exec_net_rnn = plugin.load(network = net_rnn)

ie_api.pyx in openvino.inference_engine.ie_api.IEPlugin.load()

ie_api.pyx in openvino.inference_engine.ie_api.IEPlugin.load()

RuntimeError: AssertionFailed: !ieDims.empty()

How i can solve this problem?

Thank You!

0 Kudos
5 Replies
Shubha_R_Intel
Employee
967 Views

Dear klekovkin, vladislav,

That does look like a very simple LSTM model. Without digging deeper (possible if you attach your model as a *.zip to this ticket) it's hard to say what went wrong.

One question - are you using the latest and greatest OpenVino 2019R2.01 ? If not, can you install it and try again ?

Thanks,

Shubha

 

0 Kudos
klekovkin__vladislav
967 Views

Thank you for the answer. I have reinstalled openVINO and have same problem now. I'm attaching keras model to post 

0 Kudos
Shubha_R_Intel
Employee
967 Views

Dear klekovkin, vladislav,

I have reproduced this error. I have submitted a bug on your behalf. I will let you know the results as soon as I learn of them. Thanks for your cooperation !

Shubha

0 Kudos
lu__dongx
Beginner
967 Views

Hello,

I meet a similar error.I use mo.py convert ssd_mobilenet_v2_coco_2018_03_29  tensorflow model to ir model.

Then i write a simple py file with the ir model. The error is same with "RuntimeError: AssertionFailed: !ieDims.empty()".

Soft version is linux:ubuntu 16,openvino:R2.01.

Please give some suggestion for this question,thxs.

--------

Traceback (most recent call last):
  File "ssd_mobilenet_v2.py", line 29, in <module>
    exec_net = ie.load_network(network=net, device_name="MYRIAD")
  File "ie_api.pyx", line 85, in openvino.inference_engine.ie_api.IECore.load_network
  File "ie_api.pyx", line 92, in openvino.inference_engine.ie_api.IECore.load_network
RuntimeError: AssertionFailed: !ieDims.empty()
Error on or near line 238; exiting with status 1

-----
import cv2
import numpy as np
from openvino.inference_engine import IENetwork, IECore
 
model_xml = "~/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2.xml"
model_bin = "~/ssd_mobilenet_v2_coco/tf/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2.bin"
 
ie = IECore()
net = IENetwork(model=model_xml, weights=model_bin)
 
input_blob = next(iter(net.inputs))
output_blob = next(iter(net.outputs))
net.batch_size = 1
print(net.outputs['DetectionOutput'].shape)
 
n, c, h, w = net.inputs[input_blob].shape
print(n, c, h, w)

 
image = cv2.imread("road.bmp")
img = cv2.resize(image, (w,h))
img = img.transpose((2, 0, 1))  # Change data layout from HWC to CHW

exec_net = ie.load_network(network=net, device_name="MYRIAD")
res = exec_net.infer(inputs={input_blob: np.reshape(img, [n,c,w,h])})
print(res)

0 Kudos
Nunez-Yanez__Jose
New Contributor I
967 Views

Same problem here with Myriad and LSTM

 failed: Failed to compile layer lstm/while/LoopCond/TensorIteratorCondition_/TensorIterator : AssertionFailed: !ieDims.empty()

 

UPDATE check this post for a solution

https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit/topic/831969#comment-1955572

0 Kudos
Reply