tensorbay.label.catalog¶
Catalog.
Catalog
is used to describe the types of labels
contained in a DatasetBase
and
all the optional values of the label contents.
A Catalog
contains one or several SubcatalogBase
,
corresponding to different types of labels.
subcatalog classes |
explaination |
---|---|
subcatalog for classification type of label |
|
subcatalog for 2D bounding box type of label |
|
subcatalog for 3D bounding box type of label |
|
subcatalog for 2D keypoints type of label |
|
subcatalog for polygon type of label |
|
subcatalog for 2D polyline type of label |
|
subcatalog for multiple polygon type of label |
|
subcatalog for rle mask type of label |
|
subcatalog for 2D multiple polyline type of label |
|
subcatalog for transcripted sentence type of label |
- class tensorbay.label.catalog.Catalog[source]¶
Bases:
tensorbay.utility.repr.ReprMixin
,tensorbay.utility.attr.AttrsMixin
This class defines the concept of catalog.
Catalog
is used to describe the types of labels contained in aDatasetBase
and all the optional values of the label contents.A
Catalog
contains one or severalSubcatalogBase
, corresponding to different types of labels. Each of theSubcatalogBase
contains the features, fields and the specific definitions of the labels.Examples
>>> from tensorbay.utility import NameList >>> from tensorbay.label import ClassificationSubcatalog, CategoryInfo >>> classification_subcatalog = ClassificationSubcatalog() >>> categories = NameList() >>> categories.append(CategoryInfo("example")) >>> classification_subcatalog.categories = categories >>> catalog = Catalog() >>> catalog.classification = classification_subcatalog >>> catalog Catalog( (classification): ClassificationSubcatalog( (categories): NameList [...] ) )
- classmethod loads(contents: Dict[str, Any]) tensorbay.label.catalog._T [source]¶
Load a Catalog from a dict containing the catalog information.
- Parameters
contents – A dict containing all the information of the catalog.
- Returns
The loaded
Catalog
object.
Examples
>>> contents = { ... "CLASSIFICATION": { ... "categories": [ ... { ... "name": "example", ... } ... ] ... }, ... "KEYPOINTS2D": { ... "keypoints": [ ... { ... "number": 5, ... } ... ] ... }, ... } >>> Catalog.loads(contents) Catalog( (classification): ClassificationSubcatalog( (categories): NameList [...] ), (keypoints2d): Keypoints2DSubcatalog( (is_tracking): False, (keypoints): [...] ) )
- dumps() Dict[str, Any] [source]¶
Dumps the catalog into a dict containing the information of all the subcatalog.
- Returns
A dict containing all the subcatalog information with their label types as keys.
Examples
>>> # catalog is the instance initialized above. >>> catalog.dumps() {'CLASSIFICATION': {'categories': [{'name': 'example'}]}}