Deep-GD: Deep Learning based Automatic Garment Defect Detection and Type Classification

░ ABSTRACT-Garment defect detection has been successfully implemented in the quality quick response system for textile manufacturing automation. Defects in the production of textiles waste a lot of resources and reduce the quality of the finished goods. It is challenging to detect garment defects automatically because of the complexity of images and variety of patterns in textiles. This study presented a novel deep learning-based Garment defect detection framework named as Deep-GD model for sequentially identifying image defects in patterned garments and classify the defect types. Initially, the images are gathered from the HKBU database and bilateral filters are used in the pre-processing of images to remove distortions. A squeeze-and-excitation network (SE-net) combined with Random Decision Forest Classifier with Bayesian Optimization (RDF-BO) algorithm is used to detect and classify garment defects. By analyzing the differences among the original and reconstruction images, the unsupervised technique trains to rebuild the fabric pattern. The SE-net is used to identify certain fabric flaws in the garments of the pre-processed images. Then, the defects-related garments are processed using RDF-BO algorithm for classifying the garment defect from these regions. Finally, the proposed Deep-GD model is used for classifying defected fabric into 12 classes such as Defect free, soil stain, oil stain, Double end, Snarls, Miss, Horizontal stripes, Lumpy, Dye spot, Fall out, Hairiness, tiny hole. The proposed Deep-GD model achieves the overall classification accuracy of 97.16%, which is comparatively superior to the existing techniques.

░ ABSTRACT-Garment defect detection has been successfully implemented in the quality quick response system for textile manufacturing automation.Defects in the production of textiles waste a lot of resources and reduce the quality of the finished goods.It is challenging to detect garment defects automatically because of the complexity of images and variety of patterns in textiles.This study presented a novel deep learning-based Garment defect detection framework named as Deep-GD model for sequentially identifying image defects in patterned garments and classify the defect types.Initially, the images are gathered from the HKBU database and bilateral filters are used in the pre-processing of images to remove distortions.A squeeze-and-excitation network (SEnet) combined with Random Decision Forest Classifier with Bayesian Optimization (RDF-BO) algorithm is used to detect and classify garment defects.By analyzing the differences among the original and reconstruction images, the unsupervised technique trains to rebuild the fabric pattern.The SE-net is used to identify certain fabric flaws in the garments of the pre-processed images.Then, the defects-related garments are processed using RDF-BO algorithm for classifying the garment defect from these regions.Finally, the proposed Deep-GD model is used for classifying defected fabric into 12 classes such as Defect free, soil stain, oil stain, Double end, Snarls, Miss, Horizontal stripes, Lumpy, Dye spot, Fall out, Hairiness, tiny hole.The proposed Deep-GD model achieves the overall classification accuracy of 97.16%, which is comparatively superior to the existing techniques.
Keywords: Garment defect, Defect classification, Deep learning, Bayesian Optimization, Random Decision Forest.

░ 1. INTRODUCTION
Fabrics must be handled in weaving, knitting, and clothing production facilities.Despite the fabric makers' best efforts, there are still a variety of unwelcome defects in the materials [1].Fabric flaws come in a wide variety of forms.A defect on the surface of a manufactured cloth is referred to as a fabric defect [2].There are many fabric faults, and the errors in the manufacturing process or equipment.Minor, major, and critical defects are the three main categories for defects.Small defects that have no impact on the decision to purchase the product are referred to as minor defects [3].Two types of surface defects in fabrics are distinguished by quality standards: surface color change and localized texture irregularity.Due to textural defects, there were increasing numbers of losses in the textile industry [4].Detecting flaws in the garment production process as early as possible is crucial to offering customers high-quality clothing at reasonable prices.To produce high-quality clothing under these conditions, having a system that identifies the flaws, their frequency, their causes, and their solutions is extremely helpful.Furthermore, machinery maintenance will have a significant impact on this process [5][6][7].The quality of a product can vary due to certain events that may occur during the production process.It is possible that human factors, such as skill level, years of experience, and mistake propensity, contribute to the development of such garment defects.
Detecting and classifying garment defects is imperative for sustainable business success in the textile and apparel industry.Companies that deliver high-quality products bolster their brand reputation and ensure customer satisfaction.Reducing defects leads to less rework, repair, and additional quality control processes, which ultimately leads to lower costs.Because so many mistakes can be made while processing clothing manually, it can be challenging.Human inspection does not take defect correlation into account when finding defects [8,9].The assembly line balancing problem affects sewing lines because of human differences in abilities and efficiency.The problem of balancing work on an assembly line results from unfairly dividing work among members.The optimum method is to formulate a plan utilizing a heuristic approach within an acceptable time.In order to deal with this problem, this research paper involves the hybrid of a deep learning model [11] and an optimization algorithm [12] for efficient classification.In this research, a novel Deep-GD model is introduced for efficient recognition and categorization of garment defects.The key benefits of the paper are summarized as: • The core purpose of this study is to present a deep learning-based garment defect detection and classification of defects in garment textiles.• At first, bilateral filters are used in the pre-processing stage of the collected images to remove superfluous distortions.Traditional methods of garment flaw identification could never achieve a 100% inspection rate.Despite the fact that traditional algorithms are useful tools because of the benefits already mentioned, there are still certain problems that could be solved.
There may be intricate connections between numerous variables and different aspects in some textile studies that are difficult to grasp using straightforward methods.Dealing with diverse data is a different issue that needs to be solved using problemspecific science algorithms.The fact that only a small dataset may be acquired by collecting numerous measurements in laboratories presents a recurrent problem in various textile investigations when the number of recordings is constrained.
Because of these vast drawbacks attempts are being made to replace the garment defect process by automated one that used a Squeeze-and-Excitation network and RDF MODEL with Bayesian Optimization, to ensure the increasing probability of best garments and continuous measurement of garments quality.

░ 3. PROPOSED METHODOLOGY
In this section, we proposed a novel Deep-GD model to detect and classify the defect in the garments.The overall workflow of the proposed methodology is shown in figure1.

Image Acquisition
In this work, the first database is scanned from the garment defect handbook.The sample of garments images are selected in such a way that it contains all common type of defects occurring in textile industries.This algorithm is applied on 12 classes such as Defect free, soil stain, oil stain, Double end, Snarls, Miss, Horizontal stripes, Lumpy, Dye spot, Fall out, Hairiness, tiny hole.Each class contains 100 images: for training 20 images are used and for testing 80 images are used.Totally 500 samples are adopted for this work.Sample images of the different garments is shown in figure 2. Garments images usually have noise after the scanning process.This noise affects the quality of the images and makes the images unclear, distorts the shapes of the garments texture.

Bilateral Filtering
In the bilateral method, which is similar to Gaussian filtering method's weighted value computation in spatial domain, images are smoothed while edges are preserved.Simple, local, and noniterative describe the filter process.As with photometric and geometric closeness, it combines both color and grey images, conserves neighboring value to distant value in both range and domain.the range of denotations, which include both linear and non-linear.The sum of pixels in an internal neighborhood is used in the weighted bilateral approach.The weight value is influenced by both spatial distance and intensity.Theoretically the result is calculated as follows for a pixel x location, Where the parameter   and   involves computing the weights in the spatial and intensity domains, and () of a pixel corresponds to a spatial neighborhood in (), with the element being a constant normalized value.

Squeeze-and-Excitation Block
In this section, a SE-net is used to identify the fault in the garment images.Any alteration   plotting the contribution  to the characteristic pattern  atr  2  ×× .In order to produce a channel descriptor, the structures U are subjected to a squeeze process that collects characteristic pattern over all of their longitudinal sizes.Enabling information from the global responsive area to be accessible to all system stages is the aim of this descriptor, which provides an encoding of the worldwide spread of channel-wise characteristic response.The excitement functioning: After gathering, it is a simple self-gating procedure that produces a set of per-channel modulator rates by taking the embedding as input.Prior to being directly input into further layers of the network, these values are added to the characteristic maps to produce the SE block solution.
Here * Convolution, and other terms are indicated below.One channel of   that interacts with the corresponding channel of X is represented by the 2D spatial kernel    .Figure 3 depicts a diagram outlining the structure of a SE unit.Here * denotes convolution   = [  1 ;   2 ; ∶∶∶ ;    ],  = [ 1 ;  2 ; ∶∶∶ ;   .] and 2  ×× .2D spatial filter illustrating a single channel of   that acts on the corresponding channel of .Bias terms are deleted to streamline the notation.Channel dependencies are implicitly encoded in since the output is created by summing across all channels.However, they are entangled with the local spatial correlation that the filters are able to detect.Convolution models implicit and local channel interactions by default (with the exception of the top-most layers).We anticipate that explicitly defining channel interdependencies will improve the learning of convolutional features and enable the network to become more sensitive to informative characteristics that can be used by subsequent transformations.Kernel access to global data must be calibrated so that filter responses can be calibrated in two steps, SE-net, before they are input into the subsequent transformation.

Squeeze: Global Information Embedding
We initially take into account the signal to each channel in the resultant features in order to address the issue of utilising channel dependency.Each unit of the transformation output U is unable to utilise contextual information outside of this area since each learned filter only acts with a limited receptive field.We suggest condensing global geographical information into a channel descriptor to alleviate this issue.This is accomplished by creating channel-wise statistics using global average pooling.Formally, a statistic  2   is created by decrease U through its spatial dimensions  × , like the c-th element of z is estimated by: (3)

Excitation: Adaptive Recalibration
We follow the squeeze operation with a second process that tries to completely capture channel-wise dependencies in order to make use of the data gathered during the squeeze process.This function must meet two requirements in order to accomplish this goal: first, it must be adaptable, and second, it must learn a non-mutually exclusive relationship, so multiple channels can be highlighted rather than forcing a single activation.We choose to use a straightforward gating system with sigmoid activation to fulfil these requirements: where  refers to the ReLU function, 1     × C and 2   ×   .The bottleneck can be avoided by adding two fully connected (FC) layers around the non-linearity, a dimensionality-reduction layer with a reduction ratio of r, ReLU, and a dimensionality-increasing layer that increases dimensionality to the channel dimension of the transformation output U. We parameterize the gating mechanism to reduce model complexity and aid generalisation.By scaling U with the activations s, the block's ultimate output is achieved: where  ̌ = [ 1 ̌,  2 ̌, …  ̌] and   (  ,   ) denotes to channelwise multiplication between the scalar   and the feature map   2  × .An essential component of the textile industry is quality control.Traditional human inspection can lead to erroneous conclusions, higher expenses, and slow manufacture.In order to identify textile-related flaws, such as fabric flaws (such as yarn, woven fabric, knit fabric, dyeing flaws) and garment flaws (such as cutting, stitching, and accessory flaws), some researchers employed SVMs.However, it never yields a precise result.For quality control and defect identification, the most popular type of Random Decision Forest Classifier with Bayesian Optimization is utilized.

Random Decision Forest Classifier with Bayesian Optimization
The defected images are fed in to the RDF classifier to classify the types the defects in the garments.RDF learning algorithm executing N times after randomly dividing the initial data into N equal sets of the same size.Known as N-fold cross-validation, this technique.Each time, the model will be trained using the remaining sets (i.e., N-1) and one set from the N set as the test set.The model parameters will be learned from the set with the lowest average error after calculating the average error for each set.Based on the values of the supplied data's attributes, the decision tree organizes the data.The features that best classify the content are used to produce the classifications.The data items are divided based on the values of these feature values.Every divided subset of the data items goes through the same procedure.Equation 5 can be used to compute entropy, where 'z' is the number of occurrences and 'a' is the entire information about samples from z occurrences. is a rough estimate of how often the specific result will appear in z occurrences.The following equation 6 can be used to compute the information gain.
= ℎ  − The optimization algorithm is utilized to normalize the RDF classifier to efficient classification of garment defects.

Bayesian Optimization algorithm
Website: www.ijeer.forexjournal.co.inDeep-GD: Deep Learning based Automatic Garment Defect Detection and Type Classification hyperparameter tuning.However, there are time restrictions and no systematic, methodical search.Iterative tuning has advantages techniques find the right hyperparameters in less rounds.In this paper, the Bayesian optimization approach is used.The RDF approach utilizing the BO technique (RDF-BOA) is described in detail below.Where, the hyper-parameter settings are initialized δ and loss function.

Random generation:
The parameters at the input are created at random after startup.The highest fitness values are selected in this stage based on a particular hyper-parameter configuration.

Fitness function:
The initialized values are used to generate the random sample of solutions.Based on the following equation 9, the fitness value was utilized to diminish the goal values.

𝑓𝑖𝑡𝑛𝑒𝑠𝑠 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 (
where ()denotes loss of rate over observing and volume computation, ()is produced by the loss notes, Y is the loss symbol and  * stands for specific quantile.
Termination: In this stage, the BOA is used to determine the ideal hyper parameter for RDF classification.The feature extraction output is combined with a feature-weighted input to give the right features the weight they deserve.Finally using RDF-BO algorithm accurately classify the types of the garment defects.

░ 4. RESULTS AND DISCUSSION
The experimental arrangement of this learning has been executed by using MATLAB 2018.The computations were performed on a Kaggle kernel with four CPUs and 17 GB of RAM and two CPUs and 14 GB of RAM.In this result investigation, the descriptions from the gathered dataset for classifying the defect garments has been discussed.The effectiveness of the proposed Deep-GD model and the comparison with several algorithms are also offered in this sector.
Website: www.ijeer.forexjournal.co.inDeep-GD: Deep Learning based Automatic Garment Defect Detection and Type Classification Website: www.ijeer.forexjournal.co.inDeep-GD: Deep Learning based Automatic Garment Defect Detection and Type Classification Support vector machine classifier for automated fabric defect detection system proposed by Chhapkhanewala et al. (2017)[16].High accuracy and success rates with low processing time are advantages of this work.In plain woven materials, Anila et al. (2018)[17] suggested a segmentation approach based on an entropy filter in conjunction with morphological processes.Machine learning method for textile fault detection was proposed by Daniel Yapi et al. (2018)[18].This approach accurately localises defects and is compact and quick to compute.For automatic fabric fault classification, Yassine Ben Salem et al. (2020)[19] suggested a machine learning technique.The mixture of a texture investigation method with a SVM forms the foundation of this work.Additionally, this work incorporates machine learning and statistical methods for fabric texture.High detection rate, low false alarm rate, and excellent robustness are all achieved by this effort.The production division of industries can use this strategy.

Figure 1 :Figure 2 :
Figure 1: The overall representation of the proposed methodology

Figure 4 :Figure 4
Figure 4: Trial results of garment defect detection and classification Figure 4 shows the results of detection and classification.Proposed work is applied to the garment's images affected by the defects this will accurately detect the defects and improves the quality.Table1shows the classification accuracy of the proposed work, for classification data set images and scanned images from fabric handbook are used.We have chosen to use 12 classes of fabric defects, hole, excessive margin, stain, crack, improper stitch balance, needle break, ink stain, torn, drop stitch, soil content, broken end and defect free.Defect free garments images and hole defect images are classified with high accuracy than other defects.

Table 1
shows the classification accuracy of the proposed work, for classification data set images and scanned images from fabric handbook are used.We have chosen to use 12 classes of fabric defects, hole, excessive margin, stain, crack, improper stitch balance, needle break, ink stain, torn, drop stitch, soil content, broken end and defect free.Defect free garments images and hole defect images are classified with high accuracy than other defects. ░

Table 1 . Classification results of garments defects S. No Types of Defects Accuracy
accuracy, sensitivity, specificity, precision, recall, f1-score, quadratic weighted kappa indices, detection rate, TPR, FPR.The model's performance was also tracked by plotting loss and accuracy curves across the number of epochs.The comparison of performance metric, average computational time with other Website: www.ijeer.forexjournal.co.inDeep-GD:

Deep Learning based Automatic Garment Defect Detection and Type Classification enhancement
methods.Our enhancement work attains best value due to its low complexity.Computational time of Gabor is closer to the proposed enhancement method, but the output enhanced results of Gabor affected by undesired artifacts. ░

Table 2 . Performance comparison table of proposed and conventional methods
Table2shows the performance metrics comparison of proposed work with existing models shows that precision, sensitivity, specificity and accuracy are great values for proposed work than existing approaches.AlexNet model which is most popular among conventional methods and have superiority in fabric inspection over other conventional works in terms of computational cost.On the basis of authentic garment samples, the evaluations are carried out in the same setting.Due to the application of convolutional layers in both the horizontal and vertical directions to extract defect characteristics, this method detects affects in clothing effectively.The accuracy of the Deep-GD model not be fulfilled when the flaws contour is hazy and mistaken with normal clothes texture since this model depends on the features extracted from the defects and the spatial domain method.As a result, this model is unable to accurately depict the whole contour of the faults.The proposed Deep-GD model detect defect types accurately with 97.3% accuracy.RDF-BO classification method is effective in detecting the different defects recognition.RDF-BO classification method provides accurate results, the computation time is more.It gives extensive pathway to classify the garments defects.But this method needed a greater number of features for classification.This method effectively addresses the feature redundancy problem for accurate detection and classification of garment defects. ░

Table 3 . Ablation evaluation of the proposed model
across different scenarios.The BO algorithm should be scalable to handle large-scale classification tasks efficiently.As a result of our findings, ablation models were typically less accurate in classification, demonstrating the usefulness of BO algorithm.This work presents a novel Deep-GD model to detect and classify the garment defects.To expand the efficacy of defect identification in textiles, new hardware and software innovations have been applied to computer vision technologies.The proposed model is combination of SE-net and RDF-BO algorithm was presented to classify garment defects in the apparel industry.Firstly, a Bilateral filtering with enhancement technique was presented.A segmented technique SE-Net was developed to segment images, a defect image was obtained which were collected and input into RDF-BO classifier to execute recognition work.There were 12 classes of fabric defects, hole, excessive margin, stain, crack, improper stitch balance, needle break, ink stain, torn, drop stitch, soil content, broken end and defect free images are classified.The proposed Deep-GD model was evaluated using the specific parameters using specificity, sensitivity, precision, accuracy and F1 score.The detection rate was accurate the proposed Deep-GD model achieves 97.16% for garment defect images.The experiment results show that the method developed in this study is feasible and applicable.
According to a comparison, the concert is evaluated by removing the BO algorithm.The BO algorithm should be robust to variations in input data and parameter settings, ensuring consistent performance