📚 Course contents
AI & Computer Vision, lesson 13 of 52
Train, Validation & Test Splits, and Augmentation
Introduction
You've got labelled frames. Before training, they need splitting into three piles: one to learn from, one to check progress, and one to keep secret for the final test. Split them wrongly and your model will look brilliant in class and fail on match day. Today you'll split the right way, then use augmentation to get more variety out of the same photos.
By the end of this lesson you'll be able to:
- Explain what the training, validation and test sets are for
- Split a dataset 70/20/10 by session, so near-identical frames don't leak
- Keep class proportions similar in each split
- Choose augmentations that make sense for football (motion blur, brightness, crop, flip) and reject those that don't
- Apply augmentation only to the training set, with the boxes updated correctly
- Export the final dataset in YOLO format
Working principle
Three sets, three jobs
| Set | Share | Job | When it is used |
|---|---|---|---|
| Training | 70% | The model learns from it | Every training step |
| Validation | 20% | Pick settings, spot overfitting, decide when to stop | During training |
| Test | 10% | One final, honest score | Once, at the end |
Never tune on the test set. If you do, it becomes part of training, and the score lies.
Leakage: split by session, not by frame
From lesson 10: frames from the same video are almost identical. A random split puts a frame in train and its twin in test, and the score is fake.
Each colour is one session: frames a split second apart, nearly identical. Split by frame and 13 training frames are near-copies of test frames: the exam answers leaked.
Fix: keep every frame of one session (one camera position and time, the session id in the file name from lesson 11) together in one split. Then the test set is genuinely new places and moments.
This needs enough sessions. With only 3 sessions you can't make a 70/20/10 split. Aim for at least 10 per class. That is one more reason the field trip uses several camera positions.
Keeping classes balanced
Split each class separately, so every split has players, balls and goals in similar proportions. (This is called a stratified split.)
Augmentation: more variety from the same data
| Augmentation | Football use | Careful? |
|---|---|---|
| Brightness and contrast | Sun, cloud, floodlights | Keep within real conditions |
| Motion blur | Sprinting players, a ball in flight | Realistic: use small kernels |
| Random crop (keeping the boxes) | Players at different distances | Don't crop out the object |
| Horizontal flip | Pitch viewed from either side | Fine for football. Not for text, such as shirt numbers. |
| Rotation | Slightly tilted cameras | Small angles only (a few degrees) |
| Colour swap of kits | New teams | Optional |
| Vertical flip | Never happens in real footage | No |
Rule: only augment the training set. Validation and test must stay as real as possible.
Augmentation must move the boxes too
If you crop or flip an image, the labels must change with it. Libraries such as Albumentations do this when you give them the boxes.

