← Latest papers
🤖 AI

Large-Scale Universal Defect Generation: Foundation Models and Datasets

This paper introduces UDG, a large-scale dataset of 300K normal-abnormal-mask-caption quadruplets, and UniDG, a universal foundation model that leverages this data and a two-stage training strategy to generate high-quality, diverse defects across various domains without requiring per-category fine-tuning, thereby significantly improving anomaly detection performance.

Original authors: Yuanting Fan, Jun Liu, Bin-Bin Gao, Xiaochen Chen, Yuhuan Lin, Zhewei Dai, Jiawei Zhan, Chengjie Wang

Published 2026-04-13
📖 5 min read🧠 Deep dive

Original authors: Yuanting Fan, Jun Liu, Bin-Bin Gao, Xiaochen Chen, Yuhuan Lin, Zhewei Dai, Jiawei Zhan, Chengjie Wang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a quality inspector at a factory. Your job is to spot defective products—like a scratched phone screen, a torn piece of fabric, or a cracked ceramic tile. To train a computer to do this, you need thousands of pictures of "bad" products.

But here's the problem: Real defective products are rare. You can't just wait for a million broken items to roll off the assembly line. And if you try to teach a computer using just a few examples (like showing it three broken cups), the computer gets confused. It might think all broken cups look exactly like those three, or it might invent a "broken cup" that looks like a melted candle instead of a cracked one.

This paper introduces a solution called UniDG (Universal Defect Generator). Think of it as a super-smart, magical art teacher that can create infinite, realistic examples of broken things to help train your quality inspector robots.

Here is how it works, broken down into simple concepts:

1. The Problem: The "Few-Shot" Trap

Previous methods were like trying to learn how to paint a portrait by looking at only one photo.

  • The Issue: If you only show a computer three examples of a "scratch," it memorizes those three scratches perfectly but fails to understand what a new scratch looks like. It overfits.
  • The Result: The computer generates weird, fake-looking defects that don't fool the human eye, or it can't recognize a scratch on a different type of object (like a scratch on wood vs. a scratch on metal).

2. The Solution: The "Universal Defect Library" (UDG)

Before teaching the computer, the researchers built a massive library called UDG.

  • The Analogy: Imagine a library with 300,000 books. But instead of stories, each "book" is a set of four items:
    1. A picture of a perfect product (e.g., a pristine shoe).
    2. A picture of that same shoe with a defect (e.g., a scuff mark).
    3. A mask (a stencil) showing exactly where the scuff is.
    4. A detailed description (e.g., "A small, dark scuff on the leather toe, about 2cm wide").
  • How they made it: They used a team of AI "agents" (like a digital construction crew). One agent erased defects to make perfect shoes, another wrote descriptions, and a third agent acted as a strict editor to make sure everything was accurate.
  • Why it matters: This library covers everything from industrial machines to medical scans and nature. It teaches the computer the concept of a defect, not just a specific picture.

3. The Magic Tool: UniDG (The Generator)

Now, they trained a foundation model (a giant AI brain) on this library. This is UniDG.

  • The Analogy: Think of UniDG as a chameleon artist.
    • Reference Mode: You show it a picture of a specific scratch on a banana. You then point to a shoe and say, "Put a scratch like that here." UniDG doesn't just copy-paste the banana scratch; it understands the texture and style of the scratch and paints a realistic scratch onto the shoe that fits the lighting and material.
    • Text Mode: You can also just type, "Add a deep crack to this metal plate," and it does it.
  • The Secret Sauce: It uses a technique called "Defect-Context Editing." Instead of trying to redraw the whole shoe, it focuses only on the specific spot where the defect should go, ensuring the rest of the shoe stays perfect.

4. The Training Strategy: "Diversity" then "Consistency"

Training this AI was a two-step dance:

  1. Diversity-SFT (The "Wild" Phase): First, they taught the AI to be creative. They showed it many different ways a defect could look. This made the AI good at generating many different types of defects so it wouldn't get stuck on just one style.
  2. Consistency-RFT (The "Strict" Phase): Next, they taught the AI to be precise. They used a "reward system" (like a video game scoring system). If the AI generated a scratch that looked too fake or didn't match the reference image, it got a low score. If it looked perfect, it got a high score. This forced the AI to stop being "wild" and start being "accurate."

5. The Results: Why Should We Care?

The researchers tested this on standard industrial datasets (like MVTec-AD and VisA).

  • The Outcome: UniDG created defects that were so realistic that computers trained on these fake images could spot real defects better than any previous method.
  • The Impact:
    • No More Waiting: Factories don't need to wait for real broken products to train their safety systems. They can generate millions of "what-if" scenarios instantly.
    • Universal: It works on wood, metal, fabric, and even medical images without needing to be retrained for each new object.
    • Open Source: They are sharing the code and the massive dataset with the world, so everyone can build better safety systems.

Summary

In short, UniDG is a tool that solves the "data shortage" problem in quality control. By building a massive library of "perfect vs. broken" examples and training a smart AI to learn from them, they created a system that can invent realistic defects on demand. This helps train better AI inspectors, making our products safer and our factories more efficient.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →