ScratchLearningResource ScratchAILesson
ScratchLearningResource ScratchAILesson
In this lesson plan, we will explore the possibilities and pitfalls of AI and face detection, using the Face Sensing blocks in
Scratch Lab to create games, interactive stories, and accessible projects. We’ll also try out adding playful AI-generated images
to Scratch projects, focusing on how to write prompts that produce the desired creative results. Lastly, we’ll reflect on exploring
both the opportunities and the limitations of these new technologies through topics for classroom discourse.
“We should encourage learners to use ChatGPT and other generative AI tools not to
produce the final result, but as a resource throughout their own creative process.”
— Professor Mitch Resnick, co-founder of Scratch
When working with AI on various platforms, please be sure to check the Terms of Service to ensure the students’ age does
not prohibit them from directly interacting with the application. In some cases, the educator/facilitator may need to do the
direct input and discuss output with students if the output is deemed appropriate to share.
Per Scratch’s Terms of Service, students of any age may directly interact with/code projects using the Face Sensing blocks
on our Scratch Lab site. Face Sensing blocks run securely in your browser. Images and data are not stored or shared
anywhere. No personal data is collected or stored when using these blocks. The extension can detect that a face exists, but
cannot identify the person. (You can learn more on the Face Sensing homepage and our blog post.)
See this Digital Promise article for information on “How School Districts are Integrating Generative AI into their Policies.”
Key Concepts
Artificial intelligence (AI) is the umbrella term for computing systems that use data in order to analyze information, make
predictions, and generate creative ideas.
Predictive AI is a branch of AI that uses machine learning to classify data it receives in order to generate predictions. The
more sophisticated data we feed in, the more sophisticated and accurate the system will be. It learns patterns and
relationships in data. Examples could include:
● Facial detection (Scratch Face Sensing)
● Product recommendations (Facebook advertisements)
● Email automation and spam filtering (language classification)
Scratch Lab is a site where you can engage with experimental blocks, like Face Sensing. With Face Sensing, create projects
that respond to your eyes, nose, and other parts of your face.
Step 2: Click the “Try it out” button at the top of the page.
Step 3: A new project loads using the default Scratch Cat sprite. Just as in the Scratch editor, users can use this default
sprite or choose another from the sprite library.
Step 4: Face Sensing blocks use the device’s camera. If you haven’t enabled the camera in your browser for the Scratch
Lab site, you may be prompted to give permission.
How do Face Sensing blocks work? The AI we are using was trained on millions of photos of people’s faces, called a data
set. It detects things based on what it has already seen, like parts of a face and how they are arranged. The machine
learning model looks for patterns like: a nose is between the eyes and mouth, eyes are typically a certain size in relation to
the face, mouths may show teeth or not, etc. It can detect that a face exists, but cannot identify the person.
Step 1: Select the “go to nose” block and place it on the script
area.
Step 2: Click the block while your face is visible on the stage
and see what happens. Did the sprite go to your nose?
Try moving and clicking the block again.
Starter script.
Step 3: How can you make it constantly follow your nose?
Encourage them to find a block to help. Try selecting a
forever loop from the Control category and place the
“go to nose” block inside it.
Step 4: Select the Events category and add a “when green flag
clicked” block to the top of the code stack.
Step 5: Click the green flag to see how this works. Did the
sprite stick to your nose and follow it around as you Adding a forever loop.
moved? What happens if you click on the dropdown list
and choose another feature for the sprite to go to?
● How does the object appear on your face when you are
close to the camera? What happens if you are further
from the camera? Do you see any blocks you could use
so it scales to match the size of your face?
On a new tab, navigate to the Face Sensing homepage again and scroll down until you find the Starter Projects section.
Click on the “Hat and Glasses” starter project. What blocks is this program using? What do you think they do?
False Positives
Using the “Hat and Glasses” starter project, make sure your
own face is out of the frame and hold up something with a face
(like a smiley face drawing, a picture of an animal face, or a toy).
See if the hat and glasses track smoothly (a false positive!) or
randomly jump around (indicating it does not recognize the
object as a face).
People can easily see that an animal has a face, but why might
some animal faces (like cats) be recognized while others (like
cows or dogs) may not be seen as a face? Think about the
proportions of a human face and how those are different from a Examples of possible false positives: drawings of faces, animal
cow’s face with a longer snout. Those measurements don’t faces (cat may be seen as a face, while cow not), Lego head, a
match the human faces in the photos the AI trained on, so it filled in circle (depending on the shading and direction of the
lines, etc.).
doesn’t see a cow’s face as a face!
Face Sensing blocks provide a meaningful opportunity to open up conversations with your learners about AI ethics and how
these concepts will shape our future. Several classroom reflection prompts:
● What does it recognize as a face? What were you surprised it recognized/did not recognize? Does it appear to treat
people of different races, genders, and ages fairly?
● Why was the technology developed? What do you think it was developed for?
● What if you don’t want to be seen?
Recommended Reading:
● Exploring a Creative, Safe Introduction to Machine Learning (Scratch Team) - This blog post introduces the Face
Sensing blocks and explores the design decisions and inspiration for the project. It can be used to generate
classroom discussion on ethical implications of AI models.
Resources:
● Scratch & AI: Face Sensing (Tutorial Video) - Join Eric and Maren as they explore the face sensing blocks, try to fool
the AI, and show some example projects for inspiration.
● Scratch Lab Face Sensing Coding Cards (Student-Facing Cards) - Printable cards students can use to follow along
with the lesson
● Getting Started Guide (Written Guide) - If you are new to Scratch and just getting started, this resource has helpful
information.
● Scratch Ideas Page (Webpage) - Short tutorials and Scratch Coding Cards.
Resources:
● Face Sensing Project Sharing Sheet (Worksheet) - A
place where learners can share instructions as well as
receive feedback and observations.
Chatbots can generate new ideas that expand our creative process. But generative AI models are only as reliable as the data
it has access to and the specificity and context provided in a user’s prompt. Let’s practice writing prompts that generate
positive results. Begin by opening Bing Chat (https://www.bing.com/new) or another approved AI platform, and click “Chat
Now.” (See our Special Note on Working with AI Technology above.)
Getting Started
Since we’ve been talking about faces, let’s try entering the prompt: “What is a face?” There are many ways to answer this
question. If you asked a person, they likely would have a specific perspective.
● How is the answer different from how you would answer?
● Discuss the results with a partner or as a class/group.
● What if you use a more specific prompt like, “What are the key elements of a face?”
Now, let’s try generating playful AI-generated images that can be added to Scratch projects as sprites or backgrounds. We
want to generate new images, versus searching the internet for an image that has already been created. There are a couple
of pathways to start:
Step 1: Open Bing Chat. Choose “Chat now.” You can generate a text response or an image response. Since you want an
image, specify in your prompt to “generate an image of…”. Note: you must be logged in to a Microsoft account to
access image creation.
Step 2: Alternatively, you can navigate to https://www.bing.com/images/create. Bing uses “Dall-E,” a generative AI system
that can create new images from text prompts.
Step 3: Type in an image prompt like “rainbow cat.” What are the results?
Step 4: What happens if you specify the art style you want (impressionist, cubism, art deco…)?
Adding details increases the chances you’ll get a better result. Try adding adjectives or locations or additional
objects to your prompt, like “rainbow cat wearing sunglasses sitting on a beach, impressionist.”
Step 6: In Scratch, upload the image as a backdrop or as a sprite. (Images may need to be resized in our Paint Editor after
being uploaded, or you may want to remove the background for a sprite image. See our resources below for more
information on that.)
Step 7: Add some code to bring your object to life! Perhaps you want to use blocks from the Looks category to adjust the
color, or Motion blocks to move a sprite around the stage.
Getting the image you want will likely take some iterations. AI image generation doesn’t need to replace the creative process,
but it can become a part of it. The images generated can be a creative starting point. They can be edited inside of Scratch to
add or remove elements. Or, you can combine multiple generated images into one.
We’ve explored some of the opportunities and the limitations of these new technologies, but it is important to reflect on the
possible pitfalls of this emerging technology as well. You could approach this activity as a classroom discussion, debate, or a
persuasive writing exercise.
For instance, when evaluating AI tools, you might look at these criteria Scratch uses to evaluate:
● Fairness: Only use models which have a published fairness evaluation (e.g. low false negatives and false positives
across geographic regions)
● Safety: Maintain the privacy and safety of children
● Responsibility: Gather feedback on questions of ethics and equity from advocates and domain experts
● Transparency: Publicly acknowledge the social concerns about face sensing technologies
● Accountability: Use feedback from our community to inform any future Face Sensing updates
Possible topics and associated prompts include:
Privacy and ● AI systems make predictions, but what happens if the predictions are wrong? If the AI cannot
Surveillance recognize a face during a Face Sensing project the project may not work correctly, but what if
the AI identifies a face incorrectly in other situations? What could be the consequences?
● What information is used to train AI systems? What happens if people do not want their
information included in training data? What are the privacy concerns?
Ethics, Equity, and ● What types of biases might be present in AI text or image generation? Whose perspectives or
Access voices are included in these models and who is excluded?
● What regulations might we put in place to protect intellectual property?
● How could AI generated work affect the livelihood of artists and writers, etc.?
Extension Activities
Below are two learning resources you can use with students to explore the social, civic, and ethical implications of AI.
● The Ethics of Generative AI in the Classroom | Designed by Facing History & Ourselves for 6-9th grades. This
resource includes 3 lessons that facilitate classroom discourse on the impact generative AI tools such as ChatGPT
and DALL-E have on education.
● The Algorithm & Data Literacy Project | Designed by Digital Moment in partnership with CCUNESCO and UNESCO.
These lessons support a wide range of grades and provide interactive opportunities for students to ask critical
questions and generate their own ideas and opinions about the presence of algorithms in our lives and how they
influence our decisions and experiences. This site includes a “Sensing Faces With Scratch Lab” workshop, which
focuses on the way humans and machines identify faces via an unplugged activity and exploration of Scratch Lab
Face Sensing blocks.
Additional Resources
Standards Aligned
Link to full standards Link to full standards Link to full standards Link to full standards
● 1B-AP-09 - Create programs ● 1.1d Technology Operations ● Self-Awareness ● Autonomy
● 1B-AP-10 - Create programs ● 1.2.c Intellectual Property ● Social Awareness ● Competence
● 1B-AP-12 - Modify, remix, or incorporate ● 1.3.b Evaluate Information ● Responsible ● Creativity
● 1B-AP-14 - Observe property rights ● 1.3.c Curate Information Decision-Making ● Diversity, equity &
● 1B-AP-15 - Test & debug a program ● 1.4.b Design Constraints inclusion
● 1B-IC-18 - Discuss technologies ● 1.6.a Choose Platforms or ● Safety and security
● 1B-IC-19 - Accessibility & usability Tools
● 1B-IC-20 - Seek diverse perspectives ● 1.6.b Original and Remixed
Works
Tip: If you’d like to translate this guide, click here to make a copy of this Google doc.