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=None)[source]
Bases:
tensorbay.utility.repr.ReprMixin
DataBase is a base class for the file and label combination.
- Parameters
timestamp (Optional[float]) – The timestamp for the file.
- Return type
None
- timestamp
The timestamp for the file.
- class tensorbay.dataset.data.Data(local_path, *, target_remote_path=None, timestamp=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 (str) – The file local path.
target_remote_path (Optional[str]) – The file remote path after uploading to tensorbay.
timestamp (Optional[float]) – The timestamp for the file.
- Return type
None
- path
The file local path.
- timestamp
The timestamp for the file.
- target_remote_path
The target remote path of the data.
- get_callback_body()[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": {...} } }
- Return type
Dict[str, Any]
- class tensorbay.dataset.data.RemoteData(remote_path, *, timestamp=None, url=None, cache_path='')[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 (str) – The file remote path.
timestamp (Optional[float]) – The timestamp for the file.
url (Optional[tensorbay.utility.file.URL]) – The URL instance used to get and update url.
cache_path (str) – The path to store the cache.
- Return type
None
- path
The file remote path.
- timestamp
The timestamp for the file.
- classmethod from_response_body(body, *, url=None, cache_path='')[source]
Loads a
RemoteData
object from a response body.- Parameters
body (Dict[str, Any]) –
The response body which contains the information of a remote data, whose format should be like:
{ "remotePath": <str>, "timestamp": <float>, "url": <str>, "label": { "CLASSIFICATION": {...}, "BOX2D": {...}, "BOX3D": {...}, "POLYGON": {...}, "POLYLINE2D": {...}, "KEYPOINTS2D": {...}, "SENTENCE": {...} } }
url (Optional[tensorbay.utility.file.URL]) – The URL instance used to get and update url.
cache_path (str) – The path to store the cache.
- Returns
The loaded
RemoteData
object.- Return type
tensorbay.dataset.data._T
- class tensorbay.dataset.data.AuthData(cloud_path, *, target_remote_path=None, timestamp=None, url=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 (str) – The cloud file path.
target_remote_path (Optional[str]) – The file remote path after uploading to tensorbay.
timestamp (Optional[float]) – The timestamp for the file.
url (Optional[tensorbay.utility.file.URL]) – The URL instance used to get and update url.
- Return type
None
- path
The cloud file path.
- timestamp
The timestamp for the file.
- get_callback_body()[source]
Get the callback request body for uploading.
- Returns
The callback request body, which looks like:
{ "cloudPath": <str>, "remotePath": <str>, "label": { "CLASSIFICATION": {...}, "BOX2D": {...}, "BOX3D": {...}, "POLYGON": {...}, "POLYLINE2D": {...}, "KEYPOINTS2D": {...}, "SENTENCE": {...} } }
- Return type
Dict[str, Any]