RRCS 4156 Final
RRCS 4156 Final
https://ojs.wiserpub.com/index.php/RRCS
Research Article
Abstract: Ensuring quality standards is a crucial stage within the textile sector. Automated classification of the
fabric defects is a vital step during the fabric manufacturing process in order to prevent any faulted fabric from
being supplied to the market. The defects on the surface of the fabric were manually identified by the
individuals but this poses problems in terms of human-error and is also time-consuming. Efforts have been made
to achieve better precision in defect detection through image processing studies, leading to the development of
automated systems. In this study, some high-performing deep learning models are applied including ResNet and
VGG-16 and illustrated how these algorithms can be used in the domain of textile manufacturing for fabric
defect detection. A combination of images are used ranging from patterned and textured to plain for better
defects recognition on any given fabric. The algorithm VGG-16 has displayed 73.91% accuracy while the
ResNet algorithm has shown 67.59% accuracy.
Keywords: deep learning, computer vision, ResNet, VGG-16, fabric defect detection
1. Introduction
Fabric defects are flaws in the material that diminish their quality, reducing their value and utility. Once
these defects are in the market, they cannot be rectified or reversed. Hence, ensuring a flawless product is
essential to deliver high-quality goods [1]. Quality control plays a pivotal role in guaranteeing customer
satisfaction and reducing production costs.
Defects are caused in the fabric during the manufacturing process due to various reasons like weaving,
knitting process, raw material, spinning and dying. As a result, faulted fabrics are created which may lower the
customer satisfaction. Substandard products are mostly returned to the textile mill for repair or replacement
which increases the overall cost apart from the production charges. Hence, it is necessary to identify the defects
on the fabric (if any) because only then the manufacturers will be able to figure out how the defects are being
caused and then the necessary steps could be taken to rectify this issue. Once we know how the defects are being
manifested, the process of manufacturing could be improved so that the defects do not occur in the first place,
instead of fixing the defects whenever it occurs. For creating high-quality products to be delivered into the
market, it is crucial that the fabric manufacturing process is improved from scratch [2, 3].
Another challenge in fabric defect detection is that detecting surface defects on fabric is a manual process
that necessitates the employment of an individual to physically inspect each piece of fabric, thoroughly
examining it from all angles in search for potential flaws. This is a time-consuming task, as a single person
cannot perform it as rapidly as needed, resulting in increased labour costs since one person alone cannot
efficiently handle this labour-intensive duty. Furthermore, this manual inspection process is prone to errors,
given that fabric is produced rapidly by machines, making it challenging to identify defects with the naked eye.
Copyright ©2024 Syeda Rabia Arshad, et al.
DOI: https://doi.org/10.37256/rrcs.3120244156
This is an open-access article distributed under a CC BY license
(Creative Commons Attribution 4.0 International License)
https://creativecommons.org/licenses/by/4.0/
2. Literature Review
Talking about some of the studies related to this field, a method known as Gabor filter which utilises one-
class classification (OCC) alongside Gabor filters. In OCC, a skilled classifier can define a classification
boundary based solely on the information from the positive class. Consequently, OCC simplifies the problem by
focusing exclusively on positive fabrics. This eliminates the need to collect and handle various fabric defects, as
well as worries about imbalanced datasets or the lack of negative samples. The researchers have developed a
Gabor filter bank with a range of orientations and bandwidths to analyse different fabric textures. This method
facilitates the creation of customised Gabor filter designs for each fabric texture [9]. The Gabor filter acts as a
strong representation of the simple cells found in the human visual cortex, effectively capturing textures. It is
formed by multiplying a sinusoidal waveform with a Gaussian function. The researchers focused on assessing
the model's effectiveness with plain, patterned, and rotated fabric images.
Another research done in this field is the grey-level co-occurrence matrix, also referred to as the spatial
grey-level dependence method, which aggregates the probability of certain pairs of grey levels co-occurring
under two criteria: the distance between pixels and their relative orientation [10]. The probability assessment is
determined by tallying the occurrences of various grey levels within a defined region, while taking into account
a specified displacement value. It's imperative for the statistics to remain unchanged despite shifts in grey levels,
ensuring that classification is not influenced by tone variations [11]. To generate the co-occurrence data, various
parameters must be defined, such as the window size, pixel distances (d), orientation (theta), and the number of
quantified grey levels (G). A moving window systematically moves across the entire image, computing the
GLCM at each position it covers. Subsequently, the energy feature is extracted from the GLCM. Then these
energy values are compared to a reference, and if any deviation exceeding a specific threshold is detected, it is
identified as a defect. The smallest window size must be designed to encompass a minimum of one periodic
pattern within the pattern or the texture.
After analysing these related works in the field of fabric defect detection, it can be concluded that most of
these studies use a window or a filter-based approach. The Gabor filter uses a linear filter for texture analysis. It
checks for any specific frequency content in the image around the point of analysis. Due to the linear nature of
the filter, it takes too much time to perform the defect detection process. It captures the features and stores them
into a feature vector and the dimensions of the feature vector also keeps on increasing due to the linearity of the
filter. This also causes redundancy of features which reduces the recognition rate. On the other hand, the grey-
3.1 Dataset
Having a good dataset is the key to achieving the optimal results in a deep learning model. In our dataset,
we included a variety of sample images including varied patterns, textured and plain fabric images. The dataset
is divided into three classes of defects which are vertical defects, horizontal defects and holes. Vertical and
horizontal defects are those in which the fabric has a stretch mark in form of a line on top or bottom and in the
left or right (respectively) of the fabric while holes are those defects in which the fabric has a circle or oval
shaped flaw anywhere on the fabric.
All the images including the training and testing images have been converted to grey-scale. The benefit of
working with monochrome images is that it reduces the number of colour channels which in return reduces the
computation power required to pre-process the data. Less number of channels means lesser number of
parameters our model needs to take into account for classification. During pre-processing, all the images were
resized to 224 x 224 pixels. The dataset comprises 3630 images in total which are split into training and testing
samples in a 80:20 ratio, where the 80% of our dataset is reserved for training purposes and the rest 20% is used
for testing our model.
The dataset is curated from three different sources, first is One-Shot Dataset for Fabric Detection shown in
figure (Figure 1), second is Fabric Defect Detection dataset from Kaggle [12] shown in figure (Figure 2), and
the third is Tilda Textile Texture Database [13] which is shown in figure (Figure 3). Some data samples from all
of these datasets are given below:
One-shot dataset:
Tilda:
The types of images present in the dataset are plain, textured and patterned images. Plain fabric is a
material with minimal patterning and usually solid or tonal in colour. Patterned fabrics are the ones that have a
repeating of an element or motif used to create a unique decoration on fabric. Texture refers to the feel and
appearance of fabric, encompassing qualities such as roughness or smoothness, coarseness or fineness, softness
or stiffness etc. and these textures can be different on each fabric. The image samples of these fabric types are
displayed in the image below (Figure 4).
3.2 ResNet
A Residual Neural Network (ResNet) is a type of deep learning model where the weight layers are trained
to learn residual functions with respect to the input of each layer. ResNets effectively address the well-known
issue of vanishing gradients. This problem occurs in deep neural networks when, during back propagation,
gradients become extremely small after multiple applications of the chain rule, leading to weight values not
updating and hindering learning [14]. ResNets counter this by allowing gradients to flow directly through skip
connections, which enables them to propagate backward from later layers to earlier filters, preventing the
Before training our model we first pre-processed our dataset. All images underwent resizing to dimensions
of 224 x 224 pixels, and a batch size of 10 was chosen. Given that there were multiple classes to predict, the
class mode is configured as “sparse.” Our dataset pre-processing began with the utilisation of Keras
ImageDataGenerator [16]. This tool was employed to transform the data based on the specified parameters. All
images underwent resizing to dimensions of 224 x 224 pixels, and a batch size of 10 was chosen.
The total parameters of our model are 266,411,910 out of which 207,834,118 are the trainable parameters
and 58,577,792 are non-trainable parameters. The ResNet architecture comprises an initial convolution and
pooling step, succeeded by four consecutive layers that exhibit similar behaviour. Each of these layers adheres
3.3 VGG-16
Visual Geometry Group (VGG) is 16 layers in depth. This model is also based on the Convolutional Neural
Network (CNN). A convolutional neural network consists of an input layer, an output layer, and several hidden
layers in between. This model comprises a total 13 convolutional layers, 5 max pooling layers, and 3 dense
layers, adding up to 21 layers in terms of architecture. However, it has only 16 weight layers, meaning there are
16 layers with learnable parameters. VGG-16 expects an input tensor with dimensions of 224 pixels in height,
224 pixels in width, and 3 channels for RGB colour information. One of the distinctive features of VGG16 is its
emphasis on simplicity and uniformity in architectural design. Instead of employing a multitude of
hyperparameters, VGG-16 predominantly utilises 3x3 convolution layers with a stride of 1, consistently
applying the same padding technique. Additionally, it employs max pooling layers with 2x2 filters and a stride
of 2. This consistent and straightforward design is a notable characteristic of VGG16. This model’s design
adheres to a uniform arrangement of convolutional and max- pooling layers across its entire architecture.
Following the stack of convolutional layers in VGG16, there are three Fully-Connected (FC) layers. The final
layer is the softmax layer.
We pre-processed the data by resizing it into 224 x 224 pixels. A little scaling is applied between the range
of 0.8 and 1.0. Then image normalisation was applied. Image normalisation is a crucial process that ensures
accurate comparisons across various data acquisition methods and different instances of textures. Normalising
pixel values is particularly advised for imaging modalities that don’t directly correspond to absolute physical
quantities. After that, we have used a pre-trained model by PyTorch [17] which had 135,310,918 total
parameters out of which 1,050,374 are trainable while 134,260,544 are non-trainable parameters. The batch size
was set to 128, Learning rate to 0.005, dropout rate to 0.4 [18] and the output size is 3. The summary of our
VGG-16 model can be seen in the figure (Figure 7) and the architecture diagram of the VGG-16 model is
displayed in (Figure 8).
VGG-16 has more parameters than ResNet and therefore is a deeper architecture and it has shown better
performance than ResNet with an overall accuracy of 73.91% achieved at 13th epoch. The model was executed
for a total of 30 epochs. This transfer learning model re-used the knowledge of pre-trained weights and therefore,
lesser parameters were trained due to which, the accuracy achieved was higher than ResNet. Transfer learning
made the model size substantially smaller, because it used global average pooling instead of the fully connected
layers. Since the weights are not updated and the knowledge is transferred throughout the model, the use of
global average pooling is a smarter option than fully connected layers. This gives the model an opportunity to
effortlessly flow the knowledge through the model.
5. Conclusion
Artificial Intelligence finds applications in a wide range of industries, and it has demonstrated impressive
achievements in the textile sector. Computer Vision (CV) is harnessed to spot imperfections on fabric surfaces
by recognizing patterns and singling out any unusual designs, deeming them as defects. These defects may take
the form of horizontal or vertical flaws, or even holes. This research showcases the advantages of employing
various deep learning methods for the identification of defects on fabric surfaces. Additionally, the study
categorises these defects into different types, such as horizontal, vertical, and holes. The accuracy obtained from
ResNet was 67.59% while the accuracy obtained from VGG-16 was 73.91% which was higher than ResNet.
Acknowledgments
This acknowledgment serves as a tribute to everyone who contributed to the meaningfulness of my
research journey.
Conflict of Interest
There is no conflict of interest for this study.
References
[1] Karayiannis, Y.A.; Stojanovic, R.; Mitropoulos, P.; Koulamas, C.; Stouraitis, T.; Koubias, S.;
Papadopoulos, G. Defect detection and classification on web textile fabric using multiresolution
decomposition and neural networks. In Proceedings of the IEEE International Conference on Electronics,
Circuits and Systems, Pafos, Cyprus, 5–8 September 1999, https://doi.org/10.1109/ICECS.1999.813221.
[2] Chan, C.-H.; Pang, G. Fabric defect detection by Fourier analysis. IEEE Trans. Ind. Appl. 2000, 36, 1267–
1276, https://doi.org/10.1109/28.871274.
[3] Jain, A.K.; Tuceryan, M. The Handbook of Pattern Recognition and Computer Vision. Chapter 11, Texture
analysis. World Scientific Publishing: Singapore, 1992.