Train Your First AI with Teachable Machine
Train a real-time image classifier in your browser with zero code.
Introduction
30 Second Summary
You have probably used AI that can recognize faces, translate languages, or identify songs. But have you ever wondered how it actually learns to do these things?
In this project, you will train your own AI image classifier using Google Teachable Machine. You will feed it examples, watch it learn in seconds, break it on purpose to see its limits, then improve it and share it via a link.
What You'll Build
Hold up an object to your webcam and watch your AI correctly identify it in real time, then send a link to a friend so they can test it in their own browser.
By the end of this project, you'll have:
- A working image classifier that recognizes objects you hold up to your webcam with high confidence in real time.
- Firsthand experience of the core machine learning loop: gather examples, train a model, test it, and improve it.
- A shareable link where anyone can visit and test your AI using their own webcam.
- Secret Mission: Train your AI to recognize sounds instead of images, proving the same workflow applies to any type of data.
Are there any prerequisites?
None. All you need is a computer with a web browser (Chrome or Safari recommended). No accounts, no installs, and no coding required.
Before We Start
Before we dive in, let's lock in what you're about to build and why it matters to you.
You're going to train a custom AI that recognizes objects you choose. Deciding what to teach it now gives your project a personal goal to aim for.
Open Teachable Machine
You've decided what you want to teach your AI. Now you need a place to actually build it.
Google's Teachable Machine is a free, browser-based tool that lets you train a machine learning model without writing code or creating an account. It runs entirely in your browser, so you can start training immediately.
In this step, get ready to:
- Navigate to Teachable Machine in your browser.
- Create a new Standard Image Project.
Navigate to Teachable Machine
- In your browser, type teachablemachine.withgoogle.com into the address bar and press Enter.
You should see the Teachable Machine landing page with a large Get Started button.
What is Teachable Machine?
Teachable Machine is a tool built by Google that lets anyone train an AI model by showing it examples. No coding, no installs, no sign-ups.
Your webcam data stays on your computer. Nothing is sent to a server unless you choose to export your model later.
Page not loading?
Teachable Machine works best in Chrome or Safari. If the page won't load or looks broken, try switching to one of those browsers.
help me troubleshoot why Teachable Machine won't load in my browser
Create a new Image Project
Teachable Machine supports three types of projects: Image, Audio, and Pose. You want an Image Project so your AI can learn to recognize objects through your webcam or uploaded photos.
- Click Get Started on the landing page.
- Select Image Project from the three project type options.
- Choose Standard image model when prompted.
You should now see the project workspace. On the left, there are two empty classes labeled Class 1 and Class 2. In the center, you see a Train Model button. On the right, there is a Preview panel.
What am I looking at?
This workspace is where you will build your entire AI. The classes on the left are categories your AI will learn to distinguish. The Train Model button kicks off the learning process once you add examples. The Preview panel is where you test your AI after training.
Your workspace is ready. Next up, you'll feed your AI its first examples and watch it learn the difference between your two objects in real time.
Train Your AI to Recognize Two Objects
Your workspace is set up and ready to go. Now comes the exciting part: teaching your AI to recognize real objects.
This is the core of how all machine learning works. You show the AI examples of something, and it finds the patterns that make that thing unique.
In this step, get ready to:
- Rename your classes to match two objects you choose.
- Record at least 30 image samples per class using your webcam or file uploads.
- Train your model and watch it make real-time predictions.
Pick your objects and rename the classes
Your AI needs to learn the difference between two things. Pick two objects that look clearly different from each other so your AI has an easier time telling them apart.
- Grab two objects from your desk that look different from each other (e.g., a pen and a phone, or a coffee mug and a water bottle).
- In your Teachable Machine workspace, click the pencil icon next to Class 1 on the left side.
- Type the name of your first object (e.g., "Pen") and press Enter.
- Click the pencil icon next to Class 2 and type the name of your second object (e.g., "Phone").
You should now see your two custom class names displayed on the left side of the workspace instead of the default "Class 1" and "Class 2" labels.
What are classes?
In machine learning, a class is a category that the AI learns to recognize. Each class represents one type of thing. Right now you have two classes, so your AI will learn to sort everything it sees into one of those two buckets.
Record training samples for your first class
Now you will feed your AI examples of each object. The AI studies these examples to find patterns. This collection of examples is called training data.
- Click Webcam under your first class name.
- Hold up your first object to the camera so it fills most of the frame.
- Press and hold the Hold to Record button while slowly moving the object around. Tilt it, rotate it, move it closer and farther from the camera.
- Keep recording until the sample counter shows at least 30 samples. More variety in angles and distances gives your AI better data to learn from.
You should see a grid of thumbnail images appear under your first class, with the sample counter showing 30 or more.
No webcam? No problem
Click Upload instead of Webcam and add at least 30 photos of your object from different angles. You can take photos on your phone and upload them from your computer.
- Repeat the same process for your second class: click Webcam, hold up your second object, and press and hold Hold to Record while moving the object around.
- Record at least 30 samples for this second class as well, varying the angle and distance.
Both classes should now show a grid of thumbnails with at least 30 samples each.
Why so many samples?
The more examples you provide, the more patterns the AI can find. If you only showed it one angle of a pen, it would only recognize that exact angle. By recording from many angles and distances, your AI learns what a pen looks like in general, not just in one specific pose.
Not seeing the webcam feed?
Your browser needs permission to access your camera. Look for a camera icon in the address bar and click it to allow access. If you are using Safari, check your browser preferences under the Websites tab.
Help me get my webcam working in Teachable Machine.
Train your model and watch it predict
Your AI now has all the examples it needs. Time to let it study them and learn the difference between your two objects.
- Click the Train Model button in the center panel.
- Wait 10-20 seconds for training to complete. You will see a progress indicator while the AI processes your samples.
What happens during training?
The AI scans all your sample images and figures out which visual patterns belong to which class. It builds an internal model of what each object "looks like" so it can recognize them later.
Before you test it, what do you think will happen when you hold up one of your objects to the webcam? Will the AI get it right on the first try?
- Once training finishes, the Preview panel on the right activates automatically.
- Hold up your first object to the webcam and watch the confidence bars react.
- Now hold up your second object and confirm the bars shift to favor the correct class.
The Preview panel shows a confidence bar strongly favoring the correct class (above 80%) when you hold up each object. Your AI just learned to tell two things apart in seconds.
What are confidence bars?
Confidence bars show how certain your AI is about its prediction. A bar at 80% or higher means the model strongly believes the object matches that class. The bars for all classes always add up to 100%.
Confidence bars below 80%?
Try holding the object in a similar position and lighting to how you recorded the training samples. If predictions are still weak, go back and add more samples with clearer views of the object, then click Train Model again.
Help me improve my model's confidence scores.
Your AI can now tell two objects apart in real time. But how robust is it really? In the next step, you will put it to the test and find its breaking points.
Break Your AI
Your AI is making predictions with impressive confidence. It seems like it truly "understands" what your objects look like.
But does it really? The model learned from a narrow set of examples under specific conditions. In this step, you will deliberately push it outside that comfort zone to discover its limits.
In this step, get ready to:
- Test your model with unusual angles and distances.
- Challenge it with different lighting and backgrounds.
- Show it something it has never seen before.
Test with unusual angles
Your model trained on samples where you held each object in a natural position, probably at arm's length in front of your webcam. What happens when conditions change?
Before you test, make a prediction. Do you think your AI will still correctly identify your objects if you hold them upside down, partially hidden, or much farther from the camera?
- Hold one of your objects upside down in front of the webcam.
- Watch the confidence bars in the Preview panel. Note whether the confidence drops or the prediction flips to the wrong class.
- Now partially hide the object behind your hand so only a small portion is visible.
- Finally, hold the object much farther from the camera than you did during training.
You should see the confidence bars shift. The model may drop below 80% or even predict the wrong class entirely.
What is happening here?
Your model learned to recognize patterns from the specific angles and distances you showed it. An object flipped upside down creates a completely different pattern of pixels than the same object right-side up.
The AI is not "seeing" objects the way you do. It is matching pixel patterns against what it memorized during training.
Change the lighting and background
Angles are not the only thing that can trip up your model. The lighting and background in your training samples also became part of what the AI "learned."
- Change your lighting conditions. Cover your lamp, move to a different spot in the room, or point the object toward a window so it is backlit.
- Watch the confidence bars react to the lighting change.
- Now try placing your object against a very different background. Hold it against your shirt, place it on a different-colored surface, or hold it in front of a wall instead of in the air.
- Note which changes cause the biggest drops in confidence.
The model struggles because it accidentally learned your room's lighting and background as part of what each object "looks like."
Why does the background matter?
When you recorded your training data, the AI did not just learn the object itself. It learned everything in the frame: the wall behind you, the color of your desk, the brightness of the room.
This is why data diversity matters in machine learning. A model trained in one environment often fails in another.
Show an object your AI has never seen
Here is the most revealing test. What happens when you show the model something completely outside its training?
- Hold up a completely new object that you did not train the model on. Try your hand, a book, a shoe, or anything else nearby.
- Watch the Preview panel. The model is forced to choose one of your two classes even though neither is correct.
- Try a few different unknown objects and notice how the model confidently assigns each one to a class it does not belong to.
This reveals the most important limitation. Your AI does not know what it does not know. It will always pick the "closest" class, even when the correct answer is "none of the above."
Why can't it just say "I don't know"?
Your model only has two classes to choose from. Every input must be sorted into one of them. It has no concept of "unknown" or "neither" because you never taught it that category.
This is a real problem in production AI systems. A self-driving car's object detector needs to handle things it was never trained on, not just confidently mislabel them.
Keep track of your failures
Remember which specific scenarios tripped up your model. You will use these exact failure cases to test your improvements in the next step.
You just discovered the most important lesson in AI. A model is only as good as its training data. Next up, you will fix these blind spots the same way real AI engineers do.
Make Your AI Smarter
In the last step, you discovered your AI's weak spots. It struggled with odd angles, different lighting, and objects it had never seen before. That is not a bug. It is the fundamental truth of machine learning: a model can only recognize what it has been trained on.
Now you will fix this the same way real AI engineers do. You will add more diverse training data and give the model a way to say "I don't know."
In this step, get ready to:
- Add diverse samples to your existing classes to cover the gaps you found.
- Create a third "Neither" class so your AI can handle unknown objects.
- Retrain your model and verify it handles the tricky scenarios from Step 3.
Add diverse samples to your existing classes
Your model failed because it only saw your objects in one narrow set of conditions. To fix this, you need to show it what those objects look like in all the situations that tripped it up.
- In your first class (your first object), click Webcam to open the recording interface again.
- Press and hold Hold to Record while deliberately showing your object in the conditions that confused the model: odd angles, upside down, partially hidden behind your hand, farther from the camera, and against different backgrounds.
- Record at least 20 new samples with this variety. You should see your sample count rise to 50 or more.
- Repeat the same process for your second class. Click Webcam, then record 20+ new samples showing the second object in varied conditions.
You should now see both classes displaying 50+ samples each, with a visible mix of angles and backgrounds in the thumbnail grid.
Why does variety matter?
When your AI only sees an object in one position against one background, it might actually be learning the background instead of the object. Adding variety forces it to focus on what stays the same across all samples: the object itself.
No webcam? Use file uploads
If you do not have a webcam, click Upload instead and add photos taken in different lighting, angles, and backgrounds. The same principle applies: show the AI your objects in diverse conditions.
Create a "Neither" class for unknown objects
In Step 3, you saw that your AI was forced to pick one of its two classes even when you showed it something completely different. It has no concept of "I don't know." You will now give it one.
- Scroll down below your existing two classes and click Add a class.
- Click the pencil icon next to the new class name and rename it to Neither or Unknown.
- Click Webcam in this new class.
- Press and hold Hold to Record while showing the camera a variety of random things: your empty hand, the background wall, a book, your face, a random pen cap, anything that is NOT your two chosen objects.
- Record at least 30 samples of varied "other" things. The more different items you include, the better your AI understands what is NOT one of your two objects.
Your project should now show three classes. Two with 50+ samples each, and the new "Neither" class with 30+ varied samples.
What is this class actually doing?
By adding a "Neither" class, you are teaching your AI the concept of "everything else." Instead of being forced to pick between two bad options, it now has a third choice that means "this is not something I was trained to recognize."
In professional AI, this is called handling inputs outside the model's training distribution. You just implemented it without writing a single line of code.
Retrain your model and verify the improvement
Your new data is ready. Time to let the AI learn from it and see if the fixes actually work.
- Click the Train Model button in the center panel.
- Wait 10-20 seconds for training to complete. The button shows a progress animation while it works.
Once training finishes, the Preview panel on the right activates again. Now it is time to re-test.
Before you start testing, think back to Step 3. Do you think your model will handle the same tricky scenarios better this time? What about the unknown objects?
- Hold up one of your trained objects at a weird angle (upside down, partially hidden). Watch the confidence bar. It should strongly favor the correct class.
- Change the lighting or background and test again. The model should still correctly identify your objects.
- Hold up a random object that is not one of your two trained items (your hand, a book, anything new). The model should now route it to your "Neither" class instead of guessing wrong.
You should see the confidence bars strongly favoring the correct class (above 80%) for your trained objects, even in tricky conditions. Unknown objects should land in the "Neither" class.
Still seeing wrong predictions?
If your model still struggles with a specific scenario, go back and add 10-15 more samples that match that exact condition. For example, if it fails with a dark background, record more samples against dark surfaces specifically.
If your "Neither" class is catching one of your real objects, you may need more samples of that object in positions that resemble what you put in "Neither." Why is my retrained model still making mistakes?
Your AI is now significantly smarter. It handles edge cases, deals with varied conditions, and knows when to say "I don't know." Next up, you will share it with the world so anyone can test it.
Share Your AI with the World
Your AI now handles tricky angles, weird lighting, and objects it has never seen before. It is ready for an audience.
An AI that only lives on your screen is not very impressive. In this step, you will export your model and get a shareable link that anyone can visit to try your AI in their own browser.
In this step, get ready to:
- Export your trained model using TensorFlow.js.
- Upload the model and get a shareable URL.
- Test the shared link to confirm it works for anyone.
Export and upload your model
Right now your model lives only inside your browser tab. Exporting it uploads the model to Google's servers and gives you a public link that works for anyone with a webcam.
- In the Preview panel on the right side of your project, click Export Model.
- An export popup appears with format tabs across the top.
- Make sure the Tensorflow.js tab is selected at the top of the popup.
- Click Upload my model.
- Wait 10-20 seconds for the upload to complete. A shareable URL appears in the popup once it finishes.
- Copy the shareable link by clicking the copy icon next to the URL or selecting the link text and copying it manually.
What does uploading do?
When you click Upload my model, Teachable Machine packages your trained model as a TensorFlow.js model and hosts it on Google's servers for free. The URL it gives you points to that hosted model so anyone can load it in their browser without installing anything.
Upload button not appearing?
Make sure you have already clicked Train Model and training completed successfully. The export option only appears after a model is trained.
If the upload stalls or fails, check that your internet connection is stable and try clicking Upload my model again.
Why can't I export my Teachable Machine model?
Test your shareable link
You have a URL. Before you share it with anyone, you should verify it actually works outside of your project tab.
Before you open the link, predict: will the model load immediately, or will you need to do something else first?
- Open a new browser tab.
- Paste your copied link into the address bar and press Enter.
- Allow webcam access when the page requests it.
- Hold up one of your trained objects to the webcam and watch the confidence bars react.
- Try your second object and something random to confirm the model classifies correctly and routes unknowns to your third class.
The model loads directly from the URL. You should see your familiar confidence bars responding in real time, just like they did in the Preview panel. Your AI is now live on the internet.
Who can use this link?
Anyone with the link and a webcam can test your model. They do not need a Google account or any software installed. The model runs entirely in their browser.
The link stays active indefinitely at no cost. You can share it on social media, send it to a friend, or bookmark it to demo later.
Model not loading in the new tab?
Double check that you copied the full URL. If the link is incomplete, the page will not find your model.
Make sure you allowed webcam access when prompted. Without camera permissions, the model has no input to classify.
Help me troubleshoot my shared Teachable Machine model
Secret mission
Teach Your AI to Listen
Your AI can see, but can it hear? In this challenge, you will train a brand new model that classifies sounds instead of images. This proves that the same gather-train-test-improve loop you just mastered works for any type of data.
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely in your browser at no cost. There are no cloud resources to tear down and no ongoing charges.
Decide whether to keep your projects open, save them for later, or close everything out.
Resources you used:
- Teachable Machine Image Project (stored in your browser session).
- Teachable Machine Audio Project (stored in your browser session).
Keep everything running
No action needed. Choose this if you want to keep experimenting with your models or add more training data.
- Leave your Teachable Machine browser tabs open to continue working on your Image and Audio projects.
- Your shared model URL remains active indefinitely at no cost. Anyone with the link can still test your AI.
- If you clear your browser data or cookies, unsaved projects will be lost. Consider saving them first (see the Pause tab).
Pause - I'll come back to this later
Save your projects locally so you can close the browser and pick up where you left off another day.
- In your Image Project tab, click the three-dot menu at the top of the Teachable Machine workspace.
- Select Download project to file to save your entire project (including all training data) to your computer.
- Repeat for your Audio Project tab.
- You can now close both browser tabs. To resume later, go to teachablemachine.withgoogle.com and upload your saved project files.
- Your shared model URL stays active regardless. You do not need to do anything to keep it working.
Delete - I don't want to use this again
Remove all project data from your browser. Your shared model URL will remain accessible since there is no way to revoke it, but it costs nothing.
- Close all Teachable Machine browser tabs. Your unsaved project data is stored in your browser session and will be lost when you close the tabs.
- To fully clear cached data, open your browser settings and clear site data for teachablemachine.withgoogle.com.
What about my shared model link?
Your shared model URL stays active indefinitely at no cost. There is no documented way to delete a hosted model from Teachable Machine. Since hosting is completely free, this has no financial impact.
Nice Work!
Nice Work!
You just trained your own AI from scratch. You gathered data, taught a model to recognize patterns, broke it on purpose, fixed it, and shared it with the world.
Here's what you accomplished:
- Trained a custom image classifier using Google Teachable Machine that recognizes objects in real time through your webcam.
- Discovered why data diversity matters by intentionally breaking your model with edge cases, then fixing it with more varied training data and an Unknown class.
- Shared a working AI model via a public link that anyone can visit and test with their own webcam.
- Secret Mission: Trained a sound classifier, proving the same gather-train-test-improve loop applies to any type of data.
Ready to quiz yourself?