Hello,I use python code convert tensorflow frozen graph to uff graoh,and I get error below:
Traceback (most recent call last):
File "uff_transfer.py", line 13, in <module>
output_filename = 'model.uff')
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 233, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 181, in from_tensorflow
debug_mode=debug_mode)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 94, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-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 "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 47, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py", line 33, in convert_const
array = tf2uff.convert_tf2numpy_const_node(tf_node)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 141, in convert_tf2numpy_const_node
array = np.frombuffer(data, dtype=np_dtype)
ValueError: cannot create an OBJECT array from memory buffer
And this is my code:
import tensorrt as trt
import uff
PATH = "/home/ssd1/work/qiuyang/soft/content-image-consistency/data/bow.inceptionResnetV2_back/model.ckpt-6.40-1730500.pb"
output_name = ['show_and_tell/main/image_text_sim_1/dot/MatMul',
'show_and_tell/main/image_text_sim_1/dot/MatMul',
'show_and_tell/main/image_feature']
uff_model = uff.from_tensorflow_frozen_model(
frozen_file = PATH,
output_nodes = output_name,
output_filename = 'model.uff')
my enviroment is:
UFF Version 0.6.3
TensorRT 5.1.5
tensorflow-gpu 1.14.0
python 2.7.14
linux kernel version 3.10.0_3-0-0-24
CUDA 10.1
cudnn 7.4
CPU Tesla P4
Nvidia Driver Version: 418.39
network InceptionresnetV2
Thanks for help!
and there is complete information:
Pad2DReflectPluginCreator::Pad2DReflectPluginCreator()
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginNamespace():
Pad2DReflectPluginCreator::getPluginVersion()
Pad2DReflectPluginCreator::Pad2DReflectPluginCreator()
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginNamespace():
Pad2DReflectPluginCreator::getPluginVersion()
Pad2DReflectPluginCreator::getPluginVersion()
Pad2DReflectPluginCreator::Pad2DReflectPluginCreator()
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginNamespace():
Pad2DReflectPluginCreator::getPluginVersion()
Pad2DReflectPluginCreator::getPluginVersion()
Pad2DReflectPluginCreator::Pad2DReflectPluginCreator()
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginName():Pad2D
Pad2DReflectPluginCreator::getPluginNamespace():
Pad2DReflectPluginCreator::getPluginVersion()
Pad2DReflectPluginCreator::getPluginVersion()
/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
WARNING: Logging before flag parsing goes to stderr.
W0823 11:52:58.510632 140101629601536 deprecation_wrapper.py:119] From /home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py:18: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.
W0823 11:52:58.511035 140101629601536 deprecation_wrapper.py:119] From /home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py:231: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.
NOTE: UFF has been tested with TensorFlow 1.12.0. Other versions are not guaranteed to work
WARNING: The version of TensorFlow installed on this system is not guaranteed to work with UFF.
W0823 11:52:59.775490 140101629601536 deprecation_wrapper.py:119] From /home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/graphsurgeon/_utils.py:2: The name tf.NodeDef is deprecated. Please use tf.compat.v1.NodeDef instead.
UFF Version 0.6.3
=== Automatically deduced input nodes ===
[name: "show_and_tell/main/text"
op: "Placeholder"
attr {
key: "dtype"
value {
type: DT_INT32
}
}
attr {
key: "shape"
value {
shape {
dim {
size: -1
}
dim {
size: 20
}
}
}
}
, name: "show_and_tell/main/text2"
op: "Placeholder"
attr {
key: "dtype"
value {
type: DT_INT32
}
}
attr {
key: "shape"
value {
shape {
dim {
size: -1
}
dim {
size: 20
}
}
}
}
]
=========================================
Using output node show_and_tell/main/image_text_sim_1/dot/MatMul
Using output node show_and_tell/main/image_text_sim_1/dot/MatMul
Using output node show_and_tell/main/image_feature
Converting to UFF graph
Warning: No conversion function registered for layer: PlaceholderWithDefault yet.
Converting show_and_tell/main/image_feature as custom op: PlaceholderWithDefault
W0823 11:53:01.081512 140101629601536 deprecation_wrapper.py:119] From /home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py:179: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.
Traceback (most recent call last):
File "uff_transfer.py", line 13, in <module>
output_filename = 'model.uff')
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 233, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 181, in from_tensorflow
debug_mode=debug_mode)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 94, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-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 "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 47, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter_functions.py", line 33, in convert_const
array = tf2uff.convert_tf2numpy_const_node(tf_node)
File "/home/ssd1/work/qiuyang/soft/pyenv/lib/python2.7/site-packages/uff/converters/tensorflow/converter.py", line 141, in convert_tf2numpy_const_node
array = np.frombuffer(data, dtype=np_dtype)
ValueError: cannot create an OBJECT array from memory buffer
Hi,I have the same error… could you fix it?