Teachable Machine Tutorial: Head Tilt

Barron Webster
4 min readNov 7, 2019

--

Hi! This is a tutorial for Teachable Machine, a web-based tool that makes creating machine learning models fast, easy, and accessible to everyone.

In this tutorial, I’m going to walk you through making a machine learning model to detect which way my head is tilted using pose detection.

What’s pose detection, you may ask? It means that from a picture of a person, we can estimate their pose — where their arms, legs, head, and joints are.

There are also two other tutorials — one making a machine learning model using Images, and one using Poses.

So, to get started, I’m going to go to Teachable Machine, and open up a pose project.

HOW TO TRAIN

To start training the machine, we first have to create different categories, or classes, to teach it with.

First, I’ll make three classes. One called “No Tilt”, one called “Left Tilt”, and one called “Right Tilt.”

Then, I’ll add some pose samples for each of these classes. I’ll start with “No Tilt” and record a bunch of samples of me not tilting

(If you need to record samples without holding the button down, you can go into the settings panel and turn off “Hold-to-record”, and it will count down and then record a set of samples automatically.)

So now I’ll record some samples of me tilting my head left…

And some samples of me tilting my head right…

So now that I’ve got some samples in each class, I can click train…

and once the model is trained, see how it works!

Uh-oh 1: training assumptions

But what if I move back in the frame? Or move around left to right?

It’s less certain which way my head is tilted. That’s because it didn’t learn from any examples where I was standing this far away from the webcam.

So, to get it to work better, I’ll have to give it more examples of me tilting my head left and right all over the place. And I could probably give it some examples where my head is tilted and my arms are in different places, so it learns mostly to factor my head tilt and not accidentally correlate one of the classes with an arm position.

So now it can tell if I’m tilting my head close to the camera…

And a little farther away.

OTHER THINGS TO TRY

This is just a start. There are other ways you could test the robustness of your model:

Does it work with other people?

Or multiple people? Or… what if you’re upside down?

WHAT CAN YOU DO WITH THIS?

You can actually export your model to make things with it if you like!

I exported this model and made this website with it on Glitch, that you can try out if you like. You could also use this model to play a game, control hardware, or more.

You can learn more about using your models in the Teachable Machine FAQ here.

WHAT NOW?

If you’re interested in peeking behind the scenes, you can open this project to see all the samples and try it out.

If you want to try making your own model, go to Teachable Machine.

Or, you can read about how to make an image model to detect the ripeness of bananas or how to make an audio model to detect snaps, claps and whistles.

--

--