A Hyperspectral Classification Method for Pharmaceuticals Based on Pseudo-Label Mutual Learning Semi-Supervision
Through pseudo-label mutual learning and comparison learning methods, the problem of false pseudo-labels in medical hyperspectral classification is solved, and efficient and accurate classification effects are achieved, overfitting is avoided, and the feature extraction ability of the model is improved.
Patent Information
- Application Number
- CN202311222838.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2043-09-21
AI Technical Summary
The existing semi-supervised learning methods generate false pseudo-labels in medical hyperspectral classification, which affects the classification performance of the model. Especially when the labeled samples are limited, it is difficult to effectively use a small number of labeled samples for efficient classification.
The semi-supervised method based on pseudo-label mutual learning is adopted. By building two identical sub-models, the memory storage module is used to smooth the features and prediction vectors, and combining pseudo-label smoothing strategies and contrast learning methods, the learning of noise knowledge is reduced and feature extraction accuracy is improved.
In the case of a very small number of labeled samples, the efficiency and accuracy of hyperspectral classification are significantly improved, the overfitting problem is reduced, the inter-class discreteness is enhanced, the intra-class tightness is reduced, and the classification effect is improved.
Smart Images

Figure CN117197579B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a semi-supervised medical hyperspectral classification method based on pseudo-label mutual learning. Background Art
[0002] Pharmaceutical hyperspectral analysis is a crucial technology. By analyzing the spectral characteristics of drug samples, the physical and chemical properties of drugs can be accurately determined, which plays a vital role in drug development and production. However, due to the complexity of drugs, hyperspectral data often exhibits high dimensionality, multimodality, and nonlinear characteristics, making traditional data analysis methods face significant challenges when processing pharmaceutical hyperspectral data.
[0003] Traditional medical hyperspectral classification technology mainly relies on manual analysis and statistics, which not only requires a lot of manpower and time, but is also prone to errors, limiting its application in fields such as drug quality control and production process management.
[0004] Deep learning methods can automatically learn the characteristics of data, thereby greatly improving the efficiency and accuracy of detection. However, these methods usually also require a large amount of labeled data. In the medical field, due to the particularity of the data, professional medical personnel are often required to perform precise pixel-level labeling. Therefore, obtaining a large amount of labeled data is very difficult in actual operation.
[0005] Semi-supervised learning can generate pseudo-labels from unlabeled samples and use these pseudo-labels to alleviate the labeling limitations of medical hyperspectral classification. However, current semi-supervised spectral classification methods do not consider the issue of noisy pseudo-labels. Given the limited number of labeled medical hyperspectral samples, a large number of erroneous pseudo-labels are generated, impacting the model's classification performance. Summary of the Invention
[0006] The present invention provides a semi-supervised medical hyperspectral classification method based on pseudo-label mutual learning, so as to solve the problem that the existing semi-supervised learning hyperspectral classification algorithm generates erroneous pseudo-labels and thus affects the effect of medical hyperspectral classification.
[0007] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0008] The present invention provides a semi-supervised medical hyperspectral classification method based on pseudo-label mutual learning, comprising the following steps:
[0009] S1. Obtain the original medical hyperspectral dataset;
[0010] S2, using the medical hyperspectral dataset to construct labeled sample sets and unlabeled sample sets;
[0011] S3. Build a mutual semi-supervised learning model for medical hyperspectral classification. The mutual semi-supervised learning model includes two identical sub-models, and each sub-model includes an encoder F, a feature mapping head E, a prediction mapping head P, and a memory storage module MB connected in sequence;
[0012] S4. Select a batch of samples from the labeled sample set and the unlabeled sample set respectively and input them into the two sub-models. The encoders F in the two sub-models respectively extract features from the labeled samples and the unlabeled samples to obtain labeled output features and unlabeled output features. Use the feature mapping heads E of the two sub-models to map the labeled output features and the unlabeled output features respectively to obtain labeled mapping features and unlabeled mapping features, and store them in the memory storage module MB; Use the prediction mapping heads P of the two sub-models to predict the labeled output features and the unlabeled output features respectively to obtain labeled prediction vectors and unlabeled prediction vectors, and store them in the memory storage module MB;
[0013] S5. Smooth the unlabeled prediction vectors using the labeled mapping features and the unlabeled mapping features stored in the two memory storage modules MB to obtain two pseudo-label sets for the current batch;
[0014] S6. Calculate the total loss using the labeled prediction vectors, the labeled mapping features, the unlabeled mapping features, the unlabeled prediction vectors, and the two pseudo-label sets for the current batch. Repeat S3 to S6 until the number of iterations reaches the set number, and select the weight with the smallest total loss as the weight of the sub-model for final application to obtain the sub-model for final application;
[0015] S7. Use the sub-model for final application to classify other medical hyperspectra.
[0016] Further, the specific steps of S2 are as follows:
[0017] S21. Randomly select some medical hyperspectra from the medical hyperspectral dataset and label this part of the medical hyperspectra to obtain a labeled sample set;
[0018] S22. Use another part of the medical hyperspectra without labels in the medical hyperspectral dataset to construct an unlabeled sample set.
[0019] Further, the function of the encoder F in S3 is to extract features for the feature mapping head E and the prediction mapping head P; the encoder F includes five feature extraction units connected in sequence, and each feature extraction unit includes a convolutional layer and a max pooling layer connected to each other;
[0020] The function of the feature mapping head E is to map the features obtained by the encoder F to obtain mapping features, and the feature mapping head E is a fully connected layer;
[0021] The function of the prediction mapping head P is to predict the features obtained by the encoder F to obtain a prediction vector. The prediction mapping head P includes a fully connected layer, a dropout layer, and a classification layer connected in sequence;
[0022] The memory storage module MB is used to store the labeled prediction vectors and labeled mapping features corresponding to the labeled samples, as well as the unlabeled mapping features and unlabeled prediction vectors corresponding to the unlabeled samples.
[0023] Furthermore, S5 is specifically expressed by the following formula:
[0024]
[0025]
[0026] Among them, in formula (1), z i is the unlabeled mapping feature of the i-th unlabeled sample in a batch of data within a sub-network; K represents the total number of all labeled mapping features and / or unlabeled mapping features in the memory storage module MB, is the labeled mapping feature or unlabeled mapping feature stored at the k-th position in the memory storage module MB; s ik is the similarity between the unlabeled output feature and the labeled mapping feature or unlabeled mapping feature stored at the k-th position in the memory storage module MB; t represents the temperature coefficient;
[0027] In formula (2), p i is the unlabeled prediction vector of the i-th unlabeled sample in a batch of data, is the labeled prediction vector or unlabeled prediction vector stored at the k-th position in the memory storage module MB, and α is the smoothing coefficient; the two sub-models are respectively named the first sub-model and the second sub-model, and q i represents the i-th pseudo-label input into the first sub-model.
[0028] Furthermore, S6 specifically includes the following steps:
[0029] S61. Determine whether the two memory storage modules MB are full of labeled mapping features and unlabeled mapping features. If not, go to S66. If so, use the pseudo-label q i and the unlabeled prediction vector p i to construct the mutual pseudo-label loss
[0030] S62. Perform an inner product on the pseudo-labels in the two pseudo-label sets and of the current batch to obtain the similarity matrix and the dissimilarity matrix The matrix sizes are all B×B;
[0031] S63. Construct two mapping feature sets using the unlabeled mapping features of the current batch and Using the two mapping feature sets and Solve the feature similarity matrix of size B×B by means of inner product
[0032] S64. By calculating the cross-entropy between the similarity matrix and the feature similarity matrix and the cross-entropy between the dissimilarity matrix and the feature similarity matrix to form the mutual pseudo-label guided contrast learning contrast loss
[0033] S65. Construct the supervision loss using the labeled prediction vector and the true label of the labeled sample Then use the supervision loss Mutual pseudo-label loss and the mutual pseudo-label guided contrast learning contrast loss Construct the total loss, repeat S3 to S6 until the number of iterations reaches the set number, select the weight with the smallest total loss as the weight of the sub-model for final application, and obtain the sub-model for final application. S6 ends;
[0034] S66. Construct the supervision loss using the labeled prediction vector and the true label of the labeled sample Supervision loss That is, the total loss. Repeat S3 to S6 until the number of iterations reaches the set number, select the weight with the smallest total loss as the weight of the sub-model for final application, and obtain the sub-model for final application. S6 ends.
[0035] Furthermore, the mutual pseudo-label loss in S61 is specifically as follows:
[0036]
[0037] is the pseudo-label generated by another sub-network for the current sub-model using the i-th unlabeled sample, that is, the sub-networks provide pseudo-labels for each other. B represents the number of unlabeled samples or labeled samples input to the two sub-models in S4. The ratio of the number of input unlabeled samples to labeled samples is 1:1, and the total number of inputs is 2B.
[0038] Furthermore, the similarity matrix and the dissimilarity matrix in S62 are respectively as follows:
[0039]
[0040]
[0041] Among them, q′ j represents the j-th pseudo-label input to the second sub-model.
[0042] The feature similarity matrix in S63 is specifically as follows:
[0043]
[0044] Among them, z′ j represents the j-th unlabeled mapped feature input to the second sub-model.
[0045] Furthermore, the mutual pseudo-label guided contrastive learning contrast loss in S64 is specifically as follows:
[0046]
[0047] Among them, H() represents the cross-entropy loss function.
[0048] Furthermore, the total loss in S65 is specifically as follows:
[0049]
[0050] Among them, λ mut and λ sdc are respectively the weighted coefficients of the mutual pseudo-label loss and the weighted coefficient of the mutual pseudo-label guided contrastive learning contrast loss respectively.
[0051] Furthermore, the number of iterations set in S65 and S66 is 20 to 100 times.
[0052] Advantages of the present invention:
[0053] The present invention proposes a semi-supervised medical hyperspectral classification method based on pseudo-label mutual learning, enabling sub-models to learn more refined features. In this framework, we only need a very small amount of labeled sample data, and add the data of the rest of the hyperspectral image as unlabeled data to the unlabeled sample set to train the mutual semi-supervised learning model. At the same time, the present invention combines the mutual semi-supervised learning model with a pseudo-label smoothing strategy to reduce the noisy knowledge learned by the classification model during the hyperspectral feature extraction process, avoiding the overfitting problem caused by using a single model in traditional methods. Secondly, the present invention adopts a pseudo-label-guided contrastive learning method, which helps to maximize the inter-class discreteness and minimize the intra-class compactness, thereby reducing the intra-class spectral variability and significantly improving the efficiency of hyperspectral classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a framework diagram of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0055] To facilitate the understanding of the present invention, the present invention will be described more comprehensively below with reference to the relevant drawings. The preferred embodiments of the present invention are shown in the drawings. However, the present invention can be implemented in many other different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used in the description of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0057] Referring to Figure 1 , the embodiments of the present application provide a semi-supervised medical hyperspectral classification method based on pseudo-label mutual learning, including the following steps:
[0058] S1. Obtain the original medical hyperspectral data set;
[0059] S2. Use the medical hyperspectral data set to construct a labeled sample set and an unlabeled sample set;
[0060] S3. Build a mutual semi-supervised learning model for medical hyperspectral classification. The mutual semi-supervised learning model includes two identical sub-models. Each sub-model includes an encoder F, a feature mapping head E, a prediction mapping head P, and a memory storage module MB connected in sequence from top to bottom; the two sub-models are initialized with different weights;
[0061] S4. Select a batch of samples from the labeled sample set and the unlabeled sample set respectively and input them into the two sub-models. The ratio of the labeled samples to the unlabeled samples included is 1:1. When there are insufficient labeled samples, the existing labeled samples will be resampled repeatedly until their numbers are the same;
[0062] The encoders F in the two sub-models respectively extract features from the labeled samples and the unlabeled samples to obtain labeled output features and unlabeled output features. The feature mapping heads E of the two sub-models are used to map the labeled output features and the unlabeled output features respectively to obtain labeled mapped features and unlabeled mapped features, and store them in the memory storage module MB; The prediction mapping heads P of the two sub-models are used to predict the labeled output features and the unlabeled output features respectively to obtain labeled prediction vectors and unlabeled prediction vectors, and store them in the memory storage module MB;
[0063] S5. Smooth the unlabeled prediction vectors by using the labeled mapped features and the unlabeled mapped features stored in the two memory storage modules MB to obtain two pseudo-label sets for the current batch;
[0064] S6. Calculate the total loss by using the labeled prediction vectors, the labeled mapped features, the unlabeled mapped features, the unlabeled prediction vectors and the two pseudo-label sets obtained in the current batch. Repeat S3 to S6 until the number of iterations reaches the set number, and select the weight with the smallest total loss as the weight of the sub-model for final application to obtain the sub-model for final application;
[0065] S7. Use the sub-model for final application to classify other medical hyperspectra.
[0066] In some embodiments, S2 specifically includes the following steps:
[0067] S21. Randomly select some medical hyperspectra from the medical hyperspectral dataset and label this part of the medical hyperspectra to obtain a labeled sample set;
[0068] S22. Use another part of the unlabeled medical hyperspectra in the medical hyperspectral dataset to construct an unlabeled sample set.
[0069] In some embodiments, the function of the encoder F in S3 is to extract high-dimensional features for the feature mapping head E and the prediction mapping head P; The encoder F includes sequentially connected feature extraction units, and each feature extraction unit includes a convolution layer and a max pooling layer connected to each other; The convolution layer extracts features from the image features without changing the size of the feature map, and the max pooling layer retains the significant features and reduces the feature dimension.
[0070] The role of the feature mapping head E is to map the high-dimensional features obtained by the encoder F to obtain mapped features. The feature mapping head E is a fully connected layer; the fully connected layer is used to map features to a lower dimension and reduce the storage size.
[0071] The role of the prediction mapping head P is to predict the high-dimensional features obtained by the encoder F to obtain a prediction vector. The prediction mapping head P includes a fully connected layer, a dropout layer, and a classification layer connected in sequence; the fully connected layer reduces the dimension of the features. The dropout layer is used to randomly discard 20% of the neurons to reduce overfitting. The classification layer is used to implement the classification function and calculate the confidence of each category.
[0072] The memory storage module MB is used to store the labeled prediction vectors and labeled mapped features corresponding to the labeled samples, as well as the unlabeled mapped features and unlabeled prediction vectors corresponding to the unlabeled samples.
[0073] The storage size of the memory storage module MB is 256 (that is, it can store at most 256 labeled prediction vectors or unlabeled prediction vectors, and 256 labeled mapped features or unlabeled mapped features). All data is stored in the order of input to the network. For the stored features, when the memory storage module MB reaches the storage limit during training, the earliest stored labeled prediction vector, unlabeled prediction vector, labeled mapped feature, and unlabeled mapped feature will be removed, and the latest labeled prediction vector, unlabeled prediction vector, labeled mapped feature, and unlabeled mapped feature will be stored.
[0074] In some embodiments, S5 is specifically represented by the following formula:
[0075]
[0076]
[0077] Among them, in formula (1), z i is the unlabeled mapped feature of the i-th unlabeled sample in a batch of data within a sub-network; K represents the total number of all labeled mapped features and / or unlabeled mapped features in the memory storage module MB, is the labeled mapped feature or unlabeled mapped feature stored in the k-th position of the memory storage module MB; s ik is the similarity between the unlabeled output feature and the labeled mapped feature or unlabeled mapped feature stored in the k-th position of the memory storage module MB; t represents the temperature coefficient. Preferably, t = 0.2;
[0078] In formula (2), p i is the unlabeled prediction vector of the i-th unlabeled sample in a batch of data, For the labeled prediction vector or unlabeled prediction vector stored at the k-th position of the memory storage module MB, α is the smoothing coefficient; the two sub-models are respectively named the first sub-model and the second sub-model, q i represents the i-th pseudo-label input into the first sub-model.
[0079] In some embodiments, S6 specifically includes the following steps:
[0080] S61. Determine whether the two memory storage modules MB are filled with labeled mapping features and unlabeled mapping features. If not, go to S66; if so, use the pseudo-label q i and the unlabeled prediction vector p i to construct the mutual pseudo-label loss
[0081] S62. Take the inner product of the pseudo-labels in the two pseudo-label sets and in the current batch to obtain the similarity matrix and the dissimilarity matrix The matrix sizes are both B×B;
[0082] S63. Use the unlabeled mapping features in the current batch to construct two mapping feature sets and Use the two mapping feature sets and to solve the feature similarity matrix of size B×B by taking the inner product
[0083] S64. By calculating the cross-entropy between the similarity matrix and the feature similarity matrix and the cross-entropy between the dissimilarity matrix and the feature similarity matrix to form the mutual pseudo-label guided contrastive learning contrast loss
[0084] S65. Use the labeled prediction vector and the true label of the labeled sample to construct the supervision loss [[ID=5३]]Then use the supervision loss the mutual pseudo-label loss and the mutual pseudo-label guided contrastive learning contrast loss to construct the total loss. Repeat S3 to S6 until the number of iterations reaches the set number. Select the weight with the smallest total loss as the weight of the sub-model finally applied, and obtain the sub-model finally applied. S6 ends;
[0085] S66. Use the labeled prediction vector and the true label of the labeled sample to construct the supervision loss The supervision loss That is, the total loss. Repeat S3 to S6 until the number of iterations reaches the set number. Select the weights with the minimum total loss as the weights of the sub-model finally applied, and obtain the sub-model finally applied. S6 ends.
[0086] In some embodiments, the mutual pseudo-label loss in S61 is specifically as follows:
[0087]
[0088] is the pseudo-label generated by another sub-network for the i-th unlabeled sample for the current sub-model, that is, the sub-networks provide pseudo-labels for each other. B represents the number of unlabeled samples or labeled samples input to the two sub-models in S4. The ratio of the number of input unlabeled samples to labeled samples is 1:1, and the total number of inputs is 2B.
[0089] In some embodiments, the similarity matrix in S62 and the dissimilarity matrix are respectively as follows:
[0090]
[0091]
[0092] where q′ j represents the j-th pseudo-label input to the second sub-model.
[0093] The feature similarity matrix in S63 is specifically as follows:
[0094]
[0095] where z′ j represents the j-th unlabeled mapped feature input to the second sub-model.
[0096] In some embodiments, the mutual pseudo-label guided contrastive learning contrast loss in S64 is specifically as follows:
[0097]
[0098] where H() represents the cross-entropy loss function.
[0099] In some embodiments, the total loss in S65 is specifically as follows:
[0100]
[0101] where, λ mut and λsdc the mutual pseudo-label loss weighting coefficient of and the mutual pseudo-label guided contrastive learning contrast loss weighting coefficient of; L overall represents the total loss.
[0102] In some embodiments, the number of iterations set in S65 and S66 is 20 to 100 times. Preferably, the number of iterations set in the present invention is 25 times.
[0103] The present invention proposes a semi-supervised medical hyperspectral classification method based on pseudo-label mutual learning, enabling the sub-model to learn more refined features. In this framework, we only need a very small amount of labeled sample data, and add the data of the rest of the hyperspectral image as unlabeled data to the unlabeled sample set to train the mutual semi-supervised learning model. At the same time, the present invention combines the mutual semi-supervised learning model with the pseudo-label smoothing strategy to reduce the noise knowledge learned by the classification model (i.e., the sub-model) during the hyperspectral feature extraction process, avoiding the overfitting problem caused by using a single model in traditional methods. Secondly, the present invention adopts a pseudo-label guided contrastive learning method, which helps to maximize the inter-class discreteness and minimize the intra-class compactness, thereby reducing the intra-class spectral variability and greatly improving the efficiency of hyperspectral classification.
[0104] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, and all should be covered by the protection scope of the present invention. Moreover, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A pharmaceutical hyperspectral classification method based on pseudo-label mutual learning semi-supervised, characterized in that, It includes the following steps: S1. Obtain the original hyperspectral medical dataset; S2. Use the hyperspectral medical dataset to construct a labeled sample set and an unlabeled sample set; S3. Build a mutual semi-supervised learning model for hyperspectral medical classification. The mutual semi-supervised learning model includes two identical sub-models. Each sub-model includes an encoder F, a feature mapping head E, a prediction mapping head P, and a memory storage module MB connected in sequence; S4. Select a batch of samples from the labeled sample set and the unlabeled sample set respectively and input them into the two sub-models. The encoders F in the two sub-models respectively extract features from the labeled samples and the unlabeled samples to obtain labeled output features and unlabeled output features. Use the feature mapping heads E of the two sub-models to map the labeled output features and the unlabeled output features respectively to obtain labeled mapping features and unlabeled mapping features, and store them in the memory storage module MB; Use the prediction mapping heads P of the two sub-models to predict the labeled output features and the unlabeled output features respectively to obtain labeled prediction vectors and unlabeled prediction vectors, and store them in the memory storage module MB; S5. Smooth the unlabeled prediction vectors using the labeled mapping features and the unlabeled mapping features stored in the two memory storage modules MB to obtain two pseudo-label sets for the current batch; S6. Calculate the total loss using the labeled prediction vectors, the labeled mapping features, the unlabeled mapping features, the unlabeled prediction vectors, and the two pseudo-label sets for the current batch. Repeat S3 to S6 until the number of iterations reaches the set number of times. Select the weight with the smallest total loss as the weight of the sub-model for final application to obtain the sub-model for final application; S7. Use the sub-model for final application to classify other hyperspectral medical data.
2. The hyperspectral classification method for medicine according to claim 1, wherein The specific steps of S2 are as follows: S21. Randomly select some hyperspectral medical data in the hyperspectral medical dataset and label this part of the hyperspectral medical data to obtain a labeled sample set; S22. Use another part of the hyperspectral medical data without labels in the hyperspectral medical dataset to construct an unlabeled sample set.
3. The hyperspectral classification method for medicine according to claim 1, wherein The role of the encoder F in S3 is to extract features for the feature mapping head E and the prediction mapping head P; The encoder F includes five feature extraction units connected in sequence. Each feature extraction unit includes a convolutional layer and a max pooling layer connected to each other; The role of the feature mapping head E is to map the features obtained by the encoder F to obtain mapping features. The feature mapping head E is a fully connected layer; The role of the prediction mapping head P is to predict the features obtained by the encoder F to obtain prediction vectors. The prediction mapping head P includes a fully connected layer, a dropout layer, and a classification layer connected in sequence; The memory storage module MB is used to store the labeled prediction vectors and labeled mapping features corresponding to the labeled samples, as well as the unlabeled mapping features and unlabeled prediction vectors corresponding to the unlabeled samples.
4. The pharmaceutical hyperspectral classification method according to claim 1, characterized in that, The specific formula of S5 is as follows: In formula (1), z i is the unlabeled mapping feature of the i-th unlabeled sample in a batch of data within a sub-network; K represents the total number of all labeled mapping features and / or unlabeled mapping features in the memory storage module MB; is the labeled mapping feature or unlabeled mapping feature stored at the k-th position of the memory storage module MB; s ik is the similarity between the unlabeled output feature and the labeled mapping feature or unlabeled mapping feature stored at the k-th position of the memory storage module MB; t represents the temperature coefficient; In formula (2), p i is the unlabeled prediction vector of the i-th unlabeled sample in a batch of data, is the labeled prediction vector or unlabeled prediction vector stored at the k-th position of the memory storage module MB, and α is the smoothing coefficient; the two sub-models are respectively named the first sub-model and the second sub-model, q i represents the i-th pseudo-label input into the first sub-model.
5. The pharmaceutical hyperspectral classification method according to claim 4, characterized in that The specific steps of S6 are as follows: S61. Determine whether two memory storage modules MB are filled with labeled mapping features and unlabeled mapping features. If not, go to S66. If so, use the pseudo-label q obtained in S5 i and the unlabeled prediction vector p i to construct a mutual pseudo-label loss S62. Take the inner product of the pseudo-labels in two pseudo-label sets of the current batch and to obtain a similarity matrix and a dissimilarity matrix Both matrices are of size B×B; S63. Construct two mapping feature sets using the unlabeled mapping features of the current batch and Using the two mapping feature sets and Solve the feature similarity matrix of size B×B by means of inner product S64. By calculating the cross-entropy between the similarity matrix and the feature similarity matrix as well as the cross-entropy between the dissimilarity matrix and the feature similarity matrix to construct the mutual pseudo-label-guided contrastive learning contrastive loss S65. Construct a supervision loss using the labeled prediction vector and the true label of the labeled sample Then use the supervision loss Mutual pseudo-label loss And the mutual pseudo-label guided contrastive learning contrast loss Construct the total loss, repeat S3 to S6 until the number of iterations reaches the set number, select the weight with the smallest total loss as the weight of the sub-model for final application, obtain the sub-model for final application, and end S6; S66. Construct a supervision loss using the labeled prediction vector and the true label of the labeled sample Supervision loss That is, the total loss. Repeat S3 to S6 until the number of iterations reaches the set number. Select the weight with the smallest total loss as the weight of the sub-model for final application, and obtain the sub-model for final application. End of S6.
6. The pharmaceutical hyperspectral classification method according to claim 5, wherein The mutual pseudo-label loss in S61 is as follows: q i Generate pseudo-labels for another sub-network using the pseudo-labels generated by the current sub-model for the i-th unlabeled sample, that is, the sub-networks provide pseudo-labels for each other. B represents the number of unlabeled samples or labeled samples input to the two sub-models in S4. The ratio of the number of input unlabeled samples to labeled samples is 1:1, and the total number of inputs is 2B.
7. The pharmaceutical hyperspectral classification method according to claim 5, wherein The similarity matrix in S62 and the dissimilarity matrix are as follows respectively: where q′ j represents the j-th pseudo-label input to the second sub-model; The feature similarity matrix in S63 is specifically as follows: where z′ j represents the j-th unlabeled mapped feature input to the second sub-model.
8. The pharmaceutical hyperspectral classification method according to claim 5, wherein The mutual pseudo-label guided contrastive learning contrastive loss in S64 Specifically as follows: Where H() represents the cross-entropy loss function.
9. The hyperspectral classification method for medicine according to claim 5, wherein The total loss in S65 is specifically as follows: Among them, λ mut and λ sdc are the weighted coefficients of the mutual pseudo-label loss and the weighted coefficient of the mutual pseudo-label guided contrastive learning contrast loss respectively.
10. The pharmaceutical hyperspectral classification method according to any one of claims 5 to 9, characterized in that, The set number of iterations in S65 and S66 is 20 to 100 times.
Citation Information
Patent Citations
Hyperspectral image classification method combined with unsupervised learning
CN110309868A
Semi-supervised learning method and device based on measurement distance loss framework and storage medium
CN112348109A