Incorrect Bounding Box co-ordinates


I’ve written Python code to use “ssd-mobilenet -v2” uff model with “jetson.inference.detectNet” to perform inference on video data.

Inference is working well, but the bounding box co-ordinates for detected objects seems to be incorrect.

In the attached image, it seems that the bounding boxes needs to be “transposed” vertically.

Below is the sample code used:

    width = frame.shape[1]
    height = frame.shape[0]
    img = jetson.utils.cudaFromNumpy(frame)
    detections = net.Detect(img, width, height, overlay='none')
    for detection in detections:
        detected_class = class_names[detection.ClassID]
        left = int(detection.Left)
        right = int(detection.Right)
        width = int(detection.Width)
        height = int(detection.Height)
        top = int(detection.Top)            
        bottom = int(detection.Bottom)
        cv2.rectangle(frame, (top, left), (bottom, right), (0,255,0), 2)
        cv2.putText(frame, detected_class, (top-10, left-10), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0,255,0), 1)

Can somebody help me with this ?



Sorry for the late response.

Would you mind to change to x, y coordinate in cv2.rectangle?
It looks like it just a coordinate misplacement issue to us.