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

Motion trimming

Trim inactive frames from robotics episodes

motion_trim removes inactive frames before and after the motion window of an episode. It uses action and state deltas to infer activity.

1
2
3
4
5
pipeline = (
    mdr.read_lerobot("hf://datasets/acme/raw-aloha")
    .map(mdr.robotics.motion_trim(threshold=0.001, pad_frames=2))
    .write_lerobot("hf://buckets/acme-robotics/aloha-trimmed")
)

What it updates

DataBehavior
Frame tableKeeps only selected frame indices.
TimestampsShifts kept timestamps so the trimmed episode starts at zero.
VideosClips video views to the same time span.
Video statsDrops stale video stats so the writer recomputes them.
MetricsLogs frames in/out, removed frames, and trim fraction when launched.

Parameters

ParameterMeaning
thresholdMotion energy threshold for action/state deltas.
pad_framesExtra frames to keep before and after detected motion.
timestamp_keyFrame timestamp key when semantic timestamps are absent.
action_keyFrame action key when semantic actions are absent.
state_keyFrame state key when semantic states are absent.

Requirements

Input rows must implement RoboticsRow and contain non-empty frame data with timestamps, actions, and state values. read_lerobot(...) rows satisfy this when the dataset contains those fields. Generic rows should be converted with to_robot_rows.

Related pages

  • Frames and Videos
  • Writing LeRobot

// Table of Contents

  1. What it updates
  2. Parameters
  3. Requirements
  4. Related pages
Macrodata_Labs
TermsPrivacyContact
  • GitHub
  • LinkedIn
  • X
  • HuggingFace
  • Discord