Giter Club home page Giter Club logo

adabldm's Introduction

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! 😊

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},
}

adabldm's People

Contributors

grandpaxun242 avatar zzx531 avatar

Stargazers

richfrain avatar  avatar  avatar  avatar flyinghu avatar  avatar  avatar  avatar  avatar  avatar Cameltr avatar jzlin avatar Yang Gao avatar  avatar sindo avatar  avatar  avatar keding zhang avatar Farrukh Nauman avatar Jeff Carpenter avatar  avatar  avatar Shawn He avatar  avatar  avatar  avatar

Watchers

Pribadi HCR avatar Kostas Georgiou avatar  avatar

adabldm's Issues

Generation of data sets with spatial structure

Dear author, I have trained and tested the code in the bottle/broken_large category in the mvtec_ad dataset, and I have only used a small class (broken_large), which works well. However, there is a small problem, because the location of the generated mask is random, but for the category of bottle, its borken only occurs on the ring, which means that this kind of data has a relative spatial structure. I have found that this method has poor effect on this situation, may I ask how to improve it

The output dataset

Hello,what you have done is impressive!Well,I am currently busy completing my undergraduate project and need some defect images to train my pixel refinement model. Is it possible to get your after trained MVTecAD dataset? I can receive the dataset personally or through the cloud drive if necessary. This will be a great help to me. Looking forward to your reply.

A error when run the code

Dear author, when I run the code with command,python ./foreground_predictor/foreground_predictor.py,there is a mistake
Traceback (most recent call last): File "./foreground_predictor/foreground_predictor.py", line 10, in <module> from models import EfficientnetPM File "/home/401229/AdaBLDM-main/foreground_predictor/models.py", line 1, in <module> from futils import FeaturesCollector, load_ckpt ImportError: cannot import name 'FeaturesCollector' from 'futils' (/home/401229/AdaBLDM-main/foreground_predictor/futils.py)

I checked the futils.py file, there is no FeaturesCollector function, what should I do with it?

Training Code

Hi, When the training code is available...
Big Thanks

Change gpu id.

Hello author, I would like to ask how to modify the gpu id when I train and test, because I found that 0 card is used by default every time.

The number of images in trainset

Dear authors! Thanks for your contributions! When running python generate_dataset.py, you set GENERATENUM = 20000 to generate target images of trainset. It seems a large number for only a defect type of a class. What's the influence of different image numbers of trainset, for example, if I set GENERATENUM = 200?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.