Hi Nvidia Team,
I have converted the Slow Fast model(trained on our Custom dataset) from Pt to ONNX. I need to further convert the ONNX model to TRT. But the main challenge is that the model has two Inputs(As shown in the image below). I usually convert the ONNX model to TRT using the standard code below:
import tensorrt as trt TRT_LOGGER = trt.Logger(trt.Logger.WARNING) trt_runtime = trt.Runtime(TRT_LOGGER) def build_engine(onnx_path, shape = [1,3,112,112]): with trt.Builder(TRT_LOGGER) as builder, builder.create_network(1) as network, trt.OnnxParser(network, TRT_LOGGER) as parser: builder.fp16_mode = True builder.max_workspace_size = (256 << 20) with open(onnx_path, 'rb') as model: parser.parse(model.read()) network.get_input(0).shape = shape engine = builder.build_cuda_engine(network) return engine def save_engine(engine, file_name): buf = engine.serialize() with open(file_name, 'wb') as f: f.write(buf) def load_engine(trt_runtime, plan_path): with open(engine_path, 'rb') as f: engine_data = f.read() engine = trt_runtime.deserialize_cuda_engine(engine_data) return engine from onnx import ModelProto engine_name = "model.trt" onnx_path = "model.onnx" model = ModelProto() with open(onnx_path, "rb") as f: model.ParseFromString(f.read()) batch_size = 1 d0 = model.graph.input.type.tensor_type.shape.dim.dim_value d1 = model.graph.input.type.tensor_type.shape.dim.dim_value d2 = model.graph.input.type.tensor_type.shape.dim.dim_value shape = [batch_size , d0, d1 ,d2] engine = build_engine(onnx_path) save_engine(engine, engine_name)
But, as I mentioned above that the Slowfast model has two inputs, I am facing difficulty in converting the ONNX Model(with two inputs) to TRT.
I Kindly request you assist me in changing the above Code for two Inputs for Conversion.
Thanks in advance,