I tried this python code to do the generation but failed. Please help.
import uff
import tensorrt as trt
import graphsurgeon as gs
uff_model_path = ‘./model.uff’
TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
trt.init_libnvinfer_plugins(TRT_LOGGER, ‘’)
trt_runtime = trt.Runtime(TRT_LOGGER)
with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.UffParser() as parser:
builder.max_workspace_size = 1 << 30
builder.fp16_mode = True
builder.max_batch_size = 1
parser.register_input(‘Placeholder_1’, (1, 416, 416, 3))
parser.register_output(‘yolov3/yolov3_head/feature_map_1’)
parser.register_output(‘yolov3/yolov3_head/feature_map_2’)
parser.register_output(‘yolov3/yolov3_head/feature_map_3’)
parser.parse(uff_model_path, network)
print(‘Building TensorRT engine, this may take a few minutes…’)
trt_engine = builder.build_cuda_engine(network)
with open(“model.engine”, “wb”) as f:
f.write(trt_engine.serialize())
Error message:
2020-08-10 12:51:25.168202: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
WARNING:tensorflow:Deprecation warnings have been disabled. Set TF_ENABLE_DEPRECATION_WARNINGS=1 to re-enable them.
[TensorRT] ERROR: UffParser: Validator error: yolov3/yolov3_head/Conv_5/BatchNorm/cond/Switch: Unsupported operation _Switch
Building TensorRT engine, this may take a few minutes…
Segmentation fault (core dumped)