datumaro.experimental.categories#
Categories definitions for the experimental dataset system.
This module provides category management functionality using standard dataclasses instead of attrs, taking inspiration from the original Categories implementation.
Classes
A base class for annotation metainfo. |
|
|
A colormap that stores index-to-color mappings and provides efficient reverse lookup via an inverse colormap property. |
|
Types of label groups for organizing labels. |
|
Represents a group of labels with a specific group type. |
|
Describes a color map for segmentation masks. |
|
RGB color representation with named fields. |
- class datumaro.experimental.categories.GroupType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnum
Types of label groups for organizing labels.
- EXCLUSIVE = 0#
- INCLUSIVE = 1#
- class datumaro.experimental.categories.Categories[source]#
Bases:
object
A base class for annotation metainfo. It is supposed to include dataset-wide metainfo like available labels, label colors, label attributes etc.
- class datumaro.experimental.categories.LabelCategories(labels: ~typing.List[str] = <factory>, group_type: ~datumaro.experimental.categories.GroupType = GroupType.EXCLUSIVE)[source]#
Bases:
Categories
Represents a group of labels with a specific group type.
- add(label: str) int [source]#
Add a new label.
- Parameters:
label – The label name
- Returns:
The index of the newly added category
- Raises:
ValueError – If label already exists
- class datumaro.experimental.categories.RgbColor(r: int, g: int, b: int)[source]#
Bases:
NamedTuple
RGB color representation with named fields.
Create new instance of RgbColor(r, g, b)
- class datumaro.experimental.categories.Colormap(_data: ~typing.Dict[int, ~datumaro.experimental.categories.RgbColor] = <factory>)[source]#
Bases:
object
A colormap that stores index-to-color mappings and provides efficient reverse lookup via an inverse colormap property.
- class datumaro.experimental.categories.MaskCategories(colormap: ~datumaro.experimental.categories.Colormap = <factory>)[source]#
Bases:
Categories
Describes a color map for segmentation masks.
- classmethod generate(size: int = 255, include_background: bool = True) MaskCategories [source]#
Generates MaskCategories with the specified size.
- If include_background is True, the result will include the item
“0: (0, 0, 0)”, which is typically used as a background color.