Class 8 · Unit 2: Building with no-code AI · Lesson 2.3 · 40 min
Building a classifier that works
Hiba holds a leaf up to the window. “Hazardous, 96%.” Twenty-eight photos, one desk, four minutes — the model learned the desk.
Today you will: Plan classes that don't overlap · Vary your photos on purpose · Test in a different place and light
Story
In Unit 1, Rahat's group trained a model in four minutes and it scored beautifully.
Then Hiba held up a leaf in front of the window, with the light behind it, and the model said hazardous with 96% confidence.
Rahat: “Ninety-six per cent! How can it be so sure and so wrong?”
Their teacher looks at the training photos: twenty-eight of them, all taken on the same desk, in the same light, at the same distance, within four minutes.
Teacher: “Your model didn't learn what a leaf is. It learned what your desk looks like.”
Today you build one properly. It takes longer, and it works.
Watch
What makes a good training set — — scan code 8.2.3 in the printed book.
Learn it
Rahat's model scored beautifully and then called a leaf hazardous with 96% confidence, because every training photo was taken on one desk, in one light, in four minutes. It learned the desk. A classifier that works is built with care: clear classes that don't overlap, enough varied examples of each, a test set held back before training, and training where the model will really be used.
Words to know
- Class one group the model chooses between. Classes must not overlap: if an item can honestly belong to two, fix the classes.
- Balanced about the same number of examples in each class: at least 30 each.
- Variety different objects, backgrounds, angles, distances and light in the training photos.
- Background class an extra class of empty desks, hands and walls, so the model does not force every picture into a real class.
- Test set examples chosen and put aside before training, never used to train.
- Confidence how strongly the model prefers one answer. It is not the same as being correct.
Step by step: planning a pen / pencil / eraser classifier
- Choose classes that don't overlap: pen, pencil, eraser. (Not "pen" and "blue things": a blue pen is both.)
- Decide the test set first: 5 items per class, set aside, never photographed for training.
- Plan variety: at least 3 different pens, 3 backgrounds (desk, notebook, floor), 2 kinds of light (window, tube light).
- Add a Background class: an empty desk, a hand, the wall.
- Photograph 30 per class where it will be used, turning and moving each object.
- Train, then test on the 15 held-back items, and then in a different part of the room.
Variety beats quantity. Ten bottles photographed in three places teach more than thirty photos of one bottle on one desk.
Careful: high confidence is not correctness. A model can be 96% sure and completely wrong, because confidence only says which answer it prefers, among the classes it knows.
On the laptop
You need: Teachable Machine (no account) · classifier-plan.ods · a webcam
Mission 1: Plan before you photograph (5 min, in groups of 3)
- ☐1
Choose three classes you can photograph here — pen / pencil / eraser, chinar leaf / willow leaf / paper, wet / dry / hazardous.
- ☐2
Could one item belong to two classes? Change your classes now. Where will the model be used? Photograph it there.
- ☐3
Plan 30 examples per class: at least 3 objects, 3 backgrounds, 2 kinds of light. Choose 5 test items per class to set aside.
Mission 2: Build it (15 min)
- ☐4
Four classes: your three, plus
Background(empty desk, a hand, the wall). - ☐5
Webcam → Hold to Record. Keep moving: turn it, bring it closer, change the background and the light. Photograph the test items separately.
- ☐6
Train Model, then test the 15 held-back items and record each result.
- ☐7
Predict: will it survive in a different part of the room? Try it.
⚠️ Objects only. No photographs of people.
No laptop today?
Design it on paper: three classes that don't overlap, 30 examples each, how you'd vary them, and which items you'd hold back. Then swap plans and try to break each other's: "All your photos are on a desk — what happens outdoors?"
Debate it
Your group's model works perfectly in the computer lab and fails in the school yard.
Nothing about the objects changed. What changed, and whose fault is the failure — the model's, or the people who chose its training photos?
Check yourself — practice, not a test
1. Which make a training set better? (choose all)
- ○ Photographs taken in different light
- ○ Several different objects in each class
- ○ Thirty photos of the same object from the same spot
- ○ About the same number of examples in each class
2. Testing a model on the same photos it trained on tells you how well it will work on new ones.
- ○ True
- ○ False
3. Adding a ______ class of empty desks and walls stops the model forcing every picture into a real class.
4. A model says hazardous with 96% confidence and is wrong. This shows that:
- ○ The model is broken and must be deleted
- ○ Confidence measures preference, not correctness
- ○ 96% is too low to trust
- ○ The test photo was invalid
5. A tool that trains a model from your examples without you writing any code is called a ______ platform.
6. Put the build in the right order:
- 1. Choose classes that do not overlap
- 2. Train the model
- 3. Photograph varied training examples
- 4. Test on the held-back items
- 5. Decide which items will be held back for testing
Remember
A model learns what your photos have in common. Make sure that is the thing you meant.
Typing practice
Skill: typing without looking, Term 1 (5 min)
- On typing.com, continue this term's lessons. Cover your hands with a sheet of paper if you find yourself looking down.
- Type your class plan headings for practice:
Class name, how many examples, where photographed, light, background - Target: 28–32 WPM at 93%+.