Skip to content

Commit 17202c2

Browse files
authored
Merge f293411 into c3e1f82
2 parents c3e1f82 + f293411 commit 17202c2

File tree

1 file changed

+49
-23
lines changed

1 file changed

+49
-23
lines changed

docs/source/reference/label_format.rst

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ and the unique ones will be explained under the corresponding type of label.
4545
Take a :ref:`2D box label <reference/label_format:Box2D>` as an example:
4646

4747
>>> from tensorbay.label import LabeledBox2D
48-
>>> label = LabeledBox2D(
48+
>>> box2d_label = LabeledBox2D(
4949
... 10, 20, 30, 40,
5050
... category="category",
5151
... attributes={"attribute_name": "attribute_value"},
5252
... instance="instance_ID"
5353
... )
54-
>>> label
54+
>>> box2d_label
5555
LabeledBox2D(10, 20, 30, 40)(
5656
(category): 'category',
5757
(attributes): {...},
@@ -63,7 +63,7 @@ category
6363

6464
Category is a string indicating the class of the labeled object.
6565

66-
>>> label.category
66+
>>> box2d_label.category
6767
'data_category'
6868

6969
attributes
@@ -74,7 +74,7 @@ and there is no limit on the number of attributes.
7474

7575
The attribute names and values are stored in key-value pairs.
7676

77-
>>> label.attributes
77+
>>> box2d_label.attributes
7878
{'attribute_name': 'attribute_value'}
7979

8080

@@ -84,7 +84,7 @@ instance
8484
Instance is the unique id for the object inside of the label,
8585
which is mostly used for tracking tasks.
8686

87-
>>> label.instance
87+
>>> box2d_label.instance
8888
"instance_ID"
8989

9090
******************************
@@ -121,13 +121,16 @@ or set the ``is_tracking`` attr after initialization.
121121
category information
122122
====================
123123

124+
common category information
125+
---------------------------
126+
124127
If the label of this type in the dataset has category,
125128
then the subcatalog should contain all the optional categories.
126129

127130
Each :ref:`reference/label_format:category` of a label
128131
appeared in the dataset should be within the categories of the subcatalog.
129132

130-
Category information can be added to the subcatalog.
133+
Common category information can be added to the most subcatalogs except for mask subcatalog.
131134

132135
>>> box2d_subcatalog.add_category(name="cat", description="The Flerken")
133136
>>> box2d_subcatalog.categories
@@ -139,6 +142,25 @@ Category information can be added to the subcatalog.
139142
a :ref:`reference/label_format:category`.
140143
See details in :class:`~tensorbay.label.supports.CategoryInfo`.
141144

145+
mask category information
146+
-------------------------
147+
148+
If the label of this type in the dataset has mask_category,
149+
then the subcatalog should contain all the optional mask_categories.
150+
151+
Each category of a mask label appeared in the dataset should be within the categories of the subcatalog.
152+
153+
MaskCategory information can be added to the mask subcatalog.
154+
155+
>>> semantic_mask_subcatalog.add_category(name="cat", category_id=1, description="Ragdoll")
156+
>>> semantic_mask_subcatalog.categories
157+
NameList [
158+
MaskCategoryInfo("cat")(...)
159+
]
160+
161+
:class:`~tensorbay.label.supports.MaskCategoryInfo` is used to describe the category information of pixels in the mask image.
162+
See details in :class:`~tensorbay.label.supports.MaskCategoryInfo`.
163+
142164
attributes information
143165
======================
144166

@@ -233,7 +255,7 @@ Before adding the classification label to data,
233255

234256
:class:`~tensorbay.label.label_classification.ClassificationSubcatalog`
235257
has categories and attributes information,
236-
see :ref:`reference/label_format:category information` and
258+
see :ref:`reference/label_format:common category information` and
237259
:ref:`reference/label_format:attributes information` for details.
238260

239261
To add a :class:`~tensorbay.label.label_classification.Classification` label to one data:
@@ -348,7 +370,7 @@ Before adding the Box2D labels to data,
348370

349371
:class:`~tensorbay.label.label_box.Box2DSubcatalog`
350372
has categories, attributes and tracking information,
351-
see :ref:`reference/label_format:category information`,
373+
see :ref:`reference/label_format:common category information`,
352374
:ref:`reference/label_format:attributes information` and
353375
:ref:`reference/label_format:tracking information` for details.
354376

@@ -500,7 +522,7 @@ Before adding the Box3D labels to data,
500522

501523
:class:`~tensorbay.label.label_box.Box3DSubcatalog`
502524
has categories, attributes and tracking information,
503-
see :ref:`reference/label_format:category information`,
525+
see :ref:`reference/label_format:common category information`,
504526
:ref:`reference/label_format:attributes information` and
505527
:ref:`reference/label_format:tracking information` for details.
506528

@@ -623,7 +645,7 @@ Before adding 2D keypoints labels to the dataset,
623645
:class:`~tensorbay.label.label_keypoints.Keypoints2DSubcatalog` should be defined.
624646

625647
Besides :ref:`reference/label_format:attributes information`,
626-
:ref:`reference/label_format:category information`,
648+
:ref:`reference/label_format:common category information`,
627649
:ref:`reference/label_format:tracking information` in
628650
:class:`~tensorbay.label.label_keypoints.Keypoints2DSubcatalog`,
629651
it also has :attr:`~tensorbay.label.label_keypoints.Keypoints2DSubcatalog.keypoints`
@@ -781,7 +803,7 @@ Before adding the Polygon labels to data,
781803

782804
:class:`~tensorbay.label.label_polygon.PolygonSubcatalog`
783805
has categories, attributes and tracking information,
784-
see :ref:`reference/label_format:category information`,
806+
see :ref:`reference/label_format:common category information`,
785807
:ref:`reference/label_format:attributes information` and
786808
:ref:`reference/label_format:tracking information` for details.
787809

@@ -891,7 +913,7 @@ Before adding the MultiPolygon labels to data,
891913

892914
:class:`~tensorbay.label.label_polygon.MultiPolygonSubcatalog`
893915
has categories, attributes and tracking information,
894-
see :ref:`reference/label_format:category information`,
916+
see :ref:`reference/label_format:common category information`,
895917
:ref:`reference/label_format:attributes information` and
896918
:ref:`reference/label_format:tracking information` for details.
897919

@@ -995,7 +1017,7 @@ Before adding the RLE labels to data,
9951017

9961018
:class:`~tensorbay.label.label_polygon.RLESubcatalog`
9971019
has categories, attributes and tracking information,
998-
see :ref:`reference/label_format:category information`,
1020+
see :ref:`reference/label_format:common category information`,
9991021
:ref:`reference/label_format:attributes information` and
10001022
:ref:`reference/label_format:tracking information` for details.
10011023

@@ -1111,7 +1133,7 @@ Before adding the Polyline2D labels to data,
11111133

11121134
:class:`~tensorbay.label.label_polyline.Polyline2DSubcatalog`
11131135
has categories, attributes and tracking information,
1114-
see :ref:`reference/label_format:category information`,
1136+
see :ref:`reference/label_format:common category information`,
11151137
:ref:`reference/label_format:attributes information` and
11161138
:ref:`reference/label_format:tracking information` for details.
11171139

@@ -1221,7 +1243,7 @@ Before adding the MultiPolyline2D labels to data,
12211243

12221244
:class:`~tensorbay.label.label_polyline.MultiPolyline2DSubcatalog`
12231245
has categories, attributes and tracking information,
1224-
see :ref:`reference/label_format:category information`,
1246+
see :ref:`reference/label_format:common category information`,
12251247
:ref:`reference/label_format:attributes information` and
12261248
:ref:`reference/label_format:tracking information` for details.
12271249

@@ -1467,7 +1489,7 @@ In TensorBay, the structure of SemanticMask label is unified as follows::
14671489
``local_path`` is the storage path of the mask image. TensorBay only supports single-channel, gray-scale png images.
14681490
If the number of categories exceeds 256, the color depth of this image should be 16 bits, otherwise it is 8 bits.
14691491

1470-
The gray-scale value of the pixel corresponds to the index of the ``categories`` within the :class:`~tensorbay.label.label_mask.SemanticMaskSubcatalog`.
1492+
The gray-scale value of the pixel corresponds to the categoryId of the ``categories`` within the :class:`~tensorbay.label.label_mask.SemanticMaskSubcatalog`.
14711493

14721494
Each data can only be assigned with one :class:`~tensorbay.label.label_mask.SemanticMask` label.
14731495

@@ -1509,8 +1531,8 @@ SemanticMaskSubcatalog
15091531
Before adding the SemanticMask labels to data,
15101532
:class:`~tensorbay.label.label_mask.SemanticMaskSubcatalog` should be defined.
15111533

1512-
:class:`~tensorbay.label.label_mask.SemanticMaskSubcatalog` has categories and attributes,
1513-
see :ref:`reference/label_format:category information` and
1534+
:class:`~tensorbay.label.label_mask.SemanticMaskSubcatalog` has mask categories and attributes,
1535+
see :ref:`reference/label_format:mask category information` and
15141536
:ref:`reference/label_format:attributes information` for details.
15151537

15161538
To add a :class:`~tensorbay.label.label_mask.SemanticMask` label to one data:
@@ -1551,6 +1573,9 @@ In TensorBay, the structure of InstanceMask label is unified as follows::
15511573
``local_path`` is the storage path of the mask image. TensorBay only supports single-channel, gray-scale png images.
15521574
If the number of categories exceeds 256, the color depth of this image should be 16 bits, otherwise it is 8 bits.
15531575

1576+
There are pixels in the InstanceMask that do not represent the instance, such as backgrounds or borders. This information is written to the
1577+
``categories`` within the :class:`~tensorbay.label.label_mask.InstanceMaskSubcatalog`.
1578+
15541579
Each data can only be assigned with one :class:`~tensorbay.label.label_mask.InstanceMask` label.
15551580

15561581
To create a :class:`~tensorbay.label.label_mask.InstanceMask` label:
@@ -1591,8 +1616,9 @@ InstanceMaskSubcatalog
15911616
Before adding the InstanceMask labels to data,
15921617
:class:`~tensorbay.label.label_mask.InstanceMaskSubcatalog` should be defined.
15931618

1594-
:class:`~tensorbay.label.label_mask.InstanceMaskSubcatalog` has attributes,
1595-
see :ref:`reference/label_format:attributes information` for details.
1619+
:class:`~tensorbay.label.label_mask.InstanceMaskSubcatalog` has mask categories and attributes,
1620+
see :ref:`reference/label_format:mask category information` and
1621+
:ref:`reference/label_format:attributes information` for details.
15961622

15971623
To add a :class:`~tensorbay.label.label_mask.InstanceMask` label to one data:
15981624

@@ -1633,7 +1659,7 @@ In TensorBay, the structure of PanopticMask label is unified as follows::
16331659
``local_path`` is the storage path of the mask image. TensorBay only supports single-channel, gray-scale png images.
16341660
If the number of categories exceeds 256, the color depth of this image should be 16 bits, otherwise it is 8 bits.
16351661

1636-
The gray-scale value of the pixel corresponds to the index of the ``categories`` within the :class:`~tensorbay.label.label_mask.PanopticMaskSubcatalog`.
1662+
The gray-scale value of the pixel corresponds to the categoryId of the ``categories`` within the :class:`~tensorbay.label.label_mask.PanopticMaskSubcatalog`.
16371663

16381664
Each data can only be assigned with one :class:`~tensorbay.label.label_mask.PanopticMask` label.
16391665

@@ -1689,8 +1715,8 @@ PanopticMaskSubcatalog
16891715
Before adding the PanopticMask labels to data,
16901716
:class:`~tensorbay.label.label_mask.PanopticMaskSubcatalog` should be defined.
16911717

1692-
:class:`~tensorbay.label.label_mask.PanopticMaskSubcatalog` has categories and attributes,
1693-
see :ref:`reference/label_format:category information` and
1718+
:class:`~tensorbay.label.label_mask.PanopticMaskSubcatalog` has mask categories and attributes,
1719+
see :ref:`reference/label_format:mask category information` and
16941720
:ref:`reference/label_format:attributes information` for details.
16951721

16961722
To add a :class:`~tensorbay.label.label_mask.PanopticMask` label to one data:

0 commit comments

Comments
 (0)