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

Row transforms

Use map, flat_map, and filters over episode rows

Use row transforms when each episode can be handled independently in Python.

map

map takes one row and returns one row.

1
2
3
4
5
def add_frame_count(row):
    return row.update({"frame_count": row.num_frames})


pipeline = pipeline.map(add_frame_count)

This is the default transform for simple episode enrichment.

filter

Pass a Python predicate to keep or drop rows:

1
pipeline = pipeline.filter(lambda row: row.num_frames > 30)

For simple column predicates, vectorized filters are often faster; see Vectorized Transforms.

flat_map

flat_map takes one row and returns zero or more rows.

1
2
3
4
5
6
def split_by_camera(row):
    for camera, video in row.videos.items():
        yield row.update({"camera": camera, "video": video})


pipeline = pipeline.flat_map(split_by_camera)

Use this when one episode naturally becomes several examples.

DType hints

When a transform creates a column that a writer should treat as an asset or media value, pass dtypes:

1
2
3
4
pipeline = pipeline.map(
    lambda row: row.update({"clip": row.videos["front"]}),
    dtypes={"clip": mdr.datatype.video_path()},
)

See Schemas and DTypes.

Related pages

  • Episode Rows
  • Motion Trimming

// Table of Contents

  1. map
  2. filter
  3. flatmap
  4. DType hints
  5. Related pages
Macrodata_Labs
TermsPrivacyContact
  • GitHub
  • LinkedIn
  • X
  • HuggingFace
  • Discord