Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
367 Views

Tensorflow Model conversion aslist() and index out of range errors

I've run into some issues when converting a model I trained to a movidius graph format. The model I have should have no issues as all the ops are supported on the 2.05 SDK. The model has been tested for inference in both Python tensorflow and TFMobile on Android.

 

The command I want to run is

 

mvNCCompile /tmp/movidius_graph.pb -in inputA -on a2b_generator/output_image

 

However the error I receive is

 

mvNCCompile /tmp/movidius_graph.pb -in inputA -on a2b_generator/output_image /usr/local/bin/ncsdk/Controllers/Parsers/TensorFlowParser/Convolution.py:44: SyntaxWarning: assertion is always true, perhaps remove parentheses? assert(False, "Layer type not supported by Convolution: " + obj.type) mvNCCompile v02.00, Copyright @ Intel Corporation 2017 /usr/local/lib/python3.5/dist-packages/tensorflow/python/util/tf_inspect.py:45: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead shape: [1, 600, 600, 3] Traceback (most recent call last): File "/usr/local/bin/mvNCCompile", line 169, in <module> 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) File "/usr/local/bin/mvNCCompile", line 148, in create_graph load_ret = load_network(args, parser, myriad_config) File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 100, in load_network parse_ret = parse_tensor(arguments, myriad_conf) File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 319, in parse_tensor item_shape = output_item.shape.as_list() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py", line 820, in as_list raise ValueError("as_list() is not defined on an unknown TensorShape.") ValueError: as_list() is not defined on an unknown TensorShape.

 

I have traced this error to occurring after the second layer in the network called a2b_generator/Conv_1/Relu. If I set this layer as the output layer I get an identical error.

 

mvNCCompile /tmp/movidius_graph.pb -in inputA -on a2b_generator/Conv_1/Relu /usr/local/bin/ncsdk/Controllers/Parsers/TensorFlowParser/Convolution.py:44: SyntaxWarning: assertion is always true, perhaps remove parentheses? assert(False, "Layer type not supported by Convolution: " + obj.type) mvNCCompile v02.00, Copyright @ Intel Corporation 2017 /usr/local/lib/python3.5/dist-packages/tensorflow/python/util/tf_inspect.py:45: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead shape: [1, 600, 600, 3] Traceback (most recent call last): File "/usr/local/bin/mvNCCompile", line 169, in <module> 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) File "/usr/local/bin/mvNCCompile", line 148, in create_graph load_ret = load_network(args, parser, myriad_config) File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 100, in load_network parse_ret = parse_tensor(arguments, myriad_conf) File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 319, in parse_tensor item_shape = output_item.shape.as_list() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/tensor_shape.py", line 820, in as_list raise ValueError("as_list() is not defined on an unknown TensorShape.") ValueError: as_list() is not defined on an unknown TensorShape.

 

If I try the same thing using the first layer in the network a different error is thrown

 

mvNCCompile /tmp/movidius_graph.pb -in inputA -on a2b_generator/Conv/Relu /usr/local/bin/ncsdk/Controllers/Parsers/TensorFlowParser/Convolution.py:44: SyntaxWarning: assertion is always true, perhaps remove parentheses? assert(False, "Layer type not supported by Convolution: " + obj.type) mvNCCompile v02.00, Copyright @ Intel Corporation 2017 /usr/local/lib/python3.5/dist-packages/tensorflow/python/util/tf_inspect.py:45: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead shape: [1, 600, 600, 3] res.shape: (1, 600, 600, 64) TensorFlow output shape: (600, 600, 64) Traceback (most recent call last): File "/usr/local/bin/mvNCCompile", line 169, in <module> 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) File "/usr/local/bin/mvNCCompile", line 148, in create_graph load_ret = load_network(args, parser, myriad_config) File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 110, in load_network network.optimize() File "/usr/local/bin/ncsdk/Models/Network.py", line 250, in optimize self.convert_network_input_to_yxz() File "/usr/local/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

 

My model ready for conversion can be found here

 

https://github.com/andrewginns/CycleGAN-Tensorflow-PyTorch/releases/download/tf1.7-py3.6.4/movidius_...

 

My frozen model can be found here

 

https://github.com/andrewginns/CycleGAN-Tensorflow-PyTorch/releases/download/tf1.7-py3.6.4/frozen-gr...

 

A visualisation of the frozen network is here

 

https://drive.google.com/file/d/1HrV-rXQd47aebWGUGSSgKZZtwQWs0ba-/view?usp=sharing

 

The movidius_graph.pb is created using the transform_graph tool

 

bazel build --config=opt tensorflow/tools/graph_transforms:transform_graph && bazel-bin/tensorflow/tools/graph_transforms/transform_graph --in_graph=/tmp/frozen_graph.pb --out_graph=/tmp/movidius_graph.pb --inputs=‘inputA’ --outputs='a2b_generator/output_image' --transforms=' strip_unused_nodes(type=float, shape="1,600,600,3") remove_nodes(op=Identity, op=CheckNumerics) add_default_attributes fold_constants(ignore_errors=true) fold_batch_norms merge_duplicate_nodes'
Tags (1)
0 Kudos
0 Replies
Reply