GithubHelp home page GithubHelp logo

tandon-a / quality-control-using-deep-learning- Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 9.0 13 MB

A deep learning based quality control pipeline to detect defective products

License: MIT License

Python 100.00%
deep-learning quality-control tensorflow cnn cnn-classification visual-inspection

quality-control-using-deep-learning-'s Introduction

Quality-Control-using-Deep-Learning-

Automating the process of quality control using visual inspection by developing a deep learning model to distinguish between defective and non-defective products. Implementing model architecture as proposed in the paper.

Prerequisites

  • Python 3.3+
  • Tensorflow 1.6+
  • pillow (PIL)
  • pickle
  • Matplotlib
  • DAGM Texture Databse: DAGM database used for model training

Dataset

DAGM Texture database is used to train and test the model as specified in the paper. The dataset contains 6 product classes which are divided into normal and defective categories, having 1000 and 150 images respectively.

To enlarge the defective images set small patches are extracted manually after which they are augmented using rotations and mirrorings. To do this easily the prepdatalist.py file allows the user to save the centre points for the patches of every defective image and saving them to disk. Later, at the time of training, these centre points are used to create the training and validation dataset at run time.

Fig1: Extracting image patch. The blue window patch shows the image which will be saved later. Count shows the image points extracted for this image and len shows the number of images processed for a specific class.
Class 1 Defective Class 2 Defective Class 3 Defective
Class 4 Defective Class 5 Defective Class 6 Defective
Table1: Sample defective images per class.

Sampling Video

Fig2: Sample extraction from defective images

Pipeline Architecture

First, the image of the texture is passed through a 'global' classification model which predicts the class for the texture after which it passes through the class specific 'sub' model which classifies it as defective or non-defective. The model architecture is the same for 'global' and 'sub' models except for the last fully connected layer.

model architecture

model routing

Fig3: Model Architecture

Usage

To prepare centre point lists for the defective images:

  • Change data_path variable as per your project directory in the file prepdatalist.py and execute the same.

Executing this file produces 'sub' model file lists for every class with the name- qcdlsub(Class_no)list, e.g., qcdlsub2list and a 'global' model file list containing training and validation images for the global model - qcdlglobal

To train the model: 'sub' model

> python trainqcdl.py --data_path qcdl --model_part sub --class_no 2 --model_dir qcdl/sub2

'global' model

> python trainqcdl.py --data_path qcdl --model_part global --model_dir qcdl/global
  • data_path: Path to the directory containing the dataset organised in Class(Classno) and Class(Classno)_def folders, e.g., Class1, Class1_def. File lists prepared on running prepdatalist.py are stored in this folder. The folder path is then passed as data_path variable value while training the model. (No default value. Need to provide)
  • model_part: global or sub to train a model. (default value: global)
  • class_no: Class_no for which to train the sub model (default value: 1)
  • model_dir: Path to the directory where the model would be saved after training. (default value: model_dir)

Author

Abhishek Tandon/ @Tandon-A

quality-control-using-deep-learning-'s People

Contributors

tandon-a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.