How to label data for YOLOv5 training

Before you can train a computer vision model, you need labeled data on which to train your model. The more accurate the labels, or annotations, are, the higher the performance the model will achieve.

Overview

In this guide, we are going to show how to use Roboflow Annotate a free tool you can use to create a dataset for YOLOv5 Object Detection training. You can use data annotated in Roboflow for training a model in Roboflow using Roboflow Train. You can also export your annotations so you can use them in your own YOLOv5 Object Detection custom training process.

Roboflow offers a robust annotation platform that:
‍‍

  • Uses state-of-the-art technology
  • Complies with SOC II Type 2 requirements
  • Trusted by 800,000+ developers

To train data for a YOLOv5 Object Detection Object Detection model, you will:

  1. Import data into Roboflow Annotate
  2. Open an image
  3. Label data with bounding boxes or polygons
  4. Try Label Assist for automated labeling
  5. Save the annotated data
  6. (Optional) Train a model or export your data

Let's get started!

YOLOv5 and Image Annotation Resources

Explore these resources to enhance your understanding of YOLOv5 Object Detection and image annotation techniques.

Import data into Roboflow Annotate

First, create a free Roboflow account. Then, create a new project from the Roboflow dashboard:


Once you have created a project, you will be taken to a page where you can upload your images. Drag-and-drop any images into the box:


You can also drag in annotation files if you want to view or amend annotations in Roboflow Annotate.

When you have uploaded your files, click "Save and Continue".

Your images will be uploaded to Roboflow.

Open an Image

After you have uploaded all of your images, click on one to open:

Once you have opened an image, you will see the Roboflow Annotate interface, through which you can create bounding boxes, segmentation masks, classification labels, and polygon annotations, depending on your project type.

Since this is an Object Detection project, we can either create bounding box or polygon annotations.

Label Data with Boxes or Polygons

To draw a bounding box, select the box tool in the right sidebar of Roboflow Annotate, or press "b" on your keyboard. Then, drag where you want to draw your bounding box:

Your bounding box should be drawn tightly around the object you want to annotate. Tight bounding boxes allow the model you are training to better understand what the specific object is you want to identify. Review our labeling best practices for more data annotation tips.

You can draw a polygon for object detection or semantic segmentation using the Polygon annotation tool. To toggle polygon annotation mode, press "p" on your keyboard, or click on the icon below the bounding box icon in the Roboflow Annotate sidebar.

You can also use Smart Polygon to generate annotations by clicking an object of interest.

To enable Smart Polygon, click the cursor icon in the right sidebar. There are two versions of Smart Polygon:

  1. Standard, which is ideal for small items
  2. Enhanced, which is ideal for most use cases

Let's use Enhanced Smart Polygon to label solar panels.

With Smart Polygon enabled, you can click on an object to create a polygon annotation. Polygon annotations can be used for object detection and segmentation tasks.

Annotate Images with Label Assist

Roboflow Annotate comes with a tool called Label Assist with which you can label images. Label Assist lets you use:

1. A model trained on the Microsoft COCO dataset, that can identify 80 classes

2. Any of the 50,000+ public trained models on Roboflow Universe

3. Previous versions of your model

To use Label Assist, click the magic wand icon in the sidebar. Roboflow Annotate will recommend new annotations based on the model you have selected as your assistant.

Save Your Annotation

Once you have finished annotating your image, you can move on to the next image you want to annotate! To do so, click the forward or backward arrows at the top of the Annotate interface, or use the forward and backward arrows on your keyboard.

Train a Model or Export Data

With all of your data labeled, you are now ready to train a model on Roboflow or export your data elsewhere. To train a model in Roboflow with your data, follow our Roboflow Train guide.

Alternatively, you can export your data into over 30 different formats, depending on the needs for your project.

Automatically Label Data with Autodistill

Using Autodistill, you can automatically label data for object detection, segmentation, and classification. To learn more about using Autodistill, check out our Autodistill guide.

Learn how to label data for other models

Roboflow Learn is split up into six parts, starting with computer vision foundations and ending with deployment and advanced concepts.