Feature vector shape in TensorRT converted pose estimation model?

Hi all,
I recently converted a yolo11n-pose model to TensorRT (by first exporting to ONNX in python and then using trtexec). Now I’m running inference on it using a modified version of CyrusBehr’s tensorrt library for cpp (GitHub - cyrusbehr/tensorrt-cpp-api: TensorRT C++ API Tutorial). My object contains 4 keypoints so that each prediction should contain: Class w_bounding h_bounding c_bounding and 4*(p_x p_y p_confidence). My raw feature vector is has a single vector inside it which has length 109 200. Could anybody suggest why this is such a high number? Is it just an error? The maximum number of objects in an image is less than 10.

I would be thankful for any and all suggestions and hints.

Each prediction would contain x y w h confidence

And there would be either 4x3 keypoints or 4x2 keypoints depending what your training dataset contained. It seems like it’s 4x2 because

109200 / (4 + 1 + (4*2)) = 8400

which matches the number of anchors for 640x640 imgsz.

So you need to reshape it to (8400, 13) and they then need to be filtered using confidence threshold and processed through NMS to get the final output.

2 Likes

Thank you for the reply. When processing in this manner there should be a object confidence at feature_vector[4] and class confidence at feature_vector[5], however when i put these values through sigmoid (1/(1+e^(-x))) i get 1.0 for all probabilities. It seems to me that this is the symptom of improper handling. Is it possible that there are some initial “buffer” members at the beggining of the flattened vector? Maybe trt somehow corrupted the feature vector?

Hello! Thanks for the follow-up.

The raw output tensor from the exported model typically contains logits, not probabilities. Applying a sigmoid function is the correct step for the object confidence score (usually the 5th element, index 4, in the feature vector per proposal: x, y, w, h, conf, ...kpts).

If you’re consistently getting 1.0 after sigmoid, it suggests the raw logit values might be very high positive numbers, or perhaps the TensorRT conversion process or your C++ handling might be interpreting the output differently.

Could you double-check the raw values at the confidence score index in your C++ code before applying the sigmoid? Verifying these raw values might help diagnose whether the issue lies in the model output itself or in the post-processing step. The standard export process usually doesn’t apply sigmoid within the exported graph itself.

There’s no separate object confidence other than class confidence. And you don’t need to apply sigmoid. It’s already applied.

You can find examples of post-processing here: