A fabric image defect classification method and system based on improved LDA-GSVD

By adding intra-class and inter-class scattering matrix of local geometric information to the LDA-GSVD method, combined with an improved linear discriminant analysis model and KNN classifier, the problems of low accuracy and low computational efficiency in fabric image defect classification are solved, and the problem of low accuracy and low computational efficiency is realized. Efficient fabric image defect classification.

CN113887600BActive Publication Date: 2024-12-13ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111126929.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-26
Publication Date
2024-12-13
Estimated Expiration
2041-09-26

AI Technical Summary

Technical Problem

The existing LDA-GSVD method lacks consideration of local information in fabric image defect classification, resulting in low classification accuracy, especially in high-dimensional small sample problems.

Method used

By redefining the intra-class scattering matrix and the inter-class scattering matrix, adding local geometric information, combining the LDA-GSVD algorithm, the increased intra-class scattering matrix SW and the inter-class scattering matrix SB are calculated, and the improved linear discriminant analysis model and KNN classification are used. The device improves classification accuracy.

Benefits of technology

It effectively improves the accuracy of fabric image defect classification, solves the problem of high-dimensionality of small samples, enhances the consideration of local geometric information, and achieves fast and accurate classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113887600B_ABST
    Figure CN113887600B_ABST
Patent Text Reader

Abstract

The present invention discloses a fabric image defect classification method and system based on improved LDA-GSVD. The method comprises: S1, extracting features from fabric images to obtain feature matrix X and label matrix H; S2, randomly dividing data set samples into labeled training samples X train and labeled test samples X test ; S3, using the inter-class discrete weight coefficient and the intra-class compact weight coefficient, calculate the intra-class scattering matrix S after adding local geometric information W and the inter-class scattering matrix S B ; S4, use the redefined #imgabs0# and #imgabs1# to get the matrix pair of #imgabs2# and #imgabs3# required by GSVD; S5, get the optimal projection matrix W through the improved linear discriminant analysis model, and transform the test sample X test Y is obtained by projecting the matrix W to the new subspace, and the KNN classifier is used to confirm the test set sample label. The present invention can solve the problems of lack of local geometric information and small sample high dimension in traditional LDA, and effectively improve the accuracy and efficiency of fabric image defect classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of textile defect classification methods, and in particular relates to a fabric image defect classification method and system based on an improved LDA-GSVD. Background Art

[0002] Since the Fisher criterion was proposed in 1936, it has set off a research boom in the field of pattern recognition. Linear discriminant analysis (LDA) is mainly used for feature extraction and dimensionality reduction. Its core idea is to find a projection vector or projection space in the original space and classify the samples after projecting them to the new space. As a supervised learning method, LDA has good discrimination ability, but LDA focuses on global information and lacks grasp of local information. Secondly, when faced with high-dimensional small sample problems, s B w=λs w The solution for w exists s w Irreversible situation. Although the LDA-GSVD solves the problem of high-dimensional small samples, the problem that LDA only considers global information still exists. In addition, fabric image defect classification is a challenging task in image classification. The defect distinction of fabric images is not obvious, and the potential local structure of features cannot be ignored.

[0003] Therefore, an LDA-GSVD method that adds local geometric information is needed to improve the accuracy of fabric image defect classification. Summary of the invention

[0004] In view of the above-mentioned status quo of the prior art, the present invention provides a fabric image defect classification method and system based on improved LDA-GSVD (GSVD is generalized singular value decomposition). Fabric defect images need to focus on local features, and traditional LDA pays more attention to the consideration of global information. The present invention retains the global information while adding consideration of local geometric information to improve the accuracy of the method. At the same time, the LDA-GSVD algorithm is used to solve the small sample high-dimensional problem and speed up the calculation speed.

[0005] The technical solution adopted by the present invention redefines the intra-class scattering matrix and the inter-class scattering matrix to classify different defects in fabric images. A fabric image defect classification method based on improved LDA-GSVD specifically includes the following steps:

[0006] S1, randomly extract N fabric images for feature extraction to obtain feature matrix X and label matrix H;

[0007] S2. Randomly divide the data set samples into labeled training samples X train and labeled test samples X test ;

[0008] S3. Using the inter-class discrete weight coefficient W j,q ' and the intra-class compact weight coefficient α j , calculate the intra-class scattering matrix S after adding local geometric information W and the inter-class scattering matrix S B ;

[0009] S4. Using the redefined and Get what GSVD needs and , to solve the problem of small sample and high dimension;

[0010] S5. The optimal projection matrix W is obtained through the improved linear discriminant analysis model, and the test sample X test Y is obtained by projecting the matrix W to the new subspace, and the KNN classifier is used to confirm the test set sample labels.

[0011] The linear discriminant analysis model in S5 is constructed through steps S3 and S4. The objective function of the original LDA algorithm model is: After Improvement There are two optimization processes: using Lagrangian calculation or taking the sum of the matrix diagonals, that is, the sum of the eigenvalues. The target model becomes trace is the trace of the matrix, which is the sum of the eigenvalues.

[0012] As a preferred solution, in step S1, a fabric image data set is created in MATLAB, and features of N fabric images are extracted using a gray-level co-occurrence matrix and a gradient direction histogram to obtain an N×n feature matrix X, and an N×1 label matrix H is created.

[0013] As a preferred solution, in step S2, the training sample X train ={(x1,y1);(x2,y2)K(x m ,y m )},x i is a 1×n dimensional vector with m samples in total. k is the number of categories, y i ∈{1,2...k}, is the set of samples of the jth class, N j (j=1,2...k) is the number of samples in the jth category.

[0014] As a preferred solution, in step S3, α j and Specifically include:

[0015] S3.1, let x j,p and x j,m For the p-th sample and the m-th sample of the j-th class sample, the intra-class aggregation degree is defined as Q{j}, which is expressed as:

[0016]

[0017] S3.2, N j The number of samples in the jth class is known, and there are k classes in total. The intra-class aggregation degree of class k is defined as:

[0018]

[0019] S3.3, taking the mean of the cohesion of the k classes as the criterion, the judgment standard is Let the compact weight coefficient within the class be α j , α i is determined by judging the size of Q{j} and mean, that is:

[0020] Q{j}>mean;α j =1, Q{j}≤mean

[0021] S3.4. Improved intra-class scattering matrix after adding intra-class compact weight coefficient

[0022]

[0023] Q{j}>mean;α j =1, Q{j}≤mean

[0024] As a preferred solution, in step S3, j,q 'and Specifically include:

[0025] S3.5. Using W j,q Represents the similarity between class j and class q. The greater the similarity, the smaller the difference between classes. According to the similarity formula:

[0026]

[0027] The sample mean of the jth class can be calculated using express, u j and u q Both are 1×m matrices. σ is a custom parameter.

[0028] S3.6, apply a discriminant criterion to determine the discrete weight coefficients between different classes, G∈R k×k , W mean is the overall mean of the similarity matrix G:

[0029] W j,q '=Wmean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0030] S3.7. Improved inter-class scattering matrix obtained by adding inter-class discrete weight coefficients

[0031]

[0032] As a preferred solution, step S4 specifically includes:

[0033] S4.1. Obtained through S3 and Expressed as as well as

[0034] S4.2. According to the matrix required by GSVD Perform singular value decomposition on the matrix pair

[0035] S4.3. From the SVD decomposition of M(1:k,1:t), M(1:k,1:t)=U∑ A L T , find L;

[0036] S4.4. Calculation

[0037] S4.5. Take the first k-1 columns of Z and denote them as W∈R n×(k-1) , W is the required projection matrix.

[0038] As a preferred solution, in step S5, according to the projection matrix W obtained in S4, the test sample X test Project to the new subspace, that is, Y = X test ×W, the labels of the test set samples estimated by the KNN classifier are compared with the true labels of the test set to obtain the accuracy of the classification results.

[0039] The present invention also discloses a fabric image defect classification system based on improved LDA-GSVD, which comprises the following modules:

[0040] The fabric image feature extraction module randomly extracts N fabric images for feature extraction to obtain the feature matrix X and the label matrix H;

[0041] The sample classification module randomly divides the feature matrix X into labeled training samples X trainand labeled test samples X test ;

[0042] Redefine the module and use the inter-class discrete weight coefficient W j,q ' and the intra-class compact weight coefficient α j , calculate the intra-class scattering matrix S after adding local geometric information W and the inter-class scattering matrix S B ;

[0043] Computational modules, using the redefined and Get what GSVD needs and Matrix pairs of ;

[0044] The output module obtains the optimal projection matrix W through the improved linear discriminant analysis model and transforms the test sample X test Y is obtained by projecting the matrix W to the new subspace, and the KNN classifier is used to confirm the test set sample labels.

[0045] Preferably, in the fabric image feature extraction module, a fabric image data set is created in MATLAB, features are extracted from N fabric images using a gray-level co-occurrence matrix and a gradient direction histogram to obtain an N×n feature matrix X, and an N×1 label matrix H is created.

[0046] Preferably, in the sample classification module, the training sample X train ={(x1,y1);(x2,y2)K(x m ,y m )},x i is a 1×n dimensional vector with a total of m samples; k is the number of categories, y i ∈{1,2...k}, is the set of samples of the jth class, N j (j=1,2...k) is the number of samples in the jth category.

[0047] Preferably, redefine the module α j and Specifically include:

[0048] Let x j,p and x j,m For the p-th sample and the m-th sample of the j-th class sample, the intra-class aggregation degree is defined as Q{j}, which is expressed as:

[0049]

[0050] N j The number of samples in the jth class is known, and there are k classes in total; the intra-class aggregation degree of class k is defined as:

[0051]

[0052] Taking the mean of the cohesion of k classes as the criterion, the judgment standard is Let the compact weight coefficient within the class be α j , α i is determined by judging the size of Q{j} and mean, that is:

[0053] Q{j}>mean;α j =1, Q{j}≤mean

[0054] The improved intra-class scattering matrix is ​​obtained by adding the intra-class compact weight coefficient

[0055]

[0056] Q{j}>mean;α j =1, Q{j}≤mean

[0057] Redefine W in the module j,q 'and Specifically include:

[0058] Using W j,q Represents the similarity between class j and class q. The greater the similarity, the smaller the difference between classes. According to the similarity formula:

[0059]

[0060] The sample mean of the jth class can be calculated using express, u j and u q All are 1×m matrices;

[0061] Apply a discriminant criterion to determine the discrete weight coefficients between different classes. G∈R k×k , W mean is the overall mean of the similarity matrix G:

[0062] W j,q '=W mean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0063] The improved inter-class scattering matrix is ​​obtained by adding the inter-class discrete weight coefficient

[0064]

[0065] Preferably, the calculation module specifically includes:

[0066] Obtained by redefining the module and Expressed as as well as

[0067] According to the matrix required by GSVD Perform singular value decomposition on the matrix pair

[0068] From the SVD decomposition of M(1:k,1:t), M(1:k,1:t)=U∑ A L T , find L;

[0069] calculate

[0070] Take the first k-1 columns of Z and denote them as W∈R n×(k-1) , W is the required projection matrix.

[0071] Preferably, in the output module, the test sample X is converted into test Project to the new subspace, that is, Y = X test ×W, the labels of the test set samples estimated by the KNN classifier are compared with the true labels of the test set to obtain the accuracy of the classification results.

[0072] The beneficial effects of the present invention are:

[0073] The present invention is based on the improved LDA-GSVD fabric image defect classification method, and uses the inter-class discrete weight coefficient and the intra-class compact weight coefficient to calculate the intra-class scattering matrix S after adding local geometric information. W and the inter-class scattering matrix S B , and uses the LDA-GSVD method to solve the problem of small number of fabric image samples and high feature dimension; at the same time, it enhances the consideration of local geometric information of the fabric, and can realize effective and accurate fabric image defect classification function. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 It is a flow chart of the fabric image defect classification method based on the improved LDA-GSVD of the present invention;

[0075] Figure 2The 12 types of 256×256 pixel fabric defect images to be detected by the improved LDA-GSVD fabric image defect classification method of the present invention are selected from the AITEX data set, which are broken end defect, broken weft defect, pilling, crease, knot defect, cotton particle, broken yarn, weft yarn curl, cut edge, warp yarn ball, pollution, and sparse weft.

[0076] Figure 3 This is a block diagram of the fabric image defect classification system based on the improved LDA-GSVD of the present invention. DETAILED DESCRIPTION

[0077] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, and the purpose and effects of the present invention will become more obvious.

[0078] like Figure 1 As shown, the specific implementation process of a fabric image defect classification method based on an improved LDA-GSVD in a preferred embodiment of the present invention is as follows:

[0079] In step S1, from the 12 types of 256×256 pixel fabric defect images to be detected, the same number of each is randomly selected, a total of N images, and the image size is adjusted to 64×64. The feature extraction is performed by the fusion method of GLCM (gray level co-occurrence matrix) and HOG (gradient oriented histogram), and the feature dimension is n, and an N×n feature matrix X is obtained, and an N×1 label matrix H is prepared;

[0080] In step S2, 70% of X and H obtained in step 1 are randomly selected as the training set X train , and the corresponding training set label is H train , the rest is the test set X test , the corresponding test set label is H test ;

[0081] Training sample X train ={(x1,y1);(x2,y2)K(x m ,y m )},x i is a 1×n dimensional vector with m samples in total. k is the number of categories, and in the specific example k is 12. i ∈{1,2...k}, is the set of samples of the jth class, N j (j=1,2...k) is the number of samples in the jth class, and the test sample X test ∈R (N-m)×n .

[0082] In step S3, the intra-class compactness weight coefficient α j and the redefined intra-class scattering matrix The specific steps include:

[0083] S3.1, let x j,p and x j,m For the p-th sample and the m-th sample of the j-th class sample, the intra-class aggregation degree is defined as Q{j}, which is expressed as:

[0084]

[0085] S3.2, N j The number of samples in the jth class is known, and there are k classes in total. The intra-class aggregation degree of class k is defined as:

[0086]

[0087] S3.3, taking the mean of the cohesion of the k classes as the criterion, the judgment standard is Let the compact weight coefficient within the class be α j , α i is determined by judging the size of Q{j} and mean, that is:

[0088] Q{j}>mean;α j =1, Q{j}≤mean

[0089] S3.4. Improved intra-class scattering matrix after adding intra-class compact weight coefficient

[0090]

[0091] Q{j}>mean;α j =1, Q{j}≤mean

[0092] After step S3.4, the inter-class discrete weight coefficient W j,q ' and the inter-class scattering matrix The specific steps include:

[0093] S3.5. Using W j,q Represents the similarity between class j and class q. The greater the similarity, the smaller the difference between classes. According to the similarity formula:

[0094]

[0095] The sample mean of the jth class can be calculated using express, u j and u q are all 1×m matrices. σ is set to 1e2.

[0096] S3.6, apply a discriminant criterion to determine the discrete weight coefficients between different classes, G∈R k ×k , W mean is the overall mean of the similarity matrix G:

[0097] W j,q '=W mean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0098] S3.7. Improved inter-class scattering matrix obtained by adding inter-class discrete weight coefficients

[0099]

[0100] W j,q '=W mean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0101] In step S4, the and It can be expressed as as well as

[0102] S4.1. In the specific implementation, The expression is:

[0103]

[0104] Q{j}>mean;α j =1, Q{j}≤mean(j=1Kk)

[0105] In specific implementation, The expression is:

[0106]

[0107] W j,q '=W mean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0108] According to the matrix required by GSVD Perform singular value decomposition on the matrix pair M∈R (k+m)×(k+m) ,P∈R n×n ,∑∈R (k+m)×n ;

[0109] S4.2, t is the rank of the matrix pair. From the SVD decomposition of M(1:k,1:t), we can calculate M(1:k,1:t)=U∑ A L T , U∈R k×k ,∑ A ∈R k×t , L∈R t×t Find L;

[0110] S4.3 Calculation P=[P1 P2],P1∈R n×t , P2∈R n ×(n-t) I n-t is the identity matrix of (nt)×(nt), ∑ t =∑(1:t,1:t), take the first k-1 columns of Z and denote them as W∈R n×(k-1) , W is the required projection matrix.

[0111] In step S5, the test sample X is transformed into test Project to the new subspace, that is, Y = X test ×W, project Y into the subspace and use the KNN classifier to estimate the labels of the test set samples and the true labels H of the test set test Compare and get the accuracy of the classification results.

[0112] In order to verify the performance of this classification method, the above method is used to perform the experimental process ten times. In each experimental process, 70% of the data set samples X are randomly selected as training samples. After ten times, the average value is taken as the final detection result. The experimental results are shown in Table 1. Compared with the LDA and LDA-GSVD methods, the linear discriminant analysis algorithm proposed in the present invention has the highest classification accuracy and good computational efficiency.

[0113] Table 1 Comparison of fabric image defect classification results of different methods

[0114] method LDA LDA-GSVD Method of the present invention Accuracy (%) 46.67 62.78 66.53 Time(s) 11.88 0.22 0.28

[0115] like Figure 3 As shown, the preferred embodiment of the present invention is a fabric image defect classification system based on improved LDA-GSVD, which specifically includes the following modules:

[0116] Fabric image feature extraction module, from the 12 types of 256×256 pixel fabric defect images to be detected, randomly select the same number of each, a total of N images, adjust the image size to 64×64, and extract features by fusion of GLCM (gray level co-occurrence matrix) and HOG (histogram of gradient orientation), the feature dimension is n, and obtain N×n feature matrix X, and make N×1 label matrix H;

[0117] The sample classification module randomly selects 70% of the X and H obtained by the fabric image feature extraction module as the training set X train , and the corresponding training set label is H train , the rest is the test set X test , the corresponding test set label is H test ;

[0118] Training sample X train ={(x1,y1);(x2,y2)K(x m ,y m )},x i is a 1×n dimensional vector with m samples in total. k is the number of categories, and in the specific example k is 12. i ∈{1,2...k}, is the set of samples of the jth class, N j (j=1,2...k) is the number of samples in the jth class, and the test sample X test ∈R (N-m)×n .

[0119] Redefine the module, the compact weight coefficient α within the class j and the redefined intra-class scattering matrix Specifically include:

[0120] Let x j,p and x j,m For the p-th sample and the m-th sample of the j-th class sample, the intra-class aggregation degree is defined as Q{j}, which is expressed as:

[0121]

[0122] N j The number of samples in the jth class is known, and there are k classes in total. The intra-class aggregation degree of class k is defined as:

[0123]

[0124] Taking the mean of the cohesion of k classes as the criterion, the judgment standard is Let the compact weight coefficient within the class be α j , α iis determined by judging the size of Q{j} and mean, that is:

[0125] Q{j}>mean;α j =1, Q{j}≤mean

[0126] The improved intra-class scattering matrix is ​​obtained by adding the intra-class compact weight coefficient

[0127]

[0128] Q{j}>mean;α j =1, Q{j}≤mean

[0129] After that, the inter-class discrete weight coefficient W j,q ' and the inter-class scattering matrix Specifically include:

[0130] Using W j,q Represents the similarity between class j and class q. The greater the similarity, the smaller the difference between classes. According to the similarity formula:

[0131]

[0132] The sample mean of the jth class can be calculated using express, u j and u q are all 1×m matrices. σ is set to 1e2.

[0133] Apply a discriminant criterion to determine the discrete weight coefficients between different classes. G∈R k×k , W mean is the overall mean of the similarity matrix G:

[0134] W j,q '=W mean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0135] The improved inter-class scattering matrix is ​​obtained by adding the inter-class discrete weight coefficient

[0136]

[0137] W j,q '=W mean , W j,q ≥Wmean ; W j,q '=W j,q , W j,q <W mean

[0138] Computational modules, obtained by redefining modules and It can be expressed as as well as

[0139] In specific implementation, The expression is:

[0140]

[0141] Q{j}>mean;α j =1, Q{j}≤mean(j=1Kk)

[0142] In specific implementation, The expression is:

[0143]

[0144] W j,q '=W mean , W j,q ≥W mean ; W j,q '=W j,q , W j,q <W mean

[0145] According to the matrix required by GSVD Perform singular value decomposition on the matrix pair M∈R (k+m)×(k+m) ,P∈R n×n ,∑∈R (k+m)×n ;

[0146] t is the rank of the matrix pair. From the SVD decomposition of M(1:k,1:t), we can calculate M(1:k,1:t)=U∑ A L T , U∈R k×k ,∑ A ∈R k×t , L∈R t×t Find L;

[0147] calculate P=[P1 P2],P1∈R n×t , P2∈R n×(n-t) I n-tis the identity matrix of (nt)×(nt), ∑ t =∑(1:t,1:t), take the first k-1 columns of Z and denote them as W∈R n×(k-1) , W is the required projection matrix.

[0148] The output module converts the test sample X into test Project to the new subspace, that is, Y = X test ×W, project Y into the subspace and use the KNN classifier to estimate the labels of the test set samples and the true labels H of the test set test Compare and get the accuracy of the classification results.

Claims

1. A fabric image defect classification method based on improved LDA-GSVD, characterized by The following steps are involved: S1, randomly extract N fabric images for feature extraction to obtain feature matrix X and label matrix H; S2, randomly divide the feature matrix X into labeled training samples X train and labeled test samples X test ; S3, using the inter-class discrete weight coefficient W j,q ' and the intra-class compact weight coefficient α j , calculate the intra-class scattering matrix S after adding local geometric information W and the inter-class scattering matrix S B ; S4, using the redefinition and Get what GSVD needs and Matrix pairs of ; S5. The optimal projection matrix W is obtained through the improved linear discriminant analysis model, and the test sample X test Get Y by projecting the matrix W to the new subspace, and use the KNN classifier to confirm the test set sample labels; α j and Specifically include: S3.1, let x j,p and x j,m For the p-th sample and the m-th sample of the j-th class sample, the intra-class aggregation degree is defined as Q{j}, which is expressed as: S3.2, N j The number of samples in the jth class is known, and there are k classes in total; the intra-class aggregation degree of class k is defined as: S3.3, taking the mean of the cohesion of the k classes as the criterion, the judgment standard is Let the compact weight coefficient within the class be α j , α i is determined by judging the size of Q{j} and mean, that is: S 3.

4. Improved intra-class scattering matrix obtained by adding intra-class compact weight coefficient a j =1,Q{j}≤mean W j,q 'and Specifically include: S3.

5. Using W j,q Represents the similarity between class j and class q. The greater the similarity, the smaller the difference between classes. According to the similarity formula: The sample mean of the jth class is express, u j and u q All are 1×m matrices; σ is a custom parameter; S3.6, apply a discriminant criterion to determine the discrete weight coefficients between different classes, G∈R k×k , W mean is the overall mean of the similarity matrix G: IN j,q '=W mean ,IN j,q ≥In mean ;IN j,q '=W j,q ,IN j,q <In mean S3.

7. Improved inter-class scattering matrix obtained by adding inter-class discrete weight coefficients IN j,q '=W mean ,IN j,q ≥In mean ;IN j,q '=W j,q ,IN j,q <In mean Step S4 specifically includes: S4.

1. Obtained through and Expressed as as well as S4.

2. According to the matrix required by GSVD Perform singular value decomposition on the matrix pair S4.

3. From the SVD decomposition of M(1:k,1:t), M(1:k,1:t)=U∑ A L T , find L; S4.

4. Calculation S4.

5. Take the first k-1 columns of Z and denote them as W∈R n×(k-1) , W is the required projection matrix.

2. The fabric image defect classification method based on improved LDA-GSVD according to claim 1 is characterized in that: In step S1, a fabric image dataset is created in MATLAB, and features of N fabric images are extracted through gray-level co-occurrence matrix and gradient direction histogram to obtain an N×n feature matrix X, and an N×1 label matrix H is created.

3. The fabric image defect classification method based on improved LDA-GSVD according to claim 1 or 2, characterized in that: In step S2, the training sample X train ={(x1,y1);(x2,y2)K(x m ,y m )},x i is a 1×n dimensional vector with a total of m samples; k is the number of categories, y i ∈{1,2...k}, is the set of samples of the jth class, N j is the number of samples in the jth category, j=1,2...k.

4. The fabric image defect classification method based on improved LDA-GSVD according to claim 1 is characterized in that: In step S5, according to the obtained projection matrix W, the test sample X test Project to the new subspace, that is, Y = X test ×W, the labels of the test set samples estimated by the KNN classifier are compared with the true labels of the test set to obtain the accuracy of the classification results.

5. A fabric image defect classification system based on improved LDA-GSVD, characterized by Includes the following modules: The fabric image feature extraction module randomly extracts N fabric images for feature extraction to obtain the feature matrix X and the label matrix H; The sample classification module randomly divides the feature matrix X into labeled training samples X train and labeled test samples X test ; Redefine the module and use the inter-class discrete weight coefficient W j,q ' and the intra-class compact weight coefficient α j , calculate the intra-class scattering matrix S after adding local geometric information W and the inter-class scattering matrix S B ; Computational modules, using the redefined and Get what GSVD needs and Matrix pairs of ; The output module obtains the optimal projection matrix W through the improved linear discriminant analysis model and transforms the test sample X test Get Y by projecting the matrix W to the new subspace, and use the KNN classifier to confirm the test set sample labels; α j and Specifically include: Let x j,p and x j,m For the p-th sample and the m-th sample of the j-th class sample, the intra-class aggregation degree is defined as Q{j}, which is expressed as: N j The number of samples in the jth class is known, and there are k classes in total; the intra-class aggregation degree of class k is defined as: Taking the mean of the cohesion of k classes as the criterion, the judgment standard is Let the compact weight coefficient within the class be α j , α i is determined by judging the size of Q{j} and mean, that is: The improved intra-class scattering matrix is ​​obtained by adding the intra-class compact weight coefficient W j,q 'and Specifically include: Using W j,q Represents the similarity between class j and class q. The greater the similarity, the smaller the difference between classes. According to the similarity formula: The sample mean of the jth class is express, u j and u q All are 1×m matrices; σ is a custom parameter; Apply a discriminant criterion to determine the discrete weight coefficients between different classes. G∈R k×k , W mean is the overall mean of the similarity matrix G: IN j,q '=W mean ,IN j,q ≥In mean ;IN j,q '=W j,q ,IN j,q <In mean The improved inter-class scattering matrix is ​​obtained by adding the inter-class discrete weight coefficient IN j,q '=W mean ,IN j,q ≥In mean ;IN j,q '=W j,q ,IN j,q <In mean The calculation module is obtained by and Expressed as as well as The expression is: α j =1,Q{j}≤mean(j=1K k) The expression is: IN j,q '=W mean ,IN j,q ≥In mean ;IN j,q '=W j,q ,IN j,q <In mean According to the matrix required by GSVD Perform singular value decomposition on the matrix pair M∈R (k+m)×(k+m) ,P∈R n×n ,∑∈R (k+m)×n ; t is the rank of the matrix pair; M(1:k,1:t)=U∑ is calculated from the SVD decomposition of M(1:k,1:t) A L T , U∈R k×k ,∑ A ∈R k×t , L∈R t×t Find L; calculate P=[P1 P2],P1∈R n×t , P2∈R n×(n-t) ;I n-t is the identity matrix of (nt)×(nt), Σ t =∑(1:t,1:t), take the first k-1 columns of Z and denote them as W∈R n×(k-1) , W is the required projection matrix.

6. The fabric image defect classification system based on improved LDA-GSVD according to claim 5, characterized in that: In the fabric image feature extraction module, a fabric image dataset is created in MATLAB, and features of N fabric images are extracted through gray-level co-occurrence matrix and gradient direction histogram to obtain an N×n feature matrix X, and an N×1 label matrix H is created.

7. The fabric image defect classification system based on improved LDA-GSVD according to claim 5 or 6, characterized in that: In the sample classification module, the training sample X train ={(x1,y1);(x2,y2)K(x m ,y m )},x i is a 1×n dimensional vector with a total of m samples; k is the number of categories, y i ∈{1,2...k}, is the set of samples of the jth class, N j is the number of samples in the jth category, j=1,2...k.