How to convert YOLOv4 feature vectors to bounding boxes?


I implement object detection code for Yolov4 using tensorrt c++ pipeline. Although tensorrt c++ api is not user friendly at all, I managed to preprocess image and inference the model. I, however, have 3 outputs which are in shape of 18x52x52, 18x26x26 and 18x13x13. How can I convert these outputs to bounding boxes?

For example my outputs for a person picture go like this: 0.103638 -0.646484 -0.632324 -0.922852 -0.981445 -0.602539 ... which has a size of 18x52x52 = 48672

My guess is that I have to add layers at the end of the network to convert these vectors such as yolo plugins layers and some calculations layers but I couldn’t come up with an example.


TensorRT Version: 8.6.1
GPU Type: Geforce 1650Ti
Nvidia Driver Version: 525.105.17
CUDA Version: 12.0
CUDNN Version:
Operating System + Version: Ubuntu 20.04
Python Version (if applicable): 3.10.9
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):


Please refer to the following sample, which may help you:

Thank you.