AI Lab 01: Teachable Machine Image Recognition & Data Size Experiment
- Estimated Time: 5 hours
- Tools Required: Google Teachable Machine (Completely free, no registration required, no-code)
- Hardware Required: A computer with a webcam (or smartphone camera). If no camera is available, students can upload images downloaded beforehand.
Lab Objectives
- Learn how to define "Classes" in machine learning.
- Personally collect data, train a model, and conduct real-time testing (Inference).
- Core Task: Observe and record the direct impact of data volume and data diversity on classification accuracy by comparing two different data scales (20 images vs. 200 images).
5-Hour Schedule & Step-by-Step Breakdown
Phase 1: Preparation & Topic Selection (0.5 Hour)
Phase 1: Preparation & Topic Selection (0.5 Hour)
- Open your browser and navigate to the Teachable Machine website, then click Get Started.
- Select Image Project → Standard image model.
- Choose your project topic (Pick one):
- Topic A (Mask vs. No Mask): Ideal for students with a webcam (you can act as your own model).
- Topic B (Cat vs. Dog): Ideal for students without a webcam (requires downloading about 150–200 images of cats and dogs each beforehand).
Phase 2: Controlled Variable Experiment — Small Data vs. Large Data (3 Hours)
Phase 2: Controlled Variable Experiment — Small Data vs. Large Data (3 Hours)
This phase is the core of this practical work. You will build and test two models with vastly different data scales.
Experiment 1: The Blind Spots of Extremely Small Data (1 Hour)
- Configure Classes: Rename Class 1 to Mask (or Cat) and Class 2 to No_Mask (or Dog).
- Collect Minimal Data:
- Use your webcam or upload images so that each class has exactly 15–20 images.
- Strict Constraint: When capturing these 15–20 photos, keep your posture, background, and lighting completely identical (e.g., keep your face completely still, only putting on and taking off the mask).
- Train the Model: Click Train Model (Keep the default Epochs = 50; do not alter advanced settings).
- Stress Testing & Recording:
- Observe the real-time test using the Preview panel on the right.
- Test 1: Keep the exact same angle as you did during training. Is it accurate? (It usually performs exceptionally well, reaching 90–100%).
- Test 2 (Destructive Testing): Turn your face 45 degrees to the left, take a step back, or cover part of your chin with your hand. Observe if the recognition accuracy instantly collapses.
- Take photos or screenshots to document this breakdown. This phenomenon is called "Overfitting".
Experiment 2: The Power of Large Data & Diversity (2 Hours)
- Reset or Accumulate Data: Clear the previous data or continue adding images to your existing classes.
- Collect Large & Diverse Data:
- Increase the number of images per class to 150–200 images.
- The Core Key (Diversity): Intentionally alter variables while capturing photos:
- Angles: Turn, tilt up, tilt down, and show your profile.
- Distance: Move closer to the camera, move further away.
- Lighting: Turn the lights on, turn them off, or use a phone flashlight to cast a side-light on your face.
- Distractions: Wear glasses, take off glasses, or push your hair around.
- (For the Cat vs. Dog topic, ensure the downloaded images include different breeds, fur patterns, front views, side views, or cats/dogs lying down and running).
- Retrain: Click Train Model.
- Repeat Stress Testing:
- Replicate the previous actions: turning your head, stepping back, and changing the lighting.
- Observe whether the classification output remains stable this time.
Phase 3: Writing the AI Lab Journal (1.5 Hours)
Phase 3: Writing the "AI Lab Journal" (1.5 Hours)
Complete an "AI Lab Journal" in a Word file. This will serve as the tangible proof of your 10-hour weekly course workload. The journal must follow the structure below:
AI Lab Journal Report
AI Lab Journal: Teachable Machine Image Recognition Report
1. Lab Setup
- Chosen Topic: [e.g., Mask vs. No Mask]
- Class 1 Name & Definition:
- Class 2 Name & Definition:
2. Data Size Comparison Table
| Experimental Phase | Class 1 Data Size (Images) | Class 2 Data Size (Images) | Description of Feature Diversity |
|---|---|---|---|
| Experiment 1 (Small Data) | 15 images | 15 images | Single front face angle, fixed lighting, clean background. |
| Experiment 2 (Large Data) | 180 images | 180 images | Includes left/right profiles, distances, glasses, side flashlight, etc. |
3. Test Results & Screenshot Evidence
- Small Data Model Performance: (Use about 100 words to describe what errors occurred when you turned your head or changed the lighting.)
- [Insert a screenshot of the Preview panel showing the model's incorrect recognition/collapse here]
- Large Data Model Performance: (Use about 100 words to describe how the model's performance improved after the data volume increased and diversified.)
- [Insert a screenshot of the Preview panel showing the model correctly recognizing under difficult conditions here]
4. Core Reflections
- Question 1: In Experiment 1, why did the model fail when you changed angles, even though it originally showed 100% accuracy? What does this signify in Machine Learning?
- Question 2: If we want to commercialize this mask recognition model and install it at turnstiles across subway stations, do you think the current 200-image large data model is sufficient? What kind of "real-world" data would we still need to collect?
🎯 Pro-Tips for Students (How to Avoid Common Pitfalls)
- Background Bias (Data Contamination): If you take photos for Mask in your bedroom (with a bed in the background) and for No_Mask in the living room (with a TV in the background), the AI might end up learning to recognize the bed and the TV rather than the mask. Keep the background consistent, or make sure both classes are shot against the same background!
- Do Not Switch Tabs While Training: After clicking "Train Model," keep that browser tab active. Switching to other tabs can cause the browser to throttle memory and CPU allocation, which will interrupt and crash your training process.