Testing in Scratch 3 from ML4KIDS

11 views
Skip to first unread message

Ms. Kelly Powers

unread,
Nov 21, 2025, 4:05:53 PM (12 days ago) Nov 21
to Machine Learning for Kids
I have two student image classification projects that aren't working when we test it in Scratch.  I'll share the description of one here:

One team has 3 simple classes to classify: Compost, Recycle Products, and Trash. When we use training data to test it in Scratch 3 ( because our test data was failing), the training data fails.

I would imagine that all training data has a good chance of being classified correctly since the model was trained on those pictures. Are we doing something wrong? 

We uploaded the training images to the Scratch Backdrops, and I attached just one piece of code that I was using to recreate their issue.  Can you share any wisdom?  I also included a copy of the picture that was classified as trash. ( A vest) 

Kelly
Screenshot 2025-11-21 at 3.57.03 PM.png
Screenshot 2025-11-21 at 3.56.55 PM.png

Dale Lane

unread,
Nov 21, 2025, 4:09:36 PM (12 days ago) Nov 21
to Machine Learning for Kids
Your Scratch code has a couple of issues that I recommend fixing. 

1. if model is ready to use then...
This approach means that if the model isn't ready when you click the Green Flag, nothing will happen. 
wait until model is ready to use would perhaps be a better choice.

2. if <binary image data> equals <result from asking the image classifier to classify the word "Recycle"> then...
That comparison will never return true.
I think you meant to write:
if <the word "Recycle"> equals <result from asking the image classifier to classify binary image data> then... 

Kind regards

D

Dale Lane

unread,
Nov 21, 2025, 4:18:24 PM (12 days ago) Nov 21
to Machine Learning for Kids
When writing / debugging Scratch code, a useful tip is to click on blocks on the canvas to understand the value they represent. 

That can help you to understand the meaning of the code, especially where you're doing something like an equals comparison that isn't matching when you expect 

Some examples:
screenshot-1.pngscreenshot-4.png
screenshot-2.pngscreenshot-3.png

Dale Lane

unread,
Nov 21, 2025, 4:27:37 PM (12 days ago) Nov 21
to Machine Learning for Kids
One last question - are you sure you want to use the backdrop image block?

Obviously I cannot know without understanding the rest of your Scratch project, but in case it helps to clarify things...

Consider this Scratch project:

screenshot-costume-0.png

That green "costume image" sprite will be returning this image:
costume-0.jpg

In other words, the image for the current costume of the sprite, regardless of whether the sprite is currently hidden, or if another sprite happens to be obscuring it. 

It is the current costume image for the sprite where the code block is running.



Maybe that is what you want?

Alternatively, consider this Scratch project:
screenshot-backdrop-0.png

That green "backdrop image" block will be returning this image:
backdrop-0.jpg

In other words, it shows what is currently visible on the backdrop at the location of the sprite.

It will include any other sprites that are visible, and any current backdrop.


Maybe that is what you want?


Alternatively, consider this Scratch project:
screenshot-backdrop-1.png

That green "backdrop image" block will be returning this image:
backdrop-1.jpg

In other words, it returns the current contents of the Stage, including the backdrop and all visible sprites.


Each of these are useful for different types of projects. It depends on what you want to give to the machine learning model to recognise. 

Which block is the right one for your project? 

Kind regards

D

Powers, Kelly

unread,
Nov 22, 2025, 6:10:24 AM (12 days ago) Nov 22
to Dale Lane, Machine Learning for Kids
Dale, 
Thanks again for helping us through our unit of study. We often do decompose the blocks to test them individually. You highlighted two new pieces of information/knowledge for us that we didn't know: 

1.) The stage backdrop/sprite analysis used to classify an image
2.) Better use of designing classification projects with costume sprites over backdrops
3.) Logic used for evaluating the Sprites/Backdrop was incorrect. We should have caught this error by clicking on blocks as you suggested. 

if <the word "Recycle"> equals <result from asking the image classifier to classify binary image data> then... 

This is going to help at least 3 of my teams. Thanks again for all of your help!

Kelly

From: mlfo...@googlegroups.com <mlfo...@googlegroups.com> on behalf of Dale Lane <dale...@gmail.com>
Sent: Friday, November 21, 2025 4:27 PM
To: Machine Learning for Kids <mlfo...@googlegroups.com>
Subject: [mlforkids] Re: Testing in Scratch 3 from ML4KIDS
 
--
https://machinelearningforkids.co.uk
---
You received this message because you are subscribed to the Google Groups "Machine Learning for Kids" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlforkids+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/mlforkids/2a574a3a-1137-47ac-8806-43ef384f87b7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages