tensorbay.dataset.dataset#

The implementation of the TensorBay dataset.

class tensorbay.dataset.dataset.Notes(is_continuous=False, bin_point_cloud_fields=None)[source]#

Bases: tensorbay.utility.attr.AttrsMixin, tensorbay.utility.repr.ReprMixin

This is a class stores the basic information of DatasetBase.

Parameters
  • is_continuous (bool) – Whether the data inside the dataset is time-continuous.

  • bin_point_cloud_fields (Optional[List[str]]) – The field names of the bin point cloud files in the dataset.

Return type

None

classmethod loads(contents)[source]#

Loads a Notes instance from the given contents.

Parameters

contents (Dict[str, Any]) –

The given dict containing the dataset notes:

{
    "isContinuous":            <boolean>
    "binPointCloudFields": [   <array> or null
            <field_name>,      <str>
            ...
    ]
}

Returns

The loaded Notes instance.

Return type

tensorbay.dataset.dataset._T

keys()[source]#

Return the valid keys within the notes.

Returns

The valid keys within the notes.

Return type

KeysView[str]

dumps()[source]#

Dumps the notes into a dict.

Returns

A dict containing all the information of the Notes:

{
    "isContinuous":           <boolean>
    "binPointCloudFields": [  <array> or null
        <field_name>,         <str>
        ...
    ]
}

Return type

Dict[str, Any]

class tensorbay.dataset.dataset.DatasetBase(name, gas=None, revision=None)[source]#

Bases: Sequence[tensorbay.dataset.dataset._T], tensorbay.utility.name.NameMixin

This class defines the concept of a basic dataset.

DatasetBase represents a whole dataset contains several segments and is the base class of Dataset and FusionDataset.

A dataset with labels should contain a Catalog indicating all the possible values of the labels.

Parameters
  • name – The name of the dataset.

  • gas – The GAS client for getting a remote dataset.

  • revision – The revision of the remote dataset.

catalog#

The Catalog of the dataset.

notes#

The Notes of the dataset.

property cache_enabled: bool#

Whether the cache is enabled.

Returns

Whether the cache is enabled.

enable_cache(cache_path='')[source]#

Enable cache when open the remote data of the dataset.

Parameters

cache_path (str) – The path to store the cache.

Return type

None

keys()[source]#

Get all segment names.

Returns

A tuple containing all segment names.

Return type

Tuple[str, …]

load_catalog(filepath)[source]#

Load catalog from a json file.

Parameters

filepath (str) – The path of the json file which contains the catalog information.

Return type

None

add_segment(segment)[source]#

Add a segment to the dataset.

Parameters

segment (tensorbay.dataset.dataset._T) – The segment to be added.

Return type

None

class tensorbay.dataset.dataset.Dataset(name, gas=None, revision=None)[source]#

Bases: tensorbay.dataset.dataset.DatasetBase[tensorbay.dataset.segment.Segment]

This class defines the concept of dataset.

Dataset is made up of data collected from only one sensor or data without sensor information. It consists of a list of Segment.

create_segment(segment_name='default')[source]#

Create a segment with the given name.

Parameters

segment_name (str) – The name of the segment to create, which default value is an empty string.

Returns

The created Segment.

Return type

tensorbay.dataset.segment.Segment

class tensorbay.dataset.dataset.FusionDataset(name, gas=None, revision=None)[source]#

Bases: tensorbay.dataset.dataset.DatasetBase[tensorbay.dataset.segment.FusionSegment]

This class defines the concept of fusion dataset.

FusionDataset is made up of data collected from multiple sensors. It consists of a list of FusionSegment.

create_segment(segment_name='default')[source]#

Create a fusion segment with the given name.

Parameters

segment_name (str) – The name of the fusion segment to create, which default value is an empty string.

Returns

The created FusionSegment.

Return type

tensorbay.dataset.segment.FusionSegment