ExDD: Explicit Dual Distribution Learning for Surface Defect Detection via Diffusion Synthesis

The paper introduces ExDD, a novel framework for industrial surface defect detection that overcomes data scarcity and uniform outlier assumptions by explicitly modeling dual feature distributions via parallel memory banks and generating context-aware synthetic defects using latent diffusion models.

Muhammad Aqeel, Federico Leonardi, Francesco Setti

Published 2026-03-09
📖 4 min read☕ Coffee break read

Imagine you are a quality control inspector at a factory that makes copper pipes and marble tiles. Your job is to spot tiny scratches, dents, or weird spots on the products before they get shipped out.

The Problem: The "Perfect" Inspector Who Only Knows "Normal"

Traditionally, computers were taught to do this job using a method called One-Class Anomaly Detection. Think of this like training a security guard who has only ever seen perfect, flawless products.

The guard memorizes what a "perfect" pipe looks like. If they see something that doesn't look exactly like the perfect pipe, they scream, "DEFECT!"

  • The Flaw: This works okay for random noise, but industrial defects are often specific. A scratch looks like a scratch; a dent looks like a dent. They aren't just "random weirdness"; they have their own specific shapes and patterns.
  • The Data Scarcity: The real problem is that in a factory, defects are rare. You might have 1,000 perfect pipes but only 5 broken ones. It's impossible to teach the guard what a "scratch" looks like if you only show them 5 examples.

The Solution: ExDD (Explicit Dual Distribution)

The authors of this paper, Muhammad Aqeel and his team, created a new system called ExDD. Instead of just memorizing "perfect," they teach the computer to understand two distinct worlds: Normal and Defective.

Here is how they did it, using some fun analogies:

1. The Two Filing Cabinets (Dual Memory Banks)

Instead of one big brain, ExDD uses two separate filing cabinets (Memory Banks):

  • The "Normal" Cabinet: Filled with photos of perfect pipes and tiles.
  • The "Defect" Cabinet: Filled with photos of scratches, dents, and spots.

Why is this cool? Old methods only had the "Normal" cabinet. If a new type of scratch appeared that the guard hadn't seen before, they might miss it because it didn't look "different enough" from the normal ones. By having a "Defect" cabinet, the computer can say, "Hey, this looks a lot like the scratches in the Defect cabinet, and very little like the Normal cabinet. It's a defect!"

2. The Magic Art Generator (Diffusion Synthesis)

Here is the tricky part: The "Defect" cabinet is empty at the start because real defective samples are rare. You can't fill a cabinet with only 5 photos.

To solve this, the team used a Latent Diffusion Model (think of it as a super-smart AI artist, like DALL-E or Midjourney).

  • The Trick: They give the AI a picture of a perfect pipe and a text prompt like "copper metal scratch" or "white mark on the wall."
  • The Result: The AI generates new, fake images of scratches that look incredibly real and fit perfectly into the factory context.
  • The Benefit: They can now fill the "Defect" cabinet with hundreds of high-quality examples, even though they only had a few real ones to start with. It's like having a photocopier that can create infinite variations of a scratch so the inspector learns every possible way a scratch can look.

3. The "Ratio" Score (The Final Decision)

When the system checks a new product, it doesn't just ask, "Is this weird?" It asks two questions and compares the answers:

  1. How far is this from "Normal"? (Distance to the Normal Cabinet)
  2. How close is this to "Defect"? (Distance to the Defect Cabinet)

The system calculates a Ratio:

If the item is FAR from Normal AND CLOSE to Defect, it's a definite defect!

This is much smarter than just looking for "weirdness." It's like a detective who doesn't just look for suspects who act strangely, but specifically looks for people who match the profile of the criminal and don't match the profile of an innocent bystander.

The Results

They tested this on a real industrial dataset (KSDD2).

  • The Old Way: Good at spotting big problems, but missed subtle scratches.
  • ExDD (with the AI-generated defects): Caught 97.7% of the defects and pinpointed exactly where they were on the product.

The Takeaway

The paper teaches us that in the world of industrial quality control, you don't need to wait for a million broken products to learn what they look like. Instead, you can use AI to imagine the broken ones, teach the computer to recognize the specific patterns of "broken" versus "perfect," and build a system that is far more accurate and reliable.

It's the difference between a guard who only knows what a "good" day looks like, and a detective who knows exactly what a "bad" day looks like, too.