paralleldomain.model.annotation.instance_segmentation_2d

class InstanceSegmentation2D(instance_ids)

Represents a 2D Instance Segmentation mask for a camera image.

Parameters:

instance_ids (ndarray) – InstanceSegmentation2D.instance_ids

instance_ids

Matrix identical in size to the image where the third axis contains the instance ID for each pixel as int.

get_instance(instance_id)

Returns a bool mask where instance is present.

Parameters:

instance_id (int) – ID of instance to be masked

Return type:

ndarray

Returns:

Mask of same shape as instance_ids and bool values. True where pixel matches instance, False where it doesn’t.

get_instances(instance_ids)

Returns a bool mask where instances are present.

Parameters:

instance_ids (List[int]) – IDs of instances to be masked

Return type:

ndarray

Returns:

Mask of same shape as class_ids and bool values. True where pixel matches one of the instances, False where it doesn’t.

property rgb_encoded: ndarray

Outputs InstanceSegmentation.instance_ids mask as RGB matrix with shape (H x W x 3), with R being the lowest and B being the highest 8 bit.