TM Teachable Machine GitHub

TurboWarp extension · user guide

Turn movement into project input.

The extension connects a Teachable Machine Pose, Image, or Audio model to TurboWarp. Your camera frame or microphone audio becomes label probabilities that scripts can read as labels, scores, and Boolean conditions.

Camera previewLIVE
INPUT

PROBABILITIES
Current label
jump0.91

Kamishibai DSL 4.0 bundle

Open the Teachable Machine manual from the combined palette

Click the documentation button immediately below the Teachable Machine member heading. The bundled blocks retain the model URL, recognition, preview, label, score, threshold, and lifecycle behavior described here. The TurboWarp TM 2.0.0 package line keeps the public lifecycle opcodes startRecognition, stopRecognition, and isRecognizing, with no legacy aliases. Configurable SVG pose overlay blocks remain available in pose mode, while image mode uses label scoring without keypoints. Latest-needed model initialization and cancellation controls remain host APIs documented under Composition API.

Quick start

From model to motion in four steps

You need a published Teachable Machine Pose, Image, or Audio model, the matching camera or microphone permission, and network access. Load the extension as a custom extension with Run extension without sandbox enabled, then place these blocks in order.

1

Train and publish

In Teachable Machine, give each class a useful name such as jump, card, or clap. Export the model and copy its share URL.

2

Set the model URL

Paste the model folder URL. A missing trailing slash is added automatically.

3

Start recognition

Allow camera or microphone access. The extension starts the required input and loads the model automatically if needed.

4

Use the result

Read the top label, test one class, or use a confidence value to control your project.

when green flag clicked
set model URL tohttps://teachablemachine.withgoogle.com/models/…/
start recognition
forever
if label is jump with confidence at least0.75

How it works

One input, several useful answers

While recognition is running, the extension repeatedly samples the selected camera or microphone input, runs the model in the browser, and stores a probability for every class in your model.

current label is the class with the highest probability. confidence is that class’s score, rounded to two decimal places. confidence of [NAME] reads one named class.

The preview sits on the stage

The preview is a camera canvas placed over the TurboWarp stage. It does not become a sprite and does not change model input when hidden. It is mirrored by default, and can switch between mirrored and unmirrored while the camera is running without changing recognition input.

Version 1.11.0 overlays the 17 recognized PoseNet joints and 12 standard bone connections as SVG by default. Blocks control visibility, each joint's color, opacity, and radius, shared bone color, opacity, and width, the minimum confidence, and independent confidence scaling for those visual properties.

The extension requests a normal Canvas2D context for its owned camera canvas. Physical-camera measurements of the 320x240, one-draw/one-read path did not show a repeatable end-to-end benefit from willReadFrequently; the hint helped a different read-heavy condition with four or more reads per draw, but could make video drawing more expensive. Chrome may therefore emit its Canvas2D readback warning during CPU inference. Other TurboWarp canvases are unchanged, and hosts do not need a global Canvas or Console patch.

camera
top-lefttop-rightbottom-leftbottom-rightcenterfull-stage

Start and stop are explicit

  • start camera opens the camera and displays the preview.
  • start recognition starts the required input and loads the model when necessary.
  • stop recognition clears live results, stops audio listening, and leaves the camera available.
  • stop camera stops recognition, releases media tracks, and removes the preview.
  • hide camera preview only changes what is shown; recognition can continue.

Composition hosts

Prepare only the model the story still needs

The composition API lets an application host cancel obsolete model demand while camera startup continues independently. The first inference waits for both the active input and one registered model.

Independent work and synchronization

SHA checks for separate PoseNet files run in parallel. Shared descriptor verification overlaps classifier loading, but unverified bytes never reach TensorFlow. Camera getUserMedia() and video.play() may run alongside the complete model path.

Latest-needed wins

Create the composition with modelInitializationPolicy: 'latest-needed' and pass an AbortSignal to registerPoseModel(). At most one heavy request is active and one newest request is pending. A cancelled model is never published to the registry.

Choosing a result

React now—or smooth motion over time

Default builds expose immediate probabilities. Builds that enable the optional temporalPoseScoring feature also expose accumulated scores for steadier decisions.

Default

Current confidence

Best for quick gestures. The answer follows every frame, so it reacts fast but may flicker near a decision boundary.

confidence per framethreshold

Use label is [NAME] with confidence at least [THRESHOLD]?. Thresholds are clamped to 0–1; 0.75 is a practical starting point.

Optional feature

Accumulated score

Best for sustained poses. Evidence is added over elapsed time while older evidence decays, reducing one-frame changes.

accumulated scorethreshold
previous × decayseconds + probability × accumulation × seconds

The reporter returns an empty label until the best positive score reaches the threshold. Hidden-tab time is excluded. Stopping recognition or resetting clears all accumulated scores.

Block guide

Pick the block for the job

Reporter values are empty or zero before the first usable recognition result and after recognition stops. Boolean status blocks are useful when coordinating startup.

Model setup

Configure and check the Teachable Machine model.

  • set model URL to [URL] changes the model and clears the previously loaded one.
  • load model fetches model.json and metadata.json.
  • model is loaded? reports readiness.
  • Teachable Machine version reports the extension build.

Camera and preview

Control capture separately from recognition.

  • start camera · stop camera · camera is running?
  • refresh camera list detects available video inputs.
  • set camera to [CAMERA] · default, front, back, or a detected device
  • camera count · camera device ID · camera device name
  • show camera preview · hide camera preview
  • camera preview is visible?
  • set camera preview opacity to [OPACITY] clamps opacity to 0–1.
  • set camera preview position to [POSITION]
  • set camera preview to [MIRRORING] · mirrored (default) or unmirrored
  • camera preview mirroring reports the current setting.
  • set pose overlay [VISIBILITY] · pose overlay is visible?
  • set [PART] joint color [COLOR] opacity [OPACITY] radius [RADIUS]
  • set pose bone color [COLOR] opacity [OPACITY] width [WIDTH]
  • set pose overlay minimum confidence to [CONFIDENCE]
  • set pose [PROPERTY] confidence scaling [STATE]

Camera labels may appear only after permission is granted. Device IDs are browser- and machine-specific. Switching a running camera preserves the model, recognition state, and preview settings; a failed switch attempts to restore the previous camera.

Recognition and results

Start the loop, read scores, and make decisions.

  • start recognition · stop recognition · recognition is running?
  • current label · confidence · confidence of [NAME]
  • label is [NAME]? uses a fixed 0.75 threshold.
  • label is [NAME] with confidence at least [THRESHOLD]?

Timing and errors

Measure startup and show useful failure details.

  • camera startup time (ms)
  • model load time (ms)
  • first recognition time (ms)
  • last error keeps the latest runtime error message.

Optional accumulated-pose blocks

These blocks appear only when the extension build enables temporalPoseScoring: set accumulated pose accumulation [ACCUMULATION] decay [DECAY], set accumulated pose threshold [THRESHOLD], reset accumulated pose scores, accumulated pose, accumulated score, and accumulated score of [NAME]. Decay is the fraction retained after one second (0–1), and a decay change takes effect the next time recognition starts.

Troubleshooting

When the result is not what you expect

Check last error first. Most setup failures come from permissions, an incorrect model URL, blocked network requests, or loading the extension in the sandbox.

The camera does not start

Allow camera permission for the TurboWarp page and make sure another application is not exclusively using the camera. The page must run in a secure context (HTTPS or localhost). Then run start camera again.

The model does not load

Use the published Teachable Machine model folder URL—not a link to the editor or an individual JSON file. The extension appends model.json and metadata.json to that URL. Confirm that the network allows jsDelivr and Teachable Machine model hosting.

The label is unstable

Add more varied training examples, keep the whole body visible, improve lighting, and test a threshold such as 0.75. If your build exposes accumulated-pose blocks, use them for a pose that must be held for a short time.

The preview is missing but recognition works

Run show camera preview, set opacity above zero, and choose a supported position. Packaged projects with a modified stage DOM may not support preview attachment; last error explains stage-detection failures.