A webcam-based image classifier that helps identify whether an item is recyclable, trained on 500+ images across 6 material categories using Google's Teachable Machine.
Delivery apps made grocery and takeout ordering easier, but also increased how much packaging waste I had to sort, and figuring out what's actually recyclable isn't always obvious. The surge in packaging waste during the pandemic made this feel more urgent, which led me to explore whether machine learning could help distinguish recyclable materials from non-recyclable ones.
I used Teachable Machine to train a custom image classification model, then built a demo site with p5.js and ml5.js to run it live against a webcam feed.
Trained on 6 material categories: cardboard, glass, metal, paper, plastic, and trash, plus a 7th "turn on your camera" class (a blank screen) to stop the model from misreading no-signal as an object.
The "trash" category was hardest to predict; it visually overlaps with plastic and paper. Starting from defaults (50 epochs, batch size 16), I tested 20 combinations, tracking the loss-per-epoch curve each time, and landed on 65 epochs with a batch size of 512 for the most accurate results.
Exported the trained model and built a live webcam classifier, learning JavaScript and p5.js along the way through Coding Train tutorials.
Recorded a demo testing the model against real lighting and camera distance, and adjusted the setup (darker background) to reduce misclassification.

Initial run: 50 epochs, batch size 16

Final run: 65 epochs, batch size 512
The demo loads the exported model, classifies each webcam frame continuously, and displays the predicted label and confidence score on screen.