πŸ“˜

Supported image types and size

File formats: JPG, PNG, and BMP
Maximum file size: 256 MB, all import methods (upload, IAM DA, signed URLs)

When importing image data to Labelbox, your JSON file must include the following information for each image.

Parameter

Required

Description

externalId

Yes

User-generated file name or ID for the file. For the best experience, this ID should be unique.

imageUrl

Yes

https path to a cloud-hosted image. For IAM Delegated Access, this URL must be in virtual-hosted-style format. For older regions, your S3 bucket may be in https://<bucket-name>.s3-<region>.amazonaws.com/<key> format. If your object URLs are formatted this way, make sure they are in the virtual-hosted-style format before importing.

attachments

No

Attachments
Asset overlays

[
    {
        "externalId": "cells.jpg",
        "imageUrl": "https://lb-test-data.s3.us-west-1.amazonaws.com/cells.jpg"
    },
    {
        "externalId": "b17.jpg",
        "imageUrl": "https://lb-test-data.s3.us-west-1.amazonaws.com/B17.jpg"
    }
]
[ 
    { 
        "externalId": "2017-Tesla-Model-S-P90D-102.jpg", 
        "imageUrl": "https://storage.googleapis.com/labelbox-example-datasets/tesla/2017-Tesla-Model-S-P90D-102.jpg"
    }, 
    { 
        "externalId": "2017-Tesla-Model-3-top-view.jpg", 
        "imageUrl": "https://storage.googleapis.com/labelbox-example-datasets/tesla/2017-Tesla-Model-3-top-view.jpg"
    }
]
from uuid import uuid4

dataset = client.create_dataset(name="Bulk import example")

assets = [{"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())}]

asset_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"}]

for item in assets:
  item["attachments"] = asset_attachments

task = dataset.create_data_rows(assets)
task.wait_till_done()