Table of Contents
Updated by Alex Cota
When you label an image with the Segmentation tool, each annotated pixel in the image belongs to a single class. It is often used to label images for applications that require high accuracy. The output is a mask that outlines the shape of the item in the image.
Configure the Segmentation tool
To learn more about how ontologies work, see Ontology overview.
- Create a project.
- Select "Editor" as your label editor.
- Click "Add object" and name your object.
- Select "Segmentation" as your labeling tool.
- [OPTIONAL] Configure nested classifications.
- Click "Confirm".
- Click "Complete setup".
Use the Pen tool to outline items in the image. Hold the cursor down to draw freehand or let the cursor go to draw straight lines between points. Select the (-) icon to draw around an area to erase. The Pen tool is only available when creating Segmentation annotations.
Draw over existing objects
"Draw over existing objects" is on by default. When this tool is enabled, drawing a new Segmentation annotation over an existing annotation will overwrite previously classified pixels. When this tool is disabled, a new Segmentation annotation drawn over an existing annotation will be "drawn behind" the existing annotation.
This tool is designed to significantly speed up labeling time since it is not required to intricately outline around the border of other objects. This tool is only available when creating Segmentation annotations.
For Segmentation annotations with complex boundaries, using the Superpixel tool first may be more efficient than using the Pen tool alone. Superpixel works by calculating segment clusters of similarly colored pixels in the image. The Superpixel tool is only available when you are creating Segmentation annotations.
In the top toolbar is a slider, which allows you to adjust the size of segment clusters from XS to XL. After you have selected a segment cluster size, choose an object from the left Tools panel and use your cursor to select and classify each segment to be included in that Segmentation annotation. You can then adjust the boundaries using the Pen and Eraser tools.
From the labeling interface, you can use the same class for more than one annotation. For example, if there are 5 fish in an image and you would like to assign the "Fish" class to all five, you can create multiple instances of the "Fish" class.
Follow these steps to create multiple instances of the same object:
- Select a class and draw the object.
- Select the same class again.
- Draw the next instance of the object.
If you have configured the interface to have nested classifications for any of your objects, the labeler will be presented with classification questions after the annotation of the object.
When you export your labels as a JSON file, it will look like the sample below. The
instanceURI is a URL to the image mask.
Convert mask to polygon coordinates
If you need to convert your vector masks to polygon coordinates, you can use this script here. You will need to pip install labelbox first. See our Getting started page in our Python docs for installation instructions.