tensorbay.dataset.data¶
Data.
Data
is the most basic data unit of a Dataset
.
It contains path information of a data sample and its corresponding labels.
- class tensorbay.dataset.data.DataBase(timestamp: Optional[float] = None)[source]¶
Bases:
tensorbay.utility.repr.ReprMixin
DataBase is a base class for the file and label combination.
- Parameters
timestamp – The timestamp for the file.
- timestamp¶
The timestamp for the file.
- class tensorbay.dataset.data.Data(local_path: str, *, target_remote_path: Optional[str] = None, timestamp: Optional[float] = None)[source]¶
Bases:
tensorbay.dataset.data.DataBase
,tensorbay.utility.file.FileMixin
Data is a combination of a specific local file and its label.
It contains the file local path, label information of the file and the file metadata, such as timestamp.
A Data instance contains one or several types of labels.
- Parameters
local_path – The file local path.
target_remote_path – The file remote path after uploading to tensorbay.
timestamp – The timestamp for the file.
- path¶
The file local path.
- timestamp¶
The timestamp for the file.
- target_remote_path¶
The target remote path of the data.
- get_callback_body() Dict[str, Any] [source]¶
Get the callback request body for uploading.
- Returns
The callback request body, which look like:
{ "remotePath": <str>, "timestamp": <float>, "checksum": <str>, "fileSize": <int>, "label": { "CLASSIFICATION": {...}, "BOX2D": {...}, "BOX3D": {...}, "POLYGON": {...}, "POLYLINE2D": {...}, "KEYPOINTS2D": {...}, "SENTENCE": {...} } }
- class tensorbay.dataset.data.RemoteData(remote_path: str, *, timestamp: Optional[float] = None, _url_getter: Optional[Callable[[str], str]] = None)[source]¶
Bases:
tensorbay.dataset.data.DataBase
,tensorbay.utility.file.RemoteFileMixin
RemoteData is a combination of a specific tensorbay dataset file and its label.
It contains the file remote path, label information of the file and the file metadata, such as timestamp.
A RemoteData instance contains one or several types of labels.
- Parameters
remote_path – The file remote path.
timestamp – The timestamp for the file.
_url_getter – The url getter of the remote file.
- path¶
The file remote path.
- timestamp¶
The timestamp for the file.
- classmethod from_response_body(body: Dict[str, Any], *, _url_getter: Optional[Callable[[str], str]]) tensorbay.dataset.data._T [source]¶
Loads a
RemoteData
object from a response body.- Parameters
body –
The response body which contains the information of a remote data, whose format should be like:
{ "remotePath": <str>, "timestamp": <float>, "label": { "CLASSIFICATION": {...}, "BOX2D": {...}, "BOX3D": {...}, "POLYGON": {...}, "POLYLINE2D": {...}, "KEYPOINTS2D": {...}, "SENTENCE": {...} } }
_url_getter – The url getter of the remote file.
- Returns
The loaded
RemoteData
object.
- class tensorbay.dataset.data.AuthData(cloud_path: str, *, target_remote_path: Optional[str] = None, timestamp: Optional[float] = None, _url_getter: Optional[Callable[[str], str]] = None)[source]¶
Bases:
tensorbay.dataset.data.DataBase
,tensorbay.utility.file.RemoteFileMixin
AuthData is a combination of a specific cloud storaged file and its label.
It contains the cloud storage file path, label information of the file and the file metadata, such as timestamp.
An AuthData instance contains one or several types of labels.
- Parameters
cloud_path – The cloud file path.
target_remote_path – The file remote path after uploading to tensorbay.
timestamp – The timestamp for the file.
_url_getter – The url getter of the remote file.
- path¶
The cloud file path.
- timestamp¶
The timestamp for the file.