Inferensys

Glossary

Randomized-to-Canonical

Randomized-to-Canonical is a Domain Randomization technique where a model is trained to map observations from a randomized simulation back to a canonical, non-randomized representation, learning invariant features in the process.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
DOMAIN RANDOMIZATION

What is Randomized-to-Canonical?

A technique for learning domain-invariant features by training a model to map randomized inputs back to a canonical representation.

Randomized-to-Canonical is a self-supervised approach within Domain Randomization where a model, typically a neural network, is trained to transform an observation from a randomized simulation environment back into a corresponding observation from a canonical, non-randomized version of the same scene. The core objective is to force the model to learn a mapping that is invariant to the randomized visual or physical parameters, thereby extracting robust, task-relevant features. This learned representation can then be used for downstream tasks like perception or control, improving sim-to-real transfer.

The method works by training on paired data: a randomized input (e.g., an image with random textures, lighting, and colors) and its canonical counterpart (e.g., the same scene with neutral, consistent parameters). By learning to reconstruct the canonical view, the model must implicitly discover the underlying scene geometry and semantics, ignoring the superficial randomization. This process is closely related to invariant feature learning and provides a powerful, data-efficient pathway to bridge the domain gap between simulation and reality for robotics and computer vision.

DOMAIN RANDOMIZATION

Core Characteristics of Randomized-to-Canonical

Randomized-to-Canonical is a specialized technique within Domain Randomization where a model learns to map observations from a randomized simulation back to a canonical, non-randomized representation, forcing it to extract invariant, task-relevant features.

01

Core Objective: Invariant Feature Learning

The primary goal is to train a model to learn invariant representations. By forcing the model to map diverse, randomized inputs (e.g., varied lighting, textures, object colors) to a single, consistent canonical representation, it must discard irrelevant, randomized visual attributes and focus on the underlying geometric and structural features essential for the task. This process is analogous to learning a de-rendering function, stripping away superficial variations to reveal the invariant core.

02

Architecture: The Two-Stream Model

A standard implementation uses a two-stream encoder-decoder architecture.

  • Randomized Encoder: Processes the randomized input observation (e.g., an image from a simulation with random textures).
  • Canonical Decoder: Reconstructs the corresponding scene in a canonical, non-randomized form (e.g., with uniform colors, consistent lighting). The model is trained with a reconstruction loss (like L1 or L2) between its output and the ground-truth canonical image. The bottleneck layer between the encoder and decoder becomes a learned invariant feature space.
03

Key Distinction from Standard Domain Randomization

While both aim for robustness, their mechanisms differ fundamentally.

  • Standard DR: A policy or perception model is trained directly on randomized data. Robustness is a byproduct of exposure to variation.
  • Randomized-to-Canonical: An explicit mapping model is trained to remove randomization. The resulting canonical features are then used by a downstream task model (e.g., a robot controller). This creates a decoupled, interpretable feature pipeline. The downstream model operates on clean, consistent inputs, simplifying its learning objective.
04

Primary Application: Sim-to-Real for Vision

This approach is particularly powerful for visual sim-to-real transfer in robotics. For example, training a robot to grasp objects:

  1. Generate paired data in simulation: a randomized image and its canonical counterpart.
  2. Train the Randomized-to-Canonical model.
  3. Deploy the trained encoder on real-world robot camera feeds. It converts the messy, real-world image into a clean, canonical-like representation.
  4. A separate, simulation-trained grasping policy, which expects canonical inputs, can now operate effectively on the real robot's processed observations, enabling zero-shot sim-to-real transfer.
05

Advantages and Benefits

  • Explicit Invariance: Directly optimizes for feature invariance, often leading to more robust representations than standard DR.
  • Decoupled Training: The perception model (Randomized-to-Canonical network) and the task policy can be trained separately, improving modularity.
  • Interpretable Features: The canonical output is human-inspectable, allowing engineers to debug what the model considers invariant.
  • Compensates for Low Fidelity: Effective even with low-fidelity, non-photorealistic simulators, as the model learns to ignore unrealistic visual artifacts.
06

Limitations and Considerations

  • Requires Paired Data: Needs simulated pairs of randomized and canonical observations, which adds complexity to the data generation pipeline.
  • Canonical Definition: Defining the "canonical" representation is a non-trivial design choice (e.g., neutral lighting, uniform textures) that can impact performance.
  • Reconstruction Bottleneck: The model may learn to reconstruct canonical details not needed for the task, wasting capacity. Auxiliary task losses (e.g., for segmentation) are often added to the canonical features to ensure they remain task-relevant.
  • Domain Gap for Encoder: The encoder itself must generalize from randomized simulation to real-world input, which remains a challenge, though typically easier than bridging the full reality gap.
RANDOMIZED-TO-CANONICAL

Frequently Asked Questions

Randomized-to-Canonical is a specialized technique within Domain Randomization designed to learn robust, invariant visual representations. These FAQs address its core mechanics, applications, and how it differs from related methods.

Randomized-to-Canonical is a self-supervised learning approach within Domain Randomization (DR) where a model, typically a neural network, is trained to transform an observation from a randomized simulation environment back into a corresponding canonical (i.e., non-randomized, idealized) representation. The model works by learning a mapping function that is invariant to the randomized visual parameters, forcing it to extract only the task-relevant, underlying structure of the scene.

How it works:

  1. A simulator generates paired data: a randomized observation (with varied textures, lighting, colors) and its canonical counterpart (a clean, template-like version of the same scene).
  2. A model (e.g., a U-Net) takes the randomized observation as input.
  3. The model is trained via a reconstruction loss (like L1 or L2) to output an image as close as possible to the canonical target.
  4. By learning to "undo" the randomization to reconstruct a consistent canonical view, the model's internal representations become invariant to the visual noise, capturing only the essential geometry, semantics, or state information.
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.