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.

Error running Model Optimizer TensorFlow for inception-resnet-v1

Dong_W_
Beginner
1,257 Views

Hi,

I am trying to run mo tensorflow for a variant of inception-resnet-v1. The pb has gone through strip_unused_nodes and fold_batch_norms using tensorflow's transform_graph.

I tried two different command, but both has errors.

$ python3.5 modeloptimizer/scripts/model_optimizer.py --input_model=facenet_1.pb --input='Facenet/ResizeBilinear' --output='Facenet/embeddings' --transforms=' calc_shapes(input_types=float32; input_shapes=1,160,160,3)   create_ir(model_name=facenet; output_dir=facenet_mobile;input_format=RGB)'
List is:  [('calc_shapes', {'input_types': 'float32', 'input_shapes': '1,160,160,3'}), ('create_ir', {'output_dir': 'facenet_mobile', 'input_format': 'RGB', 'model_name': 'facenet'})]
Xml file is /host/opt/intel/computer_vision_sdk_2017.0.113/mo/ModelOptimizerForTensorFlow/config.xml
Run command is: /host/opt/intel/computer_vision_sdk_2017.0.113/mo/ModelOptimizerForTensorFlow/bin/new_transform_graph --in_graph=/tmp/graph_transphorm_calc_shapes_input.pb --out_graph=/tmp/graph_transphorm_calc_shapes_output.pb --inputs=Facenet/ResizeBilinear --outputs=Facenet/embeddings --transforms="calc_shapes(input_types=\"float32\", input_shapes=\"1,160,160,3\")"
2017-08-25 19:11:26.227361: I tensorflow/tools/graph_transforms/transform_graph.cc:262] Applying calc_shapes
2017-08-25 19:11:27.481185: E tensorflow/core/kernels/remote_fused_graph_execute_utils.cc:196] Error during inference: Invalid argument: Retval[9] does not have value
2017-08-25 19:11:27.596962: E tensorflow/tools/graph_transforms/transform_graph.cc:208] Retval[9] does not have value
 
 
 
$ python3.5 modeloptimizer/scripts/model_optimizer.py --input_model=facenet_1.pb --input='Facenet/ResizeBilinear' --output='Facenet/embeddings' --transforms='create_ir(model_name=facenet; output_dir=facenet_mobile;input_format=RGB)'List is:  [('create_ir', {'input_format': 'RGB', 'output_dir': 'facenet_mobile', 'model_name': 'facenet'})]
Xml file is /host/opt/intel/computer_vision_sdk_2017.0.113/mo/ModelOptimizerForTensorFlow/config.xml
Convert_to_IR transform uses FP32 precision as default
Convert_to_IR transform uses scale to be 1 as default
Convert_to_IR transform uses 1.0 norm_factor as default
Convert_to_IR transform uses 1 batch_size as default
Loading facenet model from file... Done (0.000 sec)
 
Deploying facenet model into IR format
Target precision : FP32
Batch size       : 1
Artifacts path   : facenet_mobile
 
Restoring shapes and sizes... Something went wrong. Please check the error and try again:
<class 'ValueError'>
Error: Shapes (3, 3, 3, 32) and () are not compatible
Failed to run transform  create_ir
Failed to run transforms!!!
 
Best regards,
Dong
0 Kudos
4 Replies
Hussein_D_Intel
Employee
1,257 Views

It looks like there is a problem in the graph (or the combination with the inputs/outputs) that causes calc_shapes transform to fail.

Did you view the graph in Tensorboard?

I'll appreciate it if you attach the pb file.

Thanks

0 Kudos
Lin__Heman
Beginner
1,257 Views

Hello, 

I've also encountered this kind of issue. 

My Command is: 

... --input=X_Content --output=gradients/add_29_grad/tuple/control_dependency_1 --transforms="strip_unused_nodes(type=float;shape=4,256,256,3) remove_nodes(op=Identity) remove_nodes(op=CheckNumerics) fold_constants(ignore_errors=true) fold_batch_norms strip_unused_nodes(type=float; shape=4,256,256,3) remove_nodes(op=Identity) remove_nodes(op=CheckNumerics) fold_constants(ignore_errors=true) fold_batch_norms strip_unused_nodes(type=float; shape=4,256,256,3) remove_nodes(op=Identity) remove_nodes(op=CheckNumerics) fold_constants(ignore_errors=true) fold_batch_norms calc_shapes(input_types=float; input_shapes=4,256,256,3) create_ir(model_name=xxx_v1; output_dir=gen)"
 

And the result is: 

 Error during inference: Not found: FeedInputs: unable to find feed output X_Content
2017-11-28 08:03:09.574728: E tensorflow/tools/graph_transforms/transform_graph.cc:208] FeedInputs: unable to find feed output X_Content
2017-11-28 08:03:09.574789: E tensorflow/tools/graph_transforms/transform_graph.cc:209] usage: /home/rdds/workspace/intel/deeplearning_deploymenttoolkit_2017.1.0.4463/deployment_tools/model_optimizer/ModelOptimizerForTensorFlow/bin/new_transform_graph
Flags:
        --in_graph=""                           string  input graph file name
        --out_graph=""                          string  output graph file name
        --inputs=""                             string  inputs
        --outputs=""                            string  outputs
        --transforms=""                         string  list of transforms
        --output_as_text=false                  bool    whether to write the graph in text protobuf format

Transforms are:
add_default_attributes
backport_concatv2
backport_tensor_array_v3
calc_shapes
fold_batch_norms
fold_constants
fold_old_batch_norms
freeze_requantization_ranges
fuse_pad_and_conv
fuse_resize_and_conv
fuse_resize_pad_and_conv
insert_logging
merge_duplicate_nodes
obfuscate_names
quantize_nodes
quantize_weights
remove_attribute
remove_device
remove_nodes
rename_attribute
rename_op
rewrite_quantized_stripped_model_for_hexagon
round_weights
set_device
sort_by_execution_order
sparsify_gather
strip_unused_nodes

Failed to run Graph Transform
Failed to run transform  calc_shapes
Failed to run transforms!!!

Is there any method to solve this?

PS: The attached file is the .pb I've used.  

Thanks!

 

0 Kudos
kodonnell
Beginner
1,257 Views

Also getting this problem using https://github.com/davidsandberg/facenet example - which is largely just inception resnet-v1.

PB file: https://drive.google.com/file/d/0B5MzpY9kBtDVZ2RpVDYwWmxoSUk (though I had to force the phase_train placeholder to be a constant as the model optimizer wasn't liking two inputs as far as I could tell)

 

0 Kudos
Anna_B_Intel
Employee
1,257 Views

Hi Kodonnel, 

According to the release notes, Model Optimizer for Tensorflow supports very limited list of topologies: VGG-16/19, Inception v1/v3/v4, ResNet v1 50/101/152. Facenet you shared has a lot of unsupported primitives like fifo_queue, phase_train placeholder, etc.

Best wishes, 

Anna 

0 Kudos
Reply