class InstanceSegmentationAnnotation(SegmentationAnnotation):
Instance segmentation annotation.
Subclass of SegmentationAnnotation used to distinguish
instance segmentation annotations from semantic segmentation annotations.
The array representation of a single instance segmentation annotation is the same as that of a semantic segmentation annotation, but multiple instance segmentation annotations are combined into an array of shape (N, H, W) where the leading dimension N corresponds to the number of instance annotations instead of the number of classes as in semantic segmentation.
| Static Method | combine |
Combine instance segmentation annotations into instance masks. |
Inherited from SegmentationAnnotation:
| Method | to |
Convert the segmentation annotation to a binary mask. |
| Instance Variable | counts |
Run-length encoded mask data. |
| Instance Variable | height |
The height of the segmentation mask. |
| Instance Variable | width |
The width of the segmentation mask. |
| Class Method | _validate |
Undocumented |
| Class Method | _validate |
Undocumented |
| Class Method | _validate |
Undocumented |
| Static Method | _clip |
Undocumented |
| Static Method | _numpy |
Undocumented |
| Method | _serialize |
Undocumented |
@override
list[ InstanceSegmentationAnnotation], classes: list[ int] | None = None, n_classes: int | None = None) -> np.ndarray:
¶
Combine instance segmentation annotations into instance masks.
Note
As opposed to semantic segmentation, overlapping annotations are allowed and are not resolved in any way. One pixel can belong to multiple instances and will be marked as 1 in each instance mask it belongs to.
| Parameters | |
annotations:list[ | Instance segmentation annotations to combine. |
classes:list[ | Unused class IDs kept for API compatibility. |
nint | None | Unused class count kept for API compatibility. |
| Returns | |
np.ndarray | Combined instance segmentation masks of shape (N, H, W) where N is the number of instances. |