Graviti TensorBay Python SDK
Project description
TensorBay Python SDK
IMPORTANT: TensorBay system underwent a huge refactoring, which broke the downward compatibility
of OpenAPI and SDK. As a result, the SDK under version v1.6.0 does not work anymore.
Please update tensorbay SDK to v1.6.0 or a higher version.
TensorBay Python SDK is a python library to access TensorBay
and manage your datasets.
It provides:
- A pythonic way to access your TensorBay resources by TensorBay OpenAPI.
- An easy-to-use CLI tool
gas
(Graviti AI service) to communicate with TensorBay. - A consistent dataset format to read and write your datasets.
Installation
pip3 install tensorbay
Documentation
More information can be found on the documentation site
Usage
An AccessKey is needed to communicate with TensorBay. Please visit this page to get an AccessKey first.
Authorize a client object
from tensorbay import GAS
gas = GAS("<YOUR_ACCESSKEY>")
Create a Dataset
gas.create_dataset("DatasetName")
List Dataset names
dataset_names = gas.list_dataset_names()
Upload images to the Dataset
from tensorbay.dataset import Data, Dataset
# Organize the local dataset by the "Dataset" class before uploading.
dataset = Dataset("DatasetName")
# TensorBay uses "segment" to separate different parts in a dataset.
segment = dataset.create_segment("SegmentName")
segment.append(Data("0000001.jpg"))
segment.append(Data("0000002.jpg"))
dataset_client = gas.upload_dataset(dataset, jobs=8)
# TensorBay provides dataset version control feature, commit the uploaded data before using it.
dataset_client.commit("Initial commit")
Read images from the Dataset
from PIL import Image
dataset = Dataset("DatasetName", gas)
segment = dataset[0]
for data in segment:
with data.open() as fp:
image = Image.open(fp)
width, height = image.size
image.show()
Delete the Dataset
gas.delete_dataset("DatasetName")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tensorbay-1.17.0.tar.gz
(238.4 kB
view hashes)
Built Distribution
tensorbay-1.17.0-py3-none-any.whl
(350.2 kB
view hashes)
Close
Hashes for tensorbay-1.17.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0f170eb6dfc869231c86a17d24c4336e77b3160c8edad7cf6fe2b492db06e91 |
|
MD5 | a598c5db9df439a3f65d75ca235449f8 |
|
BLAKE2b-256 | d7899d93ffc518df51fb59c08043f8599ade715558d95de6a3420147ba0b45e8 |