Image Classification using Google's Teachable Machine


In this article you will learn about machine learning, image classification and how to use the googles teachable machine for training the models.

Machine learning

Machine learning is a subset of AI (artificial intelligence) which is used to develop the models and algorithms using which we can make our computers learn and make the decision without programming it explicitly. This is an effective way to teach machines to learn from the given data and improve the performance by time. Computers can learn the task and make predictions or find any pattern using data which shows the scenario about what we should take out next step.

Image Classification

Image classification is a machine learning process using which we assign the labels to the images. This is very popular in the computer vision sector. By classifying the images we can use the model to identify object, activity, images and scenes. Image classification is used in various tasks like face recognition, object detection. You can see some image dataset from the kaggle platform.

Google’s Teachable Machine

Google's Teachable Machine provides us a web-based interface and tools using which we can train the machine learning model for the classification of images.

We use these tools to identify the objects, image, scenes and sound classification. This platform provides us feature to train the model and export it in your local system or we can also publish it online for free to use the server based architecture using URL.

Step to Create image Classification Project Using Google Teachable Machine

To use Teachable Machine, you first need to create a project. To create the project we will go to Googles Teachable Machine website and click on Get Started.

After that step, new window will open where it will show us three kinds of project type as Image Project, Audio Project and Pose Project. So, we want to create the image classification model therefore we will choose the Image project option. And it will ask if we want Standard Image Model or Embedded Image Model so we will choose Standard Image Model. Here Standard Image model will create model of Tensorflow and mobile machine learning models whereas Embedded will create model of embedded systems like microcontrollers.

Next step we will create different classes related to our classification. We will have to add names to the class and provide the images related to that class. Take example: we want to create cat class so we will provide the images of cats similarly for the dog class we will provide the images related to dogs.

Here we created classes as cat and dog and you can also add more classes according to your needs. Now we will provide trainable images to this model. For this model I have saved some cat images and dog images by surfing websites and stored into my local computer in different folders.

Now we will use the upload button and use the option to choose images from the file and upload the available images of cat and dog and we will choose all the image files and upload all the images of that particular category. Like for cat we will upload images related to cat only so that it will label the images correctly.

From the below image you can see we uploaded the images in both the classes by selecting the images from the file. The model will label the images which are given in class name.

Now we will use the train model button to start training the model based on provided images Teachable Machine will automatically generate the model. We can also click and customize the training requirement when we will choose the advanced dropdown from the training option then it will ask for customizing the Epochs, Batch Size, Learning Rate.

  • Epochs − One epoch means each sample in the training dataset has been fed at least once. Like if epochs is 20 then the model will get trained through the entire dataset 20 times. So we can say the larger epochs will train the model better to predict the image.

  • Batch Size − Batch size is set of sample images which is used in the training within one iteration/traversal. LIke we have 50 images and our batch size is 10 then it will be splitted into 50/10=5 iteration. Means in one iteration it will use the 10 images to train the model. Once all the 5 batches are completed then it will be considered as 1 epochs completion.

  • Learning Rate − This is a hyper-parameter which is used to control the weight of neural network.

After that we will click on the train model option and it will take some time to start training the model.

Now it will give the option to preview the model by exporting the model in our local file. To check the working of the model we can use the option of choosing from file or using the camera option too. So, I choose the file option and choose one dog image and it will predict the output as dog.

From the above image you can see we choose the dog image using select from file option and it predicted the output as dog with confidence level as 100%.

Note − If we are not satisfied with the performance of the model, then we can continue our model training until it will predict better. After the training we can either download the model or use the link

Here are some tips for using Teachable Machine −

  • Use high-quality images. We should provide high-quality images to the model, the better the quality of our images, the better our model will perform.

  • Labeling the images. We should carefully label our data image with the correct class.

  • Train our model for longer period of time. As you learned, the maximum epochs will be, the better our model will perform.

  • Testing our model frequently. We should perform testing of our model to get to know about how well it is performing and we can also make adjustments as needed.

Conclusion

So, we learned about machine learning which makes our computer learn , Image classification using which we can train models to identify objects and we learn to use the Google Teachable Machine. This platform makes the process very simple of the process of building custom image classification. Person who doesn’t have extensive coding knowledge can also make their model. We can label the images, train the model and use it in the python application to make very effective image recognition systems. We saw all the processes by following them. We created our model and using an example we checked our model accuracy. You can also add more classes into this project and provide the image related to that particular category which will work as additional labels. Using Google Teachable Machine we can also create other models like audio based models which can be used to build the voice recognition applications and we can also create pose base models which can be used to identify the different body postures like in yoga or body movement. So, you learned to create your own model without a hectic process of coding.

Updated on: 06-Oct-2023

187 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements