Coverting Polygons to Bounding Boxes

How exactly do we use this? where to run the code in order to convert the polygons to bounding boxes ?

# Import Supervision
import supervision as sv

# Import polygon data
detections = sv.Detections.from_roboflow(prediction,classes)

# Export as xyxy data
bounding_boxes = detections.xyxy

currently working on a object detection model using yolov8 and (due to some human error while annotating the dataset the number of segments is not equal to number of boxes) when uploaded the dataset to train the model encountered an error stating segments and boxes aren’t equal. so can you help me know where exactly do i need to run this code which is stated above to convert Polygon to Bounding Boxes in my dataset

Hi @Ankitha_S

You can run the code anywhere, but as an example, we used a Google Colab notebook.

Could you share more about the error? Usually, YOLOv8 doesn’t have a problem using polygon annotations for training an object detection model.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.