Skip to main content
Data Groups let you put individual files into groups so that they are easier to annotate and review together. They unlock multi-tile and multimodal labeling. Data Groups are similar to image groups, but they can hold any data type (images, videos, audio files, text files, PDFs and DICOM series), and they support grid, carousel and custom layouts in the Label Editor.
You can use Data Groups in non-Consensus Projects and Consensus Projects with Review & Refine nodes. Determine Consensus nodes are not yet supported.
  • For an end-to-end example of how you can use Data Groups, go here.
  • For instructions on exporting labels go here.
  • To label Data Groups, including adding a classification to a whole Data Group, see Data Groups & Label Spaces.
Deprecated (SDK v0.1.195): Working on a Data Group’s child label rows directly — by passing include_children=True to list_label_rows_v2(), or by reading DataGroupMetadata.children — is deprecated. Work on the Data Group parent instead, and access each child through its Label Space with LabelRowV2.get_spaces(). See Data Groups & Label Spaces for the full workflow. The examples on this page use the parent-based approach.
Time series files in a Data Group share the group’s timeline. To keep a time series synchronized with a video in the same group, index the CSV by video frame (a frame column) instead of by time (for example time_ms). See Align Time Series with Video.

Create Data Groups

Each code example in this section does the following:
  1. Specifies the files (data units) to add to each Data Group.
  2. Creates the Data Groups and sets their layout in the Label Editor.
  3. Adds the Data Groups to a Dataset.
  4. Adds the Dataset to a Project.
Some examples create several Data Groups in one call with create_data_groups. To create a single Data Group, use create_data_group instead. It takes one group and returns one UUID.

Rules for Creating Data Groups

Encord checks the following when you create a Data Group. If a check fails, the call raises an error.
  • You need Admin access to the folder you create the Data Groups in, and access to every file you add.
  • You can’t create Data Groups in a cloud-synced folder. Create them in a different folder.
  • Grid and carousel Data Groups need between 2 and 50 files. Custom layouts can show up to 50 tiles.
  • Each file can appear only once in a Data Group.
  • A Data Group can’t contain another Data Group, an image group, a scene, or a single DICOM file. To group DICOM data, add DICOM series.
  • If you don’t give a name, Encord names the Data Group data-group- followed by 8 random characters.
  • create_data_groups can create up to 1,500 Data Groups per call. It sends all the groups in one request. If any group fails a check, none of the groups are created.
  • In the SDK, only custom Data Groups (DataGroupCustom) accept settings such as read-only tiles, a fixed layout, or multi-layer labels. DataGroupGrid and DataGroupCarousel have no settings field. If you pass settings to them, the SDK ignores it without raising an error, and the Data Group is created without those settings.
To use settings with a carousel layout, create a DataGroupCustom with a single DataUnitCarouselTile as the layout. This matches the layout Encord builds for DataGroupCarousel:
For a grid layout, build the grid yourself with LayoutGrid and DataUnitTile, as shown in Data Group - Custom.
You can’t change a Data Group’s files, layout or settings after you create it. To make a change, create a new Data Group. See Change the Layout or Settings of a Data Group.

Data Group - Grid (Default)

Grid Data Groups allow you to arrange multiple data units in a fixed, ordered grid within the Label Editor. Encord arranges the data units in a near-square grid, in the order you list them. You don’t choose the number of rows or columns. 3 data unit Data Group Grid 12 data unit Data Group Grid Requirements To display data units in a grid layout, you need:
  • A list of data unit UUIDs in the exact order they should appear in the grid.
  • A DataGroupGrid(...) for each Data Group you create.
Example

Data Group - Carousel/List

The order of data units in a Data Group determines how they are arranged in the Label Editor. In the carousel/list layout, a scrollable panel on the left shows all data units in the Data Group, while the currently selected data unit appears in the main editor view. Requirements To display data units in a carousel layout, you need:
  • A list of data unit UUIDs in the exact order they should appear in the carousel.
  • A DataGroupCarousel(...) for each Data Group you create.
You can also pass a plain list of UUIDs to create_data_group or create_data_groups. Each list creates a carousel Data Group. See Create a carousel from a list of file IDs.
Example
Pass a list of file IDs instead of a DataGroupCarousel to create a carousel Data Group with a generated name.

Data Group - Custom

Custom Data Groups give you full control over how multiple data units are arranged in the Label Editor. Unlike grid or carousel layouts (which use ordered lists of UUIDs), custom layouts use keys:
  • Map keys to data unit UUIDs.
  • Build a layout tree that references those keys and defines:
    • Split direction (“row” or “column”)
    • Space split (“splitPercentage”)
    • Where each tile (data unit) appears in the Label Editor
Custom Data Groups can be configured using plain Python dictionaries or ORMs.
  • Using Python dictionaries — a lightweight, flexible approach
  • Using ORMs — a more structured approach with stronger typing and validation
Both approaches are functionally equivalent. Choose the one that best fits your workflow.
To create a custom data group, you must define a layout, layout contents, and (optionally) settings. These components work together to control how data units are displayed and behave.1. Define the layout structureThe layout defines how the Label Editor is split and which data units appear in each section. Layouts are expressed as a tree of containers and data unit tiles.
2. Provide layout contentslayout_contents maps each layout key to a data unit UUID. Every key referenced in the layout must be defined here.layout_contents is a dictionary in both approaches.
3. (Optional) Configure tile settingsTile settings let you control behavior such as making a tile read-only (is_read_only) or showing a title in the tile’s toolbar (title). Settings reference the same keys used in the layout. LayoutSettings also has fixed_layout, which stops annotators from adding, removing or changing panes, and has_multilayer_labels (see Multi-Layer Data Groups).
4. Create the Data GroupFinally, create the Data Group by passing the layout, layout contents, and settings.DataGroupCustom accepts layout and settings as ORM objects or as dictionaries, so this step is the same for both approaches.
Layout rulesEncord rejects a custom Data Group that breaks any of these rules:
  • split_percentage (splitPercentage in dictionaries) must be between 5 and 95.
  • For a DataUnitCarouselTile, carousel_size must be between 10 and 70, and carousel_position must be "left", "right", "top" or "bottom".
  • Every key in layout_contents must appear in the layout, and no key can appear twice. The only exception is keys listed in timeline.
  • Keys in tile_settings must be keys in layout_contents, and at least one tile must not be read-only.
  • timeline is an optional list of keys for audio and time series files. These files appear in the timeline instead of as tiles. Only audio and time series files can go in the timeline. If every key is in timeline, you can leave out layout.
A simple layout: left panel (instructions) and right panel (image). The instructions tile is read-only, and each tile shows a title in its toolbar.Simple Custom Layout

Data Groups with Audio and Time Series

Audio and time series files can appear in the timeline, under the tiles, instead of as tiles. Create a custom Data Group and list their layout keys in timeline. Only audio and time series files can go in the timeline, and every key in layout_contents must be in either the layout or timeline. To keep a time series synchronized with a video, index the CSV by video frame. See the note at the top of this page.

Data Groups for DICOM Studies

To annotate DICOM data at the study level, create one Data Group per study that contains every series in that study. You can then classify the entire Data Group to apply labels to the whole study. The following example lists the DICOM series in a folder, groups them by their Study Instance UID (dicom_study_uid), and creates a carousel Data Group for each study. Studies with more than 50 series are split across multiple Data Groups, because Data Groups are limited to 50 data units.
Data Groups are created in the same folder as the DICOM series. Running the script again creates duplicate Data Groups, so run it once per set of series. The script adds only the Data Groups it creates to the Dataset.

Auto Data Groups with Grouping Manifests

Grouping manifests in the SDK require version 0.2.2 or later of the encord SDK.
A grouping manifest tells Encord how to group the Files in a Folder into Data Groups. It is the same configuration you create for Auto Data Groups in the Encord app. Each Folder can have one grouping manifest. Working with a grouping manifest takes two steps:
  1. Save the manifest on the Folder with save_grouping_manifest(). Saving a manifest does not group any Files.
  2. Apply the manifest with apply_grouping_manifest(). This groups the Folder’s ungrouped Files and puts the new Data Groups in another Folder. Cloud-synced Folders are grouped automatically after each sync, so you don’t need to apply the manifest yourself.
You need Admin access to the Folder to save or apply a manifest.

Write a Grouping Manifest

A GroupingManifest holds one or more DataGroupRule objects. Each rule creates Data Groups from the Files it matches. All manifest classes are imported from encord.orm.storage. Create each member rule with one of the following: All three methods accept exclude, a list of glob patterns for Files to leave out. Paths are relative to the Folder.
  • If id has placeholders, every member rule must use from_simple_pattern() or from_regex(), and the member rules must capture every placeholder in id.
  • A Data Group never changes after Encord creates it. Changing a manifest affects only Data Groups created afterwards.

Save a Grouping Manifest

save_grouping_manifest() replaces any manifest the Folder already has. If Encord rejects the manifest, for example because a regular expression is not valid, the call raises InvalidArgumentsError.

Get and Update a Grouping Manifest

get_grouping_manifest() returns the Folder’s manifest, or None if the Folder has no manifest. To change a manifest, get it, change it, and save it again.

Apply a Grouping Manifest

apply_grouping_manifest() groups the Folder’s ungrouped Files with its saved manifest, and waits for the run to finish. Use it after you upload Files to a Folder that is not cloud-synced. This is the same as clicking Run grouping in the Encord app. The call raises InvalidArgumentsError if the Folder has no saved manifest. The result is an ApplyGroupingManifestResult: To start a run without waiting, use apply_grouping_manifest_start(). It returns a job ID. Pass the job ID to apply_grouping_manifest_get_result() to wait for the result. Both ways of waiting wait for up to 1 hour by default. To change this, pass timeout_seconds. If the wait ends first, the call raises TimeOutError, but the run keeps going. If the run fails, the call raises GenericServerError with the reason. Each call to apply_grouping_manifest() or apply_grouping_manifest_start() starts a new run. A run waits if another run is grouping the same Folder.

Get Data Group Data Units

Use StorageItem.get_child_items() to list the data units in a Data Group. The first example starts from a Data Group’s file ID. The second example lists the data units of every Data Group in a Dataset. To see which tile each data unit is in, use the layout contents shown in Get Data Group Information.

Get Data Group Information

Use StorageItem.get_summary() to view a Data Group’s setup. The data_group field of the summary holds:
  • layout_contents: Each layout key and the data unit it points to.
  • layout: The layout tree. Grid and carousel Data Groups also return the layout Encord generated for them.
  • layout_settings: Tile settings (such as read-only tiles), fixed_layout, and has_multilayer_labels.
  • timeline: Keys of the audio and time series files shown in the timeline.
data_group is None when the storage item is not a Data Group.

Find the Data Groups That Contain a File

Use get_summary() on a file to list the groups that contain it. accessible_group_items lists the groups you have access to, including image groups and DICOM series, so filter on StorageItemType.GROUP to keep only Data Groups. For a file in a DICOM series, use the file ID of the series.

Change the Layout or Settings of a Data Group

You can’t change a Data Group’s files, layout or settings after you create it. This includes read-only tiles and multi-layer labels. To make a change, create a new Data Group with the same data units and the new layout or settings. The following script reads an existing Data Group and creates a copy with one more read-only tile. Change new_settings to make other changes, such as has_multilayer_labels=True.
The new Data Group is a separate storage item with its own label rows. Labels on the old Data Group are not copied. The script adds the new Data Group to your Dataset with link_items, so that you can annotate it.

Multi-Layer Data Groups

Multi-Layer Data Groups let you label all images in a Data Group at once. Labels are stored on a single shared layer (the root Label Space) that covers every image in the group, so any label you add or edit (in the Label Editor or through the SDK) applies to all of them. On export, these shared labels appear under spaces["root"]["labels"], and the top-level labels object is empty.
Multi-Layer Data Groups support images only. Videos and other data types are not supported. All images in the group must have the same aspect ratio (width divided by height). Creating the group fails if it contains other data types or images with different aspect ratios.
To create a Multi-Layer Data Group with the SDK, create a custom Data Group and set has_multilayer_labels=True in its LayoutSettings. In the UI, turn on Multilayer labels when you create Auto Data Groups. You can’t turn on multi-layer labels for an existing Data Group. Create a new Data Group instead, as shown in Change the Layout or Settings of a Data Group.
To add labels to a Multi-Layer Data Group, see Data Groups & Label Spaces.

Check if a Data Group is Multi-Layer

Read has_multilayer_labels from the Data Group’s layout settings. If you start from a label row, use label_row.get_storage_item() to get the Data Group’s storage item.

Read-Only Tiles

You can mark individual tiles in a Data Group as read-only. Annotators can view a read-only tile in the Label Editor but can’t add labels to it. This is useful for tiles that give context, such as an instructions document or a reference camera feed.
  • In the SDK, set TileSettings(is_read_only=True) for the tile when you create a custom Data Group.
  • The keys in tile_settings must be keys in layout_contents.
  • At least one tile must stay editable. Encord rejects a Data Group where every tile is read-only.
  • You can’t change which tiles are read-only after you create the Data Group. See Change the Layout or Settings of a Data Group.
SDK example
Manifest JSON example Auto Data Groups use a manifest JSON file to define groups. In a manifest, set is_read_only in settings.tile_settings, keyed by member name: