paralleldomain.model.annotation.semantic_segmentation_2d

class SemanticSegmentation2D(class_ids)

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

Parameters:

class_ids (ndarray) – SemanticSegmentation2D.class_ids

class_ids

Matrix of shape (H x W x 1), where H is height and W is width of corresponding camera image. The third axis contains the class ID for each pixel as int.

get_class_mask(class_id)

Returns a bool mask where class is present.

Parameters:

class_id (int) – ID of class to be masked

Return type:

ndarray

Returns:

Mask of same shape as class_ids and bool values. True where pixel matches class,

False where it doesn’t.

get_classes_mask(class_ids)

Returns a bool mask where classes are present.

Parameters:

class_ids (List[int]) – IDs of classes to be masked

Return type:

ndarray

Returns:

Mask of same shape as class_ids and bool values. True where pixel matches one of the classes,

False where it doesn’t.

property rgb_encoded: ndarray

Returns SemanticSegmentation2D.class_ids mask as RGB-encoded image matrix with shape (H x W x 3), with R (index: 0) being the lowest and B (index: 2) being the highest 8 bit.