Robust semi-supervised image classification method based on sparse representation
Through a robust semi-supervised image classification method based on sparse representation and PCA dimensionality reduction, the existing semi-supervised learning methods are solved, and efficient image classification is achieved, and processing efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411130214.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-16
AI Technical Summary
The existing semi-supervised learning methods are complex and slow in image classification, making it difficult to effectively utilize labelless data, and transduced semi-supervised learning is inefficient for off-sample testing, and the inductive semi-supervised learning time is high, resulting in a decrease in processing efficiency.
A robust semi-supervised image classification method based on sparse representation is proposed. By constructing the internal relationship of graph mining data, using sparse representation and PCA dimensionality reduction, the objective function is set, and the classifier and classification bias are obtained through iterative optimization, and the algorithm is improved Robustness and efficiency.
It significantly improves the efficiency of image classification processing, suppresses the influence of outliers in the data, improves the robustness of the algorithm and classification accuracy, and is suitable for practical engineering applications.
Smart Images

Figure CN119091202A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image classification and pattern recognition, and relates to a robust semi-supervised image classification method based on sparse representation. Background Art
[0002] In most image applications, massive image data is relatively easy to obtain, but the labels of these data need to be manually annotated, and large-scale acquisition is time-consuming and labor-intensive. In this case, how to make full use of abundant unlabeled data is particularly important. Semi-supervised learning, which uses labeled data and unlabeled data to learn prediction models, is a learning method suitable for this situation. Semi-supervised learning models are divided into transductive learning models and inductive learning models. Transductive semi-supervised learning methods learn labels for unlabeled data by propagating labels from labeled data to unlabeled data. The disadvantage of this method is that they cannot be used for out-of-sample testing, and new test data is not included in the unlabeled data. Therefore, when new data needs to be annotated, transductive semi-supervised learning methods need to merge these new test data into the existing data, and then reconstruct the entire model based on the merged data. This method is very inefficient for out-of-sample data testing. Inductive semi-supervised learning methods use labeled data and unlabeled data to learn classifiers, and the learned classifiers can be used for unlabeled data as well as new out-of-sample test data. The present invention is a joint model of transductive semi-supervision and inductive semi-supervision, which can complete the propagation of labels and summarize the classifier for the classification of new test data during the learning process.
[0003] Ai Ming (Semi-supervised learning and clustering algorithm based on hypergraph cutting [J]. Computer measurement and control: 1-9 [2024-03-26]) proposed semi-supervised learning based on hypergraph cutting. This method introduces the total variation on the hypergraph as the Lovalz extension of hypergraph cutting, and on this basis proposes a set of regularization functions, and proposes a semi-supervised learning method based on the regularization function family. Although the algorithm takes into account the synchronization of graph construction and label propagation and the adverse effects of high-frequency information of data on classification, the model needs to construct a graph to mine the implicit information in the data, which makes the algorithm time complexity high, runs slowly, and is difficult to apply in engineering practice.
[0004] At present, in the field of image classification, the image processing process is often limited by the high cost of label annotation, which leads to a decrease in processing efficiency. Semi-supervised classification methods can mine important classification information contained in unlabeled data and use the information of labeled data to classify unlabeled data. Among the many semi-supervised classification methods, research based on graph methods has been one of the research hotspots in the field of machine learning and data mining in recent years. However, on large sample data, building graphs will lead to complex and slow calculations. Therefore, how to improve classification efficiency and classification accuracy at the same time is still a challenge for semi-supervised classification methods. Summary of the invention
[0005] Technical issues to be solved
[0006] In order to avoid the shortcomings of the prior art, the present invention proposes a robust semi-supervised image classification method based on sparse representation. Graph-based semi-supervised learning mines the internal relationship of data by constructing a graph and uses the graph to summarize the model. However, the graph-based semi-supervised classification algorithm will lead to slow calculation. In view of the above problems, the present invention proposes a semi-supervised classification method--a robust semi-supervised image classification method based on sparse representation.
[0007] Technical Solution
[0008] A robust semi-supervised image classification method based on sparse representation, characterized by the following steps:
[0009] Step 1: Divide the dataset containing n a×b pixel-scale images into a training set and a test set; stretch the training set to an image data matrix in Stretch the test set to an image data matrix in
[0010] Step 2: Normalize the image data matrix row by row to obtain the normalized original data matrix and Finally, the normalized image data matrix is subjected to dimensionality reduction processing using PCA according to the contribution rate. The dimension after dimensionality reduction is d, and the processed image matrix is and
[0011] Step 3: Set the objective function, i.e., the robust semi-supervised image classification model based on sparse representation, and then train the training set:
[0012] Based on the image data matrix X, the membership matrix is randomly initialized It is required that the row sum is 1, f ij is the element in the i-th row and j-th column of matrix F, representing the i-th data point x iThe membership degree of the j-th classification is set to 1 in the column corresponding to the label and 0 in the other columns for the labeled data; random initialization Given parameters p, r;
[0013] The objective function is set as the robust semi-supervised image classification model based on sparse representation:
[0014]
[0015] F l =Y l ,F≥0,F1=1
[0016] Among them, W is the classifier, b is the classification bias; x i is the i-th column of matrix X, representing the i-th sample; c is the number of classification categories; F l =Y l It means that there are l labels in F and the remaining nl are unlabeled; r is a parameter; t j is the j-th column vector of matrix T, t j All rows except the jth row are 0, and p is a parameter greater than 0;
[0017] Step 4: Initialize the indicator matrix T:
[0018]
[0019] Step 5. Fix W,b and update the matrix F element by element using the following expression:
[0020]
[0021] Calculate the intermediate quantity matrix M element by element,
[0022] Step 6, fix F,b, and update the matrix W by the following expression;
[0023]
[0024] Step 7. Fix F and W and update vector b by the following expression:
[0025]
[0026] Step 8: Loop steps 5 to 7 until the value of the objective function converges, and output the classifier W, bias b and classification membership matrix F, where each row of F corresponds to a sample, and the column number where the maximum value in each row is located represents the category to which the sample belongs;
[0027] Step 9: Substitute the trained W and b into the formula The square of the distance between each sample in the test set and the category vector in the classification space is obtained, and the column number where the minimum value is located is the category to which the sample belongs, thereby completing the classification of the test set data.
[0028] When the image data matrix is normalized row by row in step 2, the mean of each row is set to zero and the standard deviation is set to 1.
[0029] In step 2, the contribution rate is selected from 85% to 95%.
[0030] The membership of the labeled samples in step 3 needs to be given in advance.
[0031] The number of classification categories c in step 3 is given by the data set.
[0032] The ratio of the training set to the test set is determined according to the actual situation of the data set.
[0033] An electronic device, characterized in that it includes a processor and a memory, wherein the processor is used to implement the steps of a data migration method for a robust semi-supervised image classification method based on sparse representation when executing a computer program stored in the memory.
[0034] A readable storage medium, characterized in that a computer program is stored on the readable storage medium, and when the computer program is executed by a processor, the steps of a data migration method for a robust semi-supervised image classification method based on sparse representation are implemented.
[0035] A computer program product, characterized by comprising computer executable instructions, which, when executed, are used to implement the method described in the robust semi-supervised image classification method based on sparse representation.
[0036] Beneficial Effects
[0037] The present invention proposes a robust semi-supervised image classification method based on sparse representation, which divides a data set into a training set and a test set, and stretches each of them into an image data matrix and normalizes them; after setting an objective function, the training set is trained, and the data classification of the training set and the test set is obtained by using the classifier and classification bias obtained by the training.
[0038] The beneficial effects of the present invention include:
[0039] (1) The present invention proposes a method of utilizing The semi-supervised learning framework based on norm mining of implicit information in unlabeled data suppresses the influence of outliers in the data on classification and improves the robustness of the algorithm.
[0040] (2) The present invention introduces The norm makes the matrix in the algorithm operation process more sparse, and the image data processing efficiency is significantly improved. Therefore, the practicability of the present invention in actual engineering applications is stronger.
[0041] (3) The present invention uses the size of membership to characterize the category to which the sample belongs, which is less affected by boundary points and has stronger robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 Flow chart of the method of the present invention
[0043] Figure 2 Specific implementation flow chart of the present invention on the COIL20 object dataset
[0044] Figure 3 Results of the present invention on the COIL20 dataset compared with the comparison algorithms LGC and ASL DETAILED DESCRIPTION
[0045] The present invention will now be further described with reference to the embodiments and the accompanying drawings:
[0046] The basic flow chart of data processing of the present invention is shown at the end of this article. Figure 1 As shown, the specific steps are as follows:
[0047] Step 1: Divide the dataset containing n a×b pixel-scale images into a training set and a test set; stretch the training set to an image data matrix in Stretch the test set to an image data matrix in
[0048] Step 2: Normalize the image data matrix row by row to obtain the normalized original data matrix and Finally, the normalized image data matrix is subjected to dimensionality reduction processing using PCA according to the contribution rate. The dimension after dimensionality reduction is d, and the processed image matrix is and
[0049] The contribution rate is selected based on the data and experimental results, and is generally 85% to 95%. The dimension after dimensionality reduction is d, and the processed image matrix is
[0050] Step 3: Based on the image data matrix X, randomly initialize the membership matrix It is required that the row sum is 1, f ij is the element in the i-th row and j-th column of matrix F, representing the i-th data point x iThe membership degree of the j-th classification is set to 1 in the column corresponding to the label and 0 in the other columns for the labeled data; random initialization Given parameters p, r. The algorithm objective function is
[0051]
[0052] Among them, W is the classifier, b is the classification bias; x i is the i-th column of matrix X, representing the i-th sample; c is the number of classification categories, which needs to be given in advance according to the data set; F l =Y l It means that there are l labels in F and the remaining nl are unlabeled. The membership of the labeled samples needs to be given in advance; r is a parameter; t j is the j-th column vector of matrix T, t j Except for the jth row which is 1, all other rows are 0, and p is a parameter greater than 0.
[0053] Step 4: Initialize the indicator matrix T
[0054]
[0055] Step 5: Fix W,b and update the matrix F element by element using the following expression
[0056]
[0057] Step 6: Calculate the intermediate quantity matrix M element by element.
[0058] Step 7: Fix F,b and update the matrix W by the following expression
[0059]
[0060] Step 8: Fix F, W and update vector b by the following expression
[0061]
[0062] Step 9: Loop through steps 5 to 8 until the value of the objective function (1) converges, and output the classifier W, bias b, and classification membership matrix F, where each row of F corresponds to a sample, and the column number of the maximum value in each row represents the category to which the sample belongs.
[0063] Step 10: Substitute the trained W and b into the formula The square of the distance between each sample in the test set and the category vector in the classification space is obtained, and the column number where the minimum value is located is the category to which the sample belongs, thereby completing the classification of the test set data.
[0064] The following is an example of the object image dataset COIL20 to illustrate the specific implementation steps of the proposed method for classification, but the technical content of the present invention is not limited to the scope described. The object image dataset COIL20 contains 1440 object images with a pixel scale of 32×32, which has a total of 20 objects. The dataset is obtained by taking a picture of each object every 5 degrees and then horizontally circling it, that is, 72 images of each object, a total of 1440 images.
[0065] Implementation step 1: Take 64 images of each object as the training set and the remaining 8 images as the test set; these 1280 images are stretched into an image data matrix Among them, 1024 = 32 × 32 is the total number of pixels of a single COIL20 image; because the scale of the collected data is not uniform, the image data matrix needs to be normalized row by row before the calculation, so that the mean of each row is zero and the standard deviation is 1, and the original data matrix after normalization is obtained Considering that the data in the image is relatively sparse, it is not convenient for subsequent inverse operations. At the same time, in order to improve the operation speed, it is necessary to use PCA to reduce the dimension of the normalized image data matrix. The dimension reduction is performed in a way that retains a certain contribution rate. The dimension after dimension reduction is d=88, and the processed image matrix is
[0066] At the same time, the test set is stretched into an image data matrix in
[0067] Implementation step 2: Based on the data matrix X, the following robust semi-supervised image classification model based on sparse representation is proposed
[0068]
[0069] Before solving, some variables need to be initialized. Here we use the random initialization method. Randomly initialize the membership matrix It is required that the row sum is 1. For labeled data, its membership is the corresponding label; random initialization Given parameters p = 1.5, r = 2. The problem to be solved is
[0070]
[0071] Implementation step 3: Alternately iterate and optimize the objective function (7) constructed in step 3, train the model, and thus obtain the classifier W, b and the membership degree F of the unlabeled data.
[0072] ① Initialize the indicator matrix T
[0073]
[0074] ②Fix W, b, find F
[0075] When W and b are fixed, problem (7) is equivalent to
[0076]
[0077] The above optimization problem is a constrained optimization problem, which can be solved by constructing a Lagrangian function. Let d ij =||W T x i +bt j ||2, construct the Lagrangian function as follows
[0078]
[0079] In order to obtain the optimal F, the partial derivative of the function L1(F) with respect to F must be zero, that is,
[0080]
[0081] Notice Solved
[0082]
[0083] ③Fix F to find W,b
[0084] When F is fixed, problem (7) is equivalent to
[0085]
[0086] Due to direct Norm optimization is difficult, so the approximate approximation method is used here to optimize the objective function (13). set up is a fixed value, then the objective function is
[0087]
[0088] At this time, W and b are easier to solve, m ij Update after each optimization of W and b. W and b are also optimized alternately.
[0089] When b is fixed and W is updated, the optimization problem (7) is transformed into
[0090]
[0091] The above problem is an unconstrained optimization problem, which can be solved by using partial derivatives to rewrite the above formula into a function form:
[0092]
[0093] In order to find the optimal W, the partial derivative of the function L2(W) with respect to W must be zero
[0094]
[0095] Solved
[0096]
[0097] When W is fixed and b is updated, the optimization problem (7) is transformed into
[0098]
[0099] This is an unconstrained optimization problem, which can be solved by using partial derivatives to rewrite the above formula into a function form
[0100]
[0101] In order to find the optimal b, the partial derivative of the function L3(b) with respect to b must be zero
[0102]
[0103] Solved
[0104]
[0105] ④ Repeat steps ②-③, and after convergence, obtain W, b and F. F is the membership of each sample in the training set to each category, and the column number where the maximum membership of each sample is located is the category to which the sample belongs.
[0106] Implementation step 4: Use the trained W and substitute it into the formula The square of the distance between each sample in the test set and the category vector in the classification space is obtained, and the column number where the minimum value is located is the category to which the sample belongs, thereby completing the classification of the test set data. Specific embodiment:
[0108] like Figure 3 As shown in the figure below, the results of the method proposed in the present invention and the comparison algorithms LGC (local and global consistency learning) and ASL (large-scale adaptive semi-supervised learning of joint induction and transduction model) on the COIL20 dataset are compared. The labels obtained after classification are compared with the real labels of the samples to obtain the overall classification accuracy as the evaluation index. The overall classification accuracy is 0-1. The larger the value, the better the classification method. As shown in the figure below, the classification accuracy of the method proposed in the present invention is significantly higher than that of the comparison algorithm when the proportion of given label data is high, which also proves the effectiveness of the method from the experimental aspect.
[0109] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should be included in the protection scope of the present invention.
Claims
1. A robust semi-supervised image classification method based on sparse representation, characterized in that Here are the steps: Step 1: Divide the dataset containing n a×b pixel-scale images into a training set and a test set; stretch the training set to an image data matrix in Stretch the test set to an image data matrix in Step 2: Normalize the image data matrix row by row to obtain the normalized original data matrix and Finally, the normalized image data matrix is subjected to dimensionality reduction processing using PCA according to the contribution rate. The dimension after dimensionality reduction is d, and the processed image matrix is and Step 3: Set the objective function, i.e., the robust semi-supervised image classification model based on sparse representation, and then train the training set: Based on the image data matrix X, the membership matrix is randomly initialized It is required that the row sum is 1, f ij is the element in the i-th row and j-th column of matrix F, representing the i-th data point x i The membership degree of the j-th classification is set to 1 in the column corresponding to the label and 0 in the other columns for the labeled data; random initialization Given parameters p, r; The objective function is set as the robust semi-supervised image classification model based on sparse representation: s.t.F l =Y l ,F≥0,F1=1 Among them, W is the classifier, b is the classification bias; x i is the i-th column of matrix X, representing the i-th sample; c is the number of classification categories; F l =Y l It means that there are l labels in F and the remaining nl are unlabeled; r is a parameter; t j is the j-th column vector of matrix T, t j All rows except the jth row are 0, and p is a parameter greater than 0; Step 4: Initialize the indicator matrix T: Step 5. Fix W,b and update the matrix F element by element using the following expression: Calculate the intermediate quantity matrix M element by element, Step 6, fix F,b, and update the matrix W by the following expression; Step 7. Fix F and W and update vector b by the following expression: Step 8: Loop steps 5 to 7 until the value of the objective function converges, and output the classifier W, bias b and classification membership matrix F, where each row of F corresponds to a sample, and the column number of the maximum value in each row represents the category to which the sample belongs; Step 9: Substitute the trained W and b into the formula The square of the distance between each sample in the test set and the category vector in the classification space is obtained, and the column number where the minimum value is located is the category to which the sample belongs, thereby completing the classification of the test set data.
2. The robust semi-supervised image classification method based on sparse representation according to claim 1, characterized in that: When the image data matrix is normalized row by row in step 2, the mean of each row is set to zero and the standard deviation is set to 1.
3. The robust semi-supervised image classification method based on sparse representation according to claim 1, characterized in that: The contribution rate is selected from 85% to 95%.
4. The robust semi-supervised image classification method based on sparse representation according to claim 1, characterized in that: The membership of the labeled samples in step 3 needs to be given in advance.
5. The robust semi-supervised image classification method based on sparse representation according to claim 1, characterized in that: The number of classification categories c in step 3 is given by the data set.
6. The robust semi-supervised image classification method based on sparse representation according to claim 1, characterized in that: The ratio of the training set to the test set is determined according to the actual situation of the data set.
7. An electronic device, characterized in that: It comprises a processor and a memory, wherein the processor is used to implement the steps of the data migration method as claimed in any one of claims 1 to 7 when executing the computer program stored in the memory.
8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data migration method according to any one of claims 1 to 7 are implemented.
9. A computer program product, characterized in that The method comprises computer executable instructions, which are used to implement the method according to any one of claims 1 to 7 when being executed.
Citation Information
Patent Citations
Robust semi-supervised image classification method based on data mining
CN115131610A
Latent low-rank projection learning based unsupervised feature extraction method for hyperspectral image
WO2022001159A1
