A great way to use what children already know about narrative and character development to support new learning about AI.
ステップ 1: 理解する
How does it work?
In this project you’ll train a machine learning (ML) model to recognise different ways that you move a soft toy with a BBC micro:bit attached to it. You’ll choose movements to help you retell a story.
You will then combine the machine learning model with a Microsoft MakeCode program, and the micro:bit will play sounds or show images when these movements are detected.
機械学習とは何ですか?
機械学習 (ML) は、コンピュータがデータに基づいて学習し、意思決定できる人工知能 (AI)の一種です。
ML モデルは、たとえば micro:bit をさまざまな方法で動かしたときに、さまざまな「アクション」を認識するなど、決定を下すのに役立つよう人がトレーニングします。
必要なこと
AI systems need humans to design, build, test, and use them.
First, you will need to decide if you want to use the movements we have provided, or choose different movements that work for your own story. Our story is about a bear called Lucy who wants to be a gymnast, so we have chosen movements that fit this theme: jumping, rollling, and sleeping.
You will then collect data to train the ML model, test it, improve it and combine it with computer code to make a storytelling device that uses AI, using a micro:bit and the micro:bit CreateAI website.
We’ve also included some evaluation questions to compare this AI project with one that just uses normal algorithms and code.
ステップ2: プログラムする
必要なもの
- micro:bitと単4電池2本が入る電池ボックス
- A computer (e.g. desktop, laptop, or Chromebook) with access to the micro:bit CreateAI website, using a Chrome or Edge web browser
- コンピュータにBluetoothが搭載されていない場合は、micro:bit V2が別途必要になります。
- A soft toy and a strap and holder, or another way to attach the micro:bit to your toy (e.g. flexible craft stems or elastic bands)
- You may also find our micro:bit CreateAI teaching tips useful
データサンプルの収集
When you open the project in micro:bit CreateAI, you’ll see we’ve given you data samples for some suggested movements for your soft toy (jumping, rolling, and sleeping):
You can add your own soft toy movement samples using the micro:bit's movement sensor, its accelerometer.
jumping
rolling
sleeping
In micro:bit CreateAI, click the ‘Connect’ button to connect your data collection micro:bit and follow the instructions.
Attach the data collection micro:bit to your soft toy. It’s important that all the samples are recorded with the same placement of the micro:bit on the soft toy. If you want to use the ready-made samples in the project, attach the micro:bit around the neck of the soft toy facing forward, as shown in the picture below. If you want to change how the toy wears the micro:bit, replace all the provided data samples with your own.
Add your own movement data samples for jumping, rolling and sleeping. Click on each action in turn, then click ‘record’ to take a short sample of each.
間違えた場合は、不要なサンプルを削除できます。 micro:bit のボタン B を押して記録を開始することもできます。
Examine the data samples: do all the ‘jumping’ samples look similar? Do all the ‘rolling’ samples look different to ‘jumping’ and ‘sleeping’?
モデルのトレーニングとテスト
「モデルのトレーニング」(Train model)ボタンをクリックしてモデルをトレーニングし、テストします。
Bounce your soft toy up and down to see if ‘jumping’ is shown as the estimated action. Put the soft toy down to sleep and see if ‘sleeping’ is estimated. Test if ‘rolling’ is detected when you turn the soft toy head over heels.
Ask someone else to move the toy and see if it works as well for them.
モデルの改善
ほとんどのモデルは、より多くのデータを学習させることで精度を上げることができます。 アクションを認識するためにモデルの改善が必要な場合には、「← データ サンプルを編集」(← Edit data samples)をクリックします。
You can clean your data set by deleting any samples which you think don’t fit (because they look completely different from other samples for the same action). また、自分自身や他の人からのサンプルを追加してモデルを改善することもできます。
Think about all the positions your soft toy might ‘sleep’ in, you’ll notice the x, y, and z lines change their order depending on the angle of the micro:bit.
モデルを再度トレーニングし、再度テストします。
モデルとプログラムをmicro:bitに入れる
micro:bit CreateAI で、「MakeCode で編集」(Edit in MakeCode)をクリックすると、MakeCode エディターでプロジェクトのプログラムが表示されます。
他の micro:bit MakeCode プロジェクトと同じようにプログラムを変更したり、そのまま試したりできます。
USB データ ケーブルで micro:bit を接続し、MakeCode 画面の 「ダウンロード」ボタンをクリックして、指示に従って AI モデルとプログラムを micro:bit に転送します。
Unplug the micro:bit, attach a battery pack, position it on your soft toy and test it.
プログラムの仕組み
The 'on ML… start' blocks are triggered when the ML model decides your toy has started one of the actions it has been trained to detect. Different sounds play and different icons are shown on the micro:bit's LED display depending on the action it has estimated your soft toy is doing.
The 'on ML… stop' blocks are triggered when the ML model decides your toy has finished an action. Code inside each block clears the screen and stops all sounds.
An extra block, ‘on ML unknown start’, clears the screen if the model is not sure which action your toy is doing.
評価
Compare this project with the Sensory toy project that also uses the accelerometer sensor to react to different movements but which does not use machine learning or any other kind of AI.
- What kinds of movements, or actions, can the Sensory toy project react to?
- What is different about the kinds of actions the AI storytelling friend project can react to? Are they simpler or more complex?
- What other actions might you want to train the ML model to recognise?
- Which project is better at helping you tell your story?
ステップ 3: 拡張する
- Explore different movements with your AI storytelling friend, and change the actions to suit a well-known folk story or fairytale.
- Use the ‘show LEDs’ block in place of the ‘show icons’ block to customise the icons to match your story. You could plan your customised icons using the LED planning sheets.
- If you have a class mascot, use CreateAI to train the mascot to respond to movements that give feedback to students e.g. give praise or reward class points.
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.