A.I. Apprentice, you and your partner are ready to apply the knowledge you have gained to make your own A.I.!
Your mission is to:
train a machine model that can recognize colors
create a chameleon in Scratch that will change color to match its background
Essential questions: How does teaching a computer to recognize colors through machine learning enhance your understanding of artificial intelligence, and how can this knowledge be applied to create interactive and adaptive programs like the Chameleon in Scratch?
This is a project from the Machine Learning for Kids website. You can download the worksheet here. The creative idea originated from Cassie Evans. You can see her version of it at https://codepen.io/cassie-codes/details/ZjErdL.
Your first task is to teach the computer to recognize colors using machine learning.
Go to the Machine Learning for Kids website. Click Get Started and log in.
Click on “Projects” on the top menu bar.
Click the “+ Add a new project” button.
Name your project "Chameleon” and set it to learn how to recognize “images”. Click the “Create” button
5. You should see "Chameleon" in your list of projects. Click it.
6. Click the "Train" button.
7. Choose 3 colors you want to train your computer to recognize. Click "+ Add new label." Type the first color you chose. For this example red is the first color selected. Click "Add." Do this again for the other two colors you selected. For this example, the colors green and blue are selected.
8. Click the webcam button for your first color. Now you will start adding images for that color. Use the webcam to take photos of images of that color. You may also use images from the web. You may drag pictures from a browser window and drop them in the bin. Repeat until you have twenty examples in each color. How can you make sure that you are providing images that will help the computer recognize the colors correctly?
9. Once you have enough images for each color, click "< Back to Project." It is now time for the computer to learn from all the images you have provided. Click "Learn & Test." Click "Train new machine learning model."
This process may take a few minutes. Once it is done you can test the model by giving images to identify if it is one of your colors. Make sure you use images that were not included in the training.
You’ve started to train a computer to recognize color of a picture. You are doing it by taking example photos. These examples are being used to train a machine learning “model”. You are doing supervised machine learning because of the way you are supervising the computer’s training. The computer will learn from patterns in the colors from each of the photos you have given it. These will be used to recognize new photos.
Is your computer able to recognize colors? If you think your computer needs more training you may go back to "Train" page and provide more image examples. The success in building a chameleon in Scratch depends on how you trained your machine model. So if you think your model is not ready yet, keep training it.
If your computer has been trained properly you can start creating your chameleon in Scratch.
Click "Back to Project" and the click "Make."
Click "Scratch 3" and then "Open in Scratch 3"
On the left side of Scratch you will notice that under "My Blocks" you have "chameleon." This is your trained model.
3. Now click "Project Template" on top. Click "Chameleon."
4. Click on the "Costumes" tab. You can use this chameleon template, modify it or create your own chameleon costume.
5. Right-click on the “outline” costume, and click “duplicate”.
6. Name the duplicate costume the name of your first color. It’s important that the name matches exactly, or your script won’t work.
7. Use the paint bucket Fill tool to color in the chameleon costume.
8. Duplicate the outline costume again, name it exactly after the second color, and use the fill bucket to color the chameleon.
9. Repeat the steps again for the third color.
10. Click the "Code" tab.
11. Create the following code:
Now it's time to test your chameleon. Click on the Green Flag. Hold something in front of your webcam to give the chameleon a new background. Use something that you didn’t use to train your machine learning model. Does your chameleon change color to match it's background or do you need to re-train?
Now it's time to improve the code.
Do one of these or come up with your own changes:
1. Style your chameleon - You don’t have to have a plain chameleon. Why not try designing your own camouflage styles?
2. Cheeky chameleon - Try adding a fourth bucket to your training data, with ten or more photos of you sticking your tongue out.
Add another costume of the chameleon and draw on a tongue sticking out. When the machine learning model recognizes you sticking your tongue out, you can switch to this costume, so your chameleon sticks out its tongue too!
You are nearing the completion of your mission. Here are the final steps:
Download the final Scratch code for your chameleon and upload it in Google Classroom.
Complete the AI Training Evaluation Worksheet with your partner. There is a copy of this worksheet in Google Classroom.
Complete the Peer and Webquest Evaluation Form individually. This form is also in Google Classroom.
Congratulations!
This marks the culmination of your journey as an A.I. Apprentice.