Skip to content

Annotation

ClassificationAnnotation

Interface for classification annotations.

ClassificationAnnotation

ClassificationAnnotation(annotation_base: AnnotationBaseTable)

Bases: Annotation

Class for classification annotations.

Parameters:

Name Type Description Default
annotation_base AnnotationBaseTable

The AnnotationBaseTable SQLAlchemy model instance.

required

confidence property

confidence: Optional[float]

Annotation confidence.

label property

label: str

Annotation label name.

get_object_session

get_object_session() -> Session

Get the database session for this annotation.

Returns:

Type Description
Session

The SQLModel session.

Raises:

Type Description
RuntimeError

If no active session is found.

InstanceSegmentationAnnotation

Interface for instance segmentation annotations.

InstanceSegmentationAnnotation

InstanceSegmentationAnnotation(inner: SegmentationAnnotationTable)

Bases: Annotation

Class for instance segmentation annotations.

The properties of the annotation are accessible as attributes of this class.

print(f"Annotation x/y coordinates: ({annotation.x},{annotation.y})")
print(f"Annotation width and height: {annotation.width}x{annotation.height}"
print(f"Annotation segmentation mask: {annotation.segmentation_mask}"

Parameters:

Name Type Description Default
inner SegmentationAnnotationTable

The SegmentationAnnotationTable SQLAlchemy model instance.

required

confidence property

confidence: Optional[float]

Annotation confidence.

height class-attribute instance-attribute

height = DBField(col(height))

Height (px) of the instance bounding box.

label property

label: str

Annotation label name.

segmentation_mask class-attribute instance-attribute

segmentation_mask = DBField(col(segmentation_mask))

Segmentation mask given as a run-length encoding.

width class-attribute instance-attribute

width = DBField(col(width))

Width (px) of the instance bounding box.

x class-attribute instance-attribute

x = DBField(col(x))

X coordinate (px) of the instance bounding box.

y class-attribute instance-attribute

y = DBField(col(y))

Y coordinate (px) of the instance bounding box.

get_object_session

get_object_session() -> Session

Get the database session for this annotation.

Returns:

Type Description
Session

The SQLModel session.

Raises:

Type Description
RuntimeError

If no active session is found.

ObjectDetectionAnnotation

Interface for object detection annotations.

ObjectDetectionAnnotation

ObjectDetectionAnnotation(inner: ObjectDetectionAnnotationTable)

Bases: Annotation

Class for object detection annotations.

The properties of the annotation are accessible as attributes of this class.

print(f"Annotation x/y coordinates: ({annotation.x},{annotation.y})")
print(f"Annotation width and height: {annotation.width}x{annotation.height}"

Parameters:

Name Type Description Default
inner ObjectDetectionAnnotationTable

The ObjectDetectionAnnotationTable SQLAlchemy model instance.

required

confidence property

confidence: Optional[float]

Annotation confidence.

height class-attribute instance-attribute

height = DBField(col(height))

Height (px) of the object detection bounding box.

label property

label: str

Annotation label name.

width class-attribute instance-attribute

width = DBField(col(width))

Width (px) of the object detection bounding box.

x class-attribute instance-attribute

x = DBField(col(x))

X coordinate (px) of the object detection bounding box.

y class-attribute instance-attribute

y = DBField(col(y))

Y coordinate (px) of the object detection bounding box.

get_object_session

get_object_session() -> Session

Get the database session for this annotation.

Returns:

Type Description
Session

The SQLModel session.

Raises:

Type Description
RuntimeError

If no active session is found.

SemanticSegmentationAnnotation

Interface for semantic segmentation annotations.

SemanticSegmentationAnnotation

SemanticSegmentationAnnotation(inner: SegmentationAnnotationTable)

Bases: Annotation

Class for semantic segmentation annotations.

The properties of the annotation are accessible as attributes of this class.

print(f"Annotation x/y coordinates: ({annotation.x},{annotation.y})")
print(f"Annotation width and height: {annotation.width}x{annotation.height}")
print(f"Annotation segmentation mask: {annotation.segmentation_mask}")

Parameters:

Name Type Description Default
inner SegmentationAnnotationTable

The SegmentationAnnotationTable SQLAlchemy model instance.

required

confidence property

confidence: Optional[float]

Annotation confidence.

height class-attribute instance-attribute

height = DBField(col(height))

Height (px) of the segmentation bounding box.

label property

label: str

Annotation label name.

segmentation_mask class-attribute instance-attribute

segmentation_mask = DBField(col(segmentation_mask))

Segmentation mask given as a run-length encoding.

width class-attribute instance-attribute

width = DBField(col(width))

Width (px) of the segmentation bounding box.

x class-attribute instance-attribute

x = DBField(col(x))

X coordinate (px) of the segmentation bounding box.

y class-attribute instance-attribute

y = DBField(col(y))

Y coordinate (px) of the segmentation bounding box.

get_object_session

get_object_session() -> Session

Get the database session for this annotation.

Returns:

Type Description
Session

The SQLModel session.

Raises:

Type Description
RuntimeError

If no active session is found.