TechieYan Technologies

Identifying Defects in the Various Fabrics using Convolutional Neural Networks

Abstract

The main objective of this project is to identify whether there is any fault in the fabrics or not, this is done using convolutional neural networks where the model is trained on both defected and non-defect fabric dataset. The dataset was obtained froms private data repository and some pre-processing has been performed to make sure the data is clean for modelling., luctus nec ullamcorper mattis, pulvinar dapibus leo.

Code Description & Execution

Algorithm Description

So, we have used Convolutional neural networks to identify whether a fabric is defect or not, as we all know, how sophisticated CNNs are and how they can learn almost anything like a human brain does, this can help us save a lot of time and also giving almost accurate predictions for the disease. As we discussed convolutional neural networks are very sophisticated and more advanced version of neural networks, these are very superior to other neural networks which works better with images and audio/speech input signal. A CNN network comprises of 3 important layers such as a convolutional layer, pooling layer and fully connected layer. we can have as many layers as possible depending on the domain and project we are working on.

Reference:

https://www.ibm.com/cloud/learn/convolutional-neural-networks

How to Execute?

Note: Make sure you have checked the add to path tick boxes while installing python, anaconda.

Refer to this link, if you are just starting and want to know how to install anaconda.

If you already have anaconda and want to check on how to create anaconda environment, refer to this article set up jupyter notebook. You can skip the article if you have knowledge of installing anaconda, setting up environment and installing requirements.txt

 

1.  Press windows key and type in anaconda prompt a terminal opens up. Before executing the code, we need to create a specific environment which allows us to install the required libraries necessary for our project. 

  • Type conda create -name “env_name”, e.g.: conda create -name project_1
  • Type conda activate “env_name,   e.g.: conda activate project_1

2. Make sure you are in the correct path in your terminal, where you have saved your executable file/folder. E.g.: cd A:\project\AI\Completed\project_name, then press enter.

3. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.)

4. After installing all the libraries, type in “jupyter notebook” you will be redirected to a webpage, there you need to select which file you would like to run. (If you face any issues of not opening jupyter notebook, please refer to the above link provided to resolve the issue.)

5. Run main.ipynb run the final code, and make sure to change the path of the model and image folders. You can even see preprocess.ipynb to get a feel of how the images are pre-processed.

Data Description

So, the dataset in the project was collected from a private repository and some were collected from Kaggle data repository. It consists of two classes of images each class consists of more than 100 images. Defected fabric and normal. Below are some sample images of 2 classes.

Credits to the owners of the dataset.

NORMAL

DEFECT

Result

1.Confusion matrix

Note: The Model weights and dataset haven’t been provided here since, it didn’t allow us, obviously.

Feel free to contact me if you face any issues.

Click here to download the code and associated files.

Credits to the owner of the Research Paper for giving reference to the project. 

Issues you may face while executing the code

Pre-processing and training the model takes lot of time since the dataset is being trained on huge amount of data.

  1. We might face an issue while installing specific libraries.
  2. Make sure you have the latest version of python, since sometimes it might cause version mismatch.
  3. Adding path to environment variables in order to run python files and anaconda environment in code editor, specifically in visual studio code.
  4. Refer to the Below link to get more details on installing python and anaconda and how to configure it. http://techieyantechnologies.com/2022/06/get-started-with-creating-new-environment-in-anaconda-configuring-jupyter-notebook-and-installing-libraries-using-requirements-txt-2/
  5. Make sure to change the paths of the model and dataset in the code.
+91 7075575787