Create prediction

If you have predictions generated for your dataset from a model, either as pre-annotated tasks or pre-labeled tasks, you can import the predictions with your dataset into Label Studio for review and correction.

To import predicted labels into Label Studio, you must use the Basic Label Studio JSON format and set up your tasks with the predictions JSON key. The Label Studio ML backend also outputs tasks in this format.

JSON format for predictions

Label Studio JSON format for pre-annotations must contain two sections:

  • A data object which references the source of the data that the pre-annotations apply to. This can be a URL to an audio file, a pre-signed cloud storage link to an image, plain text, a reference to a CSV file stored in Label Studio, or something else.
  • A predictions array that contains the pre-annotation results for the different types of labeling. See how to add results to the predictions array.

For more information, see the JSON format reference in the Label Studio documentation

Headers

AuthorizationstringRequired

Header authentication of the form Token <token>

Request

This endpoint expects an object.
taskintegerOptional
Task ID for which the prediction is created
resultlist of maps from strings to anyOptional

Prediction result in JSON format. Read more about the format in the Label Studio documentation.

scoredoubleOptional
Prediction score. Can be used in Data Manager to sort task by model confidence. Task with the lowest score will be shown first.
model_versionstringOptional

Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface

Response

Created prediction
resultlist of maps from strings to any
List of prediction results for the task
taskinteger
idinteger or null
model_versionstring or null

Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface

created_agostring or null>=1 characterDefaults to
Delta time from creation time
scoredouble or null
Prediction score
clusterinteger or null
Cluster for the current prediction
neighborsmap from strings to any or null
Array of task IDs of the closest neighbors
mislabelingdouble or null
Related task mislabeling score
created_atdatetime or null
updated_atdatetime or null
modelinteger or null
An ML Backend instance that created the prediction.
model_runinteger or null
A run of a ModelVersion that created the prediction.
projectinteger or null