Skip to main content

Open In Colab

GitHub

Supported predictions

To upload predictions in Labelbox, you need to create a prediction payload. This section shows how to create a payload for each supported prediction type. Samples are show for the following supported supported payload formats:
  • Python annotation types (recommended)
  • NDJSON
Both are described below.

Entity (Message-based)

Classification: Radio (Single-choice)

Classification: Checklist (Multi-choice, Message-based)

Classification: Free-form text

Classification: Nested checklist (Message-based)

Classification: Nested radio

Example: Upload predictions to a model run

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

Before you start

You must 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

Upload your data rows to Catalog. To learn how to format your import JSON files, see Import conversation & model response data. Note the additional modelOutputs object required. For descriptions, see Model outputs object definitions.

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

Your model run should have the correct ontology set up with all the tools and classifications supported for your predictions. Here is an example of creating an ontology programmatically for all the example predictions above:

Step 3: Create a model and a model run

Create a Model using the ontology and a model run.

Step 4: Send data rows to the model run

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_ndjson and label_prediction payloads should have exactly the same prediction content.

Step 6: Upload predictions payload to the model run

Step 7: Send annotations to the model run (optional)

We will create a project with ground truth annotations to visualize both annotations and predictions in 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.