Home

Awesome

AdaBLDM

The implement for paper : "A Novel Approach to Industrial Defect Generation through Blended Latent Diffusion Model with Online Adaptation"

Arxiv Link

News!

2024/04/25 : Update the training code! :blush:

Dataset

  1. MVTEC AD
  2. BTAD
  3. KSDD2

    Due to the non-square ksdd2 image , it need to crop the image of KSDD2 samples.

    Preprocess code in this.

Env Install

We follows ControlNet.

Prepare

Build trainset for AdaBLDM training.

MVTec-AD in this.

BTAD in this.

KSDD in this.

Train

Mvtec-AD Part

  1. Download Mvtec-AD dataset.
  2. Foreground_predictor : Look this
  3. Prepare for mvtec dataset : Look this
  4. Download SD model : download "v1-5-pruned.ckpt". And put it on the directory named "./models".
  5. Convert weight of sd model :
    python tool_add_control.py ./models/v1-5-pruned.ckpt ./models/control_sd15_ini.ckpt
    
  6. Config training setting : Look this
  7. Start to train a AdaBLDM:
    # default : train a hazelnut with hole.
    python train.py
    

Test

  1. Input the model checkpoint : in test.py line 35.
  2. Run code:
    # default : test with hazelnut with hole.
    python test.py
    

Stable Diffusion

Pretrain Stage

How to obtain the mvtec object's description? Look at this.

Foreground_predictor for trimap

How to get the object's foreground ? Look at this

SVM

Coming soon....

DeSTSeg(CVPR2023)

DeSTSeg: Segmentation Guided Denoising Student-Teacher for Anomaly Detection

offical code

Compare Method

DFMGAN(AAAI2023)

Few-Shot Defect Image Generation via Defect-Aware Feature Manipulation

offical code

Eval metric

Anomaly detection (following DeSTSeg)

  1. pixel-auc
  2. pro
  3. ap
  4. iap
  5. iap90

Image quality (following DFMGAN)

  1. KID
  2. LPIPS

Acknowledgement

ForegroundPredictor

ControlNet

LatentDiffusion

StableDiffusion

Citation

@article{Li2024ANA,
    title={A Novel Approach to Industrial Defect Generation through Blended Latent Diffusion Model with Online Adaptation},
    author={Hanxi Li and Zhengxun Zhang and Hao Chen and Lin Wu and Bo Li and Deyin Liu and Mingwen Wang},
    year={2024},
    url={https://api.semanticscholar.org/CorpusID:268091266},
}