{'fraction_non_alphanumeric': 0.0276121051468964, 'fraction_numerical': 0.0072343715484868565, 'mean_word_length': 4.737959442332066, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Deep Convolution Neural Network Approach for Defect Inspection of Textured Surfaces

Defect Inspection of Textured Surfaces is a challenging problem which occurs during manufacturing in many processing phases. With arbitrary length, shape and orientation, these defects occur. Moreover, there are fewer and different photos of defective products. Deep Convolution Neural Network (CNN) has an impressive development in target detection, and better results have been obtained with the implementation of deep CNN design for texture detection. Nonetheless, with the growing detection accuracy of deep CNNs, there are the drawbacks of significantly increasing computational costs and processing resources, which seriously hinders CNN's use in resource-limited environments such as mobile or embedded phones. In this paper, a novel framework is proposed that uses raw image database patch statistics joint with two layers of neural network for surface defect detection. For defect detection, a convolution neural network (CNN) classifier is used. Imaging analysis of training samples using Deep Convolution Neural Network (CNN) is used to find the defect in an image's target area. In point of energy saving, the results of the experiment show that proposed method has numerous advantages in terms of reduction in time and cost. It also shows the high-performance contrast to conventional manual inspection process with less repetition and helps to build the object detection classifier with high generalization potential and high detection accuracy.


Introduction
With the growth of small in size and economic machinery, machine vision became faster and more reliable and also widely used in the various fields. In specific, to detect the texture surface by the vision sensors as a device for surface detection. Further, machine vision can also simultaneously perform identification of defects, recognition of surface texture, shape etc. Earlier, surface detection was to detect the defects on non-texture surfaces like flat and smooth without the variation. Now it is applied on complex texture surfaces. In the last decades, to detect complicated defects like tiny and blurry objects that have been traditionally inspected manually.
Textile fabric is created in daily life using textile fibres and a commonly used material. Unforeseen operations may be the reason of numerous defects on the image surface during the manufacturing of woven fabric. Due to the deficiencies the price of fabric can reduce by 50-60% [1]. The reduction in the effects in the production process is normal for the manufacturer. The role of quality control in textile manufacturing involves a fabric defect inspection. Generally, the conventional approach is based on the dream of man. Workers are expected to track and manually fix possible defects for detection. Even, generally the defects are minor. Mostly different forms of defects are all right. Human eyes are not easy to detect. For fact, identification of humans would increase working hours. The textile industry has identified more than 70 types of defects [2]. Thus, for such a large number of defects, an automated inspection system must be established not only to improve the quality of the product, but also to reduce the costs. An automatic inspection can be achieved with the accuracy rate more than the 90% as compared to 75% achieved by the human beings [3,2]. In last few years, automated fabric defects are identified by using the machine vision and the image processing in the research as well as in industry. To replace historically manual methods, many vision systems have been developed. There are a wide range of different characteristics due to the variety of fabrics. All fabrics can be graded into 17 grades [2]. Each is formed in various forms such as rectangular, triangular, or hexagonal. There are a number of definitions and defect features for more than 70 types of defects.   Figure 1(b) shows a big hole, Figure 1(c) shows a cut, Figure 1(d) shows a sliced hole, and Figure 1(e) shows a sliced hole with cut. First two images are flaws in the type of hole and by the hole size. In the third image there is a cutting flaw, fourth image show the sliced hole, and the last image show the hole slicing. Data collection is also a problem in the identification of defects. It's hard to collect enough samples for each form of defect. This allows data sets to be incomplete. Consequently, although many researchers have put a lot of effort into the problem, it is not possible to extend a method proposed for a class of fabric to another. Various vision systems are being developed for inspections of surface defects in manufacturing [5,6]. Several studies have been conducted for identification of fabric defects. Recent methods are based on the analysis of the spectrum. Fourier transformation has been commonly used for identification of defects [7]. Other methods are based on the Wavelet [8,9,10,11] and also find out the systematic reviews used in the existing methods [ 2,6]. Convolution Neural Network (CNN) was projected by [14] in 1980, LeCun [15] used the gradient-based method to Convolution Neural Network (CNN), it is mostly used in image recognition as a neural network to emulate the process of human brain processed visual images. With deep neural network, a lot of sample data and training time is required, to classify complex data, therefore it is less used. Parallel processing based on GPU has become prevalent and also the big data can be easily collected. So, again the Convolution Neural Network (CNN) has paying attention [16]. By applying it to natural language processing, Convolution Neural Network (CNN) shows improved performance [17]. Further, Speech recognition [18] and image processing [19] required large data with many classes. Convolution Neural Network (CNN) has shown strong identification performance, very few studies have been carried out in industrial applications such as detection of defects and surface inspection system. Many researchers such as Soukup [20] and Yao [21] used CNN for identification of defects, but Soukup et al. applied it to a specific form of surfaces such as steel defects from the photometric stereo system. The handcrafted picture features such as heat, variability, and entropy have been suggested by Yao et al. to boost pattern of defects. Yao's system [21], however, is not an end-to-end convolution network, but a neural cellular network for classification only. Over recent years, deep learning approaches have been gradually taken into account. In machine vision, it is also proven to be an increasingly important function. This paper is intended to explore the deep learning techniques (DNN) to identify the fabric defects. Aim is to address the above-mentioned challenges with a general design. Despite, numbers of categories of material, numerous state-of-the-art deep learning techniques are applied for the detection of different defect types and are applied and tested on TILDA dataset.

Defect Detection Method
The proposed scheme of detection as shown in Figure 2 is divided into two main parts. In this, dataset of labelled training defected and non-defected regions of images in an offline training mode are used. It extracts random patches of size s=nb, where n is the total no. of pixels. By extracting statistical features with tag y having value 1 and 0 or vice versa, if a patch is part of a defect field.
Single image patch is shown by a feature vector with defected tags (x, y), where X= {x (1) …, x (m) }, all the examples of m learning as line vectors. Further, all training examples X are used by the neural network classifier for learning a hypothesis (model) h (x) through the process of back propagation and also the training runs offline, therefore no runtime issues are occurred. Sliding window vice fashion is used to evaluate unknown examples without a label. The entire image is divided into size s overlapping frames where the s/2 overlap in x and y directions. The statistical characteristics derived from the trained version of NN and determines whether an object patch is either defected or non-defected. The algorithm categorizes images as defected, if found, in some cases, though defects are permitted. Therefore, non-maximum suppression technique is used. Figure 2 displays an overall Defect detection framework [22].

Feature Extraction
For the final results of classification, the collection of features that are derived from the raw images is used with the basic statistical features that are based on the grayscale values with the image patches to keep the interface simple. Figure 3 displays an overall system for template learning function.

Figure 3.
Learning procedure with patch extraction and feature representation [22] Number of patches p with size s is used for learning instead of using the whole image, as shown in Figure 2, In the first stage random patches are generated, in the second stage patch layoutis displayed, where each image patch shows a row vector and at last features are represented. Remember that (x i ,y i ) represents the i th example of learning with 1 and 0 for defected and non-defected pictures respectively. Before extracting patch features, basic normalization procedures are applied [15]. The result is a representation in a range of [ 0, 1] of the vectors of the training example. For image patch representations statistical features are computed on normalised patches and feature generation takes the training data X and output function f: N×N, Dmaps each single training example x(i)xx from N×N dimension to D dimension space. The value of D is a parameter of the framework that represents the number of statistical features. The central moment mk of order k of a grayscale image patch is calculated by statistical characteristics are calculated after the normalization to represent the image patch. The function generation takes the training data X and produced a function as follows: This function maps each individual training sample x (i) from N×N dimensions into a D-dimensional space. System parameter, D represents, number of statistical characteristics. Central moments from 2nd to 5th order is used in addition to features such as mean, median, and standard deviation. Calculation of central moment m k of order k of a gray object patch.
( ) Where, in E(x (i) ), x (i) is the expected value. Other moments describes the features called Hu-moments [16]. In the main fundamental moments, seven invariant properties of rotation are derivations and variations. In each training sample, the vector x (i) is the measurement of statistical image features of the raw image patches and reduces the feature dimension from N×N to D=15 and this is the final dimension of features and the input values for the training algorithm for the neural network.

CNN Construction
There is more than one layer of a neural network, with many nodes in each layer. Nodes in each layer combine in a weighted sum the output of the lower layer. Each layer abstracts function by weight cost, and also the relationship between the layers are represented by weight matrix. In equation (1), the output X n j between the layer 'n' and the layer 'n-1' is calculated and based upon the output X j n-1 of n-1 layer and weight w n ij between the two layers, θ n i is a bias of node I, and f is a sigmoid function. 1 ( ) Weights are trained with adequate data then the high-level characteristics of the higher layer can be extracted by combining the low-level characteristics of lower layer output. When information put in the lowest layer, it passes over the other layers, therefore abstraction of the features is slowly achieved, resulting in higher-level choice of features. As a result, more high-level features are derived with more layers, and classification efficiency also increases.  (4) : Where Equations (4) and (5) are the convolution layer and pooling layer calculation method, respectively. In the case of Equations (4) and (5), m is the width of the mask and refers to the number of input nodes used in output node calculation. With contrast to the FC layer, convolution layers learn the mask values of image. Node in a layer of convolution is connected to a lower layer of the image window and also the nodes share the similar weights with each other, i.e. edges of the connection between the layers perform in the same way as the convolution of image processing.

Figure 5. Architecture of Neural Network
The edge weight at this point is the mask of the image. A fixed value mask is used in image processing, nevertheless in convolution neural network, the mask value is trained from the data sample automatically as shown in Figure 5. Nodes in the pooling layer of the output of convolution layer are called the max pooling operation that pick the max value in the small window. It absorbs position errors because peak pooling lacks minor changes in the location of features. In other words, a good quest on the scale can be carried out by keeping features well-expressed by taking more number of values and reduced image size. Classification quality improves slowly through several layers of pooling, and classes are defined in the layers of the FC.

Training of CNN
CNN learn optimal weights from all the layers in the training steps. First, training the sample consist of Ik (k-1,2,3,... m) images and vector ck class label. If Ik belongs to the I group then there is 1 and there are 0 other elements. CNN's feed-forward process estimates Ik's class vector and has probability distribution elements through Equation (6). This means that when CNN is taught, and ck should be close to each other. Functions loss minimization is as follows.
Where Equation (7) is called the variable SoftMax. The function SoftMax produces a uniform exponential distribution from last FC layer output nodes. In the Equation (7), implies an approximate vector of rank. Consequently, the Equation (6) loss function increases when there is a big difference between ck and ck. To the contrary, Equation (7) decreases when there is a small difference between ck and ck. CNN has many layers that are covered and from the final convolution layer loss is backpropagated towards the first convolution layer for learning all the weights used in the layers. A good batch gradient, commonly used for neural network learning, can propagate a chain rule error. Therefore, we use a respectable batch gradient algorithm to train the CNN.

Learning Defect Classifier
The marked training data to use backpropagation to train a neural network. An example of a structure of a neural network is shown in Figure 2 Classification of the function. Layer size of the of input is equivalent to the measurement of the function, k=15. The second layer is a secret layer and have L1 nodes. All the nodes of secret layer are mapped in the output layer as the final node and it displays the product of the classification. In neural network, random numbers initialize to all weights. Training a network involves optimizing the performance of network detection. This is done by reducing the role of efficiency [20]. Minimization of MSE was used because for best performance. Also, the MSE measures the average square error between the layer 2 of network output and the train the labels. MSE is: It generates the weight matrix W and b i.e. the additional biases after learning. The size of the weight matrix is D×L1 and the vector of bias is b1× L1. It is possible to identify any unknown instance by measuring the h(x) function hypotheses.

( ) g(W )
x h x b = + The sigmoidal function applied and the final result of the classification is between 0 and 1 and also determines whether or not an unidentified object patch includes areas of defect.

Experimental Analysis
TILDA dataset containing six classes of 150 defected and 1000 non-defected images, each with size 512px from 5512px.In many cases, even with human eyes, it is difficult to detect the defective region. For each training instance, the dataset provides poor labels for marking the defects. This means that a tag region not only contains defect pixels, but also a lot of background pixels that makes it difficult to differentiate defects from non-defected groups. A comparative investigation by using the modified CNN on the traditional neural network. First experiment was conducted separately to evaluate the robustness of the six surface types, and the second experiment was conducted simultaneously to train and compare more than two different types of surfaces. Through cross testing, the average error rate was estimated. The findings of these studies are shown in Figures 6 and 7.It also displays low-contrast defects with the most reliable results of inspection of defects. Nevertheless, there is less precision on the different surfaces, though the backgrounds were barely divergent the defects due to complex surface textures and also another experiment was showed on the six categories, in these two or more types of surface were mixed together and as a result classification was improved for both the approaches.

Conclusions
For machine vision systems, surface inspection is a growing feature. Neural network architecture is used for image patch generation randomly for representations of statistical features to detect defects. Also, deep network models are used to handle the general problem of fabric classification. Results are evaluated by using different parameter shows better results in identification of defects and tested on TILDA database. In contrast, the technique is extended to a method of cold formation. Through creating a design learning hierarchy, this approach deals with various types of textures. Experimental results have been presented and discussed. The accuracies in the tests are not yet high at the moment, as few basic pre-processing tasks have been applied to the training data. In another subject of development, this will be studied extensively. In future research focus is to compare other learning algorithms such as SVM or other similar approaches.