- 05 Aug 2024
- 5 Minutes to read
- Print
- DarkLight
- PDF
Segmentation
- Updated on 05 Aug 2024
- 5 Minutes to read
- Print
- DarkLight
- PDF
This article applies to these versions of LandingLens:
LandingLens | LandingLens on Snowflake |
✓ | ✓ (see exceptions below) |
Segmentation is used to identify objects with great precision. This is done by using a "brush" or Smart Labeling to mark the exact location of an object you want your model to detect. This object type is commonly used for identifying irregular shapes.
Let’s say you want to identify cracks in cement. You could use Object Detection; however, bounding boxes would include too much background (or space that you do not want to include in your label). During model training, the model will look at every labeled pixel. If you include extra, unimportant pixels, the model might think these pixels are also important. Instead, use Segmentation so that you can precisely label the relevant areas. Compare the labeling options in the following images:
Labeling Tools for Segmentation
Segmentation offers the following tools to label objects. You can mix and match tools when labeling.
- Smart Labeling: Click an area to auto-detect objects. Smart Labeling is not available in LandingLens on Snowflake.
- Polygons: Create a shape to fill the object you want to detect. You can also use this tool to "erase" labeled regions.
- Brushes: "Paint" over the object you want to detect. You can also use this tool to "erase" labeled regions.
- Polylines: Create lines over the object you want to detect.
Label with Smart Labeling
Smart Labeling is a labeling tool powered by the Segment Anything Model (SAM) that helps you label objects in Segmentation projects faster than using traditional methods.
To use Smart Labeling, simply select the tool (or press Q), hover over and click the object you want to select. Smart Labeling automatically detects the shape of the object and adds a gray overlay to it. To confirm that Smart Labeling detected the correct object, press Return (Mac) or Enter (Windows) to confirm.
Label an Object with Smart Labeling
To label an object with Smart Labeling:
- Click the Smart Labeling icon if it isn't selected, or press q.
- Select the Class you want to label from the drop-down menu.
- Hover over the object you want to select. Smart Labeling adds a gray overlay over the object it "thinks" you want to select.
- Click the object. Smart Labeling adds a green dot where you clicked. This, along with the gray overlay, help you track what regions you've selected. Clicking the object also adds a blue border to your frame, which indicates that you're using Smart Labeling.
- If you want to add another region to the same object, hover over that region. The cursor turns into a + (plus).
- Click the object. Smart Labeling adds a gray overlay to the object and adds a green dot where you clicked.
- You can continue to add regions using this method.
- Once you've labeled all regions of the object, either click Save Labels (Return), or press Return (Mac) or Enter (Windows).
- Smart Labeling labels the object with the selected Class.
Remove a Region from a Selection
Let's say a region gets accidentally added to your selection. While Smart Labeling is selected, you can hover over that region until the cursor turns into a − (minus). Then click that region. Smart Labeling removes the selection. When you're done, press Return (Mac) or Enter (Windows).
To remove a region from an object (assumes that Smart Labeling is enabled, and you just labeled an object):
- Hover over and click the labeled region. Smart Labeling removes the overlay and adds a red dot where you clicked, which helps you track what regions you've removed.
- Continue to click selected regions until you've removed all the selections you want.
- When you're done removing regions, press Return (Mac) or Enter (Windows).
Tips for Labeling Multiple Objects in an Image
Let's say you're developing a model that detects tractors in construction sites. When using Smart Labeling, we recommend that you label each tractor one at a time, instead of labeling them all at once. In other words, label one tractor, and then press Return (Mac) or Enter (Windows). Then label the second tractor, and so on.
We don't recommend labeling all tractors at once, and then clicking Enter/Return. Doing that makes Smart Labeling think that these areas are the same object, and not the same type of object. If you do this, you might notice additional areas added to the object that aren't actually part of that object.
Label with Polygons
The polygon tool lets you draw an outline of a shape. After the outline has been completed, the shape will be automatically filled. You can also use this tool to erase labeled regions.
To label with polygons:
- Open the Segmentation project you want to edit.
- Open the image you want to label.
- Click the Polygon icon. (You can also press W on your keyboard.)
- Select a class from the drop-down menu.
- Click where you want to start your shape. A blue circle displays, indicating the start of the shape.
- Click to continue creating your shape.
- Complete your shape by clicking the blue circle. The shape automatically fills with the color of the class.
Label with Brushes
The brush tool lets you paint over the object of interest. You can also use this tool to erase labeled regions.
To label with brushes:
- Open the Segmentation project you want to edit.
- Open the image you want to label.
- Click the Brush icon. (You can also press B on your keyboard.)
- Select a class from the drop-down menu.
- Adjust the size of the line width accordingly.
- Click and drag your cursor to "paint" over the area you want to identify.
- Release the mouse to complete your edits.
Remove Excess Labels with Brushes
To remove excess labels with a Brush:
- Open the Segmentation project you want to edit.
- Open the image you want to label.
- Click the Brush icon. (You can also press B on your keyboard.)
- Click the Erase icon. (You can also press E on your keyboard.)
- Adjust the size of the eraser accordingly.
- Click and drag your cursor over the area you want to remove.
- Release the mouse to complete your edits.
Label with Polylines
The polyline tool lets you create lines over the object of interest.
To label with polylines:
- Open the Segmentation project you want to edit.
- Open the image you want to label.
- Click the Polyline icon. (You can also press L on your keyboard.)
- Select the class you want to label from the drop-down menu.
- Adjust the size of the line width accordingly.
- Click where you want to start your line.
- Click to change the direction of your line.
- Press Enter on your keyboard to complete your edits.