0
$\begingroup$

I have a dataset for Object Detection with YOLO format labels, each imagine can have occurences of different classes and multiple occurences of the same class.

How can the dataset be divided into Training, Validation, and Test sets so that each contains about the same percentage of occurences per class?

$\endgroup$

1 Answer 1

1
$\begingroup$

You can use the scikit learn train_test_split() by passing the stratify argument with the class value.

$\endgroup$
1
  • $\begingroup$ This can become a more complicated problem , if there is imbalance in the distribution of classes. $\endgroup$
    – ML_Passion
    Commented Apr 27, 2023 at 21:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .