0% found this document useful (0 votes)
21 views12 pages

ML - Worksheet: Alien Language

Uploaded by

Elpiniki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views12 pages

ML - Worksheet: Alien Language

Uploaded by

Elpiniki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Alien Language

In this project you will train the computer to understand an alien


language.

You’ll use that to control an alien character so that it can understand


what you tell it to do.

This project worksheet is licensed under a Creative Commons Attribution Non-Commercial Share-Alike License
http://creativecommons.org/licenses/by-nc-sa/4.0/

Page 1 of 12 Last updated: 9 September 2022


This project requires a microphone. If you don’t have a computer with a microphone, you
might prefer to try a different worksheet.

1. Go to https://scratch.machinelearningforkids.co.uk/

The next few steps only work with Google Chrome.


If you don’t have access to Google Chrome, skip to step 5 and start from there.

2. Load the Speech to Text extension


Click on the Extensions (plus) button in the bottom left, and then choose
Speech to Text from the list.

3. Using the new Speech to Text blocks, create the following scripts.

Page 2 of 12 Last updated: 9 September 2022


4. Click on the Green Flag and give it a try
Say “left” or “right”. The cat should move in the direction that you tell it
to. Try and move it back and forth across the screen using your voice.
It can be difficult to get it to work. Try to speak calmly and clearly.
If it doesn’t work, modify your script to show what it thinks you’re saying:

What have you done so far?

You’ve used speech recognition to control a character in Scratch. To get


this working quickly, you’ve used a machine learning model that has
already been trained for you. This is a general machine learning model
that has been trained to recognize English dictionary words.

Next, you’ll train a machine learning model for yourself to see how it was
done.

For the next part of the project, you’ll use your voice to control an alien
character that doesn’t understand English! You’ll invent two new words,
that wouldn’t be found in an English dictionary, to control your character
and train a machine learning model to recognize them.

Page 3 of 12 Last updated: 9 September 2022


5. Invent your alien language!
You need two words – an alien word for “left” and an alien word for
“right”. Invent new words that wouldn’t show up in an English dictionary.
They can be random noises as long as you can repeat them in the same
way every time and will be recognisably different from each other.
If you don’t want to make weird noises with your voice, that’s okay - find
other ways to make noises. You can click your fingers, clap your hands,
squeeze a squeaky toy or do anything else you can think of!

6. Go to https://machinelearningforkids.co.uk/

7. Click on “Log In”

8. Click on “Try it now”

9. Click on “Projects” on the top menu bar

10. Click the “+ Add a new project” button.

11. Name your project “Alien Language” and set it to learn how to
recognise “sounds”.
Click the “Create” button

Page 4 of 12 Last updated: 9 September 2022


12. You should now see “Alien Language” in the list of your projects.
Click on it.

13. Click on the Train button to start collecting examples.

14. Click on the Add example button in the background noise bucket
Recording background noise will help your machine learning model to tell
the difference between the sounds you will train it to recognize, and the
background noise where you are.

15. Click the microphone to record 2 seconds of background noise

Page 5 of 12 Last updated: 9 September 2022


16. Click the Add button to save your recording

17. Repeat that until you have at least 8 examples of background noise

18. Click the Add new label button in the top right, and create a new
training bucket called “left”

Page 6 of 12 Last updated: 9 September 2022


19. Click the Add example button in the new left bucket

20. Record at least 8 examples of your alien noise for “left”

21. Click the Add new label button in the top right, and create a new
training bucket called “right”

Page 7 of 12 Last updated: 9 September 2022


22. Record at least 8 examples of your alien noise for “right”

23. Click the “Back to project” link in the top left

24. Click the Learn & Test button

25. Click “Train new machine learning model”

Page 8 of 12 Last updated: 9 September 2022


26. Once the training is finished, click the Start listening button to test
your machine learning model
Make one of the sounds you’ve trained the computer to recognize as
meaning “left” or “right”. If your machine learning model recognizes it, it
will display what it thinks you did.

27. If you’re not happy with how the model is working, go back to the
Train page and add more examples to all three training buckets.

28. When you’re happy with your machine learning model, click on the
Make button

29. Click on the Scratch 3 button and then click Open in Scratch 3

30. Click on the Project templates button at the top of the screen and
open the “Alien Language” project template

Page 9 of 12 Last updated: 9 September 2022


31. Add the following script to the alien sprite
There are already some scripts in the alien sprite to put it in the right place
at the start and animate how it walks. Don’t delete these.
You can add these scripts underneath them.

32. It’s time to test! Click the Green Flag


Make your noises for “left” and “right” to tell the alien which way to walk.

Page 10 of 12 Last updated: 9 September 2022


What have you done?

You’ve trained your own machine learning model to do speech


recognition. You used that to control a character in Scratch.

Unlike the pre-trained model you used before, which has been trained to
recognize tens of thousands of words, you’ve only trained it to recognize
two different words. But the principle is the same.

You’ve also seen the importance of training the machine learning model
to work with a certain background noise.

Can you think of an example of a system like this you’ve seen used
before? For example, some cars use speech recognition systems that have
been trained to recognize the different commands you can give to the in-
car computer. What other examples have you used?

Page 11 of 12 Last updated: 9 September 2022


Ideas and Extensions

Now that you’ve finished, why not give one of these ideas a try?

Or come up with one of your own?

Add new commands

Try adding two more training buckets for “up” and “down” so
you can control the alien to move in all four directions.

Page 12 of 12 Last updated: 9 September 2022

You might also like