tensorbay.label.label¶
Label.
A Data
instance contains one or several types of labels,
all of which are stored in label
.
Different label types correspond to different label classes classes.
label classes |
explaination |
---|---|
classification type of label |
|
2D bounding box type of label |
|
3D bounding box type of label |
|
polygon type of label |
|
polygon lists type of label |
|
rle mask type of label |
|
2D polyline type of label |
|
2D polyline lists type of label |
|
2D keypoints type of label |
|
transcripted sentence type of label |
- class tensorbay.label.label.Label[source]¶
Bases:
tensorbay.utility.repr.ReprMixin
,tensorbay.utility.attr.AttrsMixin
This class defines
label
.It contains growing types of labels referring to different tasks.
Examples
>>> from tensorbay.label import Classification >>> label = Label() >>> label.classification = Classification("example_category", {"example_attribute1": "a"}) >>> label Label( (classification): Classification( (category): 'example_category', (attributes): {...} ) )
- classmethod loads(contents: Dict[str, Any]) tensorbay.label.label._T [source]¶
Loads data from a dict containing the labels information.
- Parameters
contents – A dict containing the labels information.
- Returns
A
Label
instance containing labels information from the given dict.
Examples
>>> contents = { ... "CLASSIFICATION": { ... "category": "example_category", ... "attributes": {"example_attribute1": "a"} ... } ... } >>> Label.loads(contents) Label( (classification): Classification( (category): 'example_category', (attributes): {...} ) )
- dumps() Dict[str, Any] [source]¶
Dumps all labels into a dict.
- Returns
Dumped labels dict.
Examples
>>> from tensorbay.label import Classification >>> label = Label() >>> label.classification = Classification("category1", {"attribute1": "a"}) >>> label.dumps() {'CLASSIFICATION': {'category': 'category1', 'attributes': {'attribute1': 'a'}}}