Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Unsupervised Domain Adaptation (UDA)

Unsupervised domain adaptation adapts a model trained on labeled source data to a new target domain that has only unlabeled data, closing the domain gap.

Unsupervised domain adaptation (UDA) adapts a model trained on labeled data from one setting, the source domain, so that it works in a different setting, the target domain, for which only unlabeled data is available. Both domains share the same task and classes, but their inputs look different: synthetic renderings versus real photos, one hospital's scanners versus another's, daytime versus nighttime streets, or one camera model versus the next. Models trained on the source alone often lose much of their accuracy on the target, and UDA recovers it without the cost of data annotation in the new domain. It is a branch of transfer learning, and "unsupervised" refers only to the missing target labels.

Why Domain Shift Hurts#

Shai Ben-David and colleagues gave the problem its standard theory in 2010. A classifier's error on the target domain is bounded by three terms: its error on the source, a measure of how different the two domains look to the classifier family, and the error of the best single classifier for both domains. The first term is reduced by ordinary training on source labels. Most UDA methods attack the second one, learning features under which source and target inputs look alike, while the third term is a reminder that adaptation fails when the label relationship itself changes between domains.

Main Approaches#

  • Statistic matching: Aligns simple statistics of source and target features. Maximum mean discrepancy and CORAL, which matches feature covariances, add a penalty to the training loss, and AdaBN, proposed by Yanghao Li and colleagues in 2016, simply recomputes every batch normalization layer's mean and variance on target data.
  • Adversarial alignment: Domain-adversarial neural networks (DANN), introduced by Yaroslav Ganin and Victor Lempitsky in 2015, train a domain classifier to tell source features from target features, and a gradient reversal layer pushes the feature extractor to fool it.
  • Image translation: Generative models such as CycleGAN restyle source images to look like the target, so labeled training images already resemble deployment, as in CyCADA for driving scenes.
  • Self-training: The source model labels target images, its confident predictions become pseudo-labels, and the model is retrained on them, often with a slowly updated teacher model that keeps the labels stable.
  • Source-free and test-time adaptation: SHOT adapts a trained model without access to source data, and TENT updates only batch normalization parameters during inference by making predictions on test batches more confident.

AdaBN shows how much of a domain gap can sit in the statistics of batch normalization layers. This PyTorch example trains a small network on 1,000 handwritten digits and tests it on the remaining digits rendered as a washed-out camera would capture them, with lower contrast and higher brightness:

import torch
from sklearn.datasets import load_digits
from torch import nn

torch.manual_seed(0)
X, y = load_digits(return_X_y=True)
X, y = torch.tensor(X / 16, dtype=torch.float32), torch.tensor(y)
target_x = 0.3 * X[1000:] + 0.6  # target domain: the last 797 digits as a washed-out camera would capture them

# Train on the labeled source domain, the first 1,000 digits
model = nn.Sequential(nn.Linear(64, 64), nn.BatchNorm1d(64), nn.ReLU(), nn.Linear(64, 10))
optimizer = torch.optim.Adam(model.parameters(), lr=1e-2)
for _ in range(200):
    optimizer.zero_grad()
    nn.functional.cross_entropy(model(X[:1000]), y[:1000]).backward()
    optimizer.step()
model.eval()
print(f"Target accuracy before adaptation: {(model(target_x).argmax(1) == y[1000:]).float().mean():.3f}")

# AdaBN: replace the source BatchNorm statistics with those of the unlabeled target images
model[1].reset_running_stats()
model[1].momentum = None  # use a plain average over the target batch
model.train()
with torch.no_grad():
    model(target_x)
model.eval()
print(f"Target accuracy after adaptation: {(model(target_x).argmax(1) == y[1000:]).float().mean():.3f}")

Accuracy on the shifted digits rises from 0.290 to 0.940 without a single target label, close to the 94% the same model scores on those digits before the shift. The gain is this large because a contrast and brightness change becomes a per-feature shift and scale after the first linear layer, exactly what renormalization removes; shifts in shape or content need the stronger methods above.

Benchmarks and Applications#

Office-31, published by Kate Saenko and colleagues in 2010, contains 4,110 images of 31 office objects from three domains: Amazon product photos, webcam shots, and DSLR photos. VisDA-2017 asks models trained on synthetic 3D renderings of 12 object categories to classify real photos, and GTA5-to-Cityscapes trains semantic segmentation on 24,966 frames from a video game and tests on real city streets.

The same pattern drives practical uses. Autonomous vehicles supplement real driving footage with synthetic data and simulator renderings, medical image analysis models must work across scanner vendors and hospitals, and agriculture models meet new fields, crop varieties, and seasons. Detectors are often adapted by self-training: the auto_annotate function in the Ultralytics Python package runs a YOLO26 detector over a folder of unlabeled images, prompts Meta's Segment Anything Model (SAM) with each detected box, and writes YOLO-format segmentation labels, so a detector trained on the source domain can pseudo-label target images for review and fine-tuning.

Supervised fine-tuning needs labels from the target domain, and semi-supervised learning assumes labeled and unlabeled data come from the same distribution. Domain generalization has no target data at all and instead trains for robustness to unseen domains with data augmentation and domain randomization. Distributionally robust optimization prepares for a whole set of possible shifts, while UDA adapts to one target domain whose images it has already seen, and monitoring for data drift shows when a deployed model has entered a new domain that calls for adaptation.

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

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

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
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
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

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

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
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
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

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

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
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