tensorbay.client.dataset¶
Class DatasetClientBase, DatasetClient and FusionDatasetClient.
DatasetClient
is a remote concept. It contains the information
needed for determining a unique dataset on TensorBay, and provides a series of methods within
dataset scope, such as DatasetClient.get_segment()
, DatasetClient.list_segment_names()
,
DatasetClient.commit
, and so on.
In contrast to the DatasetClient
,
Dataset
is a local concept. It represents a
dataset created locally. Please refer to
Dataset
for more information.
Similar to the DatasetClient
, the
FusionDatasetClient
represents
the fusion dataset on TensorBay, and its local counterpart is
FusionDataset
.
Please refer to FusionDataset
for more information.
- class tensorbay.client.dataset.DatasetClientBase(name: str, dataset_id: str, gas: GAS, *, status: tensorbay.client.status.Status, alias: str, is_public: bool)[source]¶
Bases:
tensorbay.client.version.VersionControlClient
This class defines the basic concept of the dataset client.
A
DatasetClientBase
contains the information needed for determining a unique dataset on TensorBay, and provides a series of method within dataset scope, such asDatasetClientBase.list_segment_names()
andDatasetClientBase.upload_catalog()
.- Parameters
name – Dataset name.
dataset_id – Dataset ID.
gas – The initial client to interact between local and TensorBay.
status – The version control status of the dataset.
alias – Dataset alias.
is_public – Whether the dataset is public.
- name¶
Dataset name.
- dataset_id¶
Dataset ID.
- status¶
The version control status of the dataset.
- property is_public: bool¶
Return whether the dataset is public.
- Returns
Whether the dataset is public.
- update_notes(*, is_continuous: Optional[bool] = None, bin_point_cloud_fields: Optional[Iterable[str]] = Ellipsis) None [source]¶
Update the notes.
- Parameters
is_continuous – Whether the data is continuous.
bin_point_cloud_fields – The field names of the bin point cloud files in the dataset.
- get_notes() tensorbay.dataset.dataset.Notes [source]¶
Get the notes.
- Returns
The
Notes
.
- list_segment_names() tensorbay.client.lazy.PagingList[str] [source]¶
List all segment names in a certain commit.
- Returns
The PagingList of segment names.
- get_catalog() tensorbay.label.catalog.Catalog [source]¶
Get the catalog of the certain commit.
- Returns
Required
Catalog
.
- upload_catalog(catalog: tensorbay.label.catalog.Catalog) None [source]¶
Upload a catalog to the draft.
- Parameters
catalog –
Catalog
to upload.
- class tensorbay.client.dataset.DatasetClient(name: str, dataset_id: str, gas: GAS, *, status: tensorbay.client.status.Status, alias: str, is_public: bool)[source]¶
Bases:
tensorbay.client.dataset.DatasetClientBase
This class defines
DatasetClient
.DatasetClient
inherits fromDataClientBase
and provides more methods within a dataset scope, such asDatasetClient.get_segment()
,DatasetClient.commit
andDatasetClient.upload_segment()
. In contrast toFusionDatasetClient
, aDatasetClient
has only one sensor.- get_or_create_segment(name: str = 'default') tensorbay.client.segment.SegmentClient [source]¶
Get or create a segment with the given name.
- Parameters
name – The name of the fusion segment.
- Returns
The created
SegmentClient
with given name.
- create_segment(name: str = 'default') tensorbay.client.segment.SegmentClient [source]¶
Create a segment with the given name.
- Parameters
name – The name of the fusion segment.
- Returns
The created
SegmentClient
with given name.- Raises
NameConflictError – When the segment exists.
- copy_segment(source_name: str, target_name: Optional[str] = None, *, source_client: Optional[tensorbay.client.dataset.DatasetClient] = None, strategy: str = 'abort') tensorbay.client.segment.SegmentClient [source]¶
Copy segment to this dataset.
- Parameters
source_name – The source name of the copied segment.
target_name – The target name of the copied segment. This argument is used to specify a new name of the copied segment. If None, the name of the copied segment will not be changed after copy.
source_client – The source dataset client of the copied segment. This argument is used to specify where the copied segment comes from when the copied segment is from another commit, draft or even another dataset. If None, the copied segment comes from this dataset.
strategy –
The strategy of handling the name conflict. There are three options:
”abort”: stop copying and raise exception;
”override”: the source segment will override the origin segment;
”skip”: keep the origin segment.
- Returns
The client of the copied target segment.
- move_segment(source_name: str, target_name: str, *, strategy: str = 'abort') tensorbay.client.segment.SegmentClient [source]¶
Move/Rename segment in this dataset.
- Parameters
source_name – The source name of the moved segment.
target_name – The target name of the moved segment.
strategy –
The strategy of handling the name conflict. There are three options:
”abort”: stop moving and raise exception;
”override”: the source segment will override the origin segment;
”skip”: keep the origin segment.
- Returns
The client of the moved target segment.
- get_segment(name: str = 'default') tensorbay.client.segment.SegmentClient [source]¶
Get a segment in a certain commit according to given name.
- Parameters
name – The name of the required segment.
- Returns
The required
SegmentClient
.- Raises
ResourceNotExistError – When the required segment does not exist.
- upload_segment(segment: tensorbay.dataset.segment.Segment, *, jobs: int = 1, skip_uploaded_files: bool = False, quiet: bool = False) tensorbay.client.segment.SegmentClient [source]¶
Upload a
Segment
to the dataset.This function will upload all info contains in the input
Segment
, which includes:Create a segment using the name of input Segment.
Upload all Data in the Segment to the dataset.
- Parameters
segment – The
Segment
contains the information needs to be upload.jobs – The number of the max workers in multi-thread uploading method.
skip_uploaded_files – True for skipping the uploaded files.
quiet – Set to True to stop showing the upload process bar.
- Raises
Exception – When the upload got interrupted by Exception.
- Returns
The
SegmentClient
used for uploading the data in the segment.
- get_diff(*, head: Optional[Union[str, int]] = None) tensorbay.client.diff.DatasetDiff [source]¶
Get a brief diff between head and its parent commit.
- Parameters
head – Target version identification. Type int for draft number, type str for revision. If not given, use the current commit id.
Examples
>>> self.get_diff(head="b382450220a64ca9b514dcef27c82d9a")
- Returns
The brief diff between head and its parent commit.
- class tensorbay.client.dataset.FusionDatasetClient(name: str, dataset_id: str, gas: GAS, *, status: tensorbay.client.status.Status, alias: str, is_public: bool)[source]¶
Bases:
tensorbay.client.dataset.DatasetClientBase
This class defines
FusionDatasetClient
.FusionDatasetClient
inherits fromDatasetClientBase
and provides more methods within a fusion dataset scope, such asFusionDatasetClient.get_segment()
,FusionDatasetClient.commit
andFusionDatasetClient.upload_segment()
. In contrast toDatasetClient
, aFusionDatasetClient
has multiple sensors.- get_or_create_segment(name: str = 'default') tensorbay.client.segment.FusionSegmentClient [source]¶
Get or create a fusion segment with the given name.
- Parameters
name – The name of the fusion segment.
- Returns
The created
FusionSegmentClient
with given name.
- create_segment(name: str = 'default') tensorbay.client.segment.FusionSegmentClient [source]¶
Create a fusion segment with the given name.
- Parameters
name – The name of the fusion segment.
- Returns
The created
FusionSegmentClient
with given name.- Raises
NameConflictError – When the segment exists.
- copy_segment(source_name: str, target_name: Optional[str] = None, *, source_client: Optional[tensorbay.client.dataset.FusionDatasetClient] = None, strategy: str = 'abort') tensorbay.client.segment.FusionSegmentClient [source]¶
Copy segment to this dataset.
- Parameters
source_name – The source name of the copied segment.
target_name – The target name of the copied segment. This argument is used to specify a new name of the copied segment. If None, the name of the copied segment will not be changed after copy.
source_client – The source dataset client of the copied segment. This argument is used to specify where the copied segment comes from when the copied segment is from another commit, draft or even another dataset. If None, the copied segment comes from this dataset.
strategy –
The strategy of handling the name conflict. There are three options:
”abort”: stop copying and raise exception;
”override”: the source segment will override the origin segment;
”skip”: keep the origin segment.
- Returns
The client of the copied target segment.
- move_segment(source_name: str, target_name: str, *, strategy: str = 'abort') tensorbay.client.segment.FusionSegmentClient [source]¶
Move/Rename segment in this dataset.
- Parameters
source_name – The source name of the moved segment.
target_name – The target name of the moved segment.
strategy –
The strategy of handling the name conflict. There are three options:
”abort”: stop moving and raise exception;
”override”: the source segment will override the origin segment;
”skip”: keep the origin segment.
- Returns
The client of the moved target segment.
- get_segment(name: str = 'default') tensorbay.client.segment.FusionSegmentClient [source]¶
Get a fusion segment in a certain commit according to given name.
- Parameters
name – The name of the required fusion segment.
- Returns
The required
FusionSegmentClient
.- Raises
ResourceNotExistError – When the required fusion segment does not exist.
- upload_segment(segment: tensorbay.dataset.segment.FusionSegment, *, jobs: int = 1, skip_uploaded_files: bool = False, quiet: bool = False) tensorbay.client.segment.FusionSegmentClient [source]¶
Upload a fusion segment object to the draft.
This function will upload all info contains in the input
FusionSegment
, which includes:Create a segment using the name of input fusion segment object.
Upload all sensors in the segment to the dataset.
Upload all frames in the segment to the dataset.
- Parameters
segment – The
FusionSegment
.jobs – The number of the max workers in multi-thread upload.
skip_uploaded_files – Set it to True to skip the uploaded files.
quiet – Set to True to stop showing the upload process bar.
- Raises
Exception – When the upload got interrupted by Exception.
- Returns
- The
FusionSegmentClient
used for uploading the data in the segment.
- The