Skip to main content
In this guide, we’ll use the Python SDK to construct geometric annotations. Each geometric annotation object in Nucleus has five components:
  • Label of the annotation 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 annotation
  • Annotation ID, an optional unique (per dataset item) key to refer to the annotation
  • Metadata, optional key-value pairs pertaining to the annotation, e.g. vehicle_color = blue
All geometric annotation types (box, polygon, line, cuboid) share the same structure aside from the geometry. Below, we’ll explore how to construct the annotation objects, including geometries, for each type:

BoxAnnotation

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

PolygonAnnotation

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

LineAnnotation

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

KeypointsAnnotation

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

CuboidAnnotation

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 CuboidAnnotations.