With Lightly, you can export selected images effortlessly to the Labelbox format:

import json
from lightly.api import ApiWorkflowClient

# Create the Lightly client to connect to the API.
client = ApiWorkflowClient(token="MY_LIGHTLY_TOKEN", dataset_id="MY_DATASET_ID")

label_box_data_rows = client.export_label_box_v4_data_rows_by_tag_name(
    tag_name="initial-tag"  # name of the tag in the dataset
)
with open("label_box_data_rows.json", "w") as f:
    json.dump(label_box_data_rows, f, indent=4)

The resulting file should look similar to this:

[
    {
        "row_data": "https://api.lightly.ai/v1/datasets/...",
        "global_key": "your-image.png",
        "media_type": "IMAGE"
    },
...

Now, you can import the Labelbox data rows and start labeling your data.

๐Ÿ“˜

Labelbox v3 Format

To export images in the old Labelbox v3 format, use the export_label_box_data_rows_by_tag_name method:

label_box_data_rows = client.export_label_box_data_rows_by_tag_name(
    tag_name="initial-tag"  # name of the tag in the dataset
)