Run LSTM with NCS2

Run LSTM with NCS2


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  --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!

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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 ?




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


Downloadapplication/zip lstm_model_keras.zip8.31 MB

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 !


Leave a Comment

Please sign in to add a comment. Not a member? Join today