Hello,
When I’m following the guide to convert a tensorflow model to UFF
res_graph = train_net(train_x, train_y, test_x, test_y, num_class, MAX_LEN, LEARNING_RATE)
# Convert a model to UFF
uff_model = uff.from_tensorflow(graphdef=res_graph,
output_filename=UFF_OUTPUT_FILENAME,
output_nodes=OUTPUT_NAMES,
text=True)
G_LOGGER = trt.infer.ConsoleLogger(trt.infer.LogSeverity.ERROR)
parser = uffparser.create_uff_parser()
parser.register_input("input", (1, 1, 800), 0) # [channels, height, width]
parser.register_output("layer_fc/tf_output/BiasAdd")
engine = trt.utils.uff_to_trt_engine(G_LOGGER, uff_model, parser, 1, 1 << 20)
[TensorRT] ERROR: Failed to parse UFF model stream
File "/usr/local/lib/python2.7/dist-packages/tensorrt/utils/_utils.py", line 186, in uff_to_trt_engine
assert(parser_result)
Traceback (most recent call last):
File "/home/yizong/PycharmProjects/OfflineModelTensorflow-20180209/tensorflow_model.py", line 270, in <module>
engine = trt.utils.uff_to_trt_engine(G_LOGGER, uff_model, parser, 1, 1 << 20)
File "/usr/local/lib/python2.7/dist-packages/tensorrt/utils/_utils.py", line 194, in uff_to_trt_engine
raise AssertionError('UFF parsing failed on line {} in statement {}'.format(line, text))
AssertionError: UFF parsing failed on line 186 in statement assert(parser_result)
Then I modify my code like this, save the .uff file and read the .uff file:
# Read UFF model
uff_model = open(UFF_OUTPUT_FILENAME, 'rb').read()
# generate a TensorRT engine by creating a logger for TensorRT
G_LOGGER = trt.infer.ConsoleLogger(trt.infer.LogSeverity.ERROR)
# Create a UFF parser and identify the desired input and output nodes
parser = uffparser.create_uff_parser()
parser.register_input("input", (1, 1, 800), 0) # [channels, height, width]
parser.register_output("layer_fc/tf_output/BiasAdd")
# Pass the logger, parser, the UFF model stream, and some settings (max batch size and
# max workspace size) to a utility function that will create the engine
engine = trt.utils.uff_to_trt_engine(G_LOGGER, uff_model, parser, 1, 1 << 20)
It shows the error 134 like the below:
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
I don’t know why… Thanks for help.