Closed vanguard478 closed 1 year ago
Hi @vanguard478, sorry for the late response. Can you please upload the exported onnx model so I can debug on my end and determine what is causing the segfault.
same problem. I try this official resnet50-onnx and my OS is Ubuntu18.04-cuDNN8.2.2-TensorRT-8.4.1 :
import torchvision.models as models
import torch
import torch.onnx
import numpy as np
import onnx
# load the pretrained model
resnet50 = models.resnet50(pretrained=True, progress=False).eval()
USE_FP16 = True
target_dtype = np.float16 if USE_FP16 else np.float32
dummy_input = torch.randn(1, 3, 224, 224)
torch_out = resnet50(dummy_input)
torch.onnx.export(resnet50, dummy_input, "resnet50_pytorch_d.onnx",
verbose=False,
input_names=['input'],
output_names=['output'],
dynamic_axes={
'input': {0: 'batch_size'},
'output': {0: 'batch_size'},
}
)
Hi @LicharYuan The model you have provided has an input of (1, 3, 224, 224), whereas the input image in the repo is of size (3, 112, 112). Therefore the dimensions don't match. I can't be certain if you used the input image in the repo, or your own one. I am therefore closing this ticket.
That being said, I have made the code more robust such that it will give an error message if you try to provide an input which is not the correct size.
Please test again with the patches I have added and if you can still reproduce the bug, you can re-open this ticket and I will look into it.
I am able to build this project, but running the inference after the engine has been generated throws a
segmentation fault
errorAfter the successful generation of the engine when I run the driver again I get the following error.
Environment TensorRT Version : 8.0.1-1 CUDA Version : 10.2 Operating System + Version : Ubuntu 18.04.6 LTS Inference Network : AlexNet (using the conversion tutorial here : AlexNet from PyTorch to ONNX ) . I used the dynamic_axes flag while exporting the model.
Device for TRT engine builder: Jetson Nano 4GB