Back to Cvat

Layers

site/content/en/docs/annotation/annotation-editor/layers.md

2.71.06.4 KB
Original Source

What Are Layers in CVAT?

Layers in CVAT are used to manage the display order of objects on the canvas. Each object is placed on a separate layer, and the layer's position determines whether the object appears above or below other objects when they overlap.

Adjusting the display order is especially useful when working with overlapping polygons and masks, where you need to change how objects are displayed without modifying the annotations themselves.

Layer Stack Panel

The Layer Stack panel allows you to view and change the layer order. It's displayed in the sidebar. To open it, do one of the following:

  • Click Open Layer Stack in the lower-right corner of the canvas.
  • Select Sort by Layer in the sidebar.

Once open, the panel displays a list of layers for the current frame.

Panel Interface

The Layer Stack panel lists objects in the order determined by their assigned layers. Each layer appears as a layer card; the objects placed on it appear as object cards nested underneath.

IconElement nameDescription
Open Layer StackOpens the Layer Stack panel and displays the number of the active layer.
Compact layersRenumbers layers starting from 0 while preserving their current order. This is useful when layer numbers become non-consecutive after objects are moved or deleted.
Collapse/Expand All LayersCollapses or expands object cards in the sidebar. When collapsed, only the layers remain visible, making the list more compact.
Select as current layerHides objects located on layers above the selected layer, so you can focus on editing objects on the current layer and the layers below it.
Layer numberDisplays the layer number.
Layer visibility statusDisplays the current visibility status of the layer on the canvas.

Working with Layers

Moving Objects Using Drag and Drop

Drag an object or layer card in the Layer Stack panel to change its position against other layers on the canvas. When you drop it, the object (or group of objects) is placed on a new layer created at that position.

  1. Click and hold the left mouse button on an object or layer card in the Layer Stack panel.
  2. Drag the object or layer to the desired position in the list.
  3. Release the mouse button to place the object or layer in the new position.

You can also drag an object onto an existing layer to move it there:

  1. Click and hold the left mouse button on an object card in the Layer Stack panel.
  2. Drag the object card onto the target layer.
  3. Release the mouse button so that the object moves to that layer.

Merging layers

Drag one layer onto another to merge them. All objects from the dragged layer move to the target layer, and the original layer is deleted.

  1. Click and hold the left mouse button on a layer card in the Layer Stack panel.
  2. Drag the layer onto another layer.
  3. Release the mouse button.

Moving an object to background / foreground

These commands move an object to the bottommost layer (Move to Background) or the topmost layer (Move to Foreground). CVAT creates a new layer for the object automatically.

  1. Click the button on the object card.
  2. Select Move to Background or Move to Foreground.

Moving an object to one layer backward / forward

These commands move the selected object one layer forward (Move to One Layer Forward) or one layer backward (Move to One Layer Backward) on the canvas.

  1. Click the button on the object card.
  2. Select Move to One Layer Backward or Move to One Layer Forward.

Moving an object to a specific layer

This command moves an object to a layer you specify.

  1. Click the button on the object card.
  2. Select Move to layer... from the menu.
  3. Enter the number of the layer you want to move the object to.
  4. Click OK.

Compacting layers

The Compact layers command removes gaps in layer numbering while preserving the current order, renumbering layers consecutively starting from 0. For example, the sequence 0, 2, 5, 8 becomes 0, 1, 2, 3.

Gaps typically appear after you delete or merge layers, or move objects between them. Use Compact layers to clean up the numbering:

  1. Open the Layer Stack panel.
  2. Click Compact layers.

The layer numbering updates automatically.

Collapse/Expanding layers

This setting allows you to collapse or expand object cards in the Layer Stack panel, for all layers at once or for an individual layer. When collapsed, only the layers are listed and the object cards they contain are hidden. This doesn't affect object visibility on the canvas.

Displaying Layer Numbers on the Canvas

This setting allows you to display the layer number in an object's text description on the canvas, so you can identify an object's layer without opening the Layer Stack panel.

To enable it:

  1. Press F2 to open the settings, then go to the Workspace tab.
  2. Add the Layer parameter to the Content of a text field.

The layer number then appears in the text description of each object on the canvas.