asetkn / Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps

30 stars 16 forks source link

Converting all_labels.csv to YOLOv3 format #2

Open WellDL opened 4 years ago

WellDL commented 4 years ago

Actually not an issue, but maybe you can help me out in this.

I need the label information for YOLO training. For each image, there is a separate txt file containing the location of the bbox. For the training, I need the following order:

class_number x_center y_center width_bbox height_bbox

The values are not absolute, but rational to the width and height. For example:

0 0.50 0.50 0.15 0.15

This example means the x_min and y_min are in the center of the image. width and height are 0.15 of the image, however, if the width differs from height (f.e. 600x450), the bbox is not a square, but a rectangle.

At the end, the dataset in the directory for YOLO-training contains following:

ABC.jpg
ABC.txt
DEF.jpg
DEF.txt
...

Do you know how I can solve the convertion to YOLO format with using python?