Video for Train an AI activity

Video instructions

The Science
In this activity you will train a computer to recognise patterns in your own images. To do so, you will collect your data (two sets of images), you will train your model on this data, and then you will test the ability of your model to recognise those patterns in unknown images of yours that are captured live by your camera.

This activity is using machine learning to learn from your data. After you have collected your sets of images, a machine learning algorithm is running in the background, and is trying to find the common patterns in the images of one set, then it is trying to find common patterns in the images of another set, and then it is trying to find in what those two differ. This way the machine can generalise and identify those patterns in a new, unknown image!

What you will need
A computer with a web camera and internet access.


  1. Follow the link:
  2. Select Get Started.
  3. Choose Image Project on the next page.
  4. Select Standard Image under the New Image Project.
  5. Select Webcam in Class 1 (you may have to Allow teachable machine to access your camera.
  6. Take a few images (5-7) smiling by clicking Hold to Record.
  7. Then select Webcam in Class 2.
  8. Take a few images (5-7) with a sad face by clicking Hold to Record.
  9. After you gather your two classes of images, select Train Model in Training.
  10. Wait a few seconds and your model is trained!
  11. You can now see in the preview what your camera is capturing live, you can change your expression from sad to happy and vice versa, and the machine will try to distinguish in which class (smiling or sad expression) your live image belongs to by looking at the percentage bars.
  12. You can now add a new class of images, by clicking on Add a class, below Class 2. Collect images with an angry expression and train your model again. Let’s see if your model will manage to recognise also angry expressions and distinguish them from happy and sad.

Further investigation

  • What else can you teach it?  Will it recognise a glass from a coffee cup in your hand?
  • You can use the same website to capture audio and teach a machine to recognise sounds!

Things to think about

Have you ever thought that the smart filters in the cameras of phones that add your dog ears and nose are using artificial intelligence? In this case, the machine is trained on data of many people and is learning to understand what a nose is, what is an eye, what is a mouth etc. to recognise these features in your face and add filters (e.g. nose of a dog) in the right location in your face.

Downloadable Pattern Recognition Instructions (PDF)