/tm2scratch

Connect Google Teachable Machine with Scratch

Primary LanguageJavaScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

TM2Scratch

Read this in other languages: English, 日本語.

TM2Scratch connects Google Teachable Machine 2 with Scratch 3. You can use image, audio recognition on Scratch project(Please use TMPose2Scratch for pose recognition).

How to use

Image recognition

  1. On Google Teachable Machine website, create an image classification model and upload it.

  2. Copy the sharable link.

  1. Open https://stretch3.github.io/ on Chrome browser.

  2. Open "Choose an Extension" window and select "TM2Scratch".

  3. Paste the shareble link into the text field of "image classification model URL" block.

  1. You can use the image recognition results with "when received image label" blocks.

Audio recognition

  1. On Google Teachable Machine website, create a sound classification model and upload it.

  2. Copy the sharable link.

  3. Open http://champierre.github.io/tm2scratch on Chrome browser.

  4. Open "Choose an Extension" window and select "TM2Scratch".

  5. Paste the shareble link into the text field of "sound classification model URL" block.

  1. You can use the sound recognition results with "when received sound label" blocks.

  1. NOTE The camera image that is trained on the Teachable Machine is a square, whereas the camera image that appears on the Scratch stage is a horizontal rectangle. Note that the horizontal edges of the camera image are ignored, and the image in the center is used to recognize. (This is not a problem as long as the object to be judged is in the center of the image.)

For Developers - How to run TM2Scratch extension on your computer

  1. Setup LLK/scratch-gui on your computer.

    % git clone git@github.com:LLK/scratch-gui.git
    % cd scratch-gui
    % npm install
    
  2. In scratch-gui folder, clone TM2Scratch. You will have tm2scratch folder under scratch-gui.

    % git clone git@github.com:champierre/tm2scratch.git
    
  3. Run the install script.

    % sh tm2scratch/install.sh
    
  4. Run Scratch, then go to http://localhost:8601/.

    % npm start
    

Demo & Links

  • TM2Scratch + micro:bit Extension