A method and device for sensing hyperspectral components of textile fabrics
Through the textile fabric hyperspectral component perception model based on the particle swarm optimization algorithm and SGD optimizer, the problems of low textile fabric component identification accuracy and high data collection complexity are solved, achieving fast and accurate textile fabric component detection and reducing detection time. Cost and operational complexity.
Patent Information
- Application Number
- CN202410527765.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-04-29
AI Technical Summary
Existing textile fabric hyperspectral component sensing methods have problems such as low component classification accuracy, data collection that is easily affected by environmental factors, high computational complexity, and high cost of data set construction, making it difficult to meet the needs for fast and accurate textile fabric component detection.
The hyperspectral component perception model of textile fabrics trained by the adaptive weighting factor-based particle swarm optimization algorithm and SGD optimizer is used to process hyperspectral data through one-dimensional convolution layer, two-dimensional convolution layer, three-dimensional convolution layer and fully connected layer. , extract features and perform component perception, reduce model training complexity and improve recognition accuracy.
It achieves rapid and accurate identification of textile fabric components, reduces testing costs, simplifies equipment and operating procedures, is suitable for textile production, trade and quality supervision, and improves industry management levels.
Smart Images

Figure CN118366035B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and a device for perceiving hyperspectral components of textile fabrics, and belongs to the technical field of intelligent spectral perception. Background Art
[0002] In traditional textile fabric testing, chemical analysis or microscopic observation is usually required to detect the hyperspectral components of textile fabrics. These methods are time-consuming, labor-intensive and highly destructive, and are difficult to meet the growing needs of textile fabric testing.
[0003] The hyperspectral component perception method of textile fabrics is a method that uses hyperspectral imaging technology and deep learning models to quickly and accurately perceive the composition of textile fabrics. Although this method overcomes the shortcomings of traditional component detection methods such as chemical analysis or microscopy observation, such as destructiveness and inefficiency, and has the advantages of being non-destructive, fast, and economical, the existing hyperspectral component perception methods still have some shortcomings.
[0004] Due to the similarity of raw materials or processing technology, different types of textile fabrics have high similarity in hyperspectral data, which will bring challenges to component classification and affect classification accuracy; some composite fabrics are mixed with multiple chemical fibers or natural fibers, and the responses of different components in hyperspectral data are often coupled together, making it difficult to completely separate them with a single hyperspectral data, resulting in the inability of existing hyperspectral component perception methods to accurately perceive; the acquisition process of hyperspectral data is affected by environmental factors such as lighting conditions, temperature and humidity, which may cause the spectral data collected at different times for the same fabric to drift, increasing the difficulty of model generalization; the high dimensionality of hyperspectral data brings greater computational complexity to feature extraction and model training; building a high-quality hyperspectral fabric dataset requires fine scanning and annotation of a large number of fabrics, which is labor-intensive and costly. Therefore, it is necessary to continuously improve data preprocessing, feature extraction, model optimization and other links, and integrate other auxiliary information to further enhance the hyperspectral component perception ability of textile fabrics. Summary of the invention
[0005] The purpose of the present invention is to provide a method and device for perceiving hyperspectral components of textile fabrics, to process hyperspectral data through a hyperspectral component perception model of textile fabrics optimized by a particle swarm algorithm, to accurately perceive the component content of textile fabrics, and to improve the hyperspectral component perception capability of textile fabrics.
[0006] In order to achieve the above objectives / solve the above technical problems, the present invention is implemented by adopting the following technical solutions.
[0007] In a first aspect, the present invention provides a method for perceiving hyperspectral components of textile fabrics, comprising the following steps:
[0008] Process the hyperspectral data of textile fabrics to obtain spectral characteristic data;
[0009] The spectral feature data is processed using the trained hyperspectral component perception model of textile fabrics to obtain the perception results of textile fabric components;
[0010] The hyperspectral component perception model of textile fabrics is trained using a particle swarm optimization algorithm based on an adaptive weighting factor and an SGD optimizer.
[0011] In combination with the first aspect, further, the hyperspectral data of the textile fabric is processed to obtain spectral feature data, including:
[0012] Obtaining a hyperspectral signal sequence of the textile fabric from 1550 nanometers to 1850 nanometers, and extracting 61 data points from the hyperspectral signal sequence according to a 5-nanometer step size to obtain a 61-dimensional spectral sequence;
[0013] The spectral data in the spectral sequence is normalized using a feature normalization method to obtain spectral feature data.
[0014] In combination with the first aspect, further, the hyperspectral component perception model of textile fabrics includes a one-dimensional convolution layer, a one-dimensional pooling layer, a two-dimensional convolution layer, a two-dimensional pooling layer, a three-dimensional convolution layer, a first fully connected layer, a first ReLU activation function, a second fully connected layer, a second ReLU activation function, a first linear layer, and a second linear layer connected in sequence.
[0015] In combination with the first aspect, further, the one-dimensional convolution layer includes 64 1×3 one-dimensional convolution kernels; the two-dimensional convolution layer includes 29 3×3 two-dimensional convolution kernels; and the three-dimensional convolution layer includes 1 3×3×3 two-dimensional convolution kernel.
[0016] In combination with the first aspect, further, the one-dimensional pooling layer includes a one-dimensional maximum pooling layer and a one-dimensional average pooling layer, and the sizes of the one-dimensional maximum pooling layer and the one-dimensional average pooling layer are both 1×2; the two-dimensional pooling layer includes a two-dimensional maximum pooling layer and a two-dimensional average pooling layer, and the sizes of the two-dimensional maximum pooling layer and the two-dimensional average pooling layer are both 2×2.
[0017] In combination with the first aspect, further, the hyperspectral component perception model of the textile fabric is trained using a particle swarm optimization algorithm based on an adaptive weighting factor and an SGD optimizer, including:
[0018] The learning rate of the hyperspectral component perception model of textile fabrics is used as the position of the particle;
[0019] Generate a training sample set based on the hyperspectral data of textile fabrics with known composition;
[0020] The hyperspectral data in the training sample set is used to iteratively train the hyperspectral component perception model of textile fabrics. In each iterative training process, the fitness value of each particle is calculated according to the perception result of the textile fabric composition, and the position and speed of each particle in the population are updated, thereby updating the global optimal position of the current iteration.
[0021] When the number of iterations reaches the maximum number of iterations, the global optimal position is output as the optimal learning rate of the hyperspectral component perception model of textile fabrics;
[0022] The optimal learning rate is substituted into the hyperspectral component perception model of textile fabrics, and the SGD optimizer is used to update the model network parameters in the hyperspectral component perception model of textile fabrics to obtain the trained hyperspectral component perception model of textile fabrics.
[0023] In combination with the first aspect, further, in each iterative training process, the fitness value of each particle is calculated according to the textile fabric composition perception result, the position and speed of each particle in the population are updated, and then the global optimal position of the current iteration is updated, including:
[0024] According to the position of each particle in the previous iteration, the SGD optimizer is used to update the convolution kernel weights, fully connected layer weights and biases of each convolution layer in the hyperspectral component perception model of textile fabrics, and the updated hyperspectral component perception model of textile fabrics corresponding to each particle is obtained;
[0025] Input the training samples in the training sample set into the updated textile fabric hyperspectral component perception model corresponding to each particle to obtain the textile fabric component perception result corresponding to each particle in the current iteration;
[0026] Calculate the fitness value of each particle in the current iteration according to the actual content of the textile fabric and the textile fabric composition perception result corresponding to each particle in the current iteration;
[0027] Compare the fitness value of each particle in the current iteration with the individual best fitness value of the particle. If the fitness value of the i-th particle in the current iteration is better than the individual best fitness value of the particle, update the individual best position and individual best fitness value of the i-th particle.
[0028] Compare the fitness value of each particle in the current iteration with the global optimal fitness value. If the fitness value of the i-th particle in the current iteration is better than the global optimal fitness value, update the global optimal position and the global optimal fitness value.
[0029] Update the position and velocity of each particle based on the adaptive weighting factors.
[0030] Combined with the first aspect, further, the calculation formula of the fitness value of the particle is as follows:
[0031] ;
[0032] in, Represents the fitness value of the i-th particle in the current iteration, represents the true component content of the jth training sample, represents the textile fabric composition perception result corresponding to the i-th particle in the current iteration, and J is the total number of training samples in the training sample set.
[0033] In combination with the first aspect, further, the position and velocity of each particle are updated based on the adaptive weighting factor, and the expression is as follows:
[0034] ;
[0035] ;
[0036] Where d represents the dimension, 1≤d≤D, and D is the total number of dimensions. Indicates the i-th particle in the t+1th iteration The speed of the dimension, is the inertia weight, represents the i-th particle in the t-th iteration The speed of the dimension, c 1. c 2. c 3 is the acceleration constant, represents the i-th particle The individual best position of dimension, is the global best position, Indicated in The local optimal position of the population in dimension, r 1. r 2. r 3 is the adaptive weighting factor, Indicates the i-th particle in the t+1th iteration The location of the dimension, represents the i-th particle in the t-th iteration The location of the dimension;
[0037] r 1. r 2. r The calculation formula for 3 is:
[0038] ;
[0039] in, are the fitness values corresponding to the individual best position, the global best position and the local best position, respectively. is the i-th particle The current fitness value, and are the maximum and minimum fitness values in the current population respectively.
[0040] In a second aspect, the present invention provides a hyperspectral component sensing device for textile fabrics, comprising:
[0041] The spectral feature extraction module is used to process the hyperspectral data of textile fabrics to obtain spectral feature data;
[0042] The component perception module is used to process the spectral feature data using the trained hyperspectral component perception model of textile fabrics to obtain the textile fabric component perception results;
[0043] The hyperspectral component perception model of textile fabrics is trained using a particle swarm optimization algorithm based on an adaptive weighting factor and an SGD optimizer.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] The present invention proposes a method and device for perceiving hyperspectral components of textile fabrics. Through hyperspectral imaging technology and a hyperspectral component perception model of textile fabrics based on deep learning, the composition of textile fabrics can be quickly and accurately identified, and the textile fabrics will not be damaged during the identification process. Compared with traditional chemical analysis and other means, the method of the present invention does not require a complex laboratory environment and manual operation, and the detection equipment is simple, easy to operate, and easy to implement. At the same time, the present invention uses a particle swarm optimization algorithm to train and optimize the model. Once the model is trained, it can be quickly put into use, reducing long-term detection costs. The present invention can provide efficient component detection support for multiple links such as textile production, trade, and quality supervision, which is beneficial to quality control and product traceability, and improves the level of industry management. At the same time, it can also be promoted and applied to non-destructive detection and analysis of material components in other fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The figure is a schematic diagram of the steps of a method for sensing hyperspectral components of textile fabrics provided by an embodiment of the present invention;
[0047] Figure 2 The figure is a schematic diagram of the operation flow of a method for sensing hyperspectral components of textile fabrics provided by an embodiment of the present invention;
[0048] Figure 3 The figure shows a schematic diagram of the network structure of the hyperspectral component perception model of textile fabrics in an embodiment of the present invention;
[0049] Figure 4 It is a schematic diagram showing the comparison of determination coefficients of different models for textile fabric composition perception in an embodiment of the present invention;
[0050] Figure 5 It is a schematic diagram showing the comparison of mean absolute errors of different models for textile fabric composition perception in an embodiment of the present invention;
[0051] Figure 6 It is a schematic diagram showing the comparison of root mean square errors of different models for sensing the composition of textile fabrics in an embodiment of the present invention;
[0052] Figure 7 Shown is a schematic structural diagram of a hyperspectral component sensing device for textile fabrics provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] It should be noted that the hyperspectral component perception method of textile fabrics is a method that uses hyperspectral imaging technology and deep learning models to quickly and accurately perceive the composition of textile fabrics. Hyperspectral imaging technology is a technology that uses visible light, near-infrared or infrared radiation to obtain hyperspectral data of objects. In this process, by using high-resolution spectral imaging instruments, objects can be scanned and detected, and the data obtained includes the spectral response of each pixel at multiple wavelengths, forming a high-dimensional spectral data set. The absorption, transmission and reflection characteristics of textile fabrics change with the change of wavelength. Therefore, the use of hyperspectral imaging technology can record the optical properties of textile fabrics at different wavelengths, such as absorptivity, reflectivity and other parameters. These parameters are stored in the spectral data, forming a high-dimensional optical information space, which provides rich information for further analysis and processing.
[0054] In spectral data analysis, various mathematical and computer science methods, such as principal component analysis, linear discriminant analysis, neural networks, etc., can be used to extract useful features and information. These methods can help us understand and interpret spectral data, accurately identify the differences between different materials, and ultimately achieve the perception of textile components. In order to accurately extract the composition information of textile fabrics from such high-dimensional data, the present invention uses a convolutional neural network to analyze and process spectral data.
[0055] Traditional CNN mainly uses a single kernel function to extract features, while the present invention introduces kernel functions of multiple dimensions to improve the ability of feature learning. At the same time, in order to further improve data processing performance, the present invention uses particle swarm optimization (PSO) to find the optimal network parameters. Through different combinations of kernel functions, multi-core convolutional neural networks can extract richer and more diverse features, thereby improving the accuracy and robustness of perception.
[0056] With the help of CNN model and PSO algorithm, the present invention can process the hyperspectral data of each textile fabric, extract more discriminative feature representation, and then use classifier to classify and identify these features, so as to realize the perception of textile fabric composition. The deep learning-based method has high automation and accuracy when training a large amount of data, and can adapt to different textile fabric samples and complex application scenarios.
[0057] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. The embodiments of the present invention and the technical features in the embodiments may be combined with each other unless there is a conflict.
[0058] The term "and / or" is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " generally indicates that the associated objects are in an "or" relationship.
[0059] Example 1
[0060] This embodiment introduces a method for perceiving hyperspectral components of textile fabrics based on a multi-core convolutional neural network. Figure 1 , Figure 2 As shown, the following steps are included:
[0061] Step A: Acquire hyperspectral data of textile fabrics, process the hyperspectral data, obtain spectral feature data, and eliminate the influence of data collection environment temperature on the data.
[0062] Step B: Use the trained textile fabric hyperspectral component perception model to process the spectral feature data to obtain the textile fabric component perception result.
[0063] Wherein, the step A specifically includes:
[0064] Step A01, obtain a high-spectral signal sequence of textile fabrics from 1550 nanometers to 1850 nanometers, and sample according to a step size of 5 nanometers to obtain 61 sampling points, and then obtain a 61-dimensional spectrum sequence based on the 61 sampling points.
[0065] Step A02: normalize the spectral data in the 61-dimensional spectral sequence obtained in step A01 using a feature normalization method, map each piece of spectral data to between [0, 1], eliminate the influence of non-target factors on modeling, and obtain spectral feature data.
[0066] In the implementation of the present invention, the hyperspectral component perception model of textile fabrics adopts a multi-core convolutional neural network structure, including 1 one-dimensional convolutional layer, 1 two-dimensional convolutional layer, 1 three-dimensional convolutional layer, 2 fully connected layers, 2 pooling layers, 2 linear layers and 2 Relu activation functions.
[0067] In the model provided by the embodiment of the present invention, the three convolutional layers can map the input spectral feature data from one dimension to a high-dimensional space, and can better mine the high-dimensional information in the spectral data. Each pooling layer includes a maximum pooling layer and an average pooling layer. The output of each convolutional layer is subjected to maximum pooling and average pooling respectively, and then the results of maximum pooling and average pooling are added and fused as the input of the next convolution, thereby removing the redundant information between adjacent spectra; each neuron in the fully connected layer is connected to all neurons in the previous layer, which enables the neural network to capture the nonlinear relationship between the spectral features mined by the convolutional layer. The present invention regards the perception of textile fabric components as a regression task, and can directly output continuous values as component perception results through the fully connected layer.
[0068] In the embodiment of the present invention, the model input data passes through the one-dimensional convolution layer, the one-dimensional pooling layer, the two-dimensional convolution layer, the two-dimensional pooling layer, the three-dimensional convolution layer, the first fully connected layer, the first ReLU activation function, the second fully connected layer, the second ReLU activation function, the first linear layer, and the second linear layer in order to finally output the model prediction result. Figure 3 As shown in the figure, the order of the layers of the textile fabric hyperspectral component perception model is: input->one-dimensional convolution layer->one-dimensional maximum pooling layer->one-dimensional average pooling layer->two-dimensional convolution layer->two-dimensional maximum pooling layer->two-dimensional average pooling layer->three-dimensional convolution layer->first fully connected layer->first ReLU activation function->second fully connected layer->second ReLU activation function->first linear layer->second linear layer->output.
[0069] The one-dimensional convolution layer includes 64 1×3 one-dimensional convolution kernels. The input of the one-dimensional convolution layer is a 1×61-dimensional feature tensor, where 1 represents a textile fabric sample and 61 represents the spectral value of the textile fabric sample. The two-dimensional convolution layer includes 29 3×3 two-dimensional convolution kernels. The input of the two-dimensional convolution layer is an 8×8-dimensional feature tensor. The three-dimensional convolution layer includes 1 3×3×3 two-dimensional convolution kernel. The input of the three-dimensional convolution layer is a 64×3×3-dimensional feature tensor. The pooling layer size of the one-dimensional maximum pooling layer and the one-dimensional average pooling layer is 1×2. The pooling layer size of the two-dimensional maximum pooling layer and the two-dimensional average pooling layer is 2×2. The input of the first linear layer is 62 and the output is 256. The input of the second linear layer is 256 and the output is 6.
[0070] In order to improve the perception performance of the hyperspectral component perception model of textile fabrics, it is necessary to train and optimize the hyperspectral component perception model of textile fabrics. The present invention uses a particle swarm optimization algorithm to optimize the model parameters of the hyperspectral component perception model of textile fabrics, specifically the learning rate. The optimal learning rate can be obtained through training, and a trained hyperspectral component perception model of textile fabrics is obtained based on the optimal learning rate.
[0071] The training process of the hyperspectral component perception model for textile fabrics is as follows:
[0072] Step 1. Initialize the population parameters and model network parameters, where the population parameters include the number of particles, the position and speed of each particle, the maximum number of iterations, the individual best position of each particle (initialized to 0), the global best position of the population (initialized to 0), the individual best fitness value of each particle (initialized to 0) and the global best fitness value of the population (initialized to 0), etc. The model network parameters include the convolution kernel weight of each convolution layer, the weight and bias of the fully connected layer, the learning rate range (i.e., the upper and lower bounds of the learning rate), etc.
[0073] Each particle in the population represents a possible learning rate of the hyperspectral component perception model of textile fabrics. The present invention randomly selects an initial value of the learning rate within a preset learning rate range as the initial position of the particle. In an embodiment of the present invention, the learning rate range is [0.0001, 0.1].
[0074] Step 2: Obtain a training sample set. By collecting a large amount of hyperspectral data of textile fabrics with known components, a large number of samples are generated under the normalization operation of step A, and then the samples are divided into a training sample set and a test sample set in a ratio of 8:1.
[0075] Step 3: Use the hyperspectral data in the training sample set to iteratively train the hyperspectral component perception model of textile fabrics. In each iterative training process, the fitness value of each particle is calculated according to the textile fabric component perception result, and the position and speed of each particle in the population are updated, thereby updating the global optimal position of the current iteration.
[0076] Step 301: According to the position of each particle in the last iteration, the SGD optimizer is used to update the convolution kernel weights, the fully connected layer weights and the bias of each convolution layer in the textile fabric hyperspectral component perception model to obtain an updated textile fabric hyperspectral component perception model corresponding to each particle.
[0077] Step 302: input the training samples in the training sample set into the updated textile fabric hyperspectral component perception model corresponding to each particle to obtain the textile fabric component perception result corresponding to each particle in the current iteration.
[0078] Step 303: Calculate the fitness value of each particle in the current iteration according to the actual content of the textile fabric and the textile fabric composition perception result corresponding to each particle in the current iteration. The fitness value calculation formula is as follows:
[0079] (1);
[0080] in, Represents the fitness value of the i-th particle in the current iteration, represents the true component content of the jth training sample, It represents the perception result of the textile fabric composition corresponding to the i-th particle in the current iteration, specifically, the probability of the textile fabric composition perceived by the model for the training sample, and J is the total number of training samples in the training sample set.
[0081] The more accurately the model perceives the textile fabric composition of the training sample ( near ), the smaller the cross entropy loss function value is, the corresponding fitness value is The larger it is, the better the adaptability of this particle (learning rate).
[0082] Step 304: Compare the fitness value of each particle in the current iteration with the individual best fitness value of the particle. If the fitness value of the i-th particle in the current iteration is better than the individual best fitness value of the particle, update the individual best position and individual best fitness value of the i-th particle.
[0083] Step 305: Compare the fitness value of each particle in the current iteration with the global optimal fitness value. If the fitness value of the i-th particle in the current iteration is better than the global optimal fitness value, update the global optimal position and the global optimal fitness value.
[0084] Step 306: Update the position and velocity of each particle based on the adaptive weighting factor, expressed as follows:
[0085] (2);
[0086] (3);
[0087] Where d represents the dimension, 1≤d≤D, and D is the total number of dimensions. Indicates the i-th particle in the t+1th iteration The speed of the dimension, is the inertia weight, represents the i-th particle in the t-th iteration The speed of the dimension, c 1. c 2. c 3 is the acceleration constant, represents the i-th particle The individual best position of dimension, is the global best position, Indicated in The local optimal position of the population in dimension, r 1. r 2. r 3 is the adaptive weighting factor, Indicates the i-th particle in the t+1th iteration The location of the dimension, represents the i-th particle in the t-th iteration Dimensional location.
[0088] In an embodiment of the present invention, r 1. r 2. r The calculation formula for 3 is:
[0089] (4);
[0090] in, are the fitness values corresponding to the individual best position, the global best position and the local best position, respectively. is the i-th particle The current fitness value, and are the maximum and minimum fitness values in the current population respectively.
[0091] Compared with the traditional particle swarm optimization algorithm, the algorithm adopted in this invention introduces the local optimal position of the population , to enhance the local search capability of the algorithm. At the same time, the algorithm of the present invention uses an adaptive weighting factor r 1. r 2. r 3. According to the fitness difference between the current fitness value of the particle and the fitness of the optimal position, the search weights in different directions are dynamically adjusted to balance the global and local search capabilities, which can achieve better parameter optimization effects.
[0092] Step 4: Repeat step 3 until the maximum number of iterations is reached, the iteration is terminated, and the global optimal position is output as the optimal learning rate of the hyperspectral component perception model of textile fabrics. In the embodiment of the present invention, the maximum number of iterations is set to 200 times.
[0093] Step 5: Substitute the optimal learning rate into the hyperspectral component perception model of textile fabrics, and use the SGD optimizer to update the convolution kernel weights, fully connected layer weights and bias of each convolution layer in the hyperspectral component perception model of textile fabrics to obtain a trained hyperspectral component perception model of textile fabrics.
[0094] In order to verify the effect of the method of the present invention, the present invention conducted the following simulation experiment through a test sample set.
[0095] The simulation experiment of the present invention selects a one-dimensional CNN model using only maximum pooling and a one-dimensional CNN model using only average pooling as a control group, and inputs the test samples into the trained textile fabric hyperspectral component perception model, the one-dimensional CNN model using only maximum pooling, and the one-dimensional CNN model using only average pooling, respectively, to obtain the textile fabric component perception results of each model. For the convenience of distinction, the textile fabric hyperspectral component perception model trained by the method of the present invention is called Our, the one-dimensional CNN model using only maximum pooling is called Max, and the one-dimensional CNN model using only average pooling is called Avg.
[0096] According to the perception results of textile fabric composition of the three models and the actual composition content of the test samples, the determination coefficients (R-Squared) of the three models were calculated. The results are as follows: Figure 4 As shown in Figure 2, the closer the R-Squared value is to 1, the better the model fit is. Figure 4 It can be seen that the R-Squared value of the hyperspectral component perception model of textile fabrics trained in the method of the present invention is the highest, which is 0.9741, indicating that the fitting effect of the model of the present invention is the best.
[0097] The calculation formula of the coefficient of determination is as follows:
[0098] (5);
[0099] Among them, y k represents the true component content of the kth test sample, represents the textile fabric composition perception result of the kth test sample, It represents the average value of the content of textile fabric components, and n is the total number of test samples.
[0100] According to the textile fabric composition perception results of the three models and the actual composition content corresponding to the test samples, the mean absolute error (MAE) of the perception results of the three models is calculated. The results are as follows: Figure 5 As shown, the lower the MAE, the better the model perception performance. Figure 5 It can be seen that the MAE value of the method of the present invention is the lowest, which is 1.7818.
[0101] The mean absolute error is calculated as follows:
[0102] (6);
[0103] According to the textile fabric composition perception results of the three models and the actual composition content of the test samples, the root mean square error (RMSE) of the three models was calculated. The results are as follows: Figure 6 As shown in Figure 2, RMSE amplifies the samples with larger errors in the model's perceived component content compared to MAE. Therefore, the smaller the RMSE value, the more meaningful it is. Figure 6 It can be seen that the RMSE value of the method of the present invention is the smallest, which is 4.2974.
[0104] Through the above simulation experiments, it can be seen that the method of the present invention aims at the problem of textile fabric component perception, and designs a new hyperspectral component perception model for textile fabrics. Through hyperspectral imaging technology and a hyperspectral component perception model for textile fabrics based on deep learning, the components of textile fabrics can be identified quickly and accurately, and the textile fabrics will not be damaged during the identification process. This solves the problems existing in the identification of textile fabric components in the prior art and provides an advanced component perception technology for the textile industry.
[0105] Example 2
[0106] Based on the same inventive concept as Example 1, this example introduces a hyperspectral component sensing device for textile fabrics, such as Figure 7 As shown, it includes a spectral feature extraction module and a component perception model.
[0107] The spectral feature extraction module is used to process the hyperspectral data of textile fabrics to obtain spectral feature data.
[0108] The component perception module is used to process spectral feature data using the trained hyperspectral component perception model of textile fabrics to obtain the textile fabric component perception results; wherein, the hyperspectral component perception model of textile fabrics is trained using a particle swarm optimization algorithm based on an adaptive weighting factor and an SGD optimizer.
[0109] The specific functional implementation of each of the above modules can be found in the relevant contents of the method in Example 1 and will not be elaborated here.
[0110] In summary, the present invention can use the hyperspectral characteristics of textiles to better perceive the content of textile ingredients, and quickly and accurately identify the ingredients of textile fabrics without destroying the textile fabrics. Compared with traditional chemical analysis and other means, the method of the present invention does not require a complex laboratory environment and manual operation, and the detection equipment is simple, easy to operate, and easy to implement. At the same time, the present invention uses a particle swarm optimization algorithm to train and optimize the model. Once the model is trained, it can be quickly put into use, reducing long-term detection costs. The present invention can provide efficient component detection support for multiple links such as textile production, trade, and quality supervision, which is beneficial to quality control and product traceability, and improves the level of industry management. It can also be promoted and applied to non-destructive detection and analysis of material components in other fields.
[0111] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0113] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0114] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0115] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.
Claims
1. A method for perceiving hyperspectral components of textile fabrics, characterized in that: The steps include: Process the hyperspectral data of textile fabrics to obtain spectral characteristic data; The spectral feature data is processed using the trained hyperspectral component perception model of textile fabrics to obtain the perception results of textile fabric components; The hyperspectral component perception model of textile fabrics is trained using a particle swarm optimization algorithm based on an adaptive weighting factor and an SGD optimizer, including: The learning rate of the hyperspectral component perception model of textile fabrics is used as the position of the particle; Generate a training sample set based on the hyperspectral data of textile fabrics with known composition; The hyperspectral data in the training sample set is used to iteratively train the hyperspectral component perception model of textile fabrics. In each iterative training process, the fitness value of each particle is calculated according to the perception result of the textile fabric composition, and the position and speed of each particle in the population are updated, thereby updating the global optimal position of the current iteration. When the number of iterations reaches the maximum number of iterations, the global optimal position is output as the optimal learning rate of the hyperspectral component perception model of textile fabrics; The optimal learning rate is substituted into the hyperspectral component perception model of textile fabrics, and the SGD optimizer is used to update the model network parameters in the hyperspectral component perception model of textile fabrics to obtain the trained hyperspectral component perception model of textile fabrics.
2. The method for perceiving hyperspectral components of textile fabrics according to claim 1, characterized in that: The hyperspectral data of the textile fabric is processed to obtain spectral characteristic data, including: Obtaining a hyperspectral signal sequence of the textile fabric from 1550 nanometers to 1850 nanometers, and extracting 61 data points from the hyperspectral signal sequence according to a 5-nanometer step size to obtain a 61-dimensional spectral sequence; The spectral data in the spectral sequence is normalized using a feature normalization method to obtain spectral feature data.
3. The method for perceiving hyperspectral components of textile fabrics according to claim 1, characterized in that: The textile fabric hyperspectral component perception model includes a one-dimensional convolution layer, a one-dimensional pooling layer, a two-dimensional convolution layer, a two-dimensional pooling layer, a three-dimensional convolution layer, a first fully connected layer, a first ReLU activation function, a second fully connected layer, a second ReLU activation function, a first linear layer, and a second linear layer, which are connected in sequence.
4. The method for perceiving hyperspectral components of textile fabrics according to claim 3 is characterized in that: The one-dimensional convolution layer includes 64 1×3 one-dimensional convolution kernels; the two-dimensional convolution layer includes 29 3×3 two-dimensional convolution kernels; and the three-dimensional convolution layer includes 1 3×3×3 two-dimensional convolution kernel.
5. The method for perceiving hyperspectral components of textile fabrics according to claim 3, characterized in that: The one-dimensional pooling layer includes a one-dimensional maximum pooling layer and a one-dimensional average pooling layer, and the sizes of the one-dimensional maximum pooling layer and the one-dimensional average pooling layer are both 1×2; the two-dimensional pooling layer includes a two-dimensional maximum pooling layer and a two-dimensional average pooling layer, and the sizes of the two-dimensional maximum pooling layer and the two-dimensional average pooling layer are both 2×2.
6. The method for perceiving hyperspectral components of textile fabrics according to claim 1, characterized in that: In each iterative training process, the fitness value of each particle is calculated according to the textile fabric composition perception result, the position and speed of each particle in the population are updated, and then the global optimal position of the current iteration is updated, including: According to the position of each particle in the previous iteration, the SGD optimizer is used to update the convolution kernel weights, fully connected layer weights and biases of each convolution layer in the hyperspectral component perception model of textile fabrics, and the updated hyperspectral component perception model of textile fabrics corresponding to each particle is obtained; Input the training samples in the training sample set into the updated textile fabric hyperspectral component perception model corresponding to each particle to obtain the textile fabric component perception result corresponding to each particle in the current iteration; Calculate the fitness value of each particle in the current iteration according to the actual content of the textile fabric and the textile fabric composition perception result corresponding to each particle in the current iteration; Compare the fitness value of each particle in the current iteration with the individual best fitness value of the particle. If the fitness value of the i-th particle in the current iteration is better than the individual best fitness value of the particle, update the individual best position and individual best fitness value of the i-th particle. Compare the fitness value of each particle in the current iteration with the global optimal fitness value. If the fitness value of the i-th particle in the current iteration is better than the global optimal fitness value, update the global optimal position and the global optimal fitness value. Update the position and velocity of each particle based on the adaptive weighting factors.
7. The method for perceiving hyperspectral components of textile fabrics according to claim 6, characterized in that: The calculation formula of the particle's fitness value is as follows: ; in, Represents the fitness value of the i-th particle in the current iteration, represents the true component content of the jth training sample, represents the textile fabric composition perception result corresponding to the i-th particle in the current iteration, and J is the total number of training samples in the training sample set.
8. The method for perceiving hyperspectral components of textile fabrics according to claim 6, characterized in that: Update the position and velocity of each particle based on the adaptive weighting factor, as follows: ; ; Where d represents the dimension, 1≤d≤D, and D is the total number of dimensions. Indicates the i-th particle in the t+1th iteration The speed of the dimension, is the inertia weight, represents the i-th particle in the t-th iteration The speed of the dimension, c 1. c 2. c 3 is the acceleration constant, represents the i-th particle The individual best position of dimension, is the global best position, Indicated in The local optimal position of the population in dimension, r 1. r 2. r 3 is the adaptive weighting factor, Indicates the i-th particle in the t+1th iteration The location of the dimension, represents the i-th particle in the t-th iteration The location of the dimension; r 1. r 2. r The calculation formula for 3 is: ; in, are the fitness values corresponding to the individual best position, the global best position and the local best position, respectively. is the i-th particle The current fitness value, and are the maximum and minimum fitness values in the current population respectively.
9. A hyperspectral component sensing device for textile fabrics, characterized in that: include: The spectral feature extraction module is used to process the hyperspectral data of textile fabrics to obtain spectral feature data; The component perception module is used to process the spectral feature data using the trained hyperspectral component perception model of textile fabrics to obtain the textile fabric component perception results; The hyperspectral component perception model of textile fabrics is trained using a particle swarm optimization algorithm based on an adaptive weighting factor and an SGD optimizer, including: The learning rate of the hyperspectral component perception model of textile fabrics is used as the position of the particle; Generate a training sample set based on the hyperspectral data of textile fabrics with known composition; The hyperspectral data in the training sample set is used to iteratively train the hyperspectral component perception model of textile fabrics. In each iterative training process, the fitness value of each particle is calculated according to the perception result of the textile fabric composition, and the position and speed of each particle in the population are updated, thereby updating the global optimal position of the current iteration. When the number of iterations reaches the maximum number of iterations, the global optimal position is output as the optimal learning rate of the hyperspectral component perception model of textile fabrics; The optimal learning rate is substituted into the hyperspectral component perception model of textile fabrics, and the SGD optimizer is used to update the model network parameters in the hyperspectral component perception model of textile fabrics to obtain the trained hyperspectral component perception model of textile fabrics.
