Skip to main content
In this guide, we’ll use the Python SDK to construct geometric predictions. Each geometric prediction object in Nucleus has seven components:
  • Label of the prediction in the class taxonomy, e.g. car or pedestrian
  • Geometry to define the position, size, etc. of the box / polygon / line / cuboid
  • Reference ID of the item to which to apply the prediction
  • Confidence of the model for the prediction
  • Metadata, optional key-value pairs pertaining to the prediction, e.g. vehicle_color = blue
  • Annotation ID, an optional unique (per dataset item) key to refer to the prediction
  • Class PDF, an optional mapping from each class to its corresponding value in the model probability distribution
All geometric prediction types (box, polygon, line, cuboid) share the same structure aside from the geometry. Below, we’ll explore how to construct the prediction objects, including geometries, for each type:

BoxPrediction

A 2D bounding box based on a given XY position, width, and height. For more info, see our Python SDK Reference for BoxPredictions.

PolygonPrediction

A 2D polygon constructed by connecting 3+ vertices. For more info, see our Python SDK Reference for PolygonPredictions.

LinePrediction

A 2D line constructed by connecting 2+ vertices (an unclosed polygon). For more info, see our Python SDK Reference for LinePredictions.

KeypointsPrediction

A collection of 2D points that are named and connected via a domain-specific skeleton. For more info, see our Python SDK Reference for KeypointsPrediction.

CuboidPrediction

A 3D cuboid based on a given position, dimensions, and yaw. Cannot be applied to 2D images, only 3D pointcloud DatasetItems. For more info, see our Python SDK Reference for CuboidPredictions.