Buy:
|
Machine Learning: Cats vs. Dogs
Explore Supervised Learning and Computer Vision with Google's Teachable Machine
Note: Lesson plan and resources for this activity can be found at the bottom of this page.
Overview
In this lesson, we will explore the fascinating world of machine learning, focusing on supervised learning techniques. Supervised learning is a type of machine learning where the model is trained on labelled data which the model uses to learn and make predictions or classifications based on new data.
Students will engage with Google's Teachable Machine to create and test AI models, gaining practical experience with labelled datasets. They will experiment with image classification tasks, starting with unbalanced datasets and working towards improving their models by incorporating more diverse examples. By the end of the lesson, students will be able to share their models, explain flaws/limitations in their model, and discuss ways to improve their model. The assessment will focus on their participation, accuracy, and ability to demonstrate understanding and application of concepts related to machine learning and comupter vision. |
Theory
Machine Learning
Often used interchangeably with artificial intelligence, machine learning however has a different meaning. It is the ‘learning’ component of AI that the machine derives from experience using data given to it for training and data it gathers itself.
Put simply, machine learning is an application of artificial intelligence (AI) that provides computer systems with the ability to automatically learn and improve from experience.
Inferencing
The word inference means to draw a conclusion based on evidence and reasoning, rather than explicitly being told something. One way of describing this is when someone figures out an answer by “connecting the dots”, based on all of the facts and knowledge they already have.
In the context of artificial intelligence, inference is where an AI model uses what it has learned to do in training (e.g. to detect objects or recognise images) to process and draw insights from new data.
Let's break this down.
Training AI models
Robots can be trained to recognise different types of objects based on features, like the way they look, what they are made from, their size, and weight.
First, the AI robot needs to be trained with many different images of a certain object, each image labelled with its correct category (e.g. cat, dog etc.).
For example, domestic cats come in many different shapes and sizes, so it's important that the robot is trained to recognise different variations of the same object category. Once the robot is trained, we can test it to see if it is working the way it is supposed to — this is where inference comes in.
Often used interchangeably with artificial intelligence, machine learning however has a different meaning. It is the ‘learning’ component of AI that the machine derives from experience using data given to it for training and data it gathers itself.
Put simply, machine learning is an application of artificial intelligence (AI) that provides computer systems with the ability to automatically learn and improve from experience.
Inferencing
The word inference means to draw a conclusion based on evidence and reasoning, rather than explicitly being told something. One way of describing this is when someone figures out an answer by “connecting the dots”, based on all of the facts and knowledge they already have.
In the context of artificial intelligence, inference is where an AI model uses what it has learned to do in training (e.g. to detect objects or recognise images) to process and draw insights from new data.
Let's break this down.
Training AI models
Robots can be trained to recognise different types of objects based on features, like the way they look, what they are made from, their size, and weight.
First, the AI robot needs to be trained with many different images of a certain object, each image labelled with its correct category (e.g. cat, dog etc.).
For example, domestic cats come in many different shapes and sizes, so it's important that the robot is trained to recognise different variations of the same object category. Once the robot is trained, we can test it to see if it is working the way it is supposed to — this is where inference comes in.
Image created using AI
Supervised Learning
Supervised Learning is the training of an artificial intelligence (AI) algorithm using information that has been labelled. This can be thought of as a teacher providing students with the correct answers to a set of known questions upon which they can develop a strategy / learn how to answer similar questions.
Data labelling
One of the most important requirements of supervised learning is labelled data. With artificial intelligence growing in terms of its presence in our daily routines, there is a constant need to provide results with enhanced accuracy. To accomplish this, the data fed into the machine learning algorithm must be accurately labelled.
Supervised Learning is the training of an artificial intelligence (AI) algorithm using information that has been labelled. This can be thought of as a teacher providing students with the correct answers to a set of known questions upon which they can develop a strategy / learn how to answer similar questions.
Data labelling
One of the most important requirements of supervised learning is labelled data. With artificial intelligence growing in terms of its presence in our daily routines, there is a constant need to provide results with enhanced accuracy. To accomplish this, the data fed into the machine learning algorithm must be accurately labelled.
Example of Supervised Learning
In the example shown in the image (above), the model has learned from labelled input data and produces output to classify them as cats and dogs. Therefore, you can see that the model learns from the training data and then applies the same knowledge to test data.
Lesson Plan: Cats Vs. Dogs
Exploring Computer Vision and Supervised Learning
This lesson is aligned with the National Curriculum in England: Secondary Curriculum for Computer Science (Key Stage 3/4)
Lesson: Cats vs. Dogs: Understanding Computer Vision and Supervised Learning with Teachable Machine
Overview:
In this lesson, students will learn about supervised learning and computer vision techniques in AI.
Learning Objectives
Materials Needed
Starter Activity (10 minutes)
Alternative starter
Lesson: Cats vs. Dogs: Understanding Computer Vision and Supervised Learning with Teachable Machine
Overview:
In this lesson, students will learn about supervised learning and computer vision techniques in AI.
Learning Objectives
- Understand the concept of supervised learning.
- Recognise the importance of diverse datasets in training AI models.
- Use Google's Teachable Machine to create and test a simple AI model.
Materials Needed
- Computers with internet access
- Projector and screen
- Worksheets for the hands-on activity (printed or digital)
- Access to teachablemachine.withgoogle.com
Starter Activity (10 minutes)
- Challenge students to a game of Quick Draw (quickdraw.withgoogle.com). Explain that Quick Draw is a great example of a game built with machine learning. You draw, and a neural network tries to guess what you’re drawing. Of course, it doesn’t always work. But the more you play with it, the more it will learn.
- Ask the students, what is the point of Quick Draw? Explain that every time you play Quick Draw, you are training an AI algorithm to identify hand drawn objects. Launch Auto Draw (https://www.autodraw.com/). Demo how Auto Draw works and explain that the AI algorithm uses what it has learnt playing Quick Draw to predict what you’re drawing.
Alternative starter
- Alternatively, if you or students don't have access Quick Draw or Auto Draw (i.e., it's blocked due to your organisations filtering policy), direct students to https://cloud.google.com/vision/#section-2 and have them try out the image recognition API that has been developed by Google, by uploading images and seeing what the API is able to recognise/classify.
Introduction to the Topic (10 minutes)
Hands-on Activity (30 minutes)
Classifying cats and dogs with Teachable Machine
Extension
Plenary (10 minutes)
Review and Reflection
Ask students to share what happened when they uploaded an image of both a cat and dog, cartoon cat or dog, or wolf or tiger etc. Inform the students that machine learning models learn to recognise patterns in what you use to train it. If all photos in a set of dogs have floppy ears or they are all the same size or colour – then those can be patterns that the model uses to recognise pictures. Explain that, in the previous example, the machine learning algorithm might think that a dog with pointy ears might be incorrectly classified as a cat based on your training data. Ask students to share ways to improve their model - draw out answers such as 'Add more examples' or 'Use more diverse examples' etc.
- Introduce the concept of inferencing and supervised learning (See examples above).
- Share the supervised learning example of a model to classify cats and dogs (above). Explain that the model has learned from labelled input data and produces output to classify them as cats and dogs.
Hands-on Activity (30 minutes)
Classifying cats and dogs with Teachable Machine
- Explain to the students that they are going train an AI model to correctly identify images of cats and dogs.
- Guide students to access Google's Teachable Machine at teachablemachine.withgoogle.com.
- Divide students into pairs and hand out the instructions (below).
- Instruct students to start by finding images of cats and dogs (at least 6 of each) and save them to their computer. Once they have their training data (6 cats and 6 dogs), the students must train their AI model using the instructions provided.
- Once the model is trained, ask students to test it with an image of a cats and dog that was not used as part of the training data and observe the results.
Extension
- Ask students to test there model with other images, e.g., image of both a cat and dog, cartoon cat or dog, or wolf or tiger etc., and observe the results.
- Encourage students to improve their model to get more accurate results.
Plenary (10 minutes)
Review and Reflection
Ask students to share what happened when they uploaded an image of both a cat and dog, cartoon cat or dog, or wolf or tiger etc. Inform the students that machine learning models learn to recognise patterns in what you use to train it. If all photos in a set of dogs have floppy ears or they are all the same size or colour – then those can be patterns that the model uses to recognise pictures. Explain that, in the previous example, the machine learning algorithm might think that a dog with pointy ears might be incorrectly classified as a cat based on your training data. Ask students to share ways to improve their model - draw out answers such as 'Add more examples' or 'Use more diverse examples' etc.
Assessment Criteria
- Participation in discussions and activities.
- Ability to identify and explain their AI model works.
- Demonstrated improvement in AI models through the addition of diverse data.
Step-by-step instructions:

supervised_learning_worksheet.pdf |