📚 Course contents

AI & Computer Vision, lesson 10 of 52

What Makes Good Sports Data?

intermediate20 min readFull course

Introduction

From Unit 4 on you'll train AI models. A model learns only from the examples you give it, so the most important work happens before training. Today you'll learn what makes a good football dataset, measure blur and brightness with code, catch sneaky duplicate frames, and audit a dataset like a professional.

By the end of this lesson you'll be able to:

  • Explain why a model is only as good as its data
  • Name the main data quality problems in field sports: blur, occlusion, lighting, scale, angle and class imbalance
  • Measure blur and brightness with code
  • Find near-duplicate frames and explain why they cause a false sense of success
  • Audit a dataset and write up 5 specific problems with evidence
  • Describe what "diverse" means for a football dataset

Working principle

Garbage in, garbage out

A model learns patterns from examples. If the examples are narrow, blurry, wrongly labelled or repeated, the model learns the wrong thing. You can't fix poor data with a clever model.

Quality problems in football data

ProblemWhat it looks likeWhy it hurts
Motion blurA sprinting player or a ball smeared into a streakThe model sees shapes that never appear when things are still
OcclusionPlayers overlap, or the ball is hidden behind a legHard to label. The model must learn partial objects.
LightingSunny, cloudy, floodlit, backlit, shadowsColours and edges change. A sunny-only model fails at night.
ScaleThe ball is 5 pixels wide from the far side of the pitchToo small to learn. Detectors struggle with tiny objects.
AngleAll frames from one sidelineThe model fails from behind the goal or from above
Class imbalance500 players, 8 ballsThe model hardly learns the rare class
Duplicates40 frames in a row of the same still sceneTest results look great, but they're fake (see below)
Wrong labelsA box on the wrong player, or a missed ballThe model learns the mistake

Diversity

A good dataset covers the situations the model will meet: different angles, distances, lighting, teams and kits, pitch surfaces, weather, players (age, height, skin tone), and moments (play, set pieces, celebrations, empty pitch). If a group is missing, the model will be worse on it. This comes back in lesson 43.

The duplicate trap

Video gives you 30 almost identical frames per second. If you shuffle all the frames and split them into training and test sets, near-identical frames land in both. The model "remembers" the test frames, and the score looks perfect. This is called leakage. In lesson 13 we fix it by splitting by video, not by frame.

Measuring quality in code

  • Blur score: the variance of the Laplacian. A sharp image has strong edges, so a high variance. A blurry one is low. As a rough guide, below about 80 is blurry, but check on your own images.
  • Brightness: the mean of the grayscale pixels. Below about 50 is very dark. Above about 205 is washed out.
  • Near-duplicates: shrink each image to 8 by 8 grayscale and compare tiny fingerprints (an "average hash"). Few differing bits means the same scene.
What Makes Good Sports Data? | Electronics Simplified