class documentation

class BBoxAnnotation(Annotation):

View In Hierarchy

Bounding box annotation.

Values are normalized based on the image size.

Static Method combine_to_numpy Combine bounding box annotations into rows with class IDs.
Method to_numpy Convert the bounding box annotation to row format.
Instance Variable h Normalized bounding box height.
Instance Variable w Normalized bounding box width.
Instance Variable x Normalized top-left x coordinate.
Instance Variable y Normalized top-left y coordinate.
Class Method _validate_values Undocumented
Static Method _clip_sum Undocumented
@staticmethod
@override
def combine_to_numpy(annotations: list[BBoxAnnotation], classes: list[int], n_classes: int | None = None) -> np.ndarray:

Combine bounding box annotations into rows with class IDs.

Parameters
annotations:list[BBoxAnnotation]Bounding box annotations to combine.
classes:list[int]Class IDs associated with the annotations.
n_classes:int | NoneUnused class count kept for API compatibility.
Returns
np.ndarrayAn array of shape (N, 5) where N is the number of bounding box annotations and each row is in the format [class_id, x, y, w, h].
def to_numpy(self, class_id: int) -> np.ndarray:

Convert the bounding box annotation to row format.

Parameters
class_id:intThe numeric class ID of the annotation.
Returns
np.ndarrayAn array of shape (5, ) in the format [class_id, x, y, w, h].
h: NormalizedFloat =

Normalized bounding box height.

w: NormalizedFloat =

Normalized bounding box width.

x: NormalizedFloat =

Normalized top-left x coordinate.

y: NormalizedFloat =

Normalized top-left y coordinate.

@model_validator(mode='before')
@classmethod
def _validate_values(cls, values: dict[str, Any]) -> dict[str, Any]:

Undocumented

@staticmethod
def _clip_sum(values: dict[str, Any]) -> dict[str, Any]:

Undocumented