Design and Train Your Machine Learning Model With Teachable Machine — Thunkable Tutorial

Part 1 of Machine Learning + Cloud Run + Thunkable

Sofía Galán
Geek Culture
5 min readApr 4, 2021

--

Code + No Code Tools.

Ok so to be clear, this tutorial does include some knowledge in python, basic flask, and google cloud services. I will cover it as much as I can but if you’re stuck my tip is to look at their proper documentation.

So it’s safe to say this tutorial is a hybrid of no-code and real code. This is neat if you got yourself started on making apps in no-code tools. The cool thing about no-code tools is that you don’t need to become an expert in everything in the field and once you learn how to code external APIs and connect them to Thunkable you can do (almost) anything.

Overview of this tutorial.

PART 1 — Design and train your Machine Learning Model with Teachable Machine (This one!)

PART 2 — Custom API for Thunkable using Cloud Run

PART 3 — Machine Learning App in Thunkable.

Final Product:

PART 1: Design your Machine Learning Model with Teachable Machine

Machine Learning

I’m no expert in machine learning so basically whatever I tell you where I got it from different sources. So here is a fancy definition from the Machine Learning crash courses by Google Highly recommend checking it out.

In basic terms, Machine Learning is the process of training a piece of software, called a model, to make useful predictions using a data set. This predictive model can then serve up predictions about previously unseen data. We use these predictions to take action in a product; for example, the system predicts that a user will like a certain video, so the system recommends that video to the user.

For the rest of this post, I will reference Machine Learning as ML.

Teachable Machine 2.0

Making your Model

Teachable Machine 2.0 is a friendly no-code approach to train ML from Google. You can train it to recognize poses, objects, or even sounds. You record or upload images/videos to the site and it automatically does everything for you.

Teachable Machine is pretty straightforward, you start a new project by clicking ‘Get Started’. It prompts you to open an existing model from Google Drive or your computer. But if you’re getting started, you can select the type of model you will like to build. This can either be, recognizing images, sounds or poses.

Select the project of your liking, the projects all look the same the main difference is the input of the model. When you start the project you will be shown the following screen which lets you add different classes for your model to detect. If you’re detecting between different objects this can be really useful, for example, different items in your house like mugs, pets, yourself, etc. You only have to upload data for all your classes and that’s pretty much it.

Train and test your model.

Ok, so you are done adding all the classes for your project. Now you can train your model. For this, you can easily just click the button ‘Train Model’ or you can make some adjustments to the model. It will take a couple of seconds, don’t close the tab and it’ll boot up your webcam so you can start testing it right away.

It’s pretty fast so I encourage everybody to play with every version of it, think about different ways you can solve problems with them.

My project for this tutorial

For this project, I decided to make a model that recognizes different things like an apple or my dog. So here are my categories:

  • Me :)
  • My dog Frida.

When designing a machine learning model, we must prep our data with multiple scenarios. I will include these different variables in my data:

  • Lighting → No light, shadows, early morning or late at night. Warm light / White light. All related to how to subject is lighted.
  • Shot Angle → I will try to capture a 360º angle of my subjects.
  • Distance → Get the subject up close and really far.

Sharing and exporting your Models

You can then share that model as an URL so somebody else can play with it or in any of their Tensorflow formats. You can send your model to anyone with your sharable link or download it to any project you have.

Files for our next steps:

For our code what will be using is a slightly modified version of their Tensorflow format: keras. We will export our .h5 file and use it later on.

Some extra Notes.

Play with Teachable Machine. It’s a fun time. (ps. their tutorials are worth checking out) They have a cereal identifier with a servo motor that is to die for.

--

--

Sofía Galán
Geek Culture

SWE @ Axiom Cloud / How-To Guides & Tutorials for Afterwork DIYs