Webcam interface for the people selection.

Introduction to Machine Learning

Primary - Grade 3

Introduction

In this lesson, students learn how a computer can be taught to categorize objects. This is something students already have experience with. They can likely separate objects into categories quite easily. They might point out how many animals, vegetables, fruits or vehicles are in an image. For a computer, though, this task can be quite complex. 

A computer can be taught to tell objects apart visually if it is given a set of example images. In this class, students first do a non-computer activity that asks a series of questions to help them determine which category an item fits into.

Next, using Google Teachable Machine, the class takes a series of pictures with the teacher’s computer, one of each student, as well as some pictures that have no students in them. Then, the computer will be taught to tell when it is looking at a picture of a person and when it is looking at one without any people in it. 

Learning Goals

  • Introduce machine learning and how it is used in communities
  • Explore how machine learning uses questions to determine the category something fits into 
  • Learn how a computer detects what is happening in the world around it
  • Introduce foundation concepts of bias in machine learning

Vocabulary

The following is a list of potential new words that students should understand

Machine Learning
Teaching computers how to make decisions based on examples it is given
Category
A way of grouping people or things based on their characteristics

Guiding Questions

  1. Can computers learn?  (Answer: Yes, today we’ll look at how to teach computers.)
  2. Can a computer tell the difference between objects? (Answer: Yes, but we need to teach it how.)
  3. Can a computer use a camera to recognize a person? (Answer: Yes! Students may have seen facial recognition used to unlock phones.)

Curriculum Links

Science and Technology, Applied Design Skills and Technologies

Students will:

  • Make a product using known procedures or through modelling of others
  • Explore the use of simple, available tools and technologies to extend their capabilities
  • With support, follow the steps in a simple, teacher-prepared procedure for a test/experiment
  • Ask questions that demonstrate curiosity about the world around them
  • Make guesses about possible outcomes of simple procedures

Social Studies:

Students will:

  • Recognize the causes and consequences of events, decisions or developments

Sources:

The Ontario Ministry of Education “Grade 1–8 Science and Technology,” Ministry of Education, last modified 2007, accessed June 21, 2021.

The British Columbia Ministry of Education “Applied Design Skills and Technology,” accessed June 21, 2021.

The British Columbia Ministry of Education “Social Studies 3,” accessed June 21, 2021.


Materials

  • A device (computer / tablet / smartphone) with internet connection and a camera

Non-Computer Activity

Is It An Animal?

In this activity, students work in pairs to determine whether their partner has written down the name of an animal, place or thing without asking the question directly. This activity builds students’ ability to ask questions that can differentiate items based on their characteristics. Identifying similarities and differences allows both people and artificial intelligence (AI) in order to group or separate things. 

Step 1:  Without showing their partner, each learner writes the name of a living thing, plant, food or other object on a piece of paper and places it face down. 

Step 2: Each student asks a maximum of five questions to their partner. The aim is to determine whether their partner has written down the name of an animal or something else, without asking directly, Is it an animal?

Example

Partner 1: Writes down ‘tree’ without showing Partner 2
Partner 2: Begins asking their five questions to figure out if Partner 1 wrote down an animal

Partner 2: Is it alive?
Partner 1: Yes.

Partner 2: Does it live in the forest?
Partner 1: Yes.

Partner 2: Does it have legs?
Partner 1: No.

Partner 2: Does it move?
Partner 1: A little…  

Partner 2: Does it eat?
Partner 1: No.

Partner 2: – It’s not an animal! What were you thinking of?
Partner 1: A tree!  

Then the partners switch who is asking questions. 


Computer Activity

Introduction and Example

In this activity, the class works together to make a machine learning project. They teach their device to detect when a person is in view of the camera using Google Teachable Machine. The following video shows an example of how this tool can be used. 

Step 1

Go to the Google Teachable Machine website.

Step 2

Click Image Project then choose Standard Image Model

Teachable machine interface.
Standard image model circled.

Step 3

Class 1 and Class 2 are the default names for categories. Change these to People and No people by clicking on them and typing in the new names. 

Class 1 and class 2 are circled.
People and no people changed.

Step 4

Next, add sample images to each category (People and No People) so the computer can learn to tell the two types of content apart. Start by adding photos of people. The more variety of people and types of photo, the better the model will perform. Different lighting, angles and distance can help the model detect people in different situations. Add photos of each student and the teacher using the webcam. If prompted to do so, allow access to the device’s camera. Click and hold the Hold to Record button to take several photos of each student. In a  remote teaching environment, have students submit a photo of themselves using the Upload feature. Review the images and remove any that don’t have a person in them.

Webcam interface for the people selection.

Step 5

Next, take some sample images for the No People category. Again, be sure to take a variety of photos but be certain there are no people in any of the photos! Review your photos and remove any that have people in them. 

Webcam interface for the no people selection.

Step 6

Now that example images have been saved in each category, the model needs to be trained. This process gives the computer a chance to look carefully at each example image. This helps the model to be able to guess quickly whether it is being shown a picture of a person or not. Click Train Model and wait until the process is complete.

Training with a train model button.

Step 7

When the model has finished training, a live preview of it working will be displayed. This view can be used to test the model! Test the model with students to see if it replies correctly when there are people or no people in the view of the camera. 

Preview for the webcam.
Preview for the no people webcam.

Extension challenges:

  • Can the model be fooled? How? (Answer: Try showing the camera only part of a person, or a photo of a person)
  • What happens if students show one of their hands to the camera, but not their face? How could the model be improved to detect hands better? (Answer: Adding photos of students’ hands to the people category will improve the model)
  • Try starting again to create another model with more categories, or a model that uses poses, or sounds instead of images. How well does this work?

Conclusion

Dog vs. Desk

Quick exercise! What is the difference between a dog and a desk? What do they have in common? Make a chart on the board with a column for Dogs and a column for Desks. Have students come up with qualities that can be used to identify the similarities and differences. Place a mark to show if the dog or desk has that quality. Encourage discussion about general rules (not all dogs or desks have four legs, not all dogs fetch, etc.). When more information is provided about an animal or object, guesses about which category it fits into are more accurate. 

Qualities DogsDesk
Has four legsXX
Can be indoors our outdoorsXX
Many different sizesXX
Eat foodX
Good to eat offX
FetchX
Requires assemblyX

Resources

Additional Resources

Social Media Resources


We want to see the awesome things you’re creating! Take a photo or video and share your work with us by emailing media@pinnguaq.com or tagging @pinnguaq on Facebook, Twitter or Instagram. Don’t forget to include the hashtag #LearnWithPinnguaq

This article originally appeared in the third issue of Root & STEM, Pinnguaq’s free print and online STEAM resource supporting educators in teaching digital skills