Table of Contents

Segmentation

Alex Cota Updated by Alex Cota

You can use the image segmentation tool to create mask annotations. The segmentation tool is often used to label images for applications that require high accuracy.

Import image data

To learn how to import your images directly, see Direct upload. To learn how to import your images URLs via JSON, see Import via JSON. To learn how to attach metadata to your imported images, see Asset metadata via JSON.

To learn how to import programmatically, see Bulk add data rows.

Set up Image segmentation

Follow these steps to set up your ontology with Image segmentation.

  1. Create a project.
  2. Select "Editor" as your label editor.
  3. Click "Add object".
  4. Select "Segmentation" as your labeling tool and name the Object.
  5. [OPTIONAL] Configure nested classifications.
  6. Click "Confirm".
  7. Click "Complete setup".

To see a sample script for setting up your project’s ontology programmatically, see Project setup script.

You also have the option to reuse ontologies from other projects. To learn more, see Ontology overview.

Segmentation-only tools

Pen tool

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.

Superpixel

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.

In the top toolbar is a slider, which allows you to adjust the size of segment clusters from XS to XL. After you select 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.

Calculation time for Superpixel segments increases with image size. We advise using images that are no more than 4000 by 4000 pixels.

Creating instances

From the Editor, you can create instances of your Object classes in your ontology. 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.

To create multiple instances of the same object:

  1. Select a class from the Tools menu and draw the object.
  2. Select the class again.
  3. Draw the next instance of the object.

Label format

To learn how to export your annotations, see How to export labels. To see a sample export for Image segmentation see Label export formats.

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.

Was this page helpful?

Image classification

Contact