The problem
Detecting equipment faults from photographs is, on paper, a solved computer vision task. In practice it is a data problem wearing a modelling costume.
Faults are rare by definition. Nobody photographs working equipment, and when something does fail, the priority is fixing it rather than documenting it from twelve angles under varied lighting. The available corpus was fifty real images spanning ten fault classes — roughly five examples per class.
No amount of architecture selection rescues five examples per class. Conventional augmentation — flips, crops, colour jitter — multiplies the count but not the information: the model still only ever sees fifty distinct objects.
If generative models could produce imagery that varied in ways real photographs vary — angle, lighting, occlusion, background clutter — the detector would learn the fault, not the fifty photographs.
Approach
Rather than committing to one generator, I built three and evaluated them against each other on the only criterion that mattered: downstream detection performance.
DCGAN
Fast to train and effective at reproducing texture and surface detail — corrosion, cabling, connector wear. Prone to mode collapse on a dataset this small, which constrained how far it could be pushed.
Beta-VAE
The β term trades reconstruction sharpness for a more disentangled latent space. Blurrier outputs than the GAN, but the latent structure allowed controlled interpolation between fault states — useful for generating the ambiguous middle cases a detector otherwise never sees.
Stable Diffusion
The strongest contributor. Diffusion generated genuinely novel compositions — the same fault in different physical contexts — rather than recombining fragments of the training set. A parallel ControlNet-guided variant constrained generation to preserve the structural layout of the equipment while varying everything else.
Evaluating generated data honestly
The trap in synthetic data work is optimising for images that look convincing to a human. Convincing is not the same as useful, and a generator can score well on perceptual metrics while producing data the detector learns nothing from.
So I measured both:
- FID and Inception Score — distributional similarity to the real data, as a sanity check on generation quality.
- Downstream mAP ablation — the decisive test. Train the same YOLOv8 configuration on different mixes of real and synthetic data, and compare detection performance. Only this answers whether the synthetic data carries information.
The ablation is what turned the pipeline from a plausible idea into a defensible one. It also determined the final real-to-synthetic ratio, which is not something intuition gets right.
mAP@0.5 vs. synthetic-to-real ratio across generator configurations
Results
The final pipeline expanded fifty real images into over 350,000 synthetic training images and lifted YOLOv8 detection by 9.6 percentage points of mAP@0.5, reaching 0.943 across ten fault classes. The ControlNet-guided augmentation variant contributed a further +7.6% mAP over conventional augmentation in its own evaluation.
| Metric | Result |
|---|---|
| Real source images | 50 |
| Synthetic images generated | 350,000+ |
| mAP@0.5 improvement | +9.6 percentage points |
| Final mAP@0.5 | 0.943 |
| Fault classes | 10 |
| Generation quality metrics | FID, Inception Score |
| Deployment | ONNX export, FastAPI, Docker |
What I would carry forward
- Generator choice is empirical, not theoretical. The literature ranking of these three architectures did not predict their ranking on this task at this data scale.
- Perceptual metrics are a sanity check, not an objective. Everything that mattered showed up in the downstream ablation.
- The mix ratio is a hyperparameter. More synthetic data is not monotonically better; past a point the detector starts learning the generator's artefacts.
- Bulk generation needs to be reproducible. Scripting it — seeds, prompts, configurations under version control — is the difference between a result and an experiment.