In the Segmentation tool, each annotated pixel in an 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 object in the image.
Configure the Segmentation tool
During project setup, you can setup your ontology by adding all of the objects and classifications needed for your project.
- Create a project.
- Select "Image 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".
The pen drawing tool is designed to be the fastest way to outline objects. It allows you to draw freehand as well as straight lines. You can also use the pen tool to erase, just click the (-) icon in the top bar. Tip: Hold Alt on your keyboard to temporarily switch to the erase mode while you draw.
The Superpixel tool will only appear in the tool bar when you are using the segmentation tool.
For segmentation features with complex boundaries, using the Superpixel tool first may be more efficient than using the pen tool alone. The Superpixel works by calculating segment clusters of similarly colored pixels in the image.
In the top toolbar is a slider, which allows you to increase or reduce the size of segment clusters. The number corresponds to segment size; higher values will have larger segments and lower values will have smaller segments.
After you have selected the optimal segment cluster size, you can choose an object class and use your cursor to select and classify each segment to be included in that segmentation feature. You can then adjust the boundaries using the pen and eraser tools.
Draw over existing objects
This functionality used to be named "Draw to back". "Draw over existing objects" is now on by default.
With this tool, you can overwrite existing segmentation features. When this tool is enabled, a new segmentation feature drawn over existing features will overlap the existing features, overwriting previously classified pixels. When this tool is disabled, a new segmentation feature drawn over existing features will be drawn behind the existing features.
This tool was designed to significantly speed up labeling time since it is not required to intricately outline around the border of other objects.
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, the file will be structured as follows. The
instanceURI field is unique to the JSON files exported from the segmentation tool. The value for
instanceURI is a URL to the image mask.
"title": "Orange Fish",
"title": "Is the fish blurry?",
"title": "Orange Fish",
"title": "Blue Fish",
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.