UNICAL Games
A drawing game scored live by a YOLOv8 model — players sketch a prompt, submit it, and get graded on what the detector actually sees.
Context
This project started from the idea of building an interactive game to present to the students of UNICAL's Master's in Data Science and Artificial Intelligence. The goal was twofold: make learning more engaging, and show in practice how an object detection model can be used to recognise specific objects inside an image.
While researching the game design, I came across Google's Quick, Draw! dataset, which turned out to be a particularly good fit. I decided to use it as the basis for the object categories to draw, relying on an already structured dataset so I could focus on the modelling, the game logic and the model integration.
Finally, I built a simple API to expose the model and handle inference, so it could be integrated directly into the game.
- Audience
- Master's in Data Science & AI · UNICAL
- Dataset
- Google Quick, Draw!
- Model
- YOLOv8
- Training
- 32 epochs · 6,000 examples per class
noise = synthetic scribbles
- 01Observation
The model sees something everywhere
The most interesting part of the project came during the first tests. While my colleagues tried the game, I noticed a problem: the model would often assign a label even to drawings with no recognisable structure. In practice, drawing something vaguely similar to one of the categories was enough for the model to produce a prediction anyway.
- 02Solution
Weighted scoring, not hit/miss
So I designed a scoring system that doesn't just check whether a given label is present, but combines the predicted class, the average confidence and a weight assigned to each category. This made the evaluation more robust and, above all, stopped a random prediction from automatically producing a high score.
score = Σ count × weight(class) × mean confidence - 03Verification
Synthetic scribbles as noise
To test the model's behaviour further, I also generated drawings made of random strokes using mathematical equations. The goal was to simulate scribbles and use them as a kind of controlled noise, to measure how sensitive the model was to inputs with no clear semantic structure.
The final result and how the system behaves can be seen right below.
How it's built
- The canvas is exported as a PNG and posted to a FastAPI endpoint on submit.
- A YOLOv8n model runs inference at confidence ≥ 0.70, filtered against a fixed label set.
- Score is count × per-label weight × average confidence, summed across labels and saved to an in-memory leaderboard.
Results
- Detection runs at conf ≥ 0.70, so partial or ambiguous sketches don't inflate the score.
- Score is a function of count, per-label weight, and average confidence — not just a hit/miss flag.
- Backend and frontend ship as separate containers behind one Docker Compose stack, deployed alongside this portfolio.
Play it live
UNICAL Games runs as its own containerised app — a FastAPI backend serving the model, a Next.js frontend for the canvas and leaderboard — deployed alongside this portfolio rather than folded into it.
Open UNICAL Games ↗