License YOLO
Back to Ultralytics Glossary

Domain Randomization

Domain randomization trains models on simulations with randomized textures, lighting, cameras, and physics so they transfer to the real world.

Domain randomization is a technique for training models in simulation so that they work in the real world. A simulator never matches reality exactly, so domain randomization varies its parameters, including textures, colors, lighting, camera pose, object placement, distractor objects, and physical properties such as mass and friction, so widely during training that the real world looks to the model like one more variation. It is a standard tool for closing the sim-to-real gap in robotics, computer vision models trained on synthetic data, and control policies learned with reinforcement learning.

Josh Tobin and colleagues at OpenAI and UC Berkeley described the technique in a 2017 paper that trained an object detection network to localize objects using only simulated images with non-realistic random textures. With no real images in training, the detector located objects in the real world to within about 1.5 cm, accurate enough for a robot arm to grasp them in clutter.

What Gets Randomized#

Every training sample or episode draws fresh values from ranges that engineers set for each parameter:

  • Appearance: Object and background textures and colors, the number, position, and type of lights, and image noise.
  • Camera: Position, orientation, and field of view, so the model never depends on one viewpoint.
  • Scene content: The number, shape, and position of distractor objects, which teach the model to ignore clutter and partial occlusion.
  • Dynamics: Masses, friction, joint damping, motor strength, and control latency, so a learned control policy tolerates the mismatch between simulated and real physics.

Training repeats this sampling for every batch, and real-world results decide whether the ranges need to change:

A model that sees an object under thousands of random textures and lights cannot rely on any single texture or light, so it learns features that survive the change, such as shape and geometry. The cost is a harder learning problem: randomized data usually needs more training and larger models, ranges set too wide waste capacity on conditions that never occur, and ranges set too narrow lead to overfitting to the simulator. Randomization also cannot supply what the simulator cannot model, such as deformable materials or sensor artifacts it does not render.

Variants and Results#

Researchers at NVIDIA applied domain randomization to car detection in 2018 and found that a detector trained on randomized synthetic images and then fine-tuned on real KITTI images outperformed one trained on real data alone. Dynamics randomization carried the idea from images to physics, training robot control policies under randomized masses and friction. Automatic domain randomization starts from narrow ranges and widens each one as the model succeeds, and OpenAI used it in 2019 to train a robot hand that solved a Rubik's Cube. Structured domain randomization keeps the randomness inside realistic context, such as placing cars on roads instead of in the sky.

Domain randomization is now widely used in embodied AI: it trains vision-guided pick-and-place systems, drone navigation, and the perception stacks of autonomous vehicles.

Training Ultralytics YOLO on a randomized synthetic dataset adds image-space randomization on top: by default, each training sample receives a random saturation factor between 0.3 and 1.7 and a random brightness factor between 0.6 and 1.4 from the hsv_s and hsv_v augmentation settings, drawn anew every time an image is loaded.

  • Data augmentation: Transforms images after they are captured or rendered with flips, crops, and color shifts. Domain randomization changes the scene before rendering, so it can vary 3D lighting, materials, and viewpoint that 2D transforms cannot reach.
  • Unsupervised domain adaptation (UDA): Uses unlabeled images from the target domain to align a model's features with that domain. Domain randomization needs no target data during training.
  • Synthetic data generation: The broader process of creating artificial training data, in which domain randomization is one strategy for choosing what each generated sample looks like.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning