SSD MobileNetV2 with TensorRT returns bounding boxes with wrong width (but height is good)

I’m using a SSD Mobilenet V2 model retrained with TensorFlow, changing the size of the input network (rectangular input size). I converted this model to UFF format and then convert it to TensorRT engine. I applied the “0001-Add-rectangular-support-in-gridAnchor-kernel” patch found in this forum to fix the gridAnchorLayer.cu kernel in order to handle the problem with shifted bounding boxes.

Now the bounding boxes are in the correct position, but the width is wrong while the height is right.

I’m using TensorRT 8.4.1, cuda 11.7.

How can I solve the problem?
Do I need to apply other changes to gridAnchorLayer.cu?

Thanks

I assume that the parameters “anchorStrideH” and “anchorStrideW” in the “gridAnchorLayer.cu” file need to be changed.
Now they are:

float anchorStrideH = (1.0 / param.H)
float anchorStrideW = (1.0 / param.W)

but, in my case, the aspect ratio of the image is not 1.0, as the input image is rectangular. So, my question is:

do I have to rewrite “anchorStrideH” or “anchorStrideW” to reflect the correct aspect ratio of the rectangular input image?

Thanks