- Label of the prediction in the class taxonomy, e.g. shirt or dress
- Reference ID, of the item to which to apply the prediction
- Name of the taxonomy, optional but recommended
- Confidence, 0-1 indicating the confidence of the prediction
- Class PDF, an optional complete class probability distribution on this prediction. Each value should be between 0 and 1 (inclusive), and sum up to 1 as a complete distribution. This can be useful for computing entropy to surface places where the model is most uncertain
- Metadata, optional key-value pairs pertaining to the prediction, e.g. color = blue
CategoryPredictions.
Taxonomies
To begin, we recommend manually creating and adding your own taxonomies to your datasets. This allows you to apply more than one category prediction to a single image, where each prediction pertains to a different taxonomy. By default, iftaxonomy_name is not provided in the CategoryPrediction object, Nucleus will create a “default taxonomy” automatically based on the set of all unique labels in the uploaded prediction payload. If you continue to upload more CategoryPredictions, new labels will automatically be added to the default taxonomy.
You can create a taxonomy and associate it with a dataset using Dataset.add_taxonomy:
CategoryPrediction by taxonomy_name.
By setting update=True, you can add new labels to an existing taxonomy (e.g. from labels=["shirt", "trousers", "dress"] to labels=["shirt", "trousers", "dress", "jacket"]). We do not yet support changing or deleting existing labels, but this is coming soon! In the meantime, we recommend deleting the taxonomy and recreating it from scratch with the updated/removed labels. Note that deleting a taxonomy also deletes all annotations and predictions associated with it.
Single Category Predictions
For single-label categorization tasks, simply create oneCategoryPrediction per image, per taxonomy. For instance, if you have 2 taxonomies clothing_type and designer and 100 images, you would create 200 predictions as follows:
Example Category Prediction Upload
Multi-Category Predictions
Currently, the best way to add multi-category annotations or predictions to an item is to use multiple taxonomies. Rather than a single taxonomy with N classes, you can add N binary taxonomies each with two classes: True or False. For example, consider a multi-category model predicting classes: shirt, trousers, and dress. You would first add three True/False taxonomies for each of the three classes. To add aCategoryPrediction for an item of both the shirt and dress class, you would simply add True predictions for the shirt and dress taxonomies, and a False prediction for the trousers taxonomy.
Unfortunately, the confidence and class PDFs will not be calibrated across taxonomies; one way to get around this is to attach actual PDF values or multiplicative weights as metadata.
Automatic Calculation of Evaluation MetricsUnlike with other annotation types, you don’t need to call the calculate model metrics endpoint to update matches against ground truth annotations and calculate various metrics such as IOU for categorization. Sorting by metrics, as well as the evaluation plots and metrics present in the Insights page will be automatically refreshed when you upload new category annotations and/or predictions.This is because by default you can only have a single category ground truth annotation per dataset item, and a single category prediction per dataset item per model, making matching category ground truth annotations and predictions trivial (other task types require user input to calibrate results).
Scene Category Predictions
Nucleus supports uploading and visualizing category predictions at the scene level. ASceneCategoryPrediction object contains a subset of those for regular category predictions: Label, Reference ID, Taxonomy Name, Confidence, and Metadata.
To upload predictions for a scene (a video or a point cloud), begin by uploading all taxonomies present in your dataset as demonstrated earlier in this section.
Then, create a SceneCategoryPrediction for a scene with a given reference_id the same way you would for a CategoryPrediction.