Full lesson previewTeach a Machine: Train an Image Classifier on Household Objects
STEAM48 minutesGrades: 9th
Overview
Train a webcam AI, break it, then fix it with better data.
Description
Your teen uses a free browser tool such as Google's Teachable Machine to train an image model that tells a mug, a banana and a stuffed animal apart, using about 30 webcam photos of each. They then try to fool it with new angles, dim light and look-alike objects, log every failure on a test sheet, and retrain with better examples to see the accuracy change.
Objective
Your teen will train a simple image classifier, test it systematically with hard cases, and explain how the amount and variety of training data affect a model's mistakes.
Materials
| Item | Quantity |
|---|
| Laptop or computer with a webcam and internet access | 1 |
| Household objects to classify: a mug, a banana and a stuffed animal (or any 3 objects) | 3 |
| Look-alike 'trick' objects, such as a yellow sponge, a cup and a toy of another shape | 3 |
| Lamp or flashlight for lighting tests | 1 |
| Printed or hand-drawn test log sheet (see Additional Sections) | 1 |
| Pencil | 1 |
Vocabulary
Training data
The labeled examples a model learns from, such as 30 photos tagged 'mug'.
Classifier
A model that sorts a new input into one of several categories it was trained on.
Confidence score
The percentage a model gives for how strongly a new input matches each category; high confidence does not guarantee a correct answer.
Data bias
A pattern in the training data, such as every banana photo being taken in bright light, that makes the model fail on cases it rarely saw.
Preparation
- Open teachablemachine.withgoogle.com (or a similar free image-training tool), choose an Image Project, and allow webcam access.
- Copy the Test Log grid from Additional Sections onto the 1 test log sheet.
- Set the 3 household objects and the 3 trick objects on the table.
Introduction
Hold the banana up to the webcam and ask: a toddler learns 'banana' after seeing a few. How many photos do you think a computer needs, and what could make it mix a banana up with something else?
If every mug photo shows the mug on a white table, what might the model actually learn?
Where have you seen an app recognize faces, plants or objects, and has it ever been wrong?
Steps
1Step 1
Collect training photos
(12 min) Your teen creates three classes named Mug, Banana and Plush, then holds each of the 3 household objects up to the laptop webcam and records about 30 photos per class. For this first round they keep the same angle and the same lighting on purpose, so you can see later what thin data does.
2Step 2
Train and do a quick check
(6 min) Your teen clicks Train Model and waits for it to finish, then holds each of the 3 objects up in the preview and writes the confidence scores in rows 1 to 3 of the test log sheet with the pencil. Ask them to predict, in one sentence, which kind of test will fool it first.
3Step 3
Run the hard tests
(12 min) Your teen tests the model on 6 hard cases: each object upside down, each object held far from the camera, the room dimmed with only the lamp on, and the 3 trick objects. For each test they record the model's top guess, its confidence and whether it was right on the test log sheet.
4Step 4
Fix the data and retrain
(12 min) Your teen looks at the failures and adds about 15 new photos to each class that cover what was missing, such as new angles, the lamp lighting and a busy background. They add a fourth class called Nothing with photos of the empty table, retrain, and rerun the same hard tests in a new column of the test log sheet.
5Step 5
Explain what changed
(6 min) Using the before-and-after columns on the test log sheet, your teen tells you which fixes improved accuracy and which failures remain. They finish by writing two sentences with the pencil on the bottom of the sheet: one about how this model was biased and one about how a real company's face or object model could be biased the same way.
Conclusion
Ask your teen: 'If a hospital trained a skin-photo model mostly on one kind of camera or one group of patients, what would you test before trusting it?' The answer is the same thing they did today: test the hard cases and fix the data.
Make your own lesson plan in minutes
Describe a topic and Resource Portal AI writes the objectives, materials and steps for your group.
Try Resource Portal AI