Knitted fabric broken yarn defect detection system and method based on artificial intelligence
By constructing and utilizing a diverse data set of knitted fabrics, EfficientNet neural network is pre-trained, and combined with the domain classifier and loss function, the problem of insufficient data volume and low accuracy in the detection of yarn breaking defects of knitted fabrics is solved, and the data volume and accuracy of knitted fabrics is not high, so as to achieve Higher detection accuracy and robustness.
Patent Information
- Application Number
- CN202411539045.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art has problems of insufficient data volume and low accuracy in the detection of yarn breaking defects in knitted fabrics, especially in the case of high sample diversity and complexity, and the performance of the model is limited.
By constructing the source domain dataset and pre-training the EfficientNet neural network, the target domain dataset is obtained and feature extraction is performed, and the domain classifier and the designed loss function are used to alternately update, improving the detection accuracy and robustness of the model.
The accuracy and robustness of the detection of yarn breaking defects in knitted fabrics is improved, and the model's ability to identify different types of defects and the adaptability of the domain to different fields is enhanced, which reduces detection time and improves production efficiency.
Smart Images

Figure CN119399543A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of textile fabrics, and in particular to a knitted fabric yarn break defect detection system and method based on artificial intelligence. Background Art
[0002] In the modern textile industry, knitted fabrics are widely used in many fields such as clothing, home textiles and industrial products due to their comfort and diversity. However, during the production process, knitted fabrics often have various defects due to raw materials, equipment failure or human error. Among them, yarn breakage is a common and serious quality problem, which will lead to reduced fabric strength and poor appearance, thus affecting the market competitiveness and customer satisfaction of the final product. Timely detection and repair of knitted fabrics with yarn breakage defects can reduce losses and improve customer satisfaction. At the same time, automated defect detection can effectively reduce the need for manual inspection, thereby reducing production costs and improving production efficiency.
[0003] Traditional methods for detecting broken yarn defects in knitted fabrics mostly rely on manual visual inspection and simple mechanical inspection, which has certain limitations. Manual inspection is time-consuming and easily affected by subjective factors, resulting in missed inspections or misjudgments. In addition, the speed of manual inspection cannot meet the needs of large-scale production, and simple mechanical inspection is not enough to meet actual needs in identifying complex defects. These traditional methods cannot meet the requirements of the modern textile industry for high quality and high efficiency, resulting in insufficient detection accuracy and timeliness.
[0004] Existing technologies have introduced deep learning and computer vision technologies in the detection of broken yarn defects in knitted fabrics. By using deep learning models such as convolutional neural networks, image features can be automatically extracted and defects can be classified. Although this technology has significant advantages in improving detection efficiency and accuracy, it still faces the problems of insufficient data volume and low accuracy, especially when the sample diversity and complexity are high, the performance of the model is limited.
[0005] Therefore, a knitted fabric yarn break defect detection system and method based on artificial intelligence is proposed. Summary of the invention
[0006] The object of the present invention is to provide a knitted fabric broken yarn defect detection system and method based on artificial intelligence, which is used to solve the problem of insufficient knitted fabric image data and further improve the accuracy of defect detection. First, knitted fabric images with broken yarn defects are collected, the clarity level of the knitted fabric images is calculated, the knitted fabric images whose clarity level does not reach the threshold are removed, and the target domain data set is constructed. Then, different knitted fabric defect images and labels are obtained to construct the source domain data set; the EfficientNet neural network is pre-trained using the source domain data set, and the source domain features are obtained; the target domain data set is input into the pre-trained EfficientNet neural network to obtain the target domain features. Secondly, a domain label is created, using a unique hot encoding form; the source domain features and the target domain features are passed to the domain classifier, and the domain label vector is output. Then, a defect detection loss function is designed, including a classification loss term, a domain adversarial loss term, and a feature alignment loss term; each loss term is weighted to form the final defect detection loss function. Finally, the EfficientNet neural network and the domain classifier are updated alternately; the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through the softmax layer.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] A knitted fabric yarn break defect detection system based on artificial intelligence, comprising:
[0009] A data set construction unit collects knitted fabric images with broken yarn defects, calculates the clarity level of the knitted fabric images, removes the knitted fabric images whose clarity level does not reach a threshold, and constructs a target domain data set;
[0010] A feature extraction unit is used to obtain defect images and labels of different knitted fabrics and construct a source domain data set; the source domain data set is used to pre-train the EfficientNet neural network and obtain source domain features; the target domain data set is input into the pre-trained EfficientNet neural network to obtain target domain features;
[0011] A domain classification unit creates a domain label using one-hot encoding; transmits the source domain feature and the target domain feature to a domain classifier, and outputs a domain label vector;
[0012] A loss function design unit designs a defect detection loss function, including a classification loss term, a domain adversarial loss term, and a feature alignment loss term; each loss term is weighted to form the final defect detection loss function;
[0013] The defect judgment unit, the EfficientNet neural network and the domain classifier are updated alternately; finally, the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through the softmax layer.
[0014] Furthermore, the knitted fabric image includes different colors, textures and defect types; the clarity level of the knitted fabric image is calculated using the Laplace operator, and the calculation formula of the Laplace operator is:
[0015]
[0016] Wherein, I represents the input image; (x, y) represents the pixel position in the knitted fabric image;
[0017] Based on the output of the Laplace operator, the variance is calculated:
[0018]
[0019] Wherein, Var() represents the variance of the output result; L i represents the Laplace value of each pixel in the i-th knitted fabric image; μ represents the mean of the Laplace values; N represents the total number of pixels;
[0020] Var(L) is taken as the clarity level of the i-th knitted fabric image; the threshold is set as σ threshold , keep the condition Var(L)>σ threshold The knitted fabric images are discarded if they satisfy the condition Var(L)≤σ threshold The knitted fabric image dataset is constructed by using the knitted fabric image of the knitted fabric.
[0021] Further, the different knitted fabric defect images include knitted fabric tear images, knitted fabric stain images, knitted fabric skipped stitch images and knitted fabric yarn kink images;
[0022] The source domain features and the target domain features include texture, color, shape and structure information of the images in the source domain dataset and the target domain dataset respectively, and also include high-level semantic information related to the defects, which describes the unique attributes of the defect area.
[0023] Furthermore, the domain label value of the source domain is 0, and the domain label value of the target domain is 1;
[0024] The domain classifier includes an input layer, multiple fully connected layers, a Dropout layer and a Softmax output layer; the domain classifier reads the source domain features and the target domain features, and outputs a probability distribution, which represents the predicted probability of the domain classifier for the domain source of the input features.
[0025] Furthermore, the images in the source domain dataset and the target domain dataset are respectively denoted as X s and X t The source domain feature and the target domain feature are respectively denoted as f(X s ) and f(X t ); the probability distribution of the domain classifier output is recorded as (Source, Target), where Source and Target represent the probability that the domain classifier predicts the input feature domain source as the source domain and the target domain, respectively;
[0026] The classification loss term L cls Use the cross entropy loss function for optimizing the EfficientNet neural network. The formula is:
[0027]
[0028] in, represents the true label of image i in the source domain dataset; N represents the prediction probability of the EfficientNet neural network for the image i in the source domain dataset; s represents the number of images in the source domain dataset; K represents the number of categories;
[0029] The domain adversarial loss term L adv It is used to optimize the domain classifier and update the network parameters of the EfficientNet neural network through reverse gradient; the formula of the domain adversarial loss term is:
[0030]
[0031] Among them, d i Indicates the domain label value; N t Represents the number of images in the target domain dataset;
[0032] The feature alignment loss term L MMD To measure the difference in feature distribution between two fields, the formula is:
[0033]
[0034] in, Represents the source domain feature corresponding to the image i in the source domain dataset; Represents the target domain feature corresponding to the image j in the target domain dataset;
[0035] The classification loss term, the domain adversarial loss term and the feature alignment loss term are weighted and summed to form the final defect detection loss function:
[0036] L=L cls +αL adv +βL MMD ;
[0037] Among them, α and β are weight parameters of the domain adversarial loss term and the feature alignment loss term.
[0038] A method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence, comprising:
[0039] Collect knitted fabric images with broken yarn defects, calculate the clarity level of the knitted fabric images, remove the knitted fabric images whose clarity level does not reach a threshold, and construct a target domain data set;
[0040] Obtain defect images and labels of different knitted fabrics to construct a source domain data set; use the source domain data set to pre-train the EfficientNet neural network and obtain source domain features; input the target domain data set into the pre-trained EfficientNet neural network to obtain target domain features;
[0041] Create a domain label using one-hot encoding; pass the source domain feature and the target domain feature to a domain classifier, and output a domain label vector;
[0042] Designing a defect detection loss function, including a classification loss term, a domain adversarial loss term, and a feature alignment loss term; each loss term is weighted to form the final defect detection loss function;
[0043] The EfficientNet neural network and the domain classifier are updated alternately; finally, the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through the softmax layer.
[0044] Furthermore, the knitted fabric image includes different colors, textures and defect types; the clarity level of the knitted fabric image is calculated using the Laplace operator, and the calculation formula of the Laplace operator is:
[0045]
[0046] Wherein, I represents the input image; (x, y) represents the pixel position in the knitted fabric image;
[0047] Based on the output of the Laplace operator, the variance is calculated:
[0048]
[0049] Wherein, Var() represents the variance of the output result; L i represents the Laplace value of each pixel in the i-th knitted fabric image; μ represents the mean of the Laplace values; N represents the total number of pixels;
[0050] Var(L) is taken as the clarity level of the i-th knitted fabric image; the threshold is set as σ threshold , keep the condition Var(L)>σ threshold The knitted fabric images are discarded if they satisfy the condition Var(L)≤σ threshold The knitted fabric image dataset is constructed by using the knitted fabric image of the knitted fabric.
[0051] Further, the different knitted fabric defect images include knitted fabric tear images, knitted fabric stain images, knitted fabric skipped stitch images and knitted fabric yarn kink images;
[0052] The source domain features and the target domain features include texture, color, shape and structure information of the images in the source domain dataset and the target domain dataset respectively, and also include high-level semantic information related to the defects, which describes the unique attributes of the defect area.
[0053] Furthermore, the domain label value of the source domain is 0, and the domain label value of the target domain is 1;
[0054] The domain classifier includes an input layer, multiple fully connected layers, a Dropout layer and a Softmax output layer; the domain classifier reads the source domain features and the target domain features, and outputs a probability distribution, which represents the predicted probability of the domain classifier for the domain source of the input features.
[0055] Furthermore, the images in the source domain dataset and the target domain dataset are respectively denoted as X s and X t The source domain feature and the target domain feature are respectively denoted as f(X s ) and f(X t ); the probability distribution of the domain classifier output is recorded as (Source, Target), where Source and Target represent the probability that the domain classifier predicts the input feature domain source as the source domain and the target domain, respectively;
[0056] The classification loss term L cls Use the cross entropy loss function for optimizing the EfficientNet neural network. The formula is:
[0057]
[0058] in, represents the true label of image i in the source domain dataset; N represents the prediction probability of the EfficientNet neural network for the image i in the source domain dataset; s represents the number of images in the source domain dataset; K represents the number of categories;
[0059] The domain adversarial loss term L adv It is used to optimize the domain classifier and update the network parameters of the EfficientNet neural network through reverse gradient; the formula of the domain adversarial loss term is:
[0060]
[0061] Among them, d i Indicates the domain label value; N t Represents the number of images in the target domain dataset;
[0062] The feature alignment loss term L MMD To measure the difference in feature distribution between two fields, the formula is:
[0063]
[0064] in, Represents the source domain feature corresponding to the image i in the source domain dataset; Represents the target domain feature corresponding to the image j in the target domain dataset;
[0065] The classification loss term, the domain adversarial loss term and the feature alignment loss term are weighted and summed to form the final defect detection loss function:
[0066] L=L cls +αL adv +βL MMD ;
[0067] Among them, α and β are weight parameters of the domain adversarial loss term and the feature alignment loss term.
[0068] Compared with the prior art, the present invention has the following beneficial effects:
[0069] 1. The present invention lays an important foundation for the detection of broken yarn defects in knitted fabrics by constructing a source domain dataset and pre-training the EfficientNet neural network. First, the network can learn rich feature representations using a variety of defect images and labels, enhancing its ability to recognize different types of defects. The pre-trained EfficientNet not only improves the accuracy of feature extraction, but also shortens the training time of the target domain model. Secondly, inputting the target domain dataset into the pre-trained model helps to achieve transfer learning, so that the model can more effectively adapt to specific defect detection tasks. This process can improve the accuracy and robustness of the defect detection system.
[0070] 2. The present invention creates domain labels and uses unique hot encoding. This process can ensure that the source domain features and the target domain features can accurately correspond to each other, thereby enhancing the learning ability of the domain classifier. By passing the features of both to the domain classifier, the system can better identify different types of defects and their sources, and improve the model's adaptability to differences between domains. In addition, this clear label representation lays the foundation for the subsequent loss function calculation, which can further optimize the detection effect.
[0071] 3. The defect detection loss function designed by the present invention helps to comprehensively improve the defect detection performance of the model by combining classification loss terms, domain adversarial loss terms and feature alignment loss terms. The classification loss term ensures the accuracy of the model in identifying the type of broken yarn defects and improves the classification effect; the domain adversarial loss term allows the source domain features and the target domain features to maintain consistency in the feature space, reduces the deviation between domains, and can enhance the adaptability of the model in different domains; the feature alignment loss term can promote feature alignment and ensure that the features extracted during the training process have stronger transferability. By weighted combination of these loss terms, the final loss function provides a more detailed optimization direction for the model, which can significantly improve the accuracy and robustness of broken yarn defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 This is a system structure diagram of a knitted fabric yarn break defect detection system based on artificial intelligence of the present invention;
[0073] Figure 2 A schematic diagram of a set of clear and blurred images of the present invention;
[0074] Figure 3 It is a structural schematic diagram of the domain classifier of the present invention;
[0075] Figure 4 The present invention is a method flow chart of a method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0077] In order to solve the problem of insufficient knitted fabric image data and further improve the accuracy of defect detection, the present invention provides a knitted fabric broken yarn defect detection system and method based on artificial intelligence. In order to illustrate the function of the present invention, the effectiveness of the present invention will be illustrated from the following examples.
[0078] Embodiment 1
[0079] In order to improve the production efficiency and product quality of clothing, a textile and clothing industry A used an artificial intelligence-based knitted fabric yarn break defect detection system to quickly and accurately detect yarn break defects in fabrics. Figure 1 , which is a system structure diagram of a knitted fabric yarn break defect detection system based on artificial intelligence.
[0080] Reference Figure 1 , a knitted fabric yarn break defect detection system based on artificial intelligence, including a data set construction unit, which collects knitted fabric images with yarn break defects, calculates the clarity level of the knitted fabric images, removes the knitted fabric images whose clarity level does not reach a threshold, and constructs a target field data set.
[0081] Specifically, the knitted fabric image includes different colors, textures and defect types; the clarity level of the knitted fabric image is calculated using the Laplace operator, and the calculation formula of the Laplace operator is:
[0082]
[0083] Wherein, I represents the input image; (x, y) represents the pixel position in the knitted fabric image;
[0084] Based on the output of the Laplace operator, the variance is calculated:
[0085]
[0086] Wherein, Var() represents the variance of the output result; L i represents the Laplace value of each pixel in the i-th knitted fabric image; μ represents the mean of the Laplace values; N represents the total number of pixels;
[0087] Var(L) is taken as the clarity level of the i-th knitted fabric image; the threshold is set as σ threshold , keep the condition Var(L)>σ threshold The knitted fabric images are discarded if they satisfy the condition Var(L)≤σ threshold The knitted fabric image dataset is constructed by using the knitted fabric image of the knitted fabric.
[0088] In this embodiment, the threshold σ is set threshold is 150, if the variance Var() of the image is greater than σ threshold , then it is a clear image. If it is less than σ threshold , then it is a blurred image. Figure 2 As shown, a set of clear and blurred images are displayed.
[0089] By collecting images of knitted fabrics with broken yarn defects and calculating their clarity levels, it helps to remove low-quality images and thus construct a high-quality target domain dataset. This process ensures the validity of subsequent training data.
[0090] Reference Figure 1 , a knitted fabric broken yarn defect detection system based on artificial intelligence, also includes a feature extraction unit, which obtains different knitted fabric defect images and labels to construct a source domain data set; uses the source domain data set to pre-train an EfficientNet neural network and obtain source domain features; and inputs the target domain data set into the pre-trained EfficientNet neural network to obtain target domain features.
[0091] Specifically, different knitted fabric defect images include knitted fabric torn images, knitted fabric stain images, knitted fabric skipped stitch images and knitted fabric yarn kink images; these images all have corresponding good defect label images.
[0092] The source domain features and the target domain features include texture, color, shape and structure information of the images in the source domain dataset and the target domain dataset respectively, and also include high-level semantic information related to the defects, which describes the unique attributes of the defect area.
[0093] By constructing the source domain dataset and pre-training the EfficientNet neural network, the model can effectively extract the features of different knitted fabric defects and has the ability to preliminarily identify defects. Collecting other knitted fabric defect images can solve the problem of small amount of knitted fabric broken yarn defect image data. This process lays the foundation for learning the target domain features.
[0094] Reference Figure 1, a knitted fabric broken yarn defect detection system based on artificial intelligence, also includes a domain classification unit, creates a domain label, uses a one-hot encoding form; passes the source domain feature and the target domain feature to the domain classifier, and outputs a domain label vector.
[0095] Specifically, the domain label value of the source domain is 0, and the domain label value of the target domain is 1;
[0096] The domain classifier includes an input layer, multiple fully connected layers, a Dropout layer and a Softmax output layer. The structural diagram of the domain classifier is shown in Figure 3 As shown in the figure. The input layer receives a combination of source domain features and target domain features, which is usually a high-dimensional feature vector with a feature dimension of 256, containing feature components related to specific defects in the defect image; the number of nodes in the first fully connected layer is 128, followed by the ReLU activation function; the first Dropout ratio is 0.3; the number of nodes in the second fully connected layer is 64, followed by the ReLU activation function; the second Dropout ratio is 0.3; the number of nodes in the third fully connected layer is 32, followed by the ReLU activation function; the number of nodes in the Softmax output layer is 2.
[0097] The domain classifier reads the source domain features and the target domain features, and outputs a probability distribution representing the predicted probability of the domain classifier for the domain source of the input features.
[0098] Building a domain classifier helps the model to more effectively identify and classify features of different domains, enhances the model's ability to adapt to differences between domains, and provides a more accurate feature representation for the final classification.
[0099] Reference Figure 1 , a knitted fabric broken yarn defect detection system based on artificial intelligence, also includes a loss function design unit, which designs a defect detection loss function, including a classification loss term, a domain adversarial loss term and a feature alignment loss term; each loss term is weighted to form the final defect detection loss function.
[0100] Specifically, the images in the source domain dataset and the target domain dataset are respectively denoted as X s and X t The source domain feature and the target domain feature are respectively denoted as f(X s ) and f(X t ); the probability distribution of the domain classifier output is recorded as (Source, Target), where Source and Target represent the probability that the domain classifier predicts the input feature domain source as the source domain and the target domain, respectively;
[0101] The classification loss term Lcls Use the cross entropy loss function for optimizing the EfficientNet neural network. The formula is:
[0102]
[0103] in, represents the true label of image i in the source domain dataset; N represents the prediction probability of the EfficientNet neural network for the image i in the source domain dataset; s represents the number of images in the source domain dataset; K represents the number of categories;
[0104] The domain adversarial loss term L adv It is used to optimize the domain classifier and update the network parameters of the EfficientNet neural network through reverse gradient; the formula of the domain adversarial loss term is:
[0105]
[0106] Among them, d i Indicates the domain label value; N t Represents the number of images in the target domain dataset;
[0107] The feature alignment loss term L MMD To measure the difference in feature distribution between two fields, the formula is:
[0108]
[0109] in, Represents the source domain feature corresponding to the image i in the source domain dataset; Represents the target domain feature corresponding to the image j in the target domain dataset;
[0110] The classification loss term, the domain adversarial loss term and the feature alignment loss term are weighted and summed to form the final defect detection loss function:
[0111] L=L cls +αL adv +βL MMD ;
[0112] Among them, α and β are weight parameters of the domain adversarial loss term and the feature alignment loss term.
[0113] By designing the defect detection loss function, including classification loss term, domain adversarial loss term and feature alignment loss term, different task objectives can be effectively balanced, and the weighted combination of these three loss terms helps to optimize the learning process of the model and improve the detection accuracy and robustness of broken yarn defects.
[0114] Reference Figure 1 , a knitted fabric broken yarn defect detection system based on artificial intelligence, also includes a defect judgment unit, the EfficientNet neural network and the domain classifier are updated alternately; finally, the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through a softmax layer.
[0115] Specifically, the specific contents of the alternating update are:
[0116] First, initialize the parameters of the EfficientNet neural network and domain classifier;
[0117] Then, forward propagation is performed to input the target domain dataset into the pre-trained EfficientNet neural network and calculate the output features, which will be fed into the domain classifier to obtain domain label predictions.
[0118] Next, the loss is calculated using the defect detection loss function, and the defect detection loss function is back-propagated to update the parameters of the EfficientNet neural network and the domain classifier respectively. Among them, only the parameters of one of the networks are updated in one update. For example, when updating the network parameters of EfficientNet, the parameters of the domain classifier are fixed to minimize the total loss; when updating the network parameters of the domain classifier, the parameters of EfficientNet are fixed to minimize the total loss.
[0119] Finally, the performance of EfficientNet and the domain classifier is gradually optimized by alternating forward propagation, loss calculation, and backpropagation steps multiple times. This process is repeated in multiple epochs until the specified number of training rounds is reached or the loss converges.
[0120] Since EfficientNet and domain classifiers can focus on their respective optimization objectives, they can promote feature alignment and domain adaptability, thereby effectively improving the learning ability of the model.
[0121] In order to verify the effectiveness of the artificial intelligence-based knitted fabric broken yarn defect detection system used in this embodiment, the system is compared with Faster R-CNN, CNN and multimodal learning methods, using the indicators of accuracy, precision, recall and processing time. The results of the comparative experiment are shown in Table 1.
[0122] Table 1 Comparative experimental results
[0123] method Accuracy Accuracy Recall Processing time This embodiment uses the system 95.59 94.84 96.25 0.25 Faster R-CNN 92.30 90.57 93.04 0.45 CNN 95.15 87.07 95.59 0.40 Multimodal learning methods 91.27 92.78 92.11 0.58
[0124] It can be seen from Table 1 that the artificial intelligence-based knitted fabric broken yarn defect detection system used in this embodiment is superior to other methods in all evaluation indicators, indicating that it has significant advantages in broken yarn defect detection.
[0125] The artificial intelligence-based knitted fabric broken yarn defect detection system used in this embodiment overcomes the problem of insufficient data volume and improves the detection accuracy by effectively utilizing the data sets of the source and target fields. The pre-trained EfficientNet neural network enhances the feature extraction capability, and the domain classifier optimizes the output of the domain label to ensure higher classification accuracy. The designed loss function comprehensively considers the classification and adversarial losses, promotes feature alignment, and further improves the robustness and generalization ability of the model, thereby effectively improving the detection performance of broken yarn defects.
[0126] Embodiment 2
[0127] In order to ensure the quality of clothing products, reduce the return rate and improve customer experience, a certain clothing e-commerce manufacturer B needs to screen out clothing with broken yarn defects. The manufacturer uses an artificial intelligence-based knitted fabric broken yarn defect detection method. Figure 4 A method flow chart of a method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence is presented.
[0128] Reference Figure 4 In step S01, knitted fabric images with broken yarn defects are collected, the clarity levels of the knitted fabric images are calculated, the knitted fabric images whose clarity levels do not reach a threshold are removed, and a target domain data set is constructed.
[0129] In this embodiment, the threshold σ is set threshold is 100, if the variance Var() of the image is greater than σ threshold , then it is a clear image. If it is less than σ threshold , then it is a blurred image.
[0130] Specifically, the knitted fabric image includes different colors, textures and defect types; the clarity level of the knitted fabric image is calculated using the Laplace operator, and the calculation formula of the Laplace operator is:
[0131]
[0132] Wherein, I represents the input image; (x, y) represents the pixel position in the knitted fabric image;
[0133] Based on the output of the Laplace operator, the variance is calculated:
[0134]
[0135] Wherein, Var() represents the variance of the output result; L i represents the Laplace value of each pixel in the i-th knitted fabric image; μ represents the mean of the Laplace values; N represents the total number of pixels;
[0136] Var(L) is taken as the clarity level of the i-th knitted fabric image; the threshold is set as σ threshold , keep the condition Var(L)>σ threshold The knitted fabric images are discarded if they satisfy the condition Var(L)≤σ threshold The knitted fabric image dataset is constructed by using the knitted fabric image of the knitted fabric.
[0137] Reference Figure 4 In step S02, different knitted fabric defect images and labels are obtained to construct a source domain data set; the source domain data set is used to pre-train the EfficientNet neural network and obtain source domain features; the target domain data set is input into the pre-trained EfficientNet neural network to obtain target domain features.
[0138] Specifically, different knitted fabric defect images include knitted fabric tear images, knitted fabric stain images, knitted fabric skipped stitch images, and knitted fabric yarn kink images;
[0139] The source domain features and the target domain features include texture, color, shape and structure information of the images in the source domain dataset and the target domain dataset respectively, and also include high-level semantic information related to the defects, which describes the unique attributes of the defect area.
[0140] Reference Figure 4 In step S03, a domain label is created using one-hot encoding; the source domain features and the target domain features are passed to the domain classifier, and a domain label vector is output.
[0141] Specifically, the domain label value of the source domain is 0, and the domain label value of the target domain is 1;
[0142] The domain classifier includes an input layer, multiple fully connected layers, a Dropout layer, and a Softmax output layer. The input layer receives a combination of source domain features and target domain features, which is usually a high-dimensional feature vector with a feature dimension of 256, and contains feature components related to specific defects in the defect image; the number of nodes in the first fully connected layer is 128, followed by a ReLU activation function; the first Dropout ratio is 0.3; the number of nodes in the second fully connected layer is 64, followed by a ReLU activation function; the second Dropout ratio is 0.3; the number of nodes in the third fully connected layer is 32, followed by a ReLU activation function; and the number of nodes in the Softmax output layer is 2.
[0143] The domain classifier reads the source domain features and the target domain features, and outputs a probability distribution representing the predicted probability of the domain classifier for the domain source of the input features.
[0144] Reference Figure 4 In step S04, a defect detection loss function is designed, including a classification loss term, a domain adversarial loss term, and a feature alignment loss term.
[0145] Specifically, the images in the source domain dataset and the target domain dataset are respectively denoted as X s and X t The source domain feature and the target domain feature are respectively denoted as f(X s ) and f(X t ); the probability distribution of the domain classifier output is recorded as (Source, Target), where Source and Target represent the probability that the domain classifier predicts the input feature domain source as the source domain and the target domain, respectively;
[0146] The classification loss term L cls Use the cross entropy loss function for optimizing the EfficientNet neural network. The formula is:
[0147]
[0148] in, represents the true label of image i in the source domain dataset; N represents the prediction probability of the EfficientNet neural network for the image i in the source domain dataset; s represents the number of images in the source domain dataset; K represents the number of categories;
[0149] The domain adversarial loss term L advIt is used to optimize the domain classifier and update the network parameters of the EfficientNet neural network through reverse gradient; the formula of the domain adversarial loss term is:
[0150]
[0151] Among them, d i Indicates the domain label value; N t Represents the number of images in the target domain dataset;
[0152] The feature alignment loss term L MMD To measure the difference in feature distribution between two fields, the formula is:
[0153]
[0154] in, Represents the source domain feature corresponding to the image i in the source domain dataset; Represents the target domain feature corresponding to the image j in the target domain dataset;
[0155] The classification loss term, the domain adversarial loss term and the feature alignment loss term are weighted and summed to form the final defect detection loss function:
[0156] L=L cls +αL adv +βL MMD ;
[0157] Among them, α and β are weight parameters of the domain adversarial loss term and the feature alignment loss term.
[0158] Reference Figure 4 In step S05, the EfficientNet neural network and the domain classifier are updated alternately; the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through the softmax layer.
[0159] Specifically, the specific contents of the alternating update are:
[0160] First, initialize the parameters of the EfficientNet neural network and domain classifier;
[0161] Then, forward propagation is performed to input the target domain dataset into the pre-trained EfficientNet neural network and calculate the output features, which will be fed into the domain classifier to obtain domain label predictions.
[0162] Next, the loss is calculated using the defect detection loss function, and the defect detection loss function is back-propagated to update the parameters of the EfficientNet neural network and the domain classifier respectively. Among them, only the parameters of one of the networks are updated in one update. For example, when updating the network parameters of EfficientNet, the parameters of the domain classifier are fixed to minimize the total loss; when updating the network parameters of the domain classifier, the parameters of EfficientNet are fixed to minimize the total loss.
[0163] Finally, the performance of EfficientNet and the domain classifier is gradually optimized by alternating forward propagation, loss calculation, and backpropagation steps multiple times. This process is repeated in multiple epochs until the specified number of training rounds is reached or the loss converges.
[0164] In order to verify the effectiveness of the artificial intelligence-based knitted fabric broken yarn defect detection method used in this embodiment, the system is compared with SSD, Mask R-CNN and EfficientDet, using the indicators of accuracy, precision, recall and processing time. The results of the comparative experiment are shown in Table 2.
[0165] Table 2 Comparative experimental results
[0166] method Accuracy Accuracy Recall Processing time Method of using this embodiment 96.47 94.32 97.22 0.35 SSD 90.28 88.18 91.58 0.45 MaskR-CNN 92.80 90.45 93.62 0.55 EfficientDet 94.10 92.27 94.80 0.50
[0167] It can be seen from Table 2 that the artificial intelligence-based knitted fabric broken yarn defect detection method used in this embodiment performs best in accuracy, precision, recall rate and processing time, and can ensure the efficiency of detecting the quality of clothing products.
[0168] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A knitted fabric yarn breakage defect detection system based on artificial intelligence, characterized in that: include: A data set construction unit collects knitted fabric images with broken yarn defects, calculates the clarity level of the knitted fabric images, removes the knitted fabric images whose clarity level does not reach a threshold, and constructs a target domain data set; A feature extraction unit obtains defect images and labels of different knitted fabrics and constructs a source domain data set; uses the source domain data set to pre-train the EfficientNet neural network and obtain source domain features; Inputting the target domain data set into the pre-trained EfficientNet neural network to obtain target domain features; A domain classification unit creates a domain label using one-hot encoding; transmits the source domain feature and the target domain feature to a domain classifier, and outputs a domain label vector; A loss function design unit designs a defect detection loss function, including a classification loss term, a domain adversarial loss term, and a feature alignment loss term; each loss term is weighted to form the final defect detection loss function; The defect judgment unit, the EfficientNet neural network and the domain classifier are updated alternately; finally, the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through the softmax layer.
2. The artificial intelligence-based knitted fabric yarn breakage defect detection system according to claim 1 is characterized in that: The knitted fabric image includes different colors, textures and defect types; the clarity level of the knitted fabric image is calculated using the Laplace operator, and the calculation formula of the Laplace operator is: Wherein, I represents the input image; (x, y) represents the pixel position in the knitted fabric image; Based on the output of the Laplace operator, the variance is calculated: Wherein, Var() represents the variance of the output result; L i represents the Laplace value of each pixel in the i-th knitted fabric image; μ represents the mean of the Laplace values; N represents the total number of pixels; Var(L) is taken as the clarity level of the i-th knitted fabric image; the threshold is set as σ threshold , keep the condition Var(L)>σ threshold The knitted fabric images are discarded if they satisfy the condition Var(L)≤σ threshold The knitted fabric image dataset is constructed by using the knitted fabric image of the knitted fabric.
3. The artificial intelligence-based knitted fabric yarn breakage defect detection system according to claim 1, characterized in that: Different knitted fabric defect images include knitted fabric tear images, knitted fabric stain images, knitted fabric skipped stitch images and knitted fabric yarn kink images; The source domain features and the target domain features include texture, color, shape and structure information of the images in the source domain dataset and the target domain dataset respectively, and also include high-level semantic information related to the defects, which describes the unique attributes of the defect area.
4. The artificial intelligence-based knitted fabric yarn breakage defect detection system according to claim 1, characterized in that: The domain label value of the source domain is 0, and the domain label value of the target domain is 1; The domain classifier includes an input layer, multiple fully connected layers, a Dropout layer and a Softmax output layer; the domain classifier reads the source domain features and the target domain features, and outputs a probability distribution, which represents the predicted probability of the domain classifier for the domain source of the input features.
5. The artificial intelligence-based knitted fabric yarn breakage defect detection system according to claim 1, characterized in that: The images in the source domain dataset and the target domain dataset are respectively denoted as X s and X t The source domain feature and the target domain feature are respectively denoted as f(X s ) and f(X t ); the probability distribution of the domain classifier output is recorded as (Source, Target), where Source and Target represent the probability that the domain classifier predicts the input feature domain source as the source domain and the target domain, respectively; The classification loss term L cls Use the cross entropy loss function for optimizing the EfficientNet neural network. The formula is: in, represents the true label of image i in the source domain dataset; N represents the prediction probability of the EfficientNet neural network for the image i in the source domain dataset; s represents the number of images in the source domain dataset; K represents the number of categories; The domain adversarial loss term L adv It is used to optimize the domain classifier and update the network parameters of the EfficientNet neural network through reverse gradient; the formula of the domain adversarial loss term is: Among them, d i Indicates the domain label value; N t Represents the number of images in the target domain dataset; The feature alignment loss term L MMD To measure the difference in feature distribution between two fields, the formula is: in, Represents the source domain feature corresponding to the image i in the source domain dataset; Represents the target domain feature corresponding to the image j in the target domain dataset; The classification loss term, the domain adversarial loss term and the feature alignment loss term are weighted and summed to form the final defect detection loss function: L=L cls +αL adv +βL MMD ; Among them, α and β are weight parameters of the domain adversarial loss term and the feature alignment loss term.
6. A method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence, characterized in that: include: Collect knitted fabric images with broken yarn defects, calculate the clarity level of the knitted fabric images, remove the knitted fabric images whose clarity level does not reach a threshold, and construct a target domain data set; Obtain defect images and labels of different knitted fabrics and construct a source domain data set; use the source domain data set to pre-train an EfficientNet neural network and obtain source domain features; Inputting the target domain data set into the pre-trained EfficientNet neural network to obtain target domain features; Create a domain label using one-hot encoding; pass the source domain feature and the target domain feature to a domain classifier, and output a domain label vector; Designing a defect detection loss function, including a classification loss term, a domain adversarial loss term, and a feature alignment loss term; each loss term is weighted to form the final defect detection loss function; The EfficientNet neural network and the domain classifier are updated alternately; finally, the output of the EfficientNet neural network outputs the broken yarn defect type of the knitted fabric image through the softmax layer.
7. The method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence according to claim 6, characterized in that: The knitted fabric image includes different colors, textures and defect types; the clarity level of the knitted fabric image is calculated using the Laplace operator, and the calculation formula of the Laplace operator is: Wherein, I represents the input image; (x, y) represents the pixel position in the knitted fabric image; Based on the output of the Laplace operator, the variance is calculated: Wherein, Var() represents the variance of the output result; L i represents the Laplace value of each pixel in the i-th knitted fabric image; μ represents the mean of the Laplace values; N represents the total number of pixels; Var(L) is taken as the clarity level of the i-th knitted fabric image; the threshold is set as σ threshold , keep the condition Var(L)>σ threshold The knitted fabric images are discarded if they satisfy the condition Var(L)≤σ threshold The knitted fabric image dataset is constructed by using the knitted fabric image of the knitted fabric.
8. The method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence according to claim 6, characterized in that: Different knitted fabric defect images include knitted fabric tear images, knitted fabric stain images, knitted fabric skipped stitch images and knitted fabric yarn kink images; The source domain features and the target domain features include texture, color, shape and structure information of the images in the source domain dataset and the target domain dataset respectively, and also include high-level semantic information related to the defects, which describes the unique attributes of the defect area.
9. The method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence according to claim 6, characterized in that: The domain label value of the source domain is 0, and the domain label value of the target domain is 1; The domain classifier includes an input layer, multiple fully connected layers, a Dropout layer and a Softmax output layer; the domain classifier reads the source domain features and the target domain features, and outputs a probability distribution, which represents the predicted probability of the domain classifier for the domain source of the input features.
10. The method for detecting yarn breakage defects in knitted fabrics based on artificial intelligence according to claim 6, characterized in that: The images in the source domain dataset and the target domain dataset are respectively denoted as X s and X t The source domain feature and the target domain feature are respectively denoted as f(X s ) and f(X t ); the probability distribution of the domain classifier output is recorded as (Source, Target), where Source and Target represent the probability that the domain classifier predicts the input feature domain source as the source domain and the target domain, respectively; The classification loss term L cls Use the cross entropy loss function for optimizing the EfficientNet neural network. The formula is: in, represents the true label of image i in the source domain dataset; N represents the prediction probability of the EfficientNet neural network for the image i in the source domain dataset; s represents the number of images in the source domain dataset; K represents the number of categories; The domain adversarial loss term L adv It is used to optimize the domain classifier and update the network parameters of the EfficientNet neural network through reverse gradient; the formula of the domain adversarial loss term is: Among them, d i Indicates the domain label value; N t Represents the number of images in the target domain dataset; The feature alignment loss term L MMD To measure the difference in feature distribution between two fields, the formula is: in, Represents the source domain feature corresponding to the image i in the source domain dataset; Represents the target domain feature corresponding to the image j in the target domain dataset; The classification loss term, the domain adversarial loss term and the feature alignment loss term are weighted and summed to form the final defect detection loss function: L=L cls +αL adv +βL MMD ; Among them, α and β are weight parameters of the domain adversarial loss term and the feature alignment loss term.