Dataset Statistics
compute_stats
Compute normalization statistics for a dataset.src/lerobot/datasets/compute_stats.py
LeRobotDataset
required
Dataset to compute statistics for.
int
default:"32"
Batch size for data loading.
int
default:"4"
Number of dataloader workers.
dict
Dictionary mapping feature names to
{"mean": array, "std": array, "min": array, "max": array}.aggregate_stats
Aggregate statistics from multiple datasets or episodes.Data Transformation
hf_transform_to_torch
Transform Hugging Face dataset outputs to PyTorch tensors.src/lerobot/datasets/utils.py:hf_transform_to_torch
flatten_dict
Flatten nested dictionary with dot-separated keys.Video Processing
encode_video_frames
Encode image frames to video file.src/lerobot/datasets/video_utils.py:encode_video_frames
Path
required
Directory containing image files.
Path
required
Output video file path.
int
required
Frames per second.
str
default:"libsvtav1"
Video codec.
decode_video_frames
Decode specific frames from video file.Path
required
Video file path.
list[float]
required
List of timestamps in seconds.
float
default:"1e-4"
Tolerance for timestamp matching.
str
default:"pyav"
Video backend:
pyav, torchcodec, video_reader.torch.Tensor
Tensor of shape
(N, C, H, W) with decoded frames.Episode Processing
validate_episode_buffer
Validate episode data before saving.validate_frame
Validate single frame data.Delta Timestamps
get_delta_indices
Convert delta timestamps to frame indices.check_delta_timestamps
Validate delta timestamps against FPS.Image Processing
write_image
Write image array to file.AsyncImageWriter
Write images asynchronously for better performance.Hub Utilities
push_dataset_to_hub
Upload dataset to Hugging Face Hub.Example Workflows
Compute and Save Statistics
Process Videos in Batch
Custom Data Transformation
See Also
- LeRobotDataset - Dataset class
- Processor API - Data processing pipelines
- lerobot-dataset-viz - Visualize data