tlc.client.data_format

Defines the standard representations of composite features in 3LC.

Module Contents

Classes

Class

Description

InstanceSegmentationDict

The base class for dictionary representations of instance segmentation data.

SegmentationPolygonsDict

A dictionary representation of instance segmentation data where each instance is represented by a list of polygons.

SegmentationMasksDict

A dictionary representation of instance segmentation data where each instance is represented by a binary mask.

API

class tlc.client.data_format.InstanceSegmentationDict

Bases: typing.TypedDict

The base class for dictionary representations of instance segmentation data.

Initialize self. See help(type(self)) for accurate signature.

image_height: int = None

The height of the image in pixels.

image_width: int = None

The width of the image in pixels.

instance_properties: dict[str, dict | list] = None

A potentially nested dictionary with string keys where all leaf nodes are lists with one element per instance.

class tlc.client.data_format.SegmentationPolygonsDict

Bases: tlc.client.data_format.InstanceSegmentationDict

A dictionary representation of instance segmentation data where each instance is represented by a list of polygons.

Initialize self. See help(type(self)) for accurate signature.

polygons: list[list[float]] = None

A list of lists of floats, where each inner list represents a polygon enclosing a single instance. The inner list is a list of floats representing the coordinates of the polygon vertices, alternating between x and y coordinates, i.e. [x1, y1, x2, y2, …]. The floats can either be in terms of pixels or normalized to the range [0, 1] by dividing by the image width or height respectively, this should be specified in the schema.

class tlc.client.data_format.SegmentationMasksDict

Bases: tlc.client.data_format.InstanceSegmentationDict

A dictionary representation of instance segmentation data where each instance is represented by a binary mask.

Initialize self. See help(type(self)) for accurate signature.

masks: numpy.typing.NDArray[numpy.uint8] = None

A numpy array of shape (width, height, num_instances) where each element is 1 if the pixel belongs to an instance and 0 otherwise.