Pattern Recognition - activity
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.
- Follow the link: https://teachablemachine.withgoogle.com.
- Select Get Started.
- Choose Image Project on the next page.
- Select Standard Image under the New Image Project.
- Select Webcam in Class 1 (you may have to Allow teachablemachine to access your camera.
- Take a few images (5-7) smiling by clicking Hold to Record.
- Then select Webcam in Class 2.
- Take a few images (5-7) with a sad face by clicking Hold to Record.
- After you gather your two classes of images, select Train Model in Training.
- Wait a few seconds and your model is trained!
- 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.
- 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.
- What else can you teach it? Will it recognise a glass from a coffee cup in you 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 is a nose, 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.