Image classification method based on intra-class difference suppression dictionary learning
By introducing intra-class differential suppressive dictionary learning and Laplace matrix feature mapping in image classification technology, the accuracy reduction problem of image classification model in noise and complex background is solved, and high accuracy and high efficiency image classification is achieved .
Patent Information
- Application Number
- CN202411120849.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-01-03
AI Technical Summary
In the face of noise interference, lighting changes, low resolution and feature differences, existing image classification technology is difficult to learn a good classification model, resulting in a decrease in classification accuracy, and overfitting the neural network model and high data requirements.
Using the method based on in-class differential suppressive dictionary learning, the supervised dictionary learning model is constructed, and feature mapping constraints are used using label matrix and Laplace matrix to reduce the in-class deviation between sparse coefficients and improve the discriminantity of the dictionary. , and use the kNN classifier to perform image classification.
It significantly improves the accuracy and efficiency of image classification, and can maintain efficient classification performance under complex background and noise interference, solving the problem that dictionary cannot capture the internal structure and feature relationship of data.
Smart Images

Figure CN119251542A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image classification, and in particular relates to an image classification method based on intra-class difference suppression dictionary learning. Background Art
[0002] With the rapid development of computer vision, image classification technology has been widely used in various fields, such as medical image analysis, intelligent security, face recognition, image search engines, intelligent transportation, gesture recognition, etc. As one of the important tasks of computer vision, image classification is about how to train a classification model and assign the input image to the correct category through the model. In the past few decades, simple classifiers such as Support Vector Machine (SVM), kNearest Neighbor (kNN), Decision Tree, Logistic Regression, etc. have achieved good classification results in simple classification tasks. However, the particularity of the application scenario may lead to some uncertain factors in the collected image data, such as noise interference, light interference, low resolution, large feature differences, data imbalance, etc. These factors may cause simple classifiers to fail to learn a good classification model, thereby reducing the classification accuracy.
[0003] As an emerging technology, sparse representation (SR) was first used to recover the original signal from limited observation data, that is, the original signal can be represented by a small number of non-zero coefficients. In the framework of sparse representation, the original signal can be represented by a linear combination of a sparse coefficient vector and a dictionary (or basis). A large number of experiments have shown that the sparse image has good performance in algorithms such as image reconstruction, target detection, image denoising and image classification, but the premise of good performance is that the sparse coefficients of the image have specific properties.
[0004] Dictionary learning (DL), as an optimized extension of sparse representation theory, has been widely used in signal processing, image processing, pattern recognition, natural language processing, and data compression. Dictionaries are usually divided into two types: atomic dictionaries and data-driven dictionaries. The core idea of dictionary learning is to learn a dictionary with specific properties from given data, and the linear combination of dictionary atoms can better and more sparsely represent the image.
[0005] With the development of computer vision, image classification has attracted more and more attention from scholars in neural networks. The excellent classification performance of neural networks has attracted more scholars to explore in depth, but the huge hypothesis space of neural networks may cause the model to overfit and become time-consuming and unstable. In addition, neural networks require a large number of data samples to fit their complex models. In response to these problems, dictionary learning models not only solve the problem of fitting small-scale data sets, but also achieve satisfactory performance in classification accuracy and efficiency. Image classification based on dictionary learning is to learn a discriminative dictionary from a small amount of given image data. The dictionary can better capture the intrinsic features and connections of the data, thereby providing a sparse representation with stronger discriminative and expressive capabilities. Finally, high-precision and efficient classification is achieved based on the sparse representation. A suitable dictionary helps to classify more accurately and efficiently. However, when facing different image classification tasks, the dictionary learning model will face problems such as complex image background, noise interference, similar features of the same type of image data sets, and diversified features of different types of image data sets. These problems may cause the dictionary to fail to capture the intrinsic structure and feature relationship of the data well, thereby affecting the classification performance of the model.
[0006] Based on this, the present invention proposes an image classification method based on intra-class difference suppressive dictionary learning, called the IVS-DL method, which can effectively improve the classification accuracy of images. Summary of the invention
[0007] In view of the above situation, the present invention proposes an image classification method based on intra-class difference suppression dictionary learning. First, the present invention constructs a label matrix based on supervised dictionary learning, associates the category label information of the training samples with the sparse coefficients, and makes the sparse coefficients of the same category belong to the subspace spanned by the category label. Secondly, the training samples are used to construct a Laplacian matrix, and the Laplacian matrix is used to perform feature mapping constraints on the sparse coefficients, so that the local feature relationship of the original data is preserved in the sparse coefficients. In addition, by minimizing the intra-class deviation between the sparse coefficients, targets from the same category are encouraged to gather towards the class center, thereby improving the discriminability of the dictionary. Finally, the kNN classifier is used to classify the sparse coefficients of the image to be tested. Compared with the existing image classification technology, the image classification using the technical solution of the present invention has significantly improved classification accuracy and classification efficiency, and can well meet the application requirements in actual scenarios.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] An image classification method based on intra-class difference inhibitory dictionary learning includes the following steps:
[0010] S1, select image dataset;
[0011] S2, preprocessing the image selected in step S1 by using a feature extraction method to generate an image sample set;
[0012] S3, build a supervised dictionary learning model;
[0013] S4, constructing a category label matrix according to the image sample set in step S2 and the dictionary learning model in step S3;
[0014] S5. Construct a Laplace matrix using sample data;
[0015] S6, regularize the training samples using Laplace eigenmap;
[0016] S7, constructing a dictionary that suppresses intra-class differences and calculating the intra-class sparse mean vector;
[0017] S8, optimizing the dictionary model by minimizing the intra-class deviation between sparse coefficients to generate an objective function;
[0018] S9, solving the objective function using an analytical method, and iteratively updating the sparse coefficients and the dictionary;
[0019] S10, calculating the error according to the updated sparse coefficient and dictionary;
[0020] S11, determine whether the iterative convergence condition is met, if so, output the optimal discriminant dictionary D len , otherwise return to step S7;
[0021] S12. Use kNN classifier to classify images.
[0022] Preferably, in step S2, different feature extraction methods are used to pre-process four types of data sets, namely, objects, faces, scenes and textures, to generate image sample sets.
[0023] Preferably, step S3, constructing a dictionary learning model, is as follows:
[0024] Set the sample data to Dictionary for
[0025] Where n represents the dimension of the data, N represents the number of samples y, and K represents the number of dictionary atoms d. Represents the set of real numbers.
[0026] Therefore, the dictionary learning model under the L2 norm is:
[0027] in, is a sparse coefficient, and λ (λ>0) is a non-negative positive parameter. Therefore, the objective function of dictionary learning can be expressed as:
[0028]
[0029] Among them, D * and S * Represent the updated dictionary matrix and sparse coefficient matrix respectively.
[0030] Preferably, in step S4, a category label matrix A is constructed according to the image sample set in step S2 and the dictionary learning model in step S3, as follows:
[0031] Assume that the sample is represented as Y = [y1, y2, y3, y4, y5, y6, y7, y8, y9], when samples y1, y2 and y3 are from the first category, y4, y5 and y6 are from the second category, and y7, y8 and y9 are from the third category, the label matrix can be defined as:
[0032]
[0033] Among them, each diagonal block in the matrix A represents a subspace of each class, expanded to N samples, and the matrix A is defined as The number of atoms in the dictionary is set to be equal to the number of samples, that is, K = N, so the objective function of supervised dictionary learning can be re-expressed as:
[0034]
[0035] Among them, the dictionary Sparse coefficient α (α>0) is the regularization parameter of the label constraint term.
[0036] Preferably, in step S5, a Laplace matrix is constructed using sample data: L=MW.
[0037] in, is the Laplace matrix. represents the weight matrix. Represents the degree matrix, and M is a diagonal matrix. The Gaussian function is used to calculate the weight w in the weight matrix W. ij :
[0038]
[0039] Among them, σ (σ>0) is the bandwidth parameter of the Gaussian kernel function, <y i ,y j > represents y i and j There are connected paths between them, that is, a connected undirected graph. The diagonal elements M of the degree matrix M ii It can be expressed as:
[0040] Preferably, in step S6, Laplace eigenmapping is used to reduce the dimension of the training samples, and the local feature relationship between the training samples is forced to be a local feature relationship between sparse coefficients S (Y=DS) using the Laplace matrix L. The objective function of Laplace eigenmapping optimization is as follows:
[0041]
[0042] Where tr(·) is the trace of the matrix. Adding the Laplace eigenmap constraint as a regularization term to the objective function of the dictionary yields:
[0043]
[0044] Among them, β (β>0) is the regularization parameter of the Laplace eigenmap constraint term.
[0045] Preferably, in step S7, a dictionary suppressing intra-class differences is constructed, and the intra-class sparse mean vector is calculated:
[0046] Assume that the training sample Y contains N samples, C different categories, and the number of samples in each category is x c =(1,2,…,C), then Let the sparse coefficient submatrix corresponding to each type of training sample be
[0047] Among them, different sparse coefficients si in the same category have different intra-class sparse mean vectors μ i , the sparse mean vector μ within the class i It can be expressed as:
[0048]
[0049] Here, t represents the number of iterations.
[0050] Preferably, step S8 optimizes the dictionary model by minimizing the intra-class sparse mean square error of the sparse representation to generate an objective function:
[0051]
[0052] Among them, γ (γ>0) is the regularization parameter of the intra-class difference suppression constraint term, D (t) and S (t) Represents the dictionary matrix and sparse coefficient matrix obtained by the tth iteration update.
[0053] Preferably, in step S9, an analytical method is used to solve the objective function, and the sparse coefficient S and the dictionary D are iteratively updated, that is, the partial derivatives of the sparse coefficient and the dictionary are respectively calculated to obtain:
[0054]
[0055] Among them, I is the unit matrix; θ (θ>0) is a small constant, which ensures that the update formula of the dictionary D is a non-singular function.
[0056] Preferably, step S10, according to the updated sparse coefficient S (t) and dictionary D (t) Calculation error ε (t) :
[0057]
[0058] Wherein, F represents the F-norm.
[0059] Preferably, step S11, determining the dictionary D (t) Whether the iterative convergence condition is met, if so, the optimal discriminant dictionary is output: D len =D (t) ; If not satisfied, execute step S7. The iterative convergence condition is expressed as:
[0060] |ε (t) -ε (t-1) |<ε0 or max D |D (t) -D (t-1) |<ε0.
[0061] Among them, ε0 represents the iteration termination parameter.
[0062] Preferably, in step S12, the sparse coefficient s of the test sample y is classified using a kNN classifier, and the update formula of the sparse coefficient s of the sample y is as follows:
[0063]
[0064] The kNN classifier is used between the sparse coefficients corresponding to the training sample and the sample to be tested, the distance between the sparse coefficient of the test sample and the sparse coefficient of the training sample is calculated, and the label prediction of the sparse coefficient of the test sample is performed to achieve the final classification.
[0065] The beneficial effects of the present invention are:
[0066] (1) The present invention introduces a label matrix into the objective function to enhance the discriminability of the dictionary. By using the Laplace eigenmap, the local invariance of the original data is retained, and the local manifold structure in the sparse coding is retained; and by minimizing the deviation between sparse codes, the targets from the same class are more closely clustered together, further enhancing the discriminability of the dictionary; thus solving the problem of intra-class discreteness and local structural instability in sparse coding.
[0067] (2) Compared with the image classification method in the prior art, the classification accuracy of the present invention is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0069] Figure 1 It is a model structure diagram involved in an image classification method based on intra-class difference suppression dictionary learning in a preferred embodiment of the present invention;
[0070] Figure 2 It is an algorithm flow chart of an image classification method based on intra-class difference suppression dictionary learning according to a preferred embodiment of the present invention;
[0071] Figure 3 It is an undirected graph constructed by the present invention when performing Laplace eigenmapping;
[0072] Figure 4 These are image samples of the image datasets used in the present invention, where (a) is the Caltech101 image dataset, (b) is the Extended YaleB face image dataset, (c) is the Scene 15 natural scene image dataset, and (d) is the Alibaba Cloud Tianchi fabric image dataset. DETAILED DESCRIPTION
[0073] The following describes the implementation of the present invention through specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific implementations, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.
[0074] The preferred embodiment of the present invention discloses an image classification method based on intra-class difference suppression dictionary learning, referring to Figure 1 As shown in the figure, it is the model structure diagram of this method. Figure 2 , which is the algorithm flow chart involved in this method. Figure 4 , which is an image sample of the image data set used in the present invention. All images are processed according to the process of the method of this embodiment to illustrate in detail the effect of the method of the present invention on improving the reconstruction accuracy.
[0075] The present embodiment provides an image classification method based on intra-class difference suppression dictionary learning, comprising the following steps:
[0076] S1. Select image dataset.
[0077] S2. Use different feature extraction methods to preprocess the selected four types of data sets: objects, faces, scenes and textures, and generate image sample sets.
[0078] S3. Build a dictionary learning model: Set the sample data to Dictionary for
[0079] Where n represents the dimension of the data, N represents the number of samples y, and K represents the number of dictionary atoms d. Represents the set of real numbers.
[0080] Therefore, the dictionary learning model under the L2 norm is:
[0081] in, is a sparse coefficient. λ(λ>0) is a non-negative positive parameter. Therefore, the objective function of dictionary learning can be expressed as:
[0082]
[0083] Among them, D * and S * Represent the updated dictionary matrix and sparse coefficient matrix respectively.
[0084] S4. Construct a category label matrix A based on the image sample set in step S2 and the dictionary learning model in step S3: Assume that the sample is represented by Y = [y1, y2, y3, y4, y5, y6, y7, y8, y9]. When samples y1, y2 and y3 are from category 1, y4, y5 and y6 are from category 2, and y7, y8 and y9 are from category 3, the label matrix can be defined as:
[0085]
[0086] Among them, each diagonal block in the matrix A represents a subspace of each class, expanded to N samples, and the matrix A is defined as The number of atoms in the dictionary is set to be equal to the number of samples, that is, K = N, so the objective function of supervised dictionary learning can be re-expressed as:
[0087]
[0088] Among them, the dictionary Sparse coefficient α (α>0) is the regularization parameter of the label constraint term.
[0089] S5. Use sample data to construct the Laplace matrix: L=MW.
[0090] in, is the Laplace matrix. represents the weight matrix. Represents the degree matrix, and M is a diagonal matrix. The Gaussian function is used to calculate the weight w in the weight matrix W. ij :
[0091]
[0092] Among them, σ (σ>0) is the bandwidth parameter of the Gaussian kernel function, <y i ,y j > represents y i and j There are connected paths between them, that is, a connected undirected graph. The diagonal elements M of the degree matrix M ii It can be expressed as:
[0093] S6. Use Laplace eigenmapping to reduce the dimension of the training samples, and use the Laplace matrix L to force the local feature relationship between the training samples to be the local feature relationship between the sparse coefficients S (Y=DS). The objective function of Laplace eigenmapping optimization is as follows:
[0094]
[0095] where tr(·) is the trace of the · matrix. Adding the Laplace eigenmap constraint as a regularization term to the objective function of the dictionary yields:
[0096]
[0097] Where β (β>0) is the regularization parameter of the Laplace eigenmap constraint.
[0098] S7. According to the Laplace eigenmaps of step S5 and step S6, an intra-class difference suppression term is introduced, an intra-class difference suppression dictionary is constructed based on the label matrix and the Laplace eigenmap, and the intra-class sparse mean vector is calculated.
[0099] Assume that the training sample Y contains N samples, C different categories, and the number of samples in each category is x c =(1,2,…,C), then Let the sparse coefficient submatrix corresponding to each type of training sample be
[0100] Different sparse coefficients si in the same category have different intra-class sparse mean vectors μ i, the intra-class sparse mean vector μ i It can be expressed as:
[0101]
[0102] Here, t represents the number of iterations.
[0103] S8. Optimize the dictionary model by minimizing the intra-class sparse mean square error of the sparse representation and generate the objective function:
[0104]
[0105] Among them, γ (γ>0) is the regularization parameter of the intra-class difference suppression constraint term, D (t) and S (t) Represents the dictionary matrix and sparse coefficient matrix obtained by the tth iteration update.
[0106] S9. Solve the objective function using an analytical method, iteratively update the sparse coefficient S and the dictionary D, that is, calculate the partial derivatives of the sparse coefficient and the dictionary respectively, and obtain:
[0107]
[0108] Among them, I is the unit matrix; θ (θ>0) is a small constant, which ensures that the update formula of the dictionary D is a non-singular function.
[0109] S10, according to the updated sparse coefficient S (t) and dictionary D (t) Calculation error ε (t) :
[0110]
[0111] Wherein, F represents the F-norm.
[0112] S11. Judgement dictionary D (t) Whether the iterative convergence condition is met, if so, the optimal discriminant dictionary is output: D len =D (t) If not, execute step S7. The iterative convergence condition is:
[0113] |ε (t) -ε (t-1) |<ε0 or max D |D (t) -D (t-1) |<ε0.
[0114] S12. Use kNN classifier to classify the sparse coefficient s of the test sample y. The update formula of the sparse coefficient s of the sample y is as follows:
[0115]
[0116] The kNN classifier is used between the sparse coefficients corresponding to the training sample and the sample to be tested, the distance between the sparse coefficient of the test sample and the sparse coefficient of the training sample is calculated, and the label prediction of the sparse coefficient of the test sample is performed to achieve the final classification.
[0117] The following is a more detailed description of each step of the above embodiment in conjunction with specific data.
[0118] In step S1, the selected remote sensing datasets are specifically: Caltech101 image dataset, Extended YaleB face image dataset, Scene 15 natural scene image dataset and Alibaba Cloud Tianchi fabric image dataset.
[0119] In step S2, different feature extraction methods are used to preprocess the four types of data sets, namely, objects, faces, scenes and textures, to generate image sample sets.
[0120] For the Caltech101 image dataset, the six categories with the largest number of samples were selected for multiple experiments, including airplanes, motorcycles, leopards, faces, watches, and faces with simple backgrounds. 32, 64, and 80 samples were randomly selected from each category as training samples for training, and the remaining samples were used for testing. Depending on the number of training samples, the dictionary size was set to 192, 384, and 480 atoms, respectively.
[0121] For the Scene15 dataset, multiple sets of experiments were conducted by randomly selecting images from 15 categories of scenes. 100 samples were randomly selected from each category as training samples for training, and the remaining samples were used for testing. The dictionary size was set to 1500 atoms.
[0122] The above two data sets are preprocessed using a 3000-dimensional feature extraction method based on Scale-Invariant Feature Transform (SIFT). The specific feature extraction process for each image is divided into 6 steps:
[0123] 1) Image block division: At the pixel level, the image is divided into several 16×16 image blocks;
[0124] 2) Grid sampling: using a grid with a step size of 6 and performing dense sampling through translation;
[0125] 3) SIFT feature extraction: Use the SIFT algorithm to extract feature descriptors for the sampled image blocks;
[0126] 4) Constructing a spatial pyramid: Based on the extracted SIFT features, a three-layer spatial pyramid is constructed, with the three layers using grid sizes of 1×1, 2×2, and 4×4 respectively;
[0127] 5) k-means clustering: The spatial pyramid codebook is trained using the standard k-means clustering algorithm, where the value of k is 1024;
[0128] 6) PCA Dimensionality Reduction: Finally, the principal component analysis (PCA) method is used to reduce the spatial pyramid feature vector from its original dimension to 3000 dimensions.
[0129] For the Extended YaleB face image dataset, 38 people's face images are randomly selected for classification. 32 samples are randomly selected from each category as training samples for training, and the remaining samples are used for testing. The dictionary size is set to 1216 atoms. The random face feature extraction method is used to preprocess the face images. The specific feature extraction process of each face image is divided into two steps:
[0130] 1) Generate random features: Generate a 504-dimensional feature vector using a random matrix for the original image;
[0131] 2) Normalization: Normalize the 504-dimensional feature vector.
[0132] For the Alibaba Cloud Tianchi fabric image dataset, multiple categories such as rub holes, hanging warps, stains, coarse yarn, and broken edges are merged into the defect category. Therefore, the fabric images are divided into two categories: normal and defective, and multiple groups of experiments are randomly selected from the two categories of fabric images. 50, 100, and 200 samples are randomly selected from each category as training samples for training, and the remaining samples are used for testing. Depending on the number of training samples, the dictionary size is set to 100, 200, and 400 atoms, respectively.
[0133] The feature extraction of fabric images is carried out by combining the Histogram of Gradient (HOG), Gray-Level Co-occurrence Matrix (GLCM) and Local Binary Patterns (LBP), and the feature dimension is reduced by principal component analysis (PCA). The specific feature extraction process of each image is divided into 6 steps:
[0134] 1) grayscale the input fabric image;
[0135] 2) Use the LBP algorithm to perform binary calculation on the grayscale image and extract the binary texture image;
[0136] 3) Use the HOG algorithm to perform secondary feature extraction on the binary texture image to obtain the LBP-HOG feature vector;
[0137] 4) Use PCA algorithm to reduce the dimension of LBP-HOG feature vector to 496 dimensions;
[0138] 5) Using the GLCM algorithm to extract the gray-level co-occurrence matrix features of the fabric image, an 8-dimensional feature vector is obtained;
[0139] 6) The reduced LBP-HOG feature vector is combined with the feature vector extracted by the GLCM algorithm into a 504-dimensional vector as the fabric image feature.
[0140] Step S3, constructing a discriminative unstructured dictionary learning model.
[0141] Set the sample data to Dictionary for Since the L2 norm is a smooth convex function with continuous differentiability, it is easier to solve in optimization problems. And the L2 norm has a unique solution, making the classification results more stable and reliable. Therefore, the discriminative unstructured dictionary learning model obtained by using the L2 norm is:
[0142] in, is the sparse coefficient. λ (λ>0) is a non-negative positive parameter used to weigh the weight of reconstruction error and sparsity. Therefore, the objective function of dictionary learning can be expressed as:
[0143]
[0144] Step S4: According to step S4, the expression of sparse coefficients can maintain the attributes of the category labels, and to a certain extent, the sparse coefficients belong to the subspace spanned by the association coefficients, thereby improving the classification performance. Using the category label information of the training samples, a supervised dictionary learning model is constructed. First, the category label matrix A is constructed:
[0145] Assume that the sample is represented as Y = [y1, y2, y3, y4, y5, y6, y7, y8, y9], when y1, y2 and y3 are from the first category, y4, y5 and y6 are from the second category, and y7, y8 and y9 are from the third category, the label matrix can be defined as:
[0146]
[0147] Among them, each diagonal block in the matrix A represents a subspace of each class, expanded to N samples, and the matrix A is defined as The number of atoms in the dictionary is set to be equal to the number of samples, that is, K = N, so the objective function of supervised dictionary learning can be re-expressed as:
[0148]
[0149] Among them, the dictionary Sparse coefficient α (α>0) is the regularization parameter of the label constraint term, which is used to weigh the weight of the label matrix in the entire model.
[0150] Step S5, based on the supervised dictionary learning model constructed in step S4, using the Laplace feature mapping algorithm, the original data is mapped into a new low-dimensional feature space, and the Laplace matrix of the sample data is calculated: L=MW.
[0151] in, is the Laplace matrix. represents the weight matrix. Represents the degree matrix, and M is a diagonal matrix. The Gaussian function is used to calculate the weight w in the weight matrix W. ij :
[0152]
[0153] Among them, σ (σ>0) is the bandwidth parameter of the Gaussian kernel function, <y i ,y j > represents y i and j There are connected paths between them, that is, a connected undirected graph. The diagonal elements M of the degree matrix M ii It can be expressed as:
[0154] Step S6, Laplace eigenmapping is used to reduce the dimension of the training samples. Since there is a linear relationship Y=DS between the training sample Y and the sparse coefficient S, according to the principle of Laplace eigenmapping, the local feature relationship between the training samples is forced to be the local feature relationship between the sparse coefficients S using the Laplace matrix L. The objective function of Laplace eigenmapping optimization is as follows:
[0155]
[0156] Where tr(·) is the trace of the matrix. Adding the Laplace eigenmap constraint as a regularization term to the objective function of the dictionary yields:
[0157]
[0158] Among them, β (β>0) is the regularization parameter of the Laplace eigenmap constraint term, which is used to weigh the weight of local invariance in the entire model.
[0159] Step S7, construct an intra-class difference suppression dictionary so that objects from the same category are aggregated into the intra-class sparse mean vector. First, calculate the intra-class sparse mean vector:
[0160] Assume that the training sample Y contains N samples, C different categories, and the number of samples in each category is x c =(1,2,…,C), then Let the sparse coefficient submatrix corresponding to each type of training sample be
[0161] Different sparse coefficients si in the same category have different intra-class sparse mean vectors μ i , the sparse mean vector μ within the class i It can be expressed as:
[0162]
[0163] Here, t represents the number of iterations.
[0164] Step S8, according to the intra-class sparse mean vector calculated in step S7, the dictionary model is optimized by the intra-class difference suppression constraint (minimizing the intra-class sparse mean square error of the sparse representation) to generate the objective function:
[0165]
[0166] Among them, γ (γ>0) is the regularization parameter of the intra-class difference suppression constraint, which is used to weigh the weight of intra-class difference suppression in the entire model.
[0167] Step S9, solve the objective function using an analytical method, and iteratively update the sparse coefficient S and the dictionary D. The analytical method obtains the optimal solution by taking the derivative to zero, or by using the Lagrange multiplier method. That is, when optimizing the sparse coefficient S, the dictionary D is regarded as a constant, and vice versa. Therefore, the update process of the sparse coefficient S and the dictionary D is as follows:
[0168] 1) Initialization: For the initial dictionary matrix D (0) , use Gaussian random matrix to initialize the dictionary matrix D (0) After the initial dictionary is determined, the initial value S of the sparse coefficient matrix S is (0) The extreme value of S can be obtained by using the dictionary learning model in step S3, namely:
[0169]
[0170] 2) Update the sparse coefficient:
[0171]
[0172] 3) Update the dictionary:
[0173]
[0174] Among them, I is the unit matrix; θ (θ>0) is a small constant, which ensures that the update formula of the dictionary D is a non-singular function.
[0175] Step S10, based on the updated sparse coefficient S (t) and dictionary D (t) Calculation error ε (t) :
[0176]
[0177] Step S11, determine whether the iterative convergence condition is met, if so, output the optimal discriminant dictionary: D len =D (t) If not, then execute step S7. The iterative convergence condition is expressed as:
[0178] |ε (t) -ε (t-1) |<ε0 or max D |D (t) -D (t-1) |<ε0.
[0179] Step S12, using kNN classifier to classify the sparse coefficient s of the test sample y, the update formula of the sparse coefficient s of the sample y is as follows:
[0180]
[0181] The kNN classifier is used between the sparse coefficients corresponding to the training sample and the sample to be tested, the distance between the sparse coefficient of the test sample and the sparse coefficient of the training sample is calculated, and the label prediction of the sparse coefficient of the test sample is performed to achieve the final classification.
[0182] Table 1 is the common parameter table;
[0183] Table 1
[0184]
[0185] Table 2 is the independent parameter table of each data set;
[0186] Table 2
[0187]
[0188] Table 3 is a comparison table of classification accuracy of different methods on the Caltech101 dataset;
[0189] Table 3
[0190]
[0191] As can be seen from Table 3, the IVS-DL method gradually improves the classification accuracy as the number of training samples increases. The classification accuracy in 32 (Group 1), 64 (Group 2) and 80 (Group 3) training samples is 98.65%, 98.96% and 99.21% respectively, which is higher than the other six methods. Compared with the second best LRSDL method, the IVS-DL method has better generalization performance and has advantages in suppressing intra-class variation. And as the number of training samples increases, the classification accuracy gradually improves.
[0192] Table 4 is a comparison table of the classification accuracy of different methods on the Extended YaleB face image dataset and the Scene15 natural scene image dataset;
[0193] Table 4
[0194]
[0195] As shown in Table 4, the IVS-DL method achieves classification accuracy of 97.11% and 98.49% in the Extended YaleB face image dataset and the Scene15 natural scene image dataset, respectively. The classification accuracy of the IVS-DL method on the Extended YaleB face image dataset is 1.06% higher than that of the FDDL method. The intra-class difference suppression term of the IVS-DL method further reduces the intra-class dispersion of the sparse coefficients, and the similar feature points of the face images gather toward their respective class centers, making the sparse coefficients more discriminative. It can be seen that the classification accuracy of all methods on the Scene15 dataset is above 97%, which shows that dictionary learning can well represent the scene image features of complex backgrounds. Under the optimal conditions of all parameters, the IVS-DL method achieves a classification accuracy of 98.49% on the Scene15 dataset, which is slightly higher than the second SRC method by 0.12% and higher than the LRSDL method with poor classification results by 1.38%. The LRSDL method, which has outstanding classification performance in face recognition and object recognition, did not achieve satisfactory performance in scene recognition. The IVS-DL method demonstrated its excellent classification accuracy on different types of data sets, further verifying the strong robustness of the IVS-DL method.
[0196] Table 5 is a comparison table of the classification accuracy of different methods on the Alibaba Cloud Tianchi fabric image dataset;
[0197] Table 5
[0198]
[0199] As can be seen from Table 5, compared with the results of the other three datasets, the recognition accuracy of all methods for fabric images has dropped significantly. There are two reasons for this: first, the background of the fabric image is relatively simple, and in the sparse representation process, the defect feature points may be filtered out as noise, thereby increasing the inter-class ambiguity in the feature space; second, the feature pair dictionary extracted for texture images has weak discriminant ability. Despite this, the IVS-DL method still achieves the best classification performance in texture recognition. In the training with a sample size of 50, the classification accuracy of the IVSDL method is 3% lower than that of the best FDDL method. However, in the training with a sample size of 100 and 200, the IVS-DL method achieved the best results, with classification accuracy rates of 66.11% and 76.07%, respectively.
[0200] The results of the above embodiments well demonstrate the rationality and effectiveness of the category label matrix, Laplace matrix and intra-class difference suppression constraint constructed in steps S4-S9. By introducing the label matrix, the discriminability of the dictionary is enhanced. By using the Laplace eigenmap, the local invariance of the original data is retained, ensuring the retention of the local manifold structure in sparse coding. By minimizing the deviation between sparse codes, targets from the same class are encouraged to be more closely clustered together, further enhancing the discriminative ability of the dictionary. The problem of intra-class discreteness and local structural instability in sparse coding is effectively solved.
[0201] In summary, the present invention discloses an image classification method based on dictionary learning with intra-class difference suppression. The present invention uses the public Caltech101 dataset, Extended YaleB face dataset, Scene15 dataset and Alibaba Cloud Tianchi fabric dataset for illustration, and uses different feature extraction methods to pre-process these four types of datasets. The present invention has supervision, local invariance and intra-class difference suppression for image classification tasks, and effectively solves the adaptive learning under different image classification tasks. First, a label matrix is constructed on the basis of supervised dictionary learning, and the category label information of the training sample is associated with the sparse coefficient, so that the sparse coefficients of the same category belong to the subspace spanned by the category label. Secondly, a Laplacian matrix is constructed using the training samples, and the Laplacian matrix is used to perform feature mapping constraints on the sparse coefficients, so that the local feature relationship of the original data is retained in the sparse coefficients. In addition, by minimizing the intra-class deviation between the sparse coefficients, targets from the same category are encouraged to gather toward the class center, thereby improving the discriminability of the dictionary. Finally, the sparse coefficients of the image to be tested are classified using a kNN classifier. The present invention improves the accuracy of image classification by constructing a category label matrix and a Laplace matrix and adopting intra-class difference suppression constraints.
[0202] Compared with the image classification method in the prior art, the image classification method based on intra-class difference suppression dictionary learning of the present invention has higher classification accuracy.
[0203] The embodiments described above are merely descriptions of preferred implementations of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope of the present invention.
Claims
1. Image classification method based on intra-class difference inhibitory dictionary learning, characterized by The steps include: S1, select image dataset; S2, preprocessing the image selected in step S1 by using a feature extraction method to generate an image sample set; S3, build a supervised dictionary learning model; S4, constructing a category label matrix according to the image sample set in step S2 and the dictionary learning model in step S3; S5, constructing a Laplacian matrix using the sample data in the image sample set in step S2; S6, regularizing the training samples in the image sample set in step S2 using Laplace eigenmap; S7, constructing a dictionary that suppresses intra-class differences and calculating the intra-class sparse mean vector; S8, optimizing the dictionary model by minimizing the intra-class deviation between sparse coefficients to generate an objective function; S9, solving the objective function using an analytical method, and iteratively updating the sparse coefficients and the dictionary; S10, calculating the error according to the updated sparse coefficient and dictionary; S11, judging whether the iterative convergence condition is met, if so, outputting the optimal discriminant dictionary, otherwise returning to step S7; S12. Use kNN classifier to classify images.
2. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 1, characterized in that: In step S2, different feature extraction methods are used to preprocess four types of image data sets, namely, objects, faces, scenes and textures, to generate image sample sets.
3. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 1 or 2, characterized in that: In step S3, the supervised dictionary learning model is constructed as follows: Assume the sample data is Dictionary for Where n represents the dimension of the data, N represents the number of samples y, and K represents the number of dictionary atoms d. represents the set of real numbers; The dictionary learning model under the L2 norm is obtained as follows: in, is a sparse coefficient, λ is a non-negative regular parameter; the objective function of dictionary learning is expressed as: Among them, D * and S * Represent the updated dictionary matrix and sparse coefficient matrix respectively.
4. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 3, characterized in that: In step S4, a category label matrix A is constructed according to the image sample set in step S2 and the dictionary learning model in step S3, as follows: Assume that the sample is represented as Y = [y1, y2, y3, y4, y5, y6, y7, y8, y9], samples y1, y2 and y3 are from the first category, y4, y5 and y6 are from the second category, y7, y8 and y9 are from the third category, and the label matrix is defined as: Among them, each diagonal block in the matrix A represents a subspace of each class, expanded to N samples, and the matrix A is defined as Setting the number of atoms in the dictionary equal to the number of samples, that is, K = N, the objective function of supervised dictionary learning is re-expressed as: Among them, the dictionary Sparse coefficient α is the regularization parameter of the label constraint.
5. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 4, characterized in that: In step S5, the sample data is used to construct a Laplace matrix: L = MW; in, is the Laplace matrix; represents the weight matrix; Represents the degree matrix, and M is a diagonal matrix; the Gaussian function is used to calculate the weight w in the weight matrix W ij : Where σ is the bandwidth parameter of the Gaussian kernel function, <y i ,y j > represents y i and j There are connected paths between them, that is, a connected undirected graph; the diagonal elements M of the degree matrix M ii It is expressed as:
6. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 5, characterized in that: In step S6, the training samples are subjected to dimensionality reduction using Laplace eigenmapping, and the local feature relationships between the training samples are forced to be local feature relationships between sparse coefficients S using the Laplace matrix L. The objective function of the Laplace eigenmapping optimization is as follows: Among them, tr(·) is the trace of the · matrix; the Laplace eigenmap constraint is added as a regular term to the objective function of the dictionary to obtain: Among them, β is the regularization parameter of the Laplace eigenmap constraint term.
7. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 6, characterized in that: In step S7, an intra-class difference suppression dictionary is constructed and the intra-class sparse mean vector is calculated, as follows: Suppose the training sample Y contains N samples, C different categories, and the number of samples in each category is x c =(1,2,…,C), then Let the sparse coefficient submatrix corresponding to each type of training sample be Different sparse coefficients si in the same category have different intra-class sparse mean vectors μ i , the intra-class sparse mean vector μ i It is expressed as: Here, t represents the number of iterations.
8. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 7, characterized in that: In step S8, the dictionary model is optimized by minimizing the intra-class sparse mean square error of the sparse representation to generate the objective function: Among them, γ is the regularization parameter of the intra-class difference suppression constraint term, D (t) and S (t) Represents the dictionary matrix and sparse coefficient matrix obtained by the tth iteration update.
9. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 8, characterized in that: In step S9, the objective function is solved by an analytical method, and the sparse coefficient S and the dictionary D are iteratively updated, that is, the partial derivatives of the sparse coefficient and the dictionary are respectively obtained to obtain: Where I is the identity matrix and θ is a constant.
10. The image classification method based on intra-class difference suppression dictionary learning as claimed in claim 9, characterized in that: In step S10, according to the updated sparse coefficient S (t) and dictionary D (t) Calculation error ε (t) : Where, F represents the F norm; The iterative convergence condition of step S11 is: |e (t) -e (t-1) |<ε0 or Among them, ε0 represents the iteration termination parameter; judge whether the iteration convergence condition is met, if it is met, output the optimal discriminant dictionary: D len =D (t) , if not satisfied, execute step S7; In step S12, the kNN classifier is used to classify the sparse coefficient s of the test sample y. The update formula of the sparse coefficient s of the sample y is as follows:
Citation Information
Cited By
Fast image classification method based on multi-level approximation dictionary learning
CN119380072A
Fast image classification method based on multi-level approximation dictionary learning
CN119380072B
Pipeline image classification method and device and electronic equipment
CN120747646A
