Synth4Seg - Learning Defect Data Synthesis for Defect Segmentation Using Bi-Level Optimization

Shancong Mou, Raviteja Vemulapalli, Shiyu Li, Yuxuan Liu, C. Thomas, Meng Cao, Haoping Bai, Oncel Tuzel, Ping Huang, Jiulong Shan, Jianjun Shi

TL;DR

Synth4Seg introduces a bi-level optimization framework that automates the generation of synthetic training data for industrial defect segmentation. By treating data synthesis parameters—such as where to paste a defect and which augmentations to prioritize—as learnable variables, the system significantly outperforms traditional "random" cut-and-paste methods, achieving up to an 18.3% improvement in segmentation accuracy.

What Problem Does This Paper Address?

In modern manufacturing, high-quality control is essential, but "data scarcity" is a massive hurdle. Because production lines are highly efficient, almost all captured images are of "normal" products; actual defects are rare. To train deep learning models for defect segmentation, researchers often use a Cut&Paste approach: taking a few known defect examples and pasting them onto normal background images.

However, standard Cut&Paste is usually random. This leads to two main issues:

  1. Physical Impossibility: A defect might be pasted on the background (e.g., the conveyor belt) rather than the product itself, teaching the model irrelevant features.
  2. Suboptimal Diversity: Not all augmentations (like rotating or scaling a defect) are equally helpful for every product type.

The authors aim to move away from "hand-crafted" or "random" rules toward a system that learns the most effective way to synthesize data for a specific task.

Methods

The core of the paper is a bi-level optimization framework. Think of this as two nested training loops:

  • The Lower-Level Problem: A defect segmentation network (the "student") is trained using synthetic data generated by the current synthesis strategy.
  • The Upper-Level Problem: A "teacher" evaluates the student’s performance on a small, real-world validation set. The teacher then updates the synthesis parameters to make the student's job harder or more relevant, effectively minimizing the validation loss.

The authors focus on learning two specific things:

  1. Importance Weights ($\eta$): The model learns which data sources (e.g., photometric vs. geometric augmentations) provide the most "signal" for the segmentation task.
  2. Pasting Locations ($g_\theta$): They introduce a Location Prediction Network. Instead of pasting a scratch anywhere on the image, this network predicts a heatmap of "effective" locations. Over time, it learns to identify the product's foreground without any manual labeling.

To solve this complex optimization efficiently, they use a gradient-based approach involving the Implicit Function Theorem (IFT) and Neumann series approximations, allowing them to optimize millions of parameters without the prohibitive cost of standard grid searches.

Datasets

The researchers evaluated their method on the MVTec AD benchmark, a gold standard for industrial anomaly detection. They tested seven different product categories:

  • Textures: Carpet, Grid, Leather, Wood, Tile.
  • Objects: Screw, Capsule.

The "Object" categories are particularly important because they don't fill the entire frame, making the "where to paste" question critical.

Key Insights and Ideas

  • Automated Saliency: The most striking "aha moment" is seeing the Location Prediction Network evolve. Early in training, it pastes defects everywhere. As it receives feedback from the validation set, it "realizes" that pasting defects on the background doesn't help the model learn. Eventually, it perfectly highlights the product foreground (e.g., the body of a screw) as the only useful place to put a defect.
  • Task-Specific Augmentation: The model learns that different products need different "help." For example, on the "Leather" dataset, the model found that "Defect-free" and "Photometric" augmentations were much more important than "Rotation," likely due to the specific grain and lighting of the material.
  • Closing the Gap with Ground Truth: The learned pasting strategy performed almost as well as a strategy using human-provided ground-truth masks for the product locations, proving that the bi-level approach can "discover" the product geometry on its own.

Key Results

  • Location Learning: On the "Screw" dataset, learning where to paste defects improved the Intersection over Union (IoU) by 18.3% compared to random pasting. On "Capsule," the gain was 12.2%.
  • Augmentation Weighting: Learning the importance of different augmentation sources led to a performance gain of up to 2.6% compared to giving all sources equal weight.
  • State-of-the-Art Baseline: The method consistently outperformed TrivialAugment, a popular non-learning-based augmentation baseline.

Limitations and Future Work

The authors noted that while they could learn the importance of an augmentation, they didn't see significant gains when trying to learn the specific ranges (e.g., the exact degree of rotation). They suggest this might be because the default ranges provided by standard libraries are already well-tuned.

Future work could involve extending this bi-level framework to more complex generative models, such as GANs or Diffusion models, to create even more realistic defect textures rather than just "cutting and pasting" existing ones. Additionally, exploring the computational overhead of the bi-level gradients for even larger-scale industrial deployments remains an open area.

Summary updated

BibTeX
@article{mou2025synth,
  author = {Shancong Mou and Raviteja Vemulapalli and Shiyu Li and Yuxuan Liu and C. Thomas and Meng Cao and Haoping Bai and Oncel Tuzel and Ping Huang and Jiulong Shan and Jianjun Shi},
  title = {{Synth4Seg - Learning Defect Data Synthesis for Defect Segmentation Using Bi-Level Optimization}},
  journal = {IEEE Trans Autom. Sci. Eng.},
  year = {2025},
  doi = {10.1109/tase.2025.3583713},
}
Figure