Giter Site home page Giter Site logo

gan-defect's Introduction

GAN-defect

This project is mainly based on the paper: A Surface Defect Detection Method Based on Positive Samples.
The model details in this project may be not completely consistent to the model proposed in the paper.

model

Requirements

  • pytorch 1.4.0
  • torchvision 0.5.0

Introduction

The model is proved to be able to "repair" the images which are simple and with periodic texture, here "repair" means generating images without surface defects from the images with defects.

After getting the repaired images, one can use LBP feature to get the defect area, which is proposed in the paper, or use a segmentation network to output the defect area(to be deployed).

The input images are normal image patches without defects, the defect will be added automatically during the training process. The defects can be randomly generated geometric shapes(deployed) or defect patches in the collection.

Results

The following results come from a simple demo, in which the normal images are artifical grid images(randomly generated).

train data example
train data example

train result example
train results(certain batch with 16 images)

train result example
val results(certain batch with 16 images)

In above result images, the top 2 lines shows the images with surface defect, and the bottom 2 lines show the corresponding repaired results.

In this demo, the surface defects added in the training process are circles and rectangles, and the surface defects used in validation process are lines. From validation results, it can be observed that when the normal images are simple enough, the "repair" results are relatively robust to defect color and shape.

Train and validate

As far the training and validation settings can be modified in train.py directly. Modify the parameters in class Config and then run train.py.

Remark

  • The segmentation branch is not well deployed so cannot be used now.
  • The test part is not completed so far.
  • The project is just a demo to verify the methods proposed in the paper mentioned above.

gan-defect's People

Contributors

hukefei avatar

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.