class documentation

class ArrayAnnotation(Annotation):

View In Hierarchy

Custom annotation backed by an array file.

All instances of this annotation must have the same shape.

Static Method combine_to_numpy Combine array annotations into instance-class-indexed arrays.
Method to_numpy Load the array from the file path.
Instance Variable path Path to the array saved as a .npy file.
Class Method _validate_path Undocumented
Method _serialize_path Undocumented
@staticmethod
@override
def combine_to_numpy(annotations: list[ArrayAnnotation], classes: list[int], n_classes: int) -> np.ndarray:

Combine array annotations into instance-class-indexed arrays.

Parameters
annotations:list[ArrayAnnotation]Array annotations to combine.
classes:list[int]Class IDs associated with the annotations.
n_classes:intTotal number of known classes.
Returns
np.ndarrayCombined arrays of shape (N, C, …) where C is the number of classes and N is the number of instances.
def to_numpy(self) -> np.ndarray:

Load the array from the file path.

path: FilePath =

Path to the array saved as a .npy file.

@field_validator('path')
@classmethod
def _validate_path(cls, path: FilePath) -> FilePath:

Undocumented

@field_serializer('path', when_used='json')
def _serialize_path(self, value: FilePath) -> str:

Undocumented