# Sugar Cam Tutorial: Teachable Machine Model Training

### Teachable Machine Online Model Training

### [Teachable Machine with Google](https://teachablemachine.withgoogle.com/train)

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FSV7rf1eMCKEn35vG6IF0%2Fimage.png?alt=media&#x26;token=83d83dfb-a132-4ba3-990f-f16867f5ec68" alt=""><figcaption></figcaption></figure>

Create an Image Project and select Embedded image model.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FmQhSQlzzYu0h2TTaPlwp%2FScreenshot%202023-08-11%20114838.png?alt=media&#x26;token=cef3dbcb-fed9-4bf9-8f61-d12f4ab1c88c" alt=""><figcaption></figcaption></figure>

The video from Sugar Cam is used for the training. Cick Device and the click Connect, the video feed from Sugar Cam should appear. Press Record to add image samples to the current class.

{% hint style="info" %}
The maximum number of classes for Teachable Machine is 8, but the number of image samples per class is not limited.

Teachable Machine uses black-and-white images with resolution of 96x96, make sure the objects can be clearly distinguished from each other.
{% endhint %}

<div data-full-width="true"><figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FZiEMjaNABfYom6Ure9cc%2Fd.gif?alt=media&#x26;token=4098d3bd-d83b-41e2-8495-533b75305ec4" alt=""><figcaption></figcaption></figure></div>

Click Train Model to begin training, click Connect Device to verify the trained model.

<div><figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FfTxfRi9w7FlaC0SbP87b%2Fimage.png?alt=media&#x26;token=ba8d1d58-539b-4256-8ad4-1980f601b399" alt=""><figcaption></figcaption></figure> <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2F6zvoUFn3ichGr61Pekfe%2Fimage.png?alt=media&#x26;token=f14c4478-fe5d-44b9-8216-087310f678f7" alt=""><figcaption></figcaption></figure> <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FYYiXIjOhscDIMGKX5UXt%2Fimage.png?alt=media&#x26;token=6241dad6-1fe2-46a9-ab49-add24c232fce" alt=""><figcaption></figcaption></figure></div>

### Export the Teachable Machine Model

Click Export Model and choose TensorFlow Lite, choose TensorFlow Lite for Microcontrollers. Click Download my Model.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2Fa7ge1sypTO3ThySFGEb6%2Fimage.png?alt=media&#x26;token=2d7af067-90c2-4856-b4b1-30b73bc90a2d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FeTiYww650PyiSpEYRipZ%2Fimage.png?alt=media&#x26;token=c03b44cd-43b9-4a87-baaa-a3027291f67f" alt=""><figcaption></figcaption></figure>

Go back to serial\_ws.exe, upload converted\_tinyml.zip to Sugar Cam, click connect again, the predicted results are shown the bottom left corner.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2F3WLuqc7v4S9p3LrxDOhe%2Fdd.gif?alt=media&#x26;token=0e2c5671-e456-47df-907a-c36f671a671f" alt=""><figcaption></figcaption></figure>
