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.
6404 Discussions

Trying to experiment with ncs : can't compile simple model (IndexError: list index out of range)

idata
Employee
661 Views

Hi,

 

I am trying to get a first really simple model on the stick (just to check everything works). this is the model code :

 

import tensorflow as tf tf.reset_default_graph() X = tf.placeholder(dtype=tf.float32, shape=(1,2,2), name = "in037") Y = tf.constant([[[1,1],[1,1]]], dtype=tf.float32) Z = tf.math.add(X, Y, name="out037") init_op = tf.global_variables_initializer() with tf.Session() as sess: #sess.run(init_op) tf.train.export_meta_graph('test/graph.meta')

 

When I compile the graph : mvNCCompile graph.meta -s 1 -in=in037 -on=out037 -is 2 2 -o Test.graph,

 

this is what I get :

 

 

! > /usr/lib/python3.7/site-packages/networkx/classes/graph.py:23: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

 

! > from collections import Mapping

 

! > /usr/lib/python3.7/site-packages/networkx/classes/reportviews.py:95: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

 

! > from collections import Mapping, Set, Iterable

 

! > /usr/lib/python3.7/site-packages/skimage/init.py:60: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

 

! > import imp

 

! > /usr/lib/python3.7/site-packages/google/protobuf/internal/containers.py:182: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

 

! > MutableMapping = collections.MutableMapping

 

! > /usr/lib/python3.7/site-packages/google/protobuf/internal/containers.py:340: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

 

! > collections.MutableSequence.register(BaseContainer)

 

! > /usr/bin/ncsdk/Controllers/Parsers/TensorFlowParser/Convolution.py:46: SyntaxWarning: assertion is always true, perhaps remove parentheses?

 

! > assert(False, "Layer type not supported by Convolution: " + obj.type)

 

! > /usr/bin/ncsdk/Controllers/Parsers/Phases.py:617: DeprecationWarning: invalid escape sequence \

 

! > """

 

! > /usr/bin/ncsdk/Controllers/Parsers/Phases.py:893: DeprecationWarning: invalid escape sequence \

 

! > """

 

! > /usr/bin/ncsdk/Controllers/Parsers/Phases.py:322: SyntaxWarning: assertion is always true, perhaps remove parentheses?

 

! > assert(len(pred) == 1, "Slice not supported to have >1 predecessors")

 

! > mvNCCompile v02.00, Copyright @ Intel Corporation 2017

 

! >

 

! > __ WARNING: No Weights found. using filler weights __

 

! > /usr/bin/ncsdk/Controllers/TensorFlowParser.py:173: DeprecationWarning: invalid escape sequence \d

 

! > shape: (1, 2, 2)

 

! > res.shape: (1, 2, 2)

 

! > TensorFlow output shape: (1, 2, 2)

 

! > Traceback (most recent call last):

 

! > File "/usr/bin/mvNCCompile", line 206, in

 

! > create_graph(args.network, args.image, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights, args.explicit_concat, args.ma2480, args.scheduler, args.new_parser, args.cpp, args)

 

! > File "/usr/bin/mvNCCompile", line 185, in create_graph

 

! > load_ret = load_network(args, parser, myriad_config)

 

! > File "/usr/bin/ncsdk/Controllers/Scheduler.py", line 156, in load_network

 

! > network.optimize()

 

! > File "/usr/bin/ncsdk/Models/Network.py", line 250, in optimize

 

! > self.convert_network_input_to_yxz()

 

! > File "/usr/bin/ncsdk/Models/Network.py", line 337, in convert_network_input_to_yxz

 

! > if self.stageslist[0].op in [StageType.fully_connected_layer, StageType.convolution, StageType.max_pooling,

 

! > IndexError: list index out of range

 

 

The deprecation warnings doesn't really bothers me. The "no weights found" neither since it's just an "add" graph. But what is strange is the IndexError, since (as I read in the sources), self.stageslist should always contain at least one element (the input), and it seems detected since I read "shape: (1, 2, 2)" in the output… any ideas ?

0 Kudos
1 Reply
idata
Employee
341 Views

I just remembered there was something about the input dimension, so I tried this (I added the --new-parser option since I get the same error without), and I get :

 

import tensorflow as tf tf.reset_default_graph() X = tf.placeholder(dtype=tf.float32, shape=(1,2,2,1), name = "in037") Y = tf.constant([[[[1],[1]],[[1],[1]]]], dtype=tf.float32) Z = tf.math.add(X, Y, name="out037") init_op = tf.global_variables_initializer() with tf.Session() as sess: sess.run(init_op) tf.train.export_meta_graph('test/graph.meta')

 

mvNCCompile graph.meta -s 12 -in=in037 -on=out037 -o Test.graph --new-parser

 

 

__ WARNING: No Weights found. using filler weights __

 

graph.meta

 

output tensor shape (1, 2, 2, 1)

 

Fusing DeptwiseConv + Pointwise Convolution into plain Convolution

 

Fusing Add and Batch after Convolution

 

Fusing Pad and Convolution2D

 

Fusing BatchNorm and Scale after Convolution

 

Replacing BN with Bias&Scale

 

Fusing Permute and Flatten

 

Fusing Eltwise and Relu

 

Eliminate layers that have been parsed as NoOp

 

Evaluating input and weigths for each hw layer

 

Traceback (most recent call last):

 

File "/usr/bin/mvNCCompile", line 206, in

 

create_graph(args.network, args.image, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights, args.explicit_concat, args.ma2480, args.scheduler, args.new_parser, args.cpp, args)

 

File "/usr/bin/mvNCCompile", line 185, in create_graph

 

load_ret = load_network(args, parser, myriad_config)

 

File "/usr/bin/ncsdk/Controllers/Scheduler.py", line 118, in load_network

 

parsedLayers = fixTensors(parsedLayers, scheduler, arguments.ma2480)

 

File "/usr/bin/ncsdk/Controllers/Optimizer.py", line 160, in fixTensors

 

return fixTensorImported(parsedLayers, scheduler, myriadX)

 

File "/usr/bin/ncsdk/Controllers/ConversionPlacement.py", line 230, in fixTensors

 

assert(len(producerNode) == 1)

 

AssertionError

 

0 Kudos
Reply