lerobot-imgtransform-viz command generates visual examples of image transformations applied during dataset loading, helping you configure and debug image augmentation settings.
Command
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
- Original frame from first episode
- Examples of combined transforms
- Individual transform examples (if configured)
Visualize Specific Transforms
Multiple 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: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
Checkmin.png, mean.png, max.png for each transform:
- min.png: Minimum parameter value
- mean.png: Average parameter value
- max.png: Maximum parameter value
Verify Combined Effects
Checkall/ 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:Balanced Augmentation (Recommended)
Using in Training
Once you’ve tuned transforms, use in training:Programmatic Usage
Tips
- Start Simple: Test one transform at a time
- Check Extremes: Look at min/max examples to avoid over-augmentation
- Use Real Data: Test on actual dataset images, not synthetic
- Iterate: Adjust parameters based on visual inspection
- Consider Task: Match augmentation to deployment environment
See Also
- lerobot-train - Train policies with augmentation
- Image Transforms - Transform configuration
- LeRobotDataset - Dataset format and loading