I downloaded TensorRT-4.0.1.6, and tried sampleUFFSSD.
As a first step, I tried to convert a frozen graph to UFF as in the instruction (README.txt in sampleUFFSSD folder.)
convert-to-uff tensorflow --input-file frozen_inference_graph.pb -O NMS -p config.py
An error looks like:
Loading frozen_inference_graph.pb
Using output node NMS
Converting to UFF graph
Warning: No conversion function registered for layer: NMS yet.
Converting as custom op NMS NMS
name: "NMS"
op: "NMS"
input: "Input"
input: "Squeeze"
input: "concat_priorbox"
input: "concat_box_conf"
attr {
key: "iouThreshold_u_float"
value {
f: 0.6000000238418579
}
}
attr {
key: "maxDetectionsPerClass_u_int"
value {
i: 100
}
}
attr {
key: "maxTotalDetections_u_int"
value {
i: 100
}
}
attr {
key: "numClasses_u_int"
value {
i: 91
}
}
attr {
key: "scoreConverter_u_str"
value {
s: "SIGMOID"
}
}
attr {
key: "scoreThreshold_u_float"
value {
f: 9.99999993922529e-09
}
}
Warning: No conversion function registered for layer: concat_box_conf yet.
Converting as custom op concat_box_conf concat_box_conf
name: "concat_box_conf"
op: "concat_box_conf"
input: "BoxPredictor_0/Reshape_1"
input: "BoxPredictor_1/Reshape_1"
input: "BoxPredictor_2/Reshape_1"
input: "BoxPredictor_3/Reshape_1"
input: "BoxPredictor_4/Reshape_1"
input: "BoxPredictor_5/Reshape_1"
Traceback (most recent call last):
File "/home/abc/.virtualenvs/tf/bin/convert-to-uff", line 11, in <module>
sys.exit(main())
File "/home/abc/.virtualenvs/tf/lib/python3.5/site-packages/uff/bin/convert_to_uff.py", line 105, in main
output_filename=args.output
File "/home/abc/.virtualenvs/tf/lib/python3.5/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 149, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File "/home/abc/.virtualenvs/tf/lib/python3.5/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 120, in from_tensorflow
name="main")
File "/home/abc/.virtualenvs/tf/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 76, in convert_tf2uff_graph
uff_graph, input_replacements)
File "/home/abc/.virtualenvs/tf/lib/python3.5/site-packages/uff/converters/tensorflow/converter.py", line 58, in convert_tf2uff_node
inp_node = tf_nodes[inp_name]
KeyError: 'image_tensor'
It complains there is no āimage_tensorā key, but I checked there is āimage_tensorā node in the frozen graph. What is the problem?
Suspect 1:
In āconfig.pyā, it seems to replace āPreprocessorā ā āInputā, āToFloatā ā āInputā, āimage_tensorā ā āInputā.
namespace_plugin_map = {
...
"Preprocessor": Input,
"ToFloat": Input,
"image_tensor": Input,
...
}
And the conversion will delete the original input placeholder āimage_tensorā. However,
since āToFloatā has its input āimage_tensorā, its replace version āInputā will still have its input āimage_tensorā, which is deleted.
I found the error comes from it. Is it a bug or was there an update? I am wondering how the native sample can have this error. Wasnāt there a problem? Could you please make sure?
Suspect 2:
One thing I suspect is inconsistent versions of 'uff" module as follows:
(tf) $ python -m pip show uff
Name: uff
Version: 0.4.0
Summary: Toolkit for working with the Universal Framwork Format (UFF). Provides a converter from the tensorflow graph format to UFFwith support for more frameworks coming.
Home-page: https://developer.nvidia.com/tensorrt
Author: NVIDIA Corporation
Author-email: cudatools@nvidia.com
License: NVIDIA Software License
Location: /home/abc/.virtualenvs/tf/lib/python3.5/site-packages
Requires: protobuf, numpy
Required-by:
(tf) $ python
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import uff
>>> uff.__version__
'0.3.0'
>>>> uff.__path__
['/home/abc/.virtualenvs/tf/lib/python3.5/site-packages/uff']
Is it usual?
Just in case, here are the files I used:
(However, I downloaded the graph as in the instruction, and I didnāt touch config.py, so nothing special.)
frozen_inference_graph: https://drive.google.com/open?id=1PhSquQXaC2Cs1H_TwicCbNYT6Wvgt-E9
config.py: https://drive.google.com/open?id=14JgQh8vOYR0cjMtiRRyXGnXdiEn0zOa-