CN113887600A - Improved LDA-GSVD-based fabric image defect classification method and system - Google Patents

Improved LDA-GSVD-based fabric image defect classification method and system Download PDF

Info

Publication number
CN113887600A
CN113887600A CN202111126929.5A CN202111126929A CN113887600A CN 113887600 A CN113887600 A CN 113887600A CN 202111126929 A CN202111126929 A CN 202111126929A CN 113887600 A CN113887600 A CN 113887600A
Authority
CN
China
Prior art keywords
class
matrix
mean
sample
gsvd
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111126929.5A
Other languages
Chinese (zh)
Inventor
吕文涛
钟佳莹
王成群
徐伟强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Sci Tech University ZSTU
Original Assignee
Zhejiang Sci Tech University ZSTU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Sci Tech University ZSTU filed Critical Zhejiang Sci Tech University ZSTU
Priority to CN202111126929.5A priority Critical patent/CN113887600A/en
Publication of CN113887600A publication Critical patent/CN113887600A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2413Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on distances to training or reference patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method and a system for classifying fabric image flaws based on improved LDA-GSVD, wherein the method comprises the following steps: s1, extracting the characteristics of the fabric image to obtain a characteristic matrix X and a label matrix H; s2, randomly dividing the data set sample into training samples X with labelstrainAnd a labeled test sample Xtest(ii) a S3, calculating the intra-class scattering matrix S after adding the local geometric information by using the inter-class scattering weight coefficient and the intra-class compact weight coefficientWAnd inter-class scattering matrix SB(ii) a S4, using redefined
Figure DDA0003278859760000011
And
Figure DDA0003278859760000012
required for obtaining GSVD
Figure DDA0003278859760000013
And
Figure DDA0003278859760000014
s5, obtaining an optimal projection matrix W through the improved linear discriminant analysis model, and testing the sample XtestAnd (5) obtaining Y by projecting the matrix W to a new subspace, and confirming the sample label of the test set by using a KNN classifier. The method can solve the problems of lack of local geometric information and high dimension of small samples in the traditional LDA, and effectively improves the classification accuracy and efficiency of fabric image defects.

Description

Improved LDA-GSVD-based fabric image defect classification method and system
Technical Field
The invention belongs to the technical field of textile defect classification methods, and particularly relates to an improved LDA-GSVD-based fabric image defect classification method and system.
Background
The Fisher criterion is proposed in 1936, the research enthusiasm is promoted in the field of pattern recognition, Linear Discriminant Analysis (LDA) is mainly used for feature extraction and dimension reduction, and the core idea of the method is to find a projection vector or a projection space in the original space and classify samples after the projection space is projected to a new space. LDA has better discrimination as a supervised learning method, but LDA focuses on global information, lacks assurance of local information, and secondly s when facing high-dimensional small sample problemsBw=λswSolving for existence of wwAn irreversible condition. Although the problem of high-dimensional small samples is solved by the proposal of LDA-GSVD, the problem that LDA only considers global information still exists. And the classification of fabric image flaws is a challenging task in the image classification task, the flaws of the fabric image are not distinguished obviously, and the potential local structure of the features cannot be ignored.
Therefore, an LDA-GSVD method for increasing local geometric information is needed to improve the accuracy of fabric image defect classification.
Disclosure of Invention
Aiming at the current situation of the prior art, the invention provides a fabric image flaw classification method and system based on improved LDA-GSVD (GSVD is generalized singular value decomposition), local characteristics of a fabric flaw image need to be emphasized, global information is considered more emphasized by the traditional LDA, the method is characterized in that the global information is kept, meanwhile, the consideration of local geometric information is added, so that the accuracy of the method is improved, meanwhile, the LDA-GSVD algorithm is utilized to solve the problem of small sample high dimension, and the operation speed is accelerated.
The technical scheme adopted by the invention redefines the intra-class scattering matrix and the inter-class scattering matrix to classify different flaws of the fabric image, and the improved LDA-GSVD-based fabric image flaw classification method specifically comprises the following steps:
s1, randomly extracting N pieces of fabric images for feature extraction to obtain a feature matrix X and a label matrix H;
s2, randomly dividing the data set sample into training samples X with labelstrainAnd a labeled test sample Xtest
S3, using inter-class dispersion weight coefficient Wj,q' and intra-class compact weight coefficient alphajCalculating the intra-class scattering matrix S after adding the local geometric informationWAnd inter-class scattering matrix SB
S4, using redefined
Figure BDA0003278859740000027
And
Figure BDA0003278859740000028
required for obtaining GSVD
Figure BDA0003278859740000029
And
Figure BDA00032788597400000210
the matrix pair to solve the problem of high dimension of the small sample;
s5, obtaining an optimal projection matrix W through the improved linear discriminant analysis model, and testing a sample XtestAnd (5) obtaining Y by projecting the matrix W to a new subspace, and confirming the sample label of the test set by using a KNN classifier.
The linear discriminant analysis model in S5 is constructed through steps S3 and S4, and the objective function of the original LDA algorithm model is:
Figure BDA0003278859740000021
after improvement
Figure BDA0003278859740000022
The optimization process of the method has two types, and Lagrangian calculation is utilized or the sum of matrix diagonals, namely the sum of characteristic values is taken. The object model becomes
Figure BDA0003278859740000023
trace is the trace of the matrix and is the sum of the eigenvalues.
Preferably, in step S1, a fabric image dataset is created in MATLAB, N fabric images are feature extracted by 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.
Preferably, in step S2, the training sample Xtrain={(x1,y1);(x2,y2)K(xm,ym)},xiIs a 1 xn dimensional vector, and has m samples. k is the number of classes, yi∈{1,2...k},
Figure BDA0003278859740000024
Is a set of class j samples, NjAnd (j ═ 1,2.. k) is the number of j-th samples.
Preferably, in step S3, αjAnd
Figure BDA0003278859740000025
the method specifically comprises the following steps:
s3.1, setting xj,pAnd xj,mDefining the intra-class cohesion as Q { j } for the p and m samples of the jth class sample, expressed as:
Figure BDA0003278859740000026
S3.2、Njthe number of samples known as class j, total class k. The in-class cohesion for class k is defined as:
Figure BDA0003278859740000031
s3.3, taking the class cohesion degree mean value of the k classes as a criterion and judging the criterion to be
Figure BDA0003278859740000032
Setting the compact weight coefficient in class as alphaj,αiIs determined by judging the size of Q { j } and mean, namely:
Figure BDA0003278859740000033
Q{j}>mean;αj=1,Q{j}≤mean
s3.4, adding the in-class scattering matrix with the improved in-class compact weight coefficient
Figure BDA0003278859740000034
Figure BDA0003278859740000035
Figure BDA0003278859740000036
Q{j}>mean;αj=1,Q{j}≤mean
Preferably, W in step S3j,q' and
Figure BDA0003278859740000037
the method specifically comprises the following steps:
s3.5, using Wj,qAnd representing the similarity between the class j and the class q, wherein the greater the similarity is, the smaller the difference between the classes is, and according to a similarity formula:
Figure BDA0003278859740000038
the sample mean of class j can be used
Figure BDA0003278859740000039
It is shown that,
Figure BDA00032788597400000310
ujand uqAre all 1 × m matrices.σIs a self-defined parameter.
S3.6, applying a discrimination standard to determine the discrete weight coefficient between different classes,
Figure BDA00032788597400000311
G∈Rk×k,Wmeanis the overall mean of the similarity matrix G:
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
s3.7, adding the inter-class scattering matrix with the improved inter-class scattering weight coefficient
Figure BDA0003278859740000041
Figure BDA0003278859740000042
Preferably, step S4 specifically includes:
s4.1, obtained by S3
Figure BDA0003278859740000043
And
Figure BDA0003278859740000044
is shown as
Figure BDA0003278859740000045
And
Figure BDA0003278859740000046
Figure BDA0003278859740000047
s4.2, according to the needed matrix pair of GSVD
Figure BDA0003278859740000048
Performing singular value decomposition on the matrix pair
Figure BDA0003278859740000049
S4.3, from SVD decomposition of M (1: k,1: t), M (1: k,1: t) is U sigmaALTCalculating L;
s4.4, calculating
Figure BDA00032788597400000410
S4.5, taking the first k-1 column of Z as W epsilon Rn×(k-1)W is the projection matrix sought.
Preferably, in step S5, the test sample X is tested according to the projection matrix W obtained in step S4testProjected into a new subspace, i.e. Y ═ XtestAnd multiplying by W, and comparing the label of the Y projected to the subspace, which is estimated by the KNN classifier, of the test set sample with the real label of the test set to obtain the accuracy of the classification result.
The invention also discloses an improved LDA-GSVD-based fabric image defect classification system, which comprises the following modules:
the fabric image feature extraction module is used for randomly extracting N pieces of fabric images to perform feature extraction to obtain a feature matrix X and a label matrix H;
a sample classification module for randomly classifying the characteristic matrix X into training samples X with labelstrainAnd a labeled test sample Xtest
Redefining the module using inter-class dispersion weight coefficients Wj,q' and intra-class compact weight coefficient alphajCalculating the intra-class scattering matrix S after adding the local geometric informationWAnd inter-class scattering matrix SB
Computing modules using redefined
Figure BDA0003278859740000051
And
Figure BDA0003278859740000052
required for obtaining GSVD
Figure BDA0003278859740000053
And
Figure BDA0003278859740000054
a matrix pair of (a);
an output module for obtaining an optimal projection matrix W through the improved linear discriminant analysis model and testing the sample XtestAnd (5) obtaining Y by projecting the matrix W to a new subspace, and confirming the sample label of the test set by using a KNN classifier.
Preferably, in the fabric image feature extraction module, a fabric image dataset is produced in MATLAB, feature extraction is performed on N fabric images through 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 produced.
Preferably, in the sample classification module, the training sample Xtrain={(x1,y1);(x2,y2)K(xm,ym)},xiIs a vector with 1 x n dimensions, and has m samples; k is the number of classes, yi∈{1,2...k},
Figure BDA0003278859740000055
Is a set of class j samples, NjAnd (j ═ 1,2.. k) is the number of j-th samples.
Preferably, alpha in the module is redefinedjAnd
Figure BDA0003278859740000056
the method specifically comprises the following steps:
let xj,pAnd xj,mDefining the intra-class cohesion as Q { j } for the p and m samples of the jth class sample, expressed as:
Figure BDA0003278859740000057
Njthe number of samples known as class j, total class k; the in-class cohesion for class k is defined as:
Figure BDA0003278859740000058
taking the class cohesion mean value of the k classes as a criterion and judging the criterion as
Figure BDA0003278859740000059
Setting the compact weight coefficient in class as alphaj,αiIs determined by judging the size of Q { j } and mean, namely:
Figure BDA00032788597400000510
Q{j}>mean;αj=1,Q{j}≤mean
intra-class scattering matrix with improved intra-class compact weight coefficients
Figure BDA00032788597400000511
Figure BDA0003278859740000061
Figure BDA0003278859740000062
Q{j}>mean;αj=1,Q{j}≤mean
Redefining W in a Modulej,q' and
Figure BDA0003278859740000063
the method specifically comprises the following steps:
using Wj,qAnd representing the similarity between the class j and the class q, wherein the greater the similarity is, the smaller the difference between the classes is, and according to a similarity formula:
Figure BDA0003278859740000064
the sample mean of class j can be used
Figure BDA0003278859740000065
It is shown that,
Figure BDA0003278859740000066
ujand uqAll of which are 1 x m matrices;
a criterion is applied to determine discrete weight coefficients between different classes,
Figure BDA0003278859740000067
G∈Rk×k,Wmeanis the overall mean of the similarity matrix G:
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
adding an inter-class scattering matrix with improved inter-class scattering weight coefficients
Figure BDA0003278859740000068
Figure BDA0003278859740000069
Preferably, the calculation module comprises, in particular,
obtained by redefining modules
Figure BDA00032788597400000610
And
Figure BDA00032788597400000611
is shown as
Figure BDA00032788597400000612
And
Figure BDA00032788597400000613
Figure BDA00032788597400000614
matrix pair required by GSVD
Figure BDA00032788597400000615
Performing singular value decomposition on the matrix pair
Figure BDA00032788597400000616
From SVD decomposition of M (1: k,1: t), M (1: k,1: t) is U ΣALTCalculating L;
computing
Figure BDA0003278859740000071
The first k-1 column of Z is taken as W epsilon Rn×(k-1)W is the projection matrix sought.
Preferably, in the output module, the test sample X is processed according to the projection matrix W obtained by the calculation moduletestProjected into a new subspace, i.e. Y ═ XtestAnd multiplying by W, and comparing the label of the Y projected to the subspace, which is estimated by the KNN classifier, of the test set sample with the real label of the test set to obtain the accuracy of the classification result.
The invention has the beneficial effects that:
the invention is based on an improved LDA-GSVD fabric image flaw classification method, and utilizes inter-class dispersion weight coefficients and intra-class compact weight coefficients to calculate an intra-class dispersion matrix S after local geometric information is addedWAnd inter-class scattering matrix SBThe problem that the fabric image samples are few and the feature dimension is high is solved by using an LDA-GSVD method; meanwhile, the consideration on the local geometric information of the fabric is enhanced, and the function of effectively and accurately classifying the fabric image defects can be realized.
Drawings
FIG. 1 is a schematic flow chart of the method for classifying fabric image defects based on the improved LDA-GSVD;
fig. 2 is 12 fabric defect images of 256 × 256 pixels to be detected based on the improved LDA-GSVD fabric image defect classification method of the present invention, selected from the AITEX data set. Respectively including broken end defect, broken weft defect, pilling, crease, knotting defect, cotton grain, broken yarn, weft yarn curling, edge cutting, warp yarn ball, pollution and dilute weft.
FIG. 3 is a block diagram of the defect classification system of the fabric image based on the improved LDA-GSVD.
Detailed Description
The objects and effects of the present invention will become more apparent from the following further description of the present invention with reference to the accompanying drawings and the detailed description.
As shown in fig. 1, a method for classifying fabric image defects based on the improved LDA-GSVD according to the preferred embodiment of the present invention is implemented as follows:
in step S1, randomly selecting the same number of pieces of each of 12 256 × 256 fabric defect images to be detected, N pieces in total, adjusting the size of the image to 64 × 64, performing feature extraction by a method of fusion of GLCM (gray level co-occurrence matrix) and HOG (histogram in gradient direction), wherein the feature dimension is N, obtaining an N × N feature matrix X, and making an N × 1 label matrix H;
in step S2, 70% of X and H obtained in step 1 are randomly selected as a training set XtrainObtaining the corresponding training set label as HtrainThe remainder being test set XtestThe corresponding test set label is Htest
Training sample Xtrain={(x1,y1);(x2,y2)K(xm,ym)},xiIs a 1 xn dimensional vector, and has m samples. k is the number of classes, and in a specific example k is 12. y isi∈{1,2...k},
Figure BDA0003278859740000081
Is a set of class j samples, Nj(j 1,2.. k) is the number of jth samples, and the test sample X istest∈R(N-m)×n
In step S3, the intra-class compact weight coefficient αjAnd redefined intra-class scattering matrices
Figure BDA0003278859740000082
The method specifically comprises the following steps:
s3.1, setting xj,pAnd xj,mDefining the intra-class cohesion as Q { j } for the p and m samples of the j-th class sample, expressed as:
Figure BDA0003278859740000083
S3.2、NjThe number of samples known as class j, total class k. The in-class cohesion for class k is defined as:
Figure BDA0003278859740000084
s3.3, taking the class cohesion degree mean value of the k classes as a criterion and judging the criterion to be
Figure BDA0003278859740000085
Setting the compact weight coefficient in class as alphaj,αiIs determined by judging the size of Q { j } and mean, namely:
Figure BDA0003278859740000086
Q{j}>mean;αj=1,Q{j}≤mean
s3.4, adding the in-class scattering matrix with the improved in-class compact weight coefficient
Figure BDA0003278859740000087
Figure BDA0003278859740000088
Figure BDA0003278859740000089
Q{j}>mean;αj=1,Q{j}≤mean
After step S3.4, the inter-class dispersion weight coefficient Wj,q' and between-like scattering matrices
Figure BDA00032788597400000810
The method specifically comprises the following steps:
S35, using Wj,qAnd representing the similarity between the class j and the class q, wherein the greater the similarity is, the smaller the difference between the classes is, and according to a similarity formula:
Figure BDA0003278859740000091
the sample mean of class j can be used
Figure BDA0003278859740000092
It is shown that,
Figure BDA0003278859740000093
ujand uqAre all 1 × m matrices. σ is set to 1e 2.
S3.6, applying a discrimination standard to determine the discrete weight coefficient between different classes,
Figure BDA0003278859740000094
G∈Rk ×k,Wmeanis the overall mean of the similarity matrix G:
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
s3.7, adding the inter-class scattering matrix with the improved inter-class scattering weight coefficient
Figure BDA0003278859740000095
Figure BDA0003278859740000096
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
In step S4, the result obtained in S3
Figure BDA0003278859740000097
And
Figure BDA0003278859740000098
can be expressed as
Figure BDA0003278859740000099
And
Figure BDA00032788597400000910
Figure BDA00032788597400000911
s4.1. in the specific implementation,
Figure BDA00032788597400000912
the expression of (a) is:
Figure BDA00032788597400000913
Figure BDA00032788597400000914
Q{j}>mean;αj=1,Q{j}≤mean(j=1Kk)
in the concrete implementation of the method, the device comprises a base,
Figure BDA00032788597400000915
the expression of (a) is:
Figure BDA00032788597400000916
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
matrix pair required by GSVD
Figure BDA0003278859740000101
Performing singular value decomposition on the matrix pair
Figure BDA0003278859740000102
M∈R(k+m)×(k+m),P∈Rn×n,∑∈R(k+m)×n
S4.2、
Figure BDA0003278859740000103
t is the rank of the matrix pair. Computing M (1: k,1: t) ═ U Σ from SVD decomposition of M (1: k,1: t)ALT,U∈Rk×k,∑A∈Rk×t,L∈Rt×tSolving L;
s4.3, calculating
Figure BDA0003278859740000104
P=[P1 P2],P1∈Rn×t,P2∈Rn ×(n-t)。In-tIs an identity matrix of (n-t) × (n-t), ΣtIs sigma (1: t ), the first k-1 column of Z is taken as W epsilon Rn×(k-1)W is the projection matrix sought.
In step S5, according to the projection matrix W obtained in step S4, the test sample X is testedtestProjected into a new subspace, i.e. Y ═ XtestxW, estimating the label of the sample of the test set and the real label H of the test set by the KNN classifier according to Y projected to the subspacetestAnd comparing to obtain the accuracy of the classification result.
In order to verify the performance of the classification method, the method is utilized, the experimental process is executed for ten times, 70% of the experimental process is randomly extracted from a data set sample X as a training sample in each experimental process, after the execution is performed for ten times, the average value is taken as a final detection result, the experimental result is shown in the following table 1, and compared with the LDA and LDA-GSVD method, the linear discriminant analysis algorithm provided by the invention has the highest classification accuracy and has good calculation efficiency.
TABLE 1 comparison table of classification results of fabric image defects in different methods
Method LDA LDA-GSVD The method of the invention
Accuracy (%) 46.67 62.78 66.53
Time(s) 11.88 0.22 0.28
As shown in fig. 3, a system for classifying fabric image defects based on improved LDA-GSVD in accordance with a preferred embodiment of the present invention specifically includes the following modules:
the fabric image feature extraction module randomly selects the same number of pieces of the fabric defect images of 12 types of 256 multiplied by 256 pixels to be detected, wherein the number of the pieces is N, the size of the image is adjusted to 64 multiplied by 64, feature extraction is carried out by a method of fusion of GLCM (gray level co-occurrence matrix) and HOG (histogram in gradient direction), the feature dimension is N, an Nmultiplied by N feature matrix X is obtained, and an Nmultiplied by 1 label matrix H is manufactured;
a sample classification module for randomly selecting 70% of X and H obtained by the fabric image feature extraction module as a training set XtrainObtaining the corresponding training set label as HtrainThe remainder being test set XtestThe corresponding test set label is Htest
Training sample Xtrain={(x1,y1);(x2,y2)K(xm,ym)},xiIs a 1 xn dimensional vector, and has m samples. k is the number of classes, and in a specific example k is 12. y isi∈{1,2...k},
Figure BDA0003278859740000111
Is a set of class j samples, Nj(j 1,2.. k) is the number of jth samples, and the test sample X istest∈R(N-m)×n
Redefining modules, compact weight coefficients alpha within classesjAnd redefined intra-class scattering matrices
Figure BDA0003278859740000112
The method specifically comprises the following steps:
let xj,pAnd xj,mDefining the intra-class cohesion as Q { j } for the p and m samples of the jth class sample, expressed as:
Figure BDA0003278859740000113
Njthe number of samples known as class j, total class k. The in-class cohesion for class k is defined as:
Figure BDA0003278859740000114
taking the class cohesion mean value of the k classes as a criterion and judging the criterion as
Figure BDA0003278859740000115
Setting the compact weight coefficient in class as alphaj,αiIs determined by judging the size of Q { j } and mean, namely:
Figure BDA0003278859740000116
Q{j}>mean;αj=1,Q{j}≤mean
intra-class powder with improved intra-class compact weight factorShooting matrix
Figure BDA0003278859740000117
Figure BDA0003278859740000118
Figure BDA0003278859740000121
Q{j}>mean;αj=1,Q{j}≤mean
Then, the inter-class dispersion weight coefficient Wj,q' and between-like scattering matrices
Figure BDA0003278859740000122
The method specifically comprises the following steps:
using Wj,qAnd representing the similarity between the class j and the class q, wherein the greater the similarity is, the smaller the difference between the classes is, and according to a similarity formula:
Figure BDA0003278859740000123
the sample mean of class j can be used
Figure BDA0003278859740000124
It is shown that,
Figure BDA0003278859740000125
ujand uqAre all 1 × m matrices. σ is set to 1e 2.
A criterion is applied to determine discrete weight coefficients between different classes,
Figure BDA0003278859740000126
G∈Rk×k,Wmeanis the overall mean of the similarity matrix G:
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
adding an inter-class scattering matrix with improved inter-class scattering weight coefficients
Figure BDA0003278859740000127
Figure BDA0003278859740000128
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
Computing modules obtained by redefining modules
Figure BDA0003278859740000129
And
Figure BDA00032788597400001210
can be expressed as
Figure BDA00032788597400001211
And
Figure BDA00032788597400001212
in the concrete implementation of the method, the device comprises a base,
Figure BDA00032788597400001213
the expression of (a) is:
Figure BDA00032788597400001214
Figure BDA00032788597400001215
Q{j}>mean;αj=1,Q{j}≤mean(j=1Kk)
in the concrete implementation of the method, the device comprises a base,
Figure BDA00032788597400001216
the expression of (a) is:
Figure BDA0003278859740000131
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
matrix pair required by GSVD
Figure BDA0003278859740000132
Performing singular value decomposition on the matrix pair
Figure BDA0003278859740000133
M∈R(k+m)×(k+m),P∈Rn×n,∑∈R(k+m)×n
Figure BDA0003278859740000134
t is the rank of the matrix pair. Computing M (1: k,1: t) ═ U Σ from SVD decomposition of M (1: k,1: t)ALT,U∈Rk×k,∑A∈Rk×t,L∈Rt×tSolving L;
computing
Figure BDA0003278859740000135
P=[P1 P2],P1∈Rn×t,P2∈Rn×(n-t)。In-tIs an identity matrix of (n-t) × (n-t), ΣtIs sigma (1: t ), the first k-1 column of Z is taken as W epsilon Rn×(k-1)W is the projection matrix sought.
The output module is used for outputting the test sample X according to the projection matrix W obtained by the calculation moduletestProjected into a new subspace, i.e. Y ═ XtestxW, estimating the label of the sample of the test set and the real label H of the test set by the KNN classifier according to Y projected to the subspacetestAnd comparing to obtain the accuracy of the classification result.

Claims (10)

1. An improved LDA-GSVD-based fabric image defect classification method is characterized by comprising the following steps:
s1, randomly extracting N pieces of fabric images for feature extraction to obtain a feature matrix X and a label matrix H;
s2, randomly dividing the feature matrix X into training samples X with labelstrainAnd a labeled test sample Xtest
S3, using inter-class dispersion weight coefficient Wj,q' and intra-class compact weight coefficient alphajCalculating the intra-class scattering matrix S after adding the local geometric informationWAnd inter-class scattering matrix SB
S4, obtained by redefining
Figure FDA0003278859730000011
And
Figure FDA0003278859730000012
required for obtaining GSVD
Figure FDA0003278859730000013
And
Figure FDA0003278859730000014
a matrix pair of (a);
s5, obtaining an optimal projection matrix W through the improved linear discriminant analysis model, and testing a sample XtestAnd (5) obtaining Y by projecting the matrix W to a new subspace, and confirming the sample label of the test set by using a KNN classifier.
2. The improved LDA-GSVD-based fabric image defect classification method as claimed in claim 1, wherein in step S1, a fabric image dataset is made in MATLAB, feature extraction is performed on N fabric images through a gray level co-occurrence matrix and a gradient direction histogram to obtain an N X N feature matrix X, and an N X1 label matrix H is made.
3. The improved LDA-GSVD-based fabric image defect classification method of claim 1 or 2, wherein in step S2, the training sample Xtrain={(x1,y1);(x2,y2)K(xm,ym)},xiIs a vector with 1 x n dimensions, and has m samples; k is the number of classes, yi∈{1,2...k},
Figure FDA0003278859730000015
Is a set of class j samples, NjAnd (j ═ 1,2.. k) is the number of j-th samples.
4. The improved LDA-GSVD-based fabric image defect classification method of claim 3, wherein a in step S3jAnd
Figure FDA0003278859730000016
the method specifically comprises the following steps:
s3.1, setting xj,pAnd xj,mDefining the intra-class cohesion as Q { j } for the p and m samples of the jth class sample, expressed as:
Figure FDA0003278859730000021
S3.2、Njthe number of samples known as class j, total class k; the in-class cohesion for class k is defined as:
Figure FDA0003278859730000022
s3.3, taking the class cohesion degree mean value of the k classes as a criterion and judging the criterion to be
Figure FDA0003278859730000023
Setting the compact weight coefficient in class as alphaj,αiBy judging Q { j } andthe mean is determined by the following steps:
Figure FDA0003278859730000024
s3.4, adding the in-class scattering matrix with the improved in-class compact weight coefficient
Figure FDA0003278859730000025
Figure FDA0003278859730000026
Figure FDA0003278859730000027
W in step S3j,q' and
Figure FDA0003278859730000028
the method specifically comprises the following steps:
s3.5, using Wj,qAnd representing the similarity between the class j and the class q, wherein the greater the similarity is, the smaller the difference between the classes is, and according to a similarity formula:
Figure FDA0003278859730000029
the sample mean of class j can be used
Figure FDA00032788597300000210
It is shown that,
Figure FDA00032788597300000211
ujand uqAll of which are 1 x m matrices; sigma is a self-defining parameter;
s3.6, applying a discrimination standard to determine the discrete weight coefficient between different classes,
Figure FDA00032788597300000212
G∈Rk×k,Wmeanis the overall mean of the similarity matrix G:
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
s3.7, adding the inter-class scattering matrix with the improved inter-class scattering weight coefficient
Figure FDA0003278859730000031
Figure FDA0003278859730000032
5. The improved LDA-GSVD-based fabric image defect classification method of claim 4, wherein the step S4 specifically comprises,
s4.1, obtained by step S3
Figure FDA0003278859730000033
And
Figure FDA0003278859730000034
is shown as
Figure FDA0003278859730000035
And
Figure FDA0003278859730000036
Figure FDA0003278859730000037
s4.2, according to the needed matrix pair of GSVD
Figure FDA0003278859730000038
Performing singular value decomposition on the matrix pair
Figure FDA0003278859730000039
S4.3, from SVD decomposition of M (1: k,1: t), M (1: k,1: t) is U sigmaALTCalculating L;
s4.4, calculating
Figure FDA00032788597300000310
S4.5, taking the first k-1 column of Z as W epsilon Rn×(k-1)W is the projection matrix sought.
6. The method for classifying defects based on improved LDA-GSVD fabric image of claim 5, wherein in step S5, the test sample X is processed according to the projection matrix W obtained in step S4testProjected into a new subspace, i.e. Y ═ XtestAnd multiplying by W, and comparing the label of the Y projected to the subspace, which is estimated by the KNN classifier, of the test set sample with the real label of the test set to obtain the accuracy of the classification result.
7. An improved LDA-GSVD-based fabric image flaw classification system is characterized by comprising the following modules:
the fabric image feature extraction module is used for randomly extracting N pieces of fabric images to perform feature extraction to obtain a feature matrix X and a label matrix H;
a sample classification module for randomly classifying the characteristic matrix X into training samples X with labelstrainAnd a labeled test sample Xtest
Redefining the module using inter-class dispersion weight coefficients Wj,q' and intra-class compact weight coefficient alphajCalculating the intra-class scattering matrix S after adding the local geometric informationWAnd inter-class scattering matrix SB
Computing modules using redefined
Figure FDA0003278859730000041
And
Figure FDA0003278859730000042
required for obtaining GSVD
Figure FDA0003278859730000043
And
Figure FDA0003278859730000044
a matrix pair of (a);
an output module for obtaining an optimal projection matrix W through the improved linear discriminant analysis model and testing the sample XtestAnd (5) obtaining Y by projecting the matrix W to a new subspace, and confirming the sample label of the test set by using a KNN classifier.
8. The improved LDA-GSVD-based fabric image defect classification system as recited in claim 7, wherein in the fabric image feature extraction module, a fabric image dataset is made in MATLAB, feature extraction is performed on N fabric images through a gray level co-occurrence matrix and a gradient direction histogram to obtain an Nxn feature matrix X, and an Nx 1 label matrix H is made.
9. The improved LDA-GSVD-based fabric image defect classification system according to claim 7 or 8, wherein in the sample classification module, the training sample Xtrain={(x1,y1);(x2,y2)K(xm,ym)},xiIs a vector with 1 x n dimensions, and has m samples; k is the number of classes, yi∈{1,2...k},
Figure FDA0003278859730000045
Is a set of class j samples, NjAnd (j ═ 1,2.. k) is the number of j-th samples.
10. The improved LDA-GSVD based fabric map of claim 9Image defect classification system, characterized in that alpha in the module is redefinedjAnd
Figure FDA0003278859730000046
the method specifically comprises the following steps:
let xj,pAnd xj,mDefining the intra-class cohesion as Q { j } for the p and m samples of the jth class sample, expressed as:
Figure FDA0003278859730000051
Njthe number of samples known as class j, total class k; the in-class cohesion for class k is defined as:
Figure FDA0003278859730000052
taking the class cohesion mean value of the k classes as a criterion and judging the criterion as
Figure FDA0003278859730000053
Setting the compact weight coefficient in class as alphaj,αiIs determined by judging the size of Q { j } and mean, namely:
Figure FDA0003278859730000054
intra-class scattering matrix with improved intra-class compact weight coefficients
Figure FDA0003278859730000055
Figure FDA0003278859730000056
Figure FDA0003278859730000057
Redefining W in a Modulej,q' and
Figure FDA0003278859730000058
the method specifically comprises the following steps:
using Wj,qAnd representing the similarity between the class j and the class q, wherein the greater the similarity is, the smaller the difference between the classes is, and according to a similarity formula:
Figure FDA0003278859730000059
the sample mean of class j can be used
Figure FDA00032788597300000510
It is shown that,
Figure FDA00032788597300000511
ujand uqAll of which are 1 x m matrices; sigma is a self-defining parameter;
a criterion is applied to determine discrete weight coefficients between different classes,
Figure FDA0003278859730000061
G∈Rk×k,Wmeanis the overall mean of the similarity matrix G:
Wj,q’=Wmean,Wj,q≥Wmean;Wj,q’=Wj,q,Wj,q<Wmean
adding an inter-class scattering matrix with improved inter-class scattering weight coefficients
Figure FDA0003278859730000062
Figure FDA0003278859730000063
CN202111126929.5A 2021-09-26 2021-09-26 Improved LDA-GSVD-based fabric image defect classification method and system Pending CN113887600A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111126929.5A CN113887600A (en) 2021-09-26 2021-09-26 Improved LDA-GSVD-based fabric image defect classification method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111126929.5A CN113887600A (en) 2021-09-26 2021-09-26 Improved LDA-GSVD-based fabric image defect classification method and system

Publications (1)

Publication Number Publication Date
CN113887600A true CN113887600A (en) 2022-01-04

Family

ID=79006644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111126929.5A Pending CN113887600A (en) 2021-09-26 2021-09-26 Improved LDA-GSVD-based fabric image defect classification method and system

Country Status (1)

Country Link
CN (1) CN113887600A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116542956A (en) * 2023-05-25 2023-08-04 广州机智云物联网科技有限公司 Automatic detection method and system for fabric components and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116542956A (en) * 2023-05-25 2023-08-04 广州机智云物联网科技有限公司 Automatic detection method and system for fabric components and readable storage medium
CN116542956B (en) * 2023-05-25 2023-11-17 广州机智云物联网科技有限公司 Automatic detection method and system for fabric components and readable storage medium

Similar Documents

Publication Publication Date Title
CN109117826B (en) Multi-feature fusion vehicle identification method
CN110348319B (en) Face anti-counterfeiting method based on face depth information and edge image fusion
CN108765412B (en) Strip steel surface defect classification method
CN101739555B (en) Method and system for detecting false face, and method and system for training false face model
CN107657279B (en) Remote sensing target detection method based on small amount of samples
CN103870811B (en) A kind of front face Quick method for video monitoring
CN102163281B (en) Real-time human body detection method based on AdaBoost frame and colour of head
CN102521561B (en) Face identification method on basis of multi-scale weber local features and hierarchical decision fusion
CN102915453B (en) Real-time feedback and update vehicle detection method
CN104598885B (en) The detection of word label and localization method in street view image
CN103279768B (en) A kind of video face identification method based on incremental learning face piecemeal visual characteristic
CN101930549B (en) Second generation curvelet transform-based static human detection method
CN112488211A (en) Fabric image flaw classification method
CN103186776B (en) Based on the human body detecting method of multiple features and depth information
CN106778714B (en) LDA face identification method based on nonlinear characteristic and model combination
CN104715266B (en) The image characteristic extracting method being combined based on SRC DP with LDA
CN110222660B (en) Signature authentication method and system based on dynamic and static feature fusion
CN113887600A (en) Improved LDA-GSVD-based fabric image defect classification method and system
CN112257600B (en) Face recognition method and system
CN103268494A (en) Parasite egg identifying method based on sparse representation
CN117152625A (en) Remote sensing small target identification method, system, equipment and medium based on CoordConv and Yolov5
CN110287973B (en) Image feature extraction method based on low-rank robust linear discriminant analysis
CN115797970B (en) Dense pedestrian target detection method and system based on YOLOv5 model
CN111062338A (en) Certificate portrait consistency comparison method and system
CN111553888A (en) Titanium alloy forging microstructure image identification method based on machine learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination