Python SDK quickstart
On the Segments.ai web platform you can create datasets, upload samples, create releases and download labels. All of these - and more - can also be done programmatically with the Python SDK.
pip install --upgrade segments-aifrom segments import SegmentsClient
import json
# You can find your api key at https://segments.ai/account
api_key = "YOUR_API_KEY_HERE"
client = SegmentsClient(api_key)Create a new dataset
name = "pets"
description = "A dataset with images of cats and dogs."
task_type = "segmentation-bitmap"
task_attributes = {
"format_version": "0.1",
"categories": [
{
"name": "cat",
"id": 1
},
{
"name": "dog",
"id": 2
},
{
"name": "other",
"id": 3
}
]
}
dataset = client.add_dataset(name, description, task_type, task_attributes)
print(dataset)Add samples to a dataset
Get the label of a sample
Optional: visualize the instance and semantic labels
What's next?
Last updated
Was this helpful?