Skip to main content
The lerobot-imgtransform-viz command generates visual examples of image transformations applied during dataset loading, helping you configure and debug image augmentation settings.

Command

Location: src/lerobot/scripts/lerobot_imgtransform_viz.py

Overview

This utility:
  • Visualizes effects of image transformations
  • Shows individual transforms separately
  • Generates examples of combined transforms
  • Saves output images for inspection
  • Helps tune augmentation parameters
  • Supports all LeRobot transform types

Key Options

Dataset Options

str
required
Dataset repository ID (e.g., lerobot/pusht).
list[int]
Episode indices to use. Defaults to [0].
str
Git revision of the dataset.
str
Video backend: torchcodec, pyav, or video_reader.

Transform Options

bool
default:"false"
Enable image transformations. Must be True to generate transform examples.
dict
Dictionary of transform configurations. See examples below.

Output Options

str
default:"outputs/image_transforms"
Directory to save visualization images.
int
default:"5"
Number of random examples to generate per transform.

Usage Examples

Basic Visualization

Generates:
  • Original frame from first episode
  • Examples of combined transforms
  • Individual transform examples (if configured)

Visualize Specific Transforms

Multiple Augmentation Examples

Generates 10 random augmentation examples.

Custom Transform Parameters

Output Structure

Generated files are organized as:

Transform Types

RandomCrop

Randomly crops images to a fraction of original size:

ColorJitter

Randomly adjusts brightness, contrast, saturation:

SharpnessJitter

Randomly adjusts image sharpness:

RandomRotation

Randomly rotates images:

GaussianBlur

Applies Gaussian blur:

RandomGrayscale

Randomly converts to grayscale:

Combining Transforms

Apply multiple transforms in sequence:
The all/ directory shows results of all transforms applied together.

Interpreting Results

Check Augmentation Strength

Compare transformed images to original:
  • Too subtle: Increase parameter ranges
  • Too aggressive: Reduce parameter ranges
  • Good balance: Natural variation without distortion

Evaluate Individual Transforms

Check min.png, mean.png, max.png for each transform:
  • min.png: Minimum parameter value
  • mean.png: Average parameter value
  • max.png: Maximum parameter value
Ensure all three are reasonable for your task.

Verify Combined Effects

Check all/ directory:
  • Multiple transforms should create diverse but realistic variations
  • No extreme distortions or artifacts
  • Key visual features still recognizable

Tuning Guidelines

Conservative Augmentation

For sim-to-real or precise tasks:

Aggressive Augmentation

For diverse real-world environments:

Using in Training

Once you’ve tuned transforms, use in training:

Programmatic Usage

Tips

  1. Start Simple: Test one transform at a time
  2. Check Extremes: Look at min/max examples to avoid over-augmentation
  3. Use Real Data: Test on actual dataset images, not synthetic
  4. Iterate: Adjust parameters based on visual inspection
  5. Consider Task: Match augmentation to deployment environment

See Also