annotation.py
rerun.log.annotation
AnnotationInfoLike = Union[Tuple[int, str], Tuple[int, str, Color], AnnotationInfo]
module-attribute
Type helper representing the different ways to specify an AnnotationInfo
ClassDescriptionLike = Union[AnnotationInfoLike, ClassDescription]
module-attribute
Type helper representing the different ways to specify a ClassDescription
class AnnotationInfo
dataclass
Annotation info annotating a class id or key-point id.
Color and label will be used to annotate entities/keypoints which reference the id. The id refers either to a class or key-point id
id: int = 0
class-attribute
instance-attribute
The id of the class or key-point to annotate
label: str | None = None
class-attribute
instance-attribute
The label that will be shown in the UI
color: Color | None = None
class-attribute
instance-attribute
The color that will be applied to the annotated entity
class ClassDescription
dataclass
Metadata about a class type identified by an id.
Typically a class description contains only a annotation info. However, within a class there might be several keypoints, each with its own annotation info. Keypoints in turn may be connected to each other by connections (typically used for skeleton edges).
info: AnnotationInfoLike | None = None
class-attribute
instance-attribute
The annotation info for the class
keypoint_annotations: Iterable[AnnotationInfoLike] | None = None
class-attribute
instance-attribute
The annotation infos for the all key-points
keypoint_connections: Iterable[int | tuple[int, int]] | None = None
class-attribute
instance-attribute
The connections between key-points
def log_annotation_context(entity_path, class_descriptions, *, timeless=True, recording=None)
Log an annotation context made up of a collection of ClassDescriptions.
Any entity needing to access the annotation context will find it by searching the path upward. If all entities share the same you can simply log it to the root ("/"), or if you want a per-entity ClassDescriptions log it to the same path as your entity.
Each ClassDescription must include an annotation info with an id, which will be used for matching the class and may optionally include a label and color. Colors should either be in 0-255 gamma space or in 0-1 gamma space. Colors can be RGB or RGBA.
These can either be specified verbosely as:
[AnnotationInfo(id=23, label='foo', color=(255, 0, 0)), ...]
Or using short-hand tuples.
[(23, 'bar'), ...]
Unspecified colors will be filled in by the visualizer randomly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_path |
str
|
The path to the annotation context in the space hierarchy. |
required |
class_descriptions |
ClassDescriptionLike | Iterable[ClassDescriptionLike]
|
A single ClassDescription or a collection of ClassDescriptions. |
required |
timeless |
bool
|
If true, the annotation context will be timeless (default: True). |
True
|
recording |
RecordingStream | None
|
Specifies the |
None
|