tensorbay.dataset.segment¶
Segment and FusionSegment.
Segment is a concept in Dataset
.
It is the structure that composes Dataset
,
and consists of a series of Data
without sensor information.
Fusion segment is a concept in FusionDataset
.
It is the structure that composes FusionDataset
,
and consists of a list of Frame
along with multiple Sensors
.
- class tensorbay.dataset.segment.Segment(name: str = 'default', client: Optional[DatasetClient] = None)[source]¶
Bases:
tensorbay.utility.name.NameMixin
,tensorbay.utility.user.UserMutableSequence
[DataBase._Type
]This class defines the concept of segment.
Segment is a concept in
Dataset
. It is the structure that composesDataset
, and consists of a series ofData
without sensor information.If the segment is inside of a time-continuous
Dataset
, the time continuity of the data should be indicated by :meth`~graviti.dataset.data.Data.remote_path`.Since
Segment
extendsUserMutableSequence
, its basic operations are the same as a list’s.To initialize a Segment and add a
Data
to it:segment = Segment(segment_name) segment.append(Data())
- Parameters
name – The name of the segment, whose default value is an empty string.
client – The DatasetClient if you want to read the segment from tensorbay.
- sort(*, key: Callable[[DataBase._Type], Any] = <function Segment.<lambda>>, reverse: bool = False) None [source]¶
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
- Parameters
key – If a key function is given, apply it once to each item of the segment, and sort them according to their function values in ascending or descending order. By default, the data within the segment is sorted by fileuri.
reverse – The reverse flag can be set as True to sort in descending order.
- Raises
NotImplementedError – The sort method for segment init from client is not supported yet.
- class tensorbay.dataset.segment.FusionSegment(name: str = 'default', client: Optional[FusionDatasetClient] = None)[source]¶
Bases:
tensorbay.utility.name.NameMixin
,tensorbay.utility.user.UserMutableSequence
[tensorbay.dataset.frame.Frame
]This class defines the concept of fusion segment.
Fusion segment is a concept in
FusionDataset
. It is the structure that composesFusionDataset
, and consists of a list ofFrame
.Besides, a fusion segment contains multiple
Sensors
correspoinding to theData
under eachFrame
.If the segment is inside of a time-continuous
FusionDataset
, the time continuity of the frames should be indicated by the index inside the fusion segment.Since
FusionSegment
extendsUserMutableSequence
, its basic operations are the same as a list’s.To initialize a
FusionSegment
and add aFrame
to it:fusion_segment = FusionSegment(fusion_segment_name) frame = Frame() ... fusion_segment.append(frame)
- Parameters
name – The name of the fusion segment, whose default value is an empty string.
client – The FusionDatasetClient if you want to read the segment from tensorbay.
- property sensors: tensorbay.sensor.sensor.Sensors¶
Return the sensors of the fusion segment.
- Returns
The
Sensors
of the fusion dataset.