Simplify Image Labelling For ML Using Roboflow
Tags: programming, productivity, tutorial, ai
Published: 2022-12-17 20:16:41

While building a machine learning project you probably came across a point in time where you need to decide which tool should I use to annotate my raw images for training and testing purposes. You may ask, why not just go with any one of the available data labelling tools?

## Let's understand the problem 🧐
Labelling and annotating images can be a time-consuming process, especially for large datasets. Humans can make mistakes while labelling and annotating images, which can lead to errors in the final dataset. Different image labelling and annotation tools may use different standards and conventions, which can make it difficult to compare and integrate datasets from different sources. Many image labelling and annotation tools are not designed to handle large datasets, which can limit their usefulness for certain applications. Some image labelling and annotation tools can be expensive to use, which can be a barrier for smaller organizations or individuals.  Some may not be robust enough to handle complex or noisy images, which can lead to incorrect or incomplete annotations. And some may have a steep learning curve or may be difficult for users to understand and use effectively.

## How big is this problem? 🤔
If we take the example of the world's biggest autonomous vehicle manufacturer, Tesla. Their head of AI and computer vision, Andrej Karpathy, revealed that Tesla only has a "few dozen engineers" working on neural networks, but they have a "huge" team working on labelling.

According to Pinterest, they use Amazon Mechanical Turk, which is a distributed workforce who can perform image labelling and similar tasks virtually. At Pinterest, they have a growing dataset of billions of ideas, and they are tasked with showing the right idea to the right user at the right time. Taking advantage of Amazon Mechanical Turk’s powerful crowdsourcing platform, they built a high-quality human evaluation system that could scale with their needs.

Overall big organizations are handling more than a million of images each year and spending a lot of their developer hours into the object annotation process. So this task is a big part of their Machine Learning workflow.

## What is Image Labelling? 🏞
Image labelling is exactly what it sounds like — it's the process of assigning labels or tags to images based on their content. The labels can be used to categorize and organize images, as well as to describe their content in a machine-readable format.

For example, image labelling might involve assigning labels such as "cat," "dog," "car," or "flower" to images of those objects. Image labelling can be done manually by humans, or it can be automated using machine learning algorithms.

Image labelling is an important step in many applications of computer vision, such as object recognition, image classification, and image search.

## Processes involved in Image Labelling 🛠
Image labelling operates on a rather simple basis. Suppose we have 2 NFTs of different collections, one is Bored Ape Yacht Club and another one is Pancake Squad.

- Our first step would be to select the images that need to be labelled. This may involve selecting a specific subset of images from a larger dataset, or it may involve selecting images from various sources if we are trying to take NFT derivatives in consideration.
- The next step is to define the labels or tags that will be used to classify the images. This may involve defining a set of predefined labels, or it may involve creating a custom set of labels for a specific application. We'll use **ape** and **pancake** as our labels.
- The third step is to label the images based on their content. This can be done manually by humans, or it can be automated using machine learning algorithms. We'll go the manual way.
- Once the images have been labelled, it is important to verify that the labels are accurate and complete. This may involve manually reviewing the labels, or it may involve using ML algorithms to check for errors or omissions. Again we'll choose the manual path.
- In some cases, it may be necessary to add additional metadata or context to the images. This process is known as image annotation, and it can involve adding additional labels, text, or other information to the images. We'll skip this one.
- The final step in the image labelling process is to store and manage the labelled images in a way that allows them to be easily accessed and used for further analysis or processing. This may involve storing the images in a database or file system, or it may involve using a specialized image management tool. We'll use an image management tool and file system, but why? Let's discuss it.

## Which products are solving this problem? 🤝
Heartex LabelImg created by Tzutalin is one of the popular choices of labellers but is no longer actively being developed. But, but it's now a part of the Label Studio community. Their cloud platform has just **14 days of free trial**, you can use their cloud or open source product. But if you want to use it in your side projects and prefer browser softwares instead of local installation then 14 days might not be enough for you.

ImgLab is a free and a web based platform, but it lacks various computer vision annotation formats, which are essential if you need to train and experiment with distinct ML libraries and services.

[Roboflow](https://roboflow.com/) provides an image labelling feature that is easy to use and configure to our needs. It's **free-forever** for open-source projects and comes with a pay-as-you-go plan for private projects.

## A technical deep dive 🚀
To understand the technical nuances in depth let's get our hands dirty and witness some of the features of Roboflow.

In a big organization labelling images is not the only problem we have. We must assign each image to the right person, make sure it is reviewed before moving on to the next stage, set labels, structure projects and the list can go on and on. You can use Roboflow to solve all these problems. The amount of features Roboflow provides, it is hard to fit in this one blog, so let's try out some of them. In this hands-on we'll be:

- assigning images to a team member
- annotating these images
- exporting images to a specific format for a machine learning model

Let's now start by creating an account in Roboflow.

```
https://app.roboflow.com/login
```

Connect with a third-party provider or use your email and password to sign up.
![Roboflow Authentication](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2mue7kg5eyx05nu3ulc.png)

The best part of Roboflow is that it provides an interactive user onboarding tour, you can follow that or continue along with me.

I've created a project and named it as NFT Detection, you can choose a name according to your project.
![Roboflow Project Setup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ama2qkwbu4vvv4heum09.png)


We landed on our project page. Roboflow has displayed numerous features on the left sidebar, we'll cover a few of them which are related to image labelling.
![Roboflow Project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukviq5diipx8x86wh4v5.png)

Once we have our Roboflow project up and running, we can upload images, I've added 3 ape and 3 pancake images, I'll just click on `Save and Continue`.
![Roboflow Upload Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b52qe3uwyz5vg0zjf2my.png)

It shows a dialog to assign images to the teammates, as I'm the only person in this Roboflow project, I'll assign these images to myself.

On the Annotate page click on one of the Unannotated images, it'll open a canvas to annotate your image.
![Roboflow Canvas](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72mp0g7wn7zdy0vwvgfs.png)

Choose the Bounding Box Tool from the right hand side panel (if it's not already selected), click and drag the mouse to create as perfect box as you can around your object, and name the label accordingly, I'll name mine one as `ape`.
![Roboflow Annotate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3s198wtldqh4v6mwm2fc.png)

Follow the same procedure as of the above two paragraphs for the other Unannotated images and label them according to the image, I'll label remaining 2 of Bored Ape Yacht Club as ape and other 3 as pancake.

Once we have all the images annotated, we'll click on the `Add 6 images to Dataset` button (the number 6 might be different according to your data).
![Roboflow Annotated](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m22y59r88qeoin6v3v8f.png)

Adjust Train-Valid-Test split or leave it as it is, and proceed to the Generate tab. You can edit preprocessing depending on your use case. I'll remove the Resize preprocessing.
![Roboflow Generate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ppih4kds86zn2201odef.png)

Click on Generate > Export > Format YOLO v7 Pytorch (choose according to your needs) > download zip to computer > Continue.
![Roboflow Export](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yvfbykx96s5fvg0783l.png)

## Conclusion 🥁
There is no limit to Roboflow's features. This blog was created with the intention of piquing interest in this incredible tool that can help you save a ton of time and effort. Check the [docs](https://docs.roboflow.com/) to see all the features. Create an account as soon as possible to begin using [Roboflow](https://roboflow.com/). In case you have some questions regarding the article  or would like to talk about anything feel free to connect with me on [LinkedIn](https://www.linkedin.com/in/musabshakil/) ✌️

_Special thanks to [Neurala](https://www.neurala.com/), @aniket762 and [owaiskhan](https://www.kaggle.com/owaiskhan9654)_

> If you run an organization, and want me to write for you or you are hiring for a software engineer position please do connect with me 🦄