Inspiration

In badminton, every reply is decided in a fraction of a second, and good players read what is coming before the shuttle crosses the net. Researchers now record professional rallies shot by shot, but that data mostly lives in papers. Club and school players and coaches have no simple way to ask, "after these two shots, what usually comes back?" I'm a data analytics student in Malaysia, where badminton is widely played, and I wanted to turn that research data into something anyone can open on a phone.

What it does

ShuttleSense predicts the next shot in a badminton singles rally.

  • Predict: set the last two shots (type, landing zone, where the hitter stood, backhand, around-the-head). A neural network shows the most likely reply and the probability of every possible reply. A white tick marks what a simple "last shot only" frequency table would say, so you can see what the extra context changes.
  • Replay a real rally: step through rallies from matches the model never saw. Before each shot, it makes its guess. Green tiles are hits; red tiles show what it said instead. A running tally keeps score.
  • Results: the model's measured accuracy against four baselines, a robustness check, per-shot strengths and weaknesses, and its limitations.

Everything runs in the browser. There's no server, no API key, no sign-up, and it works on a phone.

How I built it

  • Data: ShuttleSet22 (Wang et al., IJCAI 2024 Demo Track, MIT licence): 33,612 strokes from high-ranking 2022 singles matches. I used the official training file (30,172 strokes, 44 matches) and split it by match: 31 train / 6 validation / 7 test, so no match leaks between sets. The model learned from the 20,611 strokes in the training matches.
  • Features: each shot becomes 32 features: shot type, landing zone, hitter zone, backhand and around-the-head flags.
  • Model: a single-layer GRU (64 hidden units) reads the last two shots and outputs a probability for each of 10 shot types. It's trained in PyTorch with Adam and early stopping on the validation matches.
  • Baselines: majority class, bigram and trigram frequency tables, and a 300-tree random forest on the same features.
  • In the browser: I export the weights to JSON and reimplement PyTorch's GRU equations in about 60 lines of plain JavaScript. A test checks the JavaScript against PyTorch on held-out samples: the maximum probability difference is 3 × 10⁻⁷, and all 20 top-1 predictions match.
  • Site: static HTML, CSS and JS on GitHub Pages, with self-hosted Barlow fonts.

Results

On 7 held-out matches (4,082 predictions):

Model Top-1 Top-3 Macro F1
Majority class 15.6% 35.7% 0.034
Bigram (last stroke type) 48.3% 90.8% 0.330
Trigram (last two types) 49.3% 90.9% 0.365
Random forest (same features) 50.8% 93.0% 0.400
GRU (2-stroke window) 52.3% 93.2% 0.413

Is the lead real? I repeated the whole comparison over 5 more match splits. Top-1 averaged 51.6% ± 1.0 for the GRU, 50.8% ± 0.5 for the random forest and 49.2% ± 1.3 for the trigram. The GRU beat the random forest in 4 of 5 splits. The lead is real but small, and the app says so.

Per-shot recall: defensive shot 91%, lob 70%, net shot 62%, smash 58%, clear 36%, drop 29%, drive 4%, push/rush 1%.

Challenges I ran into

  • My first random-forest result scored below the majority-class guess. The cause: serves never occur as a "next shot", so the forest learned only 8 of the 10 classes and its probability columns were shifted. I fixed the mapping before trusting any number.
  • The dataset's court coordinates are mirrored by side, so the 1–10 zone codes can't be placed on a court reliably. Rather than draw a court I couldn't back up, the app labels zones by their dataset codes.
  • Running a neural network with no server meant writing the GRU forward pass by hand and proving it matches PyTorch.

Accomplishments that I'm proud of

  • A working, honest model you can try in 30 seconds, with baselines, a robustness check and its weak spots shown in the app itself.
  • Exact agreement between the browser model and PyTorch, covered by a test.
  • Fully reproducible: one command retrains every model and regenerates every number.

What I learned

A simple frequency table is a strong baseline for sport sequences, and claims of improvement need repeated splits, not one lucky number. Rare shots (drives, pushes) are where models struggle, which matches how hard they are for players to read.

What's next (practical value and future development)

  • Predict where the shuttle will land, not just the shot type.
  • Player-specific models, so a coach can scout a known opponent's habits.
  • Doubles, and data from Malaysian club and school matches.
  • A courtside mode where a coach taps in shots live during training.

Limitations

The model was trained on professional singles from 2022, so club play and doubles will differ. It predicts shot type only, sees just the last two shots, and rarely predicts drives or pushes.

Disclosure

  • Data: ShuttleSet22 by Wei-Yao Wang, Wei-Wei Du, Wen-Chih Peng and Tsi-Ui Ik (MIT licence). The repo holds only trained weights and 60 sample rallies, not the raw dataset.
  • Prior work: the idea of forecasting the next stroke type with a 2-stroke recurrent model comes from my university coursework (Optimisation and Deep Learning, APU). For this hackathon I wrote a new training script and baselines, the robustness study, the browser implementation, the web app and the video. Every number here comes from this repo's code.
  • AI assistance: I used Claude (Anthropic) to help write code, documentation and this write-up, and the video narration is a synthetic voice (Piper TTS).

Built with

python, pytorch, scikit-learn, pandas, javascript, html, css, github-pages, playwright, ffmpeg

Share this project:

Updates

Submission history