Hello, I’m trying to do object detection(Yolov5) in TensorRT.
But I’m not sure how to get results.
My workflow:
Model is trained with Yolo v5. It works correctly in Pytorch framework.
Convert the model to ONNX format in Ubuntu PC.
Convert the ONNX-format Model to TensorRT in Jetson nano.
Problem:
I inferred with the TensorRT model. But it returns array of [nan, nan, nan, … ,nan].
How to get bounding boxes, confidences, class IDs?
(I post same article in Jetson forum https://forums.developer.nvidia.com/t/how-to-get-results-bonding-boxes-class-ids-confidences-of-object-detection-yolo-v5-in-tensorrt/195816)
def main():
    SHOW_IMAGE=True

    data_root="../Image/gratin_od/images"
    files = glob.glob(data_root+"/*.bmp")

    print("Got file names")
    files.sort()
    print(files[75])
    all_judges=np.empty(0)


    # Image shape expected by the post-processing

    with get_engine("./models/gratin.onnx", "./models/gratin.trt") as engine, \
        engine.create_execution_context() as context:

        for i in range(1):
            x_cv = cv2.imread(str(files[75]))
            start = time.time()
            x_show = cv2.cvtColor(x_cv, cv2.COLOR_BGR2RGB)


            inputs[0].host = x_show
            output= common.do_inference(context, bindings=bindings, inputs=inputs, outputs=outputs, stream=stream)

            print(output[0])   
            #print>> [nan nan nan ... nan nan nan]
            #How to get bounding box, class id and confidence?


            end = time.time()
            ms = 1000.0*(end-start)
 

            if(SHOW_IMAGE):
                cv2.imshow("image", x_cv)
                cv2.waitKey(0)&0xFF

    print("END")