Different tools are suggested depending on the task selected based on student skill level. These tools include:
Use Scratch 3.0 or a similar visual programming environment to create a digital solution.
Use Teachable Machine to explore image recognition using an AI tool.
Note: This tool requires an internet connection and access to the device’s camera.
An updated version of Teachable Machine is also available. The interface is different and users can save their projects.
View both versions to decide which one suits your student’s needs and skill level.
Privacy and personal information: Students capture images of themselves in this task. To ensure these student images are not stored on external servers just close the program when completed and do not save the project. If you close your tab, nothing is saved in your browser or on any servers.
Use Machine Learning for Kids to incorporate AI into the digital solution.
Note: Before the activity, this tool requires an initial set up by the teacher completed prior to the lesson. View the step-by-step guide to help with this process.
The following matrix shows which tools are required for each level in the Plugged part of this lesson.
|Level||Tools required||Artificial intelligence used|
|Medium to high||Scratch, Machine Learning for Kids||Yes|
Discuss the many things that people use their smartphones for in daily life. Then ask: ‘How do users make sure their smartphone is secure?’
List security measures used to protect a user from someone else’s unwanted (unauthorised) use of their smartphone.
Discuss which of these would use AI to perform the security measure. Explain that biometric security often uses image recognition to reform this function.
These activities explore ways of implementing a digital solution that demonstrates a smartphone security measure.
Use the AI tool Teachable Machine to create a simple demonstration of how facial recognition can be used to unlock a smartphone. No coding is required in this activity.
Note: This tool requires an internet connection and access to the device’s camera. View the tutorial first as a class, to make sure students are clear on how the tool works. The AI needs to be trained on data, in this case, each student’s image. To ensure these student images are not stored on external servers just close the program when completed and do not save the project. If you close your tab, nothing is saved in your browser or on any servers.
Image: sample screen from the AI tool Teachable Machine v 1, showing INPUT feeding into the LEARNING component, the elements of which lead to an OUTPUT (with the GIF option selected, Sound and Speech, being the other two tabs).
This option uses Scratch 3.0 or a similar programming environment. It requires the following programming skills:
Present the challenge of creating a program in Scratch 3.0 (or other familiar visual programming language) that uses a PIN to unlock a smartphone.
Depending on your students’ skill level, choose from among these:
A basic program can use the logic of first asking for a PIN – personal identification number – as an ‘answer’. An ‘ask’ block is selected for this purpose. It can be initiated when the green flag is clicked/selected.
Image: Screen capture of Scratch 3 Phone lock/unlock: ask for PIN (pin)
If the PIN (answer) is correct, broadcast ‘Unlock’ and switch the costume.
Note: The ‘costume’ changes depending on the broadcast message.
Image: Screen capture of Scratch 3-coded program showing broadcast message ‘Unlock’ (access granted), with matching costume.
If the PIN is wrong (an ‘else’ situation), broadcast ‘Locked’, say ‘Incorrect pin. Try again’, and switch the costume to a locked one.
Image: Screen capture of Scratch 3-coded program, showing broadcast message ‘Locked’ (access denied), with matching costume.
A flowchart representation of the steps described above could look like this:
Image: Flowchart representation of ‘Lock’/’Unlock’ steps depending on whether a PIN is correct or not.
Sample code: Basic Phone lock/unlock
A more complex solution can include multiple sprites and an option to access the screen by selecting a home button. This will involve showing and hiding sprites at different stages of the program. A forever block can be used to animate the home button by looping the next costume block.
Image: Screen capture of Scratch 3.0-coded program where Home button is used as one step to lock or unlock a smartphone
Image: Screen capture of Scratch 3.0-coded program with broadcast message ‘Unlock’
Sample completed program: Phone unlock/lock
The first solution involves using Scratch 3.0.
The second option requires a higher level of skill, but students learn how to train an AI and incorporate the AI model into their Scratch programming. This option requires the use of an AI tool: Machine Learning for Kids.
The first step is to have a Start screen that asks the user to scan their facial image. A sprite can be made and labelled ‘Scan’.
Image: Screen capture of Start screen coded in Scratch3.0
In the following example, avatars have been used. Students use the broadcast message to switch the background to show ‘Scanning’.
Image: Screen capture of ‘Scanning’ image coded in Scratch3.0
To avoid privacy issues when using a student’s image, suggest using a toy with a face. Students can capture an image of the toy’s face with the device’s camera. Students label one toy image as granted and identify the costume number. In our program, If costume number 2 is scanned, then broadcast is granted and the screen will show granted. Else any other image (costume number will be denied). A range of other toy faces can be uploaded to the program (these will be denied access).
Image: Screen capture of granted image coded in Scratch3.0
Image: Screen capture of denied image coded in Scratch3.0
Sample code: Scratch Basic Phone lock/unlock
Visit the worksheet page on Machine Learning for Kids. Select the project Face Lock. Download the step-by-step guide, which has explanations and colour screenshots for students to follow. Ensure students do not upload their own image or images of others to the bank of data. Instead use toys with faces. This will avoid any privacy risks where their image potentially may be used without their consent.
Note: Although the guide is labelled ‘easy’ on their site, relative to our activities it is medium to high.
Here is the main script students would use. The main difference between this and the code above (see Sample code: Scratch Basic Phone lock/unlock IMAGE) is that the AI is invoked to determine if an image has been recognised. The screenshot below shows the additional black Machine Learning for Kids blocks.
Image: AI model incorporated into Scratch 3.0
Discuss the ways the AI responded to the different facial images.
IMPORTANT NOTE – AUTOMATIC DELETION OF AI MODELS.
By default, after 24 hours Machine Learning for Kids automatically deletes AI models trained by students. As a teacher, you can increase this time to as much as 1.5 weeks (but remember that there is a limited number of models that a class can have at any time). Student training data is not deleted, so models can always be retrained.
IMPORTANT NOTE – SAVING PROGRAMS.
To accommodate each AI model, a custom Scratch 3 environment is launched when you select Make. This is different from the regular Scratch 3 environment accessed at scratch.mit.edu. Programs cannot be shared or uploaded across the two different environments. This means several things:
Share what you have learned about AI and how ‘smart’ a computer can be.
Algorithms and programming are essential to developing machines powered by artificial intelligence (AI). AI is the ability of machines to mimic human capabilities in a way that we would consider 'smart'.
In conventional programming the computer is provided with a set of instructions for a defined set of scenarios. In the 4-digit PIN program and the basic image unlock program, the students hard-coded the program with specific inputs to create an output. To include an AI model we used Machine Learning for Kids to use the AI to recognise images as ‘granted’ or ‘denied’.
Machine learning (ML) is an application of AI. With machine learning, we give the machine lots of examples of data, demonstrating what we would like it to do so that it can figure out how to achieve a goal on its own. The machine learns and adapts its strategy to achieve this goal.
This lesson focuses on: