AI and image recognition
About this lesson
This lesson builds on How can an AI recognise what is sees? It focuses on image recognition that involves feature extraction, object detection and classification, and introduces the idea that computers store and use data using 0s and 1s.
Year band: 5-6
Curriculum Links AssessmentCurriculum Links
Links with the Digital Technologies Curriculum Area.
Year | Students learn to: |
---|---|
5-6 |
Explore how data can be represented by off and on states (zeros and ones in binary) (AC9TDI6K04) |
ICT General Capabilities
Creating with ICTLevel 4 Typically, by the end of Year 6, students: Generate solutions to challenges and learning area tasks
Learning Continuum of Information and Communication Technology (ICT) Capability: Creating with ICT |
Assessment
Content descriptions
- Explore how data can be represented by off and on states (zeros and ones in binary) (AC9TDI6K04)
Achievement standard
- They explain how digital systems use whole numbers as a basis for representing a variety of data types.
Teacher assessment
Use the task in the Learning construction to provide evidence of learning.
- Does the student use 1s and 0s to represent black and white in a pixel drawing or image?
(Note: the student may use other numbers to represent colours.)
- If using a spreadsheet, did they automate the process using conditional formatting?
- Can the student create a recognisable representation of their chosen object or image?
Learning hook
Introduction to image recognition
-
Pose the question: How does a computer see? How does it know the difference between one object and another?
Students write and draw their ideas.
- Discuss ways in which a machine can be considered smart as it performs human-like behaviours such as recognising speech, text, images and being able to reason.
- View the video Artificial Intelligence Explainers: Video 2: AI in our everyday life. It includes an example of an AI-based app that provides a person who is vision impaired with a commentary of objects in their immediate surroundings. The app uses the camera to ‘see’ and computer vision to recognise the objects.
- Other examples to get students to think creatively include:
- Shark spotting: A drone fitted with a camera and using an AI system can spot a shark and send data to beach patrols to warn swimmers in the area. How might it tell a shark from a dolphin?
- Weed spotting in Kakadu National Park: View the video about a project that combines Indigenous knowledge and AI technology. Para grass, an invasive weed, is choking precious wetlands. With the help of drones and AI technology, Traditional Owners are able to target these weeds and manage country. How does the AI in the drone know a weed from a wetland plant?
- Brainstorm ways an AI, using computer vision can help solve problems.
Discussion
How does a computer recognise a shark from a dolphin or weeds from native wetland plants?
- When training an AI, images of the objects to be classified would be used through the process of supervised learning. Supervised learning is the process of the human providing the program with lots of examples of the object we want to identify, along with a label.
- For an easy to understand explanation of this refer to the video Artificial Intelligence Explainers: Video 1: Introduction to AI & machine learning.
- When referring to students’ brainstormed AI powered solutions, discuss what types of data would be required.
Learning input
What does a computer actually see?
Use this animated GIF sequence of zooming in on an image of a kangaroo to reveal RGB colour coding.
In reality, a computer sees images as individual picture elements (pixels). Use this pixel viewer to show that an image is made up of pixels. Each colour pixel in the image is made up of numbers that represent the colour as a combination of Red-Green-Blue (RGB). So the computer recognises a kangaroo, for example, based on a pattern of pixels and complex mathematical algorithms.
No wonder it is such a challenge for a computer to recognise an object accurately!
Image: Pixel viewer screen capture: Kangaroo – the zoom-in on the right image shows RGB for each pixel)
Learning demo
Data can be represented using whole numbers
- Provide students with a 5 x 7 grid and ask them to work out a way to code the squares in the grid so that someone else can represent the image.
-
In pairs, students share each other’s code and see if they can re-create the image.
Image: Image of 4 emojis represented as 5 x 7 pixels (black and white)
-
Discuss the various ways used to code the image.
Discuss that computers use 1s and 0s for all information in digital systems, text, images and audio.
- View this video, created by Byran Franklin, a teacher from Torrens Valley Christian School who created the resource to learn about binary numbers and representing 0 and 1 as black and white. The approach uses a spreadsheet, incorporating the skills of conditional formatting (if cell equals) and formatting cells.
Learning construction
Represent an object using coloured pixels
- Pose the question: How would an AI system represent an object?
Explain that an AI would look for patterns. The patterns it sees in an image are made up of pixels (picture elements).
In this task, students represent an image of an object as a pattern of pixels. The process is best done with a spreadsheet but can also be completed unplugged with a grid (e.g. 10 cm x 10 cm).
- Demonstrate three ways to represent an image by pixel. Each cell is a pixel. Each cell is colour coded. Share this pixel art of a butterfly represented in:
- Using a spreadsheet such as MS Excel, Number for iOS or Google Sheets, introduce how to use conditional formatting to automatically represent black and white if a cell contains either 0 or 1.
The conditional formatting is ‘cell is equal to a value’. The same process can be repeated for other colours.
Download this file for students to investigate conditional formatting.
- A cell that contains a 0 (zero): format to be represented as a black (fill black)
- A cell that contains a 1 (one): format to be represented as white (fill white)
Whole numbers to binary
Up to this point we have used whole numbers to represent colour.
Computers use binary numbers which is made up of only 1s and 0s.
Use this Code.org Pixelation tutorial to explore how binary numbers can be used to represent colour in pixels. The initial tutorial starts with black (0) and white (1).
Take a step further moving from 0 and 1 to show greyscale (shades of black and white). To do this you need to select two bits per pixel (see image) with each cell able to be represented as 00, 01, 10 or 11. This enables black, dark grey, light grey and white).
Image: Code.org Pixel example: Koala represented in grey scale
Discussion
Have students share what they have learnt about AI and how images can be represented with whole numbers.
- Discuss how well they represented an object using different coloured pixels using black and white only, greyscale (shades of grey, black and white) or a range of colours.
- If using a spreadsheet to automate the process, what did they learn?
- What did students learn about pixel size and the quality of the representation? (Smaller pixels enable a higher quality representation.)
Why is this relevant?
This lesson focuses on:
- image recognition
- classification.
In Digital Technologies, representing data refers to the way data is symbolised, visually treated or provided in audio. For students in years 5–6, the focus is on how data is represented using whole numbers. Using AI and image recognition provides a useful context to explore data representation. Representing data as whole numbers is a pre-cursor to representing numbers in binary (1 and 0s).
Image recognition is an area of AI that has many applications. For a computer to recognise what it sees, it needs input of data through a camera and some form of processing. Classification is a supervised learning technique used to group data based on attributes or features. Humans can provide labels on the data input for images. The machine then matches future data based on the similarity of the new data to predefined groups. Examples of the groups could be cars, traffic signals, people or bicycles.
Resources
- Download this file for students to investigate conditional formatting.
- Download this file for students to investigate conditional formatting and representing an image using coloured pixels (cells).
- Find out more about conditional formatting and pixel art from the Deep Dive 2 recorded webinar (Primary).