Self-training semi-supervised image classification method combining weighted KNN and adaptive ELM

By combining a weighted KNN and adaptive ELM self-training method, and using particle swarm optimization algorithm and BvSB criterion to select samples, the mislabeling problem in the self-training method is solved, improving the accuracy and stability of image classification, especially significantly improving classification accuracy when there are few class-labeled samples.

CN116229177BActive Publication Date: 2025-12-19天津仁爱学院
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310238925.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2025-12-19
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

Existing self-training methods are prone to mislabeling unlabeled samples in image classification, which affects the classification performance of the classifier, especially when the images are highly similar, resulting in severe error accumulation.

Method used

A self-trained semi-supervised image classification method combining weighted KNN and adaptive ELM is proposed. The number of hidden nodes in ELM is calculated by particle swarm optimization algorithm, and the membership degree of sample classes is calculated by WKNN. Samples with similar spatial structures are selected, and high-confidence samples are selected by BvSB criterion and added to the training set. The classifier is then iteratively optimized.

Benefits of technology

It effectively solves the problem of mislabeling of unlabeled samples, reduces error accumulation, and improves the accuracy and stability of the classifier, especially significantly improving classification accuracy when there are few labeled samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116229177B_ABST
    Figure CN116229177B_ABST
Patent Text Reader

Abstract

The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM belongs to the technical field of image processing. In order to solve the problem that the existing self-training method is easy to mislabel the class of the sample without a class label when the image classification is carried out, and then the accuracy of the classifier classification is affected. The number of hidden layer nodes of ELM is obtained through the particle swarm optimization algorithm; then the class membership of all samples without a class label is calculated through WKNN, and the k samples with the highest membership are obtained in descending order according to the highest membership of all samples without a class label; then the samples are classified through ELM, and the same samples are added to the set X after the same sample is classified twice, the samples are calculated by using the BvSB criterion, and part of the samples are added to the sample set with a class label and are deleted from the sample set without a class label. The classification task is ended when the iteration meets the end condition.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of image processing, and particularly relates to a semi-supervised image classification method. BACKGROUND

[0002] Self-training algorithm is a simple and effective semi-supervised learning method, which can achieve good classification effect without a large number of labeled samples. The self-training method can train the classifier through a small number of class-labeled samples, and according to the training result, a large number of class-unlabeled samples are predicted, and part of the class-unlabeled samples are selected to join the class-labeled sample training set for iterative training, so as to continuously improve the classification performance of the classifier. The self-training algorithm has been widely concerned by scholars due to its simple and efficient characteristics without specific assumptions, and has been widely applied in the field of image learning. However, how the self-training algorithm can select appropriate samples to prompt the performance of self-training learning has always been a problem of the method.

[0003] In the iterative process of the traditional self-training method, the sample is easily mislabeled, which affects the classification performance of the classifier after continuous iteration. For image classification, some images are similar, such as component damage, loss monitoring, face recognition, etc., and the image content presents very similar content features, which is more prone to mislabeling the class of samples, which brings great difficulty to the self-training method and seriously affects the performance of the image classifier obtained by the self-training method. SUMMARY

[0004] The present application is to solve the problem of mislabeling the class of class-unlabeled samples when using the existing self-training method for image classification, which affects the accuracy of the classifier classification.

[0005] The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM includes the following steps:

[0006] Step one, the number of hidden layer nodes H of the extreme learning machine ELM is calculated through the particle swarm optimization algorithm;

[0007] Step two, the WKNN classifier is trained according to the class-labeled sample set M and the class-unlabeled sample set U of the image, the membership degree of all samples in U to each class is obtained, the membership degrees of all classes of each sample are sorted in descending order, the membership degree of the highest class of each sample is taken out to form a class set C'(x t )=C' wknn ,t=1,....n;C' wknn represents the class set as a reference after WKNN classification;

[0008] Step three, according to C'(xt )Sort the membership degrees of all the un-labeled samples in U in descending order, and select the top k samples to obtain set U1; initialize the ELM classifier, set the number of hidden layer nodes as H, and train the ELM using the labeled sample set M;

[0009] Step four, after the training, classify U1 using the trained ELM classifier to obtain the membership degrees of the samples belonging to each class, sort the membership degrees of all the classes of each sample in descending order, take the highest membership degree of each sample, and construct the sample class set C"(x t ) of set U as C" elm ,t=1,....k,k≤n,C" elm represents the result of ELM classification;

[0010] Step five, create an empty set X, and add sample x t to set X when the classes obtained in step two and step four are the same, i.e., C'(x t )=C"(x t ); t

[0011] Step six, calculate the BvSB metric values of all the samples in X obtained in step five, and select a certain proportion of samples in descending order of the metric values;

[0012] Step seven, add the samples selected in step six to the labeled sample set M, repeat steps two to six using the expanded sample set M, and end the algorithm until set X is empty or the number of samples added to the labeled sample set M exceeds half of U.

[0013] Further, according to the labeled sample set M and the un-labeled sample set U of the image, the WKNN classifier is trained to obtain the membership degrees of all the samples in U belonging to each class, which includes the following steps:

[0014] Let the labeled sample set be M={(x i ,y i )}, wherein: is a training sample, and n is the number of training samples; y i is the class label of x i , y i ∈{w1,w2,...,w s}, w r is a sample contained in a certain class data set, and r=1,2,...,s;

[0015] Let the un-labeled sample set be U={x n+1 ,x n+2 ,...x m}, x​t is a sample contained in the no-class label sample set, t = n + 1, n + 2,..., m;

[0016] the k+1th neighbor sample x t of sample x k+1 is normalized with the feature distance between sample x t and sample x t , i.e.

[0017]

[0018] where d(x t , x i ) is the feature distance between sample x t and x i , x i is a sample in the class label sample set M; d(x t , x k+1 ) is the feature distance between sample x t and the k+1th neighbor sample x k+1 of sample x t ; D(x t , x i ) is the standard feature distance of d(x t , x i ) after being normalized based on d(x t , x k+1 );

[0019] In order to obtain the posterior probability of sample class x t , the conditional probability P(x t | x i ) of sample class x i based on neighbor sample x t needs to be calculated through the weighted kernel function Q(x), i.e.

[0020]

[0021] The posterior probability of sample x t belonging to class w r is obtained as

[0022]

[0023] where I(y i = w r ) is a function for judging whether the sample class is consistent; when y i = w r , I(y i = w r ) = 1; when y i ≠ w rI(y i = w r ) = 0; is the sample x t The probability sum based on all samples;

[0024] The class membership of the unlabeled sample is confidence(x t ) = max P(y i | x t ).

[0025] Further, the calculation formula of BvSB is:

[0026]

[0027] Wherein, x t is the sample, the probability of the corresponding optimal class is p(y best x t ), and the suboptimal class probability is P(y second-best | x t ).

[0028] Preferably, the 20% of the samples with the largest metric values are selected in step six.

[0029] Further, the process of calculating the number of hidden layer nodes H of the extreme learning machine ELM by the particle swarm optimization algorithm includes the following steps:

[0030] Step 1.1, particle population initialization;

[0031] Step 1.2, the position value p of the particle is directly assigned to the ELM as the value of the number of hidden layer nodes H;

[0032] Step 1.3, in the process of ELM training, the corresponding objective function is calculated according to the position value of each particle, and the objective function is the classification accuracy of ELM;

[0033] Step 1.4, update the optimal position of the particle and the optimal position of the particle swarm If the objective function value of the current particle is greater than that of the last generation, the corresponding position is the optimal position reached by the current particle; if the maximum objective function value of the current particle swarm is greater than that of the last generation, the corresponding position is the optimal position reached by the current particle swarm, otherwise it is not updated;

[0034] Step 1.5, update the particle position p and velocity v, and recalculate the position and velocity of the particle according to formulas (5) and (6);

[0035]

[0036]

[0037] wherein, is the d-th dimensional position of particle i in the k-th iteration, i.e. position p; is the d-th dimensional velocity of particle i in the k-th iteration; is the best position reached by particle i in the d-th dimension in the k-th iteration, is the best position reached by the swarm in the d-th dimension in the k-th iteration; rand1 and rand2 are random numbers between (0, 1); c1 and c2 represent learning factors; the inertia weight w value is non-negative, and is calculated as follows:

[0038]

[0039] wherein, w max and w min represent the maximum and minimum values of the weight, T max represents the maximum number of iterations, N C represents the current number of iterations; the particles have maximum and minimum velocities and maximum and minimum positions in the search process; the particle swarm optimization algorithm is to find the global optimal solution by constantly iterating and sharing the local optimal position information between the groups;

[0040] Step 1.6, until N C reaches the maximum number of iterations, the optimization ends, and the final particle swarm optimal position is the best hidden layer node number H.

[0041] Preferably, the learning factors c1 = c2 = 2.

[0042] Further, in the process of ELM training, ELM is used to calculate the output weight β of the single hidden layer feedforward neural network, including the following steps:

[0043] Suppose there are N image training samples M = {(x i ,y i )}, the input image sample X i = [x i1 , x i2 ,..., x in ] T ∈ R n , i = 1, 2,...N, the output sample y i = [y i1 , y i2 ,..., y im ] T ∈ R m ; when the number of hidden nodes is H and the activation function is G(w, b, x), the single hidden layer feedforward neural network

[0044]

[0045] where w j = [w j1 ,w j2 ,...w jn ] is the input weight of the randomly generated connection between the input layer node and the hidden layer node, the threshold of the jth hidden layer node is set as b j , and β j is the output weight of the connection between the jth hidden layer node and the output node.

[0046] Bringing N samples into formula (1) can obtain

[0047] Y = H'β

[0048] where H' is the network hidden layer output matrix.

[0049]

[0050]

[0051] A computer storage medium, the storage medium stores a computer program, the computer program is loaded and executed by the processor to realize the self-training semi-supervised image classification method combining weighted KNN and adaptive ELM.

[0052] A self-training semi-supervised image classification device combining weighted KNN and adaptive ELM, the device comprises a processor and a memory, the memory stores a computer program, the computer program is loaded and executed by the processor to realize the self-training semi-supervised image classification method combining weighted KNN and adaptive ELM.

[0053] Advantages:

[0054] The self-training semi-supervised image classification algorithm combining WKNN and adaptive ELM can adaptively obtain the ideal hidden layer node number of ELM according to different data sets, avoiding a large number of artificial experiments to obtain the ideal hidden layer node number of extreme learning machine; through the WKNN algorithm, the sample category probability membership is calculated, and part of the samples are screened for ELM classification, which is beneficial to ELM to better classify the samples without class labels in the spatial structure. By comparing the classification results of ELM and KNN, and screening the same results by BvSB, the problem of mislabeling of samples without class labels is effectively solved, and the error accumulation of misclassified samples in the self-training iteration process is reduced, thereby improving the classification accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0055] Figure 1 It is a WKNN-AELM self-training semi-supervised image classification flowchart.

[0056] Figure 2 is a schematic diagram of an ELM structure.

[0057] Figure 3 is a partial image example of The Olivetti faces dataset.

[0058] Figure 4 is the classification accuracy of different sample proportions in the embodiment.

[0059] Figure 5 is a comparison of the classification accuracy (%) of ELM, BvSB-ST, WKNN-ST, WKNN-AELM algorithms.

[0060] Figure 6 is the classification accuracy of NB, NBST, NSNB, SMUCST, KNNNB, WKNNNBST, WKNN-AELM algorithms. DETAILED DESCRIPTION DETAILED DESCRIPTION

[0062] The embodiment is a self-training semi-supervised image classification method combining weighted KNN and adaptive ELM. By combining the WKNN algorithm, the adaptive ELM algorithm and the BvSB algorithm, the problem of mislabeling unlabeled samples in the iteration process of the self-training method is solved. The ideal hidden layer node number H of the ELM is calculated by the particle swarm optimization algorithm. Then, the class membership of all unlabeled samples is calculated by the WKNN algorithm, and the samples with similar spatial structure to the labeled samples are selected by the membership. The highest membership of each unlabeled sample to a certain class is filtered out by sorting, and the highest membership of all unlabeled samples is sorted in descending order. According to the sorting result, the k samples with the highest membership are obtained. The ELM is used for classification, which enables the ELM to classify the unlabeled samples in a better spatial structure and fully utilize the spatial structure information of the samples. Thirdly, the same samples with the same classification results after ELM classification and WKNN classification are added to the set X, and all samples in X are calculated by the BvSB criterion. According to the calculation result, the feature intervals in X are sorted in descending order, and the top 20% samples are selected and added to the labeled sample set, and are deleted from the unlabeled sample set. The above steps are iterated until the unlabeled sample set is empty, and the classification task is completed.

[0063] As shown in Figure 1 , the self-training semi-supervised image classification method combining weighted KNN and adaptive ELM of the embodiment comprises the following steps:

[0064] Step one, the hidden layer node number H of the ELM is calculated by the particle swarm optimization algorithm.

[0065] ELM, Extreme Learning Machine, can be used for single hidden layer feedforward neural networks, and can also be extended to multi-layer feedforward neural networks. The entire network is composed of a large number of single hidden layers, each layer can be composed of ELM, and the training is similar to the single hidden layer ELM, and the gradient descent method is used for gradient descent to update the weight parameters. Three-layer ELM is as shown in Figure 2 .

[0066] In the initial stage of ELM training, a small number of training samples are used to calculate the output weight β by ELM. The specific steps are as follows:

[0067] Suppose there are N image training samples M = {(x i ,y i )}, input image sample X i = [x i1 , x i2 ,..., x in ] T ∈R n , output sample y i = [y i1 , y i2 ,..., y im ] T ∈R m . When the number of hidden nodes is H, and the activation function is G(w, b, x), the single hidden layer feedforward neural network

[0068]

[0069] is obtained, where i = 1, 2,...N, j = 1, 2,..., H, w j = [w j1 , w j2 ,...w jn ] is the input weight of the connection between the input layer node and the hidden layer node generated by random, the threshold of the jth hidden layer node is set as b j , and β j is the output weight of the connection between the jth hidden layer node and the output node.

[0070] Bringing N samples into formula (1) can obtain

[0071] Y = H'β (2)

[0072] Where H' is the network hidden layer output matrix;

[0073]

[0074]

[0075] The number of hidden layer nodes H becomes one of important factors affecting the generalization performance of the ELM, and different numbers of hidden layers and hidden layer nodes will affect the performance of the neural network. The optimal number of hidden layer nodes of the data set is adaptively selected through the introduction of the PSO particle swarm optimization algorithm through multiple iterations, so as to improve the classification accuracy of the ELM for different data sets and the generalization ability of the model itself.

[0076] The optimal number of hidden layer nodes of the data set is adaptively selected through the introduction of the PSO particle swarm optimization algorithm through multiple iterations, which takes the PSO position value as the number of hidden layer nodes (PSO-ELM algorithm). The PSO is equivalent to the ELM training once per iteration, and the best position finally reached by the particle swarm is the optimal number of nodes to be found. The specific steps are as follows:

[0077] Step 1.1, particle population initialization;

[0078] Step 1.2, the position quantity p of the particle is directly taken as the number of hidden layer nodes H and is assigned to the ELM;

[0079] Step 1.3, in the process of ELM training, the corresponding objective function (ELM classification accuracy) is calculated according to the position value (number of hidden layer nodes) of each particle;

[0080] Step 1.4, update the optimal position of the particle and the optimal position of the particle swarm If the objective function value of the current particle is greater than that of the last generation, the corresponding position is taken as the optimal position reached by the current particle. If the maximum objective function value of the current particle swarm is greater than that of the last generation, the corresponding position is taken as the optimal position reached by the current particle swarm, otherwise it is not updated.

[0081] Step 1.5, update the particle position p and the speed v, and recalculate the position and speed of the particle according to formulas (5) and (6);

[0082]

[0083]

[0084] wherein, is the d-dimensional position of particle i in the kth iteration, i.e. the position p; is the d-dimensional speed of particle i in the kth iteration. is the best position reached by particle i in the dth dimension in the kth iteration, is the best position reached by the particle swarm in the dth dimension in the kth iteration (global best position). rand1 and rand2 are random numbers between (0, 1). c1 and c2 represent learning factors, and the default values are c1=c2=2. The inertia weight w is non-negative, and its calculation formula is:

[0085]

[0086] where w max and w min represent the maximum and minimum value of weights respectively, T max represents the maximum iteration number, N C represents the current iteration number. Each particle has maximum and minimum velocity and maximum and minimum position in the search process. The particle swarm optimization algorithm is to find the global optimal solution by constantly iterating and sharing the local optimal position information among the groups.

[0087] Step 1.6, until N C > the maximum iteration number T max , the optimization ends, and the final particle swarm optimal position is the best hidden layer node number H.

[0088] Thus, the corresponding ELM best hidden layer node number can be set when classifying different data sets, thereby improving the classification accuracy and the generalization ability of the model itself.

[0089] Step two, according to the image class labeled sample set M and the unclassified sample set U, the WKNN classifier is trained to obtain the membership of all samples in U belonging to each class, and the membership of each sample in all classes is sorted in descending order, and the highest membership of each sample is taken out to form the class set C'(x t ) = C' wknn , t = 1,.... n; C' wknn represents the class set as a reference after WKNN classification;

[0090] After WKNN classification, two information will be obtained, one is the probability prediction of each unmarked sample belonging to the optimal class, and the other is the classification result of the unmarked sample by WKNN, which is only used for reference with the ELM classification result in the future, but not the final unmarked sample classification result;

[0091] In the image dataset self-training learning process, the feature space distance of the class label-free sample and the real class sample is positively correlated with the sample membership (i.e. the posterior probability of the sample class), and is measured by the sample class membership. The higher the membership, the closer the class to the real data sample. The feature space distance of the sample refers to the Euclidean distance of the feature vector of the sample matrix in the feature space. The feature space here is a vector space composed of all feature vectors of the sample matrix. The sample membership refers to the probability of belonging to different sample classes after the sample is tested. Each class sample probability is calculated by the WKNN-AELM model algorithm (the present application uses the WKNN algorithm to obtain two pieces of information. The first piece of information is that the WKNN algorithm is used to train the class label-free sample once. This training will obtain the probability of each sample belonging to all classes, and the probability of the sample belonging to the class with the highest probability is saved, i.e. the class membership. Finally, the highest membership of all samples is sorted, and the class label-free sample with the highest membership is taken out for AELM classification. The role here is that WKNN helps AELM to select the samples that are most easily classified from the original class label-free sample set for classification. This is because the self-training is to iterate the classification result of each time to the next training, which is easy to accumulate errors and reduce the accuracy of the classifier. Therefore, this step can effectively improve the error in the iteration process of the self-training algorithm. The second piece of information is that the WKNN is used to classify the class label-free sample once. The classification result is only used to compare with the classification result of ELM to select high-quality samples, and then BVSB is used for further screening, so as to reduce the accumulation of errors caused by iteration in the self-training process. The two steps are to solve the problem of easy error accumulation in the self-training process.), and the real sample here refers to the real class label of the sample. The feature space distance of the data sample is measured by its membership. In order to establish the corresponding relationship between the feature space distance and the data membership, it is stipulated that the feature space distance is inversely related to the data membership, i.e. the smaller the feature space distance, the higher the data membership, and the greater the posterior probability of the data, and the data class obtained by the experiment is closer to the real data. In order to correspond the data membership one by one, it is stipulated that the maximum posterior probability represents the membership of a certain class of data sample. The real data sample refers to the actually collected data with a specific label.

[0092] WKNN classifier:

[0093] The class label sample set is M = {(x i ,y i )}, wherein: is the training set sample, n is the number of training samples; y i is the class label of x i , y i ∈{w1,w2,...,w s}, wr (r = 1, 2, ..., s) represents the samples contained in a certain class of datasets.

[0094] Let the unlabeled sample set be U = {x} n+1 ,x n+2 ,...x m}, x t (t = n+1, n+2, ..., m) are the samples contained in the unlabeled sample set.

[0095] To facilitate the calculation of the class membership (i.e., the posterior probability of the sample class) of samples in the unlabeled sample set U, we use sample x. t The (k+1)th nearest neighbor sample x k+1 With sample x t The feature distance between samples x t The other k nearest neighbor samples are standardized, i.e.

[0096]

[0097] Where d(x) t ,x i ) is sample x t With x i The characteristic distance between them, x i For samples in the labeled sample set M; d(x) t ,x k+1 ) is sample x t With x t The (k+1)th nearest neighbor sample x k+1 The feature distance between them, D(x) t ,x i ) is d(x t ,x i Based on d(x) t ,x k+1 Standardized feature distance after standardization.

[0098] In order to obtain the sample class x t The posterior probability needs to be calculated using the weighted kernel function Q(x) to determine the sample class x. t Based on nearest neighbor samples x i The conditional probability P(x) t |x i ),Right now

[0099]

[0100] Among them, the weighted kernel function

[0101] Thus, sample x is obtained. t Belongs to class w rposterior probability of y

[0102]

[0103] where I(y i =w r ) is a function to determine whether the class of sample is consistent. When y i =w r , I(y i =w r ) = 1. When y i ≠ w r , I(y i =w r ) = 0. is the probability sum of all samples based on x t .

[0104] Then the class membership of the unlabeled sample can be defined as

[0105] confidence(x t ) = max P(y i |x t ) (11)

[0106] Step three, sort the membership of all unlabeled samples in U according to C'(x t ) in descending order, and select the top k samples to get set U1; initialize the ELM classifier, set the number of hidden layer nodes as H, and train the ELM using the labeled sample set M;

[0107] Step four, after the training, classify U1 using the trained ELM classifier to get the membership of each sample belonging to each class, sort the membership of all classes of each sample in descending order, take out the highest membership of each sample, and construct the sample class set C"(x t ) = C" elm , t = 1,..., k, k ≤ n, C" elm represents the result of ELM classification.

[0108] Step five, create an empty set X, and the function of the empty set X is a temporary excess set. When the sample x t is the same in step two and step four, i.e. C'(x t ) = C"(x t ), add sample x t to the sample set X.

[0109] Step six, calculate the metric value of BvSB of all samples in X in step five, and select the top 20% (larger metric value) samples.

[0110] The calculation formula of BvSB is:

[0111]

[0112] wherein x t is a sample, the probability of the optimal class corresponding to the sample is P(y best x t ), and the probability of the suboptimal class is P(y second-best |x t ).

[0113] BvSB only considers the two classes with the maximum and submaximum class membership probabilities of the sample, and ignores the interference of other classes. The maximum class and the submaximum class refer to the membership degrees of each class obtained after the sample is classified by WKNN-AELM. The maximum class refers to the class with the maximum membership degree, and the submaximum class referses to the class with the submaximum membership degree. Therefore, BvSB is a more direct and effective uncertainty measurement criterion. In the classification problem, the sample can be screened according to the uncertainty of the sample. From the perspective of classification, BvSB is a more intuitive measurement of the uncertainty of the sample class. The smaller the value is, the greater the uncertainty of the sample is, that is, the smaller the difference between the maximum class membership probability and the submaximum class membership probability of the sample is, and the closer the possibility of the sample belonging to the two classes is. Therefore, the sample is not easy to be correctly classified. On the contrary, the greater the value is, the smaller the uncertainty of the sample is, that is, the greater the difference between the maximum class membership probability and the submaximum class membership probability of the sample is, and the higher the probability of the sample belonging to the class with the maximum membership probability is, and the sample is more likely to be correctly classified. BvSB measures the difference between the class membership probability maximum class and the class membership probability submaximum class, that is, the interval of the class features. In the multi-class image classification problem, selecting the sample with high confidence for classification is beneficial to improving the classification accuracy of the algorithm. In this process, entropy is commonly used as the uncertainty measurement of the sample class probability. The higher the entropy of the sample is, the higher the uncertainty of the class of the sample is.

[0114] Step seven, adding the sample set M with the class label screened out in step six, repeating steps two to six using the expanded sample set M until the set X is empty or the number of samples added to the sample set M exceeds half of U, and the algorithm ends. Specific implementation two:

[0116] The embodiment is a computer storage medium, the storage medium stores a computer program, the computer program is loaded and executed by a processor to realize a self-training semi-supervised image classification method combining weighted KNN and adaptive ELM.

[0117] It should be understood that the storage medium described in the embodiment includes but is not limited to magnetic storage medium and optical storage medium; the magnetic storage medium includes but is not limited to RAM, ROM, and other hard disks, U disks and other storage media. Specific embodiment three:

[0119] The embodiment is a self-training semi-supervised image classification device combining weighted KNN and adaptive ELM, which comprises a processor and a memory, the memory stores a computer program, the computer program is loaded and executed by the processor to realize a self-training semi-supervised image classification method combining weighted KNN and adaptive ELM.

[0120] It should be understood that the device described in the embodiment includes but is not limited to a device including a processor and a memory, and can also include other devices corresponding to units or modules with information acquisition, information interaction, control functions, for example, the device can also include a signal acquisition device. The device includes but is not limited to a PC, a workstation, a mobile device, etc.

[0121] Embodiment

[0122] In order to test the performance of the WKNN-based ELM self-training semi-supervised image classification algorithm in the image classification problem, the following experiments are carried out: comparison between fixed hidden layer node number and adaptive hidden layer node number of ELM classifier, comparison of different proportions of labeled samples, algorithm performance analysis, and comparison with other algorithms. The classification performance measurement index is overall classification accuracy (OA).

[0123] Experimental environment:

[0124] CPU: Intel(R) 2.3GHz dual-core CPU

[0125] Memory: 16GB

[0126] Operating system: 64-bit Windows 10 system personal computer

[0127] Software framework: based on Python programming platform

[0128] The PSO algorithm is used in the experiment to calculate the ideal hidden layer node number of ELM in different data sets, and the search range of PSO is 100-3000. The threshold value of BvSB criterion screening is 0.2. The number of neighbors of WKNN is n=20. The experiment uses the tanh function as the activation function of the ELM classification hidden layer node, and the activation factor alpha in ELM is set to 1.0. The experimental data is randomly divided into training set and test set, the training set accounts for 30% (10% labeled samples + 20% unlabeled samples), the test set accounts for 70%, each experiment is run 20 times, and the average value is taken as the final experimental result.

[0129] The present application uses The Olivetti faces dataset and Iris, Wine, Breast cancer Wisconsin, Seeds, Glass, Optical Recongnition of handwriteen Digits (Optical) sub-datasets in UCI (The UC Irvine Machine Learning Repository) dataset for algorithm verification.

[0130] Among them, the UCI dataset is a commonly used machine learning standard test dataset proposed by the University of California, Irvine. The dataset currently has 557 sub-datasets, and the following datasets are used for algorithm verification in the experiment:

[0131] (1) Iris is the most widely used dataset in pattern recognition literature. The dataset has a total of 150 data, each containing 4 attributes;

[0132] (2) Wine is a wine recognition dataset. The dataset has a total of 178 data, each containing 13 attributes;

[0133] (3) Breast_Cancer_Wisconsin is a breast cancer dataset. The dataset has a total of 699 data, each containing 10 attributes;

[0134] (4) Seeds is a seed dataset. The dataset includes three different wheat varieties: Kama, Rosa, and Canadian, each with 70 elements. The dataset has a total of 210 data, each containing 7 attributes;

[0135] (5) Glass is a glass recognition database. The dataset is from the United States Bureau of Forensic Medicine, and there are 6 types of glass. The dataset has a total of 214 data, each containing 7 attributes;

[0136] (6) Optical Recongnition of handwriteen Digits (Optical) handwritten digit dataset. The dataset has a total of 1797 data, each being an 8x8 pixel image, and Optical has 10 categories.

[0137] The Olivetti faces dataset contains a set of face images taken at Cambridge AT&T Laboratories from April 1992 to April 1994, which has a total of 40 different categories, a total of 400 images, and an image size of 64x64 pixels. The Olivetti faces are a set of faces taken at the Olivetti Research Laboratory in Cambridge from April 1992 to April 1994, with 40 people, each taking 10 different face images. The original image size is 92x112, 8-bit grayscale image, and the application uses a processed 64x64 image set. Part of the Olivetti Faces dataset images are shown in Figure 3

[0138] Table 1 is the specific information of the experimental data set, including the size of the data set, the number of features, the number of categories, the size of the training set, the size of the test set, and the number of class-labeled samples.

[0139] Table 1: Size of each data set, number of features, number of categories, and experimental data ratio

[0140]

[0141] Effect of different parameters on classification performance

[0142] (1) Comparison of adaptive hidden layer experiments

[0143] To test the classification performance of the PSO algorithm for adaptive hidden layer neuron node number for WKNN-AELM (i.e. the combination of weighted KNN and adaptive ELM self-training semi-supervised image classification method of the application. WKNN is weighted KNN, and AELM represents adaptive ELM, i.e. ELM after PSO adaptive hidden layer node). The experiment will fix the number of hidden layer nodes H = 100, H = 500, H = 1000, H = 3000, and compare the classification accuracy of the ELM neuron node number obtained by the PSO algorithm in each data set. The number of iterations is set to 3000 times, and the approximate optimal hidden layer node number is obtained after the algorithm ends. In each data set, the ELM hidden layer node number obtained by PSO is respectively: Iris = 129, Wine = 452, Breast_cancer = 316, Seeds = 876, Digits = 1359, Glass = 597, Olivetti faces = 2973.

[0144] The experimental data is randomly divided into training set and test set, the training set accounts for 30% (10% class-labeled samples + 20% no class-labeled samples), and the test set accounts for 70%. Each experiment is run 20 times, and the average value is taken as the final experimental result. ​

[0145] Table 2 H = 100, 500, 1000, 3000, H = PSO classification accuracy (%)

[0146]

[0147] As shown in Table 2, the classification accuracy of the algorithm for obtaining the number of ELM hidden layer nodes by PSO self-adaptation is higher than that of the classification accuracy of the number of hidden layer nodes of H = 100, H = 500, H = 1000, H = 3000 selected by artificial random selection. The number of neuron nodes obtained by PSO self-adaptation avoids artificial repeated testing of the number of ELM hidden layer nodes, and a relatively ideal classification accuracy can be obtained. Experiments prove that PSO helps WKNN-ELM self-training algorithm to obtain an ideal number of hidden layers.

[0148] (2) Comparison of different sample proportion experiments

[0149] In this subsection experiment, the proportion of samples with class labels is fixed at 5%, 10%, 20%, 30%, and 40%. The number of hidden layer nodes obtained by ELM through PSO algorithm self-adaptation for each data set is respectively: Iris = 129, Wine = 452, Breast_cancer = 316, Seeds = 876, Digits = 1359, Glass = 597, and Faces = 2973. The experimental data is randomly divided into training set and test set, the training set accounts for 30% (10% of samples with class labels + 20% of samples without class labels), the test set accounts for 70%, each experiment is run 20 times, and the average value is taken as the final experimental result.

[0150] Table 3 Comparison of classification accuracy of different sample proportions (%)

[0151]

[0152] Figure 4 The classification accuracy of different data sets under different proportions of samples with class labels is compared.

[0153] From Table 3 and Figure 4It can be seen that the WKNN-AELM self-training algorithm only needs a small amount of class-labeled samples (5%) in most data sets to achieve good classification accuracy, and the classification accuracy tends to be stable with the increase of the sample ratio. As can be seen from Table 3, the Faces data set cannot be classified at a class-labeled sample ratio of 5% because the number of class-labeled samples is less than the number of sample categories. For the Faces and Glass data sets, the ratio of class-labeled samples affects the classification accuracy of the ELM algorithm. For example, for the Faces data set, the classification accuracy is 28.04 when the sample ratio is 5%. When the sample ratio increases to 30%, the classification accuracy improves to 76.00%. It can be seen that the classification accuracy of the WKNN-AELM algorithm is low in the case of a small number of labeled samples, but the classification accuracy of the algorithm improves rapidly with the increase of the labeled sample ratio. This is because the Faces data set has a high feature dimension, so the sample features are complex, and a small number of class-labeled samples cannot fully explain the distribution of sample features. Therefore, when the number of class-labeled samples is small, the classification accuracy of the algorithm is low, and the classification accuracy of the weighted KNN ELM self-training algorithm improves rapidly with the increase of the sample ratio.

[0154] Algorithm performance analysis

[0155] To verify the classification performance of the WKNN-AELM self-training algorithm, the following aspects can be verified: comparative experiments after adding the WKNN algorithm and the BvSB criterion. The self-training semi-supervised classification algorithm based on the ELM classifier (referred to as the ELM self-training algorithm), the ELM classifier self-training semi-supervised classification algorithm using the WKNN algorithm (referred to as the WKNN-ST), the ELM classifier self-training semi-supervised classification algorithm using the BvSB criterion (referred to as the BvSB-ST sampling algorithm), and the algorithm of the present application (WKNN-AELM) are used as comparative algorithms for comparative analysis. In the iteration process of the ELM sampling self-training algorithm, ELM is used as the classifier. In each iteration, ELM classifies all unlabeled samples, and then the samples with the top 10% results are selected and added to the training set for iterative self-training according to the classification prediction results of the ELM classifier. In the BvSB sampling self-training algorithm, ELM classifies all unlabeled samples in each iteration. After the classification is completed, the top 10% of the samples are selected and added to the training set for iteration. The samples are sorted according to the BvSB criterion and the top 10% of the samples with high confidence are selected according to the prediction results of the ELM classifier in each iteration. Then, the selected samples are added to the training set for iterative training. The experimental data is randomly divided into a training set and a test set, the training set accounts for 30% (10% class-labeled samples + 20% unlabeled samples), the test set accounts for 70%, each experiment is run 20 times, and the average value is taken as the final experimental result.

[0156] Table 4 gives the experimental results of ELM, ELM-KNN, ELM-BvSB, WKNN-AELM with 10% labeled samples. The experiment still uses the tanh function as the activation function of the ELM classification hidden layer node, and the activation factor alpha is set to 1.0, and the number of hidden layers is the same as the previous subsection.

[0157] Table 4 ELM, BvSB-ST, WKNN-ST, WKNN-AELM algorithm classification accuracy comparison (%)

[0158]

[0159]

[0160] From Table 4, it can be seen that the WKNN-AELM algorithm classification accuracy of the present application has certain improvement compared with the ELM self-training algorithm without using the strategy. The BvSB sampling self-training semi-supervised algorithm improved after the sampling criterion has certain improvement compared with the improved ELM sampling algorithm. Compared with the WKNN-AELM algorithm, the BvSB-ST algorithm does not use the WKNN classifier for re-classification prediction. Compared with the BvSB-ST algorithm (mainly to prove the ELM self-training algorithm after adding the BvSB criterion), by adding the WKNN classifier, after re-classification prediction of the class label, it is helpful to reduce the error accumulation caused by the ELM classifier in the self-training process. Compared with the ELM self-training learning algorithm, it is to prove the necessity of using the BvSB criterion for screening.

[0161] According to the experimental results in Table 4, it can be concluded that WKNN-AELM further improves the classification accuracy of the algorithm by using WKNN to compare the prediction results again. Thus, it is verified that the WKNN-AELM algorithm can extract unlabeled samples by BvSB combined with WKNN to expand the labeled samples for training under the condition of less labeled samples, fully utilize the information of unlabeled samples, better expand the training data of ELM algorithm, and improve the classification effect of ELM algorithm. The classification accuracy of WKNN-AELM algorithm is better than that of ELM algorithm using ELM training results as sampling basis, which proves the effectiveness of the method of data sampling and training by BvSB criterion and KNN classification results. Although only the BvSB criterion is used for data sampling to improve the size of the training set, it is beneficial to improve the classification accuracy of the training algorithm. However, there may be certain data errors in sampling, that is, the wrong data is extracted for training iteration, which further weakens the improvement effect of the algorithm. And the KNN comparison and screening can further eliminate the errors in the data, so as to improve the classification accuracy of the algorithm.

[0162] Figure 5 Classification accuracy comparison (%) of ELM, BvSB-ST, WKNN-ST, WKNN-AELM algorithm. According to the experimental results of Figure 5 the following conclusions can be drawn: WKNN-ST algorithm, BvSB-ST algorithm and WKNN-AELM algorithm have obvious improvement in classification accuracy compared with the original ELM algorithm in all selected data sets. For example, in the Iris data set, BvSB-ST algorithm is improved by 6.12% compared with ELM algorithm, WKNN-ST algorithm is improved by 7.79% compared with ELM algorithm, and WKNN-AELM algorithm is improved by 10.89% compared with ELM algorithm, and the improvement ratio reaches 13.5%; in the Wine data set, WKNN-AELM algorithm is improved by 1.06% in classification accuracy compared with ELM.

[0163] The improvement of the classification accuracy of the algorithm of all the above data sets is mainly due to:

[0164] 1. In the case of fewer class-labeled samples, the method of extracting unlabeled samples by BvSB combined with WKNN to expand the class-labeled samples for training can make full use of the information of the unlabeled samples, better expand the training data of the ELM algorithm, and significantly improve the classification effect of the ELM algorithm.

[0165] 2. The samples with high confidence are selected by BvSB criterion and added to the training set for training, which is conducive to reducing the addition of error samples in the algorithm iteration process and affecting the classification performance of the separator. At the same time, the samples with large clustering difference between the class-labeled samples and the unlabeled samples, i.e. the samples with large class distinction, are selected by WKNN, and the selected samples are separated by the ELM classifier, which improves the classification accuracy of the ELM classifier.

[0166] WKNN-AELM algorithm has obvious improvement in classification accuracy compared with the self-training algorithm using only ELM training results for sampling. The improved BvSB sampling self-training semi-supervised algorithm also has greater improvement compared with the improved ELM sampling algorithm. WKNN-AELM algorithm further improves the classification accuracy of the algorithm by using WKNN to compare the prediction results again. Therefore, it is verified that the method of extracting unlabeled samples by BvSB combined with WKNN to expand the class-labeled samples for training can make full use of the information of the unlabeled samples, better expand the training data of the ELM algorithm, and improve the classification effect of the ELM algorithm.

[0167] Comparison of experimental results

[0168] The Wine, Iris, and Seeds data sets are used for comparison. The experimental data is randomly divided into a training set and a test set, with the training set accounting for 80% and the test set accounting for 20%. In the training set, 10% is used as an initialization class-labeled sample, and the remaining samples are class-labeled samples. Each experiment is run 20 times, and the average value is taken as the final experimental result.

[0169] The experiment compares the present application with other existing methods. The specific methods used are as follows:

[0170] (1) Naive Bayes (NB) algorithm.

[0171] (2) Naive Bayes self-training (NBST) algorithm.

[0172] (3) Novel semi-supervised Naive Bayes (NSNB) algorithm.

[0173] (4) Semi-supervised metric-based fuzzy clustering self-training (SMUCST) based on literature.

[0174] (5) K-nearest neighbor combined with Naive Bayes (KNNNB) algorithm.

[0175] (6) Improved Naive Bayes self-training algorithm based on weighted K-nearest neighbors (WKNNNBST).

[0176] (7) ELM-KNN-BvSB algorithm of the present application.

[0177] To verify the performance of the WKNN-AELM algorithm in classifying the above data sets, this section experiment mainly compares the classification accuracy of NB, NBST, NSNB, SMUCST, KNNNB, WKNNNBST, and WKNN-AELM algorithms. The experimental results are shown in Table 5.

[0178] Table 5 Comparison experiment of different sample proportions in different data sets (%)

[0179]

[0180] The classification accuracy comparison results of the WKNN-AELM algorithm with NB, NBS, NSNB, SMUCST, KNNNB, WKNNNBST, and ELM algorithms are as follows: Figure 6 As shown.

[0181] According to Table 5 and Figure 6 The experimental results lead to the following conclusions: the WKNN-AELM algorithm outperforms algorithms using NB, NBST, NSNB, SMUCST, KNNNB, and WKNNNBST, demonstrating the effectiveness of the WKNN-AELM algorithm's method of data sampling and training based on the BvSB criterion and WKNN classification results. While sampling data solely using the BvSB criterion increases the training set size, thus improving classification accuracy, sampling may introduce data errors, potentially weakening the algorithm's improvement by drawing incorrect data for training iterations. Using WKNN for comparison and filtering further reduces these errors, thus improving classification accuracy. The WKNN-AELM algorithm outperforms the NB, NBST, NSNB, and KNNB algorithms on various experimental datasets. The experiments verify that using WKNN for classification extraction based on membership degrees and filtering using BvSB feature metrics helps improve the WKNN-AELM algorithm's classification accuracy.

[0182] This invention may have other embodiments. Without departing from the spirit and essence of this invention, those skilled in the art can make various corresponding changes and modifications according to this invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.

Claims

1. A self-training semi-supervised image classification method combining weighted KNN and adaptive ELM, characterized in that, The method comprises the following steps: Step one, the number of hidden layer nodes H of the extreme learning machine ELM is calculated by a particle swarm optimization algorithm; Step two, according to the image with class label sample set M and without class label sample set U, the WKNN classifier is trained to obtain the membership of all samples in U belonging to each class, the membership of all classes of each sample is sorted in descending order, the highest membership of each sample is taken out to form the class set C'(x t ) = C' wknn ,t = 1,.... n; C' wknn indicates the class set as reference after WKNN classification; Step three, sort the membership of all un-labeled samples in U in descending order according to C'(x t ), and select the first k samples to obtain set U1; initialize the ELM classifier, set the number of hidden layer nodes to H, and train the ELM using the set of labeled samples M; Step four, at the end of the training, the trained ELM classifier is used to classify U1, and the membership of each sample belonging to each class is obtained. The membership of all classes for each sample is sorted in descending order, and the highest membership of each sample is taken out. The sample class set of set U is C"(x t ) = C" elm ,t = 1,.... k, k ≤ n, C" elm represents the result of ELM classification; Step five, create an empty set X, when sample x t In step two and step four, when the same class is obtained, that is, C'(x t ) = C"(x t ), sample x t is added to the sample set X; Step six, the metric value of BvSB of all samples in X in step five is calculated, and a certain proportion of samples are selected in descending order of the metric value; Step seven, the samples selected in step six are added to the sample set M with class labels, and steps two to six are repeated using the expanded sample set M until the set X is empty or the number of samples added to the sample set M exceeds half of U, and the algorithm ends.

2. The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM according to claim 1, characterized in that, According to the sample set M with class labels and the sample set U without class labels, the WKNN classifier is trained to obtain the membership degree of all samples in U to each class, which comprises the following steps: A sample set with class labels is M = {(x i ,y i )}, wherein: x i is a training set sample, n is the number of training samples; y i is the class label of x i , y i ∈{w1,w2,...,w s}, w r is a sample contained in a certain class data set, r = 1, 2,..., s; Let the unlabeled sample set be U = {x n+1 ,x n+2 ,...x m}, x t is the sample contained in the unlabeled sample set, t = n + 1, n + 2,..., m; the k+1th nearest neighbor sample x t of sample x k+1 is normalized by the feature distance between sample x t and the other k nearest neighbors of sample x t , i.e. wherein d(x t ,x i ) is a feature distance between samples x t and x i , x i is a sample in the sample set M with a class label; d(x t ,x k+1 ) is a feature distance between sample x t and the k+1th nearest neighbor sample x t of x k+1 ; D(x t ,x i ) is a standard feature distance after d(x t ,x i ) is standardized based on d(x t ,x k+1 ). In order to obtain the sample class x t The posterior probability needs to be calculated using the weighted kernel function Q(x) to determine the sample class x. t Based on nearest neighbor samples x i The conditional probability P(x) t |x i ),Right now Obtain sample x t Belonging to class w r Posterior probability where I(y i = w r ) is a function of judging whether the sample class is consistent; when y i = w r , I(y i = w r ) = 1; when y i ≠ w r , I(y i = w r ) = 0; is the probability sum of all samples based on x t ; The class membership of the unlabeled sample is confidence(x t ) = max P(y i |x t ).

3. The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM according to claim 2, characterized in that, The calculation formula of BvSB is: where x t is a sample, and p(y best |x t ) is the probability of the optimal class and p(y second-best |x t ) is the probability of the suboptimal class, respectively.

4. The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM according to claim 3, characterized in that, In step six, the top 20% of samples in the metric value are selected.

5. The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM according to claim 1, 2, 3 or 4, characterized in that, The process of calculating the number of hidden layer nodes H of the extreme learning machine ELM by the particle swarm optimization algorithm comprises the following steps: Step 1.1, particle population initialization; Step 1.2, the position value p of the particle is directly assigned to the ELM as the number of hidden layer nodes H; Step 1.3, in the process of ELM training, the corresponding objective function is calculated according to the position value of each particle, and the objective function is the classification accuracy of ELM; Step 1.4, updating the optimal position of the particle and the optimal position of the particle swarm If the objective function value of the current particle is greater than that of the last generation, the corresponding position is taken as the optimal position reached by the current particle; if the maximum objective function value of the current particle swarm is greater than that of the last generation, the corresponding position is taken as the optimal position reached by the current particle swarm, otherwise it is not updated; Step 1.5, update the particle position p and velocity v, and recalculate the position and velocity of the particle according to formulas (5) and (6); wherein, is the d-th dimensional position of particle i in the k-th iteration, i.e. position p; is the d-th dimensional velocity of particle i in the k-th iteration; is the best position reached by particle i in the d-th dimension in the k-th iteration, is the best position reached by the swarm in the d-th dimension in the k-th iteration; rand1 and rand2 are random numbers between (0, 1); c1 and c2 represent learning factors; the inertia weight w value is non-negative and is calculated as: where w max and w min represent the maximum and minimum values of the weights, T max represents the maximum number of iterations, N C represents the current iteration number; each particle has a maximum and minimum velocity and a maximum and minimum position during the search; the particle swarm optimization algorithm finds the global optimum solution by constantly iterating and sharing local optimum position information among the group. Step 1.6, until N C The optimization ends when the maximum iteration number is reached, and the final particle swarm optimal position is the optimal hidden layer node number H.

6. The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM according to claim 5, characterized in that, The learning factor c1 = c2 = 2.

7. The self-training semi-supervised image classification method combining weighted KNN and adaptive ELM according to claim 6, characterized in that, In the process of ELM training, ELM is used to calculate the output weight β of the single-hidden layer feedforward neural network, which comprises the following steps: Assume there are N image training samples M = {(x i ,y i )}, input image samples X i = [x i1 ,x i2 ,...,x in ] T ∈R n , i = 1, 2,...N, output samples y i = [y i1 ,y i2 ,...,y im ] T ∈R m ; when the number of hidden nodes is H and the activation function is G(w,b,x), a single hidden layer feedforward neural network is obtained where w j = [w j1 ,w j2 ,...w jn ] is the input weight connecting the input layer nodes to the hidden layer nodes generated randomly, the threshold of the jth hidden layer node is set as b j , and β j is the output weight connecting the jth hidden layer node and the output node. Bringing N samples into formula (1) can obtain Y = H'β Wherein, H' is the network hidden layer output matrix; 8. A computer storage medium, characterized in that The storage medium stores a computer program, the computer program is loaded and executed by the processor to realize the self-training semi-supervised image classification method combining weighted KNN and adaptive ELM of any one of claims 1 to 7.

9. A self-training semi-supervised image classification device combining weighted KNN and adaptive ELM, characterized in that, The device comprises a processor and a memory, and the memory stores a computer program, which is loaded and executed by the processor to realize the self-training semi-supervised image classification method combining weighted KNN and adaptive ELM of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multiclass image classification method based on semi-supervised extreme learning machine

    CN104992184A

  • Local receptive field extreme learning machine image classification method based on particle swarm optimization

    CN108038507A