Skip to content

kolena.annotation

Annotations are visualized in Kolena as overlays on top of datapoints.

Annotation Conditions for visualization
BoundingBox Limited to Image or Video data
BoundingBox3D Limited to PointCloud data
Polygon Limited to Image or Video data
Polyline Limited to Image or Video data
Keypoints Limited to Image or Video data
SegmentationMask Limited to Image or Video data
BitmapMask Limited to Image or Video data
Label Valid for all data
TimeSegment Limited to Audio or Video data

For example, when viewing images in the Studio, any annotations (such as lists of BoundingBox objects) present in the datapoints are rendered on top of the image.

ClassificationLabel = Label module-attribute #

Alias for Label.

ScoredClassificationLabel = ScoredLabel module-attribute #

Alias for ScoredLabel.

Annotation #

Bases: TypedDataObject[_AnnotationType]

The base class for all annotation types.

BoundingBox #

Bases: Annotation

Rectangular bounding box specified with pixel coordinates of the top left and bottom right vertices.

The reserved fields width, height, area, and aspect_ratio are automatically populated with values derived from the provided coordinates.

top_left: Tuple[float, float] instance-attribute #

The top left vertex (in (x, y) pixel coordinates) of this bounding box.

bottom_right: Tuple[float, float] instance-attribute #

The bottom right vertex (in (x, y) pixel coordinates) of this bounding box.

LabeledBoundingBox #

Bases: BoundingBox

Rectangular bounding box specified with pixel coordinates of the top left and bottom right vertices and a string label.

label: str instance-attribute #

The label (e.g. model classification) associated with this bounding box.

ScoredBoundingBox #

Bases: BoundingBox

Rectangular bounding box specified with pixel coordinates of the top left and bottom right vertices and a float score.

score: float instance-attribute #

The score (e.g. model confidence) associated with this bounding box.

ScoredLabeledBoundingBox #

Bases: BoundingBox

Rectangular bounding box specified with pixel coordinates of the top left and bottom right vertices, a string label, and a float score.

label: str instance-attribute #

The label (e.g. model classification) associated with this bounding box.

score: float instance-attribute #

The score (e.g. model confidence) associated with this bounding box.

Polygon #

Bases: Annotation

Arbitrary polygon specified by three or more pixel coordinates.

points: List[Tuple[float, float]] instance-attribute #

The sequence of (x, y) pixel coordinates comprising the boundary of this polygon.

LabeledPolygon #

Bases: Polygon

Arbitrary polygon specified by three or more pixel coordinates and a string label.

label: str instance-attribute #

The label (e.g. model classification) associated with this polygon.

ScoredPolygon #

Bases: Polygon

Arbitrary polygon specified by three or more pixel coordinates and a float score.

score: float instance-attribute #

The score (e.g. model confidence) associated with this polygon.

ScoredLabeledPolygon #

Bases: Polygon

Arbitrary polygon specified by three or more pixel coordinates with a string label and a float score.

label: str instance-attribute #

The label (e.g. model classification) associated with this polygon.

score: float instance-attribute #

The score (e.g. model confidence) associated with this polygon.

Keypoints #

Bases: Annotation

Array of any number of keypoints specified in pixel coordinates.

points: List[Tuple[float, float]] instance-attribute #

The sequence of discrete (x, y) pixel coordinates comprising this keypoints annotation.

Polyline #

Bases: Annotation

Polyline with any number of vertices specified in pixel coordinates.

points: List[Tuple[float, float]] instance-attribute #

The sequence of connected (x, y) pixel coordinates comprising this polyline.

BoundingBox3D #

Bases: Annotation

Three-dimensional cuboid bounding box in a right-handed coordinate system.

Specified by (x, y, z) coordinates for the center of the cuboid, (x, y, z) dimensions, and a rotation parameter specifying the degrees of rotation about each axis (x, y, z) ranging [-π, π].

The reserved field volume is automatically derived from the provided dimensions.

center: Tuple[float, float, float] instance-attribute #

(x, y, z) coordinates specifying the center of the bounding box.

dimensions: Tuple[float, float, float] instance-attribute #

(x, y, z) measurements specifying the dimensions of the bounding box.

rotations: Tuple[float, float, float] instance-attribute #

Rotations in degrees about each (x, y, z) axis.

LabeledBoundingBox3D #

Bases: BoundingBox3D

BoundingBox3D with an additional string label.

label: str instance-attribute #

The label associated with this 3D bounding box.

ScoredBoundingBox3D #

Bases: BoundingBox3D

BoundingBox3D with an additional float score.

score: float instance-attribute #

The score associated with this 3D bounding box.

ScoredLabeledBoundingBox3D #

Bases: BoundingBox3D

BoundingBox3D with an additional string label and float score.

label: str instance-attribute #

The label associated with this 3D bounding box.

score: float instance-attribute #

The score associated with this 3D bounding box.

SegmentationMask #

Bases: Annotation

Raster segmentation mask. The locator is the URL to the image file representing the segmentation mask.

The segmentation mask must be rendered as a single-channel, 8-bit-depth (grayscale) image. For the best results, use a lossless file format such as PNG. Each pixel's value is the numerical ID of its class label, as specified in the labels map. Any pixel value not present in the labels map is rendered as part of the background.

For example, labels = {255: "object"} will highlight all pixels with the value of 255 as "object". Every other pixel value will be transparent.

labels: Dict[int, str] instance-attribute #

Mapping of unique label IDs (pixel values) to unique label values.

locator: str instance-attribute #

URL of the segmentation mask image.

BitmapMask #

Bases: Annotation

Arbitrary bitmap mask. The locator is the URL to the image file representing the mask.

locator: str instance-attribute #

URL of the bitmap data.

Label #

Bases: Annotation

Label, e.g. for classification.

label: str instance-attribute #

String label for this classification.

ScoredLabel #

Bases: Label

Label with accompanying score.

score: float instance-attribute #

Score associated with this label.

TimeSegment #

Bases: Annotation

Segment of time in the associated audio or video file.

When a group is specified, segments are displayed on Kolena with different colors for each group present in a List[TimeSegment]. Example usage:

transcription: List[TimeSegment] = [
    LabeledTimeSegment(group="A", label="Knock, knock.", start=0, end=1),
    LabeledTimeSegment(group="B", label="Who's there?", start=2, end=3),
    LabeledTimeSegment(group="A", label="Example.", start=3.5, end=4),
    LabeledTimeSegment(group="B", label="Example who?", start=4.5, end=5.5),
    LabeledTimeSegment(group="A", label="Example illustrating two-person dialogue using `group`.", start=6, end=9),
]

start: float instance-attribute #

Start time, in seconds, of this segment.

end: float instance-attribute #

End time, in seconds, of this segment.

LabeledTimeSegment #

Bases: TimeSegment

Time segment with accompanying label, e.g. audio transcription.

label: str instance-attribute #

The label associated with this time segment.

ScoredTimeSegment #

Bases: TimeSegment

Time segment with additional float score, representing e.g. model prediction confidence.

score: float instance-attribute #

The score associated with this time segment.

ScoredLabeledTimeSegment #

Bases: TimeSegment

Time segment with accompanying label and score.

label: str instance-attribute #

The label associated with this time segment.

score: float instance-attribute #

The score associated with this time segment.