Common Subcatalog Properties
Before creating a label or adding a label to data, it’s necessary to define the annotation rules of the specific label type inside the dataset. This task is done by subcatalog.
Different label types have different subcatalog classes.
Take Box2DSubcatalog
as an example
to describe some common features of subcatalog.
>>> from tensorbay.label import Box2DSubcatalog
>>> box2d_subcatalog = Box2DSubcatalog(is_tracking=True)
>>> box2d_subcatalog
Box2DSubcatalog(
(is_tracking): True
)
tracking information
If the label of this type in the dataset has the information of instance IDs, then the subcatalog should set a flag to show its support for tracking information.
Pass True
to the is_tracking
parameter while creating the subcatalog,
or set the is_tracking
attr after initialization.
>>> box2d_subcatalog.is_tracking = True
category information
common category information
If the label of this type in the dataset has category, then the subcatalog should contain all the optional categories.
Each category of a label appeared in the dataset should be within the categories of the subcatalog.
Common category information can be added to the most subcatalogs except for mask subcatalogs.
>>> box2d_subcatalog.add_category(name="cat", description="The Flerken")
>>> box2d_subcatalog.categories
NameList [
CategoryInfo("cat")
]
CategoryInfo
is used to describe
a category.
See details in CategoryInfo
.
mask category information
If the mask label in the dataset has category information, then the subcatalog should contain all the optional mask categories.
MaskCategory information can be added to the mask subcatalog.
Different from common category, mask category information must have category_id
which
is the pixel value of this category in all mask images.
>>> semantic_mask_subcatalog.add_category(name="cat", category_id=1, description="Ragdoll")
>>> semantic_mask_subcatalog.categories
NameList [
MaskCategoryInfo("cat")(...)
]
MaskCategoryInfo
is used to describe the category information of pixels in the mask image.
See details in MaskCategoryInfo
.
attributes information
If the label of this type in the dataset has attributes, then the subcatalog should contain all the rules for different attributes.
Each attributes of a label appeared in the dataset should follow the rules set in the attributes of the subcatalog.
Attribute information ca be added to the subcatalog.
>>> box2d_subcatalog.add_attribute(
... name="attribute_name",
... type_="number",
... maximum=100,
... minimum=0,
... description="attribute description"
... )
>>> box2d_subcatalog.attributes
NameList [
AttributeInfo("attribute_name")(...)
]
AttributeInfo
is used to describe the rules of an
attributes, which refers to the Json schema method.
See details in AttributeInfo
.
Other unique subcatalog features will be explained in the corresponding label type section.