pip3 install tensorbay
1# !/usr/bin/env python3 2 3from PIL import Image 4from tensorbay import GAS 5from tensorbay.dataset import Segment 6 7gas = GAS("<YOUR_ACCESSKEY>") 8 9dataset = Dataset("<DATASET_NAME>", gas) 10 11segment = dataset["<SEGMENT_NAME>"] 12for data in segment: 13 with data.open() as fp: 14 image = Image.open(fp) 15 width, height = image.size 16 image.show() 17
gas auth [YOUR_ACCESSKEY] # Use the AccessKey for the current environment.
gas dataset # List the names of all the datasets.
gas dataset tb:<dataset_name> # Create a new dataset.
gas ls tb:<dataset_name> # List the names of all the segments of the dataset.
gas ls -a tb:<dataset_name> # List all the files in all the segments of the dataset.
gas ls tb:<dataset_name>:<segment_name> # List all the files in a specific segment of the dataset.
gas dataset -d tb:<dataset_name> # Delete the dataset.
Create a 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 |
1curl --location --request POST '{service}/v1/datasets' \ 2--header 'x-token: {your_accesskey}' \ 3--header 'Content-Type: application/json' \ 4--data-raw '{ 5 "name": "my first dataset", 6 "type": 0 7}'
Output
# Response status
HttpStatus 201
# Response result
{
"id": "154e35ba-e895-4f09-969e-f8c9445efd2c"
}