I’m using a SSD Lite Mobilenet V2 model that I retrained and changed the input network size (from square to rectangular input size) with TensorFlow. Then I converted this model to UFF format to finally convert it to a TensorRT engine to run on a Jetson with DeepStream. To do so I put my UFF file in the deepstream-app config file to convert it to TensorRT and then start the deepstream-app.
When I do this on a Jetson Xavier NX with TensorRT 8.0 and DeepStream 6.0, the TensorRT engine is created and the app runs but the bounding boxes I get are shifted.
When I do the same thing on a Jetson TX2 with TensorRT 7.1 and DeepStream 5.1, everything works fine and the bounding boxes are not shifted. For TensorRT 7.1, since GridAnchorRect_TRT was not supported, I had to download TensorRT OSS 7.1 which had the plugin to build the TensorRT engine.
Is there a difference between TensorRT 7.1 and 8.0 that could create this issue? Is there a way to make it work with TensorRT 8.0?
Hi, yes I used the sample config_infer_primary_ssd.txt and modified the values so it can corresponds to my model.
To test it with JetPack 4.6.1, I have to uninstall the current JetPack version and reinstall the new one or can I just upgrade it in a simple way ?
Hi, I just did another test by using the TensorFlow pre trained SSD Lite Inception V2 model, which have a square input shape (300x300). I tried it on the Jetson NX with TensorRT 8.2 and the bounding boxes are not shifted. So I really think this issue has to do with the fact that I used a rectangular input shape for my retrained model.
There are some discussions on the nonsquare input for YOLO with Deepstream.
Not sure if you are facing the same issue although we didn’t receive a similar one for SSD.
Hi, I looked it up and it doesn’t help. The files are really different for YOLO and SSD.
I found on github a post of somebody having a similar issue as mine with a SSD but it was not solved either : GridAnchorRect_TRT get shifted bbox · Issue #691 · NVIDIA/TensorRT · GitHub. The only difference is that it seems that this person was running TensorRT 7.1 but it was also on a Jetson Xavier as he mentioned.
Hi, I don’t really get the correct output. It seems like the bounding boxes inside the square part of the video is kind of okay (the height * height subframe of the height*width frame) even though there is still a bit of shift but it’s better than before. But there is no bounding boxes outside of this square part and you can see it from the way the bounding boxes get thin and disappear outside of that subframe.
Thanks for your patience.
We found the real issue of this problem. Please ignore the workaround of the Deepstream parser shared on Jun 30.
The root cause is that the gridAnchor kernel doesn’t handle the rectangular case.
It uses a single anchorStride to represent horizontal and vertical stride, and generates the incorrect bbox position when W≠H.
To fix this, please build the TensorRT plugin with the below patch that has rectangular support.
(You don’t need to apply the nvdsparsebbox_ssd WAR anymore)
Update cmake 3.13.0
$ wget http://www.cmake.org/files/v3.13/cmake-3.13.0.tar.gz
$ tar xpvf cmake-3.13.0.tar.gz cmake-3.13.0/
$ cd cmake-3.13.0/
$ ./bootstrap
$ make -j8
$ echo 'export PATH='${PWD}'/bin/:$PATH' >> ~/.bashrc
$ source ~/.bashrc
Hi thank you for your answer.
I’m at the step of running the cmake line to build TensorRT. At first I had this issue:
CMake Error at CMakeLists.txt:47 (project):
No CMAKE_CUDA_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable “CUDACXX” or the CMake cache entry CMAKE_CUDA_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.
which I solved by adding - DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc at the end of the cmake line.
But now I have this error:
fatal error: cub/cub.cuh: No such file or directory #include “cub/cub.cuh”
^~~~~~~~~~~~~
compilation terminated.
plugin/CMakeFiles/nvinfer_plugin.dir/build.make:1466: recipe for target ‘plugin/CMakeFiles/nvinfer_plugin.dir/efficientNMSPlugin/efficientNMSInference.cu.o’ failed
Do you know how I can solve this? Is the first thing that I did by adding -DCMAKE_CUDA_COMPILER was a good solution?
Thanks.