Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'pytrt.Trt' object has no attribute 'AddDynamicShapeProfile' #72

Open
mahesh11T opened this issue Nov 15, 2023 · 1 comment
Open

'pytrt.Trt' object has no attribute 'AddDynamicShapeProfile' #72

mahesh11T opened this issue Nov 15, 2023 · 1 comment
Assignees

Comments

@mahesh11T
Copy link

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)

image

@zerollzeng
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants