guides/kfold-cross-validation/ #13044
Replies: 6 comments 20 replies
-
In the 5th step, there is a bug. As we all known, 'labels' is a generator, it can't be resued. so in the step, 'labels' is empty when runing code |
Beta Was this translation helpful? Give feedback.
-
Is there any way to implement Stratified K-Fold Cross Validation with YOLOv8? |
Beta Was this translation helpful? Give feedback.
-
Good guide, consider adding it in a colab notebook. In section "Train YOLO using K-Fold Data Splits", model should be re-initialized foe every k, i.e. it should be inside the for-loop: for k in range(ksplit). |
Beta Was this translation helpful? Give feedback.
-
is it usefult to use this k fold approach when I just have one class only |
Beta Was this translation helpful? Give feedback.
-
After the loop:
Should be this line of code: For Otherwise the script creates background images because some images missing their labels. |
Beta Was this translation helpful? Give feedback.
-
Hi, I am applying K-fold validation using the leave-one-out technique. My dataset consists of a single class and includes 21 images in total. For each split, I use 20 images for training and 1 image for testing. I am implementing the leave-one-out technique with the code above, setting ksplit=21. I am not using a separate validation dataset, only training and testing data. Here is the code I am using: results = {} Define additional arguments herebatch = 16 for k in range(ksplit): In my data.yaml file, I have provided the validation path as the test set. my data.yaml file for each split looks like this:
My second question is about calculating the final performance. When I ran the above code, it calculated scores for each individual split. Do I need to calculate the final performance metrics manually, or is there any functionality in YOLOv8 to compute the aggregated performance automatically? |
Beta Was this translation helpful? Give feedback.
-
guides/kfold-cross-validation/
An in-depth guide demonstrating the implementation of K-Fold Cross Validation with the Ultralytics ecosystem for object detection datasets, leveraging Python, YOLO, and sklearn.
https://docs.ultralytics.com/guides/kfold-cross-validation/
Beta Was this translation helpful? Give feedback.
All reactions