Train an image model in Teachable Machine, then test it on photos it has never seen. It works on photos like its training photos and fails on others, so to fix a model you change its data.
Recycling centres use cameras and trained models to sort paper from plastic on a fast conveyor belt. Before a centre trusts one, someone has to test it on items it has never seen.
A recycling centre wants a camera that sorts Paper from Plastic. You will train a model in Teachable Machine, then test it on the board's photos: paper and plastic items your model has never seen, in different places and light.
To train a model: open Teachable Machine in a new tab and choose Image Project, then Standard. Name one class Paper and one Plastic, add about 20 photos of each, and click Train Model. Then click Export Model, choose Upload my model, and copy the link it gives you into the board.
No webcam, or no paper and plastic on your desk? Download photos to upload instead (in each class, choose Upload and select every photo in its folder): plain photos and varied photos.
Make your prediction first. Help opens once you've locked it in.
Train Paper and Plastic with about 20 photos each, all on the same plain desk (or upload the plain photos). Paste your link and click Load. Compare the plain background and messy bench scores.
Train two classes (Paper and Plastic) on one plain background, paste your link and test it.
Use the board. This ticks when you get there.
Accuracy is the number correct divided by the number tested. A score for each group of test photos (plain, messy, low light) shows where a model fails, not just how often.
To find what is wrong, look at the ✗ photos and ask what they have in common that is not the item: the background, the light, the angle. Then compare that with the training photos.
| Step | What to write | Why |
|---|---|---|
| 1 | overall = 23 ÷ 32 = 72% | Accuracy is correct ÷ total |
| 2 | plain 8/8, messy 4/8, low light 5/8, neither 0/8 | Groups show where it fails |
| 3 | The messy failures all have a cluttered background | Look for what the failures share |
| 4 | The training photos were all on one plain desk | The model can't tell item from background |
| 5 | Fix: add training photos on cluttered backgrounds | Change the data, not the settings |
Same model, different results: it fails only in low light. Work through steps 3 to 5 for it.
A model gets 23 of 32 test photos right. What is its accuracy, as a percentage (to the nearest whole number)?
Retrain your model with photos of the items on at least three different backgrounds (or upload the varied photos). Export, paste the new link and Load.
Look at the not paper or plastic group: the model gives a can or a jar a label anyway, often with high confidence. A model always picks one of its classes. Add a third class called Neither with photos of other things (cans, glass, fruit), retrain and test again.
Retrain with photos on at least three different backgrounds. Get the messy bench to 75% or more.
Use the board. This ticks when you get there.
The model labels a can or a bottle of glass as paper or plastic. Add a Neither class and get the 'not paper or plastic' group to 75% or more.
Use the board. This ticks when you get there.
Use what you found: varied backgrounds and light, balanced classes, and a Neither class. Then ask a classmate to bring three items your model has never seen. Does it still work?
Build a sorter that gets 80% or more overall and 75% or more in low light.
Use the board. This ticks when you get there.
Write one or two sentences: which items or conditions your sorter would still get wrong, and what a real recycling centre would need to test before trusting it.
Revision summary
Students train a Paper/Plastic image model in Teachable Machine, test it on photos it has never seen, and fix it by changing the training data. About 50 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
The idea: a model learns only from the examples it is given. It works on new inputs that look like its training photos and fails on ones that don't. The fix is always in the data, not the settings.
How it works: students train in Teachable Machine (Google's free site, no account needed to train), export with Upload my model, and paste the link into the board. The board tests the model on 40 fixed photos it has never seen, in five groups: plain background, messy bench, low light, crumpled or at odd angles, and things that are neither paper nor plastic. Checks tick on the board's scores, not on the training.
Before class: on a student laptop on the school network, open Teachable Machine, train a tiny model, export it with Upload, and paste the link into the board. Bring a box of clean paper and plastic (and a few cans, jars or fruit) so every desk has variety.
Privacy: training happens in the browser and photos are not uploaded. Upload my model puts the trained model (not the photos) online, and anyone with the link can use it. Train on objects, not faces.
No webcam? The lesson links two folders of photos to upload instead: plain (30 per class on a white board: trains the biased model) and varied (messy benches, low light, odd angles and a Neither class: trains a good one). The photos come from TrashNet (MIT licence); the messy benches and low light are made from them.
The test photos are similar in style to the downloadable ones, so a model trained only on the varied folder can do well without the webcam. That is fine: the point is what changes the scores.
Accepting that a model trained on one desk fails on a messy bench. Ask what the test photos have that the training photos don't, before adding more data.
Stretch: Add a fourth class (Cardboard or Glass). Which pairs of classes does the model mix up most, and why?
Support: Use the downloaded photos instead of the webcam: plain first (the biased model), then varied.
Next: send the model's labels to a micro:bit that sorts with a servo flap.
Real world: automated recycling sorters, and any camera system tested on people or places it wasn't trained on (who might it fail for?).