Please provide complete information as applicable to your setup.
**• Hardware Platform (Jetson / GPU)GPU
**• DeepStream Version 6.1
**• TensorRT Version 8.2E
**• NVIDIA GPU Driver Version (valid for GPU only)515
Dear professor, this is a hurry problem to me, it makes me sad server days.
I use the pytorch to load ResNet50 in torchvision. I hope to train it by my own dataset, and translate it by tensorrt for SIGE of DS. However, it is a crushing problem for me.
(1) My model is:
class ResNet50_with_softmax(nn.Module):
def init(self):
super(ResNet50_with_softmax, self).init()
self.net = models.resnet50(weights=models.ResNet50_Weights.DEFAULT)
fc_features = self.net.fc.in_features
self.net.fc = nn.Linear(fc_features, 3)
self.softmax = nn.Softmax(dim=1)
def forward(self, x):
x = self.net(x)
x = self.softmax(x)
return x
(2) My onnx transform as below:
import torch
from myModel import ResNet50_with_softmax, ResNet50_No_softmax
input_names = [“input”]
output_names = [“predictions/Softmax”]
input_data = torch.randn((2, 3, 300, 200))
model = ResNet50_with_softmax()
model.eval()
output = model(input_data)
print(output)
torch.onnx.export(model,
input_data,
‘ResNet_with_softmax_D_300.onnx’,
export_params=True,
do_constant_folding=True,
input_names=input_names,
output_names=output_names,
dynamic_axes={‘input’: {0: ‘batch_size’, 2:‘width’, 3:‘height’},
‘predictions/Softmax’: {0: ‘batch_size’}})
(3) My command for translating the onnx into tensorrt as below
/usr/src/tensorrt/bin/trtexec --onnx=ResNet_with_softmax_D_300.onnx
–minShapes=input:1x3x300x200
–optShapes=input:8x3x300x200
–maxShapes=input:16x3x300x200
–workspace=14096
–saveEngine=SGIE_with_softmax_D_300.engine --fp16
(4) I copy the SGIE_with_softmax_D_300.engine to test2.
and modify the “dstest2_sgie1_config.txt” as below
[property]
gpu-id=0
net-scale-factor=1
model-engine-file=./SGIE_with_softmax_D_300.engine
labelfile-path=./SGIElabels.txt
force-implicit-batch-dim=1
batch-size=8
0=FP32 and 1=INT8 mode
network-mode=1
input-object-min-width=64
input-object-min-height=64
process-mode=2
model-color-format=1
gie-unique-id=2
operate-on-gie-id=1
operate-on-class-ids=0
is-classifier=1
output-blob-names=predictions/Softmax
classifier-async-mode=1
classifier-threshold=0.51
process-mode=2
#scaling-filter=0
#scaling-compute-hw=0
my problem is: I can not get the result of my SIGE. So I modify the Resnet50, such as delete the softmax, load my trained weight, delete the dynamic axis.
But few times, it can work, the SGIE can get result. It likes a small probability random event.
Even the code and processes are the same, a few times I can get the result of SGIE, but many times I can not.
It makes me crazy. Please kindly help me. Thank you very much