Ultralytics YOLO and NVIDIA Cosmos Data Factory: Synthetic data for defect detection
NVIDIA Cosmos Data Factory synthetic data and an agentic training loop help Ultralytics YOLO26 match full-dataset defect detection accuracy with fewer labels.
Manuel Calvé11 min readListen to this article

Ultralytics and NVIDIA have partnered to show what targeted training data can do for Ultralytics YOLO. NVIDIA’s agentic data-enhanced training loop identifies the images a model needs, NVIDIA Cosmos Data Factory generates the ones that don’t exist yet, and Ultralytics YOLO is the model trained on the result. Our machine learning (ML) team put the combination through 19 public industrial-inspection benchmarks, comparing Ultralytics YOLO26 trained with NVIDIA’s agentic pipeline and Cosmos Data Factory synthetic data against the same model trained the conventional way. This post shares the results.
More data isn't the answer. The right data is.#
Every inspection team knows the pattern. A defect-detection model performs well on the defects it has seen many times, then misses the rare scratch, the unusual lighting, or the odd camera angle that matters most on the production line. The usual fix is to collect and label more of everything, which is slow, expensive, and mostly adds images the model already handles well.
Automated agentic training powered by NVIDIA takes a different approach: it finds the specific weak spots in a dataset and patches them, with real images that already exist or with synthetic ones from Cosmos Data Factory where real examples don’t. Paired with Ultralytics YOLO, that means a model that is trained on exactly the data it's missing.
How does NVIDIA’s data-enhanced training loop work?#
NVIDIA’s agentic data-enhanced training loop for Ultralytics YOLO is a model-improvement pipeline that wraps the training loop and decides what data the model needs next:
- Mines real data. It searches existing image pools for real examples that fill specific gaps in the training set.
- Generates synthetic data. Where real examples don't exist, it generates edge-case images with Cosmos Data Factory.
- Labels automatically. A component called AnomalyGen labels the synthetic images, so no manual annotation is needed before retraining.
The guiding idea is targeted data over data efficiency. The goal isn't simply to train on less data. It's to precisely fill the gaps in a dataset where the model is weak, by mining or by generating, and retraining on that enriched set. Training on fewer images is often a side effect of doing this well, as the results below show.
The pipeline has been benchmarked in depth with Ultralytics YOLO, and every result in this article uses Ultralytics YOLO26.
Where NVIDIA Cosmos Data Factory fits#
Cosmos Data Factory is NVIDIA's data curation, processing, and generation platform, built on its Cosmos world models. Within the agentic training loop, its job is to generate images for scenarios a real dataset doesn’t cover well, such as specific defect types in manufacturing or fisheye-lens distortion in transportation footage.
The hand-off is simple. Cosmos generates the edge-case imagery, AnomalyGen labels it, and Ultralytics YOLO is retrained on the combined real and synthetic set using the standard Ultralytics training pipeline.
Putting Cosmos Data Factory to the test on 19 public datasets#
To see how far Cosmos Data Factory + Ultralytics YOLO can go, our ML team ran the agentic data-enhanced fine-tuning pipeline on 19 public industrial inspection datasets covering steel, PCBs, fabric, metal surfaces, and consumer products, about 91,000 training images in total. Every run used one 8-GPU host.
The comparison is deliberately strict. The baseline and the Cosmos Data Factory model were trained with an identical recipe: Ultralytics YOLO26x, 100 epochs, the same optimizer, learning rate, and seed, and both were scored on the same held-out test set. The only difference is which images each model trained on. The baseline trains on every labeled image (and, for the synthetic-data test, real images only).
1. The same accuracy on a fraction of the labels#
On 11 of the 19 datasets, Ultralytics YOLO26x trained with the agentic pipeline matched the same model trained on the full dataset. Across those 11, 53% of the labeled images were never needed.
| dataset | labeled | used | not needed | mAP50 full | mAP50 curated |
|---|---|---|---|---|---|
| dagm class 1 | 1,035 | 90 | 91% | 0.9923 | 0.9998 |
| dagm class 2 | 1,035 | 90 | 91% | 1.0000 | 0.9999 |
| dagm class 3 | 1,035 | 90 | 91% | 1.0000 | 0.9987 |
| dagm class 4 | 1,035 | 90 | 91% | 1.0000 | 0.9991 |
| dagm class 7 | 2,070 | 180 | 91% | 1.0000 | 0.9995 |
| dagm class 8 | 2,070 | 178 | 91% | 0.9991 | 1.0000 |
| dagm class 9 | 2,070 | 180 | 91% | 1.0000 | 0.9992 |
| dagm class 10 | 2,070 | 180 | 91% | 1.0000 | 1.0000 |
| pcb-defect | 20,924 | 13,903 | 34% | 0.9900 | 0.9893 |
| hripcb | 559 | 414 | 26% | 0.9891 | 0.9754 |
| deeppcb | 1,000 | 900 | 10% | 0.9887 | 0.9885 |
Table 1. Datasets where Cosmos Data Factory matched the full-data model. mAP50 on the same held-out set.
On the DAGM datasets, the agentic pipeline reached the same mAP50 on a tenth of the labels, and on two classes it finished slightly ahead of the full-data model. On pcb-defect, it dropped 7,000 of 20,924 images for an accuracy difference four times smaller than run-to-run noise.
For teams paying for annotation, this is the headline: most of the labeling budget on these datasets went into images that didn't change the result.
2. Training up to 74% faster#

Figure 1. Training time, full dataset vs. Cosmos Data Factory subset, on the datasets where Cosmos Data Factory was faster.
Training Ultralytics YOLO on a smaller, targeted set also cuts compute. 10 of the 19 datasets trained faster with the agentic pipeline. On DAGM, training time dropped from 13–24 minutes to 4–7 minutes, a 69–74% reduction. The larger datasets saw smaller but real savings: 19% on VisA and 12% on metal-surface-defect.
The saving isn't universal. On the remaining nine datasets, the agentic pipeline took longer than a single full-data run, because each curated round retrains from scratch. Where the curated subset isn't much smaller than the original, those extra rounds outweigh the savings.
3. Generated defects sharpen the boxes#

Figure 2. mAP75 with real images only vs. with generated defects, on the datasets where synthesis was tested and helped.
The third test isolates synthetic data. On datasets with polygon annotations, we added defects generated with Cosmos Data Factory, labeled by AnomalyGen and compared the resulting Ultralytics YOLO model against one trained on real images only.
We report mAP75, a stricter metric than mAP50: a prediction counts only if its box reaches an intersection over union (IoU) of at least 0.75 with the true defect. It measures how precisely the model locates a defect, not just whether it finds it. Adding generated defects raised mAP75 by 0.11 to 0.32 on the DAGM classes, and recall improved on every dataset tested. The biggest jump was DAGM class 9, from 0.650 to 0.966. On Real-IAD, the gain was marginal (+0.008).
Defects are rare by nature, so real examples of a given defect type are always in short supply. Generating them, already labeled, lets Ultralytics YOLO learn a defect's exact shape and extent without anyone drawing a polygon.
How much synthetic data went in#
Each generation runs in three steps. Cosmos Data Factory first finds plausible defect locations on the real images (placed), the generator draws defect images at those locations (generated), and only up to a set limit enters the training set (kept). We tested two limits: synthetic images equal to 25% or 100% of the real images in the training set.
Across 18 generation rounds (9 baseline and 9 synthetic), the pipeline generated 11,448 images. Only 1,481 of those, about one in eight, were kept, so the limit decided how much synthetic data each Ultralytics YOLO model saw, not the generator's output. At the 100% limit, each training set held one synthetic image for every real one; at 25%, roughly one for every four. In absolute terms, the amounts are small: on DAGM, 90–180 real images plus at most the same number of synthetic ones.
| dataset | limit | placed | generated | blocked | kept | real | ratio |
|---|---|---|---|---|---|---|---|
| dagm class 1 | 25% | 870 | 440 | 0 | 22 | 90 | 1 : 0.24 |
| dagm class 1 | 100% | 870 | 400 | 0 | 90 | 90 | 1 : 1.00 |
| dagm class 2 | 25% | 606 | 254 | 0 | 22 | 90 | 1 : 0.24 |
| dagm class 2 | 100% | 606 | 304 | 0 | 90 | 90 | 1 : 1.00 |
| dagm class 3 | 25% | 900 | 370 | 0 | 22 | 90 | 1 : 0.24 |
| dagm class 3 | 100% | 900 | 370 | 0 | 90 | 90 | 1 : 1.00 |
| dagm class 9 | 100% | 1,800 | 620 | 0 | 180 | 180 | 1 : 1.00 |
| realiad | 25% | 9,534 | 4,440 | 0 | 193 | 772 | 1 : 0.25 |
| realiad | 100% | 9,534 | 4,250 | 0 | 772 | 772 | 1 : 1.00 |
| Total | 11,448 | 0 | 1,481 |
Table 2. Generated images and the real-to-synthetic ratio, from each run's generation and admission records.
What this means for teams building inspection models#
For teams already training Ultralytics YOLO, Cosmos Data Factory and automated agentic training powered by NVIDIA fit into the workflow they have and know: the same models, the same training recipe, with smarter data going in.
- Cover the edge cases you can't collect. Auto-labeled synthetic defects help Ultralytics YOLO localize defects where real examples are scarce.
- Spend the labeling budget where it counts. On over half the datasets tested, most labels were redundant. Targeted selection finds the images that matter.
- Iterate faster. Smaller, curated training sets mean shorter Ultralytics YOLO training runs and quicker experiments on many datasets.
Availability#
The Cosmos-based synthetic generation step is currently available as a sample and demo, and isn't yet a shipped integration.
To try Cosmos Data Factory with your own Ultralytics YOLO models, get in touch with the Ultralytics team. We'll keep working with NVIDIA as the synthetic generation step moves toward a full integration.
Appendix: test setup and datasets#
All runs: Ultralytics YOLO26x, 100 epochs, identical optimizer, learning rate and seed for baseline and Cosmos Data Factory; one 8-GPU host; same held-out test set per dataset. The 11 datasets with polygon annotations can use generated defects. Each dataset in Table 3 links to its public copy on Ultralytics Platform, where you can browse the images and labels or clone it to train your own model.
| dataset | train images | annotation | source |
|---|---|---|---|
| dagm class 1, 2, 3, 4 | 1,035 each | polygon | DAGM 2007 |
| dagm class 7, 8, 9, 10 | 2,070 each | polygon | DAGM 2007 |
| pcb-defect | 20,924 | box | PCB defect |
| dspcbsd | 6,575 | box | DsPCBSD+ |
| deeppcb | 1,000 | box | DeepPCB |
| hripcb | 559 | box | HRIPCB |
| metal-surface-defect | 11,845 | box | GC10-DET (+ NEU-DET) |
| tianchifabric | 10,332 | box | Tianchi fabric |
| severstal | 10,061 | polygon | Severstal steel |
| mvtec-ad | 4,637 | box | MVTec AD |
| visa | 7,794 | polygon | VisA |
| realiad-bottle-cap | 3,581 | polygon | Real-IAD |
| crack | 1,290 | box | crack segmentation |
Table 3. The 19 datasets (DAGM counts as eight, one per class).
Written by
Comments
Ask a question, share your results, or help someone else.










