L02 | English F3 Student Learning Log

Persona: I'm a Form 3 (Grade 9) student and I only read English. I know basic Python (variables, for loops, lists) and school algebra up to quadratics. I learn from the official pages, the videos with captions, and the book. Kaggle notebook steps are written as a practice log that follows the official notebooks.

What I understood (in my own words)

  • Training a model is only half the job. Deployment lets other people actually use it.
  • Hugging Face Spaces is free web hosting for ML apps, and Gradio builds the upload button and results display for me.
  • A confusion matrix is a table: the diagonal is correct answers, everything off the diagonal shows which classes get mixed up.
  • Data augmentation randomly crops, flips and rotates the same image so the model sees 'new' pictures.
  • A trained model can be saved as a .pkl file and loaded on another computer.

Where I got stuck, and how I got unstuck

Where I got stuckHow I solved it
I had never used git commands like clone and pushI followed the Gradio tutorial linked on the page and used GitHub Desktop at first, so I didn't mistype commands.
My app crashed saying it couldn't find model.pklThe file was in a subfolder. It had to sit in the top level of the Space folder, next to app.py.
I didn't get why squish could be better than cropI compared both: crop cut off the bear's head, squish stretched it a bit but kept the whole bear.

My answers to the exercises

Q1. Why does the course suggest training a model before cleaning the data? How is this different from what most people expect?

Checking hundreds of images by hand is slow. After training, the model can show you the images it was least sure about or got most wrong, so you only check those few. Most people think you must clean data first, but training first finds the problems faster.

Q2. What is data augmentation? Why do you need more epochs when you use it?

Data augmentation applies random changes (crop, flip, rotate, brightness) so each image looks a bit different every time. Because the model sees a different version each epoch, it needs more epochs to learn from all that variety.

Q3. A bear classifier's confusion matrix: of 50 real grizzlies, 45 correct and 5 predicted black; of 48 real black bears, 46 correct and 2 predicted grizzly; teddies all correct. What is the model's main weakness?

Its main weakness is confusing grizzly and black bears, especially predicting grizzlies as black bears (5) more than the reverse (2). Teddies are fine. Some grizzly photos may be dark. I'd use plot_top_losses to look at those images.

Q4. List the main steps (at least five) to deploy a model to Hugging Face Spaces.

  1. Train on Kaggle and run learn.export to save model.pkl. 2) Download model.pkl. 3) Create a new Gradio Space at huggingface.co/spaces. 4) git clone the Space folder. 5) Write app.py: load_learner, a predict function, and gr.Interface. 6) Add app.py, model.pkl and requirements.txt. 7) git push and wait for the app to build.

Q5. Design your own deployment project: what does it classify, who would use it, and what are the Gradio inputs and outputs?

A 'which recycling bin?' classifier for my school canteen. Users: students throwing rubbish away. Input: a photo of the item. Output: probabilities for paper, plastic, metal and general waste.

My Zettelkasten card

Card|A model isn't finished until someone else can use it

Getting a model accurate is only half the work. Deployment turns it into something useful. What surprised me most in this lesson is that a few dozen lines of code turned my model into a link I could send to anyone.

Most of my school computing projects lived in my own folder and nobody looked at them after I handed them in. This time I put my recycling-bin classifier on Hugging Face Spaces and shared it with my class. Within a day, friends found that it called crushed cans 'general waste'. Real users showed me my data had almost no crushed cans. Deployment does take effort, though: git, file paths and package versions took me longer than training did.

Next step this week: collect 40 photos of crushed cans, retrain, update the Space, and ask three classmates to test it again.

🔗 Related notes to grow next: → Projects: 'Feedback from real users beats testing alone' → Tools: 'Version control lets you change code without fear' → Data: 'Rare classes need more examples or the model ignores them'


Back to lesson note:L02_模型部署_202611041526

Built with LogoFlowershow