Export¶
Export lets you save annotations and file paths from your dataset in common formats. Exports can be triggered from the GUI or through the Python API. You can export an entire dataset or a filtered subset using collection filters, or other criteria when using the Python API.
The following export formats are supported:
| Format | Content | File type |
|---|---|---|
| Sample Filenames | Absolute file paths of selected samples | TXT |
| Classification CSV | Image and whole-video classification annotations and confidence scores | CSV |
| COCO Object Detection | Bounding box annotations | JSON |
| YOLO Object Detection | Bounding box annotations | TXT labels + data.yaml (zipped) |
| COCO Segmentation Mask | Segmentation masks with bounding boxes | JSON |
| COCO Captions | Image captions | JSON |
| Pascal VOC Semantic Segmentation | Per-pixel class masks | PNG masks + class map |
| YouTube-VIS Segmentation Mask | Video segmentation mask tracks | JSON |
Export in the GUI¶
Open the export dialog from the Menu button in the top-right corner of any grid view
and select Export. The dialog shows a dropdown with all available formats for the current dataset.

Exporting annotations¶
For annotation formats (Image Classifications (CSV), Video Classifications (CSV),
Image Object Detections (COCO),
Image Object Detections (YOLO),
Image Segmentation Mask (COCO), Image Segmentation Mask (PASCAL VOC), Image Captions,
YouTube-VIS Video Segmentation Masks),
select the format and click Download. A zip file is created if the export includes multiple files.
The export includes all samples in the dataset.

Exporting sample filenames¶
The Image Filenames option exports the filenames of all samples that match the active collection
filters. Apply filters in the collection view before opening the export dialog to limit the export
to a specific subset.

Export in Python¶
Export a dataset¶
Call dataset.export() to get an export object, then call a format-specific method on it.
The export methods depend on the dataset type, see
Dataset export reference
for details.
import lightly_studio as ls
# Image dataset export
dataset = ls.ImageDataset.load()
dataset.export().to_csv_classifications("classifications.csv")
dataset.export().to_coco_object_detections("detections.json")
dataset.export().to_yolo_object_detections("yolo_output_dir/")
dataset.export().to_coco_segmentation_masks("segmentations.json")
dataset.export().to_coco_captions("captions.json")
dataset.export().to_pascalvoc_segmentation_mask("pascalvoc_output_dir/")
# Video dataset export
dataset = ls.VideoDataset.load()
dataset.export().to_csv_classifications("classifications.csv")
dataset.export().to_youtube_vis_segmentation_mask("youtube_vis.json")
Export a filtered subset¶
Pass a DatasetQuery to export() to export only matching samples. Queries support
filtering, ordering, and slicing — see Search and Filter
for the full query API.
import lightly_studio as ls
from lightly_studio.core.dataset_query import ImageSampleField
dataset = ls.ImageDataset.load()
# Export only samples taller than 500 pixels
query = dataset.query().match(ImageSampleField.height > 500)
dataset.export(query).to_coco_object_detections("tall_images.json")