tensorbay.dataset.dataset

Notes, DatasetBase, Dataset and FusionDataset.

Notes contains the basic information of a DatasetBase.

DatasetBase defines the basic concept of a dataset, which is the top-level structure to handle your data files, labels and other additional information.

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

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

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

class tensorbay.dataset.dataset.Notes(is_continuous: bool = False, bin_point_cloud_fields: Optional[Iterable[str]] = None)[source]

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

This is a class stores the basic information of DatasetBase.

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

  • bin_point_cloud_fields – The field names of the bin point cloud files in the dataset.

classmethod loads(contents: Dict[str, Any]) tensorbay.dataset.dataset._T[source]

Loads a Notes instance from the given contents.

Parameters

contents

The given dict containing the dataset notes:

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

Returns

The loaded Notes instance.

keys() KeysView[str][source]

Return the valid keys within the notes.

Returns

The valid keys within the notes.

dumps() Dict[str, Any][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>
        ...
    ]
}

class tensorbay.dataset.dataset.DatasetBase(name: str, gas: Optional[GAS] = None, revision: Optional[str] = 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.

keys() Tuple[str, ...][source]

Get all segment names.

Returns

A tuple containing all segment names.

load_catalog(filepath: str) None[source]

Load catalog from a json file.

Parameters

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

add_segment(segment: tensorbay.dataset.dataset._T) None[source]

Add a segment to the dataset.

Parameters

segment – The segment to be added.

class tensorbay.dataset.dataset.Dataset(name: str, gas: Optional[GAS] = None, revision: Optional[str] = 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: str = 'default') tensorbay.dataset.segment.Segment[source]

Create a segment with the given name.

Parameters

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

Returns

The created Segment.

class tensorbay.dataset.dataset.FusionDataset(name: str, gas: Optional[GAS] = None, revision: Optional[str] = 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: str = 'default') tensorbay.dataset.segment.FusionSegment[source]

Create a fusion segment with the given name.

Parameters

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

Returns

The created FusionSegment.