Skip to content
Related Articles

Related Articles

Machine Learning Model with Teachable Machine

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 15 Jun, 2022

Machine Learning and Artificial Intelligence have raised the level of applications. Many organizations are working on Artificial Intelligence to create an impact on society. Machine learning is the backbone of Artificial Intelligence. But everyone doesn’t know how machine learning works and how to create models that can be used in artificial intelligence. Don’t worry; it is possible now. You might be wondering how? It is super easy for non-coders or coders not from machine learning backgrounds to create a machine learning model and integrate it within the application. In this article, we are going to build a machine learning model without coding a single line.

We are going to create a model for the classification of food items. So, we will be using a food dataset from Kaggle that consists of different food items like Cake, Salad, Potato, etc. You can download the dataset from https://www.kaggle.com/cristeaioan/ffml-dataset.

Teachable Machine

Yes, we are going to do it with the help of a teachable machine. A teachable machine is a web-based application that creates models easily and fastly. It serves three purposes – image, sound, and pose recognition. The good part is it is flexible. It can teach a model to classify images or poses through images or a live webcam. It is free of cost and best for students. The model that is created through Teachable Machine is a real Tensorflow model that one can integrate with a web app, Android app, or any platform. Neither requires a need to create an account. It made everything so simple. 

Let’s Build a Model

Step 1: Go to  Teachable Machine(https://teachablemachine.withgoogle.com/train). You should be directed to the below-shown screen that consists of three options – Image, Audio, and Pose.

Step 2: Choose the image project. You will again see two options, standard and embedded. Choose standard because we are not making it for the purpose of micro-controllers. Well, if you are, then choose Embedded Image Model. Even if you choose Embedded, the entire process will be the same, just the model will be different.

After clicking on Standard Image Project, you will be directed to the below-shown screen, where we will add classes we want to classify with the help of the model. There are two options – either you upload images from the dataset or use the live camera to capture the images.  

Step 3: Now, create classes and start uploading the images, like I am doing. For simplicity, I am creating only three classes – Cake, Salad, and Potato. So, I am replacing class1 with Cake, class2 name with Salad, and class3 name with Potato. You can create as many as you want.

After uploading the images, click on Train Model. You will see different options – Epochs, Batch Size and Learning rate. Don’t worry if you haven’t heard about these in your life. To make the model more efficient, it’s important to play with them and find out at which values model gives the highest accuracy. Of course, there is no meaning in a model if it is not accurate enough. So, you can change their values and find out the best one. Here, I am going with default values.

Step 4: After the model is trained, it’s time to export the model.

When you click Export Model again, you will get several options. Even the code snippets are given to help you integrate the model with your application. Tensorflow.js models work with every JavaScript library or framework. Some frameworks support only a particular type of model. So,  check which ones your framework or library supports.

Downloading the model might take a while, so sit back and enjoy your Coffee. You just created a machine learning model without coding.

Similar to image poses, we can create models for audio and poses also. Let us see how we can do it.

Poses Model

To create the pose model, we have to choose pose project in the teachable machine. In the example, we are creating two different classes for standing and sitting and uploading the respective images. We start training the model after.

When the training is finished, we preview the output of the model by uploading any image to see the output and see the efficiency of the model before exporting it. In the below image, we can see that the output of an image that we uploaded for preview is correct i.e, sitting. It means the model is doing good.

Audio Model

To create a model that detects sound, we will create an audio project. We created three classes – Background Noise, Clapping, Rain and Thunderstorm. After training the model, in the preview section, we used noise to test the model efficiency. And in output of the preview, we can see that the percentage of background noise is higher. To make the model more efficient, we need to add thousands of samples for better learning of the model from the data.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!