I converted a Dashcam model from the example code into a TensorRT engine using tlt-convert, and tried to infer it by using the following pre-processing steps: convert to float, subtracting RGB channels numbers by offsets 77.2, 21.2, 11.8 respectively, and multiplying them by 1/255. However, the inferred results were different than the ones done through a modified version of deepstream-infer-tensor-meta-test app via deepstream. The pgie configs for Dashcamnet had net-scale-factor as 1/255 and no offsets. What is missing from these preprocessing steps for the Dashcam model?
Environment
TensorRT Version : 7.0.0.11 GPU Type : GTX1070 Nvidia Driver Version :450.66 CUDA Version : 10.2 CUDNN Version : 7.6.5 Operating System + Version : Ubuntu 18.04 Python Version (if applicable) : TensorFlow Version (if applicable) : PyTorch Version (if applicable) : Baremetal or Container (if container which image + tag) : nvcr.io/nvidia/deepstream:5.0.1-20.09-triton
Relevant Files
Changed within the docker image:
/opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-infer-tensor-meta-test/deepstream_infer_tensor_meta_test.cpp
/opt/nvidia/deepstream/deepstream-5.0/sources/libs/nvdsinfer_customparser/nvdsinfer_custombboxparser.cpp
Steps To Reproduce
The same image with cars is used for both the deepstream app and the TensorRT inference script
Pull and run the docker image: syther22/deepstream_dashcam_264 from docker.io
Run the container, run the deepstream-inter-tensor-meta-app
/opt/nvidia/deepstream/deepstream-5.0/sources/apps/sample_apps/deepstream-infer-tensor-meta-test# ./deepstream-infer-tensor-meta-app ./test.h264
the floating point number inference results start from 3.33143e-07 2.8675e-08 3.02065e-07 1.90778e-07 1.97347e-07 2.38013e-07…
Using TensorRT + cuda, the results of inference are different after following preprocessing steps mentioned above; eg. 1.33245e-06 7.46877e-07 1.81713e-06 1.9149e-06 1.86566e-06 2.54461e-06 5.59784e-06 8.99243e-06…
I can also send the source code for inference through TensorRT.
Hi @syther666,
Did you set the ‘offsets’ and ‘net-scale-factor’ in your pgie config, e.g. offsets=77.2, 21.2, 11.8, net-scale-factor=0.003921568627451 ? 0.003921568627451=1/255
For deepstream-infer-tensor-meta-test using dashcam I did not override the offsets(kept at default), and net-scale-factor was overridden to be ‘0.0039…’.
Since offsets is 77.5,21.1,11.8 by default the behavior should have been the same whether I set it or not.
Okay for your sanity, I added the line ‘offsets=77.5;21.2;11.8’ to the config. But the issue has been deepstream using the engine model file always got the correct results while TensorRT inference using a different script didn’t.