hi,
I tried to use convert_to_uff.py to convert my pb model to uff. But I get these errors:
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 233, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 181, in from_tensorflow
debug_mode=debug_mode)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 94, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 79, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 41, in convert_layer
fields = cls.parse_tf_attrs(tf_node.attr)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 222, in parse_tf_attrs
return {key: cls.parse_tf_attr_value(val) for key, val in attrs.items() if val is not None and val.WhichOneof('value') is not None}
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 222, in <dictcomp>
return {key: cls.parse_tf_attr_value(val) for key, val in attrs.items() if val is not None and val.WhichOneof('value') is not None}
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 218, in parse_tf_attr_value
return cls.convert_tf2uff_field(code, val)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 190, in convert_tf2uff_field
return TensorFlowToUFFConverter.convert_tf2numpy_dtype(val)
File "/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py", line 103, in convert_tf2numpy_dtype
return tf.as_dtype(dtype).as_numpy_dtype
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py", line 128, in as_numpy_dtype
return _TF_TO_NP[self._type_enum]
KeyError: 20
Then I search the problem and answer for this: https://devtalk.nvidia.com/default/topic/1049399/jetson-tx2/tensorflow-model-to-tensorrf-uff-model-convert-error/
and then I tried tf-trt to convert my model with my own pb file( converted from .h5 model file), but then I got these errors:
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/importer.py", line 426, in import_graph_def
graph._c_graph, serialized, options) # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node bn_Conv1/cond/ReadVariableOp/Switch was passed float from bn_Conv1/gamma:0 incompatible with expected resource.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pb2uff.py", line 17, in <module>
trt_graph = trt.create_inference_graph(input_graph_def=frozen_graph,outputs=output_names,max_batch_size=1,max_workspace_size_bytes=1<< 25,precision_mode='FP32',minimum_segment_size=50)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/tensorrt/python/trt_convert.py", line 333, in create_inference_graph
importer.import_graph_def(input_graph_def, name="")
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/importer.py", line 430, in import_graph_def
raise ValueError(str(e))
ValueError: Input 0 of node bn_Conv1/cond/ReadVariableOp/Switch was passed float from bn_Conv1/gamma:0 incompatible with expected resource.
Then how could I solve this problem? thanks