Skip to content

Running a Worker ​

SUMMARY

A worker turns one YAML file into a finished dataset. It builds the environment and the randomizer from the config, renders in size-capped shards, merges the shards, and exports a train/valid/test split in COCO or YOLO format. No Python beyond three lines is required.

BinPickingWorker covers bin picking: parts in a container, optional distractors, physics, and an overhead camera. It is the Python pipeline from Physics Based Synthetic Dataset Generation, with every setting moved into the worker YAML.

Run It ​

python
from telekinesis.illusion.workers.bin_picking_worker import BinPickingWorker

worker = BinPickingWorker("bin_picking.yaml")
worker.generate()                    # render shards until dataset.num_images is reached
worker.merge_shards(preview=False)   # merge, then export to dataset.writer.dataset_format
MethodDoes
BinPickingWorker(config_file_path)Loads and validates the YAML, then builds the environment and randomizer. A bad key or value fails here, with the file name and key path in the message.
generate()Renders dataset.num_images images in shards of dataset.shard.size. Stops early if the output exceeds dataset.writer.max_size_gb.
merge_shards(preview=True)Merges every shard into merged_coco_annotations.json, then exports to dataset_format if one is set. preview=True opens the viewer afterwards. Call it after generate() on the same worker.
get_environment(), get_randomizer()The objects built from the config, for inspection or extra nodes.
get_output_base_directory()<output_directory>/<name>.

The official example in telekinesis-examples does the same with a ready-made config, bin_picking_example.yaml, next to the script:

bash
python examples/dataengine/synthetic_data_generation/generate_synthetic_data_with_bin_picking_worker.py --no-preview

Pass --config-file path/to/your.yaml to run your own configuration. The example config renders on CUDA; change renderer.device in a copy of it if you have no NVIDIA GPU.

Smoke test first

Set dataset.num_images to a handful and dataset.shard.size to half of that before a long run. A full pipeline (render, merge, export) then finishes in a minute and shows any problem with the config, assets or output.

What You Get ​

text
output/gears_in_bins/                     # <output_directory>/<name>
├── config.yaml                           # copy of the YAML this dataset was generated from
├── shard_20261102_134205_e9aa94cc/
│   ├── coco_annotations.json
│   └── images/000000.jpg ...
├── shard_20261102_134216_a0886ccb/
│   └── ...
├── merged_coco_annotations.json          # every shard, re-indexed
└── yolo_format/                          # or coco_format/, from dataset.writer.dataset_format
    ├── data.yaml
    ├── images/{train,val,test}/
    └── labels/{train,val,test}/
  • config.yaml is a copy of the configuration file, headed by a comment with the telekinesis-illusion version and the generation time (# Generated with telekinesis-illusion 0.3.2 on 2026-11-02T14:47:36). Pass it to BinPickingWorker to regenerate the dataset as-is. A rerun into the same folder overwrites it.
  • Shards are independent COCO datasets of shard.size images each, named from shard.name_template. If a long run is interrupted, every finished shard is still usable.
  • merged_coco_annotations.json combines them with unique image and annotation IDs. Image file_names are prefixed with their shard directory.
  • coco_format/ holds train/, valid/ and test/, each with its images and _annotations.coco.json. yolo_format/ holds Ultralytics YOLO segmentation labels and a data.yaml. See Merging and Converting.

Re-exporting asks before overwriting

If <name>/coco_format/ or <name>/yolo_format/ already exists, merge_shards() asks on the terminal whether to overwrite it. In unattended runs, give each run a new dataset.name or remove the old export first.

Run Several Workers in Parallel ​

Shard names contain a timestamp and a random ID, so several workers with the same config can write into the same <output_directory>/<name>/ at once, for example one per GPU. Merge once at the end with CocoShardMerger.

Worker YAML Reference
Every section and key of the worker configuration, with defaults.
Open reference →