Semi-supervised classification method of fabric fiber composition based on π model
Through the semi-supervised learning method based on the π model, combined with data augmentation and confidence detection, the problem of insufficient label data in traditional fabric fiber component analysis is solved, the generalization ability and robustness of the model are improved, and more efficient Fabric fiber composition classification.
Patent Information
- Application Number
- CN202111040595.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-06
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-09-06
AI Technical Summary
The traditional fabric fiber composition analysis method is complicated, time-consuming, high cost, and the deep neural network has poor effect in material analysis. It is mainly due to insufficient label data, which leads to overfitting, and traditional methods are difficult to obtain a large amount of unlabeled data, resulting in generalization of the model. Inadequate performance and robustness.
Using a semi-supervised learning method based on the π model, data augmentation and confidence detection are performed on labeled data, combined with labeled data for training, and using consistency regularity and cross-entropy loss to avoid data distortion and overfitting, and improve the model's generalization ability to transform.
It improves the generalization ability and robustness of the model, alleviates the overfitting problem caused by too little labeled data, enhances the prediction accuracy of fabric fiber composition classification, and is suitable for the analysis of fabric near-infrared hyperspectral data.
Smart Images

Figure CN113887317B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a fabric fiber component classification method, in particular to a semi-supervised learning method based on a π model. Background Art
[0002] The fabric production process is easily affected by various external factors, which leads to large fluctuations in the quality of the finished product and requires strict quality testing. Traditional fabric fiber composition analysis is divided into two steps: qualitative and quantitative.
[0003] Qualitative material analysis methods include combustion method, melting point method, visual inspection by hand, microscope section analysis method, etc. The microscope section analysis method is generally used, that is, the fiber is sliced with a slicer and then observed under a microscope. The fiber type is determined based on its appearance.
[0004] Quantitative material analysis method: First, different fibers are qualitatively analyzed using different solvents, and then the specific component content is calculated.
[0005] Traditional methods for analyzing fabric fiber composition have many steps, are time-consuming, require high technical staff, and are costly, so technological innovation is urgently needed.
[0006] Recently, there are also traditional machine learning methods based on SVM, decision tree, etc., or deep neural network methods based on LSTM, RNN, etc. However, the traditional machine learning methods are less effective, and deep neural networks require a large amount of labeled data obtained by traditional material analysis methods. Traditional material analysis methods are too expensive, time-consuming, and labor-intensive to obtain in large quantities. This has resulted in the problem that deep neural networks are difficult to apply to material analysis problems and have poor results.
[0007] Semi-supervised learning is different from supervised learning, which only uses labeled data. It introduces a large amount of unlabeled data, constructs unsupervised signals by learning the intrinsic properties of unlabeled data, and combines them with supervised signals constructed from labeled data. This enables the model to make full use of a large amount of unlabeled data and iterate continuously, ultimately enhancing the generalization performance and greatly alleviating the overfitting problem caused by the lack of labeled data during supervised training of deep neural networks.
[0008] At the same time, semi-supervised learning uses stronger data enhancement and introduces a noise training mechanism. Therefore, the trained model is more robust and will be more stable in the face of noise caused by equipment differences, environmental differences, etc. in the real world.
[0009] The π model is an effective semi-supervised learning method that calculates the cross entropy loss for labeled data. Based on the principle of consistency regularization, it performs different data enhancements on two copies of unlabeled data and calculates the MSE loss as the consistency loss. The cross entropy loss of labeled data and the consistency loss of unlabeled data are then combined into a total loss to train the neural network model. Summary of the invention
[0010] The π model was originally applied to image classification problems, but its direct application to fabric fiber classification problems performs poorly. This is because the near-infrared spectrum is different from the image data type, and its data enhancement method based on visual invariance prior cannot be introduced. At the same time, the spectral data has a small dimension, which is more likely to cause distortion after data enhancement and no longer belong to the original category, so consistency regularization is not applicable.
[0011] In order to overcome the defects and shortcomings of the π model algorithm in the prior art, the present invention provides a semi-supervised classification method for fabric fiber components based on the π model. On the basis of the π model semi-supervised loss, cosine distance screening is applied to data enhancement samples to avoid data distortion samples from participating in calculation losses; at the same time, a confidence detection mechanism is added to avoid low prediction confidence samples from participating in training, increase the stability of model training, alleviate the network overfitting problem caused by too little labeled data, and improve the generalization ability of the model. The model training method includes the following steps:
[0012] S1: Collection of supervised and unsupervised data of fabric fibers;
[0013] S2: using the feature extraction neural network and classifier of the fabric near-infrared hyperspectral data, and using the labeled training data of the fabric near-infrared hyperspectral sequence data set, supervised training is performed on the labeled data.
[0014] S3: Through the feature extraction neural network and classifier of the fabric near-infrared hyperspectral data, using the unlabeled training data of the fabric near-infrared hyperspectral sequence data set, introducing the semi-supervised training method, and performing unsupervised training.
[0015] S4: combining supervised data training and unsupervised training to update the model through the semi-supervised training method;
[0016] S5: Material analysis of fabric near-infrared hyperspectral data, through the method of collecting and cleaning fabric near-infrared hyperspectral data, feature extraction neural network and classifier, the fabric near-infrared hyperspectral data is collected, cleaned, feature extracted and classified to obtain the material category components of the target fabric.
[0017] Furthermore, the specific steps of collecting supervised and unsupervised data of fabric fibers in step S1 are as follows:
[0018] S11: Collection of fabric near-infrared hyperspectral sequence data; S12: Supervised data label collection; S13: Data cleaning and anomaly elimination of fabric near-infrared hyperspectral sequence data; S14: Training of fabric near-infrared hyperspectral sequence data and preparation of test data sets
[0019] Furthermore, the specific steps of collecting fabric near-infrared hyperspectral sequence data in step S11 are as follows:
[0020] S111: In order to ensure that the collected data reflects the overall situation of a piece of cloth and expand the data set, multiple sampling is performed to fill in the database; S112: The near-infrared hyperspectral sequence data of the fabric is collected by a near-infrared hyperspectral imager, and the sequence data with a wavelength range of 900nm-1700nm is intercepted.
[0021] Furthermore, the specific steps of supervised data label collection in step S12 are as follows:
[0022] S121: For fabric data collected by S111, if the fabric sample has been analyzed by traditional fabric composition analysis methods to obtain material components, the data is marked to construct a mapping relationship between the fabric near-infrared hyperspectral sequence and its material components; S122: For fabric data collected by S121, its material components include common pure materials such as cotton, rayon, modal, tencel, polyester, wool, spandex, linen, nylon, acrylic, silk, cashmere, and blended fabrics composed of the above materials. Material components refer to the list of materials that make up a piece of fabric, and have nothing to do with the blending content of each material.
[0023] Furthermore, in step S13, the data cleaning and abnormality elimination of the fabric near-infrared hyperspectral sequence data are as follows:
[0024] S131: In view of the characteristics of some cloth spectral sequences with high noise and unevenness, the smoothed denoised curve is obtained based on the Savitzky-Golay smoothing denoising algorithm, and the mean square error is obtained by comparing it with the original data curve. The sampling points with a mean square error greater than the threshold w are excluded from the data set.
[0025] Furthermore, in step S14, the training of the fabric near-infrared hyperspectral sequence data and the test data set are specifically performed as follows:
[0026] S141: The data after data cleaning and anomaly elimination described in step S131 is divided into labeled data and unlabeled data according to whether there is a label or not. The labeled data set is divided into a training set and a test set in a ratio of 7:3. All unlabeled data are put into the training set; S142: In view of the fact that the spectral waveforms of multiple sampling points of the same cloth sample are similar, multiple sampling points of the same cloth sample should not be dispersed into the training set and the test set, otherwise the training set will be mixed with the test set, resulting in the problem that the test results deviate from the actual situation.
[0027] Furthermore, the specific steps of supervised training with labeled data in step S2 are as follows:
[0028] S21: Based on the characteristics of near-infrared hyperspectral sequence data, a feature extraction network based on a one-dimensional convolutional neural network is constructed; S22: Based on the labeled training data obtained in step S1, the labeled training data is input into the one-dimensional convolutional feature extraction neural network to obtain a feature vector, and then the output probability distribution is obtained by the Softmax classifier, and the supervised cross entropy loss is obtained by comparing with the true label, which is recorded as the supervised loss; S23: Based on the output probability distribution vector obtained by the classifier in step S22, a threshold e is set to address the problem that the amount of labeled data is small and the model is prone to overfitting. If the maximum value of the probability distribution vector obtained by the feature extraction network and the Softmax classifier of a certain sampling point in step S22 is greater than e, it is not counted in the supervised loss; S24: Based on the labeled training data obtained in step S1, labeled training data is obtained by uniform sampling in the early stage of training. In the late stage of training, labeled training data is obtained by random weighted sampling.
[0029] Furthermore, step S3 introduces the semi-supervised training method, and the specific steps of unsupervised training are as follows:
[0030] S31: Based on the data cleaning, anomaly elimination, and unlabeled training data obtained by data set preparation in step S1, each spectral sequence is randomly enhanced to form a pair, and the one-dimensional convolutional feature extraction network in step S21 obtains the features, and then the classifier obtains the output probability distribution. The unsupervised MSE loss is calculated for the sequence output of the same training data but different random enhancements, which is recorded as the unsupervised loss; S32: The classifier of the unsupervised data pair in step S31 after the S21 feature extraction network is generated by the Softmax function and the temperature coefficient τ, in order to obtain a steeper distribution so that it is easier to meet the confidence threshold β. τ is generally taken as 0.5. The formula is as follows:
[0031]
[0032] S33: For the unsupervised loss obtained by step S31 of the unsupervised data, a threshold β is set, which is taken as 0.6. If the maximum value of the unsupervised probability distribution does not reach the threshold, the loss is not included. It can be expressed as:
[0033]
[0034] Where x is the input data, p is the feature vector output by the model, and the probability distribution vector output by the warming Softmax function P(*).
[0035] S34: Based on the input sequence pair obtained by random enhancement in S31, a threshold r is set to avoid data distortion and other problems caused by too drastic data enhancement. If the absolute value of the cosine distance between a sampling point and the sample after data enhancement is less than r, it is not counted in the unsupervised loss. It can be expressed as:
[0036]
[0037] in
[0038]
[0039] Where X is the unlabeled training data sequence vector and X' is the data augmented copy of X.
[0040] S35: Based on the unlabeled training data obtained in step S1, data is always obtained by uniform sampling during training.
[0041] Furthermore, step S4 is a semi-supervised training method that combines supervised data training and unsupervised training to update the model. The specific steps are as follows:
[0042] S41: The total loss is the sum of the supervised loss plus a coefficient w(t) related to the number of training generations multiplied by the unsupervised loss. It can be calculated by the following formula:
[0043]
[0044] Where t is the current training generation, T is the total training generation, and μ is a constant, which is generally taken as 10 to increase the unsupervised loss.
[0045] The semi-supervised classification method of fabric fiber composition based on the π model proposed in the present invention utilizes a convolutional neural network to extract features from input spectral sequence data, combines unsupervised learning, and utilizes the consistency prior knowledge of a large amount of unlabeled sample data in practical applications to train the feature extraction capability of the neural network, thereby enhancing the generalization ability of the model and improving the robustness against noise during instrument acquisition, thus solving the serious overfitting problem in the previous use of neural networks to process fabric spectral sequences. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The model training flow chart provided by the present invention;
[0047] Figure 2 A waveform comparison diagram of multiple sampling points of the same cloth provided by the present invention; DETAILED DESCRIPTION
[0048] The specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. However, the present invention should be understood as not being limited to the embodiments described below, and the technical concept of the present invention can be implemented in combination with other known technologies or other technologies with the same functions as those known technologies.
[0049] In the description of the following specific embodiments, in order to clearly demonstrate the structure and working mode of the present invention, many directional words will be used for description, but the words "front", "rear", "left", "right", "outside", "inside", "outward", "inward", "axial", "radial" and the like should be understood as convenient terms and should not be understood as restrictive terms.
[0050] The relevant terms are explained as follows:
[0051] Data cleaning: Data cleaning is the process of reviewing and verifying data with the aim of removing duplicate information, correcting existing errors, and providing data consistency.
[0052] Data augmentation: Data augmentation is the process of changing and expanding the data, with the aim of expanding the data set and preventing the model from overfitting.
[0053] Consistency loss: Based on the clustering assumption, the learned decision boundary must lie in low-density regions: if a realistic perturbation is applied to an unlabeled data, the prediction should not change significantly.
[0054] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0055] Reference Figure 1 , the model training process, including steps S1-S4, is as follows:
[0056] 1. Step S1—Collection of supervised and unsupervised data of fabric fibers
[0057] We went deep into textile and garment factories, cloth manufacturers and other places, using hyperspectral near-infrared instruments to collect data such as reflectivity, absorption rate, intensity, etc. of cloth in the near-infrared band, and cleaned the data, taking only spectral sequence data with a wavelength of 900nm-1700nm.
[0058] For cloth that has undergone traditional fabric fiber composition analysis procedures to determine its material and proportion, it is still necessary to collect its material and proportion and match them one-to-one with its spectral sequence.
[0059] During the data acquisition process of the near-infrared spectrometer, light leakage may occur due to improper operation and other reasons, which will be marked as abnormal data and need to be excluded from the data set. The specific judgment method is: if the maximum reflectivity of the cloth does not exceed 0.1, it is abnormal data.
[0060] 2. Step S2 — Training part of supervised data
[0061] In order to expand the data set and enhance the generalization ability of the model, we need to perform data augmentation on the near-infrared hyperspectral sequence in the data set and then input it into the model.
[0062] There are many ways to enhance data. After experimental testing, the more effective data enhancement methods for fabric spectral sequence data are:
[0063] a. Shift up and down. That is, add a one-dimensional sequence to the one-dimensional input sequence. In particular, refer to Figure 2 We found that the data shift of near-infrared hyperspectral sequences in the wavelength range of 900nm-1600nm is more significant. Therefore, we only shift the data in the wavelength range of 900nm-1600nm up and down, and the experiment shows that the effect is better than the overall up and down shift.
[0064] b. Add Gaussian white noise. The near-infrared hyperspectral sequence is collected and analyzed. Experiments have shown that Gaussian white noise with a mean of 0 and a standard deviation of 0.2 has the best effect.
[0065] c. Random mixing. Based on the clustering hypothesis, the same category should have similar characteristics. Samples of this category can be randomly selected and mixed, and the resulting category should remain unchanged.
[0066] The enhanced input data is input into a one-dimensional convolutional neural network to obtain features, and then the output probability distribution is obtained by the classifier, which is compared with the true label to obtain the supervised cross entropy loss. Because the number of labeled samples in actual production is much smaller than that of unlabeled samples, the model is very easy to overfit. In order to suppress this trend, when the maximum value of the output probability distribution vector is greater than the set threshold, it is not counted in the loss.
[0067] Studies have shown that uniform sampling helps train neural network feature extraction capabilities, and balanced sampling helps train neural network classification capabilities. Therefore, in order to further reduce the imbalance of data categories caused by the long tail effect in the data set, uniform sampling is used to obtain training data in the early stages of training. In the late stages of training, random weighted sampling is used to obtain training data.
[0068] 3. Step S3 — Training part of unsupervised data
[0069] The unsupervised near-infrared hyperspectral sequences are randomly enhanced to form a pair (the enhancement method is the same as that of supervised data, but with a larger amplitude), and the features are input into a one-dimensional convolutional neural network. The output probability distribution is then obtained through Softmax, and the unsupervised MSE loss is calculated for this pair of homologous but differently enhanced sequence outputs, which is the unsupervised consistency loss.
[0070] Because the unsupervised part of the training is to enhance the feature extraction ability of the model, the data should always be obtained by uniform sampling to achieve the best training effect.
[0071] The probability distribution MSE of the neural network output after different enhancements of the same data is small and needs to be expanded. Our method is to add temperature τ and transform the Softmax function to obtain a steeper distribution and increase the MSE loss. The calculation formula is:
[0072]
[0073] where τ is the temperature constant and is taken as 0.5 to obtain a steeper distribution.
[0074] Because of the randomness of data augmentation, its output may not belong to any known category. We set a threshold β, which is 0.6. If the maximum value of the unsupervised probability distribution does not reach the threshold, it will not be counted in the loss. It can be expressed as:
[0075]
[0076] Where p is the probability distribution vector of the embedding output by the model after the warming Softmax function P(*).
[0077] Data enhancement in unsupervised training data is the key to obtaining consistency loss. However, excessive data enhancement will lead to problems such as data distortion, causing data category changes to destroy consistency loss, so a threshold r needs to be set. If the absolute value of the cosine distance between a sampling point and its data-enhanced sample is less than r, it will not be counted in the unsupervised loss. It can be expressed as:
[0078]
[0079] in
[0080]
[0081] Where X is the unlabeled training data sequence vector and X' is the data augmented copy of X.
[0082] 4. Step S4 Semi-supervised training method
[0083] In order to combine the results of supervised training and unsupervised training, the total loss is the sum of the supervised loss plus a coefficient w(t) related to the training algebra multiplied by the unsupervised loss.
[0084]
[0085] Where t is the current training generation, T is the total training generation, and μ is a constant, which is generally taken as 10 to increase the unsupervised loss.
[0086] The total loss function is:
[0087]
[0088] Where S is the number of supervised data samples, CE is the cross entropy function, U is the number of unsupervised data samples, μ is the unsupervised loss weight, t is the current training generation, T is the total training generation, I(*) is the confidence decision function, R(*) is the cosine distance decision function, f(*) is the warming Softmax function, a(*) is random data augmentation, and j1 and j2 are two copies of the same unlabeled sample.
[0089] After the above training process, we can obtain a qualitative method for fabric fiber composition that uses both supervised and unsupervised data. By inputting the hyperspectral sequence of the fabric to be detected into the trained model, its material category can be output.
[0090] Compared with the prior art, the present invention achieves the following effects: a semi-supervised classification method for fabric fiber components based on the π model, which extracts features from input spectral sequence data through a convolutional neural network, uses semi-supervised learning, and utilizes the consistency prior knowledge of a large amount of unlabeled sample data in practical applications to train the feature extraction capability of the neural network, thereby enhancing the generalization capability of the model and improving the robustness against noise during instrument acquisition, thereby solving the serious overfitting problem of processing fabric spectral sequences using neural networks in the past and further improving the prediction accuracy of fabric fiber component classification.
Claims
1. A semi-supervised classification method for fabric fiber components based on the π model, characterized in that: The method comprises the following steps: Collecting and cleaning fabric near-infrared hyperspectral data, wherein the hyperspectral data contains labeled data and unlabeled data; Input the labeled data of the fabric into a feature extraction neural network and a classifier to obtain a probability distribution of the model output, and calculate the cross entropy loss with the corresponding label; Performing random data enhancement twice on the unlabeled fabric data to obtain an unlabeled sample pair, inputting the sample pair into a feature extraction neural network and a classifier to obtain a probability distribution of the sample pair output by the model; measuring the L2 distance of different output probability distributions of the same sample pair, and calculating the unsupervised MSE loss for the sample pair; combining the cross entropy loss and the MSE loss into a total loss, and updating the feature extraction neural network model; After the neural network model training is completed, the fabric hyperspectral data is classified using the neural network model; According to the characteristics of near-infrared hyperspectral sequence data, a feature extraction network based on one-dimensional convolutional neural network is constructed; Since the fabric near-infrared hyperspectral data has a small amount of labeled data, the neural network model is prone to overfitting problems, so a threshold e is set. If the maximum value of the probability distribution vector output by the neural network model with labeled data input is greater than e, it will not be counted in the supervised loss; For the labeled data training process, in the early stage of training, labeled training data is obtained by uniform sampling; in the late stage of training, labeled training data is obtained by random weighted sampling; The feature extraction neural network model shares parameters with the neural network model in labeled training; The unlabeled sample pair is obtained by randomly enhancing the data of the same sample. In order to avoid the problem of data distortion caused by excessive data enhancement, a threshold r is set; If the absolute value of the cosine distance between a sampling point and the sample after data enhancement is less than r, it will not be included in the unsupervised loss, which can be expressed as: in Where X is the unlabeled training data sequence vector, and X′ is the data augmented copy of x; For the MSE loss calculated for the unlabeled data pair, a threshold β is set to 0.
6. If the maximum value of the unsupervised probability distribution does not reach the threshold, it is not included in the loss. It can be expressed by the judgment function formula as follows: Where x is the input data, and p is the probability distribution vector output by the classifier; The unlabeled sample extracts the input feature of the neural network and the classifier to obtain the output probability distribution; in order to make the probability distribution easier to meet the confidence threshold β, a classifier combined with a temperature coefficient is used, and the formula is as follows: Where τ is the temperature coefficient; For the unlabeled data training process, the unlabeled training data is always obtained by uniform sampling.
2. The method according to claim 1, characterized in that The combination of labeled data loss and unlabeled data loss further includes: The total loss is the sum of the labeled data loss plus a coefficient w(t) related to the training number multiplied by the unlabeled data loss, which can be calculated by the following formula: Where t is the current training generation, T is the total training generation, and μ is a constant, which is generally taken as 10 to increase the loss of unlabeled data.
