Train a Waste Sorter

Train a webcam classifier to sort waste and test its limits.

Introduction

30 Second Summary

At UC Davis, a coffee cup or food wrapper can turn a quick stop at a campus waste station into a guessing game. The label may look clear, but the item does not always match it.

In this project, you will train a live waste sorter with Teachable Machine and your webcam. During your weekly Build & Brew session, you will use image classification to test how its predictions change as its training examples become more representative.

What You'll Build

You'll hold up an unseen item and watch your live webcam sorter choose Recycle, Landfill, or Not Waste.

By the end of this project, you'll have:

  • Demonstrated a live three-class sorter that predicts Recycle, Landfill, or Not Waste from a webcam view.
  • Run a repeatable challenge test with unseen objects, changed backgrounds, and partly hidden items.
  • Presented an evaluation scorecard with a downloaded model and a clear limitations statement.
  • Secret Mission: Add a Reusables class with books or school supplies without weakening the original three classes.

Are there any prerequisites?

Bring a Windows computer with Google Chrome, internet access, a webcam, and a Google account to your UC Davis Build & Brew session. Bring a few clean, dry household items that are safe to show on camera.

Before We Start

Before the hands-on work begins, your group needs a shared purpose for the waste sorter. This checkpoint captures what the webcam classifier will sort and why testing new examples reveals whether it can generalize.

Prepare the Waste Lab

Your group knows what the sorter must classify. You also know why testing with new examples matters.

A reliable first experiment needs controlled preparation before anyone collects training examples. The camera, samples, and group roles all shape whether later results are trustworthy.

Prepare the UC Davis Build Master

  • Ask the Build Master to complete this waste-sorter project once before the UC Davis session.
  • Confirm the image-classification workspace shows a live webcam preview on the room computer.
  • Place clean, dry sample items at each group table.

Build a Working Prototype Together and Document It

Build a working waste sorter as a group. Document the setup, decisions, and results so someone else can reproduce the experiment.

In this step, get ready to:
  • Reach the image-classification workspace with a live webcam preview.
  • Separate safe training samples from hidden test samples.
  • Organize the group around four roles plus a four-column results table.
Open the image-classification workspace

Teachable Machine runs image classification in your browser. Google Chrome connects the workspace to your webcam so you can collect examples later.

  • Press the Windows key to open the search bar.
  • Type Google Chrome and press Enter to open it.
  • Click the address bar at the top of Google Chrome.
  • Paste https://teachablemachine.withgoogle.com/ into the address bar.
  • Press Enter to load the Teachable Machine homepage.
  • Choose the image-classification path on the homepage.
  • Select the live-camera workflow in the image-classification workspace.
  • Select Allow this time if Chrome asks for camera permission.

Before you check the workspace, what should change when camera access is working?

  • Check the image-classification workspace for a live webcam preview.

You should see the webcam preview respond as the scene in front of the camera changes.

Can't See the Webcam Preview?

  • Click More in the top-right corner of Chrome.
  • Select Settings.
  • Select Privacy and security.
  • Select Site settings.
  • Select Camera.
  • Allow camera access for the Teachable Machine site.
  • Return to the workspace tab.
  • Reload the workspace page.

Help me restore the webcam preview.

Prepare safe classes and samples

Held-out testing uses items that the model does not see during training. Keeping those items hidden gives your later challenge tests a fair starting point.

Why These Two Categories?

For this demonstration, UC Davis guidance places clean plastic containers in recycling. It places chip bags plus food wrappers in landfill.

Treat Recycle and Landfill as demonstration labels based on that guidance. Follow current local guidance for real disposal decisions.

  • Inspect the empty plastic container to confirm it is clean and dry.
  • Reserve the plastic container as the initial Recycle training sample.
  • Inspect the wrapper to confirm it is clean and dry.
  • Reserve the wrapper as the initial Landfill training sample.
  • Choose a second clean recyclable item for later testing.
  • Choose a second clean landfill item for later testing.
  • Choose an ordinary non-waste object for later testing.
  • Place all three held-out items out of view of the person who captures the training examples.

That separation gives you two familiar training objects plus three unseen challenge inputs. Your model gets a fairer test because the hidden items stay outside its starter dataset.

Assign group roles

Clear roles stop image collection from blending into evaluation. The data checker also watches for a confounding background, such as one backdrop appearing only behind a single label.

What Does Each Role Protect?

  • The camera operator controls the webcam framing.
  • The item handler presents one item at a time.
  • The data checker stops a capture when a face enters the frame.
  • The data checker stops a capture when private information enters the frame.
  • The data checker flags clutter that could distract the model.
  • The data checker flags a background that appears with only one label.
  • The test recorder records the expected label plus the model's result.
  • Assign one group member as the camera operator.
  • Assign one group member as the item handler.
  • Assign one group member as the data checker.
  • Assign one group member as the test recorder.

The role list controls how the experiment runs. The results table gives every later test the same evidence format.

  • Ask the test recorder to choose a notebook page or shared document for the results table.
  • Add a column named input.
  • Add a column named expected label.
  • Add a column named top prediction.
  • Add a column named observation.

Before the final check, do you expect every part of the lab to be ready for image collection?

  • Switch back to the Teachable Machine workspace from earlier.
  • Move the clean plastic container slowly across the webcam view.
  • Confirm that the live preview updates as the container moves.
  • Check that all four role names are written down.
  • Check that the results table has all four columns.
  • Confirm that the three held-out items remain hidden from the training operator.

You're set. The live webcam preview responds in Google Chrome.

Your training samples, hidden test samples, assigned roles, and four-column results table are ready for the first controlled training run.

Your waste lab now has the controls needed for a fair first experiment. Next up, you will capture a deliberately narrow dataset and train the first two-class sorter.

Train the First Two-Class Sorter

Your Teachable Machine waste lab is ready for its first experiment. The group can now collect examples through the live webcam.

A narrow image classification dataset can produce a quick visible result. It can also encourage the model to associate one object or background with an entire category.

In this step, you will train a two-class model with one object per label. You will then test both familiar objects in the live preview.

In this step, get ready to:
  • Name the two classes Recycle and Landfill.
  • Capture narrow starter examples with consistent background and lighting.
  • Train the model for live predictions from both training objects.
Define the first two labels

A class is one category the model can choose. A label is the short name shown with that category's live prediction.

  • Find the first class-name field in the workspace.
  • Replace its current text with Recycle.
  • Find the second class-name field in the workspace.
  • Replace its current text with Landfill.
  • Confirm that both class headings show the new names.

You should see one class named Recycle and one class named Landfill.

Only See One Class?

  • Use the workspace control for adding another class.
  • Name the added class Landfill.

Help me create the two classes in my image-classification workspace.

Capture a narrow starter dataset

Training examples are the images that teach the model what belongs in each class. This first dataset uses one object for each class.

Held-out testing only works when test items stay outside the training set. All three held-out items remain outside the capture area.

The original background and lighting stay consistent so the model gets a deliberately narrow view. The data checker keeps faces and private information out of the frame.

  • Leave all three held-out items in the separate testing area.
  • Keep the original background and lighting in place.
  • Hold the empty plastic container in the webcam frame.
  • Capture a brief burst for Recycle while turning the container slightly.
  • Confirm that Recycle contains multiple image examples.
  • Swap the plastic container for the clean wrapper.
  • Capture a brief burst for Landfill while turning the wrapper slightly.
  • Confirm that Landfill contains multiple image examples.

Both classes should now show several captured images from slight rotations. That gives your first model its deliberately narrow view of the sorting task.

Why Keep the Dataset Narrow?

Every image in each class comes from one object in one scene. The model may therefore respond to details that are unique to that object.

A confounding background is a scene detail that repeatedly appears with one label. The model can use that detail as a shortcut.

This narrow dataset creates a clear baseline for later challenge tests. Those tests can reveal what the first model actually learned.

Train and preview the model

Training turns the captured examples into a model that can compare new webcam images with its two learned classes. The live preview shows which available class receives the top prediction.

  • Start the model's training process with the workspace's standard settings.
  • Wait for training to finish.
  • Return to the live webcam preview.

Before the test, predict which label should rank first for each familiar object.

  • Present the empty plastic container to the webcam.

You should see Recycle become the top live prediction.

  • Present the clean wrapper to the webcam.

You should see Landfill become the top live prediction.

  • Record one sentence beneath your results table describing the visual pattern or object and background association the model appears to use.

You now have a working two-class sorter. Its live output responds to both familiar training objects.

Predictions Not Matching the Training Objects?

  • Confirm that the plastic container images appear only in Recycle.
  • Confirm that the wrapper images appear only in Landfill.
  • Capture another brief burst for the weaker class under the original background.
  • Retrain the model with the standard settings.

Help me troubleshoot my two-class model.

  • Keep the current Teachable Machine tab open in Google Chrome.
  • Leave live webcam access active.

The first model is ready for a tougher test. Next, you will move beyond the familiar objects to measure how its narrow training shapes its answers.

Test the Model's Blind Spots

Your two-class Teachable Machine model recognizes both familiar training objects in the live preview. Those successful predictions only show how it behaves with objects from its narrow dataset.

The image classifier has only two class labels: Recycle and Landfill. This step asks what happens when neither label describes the scene.

In this step, get ready to:
  • Challenge the narrow model with an out-of-scope input.
  • Test held-out waste items for generalization.
  • Shift the scene to expose background sensitivity.
Test an out-of-scope input

An out-of-scope input belongs to neither class. The ordinary object held back earlier gives you a clean way to test that gap.

Before the object enters the frame, predict whether the model can leave both available labels unselected.

  • Remove the plastic container from the webcam frame.
  • Remove the wrapper from the webcam frame.
  • Place the held-out ordinary non-waste object in the webcam frame.
  • Hold the object steady until one class becomes the top prediction.
  • Record the object description in the input column.
  • Record that neither available label is valid in the expected label column.
  • Record the top prediction in the matching column.
  • Record the forced choice in the observation column.

You'll see either Recycle or Landfill become the top prediction. You have now exposed a blind spot that a familiar training object could never reveal.

Why must the model choose?

A closed-set classifier chooses among the labels available in its training dataset. The current model has no Not Waste class.

Its prediction reports the closest available visual pattern. The prediction does not prove that the ordinary object belongs in the chosen waste class.

🙋‍♀️ Prediction not settling?

  • Keep only the ordinary object inside the webcam frame.
  • Reduce movement until the top prediction becomes readable.
  • Confirm the live webcam preview remains active.

Help me diagnose an unstable Teachable Machine prediction.

Test truly unseen waste items

Held-out testing uses examples that never entered the training dataset. It tests generalization by checking whether the model recognizes new items from each intended class.

  • Keep the workspace's image-capture function inactive throughout both held-out tests.
  • Ask the test recorder to reveal the held-out recyclable item.
  • Record a short description of the item in the input column.
  • Enter Recycle in the expected label column.
  • Present the item to the live webcam preview.
  • Move the item slowly through several positions.
  • Record the top prediction.
  • Record any movement-related changes in the observation column.

That is your first true generalization check. The recyclable row now shows how a new item behaved without changing the training dataset.

  • Ask the test recorder to reveal the held-out landfill item.
  • Record a short description of the item in the input column.
  • Enter Landfill in the expected label column.
  • Present the item to the live webcam preview.
  • Move the item slowly through several positions.
  • Record the top prediction.
  • Record any movement-related changes in the observation column.

You now have evidence from both waste classes. Differences between the two rows show which class handles unseen objects more reliably.

Predictions changing too fast?

  • Hold the item still long enough to record one baseline prediction.
  • Move only the item during the movement check.
  • Treat repeated label changes as an unstable result.

Help me record an unstable held-out test clearly.

Shift the scene

A confounding background can become an accidental shortcut when one scene repeatedly appears in a class's training images. Changing the background reveals whether the prediction follows the item or its original surroundings.

This remains a preview-only test. No new images enter either training class.

Before you shift the scene, predict whether the same held-out item will keep its earlier top prediction against a different background.

  • Choose one held-out waste item from the previous test.
  • Add a new row for a changed-background trial.
  • Record the item's intended class in the expected label column.
  • Move the item to a visibly different background.
  • Present the item at approximately the same distance as before.
  • Observe the top prediction for several seconds.
  • Record the new top prediction.
  • Record whether the result stayed consistent or became unstable.

Your table should now contain four test notes: the out-of-scope object, the held-out recyclable, the held-out landfill item, and the changed-background trial. The out-of-scope row shows a forced Recycle or Landfill choice.

The remaining rows capture how the model handled unseen objects and a shifted scene. You now have concrete evidence of where the narrow dataset succeeds or falls short.

Comparison unclear?

  • Confirm the changed-scene row names the different background in the input column.
  • Compare its top prediction with the earlier row for the same item.
  • Record a stable result when the label does not change.

Help me interpret my changed-background test.

Your narrow model has revealed exactly where its dataset falls short. Next, you'll use this evidence to teach it about ordinary scenes while strengthening both waste classes.

Add Not Waste and Retrain

Your two-class image classifier exposed a clear gap. It had to call every scene Recycle or Landfill because those were its only choices.

An explicit negative class gives the model a valid answer for scenes outside the sorting task. In this step, you will build a broader three-class model in Teachable Machine.

In this step, get ready to:
  • Add a Not Waste class using empty scenes plus ordinary objects.
  • Expand Recycle plus Landfill with varied examples from additional clean items.
  • Retrain the model before comparing the repeated challenge tests with the two-class baseline.
Add the missing class

The Not Waste label gives empty scenes plus ordinary objects a suitable place in the model. This closes the missing-class gap from your earlier test.

  • Switch back to the Teachable Machine workspace from earlier.
  • Use the class-add control in the training area to create a third class.

You should see a new class beside the existing Recycle plus Landfill classes.

  • Name the new class Not Waste.

The workspace should now display all three class names.

  • Keep the held-out ordinary object from earlier outside the training dataset.
  • Ask the data checker to confirm that the webcam frame contains no faces or private information.

Your original test object remains unseen by the model. The webcam frame is also ready for safe data collection.

  • Capture empty-scene webcam examples for Not Waste across multiple backgrounds.
  • Capture several ordinary non-waste training objects in multiple positions across more than one background.

You should see Not Waste fill with varied examples of empty scenes plus ordinary objects.

Strengthen the waste classes

Generalization describes how well a model handles inputs it did not see during training. Variation across angle, distance, position, plus background reduces dependence on the original capture setup.

  • Keep the held-out recyclable plus landfill items from earlier outside the training dataset.
  • Set aside a new training pair containing one clean recyclable item plus one clean landfill item.

You now have new training objects while the original test samples remain unseen.

  • Capture varied webcam examples of the new recyclable item in Recycle.

The Recycle class should now contain more than one clean item across different angles, distances, positions, plus backgrounds.

  • Capture varied webcam examples of the new landfill item in Landfill.

The Landfill class should now contain more than one clean item across the same kinds of variation.

  • Compare the visible example totals across all three classes.
  • Add further captures to the smallest class until no class has only a tiny handful of examples.

You should see reasonably balanced class totals with broader visual coverage than the narrow starter dataset.

Retrain and rerun the same tests

Held-out testing gives you a fair before-and-after comparison. Reusing the earlier inputs shows whether the new dataset changed behavior beyond the training objects.

  • Start retraining from the workspace's training area using the standard settings.

When training finishes, you should see live outputs for Recycle, Landfill, plus Not Waste.

  • Add six blank rerun rows to the results table from earlier.
  • Assign the test recorder to use the existing input, expected label, top prediction, plus observation columns for every rerun.

Before you rerun the challenge, predict which input you expect to change most with Not Waste available.

  • Test an empty scene with the retrained model.
  • Test the held-out ordinary non-waste object from earlier.
  • Test the held-out recyclable item from earlier.
  • Test the held-out landfill item from earlier.
  • Test one held-out item against a changed background.
  • Test one held-out item under partial occlusion.

You should see Not Waste become the top prediction for at least one applicable empty-scene or ordinary-object test. The waste trials show whether the earlier labels still hold on unseen inputs.

  • Compare each new result with the corresponding two-class notes from earlier.

That is a meaningful upgrade. Your results table now shows how the three-class model behaved across all six challenge cases.

Not seeing the expected improvement?

  • Add more varied examples to Not Waste if empty scenes or ordinary objects still receive a waste label.
  • Review the class totals if one label dominates most live predictions.
  • Capture targeted examples for the confusing classes before retraining once more.

Help me diagnose my three-class model results.

Your three-class sorter is ready for a formal challenge. Next up, you will turn these reruns into a five-trial scorecard with an honest limitations statement.

Evaluate and Export the Sorter

Your retrained Teachable Machine image classifier can now choose Recycle, Landfill, or Not Waste. The next goal is to prove how it behaves beyond its training examples.

A final demonstration needs evidence from held-out testing. It also needs an honest boundary statement before anyone uses a prediction as disposal guidance.

In this step, get ready to:
  • Complete a five-trial scorecard using unseen inputs and challenging scenes.
  • Write a conclusion that explains the improvement and the model's limitations.
  • Preserve the trained model alongside its scorecard.
Run a five-trial scorecard

Held-out testing measures generalization with examples that were not part of the training data. These five trials also expose sensitivity to backgrounds and partial visibility.

  • Return to the results table from earlier.
  • Add a section named Five-trial scorecard.
  • Record the input, expected label, and top prediction after each trial.
  • Classify each observation as correct, incorrect, or unstable.

How Do You Score a Trial?

  • A correct result gives the expected class as the top prediction.
  • An incorrect result gives a different class as the top prediction.
  • An unstable result changes repeatedly while the same item remains in view.
  • Present an unseen recyclable that was never added to training.
  • Present an unseen landfill item that was never added to training.
  • Present an ordinary Not Waste object that was never added to training.
  • Present one held-out waste item against a changed background.
  • Present one held-out item while partly covering it.

That is your evidence collected: the scorecard now contains five completed rows covering new objects and harder viewing conditions.

Write an honest conclusion

A useful evaluation explains which data change improved the sorter most. It also draws a clear boundary around decisions the prototype cannot make safely.

  • Review the three-class comparison notes from earlier.
  • Choose the data change that improved the model most.
  • Write sentence one naming that data improvement.
  • Write sentence two stating that because the prototype recognizes visual patterns from examples, it must not replace current local waste guidance for ambiguous, hazardous, dirty, or region-specific items.
  • Keep the two-sentence conclusion with the completed scorecard.

Your conclusion now names the strongest data improvement. It also sets a clear safety boundary for the sorter.

Preserve the result

A local model export lets the group return to the trained sorter for another demonstration. Keeping it with the scorecard preserves the evidence behind the model.

  • Use the model export area in the Teachable Machine workspace from earlier to choose a local download.
  • Save a digital copy or clear photo of the completed scorecard in the same local folder as the downloaded model.

Before you check, what two pieces of evidence should prove that the sorter is ready for another group member to demonstrate?

  • Confirm Google Chrome shows the model export as completed.
  • Confirm the scorecard contains rows for an unseen recyclable, unseen landfill item, Not Waste object, changed-background item, and partly occluded item.
  • Confirm every row includes the input, expected label, top prediction, and observation.

You'll see a completed model download in Chrome. Your scorecard will show five filled rows with each result marked as correct, incorrect, or unstable.

Download Not Completing?

  • Keep the Teachable Machine workspace open while you retry the local export.
  • Check your internet connection if the download stalls.
  • Look for a blocked-download notice in Chrome if no local file arrives.

Help me finish the Teachable Machine model download.

That is a strong finish: your three-class sorter now comes with test evidence, a safety boundary, and a local export.

Secret mission

Add a Reusables Route

Your three-class sorter has a new challenge: recognize clean books plus school or office supplies as Reusables. Expand the dataset. Then regression-test the original classes after retraining.

Clean Up Your Resources

Clean Up Your Resources

This project creates no paid cloud resources or ongoing cloud costs. Decide whether to keep your resources running, pause them to come back later, or delete them entirely.

Resources you used:

  • An open Teachable Machine workspace containing a four-class image classification model with Recycle, Landfill, Not Waste, and Reusables classes.
  • A live webcam preview with camera access granted through Google Chrome.
  • A downloaded three-class model stored with the completed five-trial scorecard.
  • Written records covering the model limitations, comparison tests, Reusables test, and original-class regression tests.

Keep everything running

No action needed. Choose this if you are still testing the four-class waste sorter.

  • Continue using the current Teachable Machine tab to keep the live four-class session available.
  • Keep the existing camera permission while you continue training or testing.
  • Keep the downloaded three-class model with the scorecard and supporting notes.

The webcam remains active while the workspace uses it. There are no cloud resources generating ongoing costs.

Pause - I'll come back to this later

Shut down the active webcam session while keeping your downloaded model and evaluation records for later.

  • Close the current Teachable Machine tab in Google Chrome.
  • Keep the saved camera permission in place for your next visit.
  • Leave the downloaded three-class model with the completed scorecard and supporting notes.

That safely pauses your live session. Your downloaded model and evaluation records remain ready for another demonstration.

Delete - I don't want to use this again

Remove the browser session, saved camera access, downloaded model, and written records.

Deleting these artifacts becomes final after you empty the system's deleted-items folder. Your household sample items stay untouched.

  • Close the current Teachable Machine tab in Google Chrome.
  • Select More in Google Chrome.
  • Select Settings.
  • Select Privacy and security.
  • Select Site settings.
  • Select Camera.
  • Select the Teachable Machine site entry.
  • Set its camera access to Never allow.

That closes the privacy loop. Google Chrome no longer grants the site camera access.

  • Use Windows search to open the file browser.
  • Navigate to the location where the downloaded three-class model is stored with the completed scorecard.
  • Select the downloaded three-class model.
  • Select the scorecard, limitations statement, Reusables and regression notes, three-class comparison notes, two-class limitation notes, and training observation.
  • Press Delete to move the selected artifacts to the system's deleted-items folder.
  • Open the system's deleted-items folder.
  • Empty that folder to permanently delete the selected project artifacts.

Cleanup complete. The active webcam session is closed.

Teachable Machine no longer has saved camera access. Your local project artifacts are deleted.

Nice Work!

Nice Work!

You pulled it off. Your group trained and tested a live four-class waste sorter with Teachable Machine that can classify webcam examples as Recycle, Landfill, Not Waste, or Reusables.

What you learned:

  • Built a live three-class waste sorter that labels webcam inputs as Recycle, Landfill, or Not Waste.
  • Exposed the model's closed-set limitation by testing an ordinary object that did not match either available class.
  • Created an evaluation record with held-out tests, background changes, partial occlusion, a five-trial scorecard, a limitations statement, and a downloaded model.
  • Completed the Secret Mission by adding a Reusables class with varied examples. Regression-tested Recycle, Landfill, and Not Waste after retraining.

Ready to quiz yourself?