how to balance a dataset with multiple annotations of different classes per image?

120 Views Asked by At

I am trying to train an object detection model in Yolov8 using ultralytics. I have a dataset with 8975 images, a total of 28 classes and 26616 annotations. Note that each image can have different annotated classes. The big problem arises when I want to perform a data augmentation only of the most unbalanced classes, but without increasing a lot the number of classes with more annotations or at least taking them into account. This is the distribution class:

- Class 1   9253 annot
- Class 2   6537 annot
- Class 3   1777 annot
- Class 4   1512 annot
- Class 5   1416 annot
- Class 6   1341 annot
- Class 7   1177 annot
- Class 8   785 annot
- Class 9   625 annot
- Class 10  388 annot
- Class 11  369 annot
- Class 12  282 annot
- Class 13  216 annot
- Class 14  155 annot
- Class 15  128 annot
- Class 16  93 annot
- Class 17  92 annot
- Class 18  84 annot
- Class 19  81 annot
- Class 20  72 annot
- Class 21  66 annot
- Class 22  60 annot
- Class 23  51 annot
- Class 24  33 annot
- Class 25  15 annot
- Class 26  4 annot
- Class 27  2 annot
- Class 28  2 annot

Some Help!

I need a code or library that I can use so that from a folder containing images (.jpg) and annotations, I can increase the number of images contained in the minority classes, without exceeding too much the other classes.

0

There are 0 best solutions below