maudzung / Complex-YOLOv4-Pytorch

The PyTorch Implementation based on YOLOv4 of the paper: "Complex-YOLO: Real-time 3D Object Detection on Point Clouds"
https://arxiv.org/pdf/1803.06199.pdf
GNU General Public License v3.0
1.21k stars 260 forks source link

Getting error while running the code #59

Open dibyendu22 opened 1 year ago

dibyendu22 commented 1 year ago

Press n to see the next sample >>> Press Esc to quit... Traceback (most recent call last):

Overload resolution failed:

  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type
  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type
nikitamalviya commented 3 months ago

There an issue with the order or structure of the coordinates passed to cv2.line(), also the corners_int are in float values.

Replace the function drawRotatedBox with the below function in the module data_process/kitti_bev_utils.py

def drawRotatedBox(img, x, y, w, l, yaw, color):
    bev_corners = get_corners(x, y, w, l, yaw)
    corners_int = np.round(bev_corners).astype(int)  # Convert coordinates to integers
    cv2.polylines(img, [corners_int], True, color, 2)

    # Extract coordinates of the endpoints of the diagonal line
    pt1 = (corners_int[0, 0], corners_int[0, 1])  # Top-left corner
    pt2 = (corners_int[2, 0], corners_int[2, 1])  # Bottom-right corner

    # Draw the diagonal line
    cv2.line(img, pt1, pt2, (255, 255, 0), 2)

The modified function : The function extracts the coordinates of the top-left and bottom-right corners from corners_int and creates tuples (x, y) for each point. These tuples are then passed as arguments pt1 and pt2 to cv2.line() to draw the diagonal line across the rotated box. By ensuring that the coordinates are correctly structured as tuples of integers, this modification should resolve the error you're encountering when drawing the diagonal line.