Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Model and README Enhancement] Glass Bangle Defects Detection #643

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ The data images(about 1080 in number) were especially large (3000X3000 pixels).
- Normalized the data images using empirical values of mean and standard deviation.
- Finally all images were converted into batches and loaded into the pytorch model

- For CNN with Attention, we took images as 400 X 400, normalized them, and then flipped the colour intensity to highlight contours better.

## The Model
So the model I have used here is here is ResNet and GoogleNet, commom industry standard models developed by researchers at Microsoft and Google respectively.

#### ResNet
<img src="./Images/Residual-Block.PNG" width="800" title="CNN Model">

Expand All @@ -28,26 +31,36 @@ So the model I have used here is here is ResNet and GoogleNet, commom industry s
#### Custom-Model
Also I have made a custom model using one convolutional layer and 2 fully connected layers in order to display the internal working of the CNN-architecture based Neural Networks.

<img src="./Images/Residual-Block.PNG" width="800" title="CNN Model">

#### CNN

A Deep neural network model which has feature selection and feature training components.

<img src="https://github.com/Arihant-Bhandari/DL-Simplified/blob/enhance_bangle_defect/Glass%20Bangle%20Defects%20Detection%20using%20DL/Images/CNN-Keras.png">

#### CNN with Attention

A Deep neural network model which has feature selection and feature training components, with an overhead attention mechanism to introduce probability distributions into training.

<img src="https://github.com/Arihant-Bhandari/DL-Simplified/blob/enhance_bangle_defect/Glass%20Bangle%20Defects%20Detection%20using%20DL/Images/CNN-Keras-Attention.png">

## Training and Testing of the Model
ResNet and GoogleNet took approximately 19 minutes each to be fine-tuned and generate accurate results.And the custom model took approximately 30 minutes of computational time. All models were trained on GoogleColab using 12 GB free GPU provided by Colab.
ResNet and GoogleNet took approximately 19 minutes each to be fine-tuned and generate accurate results.And the custom model took approximately 30 minutes of computational time. All models were trained on GoogleColab using 12 GB free GPU provided by Colab. CNN-Keras and Attention were trained on Kaggle with GPU-T4 boosting.

| Models | Best Train-Accuracy | Best Validation-Accuracy | Computation-Time|
|--------|---------------------|--------------------------|-----------------|
| ResNet-18 | 86.21% | 89.8618% | 19m 31s |
| GoogleNet | 74.62% | 77.8802% | 19m 42s |
| Custom Model |53.548% | 53.548 % | 30 minutes |

| Custom Model | 53.548% | 53.548 % | 30 minutes |
| CNN (Keras) | 89.9% | 81.4% | 2.5 minutes |
| CNN (Keras-Attention) | 99.32% | 88.27% | 1.67 minutes |

## Conclusion

So the best model selected is going to be ResNet which is a very good model for Image Recognition. For more information on ResNet, read https://arxiv.org/abs/1512.03385
So the best model selected is going to be ResNet which is a very good model for Image Recognition, and another model to be considered is CNN with Attention mechanism with comes just as close.

## Courses I followed to Build the Model
- Michigan's Deep Learning for Computer Vision
(https://www.youtube.com/playlist?list=PL5-TkQAfAZFbzxjBHtzdVCWE0Zbhomg7r)
- Pytorch Tutorials
(https://www.youtube.com/playlist?list=PLqnslRFeH2UrcDBWF5mfPGpqQDSta6VK4)
## Your signature
Original Contribution: Aryan Gupta

## Developer Details
Developed By Aryan Gupta
(Electrical Engineering Student, IIT Roorkee)
README and Model enhanced by: Arihant Bhandari [https://github.com/Arihant-Bhandari]
1,462 changes: 0 additions & 1,462 deletions Glass-Bangle-Defect-Detection/Model/Glass-Bangle-Defect-Detection.ipynb

This file was deleted.