Waldo Detection Using YOLOv8
Solo Developer
A computer vision project that trains a YOLOv8 model to find Waldo in densely cluttered images, served through both a REST API and a web app.
Overview
About the project
Spotting a small, intentionally hidden figure in a busy Where's Waldo scene is a hard object detection problem. The target is tiny, the background is deliberately distracting, and the source images vary wildly in size and quality.
I ran exploratory analysis on a custom dataset of 106 images, where dimensions ranged from 500px to over 4000px, and preprocessed them to a consistent 640px input. Using transfer learning from pretrained COCO weights, I trained a YOLOv8 model for single class detection over 45 epochs with a batch size of 16 and data augmentation to offset the small dataset. The trained model is exposed two ways, as a Flask REST API and as a Streamlit web app.
The model reliably locates Waldo across images of very different sizes and quality, returning bounding boxes with confidence scores. It ships with two ready to use interfaces for testing and demonstration.
System Overview
At a glance
A computer vision project that trains a YOLOv8 model to spot Waldo in densely cluttered scenes, served two ways: a Flask REST API for programmatic access and a Streamlit app for browser based testing. The model is fine tuned from pretrained COCO weights and produces detections across images that vary wildly in size and quality.
How It Works
System Architecture
Roboflow Dataset
106 annotated images prepared for training
YOLOv8 Model
Single class object detector
Flask REST API
Programmatic access to detections
Streamlit App
Browser interface for trying the model
Process Flow
How the project moves from start to finish, step by step.
Prepare
Analyse and resize 106 images to a consistent 640px input size.
Train
Fine tune YOLOv8 from COCO weights over 45 epochs with augmentation.
Detect
Run inference to return bounding boxes with confidence scores.
System Breakdown
Training Setup
The training recipe is small but deliberate, with each choice driven by a constraint of the dataset.
Dataset
106 Annotated Images
A custom Roboflow annotated dataset with single class labels.
Size Variation
Images from 500px up to over 4000px on the long edge.
Preprocessing
Resized to a consistent 640px input before training.
Model and Training
Base Model
YOLOv8 initialised from pretrained COCO weights.
Epochs
45 epochs of fine tuning on the Waldo dataset.
Batch Size
16 images per batch on the training GPU.
Augmentation
Extra variation to compensate for the small dataset.
Serving
Flask REST API
Programmatic access for any external system that needs detections.
Streamlit App
Browser interface for ad hoc testing and demonstration.
Confidence Scores
Every detection comes with a certainty value alongside the bounding box.
Workflows
Training Pipeline
Three phases take the project from a folder of raw images to a working detector.
Data Preparation
Purpose: Make the dataset usable by a single class detector.
How it works
- Inspect the 106 images and note the size and quality variation.
- Annotate single class Waldo labels in Roboflow.
- Resize every image to a 640px input for consistency.
- Split into train, validation, and test sets.
Model Training
Purpose: Fine tune a strong base model on a small, specialised dataset.
How it works
- Start from pretrained COCO weights for a head start.
- Train YOLOv8 for 45 epochs at batch size 16.
- Apply data augmentation to stretch the small dataset further.
- Track training metrics for honest comparison.
Detection and Serving
Purpose: Make the model easy to use from anywhere.
How it works
- Run inference to return bounding boxes with confidence scores.
- Expose detections through a Flask REST API for integrations.
- Offer the same detections through a Streamlit web UI for casual use.
Under The Hood
Technical Implementation
from ultralytics import YOLO
# Fine tune from pretrained COCO weights
model = YOLO("yolov8n.pt")
model.train(
data="waldo.yaml",
epochs=45,
imgsz=640,
batch=16,
)Transfer Learning
Training starts from pretrained COCO weights for a head start.
Data Augmentation
Extra variation offsets the small 106 image dataset.
What It Does
Features & Capabilities
Cluttered Scene Detection
Finds a tiny target hidden in deliberately busy backgrounds.
Size Robust
Handles images ranging from 500px to over 4000px.
Two Interfaces
A Flask REST API and a Streamlit web app, ready to use.
Confidence Scores
Every detection comes with a certainty value.
Running It