https://github.com/bhavyemathur/defect-detection
Machine Learning for unsupervised & single-shot quality inspection & defect-detection on the assembly line.
https://github.com/bhavyemathur/defect-detection
defect-detection machine-learning single-shot-detection unsupervised-learning
Last synced: 7 months ago
JSON representation
Machine Learning for unsupervised & single-shot quality inspection & defect-detection on the assembly line.
- Host: GitHub
- URL: https://github.com/bhavyemathur/defect-detection
- Owner: BhavyeMathur
- Created: 2024-06-28T08:21:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T15:01:09.000Z (almost 2 years ago)
- Last Synced: 2024-08-07T19:15:18.187Z (almost 2 years ago)
- Topics: defect-detection, machine-learning, single-shot-detection, unsupervised-learning
- Language: Jupyter Notebook
- Homepage:
- Size: 1.09 GB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repository contains code developed at [AIVolved](https://aivolved.in/) for quality testing using Machine Learning & Artificial Intelligence.
Several goals were pursued on key datasets including:
1. Eye-patch shift detection using non-ML computer vision techniques (92.98% accuracy)
2. Clustering & SVD on ResNet output for unsupervised defect detection in soap (99.55% acccuracy)
3. Unsupervised, single-shot defect detection in soap using the Fourier Transform (100% accuracy)
4. Cut detection in shampoo using Sobel & Canny filters + Hough Transform (N/A)
# Eye-patch shift Dataset
[eyeshift.ipynb](eyeshift.ipynb) contains code that identifies defects in eye-patches for shampoo packets.
First, a YOLOv8 model identifies horizontal and vertical cuts, then a linear regression is performed through the horizontal cuts,
and eye-patches outside a threshold are categorised as defective.
**Accuracy:** 92.98%


# Soap Dataset
[soap-binary-classifier.ipynb](soap-binary-classifier.ipynb) uses a simple fully-connected layer on the outputs from ResNet18,
fine-tuned on a dataset of soap to classify as either defective or non-defective.
**Accuracy:** 100%
Non-Defective
Defective
[soap-feature-clustering.ipynb](soap-feature-clustering.ipynb) is an unsupervised approach to defect detection in
this dataset where features from the ResNet18 output undergo a Singular Value Decomposition (SVD) and are then clustered using Birch.
**Accuracy:** 99.55%
Ground Truth
SVD & Clustering
Prediction
[soap-autoencoder.ipynb](soap-autoencoder.ipynb) is actually a U-net which attempts to reconstruct masked images of soap to predict defective pieces by correcting errors.
**Accuracy:** untested.
Masked Input
Prediction
[soap-fourier-analysis.ipynb](soap-fourier-analysis.ipynb) is a single-shot, unsupervised method for defect detection on a normalised dataset.
A non-defective single-shot reference image is chosen and the squared complex-difference between its Fourier Transform and all other images in the dataset are compared and clustered.
**Accuracy:** 100%
Fourier Transform of Soap
Histogram of Differences to Reference
# Shampoo Dataset
[shampoo.ipynb](shampoo.ipynb) contains code that identifies defective cuts in shampoo packets.
First, vertical cuts are extracted using a YOLOv8 model, the cuts are equalised and normalised and a sobel filter is applied to enhance edges.
A Canny edge-detector is used followed by a Hough transform to identify cuts.
**Accuracy:** visually excellent. No quantitative measure.
Masked Input
Cuts Extracted from YOLOv8
Equalised & Sobel Filtered
Canny Edge-detection & Hough Transform

