Articles on: Tutorials

How to Label Images and create your dataset for an Object Detection AI model

Label Images for an Object Detection Task Using Label-Studio

1. Login to the labeling tool

Access here:
Then log in to the tool with your Cogniflow credentials.

If you signed up using Google, you must set up a password under your profile settings.

2. Create a Labeling Project

The home page shows all the labeling projects that you have created. If it's your first time, then this is what you see:

Click on Create Project.

3. Name the Project

Enter a name for the project and optionally add a description. Then click on Save button.

4. Import your Images

Click on Upload Files button to upload your images. These file formats are supported for images: jpg, png, gif, bmp, svg, webp. It's recommended to upload batch of images if many. Also, you can upload more images after creating the project and labeling the first ones.

After the images have been uploaded successfully, click on Import to finish the process.

5. Create the Classes to Detect

Go to Settings to create the object's classes you want to train the model to detect.

Click on Labeling Interface at the left panel, then on Browse Templates button on top and finally select the Object Detection with Bounding Boxes template.

You will see this layout:

Now it's possible to add and edit the labels' names and colors via GUI.

If you prefer, you could also create and edit classes by XML code after clicking on the Code button:

For this testing project, we will have two classes, "player" and "referee", to detect both kinds of objects in the soccer images.

After completing the task, hit on Save to keep your changes.

6. Label the Images

Once images are uploaded and the labels created, it's time to start labeling the data. The task is simple: choose the label at the bottom of the image and search for the corresponding objects to encircle them with a rectangular bounding box.

Look how the players are framed inside "player" bounding boxes while the referee is in the "referee" bounding box.

When all objects are labeled, just click on Submit button to save the changes and go to the next images (which will be displayed in the left panel).

7. Export the Labeled Dataset

After all images are labeled, select them all and click on the Export button at the right side of the image.

A pop-up window will be displayed to select the format desired. Choose the YOLO format and click on Export button. A zip file will be downloaded with the images, the labels and some meta-data files.

8. Time to Train an Object Detection Model

Now everything is ready to train an Object Detection model. Go to your dashboard in Cogniflow, click in "Create a new experiment" button, then choose Image based -> Object Detection card, give it a name and description, upload the exported zip file and you are done!

Optional: Check the Labeled Dataset

If you want to check the labeled dataset was correctly generated and exported, first unzip the downloaded file. The following files and folders will be extracted:

The original pictures will be saved in "images" folder, while the labels files (i.e. txt files with the bounding boxes classes and normalized coordinates) will be stored in "labels" folder. The "classes.txt" and "notes.json" files will have the mappings between the classes names and their IDs.

Extra: Invite a Colleague to your Organization to Speed-up the Labeling Process

Click on the drop-down menu at the top left side.

Click on Organization.

Now click on Add People.

A pop-up window will be displayed. Click on Copy link and send it to your friend to have some help while labeling!

Dataset examples

Blood Cells Dataset - BCCD - v3: This dataset has 364 images, with three classes, one for each class of blood cell: White Blood Cells (WBC), Red Blood Cells (RBC) and Platelets. With this dataset you can train an OD model to detect blood cells in images.

American Sign Language Letters - ASLL - v1: This dataset has 1728 images, with twenty-six classes, one for each letter of the alphabet. With this dataset you can train an OD model to detect letters in images of people using sign language.

Soccer Players - v7: This dataset has 163 images, with three classes: player, referee and futbol. With this dataset you can train an OD model to detect players, referees and balls (futbol) in soccer matches images.

Updated on: 28/08/2023

Was this article helpful?

Share your feedback


Thank you!