Open mahesh11T opened 11 months ago
can I get help on how to run with dynamic shape input in python? can you add an example in python?
import cv2 import tritonclient.grpc as grpc_client import time import sys sys.path.append("/opt/nvocdr/tiny-tensorrt/build/lib") import pytrt import numpy as np # /opt/nvocdr/tiny-tensorrt/build/lib/pytrt.cpython-310-x86_64-linux-gnu.so # Assuming engine creation logic exists prior to this snippet # Load the engine engineFile = r"/opt/nvocdr/engines/ocdnet.fp16.engine" onnx_model = r"/opt/nvocdr/onnx_model/ocdnet.onnx" trt = pytrt.Trt() # Create an optimization profile min_shape = (1, 3, 736, 1280) # Define minimum input shape max_shape = (4, 3, 736, 1280) # Define maximum input shape # opt_profile = trt.create_optimization_profile() trt.AddDynamicShapeProfile('INPUT_DATA', min_shape, max_shape) trt.AddDynamicShapeProfile('INPUT_IMG_EXTENSION', min_shape, max_shape) trt.BuildEngine(onnx_model, engineFile)
Sorry I won't work in this project now since we had better alternatives.
E.g. you can use TensorRT's python API directly, or use trtexec or polygraphy to do the engine built quickly.
can I get help on how to run with dynamic shape input in python? can you add an example in python?