Macrodata_Labs
AboutBlogDemo
Announcing MacroHands, our SOTA model for 3D hands and camera path from egocentric video!
// Docs›
Quickstart
Running pipelines
  • In-process debugging
  • Local launcher
Reading data
  • Reader model
  • Sharding
  • LeRobot reader
  • HDF5 reader
  • Zarr reader
  • MCAP reader
  • Tabular files
  • Files and videos
  • Hugging Face
  • TensorFlow
  • Lance
  • Custom readers
Episode data
  • Episode rows
  • Frames and videos
  • Metadata, tasks, and stats
  • Converting to robot rows
Transforms
  • Row transforms
  • Async and batch transforms
  • Vectorized transforms
  • Expressions
  • Schemas and DTypes
Episode operations
  • Motion trimming
  • Subtask annotation
Inference
  • Generate text
  • Multimodal and structured output
  • Inference providers
  • Pooling
Writing data
  • Writer model
  • LeRobot writer
  • Zarr writer
  • Parquet and JSONL writers
  • Lance
  • Media assets and reducers
Examples
  • ALOHA HDF5
  • robomimic HDF5
  • Zarr replay buffer
  • MCAP Franka
  • LIBERO HDF5
  • Merge LeRobot datasets
  • Annotate subtasks
Reference
  • Path formats
  • Optional dependencies
// Docs
Quickstart
Running pipelines
  • In-process debugging
  • Local launcher
Reading data
  • Reader model
  • Sharding
  • LeRobot reader
  • HDF5 reader
  • Zarr reader
  • MCAP reader
  • Tabular files
  • Files and videos
  • Hugging Face
  • TensorFlow
  • Lance
  • Custom readers
Episode data
  • Episode rows
  • Frames and videos
  • Metadata, tasks, and stats
  • Converting to robot rows
Transforms
  • Row transforms
  • Async and batch transforms
  • Vectorized transforms
  • Expressions
  • Schemas and DTypes
Episode operations
  • Motion trimming
  • Subtask annotation
Inference
  • Generate text
  • Multimodal and structured output
  • Inference providers
  • Pooling
Writing data
  • Writer model
  • LeRobot writer
  • Zarr writer
  • Parquet and JSONL writers
  • Lance
  • Media assets and reducers
Examples
  • ALOHA HDF5
  • robomimic HDF5
  • Zarr replay buffer
  • MCAP Franka
  • LIBERO HDF5
  • Merge LeRobot datasets
  • Annotate subtasks
Reference
  • Path formats
  • Optional dependencies

Annotate subtasks

Add VLM-generated temporal subtask annotations to episodes

This example reads a LeRobot dataset, runs temporal subtask segmentation on each episode video, optionally relabels the predicted subtasks to improve accuracy, and saves the result back in LeRobot format.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import refiner as mdr

INPUT_DATASET = "hf://datasets/lerobot/berkeley_cable_routing"
OUTPUT_ROOT = "hf://buckets/macrodata/test_bucket"
VIDEO_KEY = "observation.images.top_image"


pipeline = (
    mdr.read_lerobot(INPUT_DATASET)
    .map_async(
        mdr.robotics.subtask_annotation(
            video_key=VIDEO_KEY,
            output_column="predicted_subtasks",
        ),
    )
    .map_async(
        mdr.robotics.subtask_labeling(
            video_key=VIDEO_KEY,
            segments_column="predicted_subtasks",
            output_column="labeled_subtasks",
        ),
    )
    .write_lerobot(f"{OUTPUT_ROOT}/berkeley-cable-routing-subtasks")
)

pipeline.launch_local(
    name="berkeley-subtask-annotation",
    num_workers=1,
)

Export HF_TOKEN and GOOGLE_GENERATIVE_AI_API_KEY before launching the pipeline. Local workers inherit both values from your environment.

Use Subtask Annotation for parameter details and in-depth explanation. Both subtask_annotation and subtask_labeling use Gemini 3.5 Flash through GoogleEndpointProvider, so you need to provide GOOGLE_GENERATIVE_AI_API_KEY.

For the benchmark context behind this workflow, see Annotating Robot Video Subtasks.

This is an open-source reference workflow. To have Macrodata evaluate subtask annotations on representative episodes from your dataset, send us a sample.

Macrodata_Labs
TermsPrivacyContact
  • GitHub
  • LinkedIn
  • X
  • HuggingFace
  • Discord