pip3 install tensorbay
# !/usr/bin/env python3
from PIL import Image
from tensorbay import GAS
from tensorbay.dataset import Segment
gas = GAS("<YOUR_ACCESSKEY>")
dataset_client = gas.get_dataset("DatasetName")
segment = Segment("", dataset_client)
for data in segment:
with data.open() as fp:
image = Image.open(fp)
width, height = image.size
image.show()
gas config [accessKey] # Use the AccessKey for the current environment.
gas create tb:BSTLD # Create the "BSTLD" dataset.
gas ls # List the names of all datasets.
gas ls tb:BSTLD # List the names of all segments of BSTLD.
gas ls -a tb:BSTLD # List all the files in all the segments of BSTLD.
gas ls tb:BSTLD:train # List all the files in the train segment of BSTLD.
gas delete tb:BSTLD # Delete the "BSTLD" dataset.
Create a TensorBay dataset with version control. The dataset name must be unique.
Request Path
POST /v1/datasets
Request Parameters
Body
Name | Type | Required? | Description |
---|---|---|---|
name | string | Yes | Dataset name |
type | int | No | The default is 0, 0-normal dataset, 1-Fusion dataset |
Request Instance
curl --location --request POST '{service}/v1/datasets' \
--header 'x-token: {your_accesskey}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "my first dataset",
"type": 0
}'
Output
# Response status
HttpStatus 201
# Response result
{
"id": "154e35ba-e895-4f09-969e-f8c9445efd2c"
}