Setup
Keep your Colab notebook tab open all session. Open in a new tab — don’t use the buttons in this page to leave the course.
your own copy of the starter notebook in Google Colab, running on a GPU
what Colab is and how a notebook runs code one cell at a time
a notebook that prints Hello and is ready for Stage 1
Before students touch their laptops, show the room on the projector:
- Click the Open in Colab button. Show that it opens the starter notebook.
- Do File → Save a copy in Drive so everyone has their own copy to edit.
- Set Runtime → Change runtime type → GPU, then run the
printcell with Shift + Enter. - Make the point: a notebook is a stack of cells we run top to bottom, and the work lives in Google Drive — closing the tab doesn't lose it.
The big idea
Google Colab is a free coding notebook that runs in your browser. You write Python in little boxes called cells and run them one at a time. Colab does the heavy lifting on Google's computers — including a GPU, a chip that trains AI models fast — so your laptop doesn't have to.
This course is a first machine-learning path through one project: an image classifier. You will use Python tools to inspect image data, prepare it, build a model, train it, grade it honestly, study mistakes, improve the experiment, and explain the evidence.
A notebook is not one long program. It's a stack of cells, and you run them top to bottom. A cell can use a variable made in an earlier cell, which is powerful — but it also means that if the notebook disconnects (which happens), those variables disappear and you have to run the earlier cells again.
- 1Photos / CIFAR-10labeled image examplesStage 1
- 2Notebook variablesx_train, y_train, class_namesSetup-2
- 3Prepared datanormalized pixels and fair pilesStage 3
- 4Keras modelCNN layers and summaryStage 4
- 5Training historyepochs, loss, accuracyStage 5
- 6Test evidencesealed score and mistakesStages 6-7
- 7Improved modelaugmentation comparisonStage 8
- 8Inferenceuploaded image to top-3 guessesStage 9
- 9Demo evidencetable, confidence, limitationStage 10
Setup creates the workspace that holds the whole workflow. Every later stage adds one more notebook result: data, prepared arrays, model, training history, test evidence, predictions, and final demo.
┌─────────────────────────────┐
│ cell 1 load the data │ ← run this first
├─────────────────────────────┤
│ cell 2 build the model │ ← then this
├─────────────────────────────┤
│ cell 3 train the model │ ← then this
└─────────────────────────────┘
run top → bottom, every time
- Colab
- a free notebook in your browser where you write and run Python
- cell
- one box in the notebook that holds code you can run
- runtime
- the computer Colab gives you to run your code
- GPU
- a chip that trains AI models much faster than a normal one
Build it
Step 1 — Open the starter notebook
Click the Open in Colab button at the top of this page. A notebook called image-lab-starter opens. It already has a section for every stage of the week.
Step 2 — Save your own copy
Right now you're looking at a read-only copy. Make it yours: click File → Save a copy in Drive.
A new tab opens titled Copy of image-lab-starter. This is the one you edit all week. Rename it to something you'll recognize, like YourName_PythonML, by clicking the title at the top.
From now on, the Open in Colab button is only for getting a fresh copy. Your saved copy lives in your Google Drive — find it again at drive.google.com.
Step 3 — Turn on the GPU
Click Runtime → Change runtime type. Choose GPU, then Save.
Training without a GPU still works — it's just slower. Turning it on now means Stage 4 finishes in a couple of minutes instead of ten.
Step 4 — Run your first cell
Find the first empty code cell and type:
print("Hello! My Python machine learning notebook is ready.")
Run it by clicking the ▶ button on the left of the cell, or by pressing Shift + Enter. The first run takes a few seconds while Colab wakes up the runtime. You should see your message appear right below the cell.
Test your setup
- You have your own copy of the notebook (the title says
Copy of…or your new name, not justimage-lab-starter). - The runtime type is set to GPU.
- Your
printcell ran and showed your message below it. - You can find your saved notebook again in Google Drive.
- Workflow check. Point to the workflow map and explain why Colab is the workspace for the whole course.
- Design check. Tell a neighbor the difference between a text cell, a code cell, and an output. If you can explain all three, you understand the tool.
If it breaks
- The Open in Colab button shows a 404 or "not found." The starter notebook may not be published yet — ask your coach for the shared notebook link instead, then do File → Save a copy in Drive.
- It asks me to sign in. Colab needs a Google account. Use the one your camp gave you, or your own.
- My cell shows a red error. Read the last line of the error first — it usually names the problem. For Setup, the most common cause is a typo in
print. - "Cannot connect to GPU backend." Free GPUs are sometimes busy. Switch Runtime type back to CPU for now; everything still works, just slower. Try the GPU again later.
- My notebook says "disconnected." Colab disconnects if you leave it idle. Click Reconnect, then Runtime → Run all to re-run your cells.
The single biggest time sink here is students editing the read-only starter instead of their own copy — their work vanishes when they reload. Walk the room after Step 2 and confirm every title reads Copy of….
If your camp pre-creates Google accounts, hand out the credentials before opening Colab; signing in eats 5–10 minutes otherwise. GPU backends can be unavailable at peak times — it's fine to run the whole course on CPU at this dataset size if you have to; only Stage 4 feels the difference.