AI classroom activity: Facial recognition

Artificial intelligence (AI) is everywhere in our daily lives – search engines, social media, intelligent personal assistants such as Siri – and today's schoolchildren are a generation who will grow up with these AI technologies.

I have a one year old daughter; it is distinctly possible that she does not need to learn how to drive when she grows up because self-driving vehicles will be the norm.

As a computer scientist who works in a medical research institute, I witness firsthand how AI is transforming the way we screen our three-billion-character genome to discover disease-causing mutations, and detect cardiovascular risks by analysing data from wearable fitness trackers.

Like it or not, AI will be an integral part of our children's future. The term AI may sound scary, possibly due to association with killer robots in science fiction. Another misconception is that AI is so complicated that there is no way schoolchildren can understand the concept.

Setting aside the philosophical issues surrounding what is intelligence, most real-life AI algorithms are actually doing something much simpler – to mimic some aspects of human-like behaviours, such as identifying objects inside an image, learning, natural language comprehension, and social interactions. All these behaviours can be encoded into computer algorithms.

Through the CSIRO STEM Professionals in Schools program, I have been working with ICT teacher Matthew Scadding from the Ravenswood School for Girls in Sydney's North Shore to introduce the fundamental concepts of AI into their Year 6 robotic classes. In this two-part series, I will summarise the activities we used to introduce two important AI tasks to our students – facial recognition and learning.

‘Unplugged' facial recognition task

The facial recognition task was an unplugged activity in which students act out the algorithm physically in a game, without the use of a computer or robot. The task is as follows: given a person's photo, name the person inside the photo. This is the type of facial recognition technology behind automatic photo tagging in Facebook. To make this activity more engaging for our Year 6 girls, we called this activity ‘Who is this princess?' – a game to identify the name of a Disney princess inside a picture. (Before creating your own game, check the Smartcopying website for copyright issues and use of images.)

Preparation: In our game, the teacher prepared seven colour-printed papers, each with one side printed with the image of one of six different Disney princesses – five images of five different princesses and two different images of one princess (for example, see Belle in Figure 1).

On the other side of the page, print a list of questions regarding some physical characteristics of the princess, such as dress colour, hair colour, skin colour, hair length and so on. Disney princesses were selected because they are generally well-known to our students, and the characters tend to have distinct visual features. You can choose any other collection of characters to suit your class, or create your own.

Classroom discussion: Before the activity, the teacher can explain to the class that facial recognition is not as easy as it seems. A computer can match two photos pixel-by-pixel to check if there is an exact match. However, in real life the same person may look differently in each photo due to different posture, clothing, and facial expression. Humans can readily recognise faces. We can do so because our brain extracts and matches key features of the person inside the photos. For example, Snow White has short dark hair and always wears a dress, while Ariel has long red hair and has a fishtail. The goal of this activity is to illustrate the key AI concept of feature extraction – conversion of data in the original format (for example, an image) into a series of quantitative or qualitative features that can be used to distinguish different objects in the original data. A computer cannot ‘see' a photo like a human, but it is good at comparing a list of features. By converting the original image into a series of features, a computer can behave like humans in terms of recognising the person inside each photo.

The new staffroom at Macgregor Primary School

[Figure 1: The task of facial recognition can be achieved by converting the image of an unnamed person (right) into a series of physical characteristics, and identifying which image best matches the list of physical characteristics within a database of named photos (left). Images © dean bertoncelj/Shutterstock]

Activity: This activity consists of two parts – feature extraction and database search. In the feature extraction step, we selected six students and gave each person a randomly chosen princess and instructed them not to show it to anyone else. Please make sure each person has a different character. The students were then asked to answer the questions about the princess in their hand (see Figure 1 for an example). The teacher then selected one other student from the rest of the class to give them a new ‘unnamed' image of one of the princesses that was selected by the initial six students. Similarly, this student had to fill in the questions about their princess, but she could show the image to the class. At this point, the physical image of the princesses can be described by a series of textual descriptors of the characteristics of their appearance. This completes the feature extraction step.

The next step is the database search step. The teacher asked the six students to stand in front of the class but try not to show the image of their princess. The student holding the unnamed princess walked in front of each of the six classmates and counted how many of the physical characteristics matched between her unnamed princess and their classmate's princess, based on the list of physical characteristics alone, without looking at their images directly. The number of matched characteristics is called a similarity score. After all six princesses have been compared, the student needs to identify the princess with the highest similarity score. At this point, the teacher can ask all six students to show their princesses to the class. If all goes to plan, the unnamed princess should match the princess with the highest similarity score.

Key concept: This game seeks to demonstrate the key concept of feature extraction – conversion of one type of data (image) into another format that facilitates comparison. The two selected images may not have a perfect match in every single characteristic, but it should be the most similar among a big database of photos. Accuracy of this type of facial recognition depends on the quality and size of the background photo database. This is why ‘big data' is such an important component of modern AI.

Stay tuned: Next week, Dr Joshua Ho will give a step-by-step guide to another classroom activity you can use to illustrate the concept of machine learning.

In what ways is your school engaging students in STEM subjects?

Dr Joshua Ho is working with educators as part of the CSIRO’s STEM professionals in schools program. Think about a STEM-related topic you’re teaching next term. How could you develop links to tap into external expertise?