Guide for Sound Classification Model with Marty the Robot

This guide explains how to import a sound classification model from Teachable Machine and have Marty the Robot respond to predictions in MartyBlocks.

Users new to Teachable Machine should review the following videos to learn about how to create a classification model:

Step 1: Create a sound classification model on Teachable Machine

Go to the Teachable Machine website, select “Get Started,” and create a sound project.

Follow the instructions from Teachable Machine to define your classes, collect sound samples, and train your model.

Step 2: Export your model from Teachable Machine

In the preview panel, select “Export Model.”

In the dialog box that appears, confirm that “Upload (shareable link)” is chosen and select “Upload my model.”

Image for Step 2.1

It will take a few seconds to save your model, then copy the shareable link URL that is generated.

Image for Step 2.2

Step 3: Add the Teachable Machine extension to MartyBlocks

Open MartyBlocks and select the add extension icon in the lower left corner.

Image for Step 3.1

Select the “Teachable Machine Image & Sound” extension.

Image for Step 3.2

Step 4: Import your Teachable Machine model

From the Teachable Machine menu, select the “sound classification model URL” block and drag it into the workspace.

Image for Step 4.1

Paste your classification model URL from Teachable Machine into the block and execute the command to import the model.

Image for Step 4.2

Step 5: Make classifications in MartyBlocks

Sound classifications should start automatically after importing the model. You may toggle classifications on and off using the “turn classification” block.

Image for Step 5.1

Once you have executed the command to import your classification model, the class labels will be available for selection in some blocks. There are a few ways to make predictions:

Event handler:

Image for Event handler

Boolean:

Image for Boolean

Variable:

Image for Variable

To see the value of the “sound label” variable, check the box beside the variable in the Teachable Machine menu.

Image for Step 5.2

Step 6: Changing the classification rate and confidence threshold (optional)

To make changes to the rate of classifications, use the “Label once every seconds” block

To make changes to the confidence threshold, use the “set confidence threshold” block. The default confidence threshold is 0.5 (i.e. 50%).

Image for Step 7.1