githubEdit

Overlay images

Introduction

In this tutorial, you will learn how to upload source images together with one or multiple overlay images for each source image using Python SDK. Overlay images are displayed as additional visual layers in the labeling interface and are linked to their parent (source) images.

In the Overlay labeling interface, overlay visibility is controlled by adjustable opacity.

overlay

Both directory and archive are supported.

  • Parent images are stored in img.

  • Parent image annotations are stored in ann as image_name.ext.json.

  • Overlay images are stored in overlay/<parent_image_name_with_extension>/.

  • Overlay images do not require annotation files.

How to upload overlay images with Python SDK

Use api.image.upload_overlay_images.

Parameters
Type
Description

dataset_id

int

ID of the dataset to upload

names

List[str]

Parent image names

paths

Optional[List[str]]

List of local paths to parent images (optional)

links

Optional[List[str]]

List of remote links to parent images (optional)

hashes

Optional[List[str]]

List of hashes for parent images already in storage (optional)

overlay_names

Optional[List[List[str]]]

Overlay names grouped by parent index (overlay_names[i] corresponds to names[i])

overlay_paths

Optional[List[List[str]]]

Local overlay paths grouped by parent index (optional)

overlay_links

Optional[List[List[str]]]

Remote overlay links grouped by parent index (optional)

overlay_hashes

Optional[List[List[str]]]

Overlay hashes grouped by parent index (optional)

batch_size

Optional[int]

Number of items uploaded in one batch (for links/hashes)

conflict_resolution

Literal["rename", "skip", "replace"]

Conflict resolution strategy (optional)

force_metadata_for_links

Optional[bool]

Force metadata retrieval for images uploaded by links (if False, metadata can be temporarily incomplete)

So, the method uploads parent images and linked overlay images to Supervisely and returns a tuple with parent ImageInfo list and grouped overlay ImageInfo lists.

Important rules

  • Exactly one source for parent images must be provided: paths or links or hashes.

  • Exactly one source for overlays must be provided: overlay_paths or overlay_links or overlay_hashes.

  • Parent and overlay lists must have consistent lengths.

Example: upload from local paths

Result in labeling interface

After upload, each parent image in the dataset has one or multiple linked overlays that can be displayed in the new Overlay labeling interface.

Last updated