Add image layers

Attach alternative views to an image.

Image layers can be used to provide labelers with additional view options for the image being labeled. For example, if you have additional cameras capturing images of your subject matter in different formats (greyscale, thermal, etc.), you may want to provide these images as contextual layers to the primary image to supplement labeling.

Only images may be attached as layers to an image asset. Layers are applied to individual images, and a maximum of 10 layers may be added per image. (If more than 10 layers are needed, please reach out to Support.) Changing layer transparency and drawing annotations on image layers are not yet supported.

Importing layers

Image layers are imported as attachments to a Data Row. You must include the following information for each image layer.

Parameter

Required

Value

type

Yes

IMAGE_OVERLAY

value

Yes

URL of Image (PNG/JPG) (HTTPS or IAM delegated access path)

name

No

String

Python SDK

import labelbox 

#Enter your API key
API_KEY = ""
client = labelbox.Client(api_key=API_KEY)

#create a new dataset
dataset = client.create_dataset(name="Image layer example")

#create a data row with external ID
data_row = dataset.create_data_row(row_data="https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg",
                        external_id="base_image")

#Create multiple attachments
data_row.create_attachment(attachment_type="IMAGE_OVERLAY", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/rgb.jpg", attachment_name="RGB")
data_row.create_attachment(attachment_type="IMAGE_OVERLAY", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/cir.jpg", attachment_name="CIR")
data_row.create_attachment(attachment_type="IMAGE_OVERLAY", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/weeds.jpg", attachment_name="Weeds")

JSON format

[
    {
        "externalId": "base_image",
        "imageUrl": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg",
        "attachments": [
            {
                "type": "IMAGE_OVERLAY",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/rgb.jpg",
                "name": "RGB"
            },
            {
                "type": "IMAGE_OVERLAY",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/cir.jpg",
                "name": "CIR"
            },
            {
                "type": "IMAGE_OVERLAY",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/weeds.jpg",
                "name": "Weeds"
            }
        ]
    }
]

Viewing layers

When layers have been provided for an image, labelers will see the Image overlay button appear in the top bar of the editor, to the left of the zoom menu.

Clicking on this button opens a dropdown menu where alternative layers may be selected. Labelers can additionally use the keyboard shortcut (Option/Alt key + Layer #) to quickly switch between layers.


Did this page help you?