Documentation
Search…
Export data
To download your labeled data, create a release on the Releases tab of your dataset. A release is a snapshot of your dataset at a specific point in time.
By clicking the download link of a release, you obtain a release file in JSON format. This release file contains all information about the dataset, tasks, samples, and labels in the release.

Exporting the release file to different formats

You can export the release file to different formats with the Python SDK. Use the export_datasetutil function for this, setting the export_format parameter to one of the following:
Value
Description
coco-instance
COCO instance segmentation format
coco-panoptic
COCO panoptic segmentation format
yolo
Yolo Darknet object detection format
instance
Grayscale PNGs (16-bit) where the values correspond to instance ids
semantic
Grayscale PNGs (8-bit) where the values correspond to category ids
instance-color
Colored PNGs where the colors correspond to different instances
semantic-color
Colored PNGs where the colors correspond to different categories, with colors as configured in the label editor settings when available
Example:
1
# pip install segments-ai
2
from segments import SegmentsClient, SegmentsDataset
3
from segments.utils import export_dataset
4
5
# Initialize a SegmentsDataset from the release file
6
client = SegmentsClient('YOUR_API_KEY')
7
release = client.get_release('jane/flowers', 'v1.0') # Alternatively: release = 'flowers-v1.0.json'
8
dataset = SegmentsDataset(release, labelset='ground-truth', filter_by=['labeled', 'reviewed'])
9
10
# Export to COCO panoptic format
11
export_dataset(dataset, export_format='coco-panoptic')
Copied!
Alternatively, you can use the initialized SegmentsDataset to loop through the samples and labels, and visualize or process them in any way you please:
1
import matplotlib.pyplot as plt
2
from segments.utils import get_semantic_bitmap
3
4
for sample in dataset:
5
# Print the sample name and list of labeled objects
6
print(sample['name'])
7
print(sample['annotations'])
8
9
# Show the image
10
plt.imshow(sample['image'])
11
plt.show()
12
13
# Show the instance segmentation label
14
plt.imshow(sample['segmentation_bitmap'])
15
plt.show()
16
17
# Show the semantic segmentation label
18
semantic_bitmap = get_semantic_bitmap(sample['segmentation_bitmap'], sample['annotations'])
19
plt.imshow(semantic_bitmap)
20
plt.show()
Copied!

Structure of the release file

The general structure of the release file is as follows:
1
{
2
"name": "first release",
3
"description": "This is a first release of Segments.ai playground dataset",
4
"created_at": "2020-07-09 10:20:19.888887+00:00",
5
"dataset": {
6
"name": "flowers",
7
"task_type": "segmentation-bitmap",
8
"task_attributes": {...} # the categories etc.
9
"labelsets": [
10
** list of labelsets **
11
],
12
"samples": {
13
** list of samples **
14
}
15
}
16
17
}
Copied!

Label set

Each labelset entry contains the labelset's name and description:
1
{
2
"name": "ground-truth",
3
"description": ""
4
}
Copied!

Sample

Each sample entry contains information about the sample (name, image URL, ...) and a list of labels.
1
{
2
"name": "donuts.jpg",
3
"attributes": {
4
"image": {
5
"url": "https://segmentsai-prod.s3.eu-west-2.amazonaws.com/assets/segments/3b8b3da2-f09a-494b-999e-37250dfbf5b6.jpg"
6
}
7
},
8
"labels": {
9
/** list of labels, indexed by labelset **/
10
}
11
}
Copied!

Label

Each label contains basic information such as the time it was created, the user who created it, its status (e.g. LABELED). The attributes field contains all info about the labeled objects. Its contents depend on the labeling type (segmentation or bounding boxes) and are described in more detail here.
1
{
2
"label_status": "LABELED",
3
"attributes": {
4
"format_version": "0.1",
5
"annotations": [
6
{
7
"id": 1,
8
"category_id": 1
9
},
10
{
11
"id": 2,
12
"category_id": 1
13
},
14
{
15
"id": 3,
16
"category_id": 1
17
},
18
{
19
"id": 4,
20
"category_id": 1
21
}
22
],
23
"segmentation_bitmap": {
24
"url": "https://segmentsai-prod.s3.eu-west-2.amazonaws.com/assets/segments/504e7633-ef51-49c3-8b0e-d4eb9100532d.png"
25
}
26
}
27
}
Copied!
Please refer to this blog post for an example of training a model on exported data.
Last modified 2d ago