Classes, Splits & Export
SUMMARY
Keep class IDs consistent across episodes with class presets. Filter the samples you need, then export YOLO or COCO datasets with repeatable, class-balanced splits.
Reuse classes across episodes
When you annotate several episodes of the same task, give each one the same class list and order. YOLO and COCO exports assign contiguous class IDs in that order.
- In the explorer sidebar, open Classes & presets.
- Under Save & export, save the class list as a named preset, for example "Assembly dataset", or download it as
classes.lens.json. - In the next episode, choose the preset under Import classes, review the preview, and choose Apply classes.
You can also import classes from a .lens.json file, a YOLO data.yaml, a COCO JSON file, or another open episode. Only the class list is imported, with its IDs, order, and colors. You can replace the current list or add to it. If the import conflicts with existing annotations, Lens blocks it and leaves the annotations unchanged.
Presets are stored in ~/.cache/telekinesis/lens/class-presets. To use a different folder, set LENS_PRESETS_DIR. Updating a preset doesn't change episodes that imported it earlier.
You can rename classes and keypoints in place. Lens updates the annotations, counts, and exports to match.
Filter samples
Filter the explorer by search text, class, annotation status, and split. The Image ID range filter uses the IDs shown on the image cards, which start at 1 in dataset order. All filters combine.
Export
Lens exports:
- YOLO detection, segmentation, or pose datasets
- COCO datasets
To export only the samples that match the explorer filters, choose Current filters. Exports include unused classes by default, so class IDs stay stable across episodes.
Splits
| Option | Behavior |
|---|---|
| No custom percentages | Keeps the existing splits. |
| Custom train / validation / test percentages | Shuffles images with a fixed seed (42). The same images, order, and percentages always give the same split. |
| Keep class proportions similar across splits | Splits each class close to the chosen percentages, so rare classes also reach validation and test. Split sizes can differ slightly from the percentages. |
| Max train images per class | Removes train images of common classes to reduce imbalance. Validation and test are never trimmed, so evaluation keeps the real class distribution. |
WARNING
Splits are assigned per image. Frames from the same video or episode can end up in different splits, so nearly identical frames can leak between train and test.
Merge datasets
To combine several datasets, open one of them and choose Merge datasets in the side bar. The open dataset is the base: its class order sets the exported class IDs, and classes with the same name are combined.
- Datasets. Select the open datasets to merge, or add a folder. You can't merge videos.
- Checks. Lens compares the class maps and opens every image. Unreadable images and conflicting keypoint definitions block the export. Missing classes, missing files, and size mismatches show as warnings.
- Splits and balancing. Keep each dataset's splits, or set percentages, optionally per class, and a train limit per class.
- Preview. Check the images and annotations per class and split. Lens warns about missing or under-represented classes and strong train imbalance.
- Export. Choose COCO or YOLO, then Merge and export.
The source datasets aren't modified. If you don't set custom percentages, a COCO merge keeps the existing splits and needs train, validation, and test in every dataset.