Students train a two-class picture model in the Pattern Trainer, test it on the board on photos it hasn't seen, read the starter's classify function, and run the same my_model.json in the Python starter on their own computer.
Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict 3 min · Train and try 12 min · Investigate 10 min · Run it in Python 15 min
The idea: a model is trained on examples in one place (the Pattern Trainer, a web page) and used in another (a Python app), and what travels between them is one small file of class names and numbers. This lesson does that path once, with two things from the student's desk, before any project.
Before class: the starters need installing once per computer (Python 3, then pip install -r requirements.txt, about 0.5 GB, no TensorFlow; setup). Do it before the lesson, or the last step becomes an install lesson. On a student laptop on the school network, check tools.learningwaypoints.com/trainer/ loads (about 35 MB the first time, for the trainer and again for the board) and the camera is allowed. Without a camera, students use Upload photos with photos they have.
Privacy: training happens in the browser and photos never leave the computer (the trainer's Privacy page shows how to check). The board keeps students' test photos in this browser only. my_model.json holds class names and numbers, no photos. Train on things, not people.
Where this sits: the first step of Pattern Detector projects, after Apps with Gradio. It needs Gradio apps, if/else and f-strings; the trainer does the training and pattern_model.py hides numpy. Machine learning with Gradio shows how a model works inside; either can come first.
Moving the downloaded file into the starters folder in place of the sample. Ask students to say out loud which folder the app reads from before they run it.
| What you will see | A question to ask | The fix |
|---|---|---|
| The board says the file is not a model file, or is a project file. | Did you click Download my_model.json (not Save project)? | Download the model and open my_model.json. |
| The board or the trainer says the picture model didn't load. | Can this computer open tools.learningwaypoints.com? | Ask for the site to be allowed on the school network, then reload. |
| The Python app still says Cat or Coffee. | Which my_model.json is in the starters folder? | Replace the sample with your download (same name, my_model.json), then run the app again. |
| ModuleNotFoundError: No module named 'mediapipe' (or gradio). | Is the starters' .venv switched on in this terminal? | Activate .venv (see the setup), or run pip install -r requirements.txt. |
Stretch: Add a third class, Neither, with photos of other things. Does the thing that was neither now get the right answer?
Support: Train in pairs on one laptop; skip the Python step and do it at the start of Brief B.
What is inside my_model.json, and why can the same file work in the trainer, on the board and in Python?
Class names and the trained numbers. Each side turns a picture into numbers the same way, then runs the same trained numbers on them.
Next: Brief B (a model you train) builds an app around this model; Brief A (rules you write) can come first. Real world: photo apps, recycling sorters and parcel scanners are a trained model inside an app.