Cashmere and wool identification method based on orthogonal matching pursuit
By performing singular value decomposition and sparse reconstruction of the near-infrared spectral matrix, combined with the SVM model, the problem of insufficient accuracy in cashmere and wool fiber recognition is solved, and efficient fiber distinction is achieved.
Patent Information
- Application Number
- CN202411925643.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
AI Technical Summary
The prior art has the problem of insufficient accuracy in the identification of cashmere and wool fibers, especially in the existence of irrelevant feature variables caused by high dimensionality and collinearity of spectral data, making it difficult to effectively combine noise reduction and feature selection.
The near-infrared spectral matrix is decomposed by a method based on orthogonal matching tracking, and only the first k singular values and their corresponding singular vectors are retained to form the compressed spectral matrix. The characteristic peak information of the fiber is extracted through sparse reconstruction, and finally, the classification model is constructed based on the SVM model to perform binary classification of fibers.
By reducing the data dimensions and extracting the main features, the identification accuracy of cashmere and wool fibers is significantly improved, the ability to distinguish fibers is enhanced, and the needs of industrial production are met.
Smart Images

Figure CN119848644A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image recognition, and in particular relates to a cashmere wool recognition method based on orthogonal matching pursuit. Background Art
[0002] Wool comes from sheep. Even the finest wool is called wool. It feels full and warm. Cashmere grows on goats. It grows on the outer cortex. It is a layer of fine wool covering the roots of the coarse hair. Cashmere will fall off naturally. It is a unique animal fiber.
[0003] Cashmere and wool fibers are both protein fibers, and their basic composition is keratin. They are both formed by the accumulation of many cells. Their cross-sectional distribution is divided into 2 or 3 layers, namely the scale layer on the outer surface, the cortex layer inside, and the medulla layer in the center. Cashmere fibers are short in length and low in strength. The scales covering the surface are thin and sparse, and they are close to each other. The fiber curls are less than wool, so the friction coefficient is smaller than wool, and the cohesion between fibers is relatively poor, but the hand feels smooth and waxy. Although cashmere fibers have fewer curls, they have a large curl depth and can be straightened to more than 300%, while 64-count Merino wool is only 16,000, so cashmere fibers are better at keeping warm than wool.
[0004] Due to their similar composition and tissue structure, they are difficult to distinguish in appearance and feel. Wool is often passed off as cashmere in the market, which not only harms the interests of consumers, but also has a negative impact on the healthy development of the textile market. Therefore, the accurate identification of wool and cashmere fibers has become a major problem in the industry.
[0005] Traditional fiber identification methods rely on microscopic detection or chemical analysis, which is not only time-consuming and labor-intensive, but also destructive and difficult to meet the needs of industrial production. Near-infrared spectroscopy technology has been widely used in fiber identification due to its pollution-free, low-cost and short detection cycle. However, the high dimensionality and collinearity of spectral data, as well as the limited number of spectral peaks, lead to the existence of irrelevant feature variables. Traditional methods fail to effectively combine spectral noise reduction with feature selection, resulting in inaccurate classification results. Therefore, there is an urgent need for an efficient method that combines noise reduction and feature extraction to improve the recognition performance of cashmere and wool. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a cashmere and wool identification method based on orthogonal matching pursuit in view of the deficiencies in the above-mentioned prior art. The method has a simple structure and a reasonable design. The near-infrared spectral matrix is subjected to singular value decomposition, and only the first k singular values and their corresponding singular vectors are retained to form a compressed spectral matrix. The spectral matrix is sparsely reconstructed based on orthogonal matching pursuit to further enhance the distinction between cashmere and wool fibers. A classification model is constructed based on the SVM model to solve the binary classification problem of cashmere samples and wool samples.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is: a cashmere wool identification method based on orthogonal matching pursuit, characterized in that it includes the following steps:
[0008] Step 1: The near infrared spectrum data set includes multiple near infrared spectrum matrices, and the multiple near infrared spectrum matrices are composed of multiple wool near infrared spectrum matrices and multiple cashmere near infrared spectrum matrices;
[0009] Step 2: Perform singular value decomposition on each near-infrared spectrum matrix X to obtain the spectrum matrix X k ;
[0010] Step 3: Orthogonal matching pursuit for the spectral matrix X k Perform sparse reconstruction and iteratively update the residual r j+1 , when the stop condition a or b is reached, the iteration stops, and the reconstructed signal of each sample is obtained after the iteration is completed
[0011] Stop condition a: sparse coefficient vector α Λ The number of non-zero elements in reaches the sparsity threshold;
[0012] Stop condition b: satisfied in Represents the current residual r j+1 Energy, E0 represents the energy of the initial residual r0, Γ2 represents the contribution rate threshold;
[0013] Step 4: Repeat steps 2 and 3 to obtain the reconstructed signal of each near-infrared spectral matrix Multiple reconstruction signals Divide into training set and test set;
[0014] Step 5: Build a classification model and obtain a tested classification model based on the training set and the test set;
[0015] Step 6: Obtain the fiber sample to be tested, use steps 2 and 3 to obtain the reconstructed signal of the fiber sample to be tested, input the reconstructed signal of the fiber sample to be tested into the tested classification model, and the tested classification model outputs the classification result that the fiber sample to be tested belongs to cashmere or wool.
[0016] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that: the specific method of "performing singular value decomposition on each near-infrared spectrum matrix X" in step 2 is:
[0017] Step 201: Perform singular value decomposition on the collected near-infrared spectrum matrix X, X = U·R·V T , where U represents the component of the signal in the sample space, V T Represents the component of the signal in wavelength space, V T is the transposed matrix of matrix V, R represents the singular values σ of matrix X i The diagonal matrix formed, 1≤i≤h, h represents a positive integer, U and V are both orthogonal matrices;
[0018] Step 202: Select Γ k , so that Γ k ≥Γ set , where Γ k represents the cumulative contribution rate of the first k singular values, γ i represents the i-th singular value σ i The contribution rate,
[0019] Step 203: Retain the first k singular values, reconstruct the diagonal matrix R', take the first k columns of the matrix U and the first k columns of the matrix V, and obtain the matrices U and V respectively. k and the matrix V k , the spectral matrix after singular value decomposition is completed
[0020] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that: in step 3, "the spectrum matrix X k The specific method of "sparse reconstruction" is:
[0021] Step 301, initialization: Initialize residual r0 = X k , initialize the sparse coefficient vector α, α = 0, initialize the index set Λ, Dictionary matrix D = [d1, d2, ..., d n ], each column of the dictionary matrix D is an atom, 1≤j≤n;
[0022] Step 302, select iterative atoms: calculate each atom d in the dictionary matrix D j With the current residual rj The inner product of Choose The corresponding atom d p , the atom d p The index of is added to the index set Λ;
[0023] Step 303: Update the index set Λ and the dictionary matrix D;
[0024] Step 304, update the residual: the new residual r j+1 =X k -D Λ α Λ , where D Λ Represents the matrix consisting of the columns corresponding to the index set Λ in the dictionary D, and uses the least squares method to calculate the sparse coefficient vector α Λ , At this time, the reconstructed signal
[0025] Step 305, determine whether the stop condition a or the stop condition b is met, if so, proceed to step 307, otherwise proceed to step 306;
[0026] Step 306, repeating steps 302 to 305;
[0027] Step 307: Stop iteration.
[0028] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that: the specific method of "constructing a classification model and obtaining a tested classification model based on a training set and a test set" in step 5 is:
[0029] Step 501: construct a classification model based on the SVM model, and set the kernel function and regularization parameter C of the classification model;
[0030] Step 502: label the reconstructed signal of the training set, and use the training set to train the classification model to obtain a trained classification model;
[0031] Step 503: Run the trained classification model on the test set, calculate the performance index of the classification model, and save the tested classification model.
[0032] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that the kernel function of the classification model is a radial basis kernel function.
[0033] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that: the loss function of the classification model in represents the regularization term, represents the sum of the hinge loss function, w T xi +b represents the predicted value of the classification model for the i-th sample, y i represents the actual label of the i-th sample, y i = +1 means the i-th sample is a cashmere sample, y i = -1 indicates that the i-th sample is a wool sample, w is the weight vector of the classification model, x i represents the reconstructed signal of the i-th sample, b represents the bias term, and C represents the regularization parameter.
[0034] The cashmere wool identification method based on orthogonal matching pursuit is characterized by:
[0035] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that: the specific collection method of the "multiple near-infrared spectral matrices" in step 1 is: the wool fiber sample and the cashmere fiber sample are scanned separately by a near-infrared spectrometer, the parameters of the near-infrared spectrometer are set, the scanning wavelength range is 1000-2500nm, the wavenumber resolution is set to 1cm-1, and each scan is set to scan the front and back sides of the fiber and take the average spectrum.
[0036] The cashmere wool identification method based on orthogonal matching pursuit is characterized in that: in step 4, "multiple reconstructed signals are The specific method of "dividing into training set and test set" is: multiple reconstructed signals Randomly divide the data into z parts, and take z-1 parts as training sets and 1 part as test sets in turn.
[0037] Compared with the prior art, the present invention has the following advantages:
[0038] 1. The invention has a simple structure, reasonable design, and is easy to implement and operate.
[0039] 2. The present invention performs singular value decomposition on the near-infrared spectral matrix, retains only the first k singular values and their corresponding singular vectors, obtains a reconstructed diagonal matrix, and constitutes a compressed spectral matrix, thereby achieving the purpose of reducing the dimension of the data and extracting the main features.
[0040] 3. The present invention performs sparse reconstruction of the spectral matrix based on orthogonal matching pursuit, extracts the characteristic peak position information of cashmere and wool, and further enhances the distinction between the two fibers.
[0041] 4. The iteration stop conditions of the present invention include stop condition a and stop condition b. Stop condition a is based on a sparsity threshold, and stop condition b is based on a contribution rate threshold.
[0042] 5. The present invention constructs a classification model based on the SVM model to solve the binary classification problem of cashmere samples and wool samples.
[0043] In summary, the present invention has a simple structure and a reasonable design. It performs singular value decomposition on the near-infrared spectral matrix and only retains the first k singular values and their corresponding singular vectors to form a compressed spectral matrix. It performs sparse reconstruction on the spectral matrix based on orthogonal matching pursuit to further enhance the distinction between cashmere and wool fibers. It also constructs a classification model based on the SVM model to solve the binary classification problem of cashmere samples and wool samples.
[0044] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 The figure is a flow chart of the method of the present invention.
[0046] Figure 2 This is a flow chart of the sparse reconstruction method of the present invention.
[0047] Figure 3 This is a comparison chart of cashmere and wool samples of the present invention.
[0048] Figure 4 These are the near infrared spectra of cashmere fiber samples and wool fiber samples. DETAILED DESCRIPTION
[0049] The method of the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments of the present invention.
[0050] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0051] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0053] For ease of description, spatially relative terms such as "above", "above", "on the upper surface of", "above", etc. may be used here to describe the spatial positional relationship between a device or feature and other devices or features as shown in the figure. It should be understood that spatially relative terms are intended to include different orientations of the device in use or operation in addition to the orientation described in the figure. For example, if the device in the accompanying drawings is inverted, the device described as "above other devices or structures" or "above other devices or structures" will be positioned as "below other devices or structures" or "below other devices or structures". Thus, the exemplary term "above" can include both "above" and "below". The device can also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatially relative descriptions used here are interpreted accordingly.
[0054] like Figure 1 and Figure 2 As shown, a cashmere wool identification method based on orthogonal matching pursuit of the present invention comprises the following steps:
[0055] Step 1: The near infrared spectral data set includes multiple near infrared spectral matrices, and the multiple near infrared spectral matrices are composed of multiple wool near infrared spectral matrices and multiple cashmere near infrared spectral matrices.
[0056] When collecting near-infrared spectral data, we first need to collect wool fiber samples and cashmere fiber samples from different brands and origins to ensure the diversity and representativeness of the samples, remove the hair foam and surface impurities of the samples, and construct effective samples. Figure 3 As shown, Figure 3 a is a cashmere sample, Figure 3 b is a wool sample.
[0057] The near-infrared spectrum matrix is obtained by scanning wool fiber samples and cashmere fiber samples with a near-infrared spectrometer. The near-infrared spectrum matrix can reflect the absorption characteristics of wool fiber samples and cashmere fiber samples in the near-infrared spectrum region. In the near-infrared spectrum region, the vibration of hydrogen-containing groups in organic molecules will produce absorption of the combined frequency and various harmonic frequencies. When the near-infrared light of the near-infrared spectrometer is irradiated onto the sample, these hydrogen-containing groups will absorb light that matches their vibration frequency, thereby producing a specific absorption spectrum. By analyzing the optical density of the transmitted or reflected light through the detector, the near-infrared spectrum matrix of the wool fiber sample and the cashmere fiber sample can be obtained respectively. The near-infrared spectrum matrix is usually expressed as a series of absorbance or reflectance values corresponding to wavelengths.
[0058] The wool fiber samples and cashmere fiber samples were scanned by near-infrared spectrometer, and the parameters of the near-infrared spectrometer were set. The scanning wavelength range was 1000-2500nm, the wave number resolution was set to 1cm-1, and each scan was set to scan the front and back sides of the fiber and take the average spectrum to ensure the accuracy of the spectral data. The sample was placed on the sample table to ensure full contact with the table surface and to ensure that the fiber had a certain thickness and no light leakage occurred. The reflectance spectrum data was collected using an integrating sphere accessory.
[0059] In this embodiment, 50 wool fiber samples and 50 cashmere fiber samples are used to form a sample set. Figure 3 a is one of the cashmere fiber samples. Figure 3 b is one of the wool fiber samples. Ten spectral data were collected from each sample by near infrared spectrometer. Figure 4 As shown, in the 2200 nm band region, from top to bottom are the spectral data of the first cashmere sample, the second cashmere sample, the first wool sample and the second wool sample.
[0060] Step 2: Perform singular value decomposition on each near-infrared spectrum matrix X to obtain the spectrum matrix X k .
[0061] The specific method is:
[0062] Step 201: Perform singular value decomposition on the collected near-infrared spectrum matrix X, X = U·R·V T , where U represents the component of the signal in the sample space, V T Represents the component of the signal in wavelength space, V T is the transposed matrix of matrix V, R represents the singular values σ of matrix X i The diagonal matrix formed is 1≤i≤h, h represents a positive integer, and U and V are both orthogonal matrices.
[0063] Any m×n matrix can be expressed as the product of three matrices through factor decomposition, namely, an m-order orthogonal matrix, an m×n diagonal matrix composed of diagonal elements, and an n-order orthogonal matrix, which is called the singular value decomposition of the matrix. In this embodiment, U and V are both orthogonal matrices, R represents a diagonal matrix, and the elements on the diagonal are singular values σ i , singular value σ i Indicates the magnitude of the signal component energy.
[0064] Step 202: Select Γ k , so that Γ k ≥Γ set , where Γ k represents the cumulative contribution rate of the first k singular values, γ i represents the i-th singular value σ i The contribution rate, Γ set Indicates the cumulative contribution rate threshold.
[0065] It should be noted that the singular value σ i Usually they are arranged in descending order. If not, when calculating the cumulative contribution rate, first calculate the singular value σ i Sort in descending order. Then calculate the cumulative contribution rate of the first k singular values.
[0066] The contribution rate of singular values can be used to evaluate the important components of the signal. If the cumulative contribution rate Γ k When the cumulative contribution rate reaches a higher level, such as 90%, it can be considered that the main information of the near-infrared spectrum matrix X has been retained, while the secondary information, including data details and noise, has been ignored. Therefore, different cumulative contribution rate thresholds Γ are set. set , according to the cumulative contribution rate of singular values Γ k By selecting the number of singular values to be retained, different degrees of detail features can be retained to achieve the purpose of reducing the dimension of the data and extracting the main features.
[0067] Step 203: Retain the first k singular values, reconstruct the diagonal matrix R', take the first k columns of the matrix U and the first k columns of the matrix V, and obtain the matrices U and V respectively. k and the matrix V k , the spectral matrix after singular value decomposition is completed
[0068] In one possible embodiment, the first k singular values are retained, and the other singular values are set to 0, and the diagonal matrix S is compressed, which only removes details or noise, has no effect on the information characteristics, and will not affect the understanding of the near-infrared spectrum matrix of the fiber sample.
[0069] Only the first k singular values and their corresponding singular vectors are retained to obtain the reconstructed diagonal matrix R'. The reconstructed diagonal matrix R' and the matrix U k and the matrix V k Construct the compressed spectrum matrix X k , achieving the purpose of reducing the dimension of the data and extracting the main features, significantly improving the effectiveness of the spectral data and reducing the computational complexity of the model.
[0070] Step 3: Orthogonal matching pursuit for the spectral matrix X k Perform sparse reconstruction and iteratively update the residual r j+1 , when the stop condition a or b is reached, the iteration stops, and the reconstructed signal of each sample is obtained after the iteration is completed
[0071] Stop condition a: sparse coefficient vector α Λ The number of non-zero elements in reaches the sparsity threshold;
[0072] Stop condition b: satisfied in Represents the current residual r j+1 , E0 represents the energy of the initialization residual r0, and Γ2 represents the contribution rate threshold.
[0073] In actual use, for the spectral matrix X after singular value decomposition k Sparse reconstruction can extract core features from less spectral data, extract characteristic peak information of cashmere and wool, and further strengthen the distinction between the two fibers. The reconstructed signal is closer to the original signal, further improving the fidelity of the spectral peak features, and thus enhancing the performance of the classifier. It effectively alleviates the impact of insufficient sample data on model performance, which is particularly important for practical applications where sample acquisition is difficult and the number of samples is limited.
[0074] In the near-infrared spectral data processing, the sparse reconstruction algorithm can automatically select a few variables or bands related to the characteristic peak position, thereby realizing the extraction of the characteristic peak position. It should be noted that the bands related to the characteristic peak position include the 1000nm-1300nm band; the 1301nm-1600nm band; the 1601nm-1900nm band; the 1901nm-2200nm band; and the 2200nm-2500nm band.
[0075] The 1000nm-1300nm band mainly contains characteristic peaks related to lipids and fatty acids. There are differences in lipid content between cashmere fibers and wool fibers. The 1301nm-1600nm band mainly contains absorption peaks related to amino and amine groups of proteins. There are slight differences in the expression of proteins between cashmere fibers and wool fibers. The 1601nm-1900nm band contains absorption peaks related to OH bonds and NH bonds. The moisture content of cashmere fibers and wool fibers is different, and there are different manifestations in the spectrum of this band. Through this band, the difference information related to moisture and amino acid content can be captured. The 1901nm-2200nm band mainly involves absorption peaks related to C=O and OH stretching vibrations. These peaks are usually related to carbonyl and amino acid side chains in proteins, and are also related to trace lipids and moisture in fibers. The absorption peaks in this section are crucial for further refining the differences in protein structure between wool and cashmere, and can enhance the discrimination ability of the model. The absorption of the 2200nm-2500nm band is mainly related to the NH and OH bonds in amino acids, and also includes some characteristic peaks related to the vibration of the polypeptide chain backbone. This band can capture deeper structural information of cashmere and wool fiber proteins, especially the vibration characteristics of certain trace components. By including this band, more complex amino acids and their side chain structural differences in the fiber can be identified.
[0076] Therefore, in sparse reconstruction, by selecting an appropriate sparse representation basis, the characteristic peaks in the near-infrared spectrum matrix are represented as a linear combination of a few basis functions, thereby retaining the important features of the original data. k The specific method of "sparse reconstruction" is:
[0077] Step 301, initialization: Initialize residual r0 = X k , initialize the sparse coefficient vector α, α = 0, initialize the index set Λ, Dictionary matrix D = [d1, d2, ..., d n ], each column of the dictionary matrix D is an atom, 1≤j≤n;
[0078] Step 302, select iterative atoms: calculate each atom d in the dictionary matrix D j With the current residual r j The inner product of Choose The corresponding atom d p , the atom d p The index of is added to the index set Λ. By selecting the index with the current residual r in each iteration j The most relevant atom d j To gradually build a sparse representation, these selected atoms d jTogether they form an index set Λ, the linear combination of which can approximate the original signal X k .
[0079] Step 303: Update the index set Λ and the dictionary matrix D;
[0080] Step 304, update the residual: the new residual r j+1 =X k -D Λ α Λ , where D Λ Represents the matrix consisting of the columns corresponding to the index set Λ in the dictionary D, and uses the least squares method to calculate the sparse coefficient vector α Λ , At this time, the reconstructed signal
[0081] The improved orthogonal matching pursuit algorithm iteratively selects atoms d j And update the residual r j , the new residual r j+1 is obtained by converting the original signal X k Subtract the selected atom D Λ The linear combination is calculated so that the residual r j Gradually decrease, while ensuring that each selected atom d j Orthogonal to the atoms in the index set Λ, which ensures the stability and convergence of the algorithm and also makes the final sparse representation More accurate and efficient.
[0082] Step 305, determine whether the stop condition a or the stop condition b is met, if so, proceed to step 307, otherwise proceed to step 306;
[0083] Step 306, repeating steps 302 to 305;
[0084] Step 307: Stop iteration.
[0085] The stop condition a or stop condition b is specifically:
[0086] Stop condition a: sparse coefficient vector α Λ The number of non-zero elements in reaches the sparsity threshold.
[0087] Sparse coefficient vector α Λ The number of non-zero elements in reaches the sparsity threshold, indicating that the reconstructed signal is maintained. Therefore, in this embodiment, an improved orthogonal matching pursuit algorithm is used to construct a sparse representation by iteratively selecting the optimal basis function that best matches the current residual to reconstruct the signal. Each iteration will reduce the residual, and the new residual r j+1 =X k -D Λ α Λ , until the sparsity threshold is reached, the iteration stops.
[0088] Stop condition b: satisfied in Represents the current residual r j+1 , E0 represents the energy of the initialization residual r0, and Γ2 represents the contribution rate threshold.
[0089] In this embodiment,
[0090] The core idea of stopping iteration based on residual energy is that the current residual r j+1 Energy When it drops below the contribution rate threshold Γ2, it is considered that the iterative process is close enough to the original signal X k , the iteration can be stopped. In the comparison process, the energy E0 of the initial residual r0 is used as the energy The lowered benchmark is easy to calculate and has good application effect.
[0091] Step 4: Repeat steps 2 and 3 to obtain the reconstructed signal of each near-infrared spectral matrix Multiple reconstruction signals Divide into training set and test set.
[0092] In step 4, "multiple reconstructed signals The specific method of "dividing into training set and test set" is: multiple reconstructed signals Randomly divide the data into z parts, and take z-1 parts as training sets and 1 part as test sets in turn.
[0093] Reconstructing the signal Most of the coefficients are close to zero, and the number of non-zero coefficients is relatively small. This sparsity makes the reconstructed signal A lot of resources and time can be saved during processing and transmission.
[0094] Step 5: Construct a classification model, and obtain a tested classification model based on the training set and the test set. In this embodiment, the specific method of "constructing a classification model, and obtaining a tested classification model based on the training set and the test set" in step 5 is:
[0095] Step 501: construct a classification model based on the SVM model, set the kernel function and regularization parameter C of the classification model; in this embodiment, the kernel function of the classification model is a radial basis kernel function. Construct a classification model based on the SVM model to solve the binary classification problem of cashmere samples and wool samples.
[0096] Step 502: Label the reconstructed signal of the training set, use the training set to train the classification model, and obtain a trained classification model; use the training set and the selected kernel function to train the classification model. During the training process, the classification model based on the SVM model will find an optimal hyperplane to separate the cashmere sample from the wool sample.
[0097] Step 503: Run the trained classification model on the test set, calculate the performance index of the classification model, and save the tested classification model.
[0098] It should be noted that, in a possible embodiment, the performance indicator refers to accuracy. Accuracy is defined as the proportion of correctly classified samples among all samples. Accuracy is used to measure the overall performance of the classification model. The higher the accuracy, the stronger the classification ability of the model.
[0099] Step 6: Obtain the fiber sample to be tested, use steps 2 and 3 to obtain the reconstructed signal of the fiber sample to be tested, input the reconstructed signal of the fiber sample to be tested into the tested classification model, and the tested classification model outputs the classification result that the fiber sample to be tested belongs to cashmere or wool.
[0100] In one possible embodiment, the loss function of the classification model is in represents the regularization term, represents the sum of the hinge loss function, which measures the accuracy and error of the model in classifying samples. i Indicates the actual label of the i-th sample, usually with a value of +1 or -1, used to indicate the category of the sample. i = +1 means the i-th sample is a cashmere sample, y i = -1 indicates that the i-th sample is a wool sample. T x i +b represents the predicted value of the classification model for the i-th sample, w is the weight vector of the classification model, and x i represents the reconstructed signal of the i-th sample, b represents the bias term, and C represents the regularization parameter.
[0101] In this embodiment, singular value decomposition is performed on the near-infrared spectral matrix, and only the first k singular values and their corresponding singular vectors are retained to form a compressed spectral matrix; the spectral matrix is sparsely reconstructed based on orthogonal matching pursuit to further enhance the distinction between cashmere and wool fibers; and a classification model is constructed based on the SVM model to solve the binary classification problem of cashmere samples and wool samples.
[0102] The above description is only an embodiment of the present invention and does not limit the present invention in any way. Any simple modification, change and equivalent structural change made to the above embodiment based on the technical essence of the present invention still falls within the protection scope of the technical solution of the present invention.
Claims
1. A cashmere wool identification method based on orthogonal matching pursuit, characterized in that: The following steps are involved: Step 1: The near infrared spectrum data set includes multiple near infrared spectrum matrices, and the multiple near infrared spectrum matrices are composed of multiple wool near infrared spectrum matrices and multiple cashmere near infrared spectrum matrices; Step 2: Perform singular value decomposition on each near-infrared spectrum matrix X to obtain the spectrum matrix X k ; Step 3: Orthogonal matching pursuit for the spectral matrix X k Perform sparse reconstruction and iteratively update the residual r j+1 , when the stop condition a or b is reached, the iteration stops, and the reconstructed signal of each sample is obtained after the iteration is completed Stop condition a: sparse coefficient vector α Λ The number of non-zero elements in reaches the sparsity threshold; Stop condition b: satisfied in Represents the current residual r j+1 The energy of, E0 represents the energy of the initial residual r0, Γ2 represents the contribution rate threshold; Step 4: Repeat steps 2 and 3 to obtain the reconstructed signal of each near-infrared spectral matrix Multiple reconstruction signals Divide into training set and test set; Step 5: Build a classification model and obtain a tested classification model based on the training set and the test set; Step 6: Obtain the fiber sample to be tested, use steps 2 and 3 to obtain the reconstructed signal of the fiber sample to be tested, input the reconstructed signal of the fiber sample to be tested into the tested classification model, and the tested classification model outputs the classification result that the fiber sample to be tested belongs to cashmere or wool.
2. The cashmere wool identification method based on orthogonal matching pursuit according to claim 1, characterized in that: The specific method of "performing singular value decomposition on each near-infrared spectrum matrix X" in step 2 is: Step 201: Perform singular value decomposition on the collected near-infrared spectrum matrix X, X = U·R·V T , where U represents the component of the signal in the sample space, V T Represents the component of the signal in wavelength space, V T is the transposed matrix of matrix V, R represents the singular values σ of matrix X i The diagonal matrix formed, 1≤i≤h, h represents a positive integer, U and V are both orthogonal matrices; Step 202: Select Γ k , so that Γ k ≥Γ set , where Γ k represents the cumulative contribution rate of the first k singular values, γ i represents the i-th singular value σ i The contribution rate, Step 203: Retain the first k singular values, reconstruct the diagonal matrix R', take the first k columns of the matrix U and the first k columns of the matrix V, and obtain the matrices U and V respectively. k and the matrix V k , the spectral matrix after singular value decomposition is completed 3. The cashmere wool identification method based on orthogonal matching pursuit according to claim 1, characterized in that: In step 3, "spectral matrix X k The specific method of "sparse reconstruction" is: Step 301, initialization: Initialize residual r0 = X k , initialize the sparse coefficient vector α, α = 0, initialize the index set Λ, Dictionary matrix D = [d1, d2, ..., d n ], each column of the dictionary matrix D is an atom, 1≤j≤n; Step 302, select iterative atoms: calculate each atom d in the dictionary matrix D j With the current residual r j The inner product of Choose The corresponding atom d p , the atom d p The index of is added to the index set Λ; Step 303: Update the index set Λ and the dictionary matrix D; Step 304, update the residual: the new residual r j+1 =X k -D Λ α Λ , where D Λ Represents the matrix composed of columns corresponding to the index set Λ in the dictionary D, and uses the least squares method to calculate the sparse coefficient vector α Λ , At this time, the reconstructed signal Step 305, determine whether the stop condition a or the stop condition b is met, if so, proceed to step 307, otherwise proceed to step 306; Step 306, repeating steps 302 to 305; Step 307: Stop iteration.
4. The cashmere wool identification method based on orthogonal matching pursuit according to claim 1, characterized in that: The specific method of "building a classification model and obtaining a tested classification model based on the training set and the test set" in step 5 is: Step 501: construct a classification model based on the SVM model, and set the kernel function and regularization parameter C of the classification model; Step 502: label the reconstructed signal of the training set, and use the training set to train the classification model to obtain a trained classification model; Step 503: Run the trained classification model on the test set, calculate the performance index of the classification model, and save the tested classification model.
5. The cashmere wool identification method based on orthogonal matching pursuit according to claim 4, characterized in that: The kernel function of the classification model is the radial basis kernel function.
6. The cashmere wool identification method based on orthogonal matching pursuit according to claim 4, characterized in that: Loss function for classification models in represents the regularization term, represents the sum of the hinge loss function, w T x i +b represents the predicted value of the classification model for the i-th sample, y i represents the actual label of the i-th sample, y i = +1 means the i-th sample is a cashmere sample, y i = -1 indicates that the i-th sample is a wool sample, w is the weight vector of the classification model, x i represents the reconstructed signal of the i-th sample, b represents the bias term, and C represents the regularization parameter.
7. The cashmere wool identification method based on orthogonal matching pursuit according to claim 1, characterized in that:
8. The cashmere wool identification method based on orthogonal matching pursuit according to claim 1, characterized in that: The specific collection method of "multiple near-infrared spectral matrices" in step 1 is: scan the wool fiber sample and the cashmere fiber sample separately through the near-infrared spectrometer, set the parameters of the near-infrared spectrometer, the scanning wavelength range is 1000-2500nm, the wavenumber resolution is set to 1cm-1, and each scan is set to scan the front and back sides of the fiber and take the average spectrum.
9. The cashmere wool identification method based on orthogonal matching pursuit according to claim 1, characterized in that: In step 4, "multiple reconstructed signals The specific method of "dividing into training set and test set" is: multiple reconstructed signals Randomly divide the data into z parts, and take z-1 parts as training sets and 1 part as test sets in turn.
Citation Information
Cited By
Laser acceleration tabulation method
CN121597874A
A laser acceleration watchmaking method
CN121597874B