Attachments

Attach supplementary content to an asset.

The attachments feature can be used to provide supplementary content to an asset to help provide additional context for the labeling team. For example, your labeler may be able to identify a crop more accurately when provided with additional images of the crop taken from different angles or classify the stage of surgery quicker when provided with a contextual video of the full surgery.

Attachments are applied to individual assets and may be comprised of image, video, text, and/or HTML content. The HTML type can take a text or HTML file and render it in an iframe in the attachments panel. Markdown and HTML can also be used with this type to style the content.

Attachments can be added to any natively supported asset type.

Supported types

Type

Value

Description

IMAGE

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

Labelers can see the attached image(s) while labeling the primary Data Row

VIDEO

URL of Video (MP4) (HTTPS or IAM delegated access path)

Labelers can see the attached video(s) while labeling the primary Data Row

TEXT

Plain text as string or hyperlink

Labelers can see the attached text or hyperlink while labeling the primary Data Row

HTML

URL of a HTML file (HTTPS or IAM delegated access path)

Renders HTML in an iframe as an attachment. Labelers can see and interact with the attached HTML widget while labeling the primary Data Row.

IMAGE_OVERLAY

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

Labelers can view the attached image as an overlay on the primary Data Row. The asset overlay feature can be used to include alternative layers of an asset. 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.

Currently, only images may be attached as layers to an image asset. A maximum of 10 layers may be added per image. Changing layer transparency and creating annotations on image layers is not yet supported.

JSON format

Here are a few examples of attachments. You can upload any of the JSON files in Labelbox to experience the attachments in the editor.

[
    {
        "externalId": "basic.png",
        "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"
            },
            {
                "type": "IMAGE_OVERLAY",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/cir.jpg"
            },
            {
                "type": "IMAGE_OVERLAY",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/weeds.jpg"
            },
            {
                "type": "TEXT",
                "value": "IOWA, Zone 2232, June 2022 [Text string]"
            },
            {
                "type": "TEXT",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt"
            },
            {
                "type": "IMAGE",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/disease_attachment.jpeg"
            },
            {
                "type": "VIDEO",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/drone_video.mp4"
            },
            {
                "type": "HTML",
                "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/windy.html"
            }
        ]
    }
]
[
     {
         "externalId": "DesigningForGoogleCastVideo.mp4",
         "videoUrl": "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/dash/DesigningForGoogleCastVideo.mp4",
         "attachments": [
             {
                 "type": "TEXT",
                 "value": "Some sample text"
             },
             {
                 "type": "TEXT",
                 "value": "Some more sample text"
             }
         ]
     }
]
[
     {
         "externalId": "lorem-ipsum.txt",
         "data": "https://storage.googleapis.com/labelbox-sample-datasets/nlp/lorem-ipsum.txt",
         "attachments": [
             {
                 "type": "TEXT",
                 "value": "Some sample text"
             },
             {
                 "type": "TEXT",
                 "value": "Some more sample text"
             }
         ]
     }
]
[
    {
        "externalId": "cklidhv7o0zdk0y4z4282dp6o",
        "tileLayerUrl": "https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png",
        "bounds": [
            [
                19.405662413477728,
                -99.21052827588443
            ],
            [
                19.400498983095076,
                -99.20534818927473
            ]
        ],
        "minZoom": 12,
        "maxZoom": 20,
        "epsg": "EPSG4326",
        "version": 2,
        "attachments": [
             {
                 "type": "TEXT",
                 "value": "Some sample text"
             },
             {
                 "type": "TEXT",
                 "value": "Some more sample text"
             }
         ]
     }
]

Viewing attachments

Image, Video, Text, or HTML
When any of these attachments have been provided for an asset, labelers will see the Asset info button appear in the top left of the editor.

Clicking on this button or use the hotkey Shift + ? to open the attachments panel.

Image Overlay
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.

Using the 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="Data Row attachment 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")
data_row.create_attachment(attachment_type="IMAGE_OVERLAY", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/cir.jpg")
data_row.create_attachment(attachment_type="IMAGE_OVERLAY", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/weeds.jpg")

data_row.create_attachment(attachment_type="TEXT", attachment_value="IOWA, Zone 2232, June 2022 [Text string]")
data_row.create_attachment(attachment_type="TEXT", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt")
data_row.create_attachment(attachment_type="IMAGE", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/disease_attachment.jpeg")
data_row.create_attachment(attachment_type="VIDEO", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/drone_video.mp4")
data_row.create_attachment(attachment_type="HTML", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/windy.html")

Did this page help you?