Annotations: kolena.workflow.annotation
#
Annotations are visualized in Kolena as overlays on top of TestSample
objects.
The following annotation types are available:
BoundingBox
Polygon
Polyline
Keypoints
BoundingBox3D
SegmentationMask
BitmapMask
ClassificationLabel
For example, when viewing images in the Studio, any annotations (such as lists of
BoundingBox
objects) present in the
TestSample
, GroundTruth
,
Inference
, or MetricsTestSample
objects are
rendered on top of the image.
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.
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.
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
#
ScoredPolygon
#
ScoredLabeledPolygon
#
Bases: Polygon
Arbitrary polygon specified by three or more pixel coordinates with a string label and a float score.
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.
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.
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.
ClassificationLabel
#
Bases: Annotation
Label of classification.
label: str
instance-attribute
#
String label for this classification.
ScoredClassificationLabel
#
Bases: ClassificationLabel
Classification label with accompanying score.
score: float
instance-attribute
#
Score associated with this label.