Skip to main content

Open In Colab

GitHub

Supported predictions

To upload predictions in Labelbox, you need to create a predictions payload. In this section, we provide this payload for every supported prediction type. Labelbox supports two formats for the predictions payload:
  • Python annotation types (recommended)
  • NDJSON
Both are described below.

Entity

The textSelections field is required in the payload for each entity annotation. Each textSelections item in the list requires the following fields:
  • A list of token_ids for each word in the group of words.
  • The group_id associated with a group of words.
  • The page of the document (1-indexed).
Both the token_idsand the group_id are extracted from the text layer URL attached to the data row. Please follow the end-to-end demo to learn how to construct an entity annotation for documents.

Classification: Radio

Classification: Checklist

Bounding box

Nested classifications: Checklist and radio

Classification: Free-form text

Bounding box with nested classification

Entity with nested classification

End-to-end example: Upload predictions to a model run

Here are the steps to upload predictions to a model run:

Before you start

You will need to import these libraries to use the code examples in this section:
Replace the value of API_KEY with a valid API key to connect to the Labelbox client.

Step 1: Import data rows into Catalog

Step 2: Create/select an ontology for your model predictions

Your model run should have the correct ontology setup with all the tools and classifications supported for your predictions, and the tool names and classification instructions should match the name/instructions fields in your annotation payloads to ensure the correct feature schemas are matched.

Step 3: Create a model and a model run

Step 4: Send data rows to the model run

Step 5: Create the predictions payload

To import ner annotations, you can either pass atext_layer_url or use Labelbox-generated text_layer_url. To extract the generated text layer url we first need to export the data row

Step 5: Create the predictions payload

Create the predictions payload using the snippets of code shown above. Labelbox supports two formats for the annotations payload: NDJSON and Python annotation types. Both approaches are described below with instructions to compose annotations into Labels attached to the data rows. The resulting label_predictions_ndjson and label_predictions payloads should have exactly the same prediction content (with the exception of the uuid strings that are generated).

Step 6: Upload the predictions payload to the model run

Step 7: Send annotations to the model run

To send annotations to a model run, we must first import them into a project, create a label payload and then send them to the model run.