Portfolio Project
Shape Classifier Demo
Handwritten Shape Recognition
Context
I wanted a model that can tell what shape someone drew.
Approach
- Used Google's QuickDraw sketches and built train/validation splits.
- Trained a small ResNet18 classifier in PyTorch.
- Deployed a CPU-only AWS Lambda endpoint so the browser can request predictions.
Impact
- About 90% accuracy on five shapes: circle, triangle, square, hexagon, and octagon.
- After warm-up (~10 seconds), predictions return in under a second.
Data and Training
I trained a small classifier on Google’s QuickDraw sketches to recognize five basic shapes from a simple black-and-white drawing.
- Built class-balanced train/validation splits from QuickDraw categories.
- Used ResNet18 to keep the model small and fast.
- Exported plain weights (`model.pt`) so inference stays simple.
Inference API
- Implemented an AWS Lambda handler that takes a base64 image and returns a class plus confidence.
- Kept the API browser-friendly (CORS and small JSON payloads).
- Ran CPU-only inference so it works well in serverless environments.
Demo UX
- Canvas drawing UI with a clear submit step and a confidence bar.
- Clear status messaging during warm-up and cold starts.
- Preprocessing tuned so messy real-world strokes still work.
What I'd Improve
- Calibrate confidence (for example, temperature scaling) so scores are more reliable.
- Expand to more shapes and add augmentation for stroke width and incomplete outlines.
- Create a small human-drawn validation set to measure real-world performance.