A semi-supervised continual learning method and system, and a disease recognition method based on medical images

By combining dual memory playback and unbiased contrastive learning, the problems of unlabeled data forgetting and feature bias in semi-supervised continuous learning are solved, achieving efficient knowledge retention and improved feature discriminativeness. It is applicable to fields such as medical imaging, industrial quality inspection, and autonomous driving.

CN122156166APending Publication Date: 2026-06-05NORTH CHINA ELECTRIC POWER UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTH CHINA ELECTRIC POWER UNIV
Filing Date
2026-03-10
Publication Date
2026-06-05

Smart Images

  • Figure CN122156166A_ABST
    Figure CN122156166A_ABST
Patent Text Reader

Abstract

The application relates to a kind of semi-supervised continuous learning method and system, and disease identification method based on medical image, the system includes two core modules of double memory playback (DMR) and unbiased contrast learning (UBCL). The method is based on NNCSL, and the traditional mechanism is optimized by data classification and feature deviation correction, efficient knowledge retention and unbiased feature learning are realized. By designing double memory playback (DMR) strategy, a double buffer area with labels and without labels is constructed, random sampling and loss-based confidence sampling are used respectively, and the overfitting of labeled data and the catastrophic forgetting of unlabeled data are simultaneously relieved. An unbiased contrast learning (UBCL) method is proposed, which combines metric learning and balanced KL regularization techniques to eliminate feature representation bias and help the model obtain unbiased and discriminative features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine learning technology in the field of artificial intelligence, specifically to a semi-supervised continuous learning method and system, and a disease recognition method based on medical images. Background Technology

[0002] Continual learning is one of the core research directions in artificial intelligence. Its goal is to enable models to continuously accumulate knowledge like humans and avoid forgetting old tasks when learning new ones.

[0003] Traditional continuous learning methods are mostly based on the assumption of fully supervised learning, i.e., all training data has accurate labels. However, in practical applications, obtaining large amounts of labeled data is time-consuming and expensive, limiting the practicality of these methods. To address this, semi-supervised continuous learning has emerged. By combining the characteristics of semi-supervised learning (using unlabeled data to improve the model's generalization ability) and continuous learning (sequentially learning multiple tasks), it has become a research hotspot in recent years.

[0004] Existing semi-supervised continuous learning methods are mainly based on replay strategies, regularization techniques, and parameter isolation mechanisms.

[0005] Among them, the replay method is the mainstream approach, which uses stored or generated historical samples to replay during training on new tasks in order to alleviate catastrophic forgetting.

[0006] For example, the Experience Replay (ER) method uses a fixed-capacity buffer to store old task samples and mixes them during training for new tasks; derivative methods such as Dark Experience Replay (DER) enhance knowledge retention by constraining model output consistency. However, while these methods perform well in fully supervised settings, they face adaptation difficulties in semi-supervised scenarios: in semi-supervised environments, only a portion of the data is labeled, and a large amount of unlabeled data requires the use of pseudo-label techniques to generate supervision signals, which can easily lead to low-quality pseudo-labels and error accumulation.

[0007] In semi-supervised learning, early methods such as pseudo-labeling and self-training generate supervisory signals through model prediction, but lack continuous learning mechanisms. Advanced methods like FixMatch combine consistency regularization and data augmentation to improve pseudo-label quality; contrastive learning techniques such as PAWS mine unlabeled data representations through metric learning. However, none of these methods consider scenarios where tasks arrive sequentially, failing to address the catastrophic forgetting problem. In recent years, a few studies have attempted to integrate semi-supervised learning with continuous learning.

[0008] For example, the NNCSL (Nearest Neighbor for Continual Semi-supervised Learning) method uses a nearest neighbor classifier to assign pseudo-labels to unlabeled data and retains old knowledge through aggregation relationships. However, this method only stores labeled samples and does not fully utilize the knowledge of the unlabeled samples themselves, resulting in limited mitigation of forgetting of unlabeled data. Other methods, such as ORDiSCo, rely on generative models to replay historical categories, but have high computational costs; CCIC uses cross-task contrastive learning, which is prone to performance degradation in complex scenarios.

[0009] Despite some progress made by existing methods, semi-supervised continuous learning still faces two core challenges: catastrophic forgetting of unlabeled data and feature representation bias. These issues severely limit the performance and application scope of models in real-world scenarios.

[0010] First, there is the catastrophic forgetting problem of unlabeled data. In a semi-supervised setting, the model needs to rely on a small amount of labeled data to assign pseudo-labels to unlabeled samples. Existing replay methods such as ER and DER typically use a single buffer to store samples, but in a semi-supervised environment, if only labeled samples are replayed, it will exacerbate the model's overfitting to labeled data, while ignoring the knowledge contained in unlabeled data, leading to performance degradation of older tasks.

[0011] For example, the NNCSL method stores labeled samples in a buffer for pseudo-label assignment but avoids replaying these samples to mitigate overfitting. However, this method only alleviates forgetting by maintaining the aggregation relationship between samples and classes (such as nearest neighbor distillation) and fails to directly utilize unlabeled samples for knowledge preservation. Therefore, when the buffer capacity is limited, its effect on mitigating forgetting of unlabeled data is poor. Experiments show that on the CIFAR-10 dataset, when the proportion of labeled data is only 0.8%, the accuracy of the NNCSL method is about 20% lower than that of the fully supervised method, highlighting the severity of the forgetting problem.

[0012] Second, there is the issue of feature representation bias. The generation of pseudo-labels in semi-supervised learning relies on the distribution of labeled data, but labeled data often fails to fully reflect the true data distribution, causing the feature representation of unlabeled samples to be biased towards the subspace of labeled samples. This bias leads the model to learn biased features, making it difficult to construct clear classification boundaries. In continuous learning scenarios, task data is input in a streaming manner with large distribution differences, and feature bias will amplify with the accumulation of tasks, further impairing the model's discriminative ability.

[0013] For example, while the NNCSL method avoids replaying labeled samples, pseudo-labels are still limited by the distribution of labeled data, making the feature representation unable to fairly represent unlabeled data. Existing contrastive learning methods, such as supervised contrastive learning (SupInfoNCE), can improve feature discriminativeness, but when directly applied to semi-supervised scenarios, they amplify bias due to pseudo-label errors, leading to unstable model performance on complex datasets (such as ImageNet-100).

[0014] Furthermore, existing methods have shortcomings in buffer design and sampling strategies. Most methods employ a flat buffer structure, which fails to distinguish the importance of labeled and unlabeled data; sampling strategies such as random sampling or ring buffering do not consider sample confidence and are prone to introducing low-quality false labels. These problems collectively result in poor generalization ability of the model in scenarios with a low proportion of labeled data and a large number of tasks.

[0015] For example, on the CIFAR-100 dataset, when the buffer capacity is 500, the accuracy of mainstream methods such as ER and iCaRL is less than 30%, which is far below the ideal level. Summary of the Invention

[0016] In view of this, the purpose of the present invention is to provide a semi-supervised continuous learning method and system, and a disease identification method based on medical images, so as to at least solve the problems of overfitting to labeled data and catastrophic forgetting of unlabeled data in the prior art of semi-supervised continuous learning.

[0017] According to a first aspect of the present invention, a semi-supervised continuous learning method is provided, comprising: Step S11, Buffer Allocation: Allocate a first buffer Ms to store labeled samples and a second buffer Mu to store unlabeled samples. The capacities of Ms and Mu are fixed, and Ms is updated through a random sampling strategy, while Mu is dynamically updated through a confidence-aware sampling strategy. Step S12, Pseudo-label assignment: By measuring the distance between each unlabeled sample in Mu and the labeled sample in Ms, a pseudo-label is assigned to each unlabeled sample in Mu, and the assigned pseudo-label is associated with the corresponding unlabeled sample and stored in the second buffer Mu. Step S13, Confidence Calculation: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample; Step S14, Sampling and Update: Use unlabeled samples with high confidence as the sampling standard to dynamically manage the second buffer Mu; Step S15, Experience Replay Training: During the training of a new task, the old task samples in the second buffer Mu are mixed with the current task data for training using the experience replay method. During hybrid training, the model minimizes the total loss function. To optimize the overall loss function, the loss function includes: basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss, in order to achieve knowledge preservation and feature bias elimination.

[0018] According to a second aspect of the present invention, a disease identification method based on medical images is provided, wherein the method described above is used to identify diseases in medical images, comprising: Step S21: Deploy a disease identification system based on semi-supervised continuous learning, and initialize two core buffers: The labeled buffer Ms stores typical medical image samples that have been labeled by experts, including labeled X-rays or CT scans of common diseases, as an initial knowledge base; Unlabeled buffer Mu: Initially empty, used to dynamically accumulate unlabeled image samples with high confidence, supporting subsequent knowledge replay; Step S22: Process the medical image learning tasks that arrive consecutively in chronological order. For each new task, use only less than a first number of labeled data and more than a second number of unlabeled data to simulate a clinical annotation scarcity scenario; where the second number is greater than the first number. Step S23: Generate strong and weak augmented views for the unlabeled medical images of the current task, extract features and calculate the similarity with the labeled samples in Ms, assign pseudo-labels to each unlabeled sample in Mu, and associate the assigned pseudo-labels with the corresponding unlabeled samples and store them in the second buffer Mu. Step S24: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample, and use the unlabeled samples with high confidence levels as the sampling standard and store them in the second buffer Mu; at the same time, randomly sample labeled samples of the new task to update the Ms buffer to ensure dynamic optimization of the buffer. Step S25: During the training process of the new task, input the training data combination: the new image of the current task and the old task image played back in Mu; Calculate the loss function: Used to ensure the quality of pseudo-tags for new tasks; Used to maintain the ability to identify learned diseases by replaying old task samples in Mu; Used to eliminate feature bias and prevent the model from being overly biased towards new disease features; Eliminating feature bias includes: dividing the samples into: Representative sample: typical cases; Discriminative samples: atypical cases; By using balanced KL regularization, the model is forced to learn both types of features equally, thereby improving its robustness in identifying atypical cases.

[0019] Preferably, the method further includes: Perform real-time reasoning on input medical images and output disease type and confidence score; Regularly evaluate the diagnostic accuracy of all learned diseases on the test set; The system dynamically manages the buffer samples based on the confidence score to ensure the system remains stable during long-term operation.

[0020] According to a third aspect of the present invention, a semi-supervised continuous learning system is provided, comprising: Dual memory playback module, used for: Buffer allocation: A first buffer Ms is allocated to store labeled samples, and a second buffer Mu is allocated to store unlabeled samples. The capacities of Ms and Mu are fixed, and Ms is updated through a random sampling strategy, while Mu is updated dynamically through a confidence-aware sampling strategy. Pseudo-label assignment: By measuring the distance between each unlabeled sample in Mu and the labeled sample in Ms, a pseudo-label is assigned to each unlabeled sample in Mu, and the assigned pseudo-label is associated with the corresponding unlabeled sample and stored in the second buffer Mu; Confidence Calculation: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample; Sampling and updating: Using unlabeled samples with high confidence as the sampling standard, the second buffer Mu is dynamically managed; Experience replay training: During the training of a new task, the old task samples in the second buffer Mu are mixed with the current task data for training by using the experience replay method; During hybrid training, the model minimizes the total loss function. To optimize, the total loss function includes: basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss; The unbiased contrastive learning module is used to calculate the unbiased contrastive learning loss to eliminate feature bias.

[0021] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: The technical solution proposed in this invention comprises two core modules: Dual Memory Replay (DMR) and Unbiased Contrastive Learning (UBCL). Based on Non-Non-Comparative Learning (NNCSL), this method optimizes traditional mechanisms through hierarchical data utilization and feature bias correction, achieving efficient knowledge retention and unbiased feature learning.

[0022] By designing a dual memory playback (DMR) strategy, a dual buffer system with labeled and unlabeled elements is constructed, employing random sampling and a method based on... Loss confidence sampling simultaneously mitigates overfitting of labeled data and catastrophic forgetting of unlabeled data.

[0023] We propose the Unbiased Comparative Learning (UBCL) method, which integrates the idea of ​​metric learning with balanced KL regularization to eliminate feature representation bias and help the model obtain unbiased and highly discriminative features.

[0024] In addition, comparative, ablation, and hyperparameter quantification experiments were conducted on the CIFAR-10, CIFAR-100, and ImageNet-100 datasets, which fully verified the effectiveness and versatility of the method of the present invention.

[0025] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0027] Figure 1 This is a flowchart illustrating a semi-supervised continuous learning method according to an exemplary embodiment; Figure 2 This is a schematic diagram of a dual memory playback (DMR) module according to an exemplary embodiment; Figure 3 This is a schematic block diagram illustrating a semi-supervised continuous learning system according to an exemplary embodiment; Figure 4 This is a flowchart illustrating a disease identification method based on medical images according to an exemplary embodiment. Detailed Implementation

[0028] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims. Example 1

[0029] Figure 1 This is a flowchart illustrating a semi-supervised continuous learning method according to an exemplary embodiment, such as... Figure 1 As shown, the method includes: Step S11, Buffer Allocation: Allocate a first buffer Ms specifically for storing labeled samples, and allocate a second buffer Mu specifically for storing unlabeled samples. The capacities of Ms and Mu are fixed, and Ms is updated using a random sampling strategy, while Mu is dynamically updated using a confidence-aware sampling strategy (see [link to relevant documentation]). Figure 2 ); Step S12, Pseudo-label assignment: By measuring the distance between each unlabeled sample in Mu and the labeled sample in Ms, a pseudo-label is assigned to each unlabeled sample in Mu, and the assigned pseudo-label is associated with the corresponding unlabeled sample and stored in the second buffer Mu. Step S13, Confidence Calculation: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample; Step S14, Sampling and Update: Use unlabeled samples with high confidence as the sampling standard to dynamically manage the second buffer Mu; Step S15, Experience Replay Training: During the training of a new task, the old task samples in the second buffer Mu are mixed with the current task data for training using the experience replay method. During hybrid training, the model minimizes the total loss function. To optimize the overall loss function, the loss function includes: basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss, in order to achieve knowledge preservation and feature bias elimination.

[0030] It is understood that the technical solution provided in this embodiment aims to solve the key problem of avoiding forgetting old knowledge when the model continuously learns new knowledge in a scenario with limited labeled data.

[0031] Semi-supervised continuous learning combines the advantages of semi-supervised learning and continuous learning. It can perform sequential learning using a large amount of unlabeled data in environments where labeled data is scarce, thereby adapting to the needs of massive data streams and dynamically changing environments in the real world.

[0032] This technology is widely used in fields such as image classification, autonomous driving perception, and medical image monitoring. Specifically, applicable scenarios include, but are not limited to: I. Medical Image Analysis Scenarios: 1. Diagnosis of multiple diseases using radiological imaging, such as lesion detection using X-ray, CT, and MRI (e.g., continuous learning of pneumonia, tuberculosis, and COVID-19).

[0033] Medical labeling is costly. This method only requires 5% expert labeling and can utilize 95% of unlabeled data through pseudo-label allocation and a dual playback mechanism.

[0034] The incremental learning feature allows hospitals to deploy disease diagnosis modules in stages (e.g., learn common diseases first, and then expand to rare diseases), avoiding the model forgetting old knowledge.

[0035] 2. Classification of pathological tissue sections, for example: identification of colon pathological sections (such as 9 types of tissue classification).

[0036] The differences between pathological sections are minor (such as lymphocytes and mucus tissue). This method improves the discrimination ability by learning typical and atypical features in a balanced manner through unbiased contrastive learning.

[0037] Extended scenarios: Scenarios requiring continuous updates to the disease database, such as cervical smear cancer detection and dermoscopy image classification.

[0038] II. Industrial Quality Inspection and Fault Diagnosis Scenarios: 1. Product defect detection, such as surface scratches and assembly defects on electronic product production lines.

[0039] In industrial scenarios, new defect types are added as the production line changes (e.g., Task 1: Scratch detection → Task 2: Rust detection). This method maintains sensitivity to old defect types through experience playback training (step S15).

[0040] The confidence sampling mechanism (steps S13-14) can screen unlabeled samples with high confidence, adapting to the rapid changes in production line data flow.

[0041] Benefits: Reduces reliance on quality inspection and labeling, and supports rapid switching of product types on the production line.

[0042] 2. Predictive maintenance of equipment, such as mechanical fault diagnosis based on vibration and temperature signals.

[0043] Equipment failure modes evolve over time (e.g., bearing wear → gear breakage), and the streaming task processing capability of this method can dynamically integrate new failure data.

[0044] The unbiased contrastive learning module eliminates feature bias and prevents the model from being overly biased towards a certain fault type due to recent data.

[0045] III. Autonomous Driving and Environmental Perception Scenarios: 1. Traffic target recognition, such as incremental detection of vehicles, pedestrians, and traffic signs.

[0046] Autonomous driving needs to adapt to different regions and weather conditions (e.g., Task 1: vehicle recognition in sunny weather → Task 2: vehicle recognition in rainy and foggy weather). This method maintains the generalization of the model by replaying old scene data in a buffer.

[0047] Semi-supervised setups can utilize a large number of unlabeled driving records (such as 95% of unlabeled video frames) to reduce labeling costs.

[0048] 2. Agricultural remote sensing monitoring, such as crop pest and disease identification and land classification.

[0049] This method supports learning new tasks incrementally by season, taking into account the seasonal changes in pest and disease types during the crop growth cycle.

[0050] The pseudo-labeling mechanism can handle a large number of unlabeled areas in remote sensing images (such as 95% of pixels in satellite images being unlabeled).

[0051] Typical case: Extending from corn rust identification to wheat mold detection, avoiding repeated model training.

[0052] To facilitate understanding of the semi-supervised continuous learning method provided in this embodiment, let's take the identification of diseases in medical images as an example. Assume that we need to process medical image tasks that arrive sequentially in time (such as adding a new disease type every month): Task example: Task 1: Learn about pneumonia detection; Task 2: Add tuberculosis testing; Task 3: Add COVID-19 testing.

[0053] For each new task, only a small amount of labeled data (e.g., 5% of the total data) and a large amount of unlabeled data (95%) are used to simulate a clinically labeled scenario.

[0054] Specifically, the technical solution provided in this embodiment achieves efficient resource utilization through the fixed-capacity Ms and Mu buffers in step S11. Ms is updated through a random sampling strategy to ensure the diversity of labeled samples; Mu is dynamically updated through confidence-aware sampling, prioritizing the retention of unlabeled samples with high confidence. This design avoids buffer overflow or sample redundancy while providing a high-quality knowledge base for subsequent playback training. In medical imaging scenarios, this helps the system continuously accumulate features of typical cases (such as pneumonia) and difficult cases, improving the stability of long-term learning.

[0055] In step S12, by calculating the similarity (e.g., cosine distance) between unlabeled samples and labeled samples in Ms, the system can automatically generate pseudo-labels, effectively mining the potential value of unlabeled data. Pseudo-label assignment, as a key aspect of semi-supervised learning, enables the model to adapt to new disease types (such as expanding from pneumonia to tuberculosis) without the need for relabeling.

[0056] Step S13 calculates the confidence level of the pseudo-label for each unlabeled sample, filtering out samples with high confidence levels and avoiding noise introduced by low-quality pseudo-labels. This step ensures the quality of the pseudo-label's "feature distillation," preventing the model from overfitting to incorrect labels during training. In medical applications, this is crucial for diagnostic safety, such as avoiding misdiagnosing atypical COVID-19 cases as ordinary pneumonia.

[0057] The priority storage and dynamic update mechanism for high-confidence samples in step S14 ensures that the buffer always contains highly representative samples. For example, in Task 2 (tuberculosis detection), the system can quickly integrate new samples while retaining the key features of Task 1 (pneumonia). This dynamic management improves the model's adaptability and convergence speed. Experiments show that the average loss is stable at 0.404, proving that the training process is balanced and efficient.

[0058] In step S15, by mixing old task samples (such as pneumonia images) in Mu with current task data (such as tuberculosis images) for training, and combining multiple loss function optimizations (basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss), the system achieves knowledge preservation and bias elimination. Among the loss functions, empirical replay loss and unbiased contrastive learning loss suppress forgetting and feature bias, respectively, enabling the model to maintain high accuracy after incremental learning.

[0059] As can be seen, the technical solution provided in this embodiment significantly reduces annotation costs in medical image disease recognition by integrating buffer management, pseudo-label generation, and replay training, making it suitable for resource-limited medical environments; the incremental learning mechanism supports the system to continuously adapt to new diseases, avoiding repetitive training; and feature bias elimination ensures diagnostic reliability.

[0060] In summary, this embodiment proposes an Impartial Semi-supervised Continual Learning (ISCL) method, which aims to achieve efficient knowledge retention and unbiased feature learning through Double Memory Replay (DMR) and Unbiased Contrast Learning (UBCL) modules.

[0061] The core innovation of this embodiment lies in the following: First, the DMR module constructs a double buffer to store labeled and unlabeled samples respectively, and adopts a hierarchical utilization strategy: labeled samples are responsible for pseudo-label allocation, and unlabeled samples directly participate in the retention of old knowledge through replay, thereby simultaneously alleviating overfitting and catastrophic forgetting; Second, the UBCL module introduces unbiased contrastive learning loss in the model's experience replay training to eliminate feature representation bias and improve the discriminativeness and fairness of features.

[0062] In practice, step S12, pseudo-label allocation, includes: By measuring the feature space distance between each unlabeled sample in the second buffer Mu and the labeled sample in the first buffer Ms, a pseudo-label is assigned to each unlabeled sample. Among them, the feature space distance metric is based on the cosine similarity or L2 distance between feature representations, the pseudo-label assignment adopts the nearest neighbor classifier principle, and the assigned pseudo-labels are associated with the corresponding unlabeled samples and stored in the second buffer Mu.

[0063] In practice, step S13, confidence level calculation, includes: Calculate the confidence score of the pseudo-label for each unlabeled sample. Among them, the confidence score based on Loss quantization The loss value is measured by the cross-entropy function to determine the consistency of pseudo-labels for the same sample after strong and weak augmentation. The smaller the loss value, the higher the confidence level.

[0064] Understandably, a second buffer, Mu, is used to store samples assigned pseudo-labels, and old knowledge is preserved by replaying these unlabeled samples. However, the buffer capacity is limited, so samples with high confidence (the probability that the pseudo-label is correctly labeled or the model's confidence in its correctness) need to be stored for replay. This avoids the transmission and accumulation of erroneous knowledge during replay. Therefore, it is necessary to measure the confidence of the pseudo-label corresponding to each unlabeled sample as a sampling criterion.

[0065] In practice, step S14, sampling and updating, includes: When the second buffer Mu is not full, directly add the current pseudo-label sample and its confidence score; When the second buffer Mu is full, the confidence-aware sampling strategy is executed: The confidence score was determined using the Z-score normalization method. Standardize the data to obtain standardized scores. : ; in, The average of the confidence scores. Let be the standard deviation, such that the mean of all standardized scores is 0 and the standard deviation is 1; The replacement probability of each pseudo-labeled sample is calculated based on the absolute value of the standardized score. ; ; in, This represents the proportion of the absolute value of the standardized score of each pseudo-labeled sample to the sum of the absolute values ​​of the standardized scores of all pseudo-labeled samples. Based on the probability of replacement Weighted random sampling is performed on the samples in the second buffer Mu, and low-probability samples are replaced first to retain high-confidence samples.

[0066] In practice, the method based on replacement probability... Weighted random sampling is performed on the samples in the second buffer Mu, prioritizing the replacement of low-probability samples to retain high-confidence samples, including: Random index generation steps: Generate a uniformly distributed random integer i in the interval [0, N-1], where N is the fixed capacity of the second buffer Mu, and i represents the index of the potential replacement position to ensure the unbiasedness of the sampling starting point; Probability-weighted selection step: based on the replacement probability For each old pseudo-label sample in the second buffer Mu, calculate the replacement weight, where the replacement weight is related to the replacement probability. Inversely proportional; Dynamic update steps: Based on the replacement weight, randomly select an old pseudo-label sample position j from the second buffer Mu. If the replacement weight at position i is less than the replacement weight at position j, replace the old pseudo-label sample at position j with the new pseudo-label sample at position i. This ensures that the buffer always prioritizes high-confidence samples with high replacement probability, thus optimizing the replay training effect.

[0067] In practice, step S15, experience replay training, includes: (1) Calculate the basic semi-supervised loss The loss function is defined as: ; in, For SNN loss, For MEM loss, For LIN loss, For NND loss; where, , and This is a hyperparameter.

[0068] It should be noted that the technical solution provided in this embodiment optimizes the loss function based on the Nearest Neighbor for Continual Semi-supervised Learning (NNCSL) method.

[0069] The core logic of the NNCSL method consists of three main modules: pseudo-label assignment, loss function optimization, and knowledge preservation. In the pseudo-label assignment stage, for the unlabeled sample Xu, NNCSL employs a self-supervised multi-view strategy for data augmentation, generating both strong and weak augmented views, and extracting corresponding features through the model. (Strong augmentation) and (Weak augmentation).

[0070] Subsequently, by measuring the similarity between these two types of features and the features of the labeled samples, and combining this with sharpening parameters... (weak augmentation) and (Strong augmentation), by aggregating the weakly augmented pseudo-labels q and p respectively, label estimation is achieved for unlabeled samples: (1);

[0071] The feature vector representing the k-th labeled sample in the current batch is used as the comparison object for similarity measurement and is used to calculate the cosine similarity between the augmented features of the unlabeled sample and the features of the labeled sample. This represents the feature vector of the i-th labeled sample in the current batch, which is the summation of the labeled sample features in the formula, and... Different traversal indices for different features of labeled samples in the same batch; K represents the total number of labeled samples in the current batch, which is used to determine the range of summation in the formula, that is, to normalize the similarity calculation results of all K labeled samples in the current batch.

[0072] To optimize pseudo-label quality and model training performance, NNCSL designed a loss function: ; ; ; ; in, The pseudo-label is assigned to the nth unlabeled sample in the current batch under weak augmentation. L LIN This is short for the loss of a linear classifier, also known as the cross-entropy loss of a linear classifier. To sum all labeled samples in the current batch, the summation range is the index j (1 to J) of the labeled samples in the current batch. H() is the symbolic representation of cross-entropy loss, which is the core function in classification tasks that measures the difference between the model's predicted distribution and the true label distribution. The smaller the difference, the lower the cross-entropy loss value, and the more accurate the model prediction. This represents the predicted probability distribution of labeled samples in the current batch output by a linear classifier. The subscript l represents labeled samples, and the superscript k is the index of the labeled samples. This symbol indicates the model's prediction of the class of the k-th labeled sample (presented in the form of a probability distribution). The true label (true probability distribution in one-hot encoded form) of the j-th labeled sample in the current batch is the supervision signal for the classification task; J represents the total number of labeled samples in the current batch, and J contains K labeled samples for the current task (K is the number of labeled samples in the current batch, which is the core parameter in the NNCSL pseudo-label allocation formula).

[0073] For SNN loss, cross-entropy operation is used to constrain the consistency between pseudo-labels q and p in the strong augmented view, thereby improving the reliability of pseudo-labels; The MEM loss aims to maximize the average entropy by forcing all classes to have a uniform likelihood distribution, thus avoiding over-prediction of some classes. For LIN loss, the standard cross-entropy loss is used to optimize the linear classifier for labeled samples, while filtering out labeled samples from previous tasks to avoid them interfering with the current pseudo-label assignment. For NND loss; In terms of knowledge preservation, NNCSL introduces the nearest neighbor distillation (NND) mechanism. The models at time t and time t-1 are denoted as follows: and For each unlabeled sample Xu, the output features z and z′ at two time points are extracted, and a nearest neighbor classifier is constructed using the class support set at the corresponding time points to generate pseudo-labels at different time points. and Through NND loss Constraining the consistency of these two pseudo-labels maintains the mapping relationship between samples and categories, mitigating the catastrophic forgetting of old knowledge.

[0074] in, , and Hyperparameters are used to balance the effects of various loss terms. However, this method has obvious limitations: it only retains old knowledge by maintaining aggregation relationships, without fully utilizing the knowledge of the unlabeled samples themselves, and has a limited effect on mitigating forgetting of unlabeled data; moreover, pseudo-labels depend on the allocation of labeled data, are limited by the distribution of labeled data, and are prone to bias in the feature representation of unlabeled samples.

[0075] Based on this, the impartial semi-supervised continuous learning (ISCL) method provided in this embodiment improves the loss function and also includes: (2) Calculate the empirical playback loss This is achieved by training with old task samples in the second buffer Mu mixed with the current task data Dn. The loss function is defined as: ; The first term represents the prediction loss of the old task samples in the second buffer Mu based on their pseudo-labels, the second term represents the consistency loss of the replay samples, and z and z′ represent the model output response of the samples at the current time and in past time, respectively. Let B be the loss function, B represent the replay buffer, and E represent the expected value. This indicates that the second buffer Mu contains unlabeled samples from older tasks. express The pseudo-tags that were already assigned when storing Mu This indicates that sample Xu follows the old task sample distribution Dn in the second buffer Mu. This represents the probability distribution of the model's class prediction for the unlabeled sample Xu from the old task under the current parameters θ. It is obtained by normalizing the original output of the model through softmax and is the model's final prediction result for the class to which Xu belongs. This indicates that sample Xu follows the sample distribution B of the replay buffer; (3) Calculate the unbiased contrastive learning loss , It is used to obtain unbiased and highly discriminative feature representations, which include a supervised contrastive loss term and a balanced KL regularization term; In practice, the supervised contrastive loss term is based on the positive and negative sample similarity defined by the pseudo-label, and adopts the InfoNCE loss form. The calculation formula is as follows: ; in, and These represent the similarity between the anchor sample and the positive and negative samples, respectively. α is the separation margin between positive and negative samples; i and j are both uniformly distributed random integers on [0, N-1]; N is the fixed capacity of the second buffer Mu; i represents the i position in the second buffer Mu; and j represents the j position in the second buffer Mu. The equilibrium KL regularization term uses KL divergence to measure the difference in feature distributions between representative and discriminative samples, thus eliminating bias. The calculation formula is as follows: Where λ is a hyperparameter; This represents the KL constraint for balancing negative samples; This represents the KL constraint for balancing negative samples; The distance between the representative positive sample and the anchor point; The distance between the discriminative positive sample and the anchor point; The distance between the representative negative sample and the anchor point; The distance between the discriminative negative sample and the anchor point.

[0076] Understandably, the dual-memory replay strategy described above preserves the knowledge contained in unlabeled data from previous tasks, thereby improving the model's ability to mitigate catastrophic forgetting. However, in semi-supervised continuous learning, the finite representation space constructed from labeled data cannot fully represent the spatial distribution of unlabeled data. This results in the obtained feature representations of unlabeled data being biased towards labeled data, and consequently, the classification boundary constructed based on these biased features cannot achieve good classification.

[0077] To obtain unbiased and discriminative features for classification, a high-quality feature extractor is needed. Currently, supervised representation learning methods, such as contrastive learning, have become the primary choice for obtaining high-quality features.

[0078] However, the focus of this application is on how to extend this supervised contrastive learning to the semi-supervised domain and construct a contrastive learning strategy that can eliminate bias. Based on this, this application designs an unbiased contrastive learning method that utilizes the idea of ​​metric learning to obtain unbiased and highly discriminative features.

[0079] Specifically, the existing contrastive learning framework is first unified in order to analyze and compare the similarities and differences between the existing contrastive loss formula and the contrastive loss designed in this application.

[0080] Taking InfoNCE loss (Representation Learning with Contrastive Predictive Coding) as an example, we define... As a measure of similarity between the representations of two samples a and b (e.g., cosine similarity). Due to Therefore, using cosine similarity is equivalent to using L2 distance. .

[0081] from From the perspective of metric learning, the simplest goal of contrastive learning is to find a mapping function f such that the following Always satisfied: ; in, ,Right now The marginal threshold in the equation is a non-negative constant and is the minimum difference threshold between positive and negative samples and the anchor point required in contrastive learning. It is used to control the degree of separation between positive and negative samples. F() is the mapping function from the sample to the feature space (i.e., the feature extractor of the model). The input is the original sample, and the output is the feature representation of the sample. The core goal of contrastive learning is to learn this optimal f. X is the anchor sample, which is the benchmark sample for similarity / distance measurement in contrastive learning. All positive and negative samples are compared around this sample. , which is the positive sample corresponding to the anchor sample X, referring to the sample that belongs to the same category as the anchor sample; , is the j-th negative sample corresponding to the anchor sample X, refers to the sample that belongs to a different category from the anchor sample, and the subscript j represents the traversal index of the negative sample; d() is a distance metric function (L2 distance) used to calculate the distance between the feature representations of two samples after mapping f. The smaller the distance value, the higher the feature similarity between the two samples. , for the features of anchor sample X and positive sample The positive sample distance between features, i.e., d(f(x), f(x) + ()) is an abbreviation; , where the features of anchor sample X and the j-th negative sample are... The negative sample distance between features, i.e., d(f(x), f(x) j - ()) is an abbreviation; s() is a similarity metric function (cosine similarity), used to calculate the similarity between the feature representations of two samples after mapping f. The larger the similarity value, the more similar the features of the two samples are. , for the features of anchor sample x and positive sample The positive sample similarity between features is a shorthand for s(f(x), f(x+)). , where the features of anchor sample X and the j-th negative sample are... The negative sample similarity between features, i.e., s(f(x), f(x) j - )) is an abbreviation of )).

[0082] The logical equivalence symbol indicates that the distance constraint on the left side of the formula and the similarity constraint on the right side are completely equivalent in derivation.

[0083] Thus, for any given sample, the InfoNCE loss can be represented as follows: ; The proposed method utilizes LogSumExp(LSE) to obtain a smooth maximum approximation. The current supervised contrastive loss can be viewed as extending the InfoNCE loss to a supervised setting with multiple positive samples. Using the proposed metric learning method, each loss can be reformulated as a set of contrastive conditions, thus enabling supervised contrastive learning (…). ) can be represented as: ; By setting different The value can be used to separate positive and negative samples, thereby obtaining highly discriminative features and ensuring good performance for subsequent tasks. To control the marginal threshold for separating positive and negative samples in contrastive learning, a reasonable A value that allows for sufficient difference between the similarity between positive samples and anchor points, and between negative samples and anchor points, to achieve effective separation; an excessively large value... It will amplify the negative impact of false labeling errors, causing similar samples to be incorrectly separated; too small Then it is impossible to effectively distinguish between positive and negative samples, and a suitable Only with high values ​​can the model learn highly discriminative features.

[0084] Based on this, this application uses formula (1) to obtain pseudo-labels q as sample labels, thereby converting semi-supervised learning into supervised learning, and uses the features obtained after strong and weak augmentation to construct a contrastive loss. In addition, this application also designs an equalized KL regularization technique to eliminate bias, thereby obtaining unbiased and highly discriminative features.

[0085] q: Based on weak enhancement features The calculated probability distribution of samples belonging to each category. Because it is relatively stable, it is often used as a benchmark for "soft objectives" or consistency constraints.

[0086] p: Based on strong enhancement features The calculated probability distribution reflects the model's discriminative results under more challenging data views.

[0087] By defining a loss function (such as cross-entropy or KL divergence) to minimize the difference between q and p, the model can be forced to produce consistent and unbiased predictions for different augmented versions of the same sample, which is the core of unbiased contrastive learning.

[0088] By defining a loss function (such as cross-entropy or KL divergence) to minimize the difference between q and p, the model can be forced to produce consistent and unbiased predictions for different augmented versions of the same sample, which is the core of unbiased contrastive learning.

[0089] Specifically, use To represent a representative sample, use The classifier uses the concept of "discriminative" to represent samples, meaning samples that are closer to the class center and those that are highly discriminative, meaning samples that are distributed along the class boundary. In the early stages of training, the classifier tends to learn from highly representative samples, while later it learns from highly discriminative samples, because neural networks tend to leave the more difficult learning parts for later.

[0090] Therefore, for a given anchor point X, if the bias is "strong" and easy to learn, then it is a positively representative sample. Possibly more discriminative samples It is closer to the anchor point X in the representation space (the same applies to negative samples). This can easily lead to the continuous amplification and solidification of bias. In order to eliminate this bias, this application designs a balanced KL divergence for regularization, denoted as Balance KL.

[0091] Specifically, in an extremely ideal scenario, this is achieved by forcing the distances of the positive (negative) representative samples and the positive (negative) discriminative samples to be consistent with those of the anchor point. That is: ; However, in practice, this condition is very strict because it will force the distance between all positive (negative) samples to be uniformly distributed (uniformly arranged).

[0092] Therefore, this application uses a relatively loose distribution similarity instead of exact equivalence. Based on this, a normal distribution is used to fit the relationship between positive (and negative) samples. First, the mean and variance between the representative and discriminant samples are calculated using the following formula:

[0093] The feature space distance between the anchor sample and the representative positive sample; P represents the positive sample, N represents the negative sample, and b represents the representative sample (the sample closer to the class center). This represents the set of L2 distances between the positive representative samples and the anchor sample X. This represents the set of L2 distances between positively discriminative samples and anchor sample X. This represents the set of L2 distances between negatively represented samples and anchor sample X. The set of L2 distances between negative discriminative samples and anchor sample X; b' represents the feature space distance between the anchor sample and the discriminative positive sample; b' represents the discriminative sample (the sample distributed on the classification boundary). The feature space distance between the anchor sample and the representative negative sample; The feature space distance between the anchor sample and the discriminative negative sample is given.

[0094] Secondly, equilibrium KL bias removal constraints are proposed for positive and negative samples using the mean and variance: ; Finally, highly discriminative and unbiased features are obtained by minimizing the following objective function: ; Where α and λ are the hyperparameters of the corresponding terms.

[0095] Finally, the total loss function of the impartial semi-supervised continuous learning (ISCL) method provided in this embodiment is: ;in and To balance the hyperparameters. Example 2

[0096] Figure 3 This is a schematic block diagram illustrating a semi-supervised continuous learning system according to an exemplary embodiment, such as... Figure 3 As shown, the system includes: Dual Memory Playback Module (DWR) is used for: Buffer allocation: A first buffer Ms is allocated to store labeled samples, and a second buffer Mu is allocated to store unlabeled samples. The capacities of Ms and Mu are fixed, and Ms is updated through a random sampling strategy, while Mu is updated dynamically through a confidence-aware sampling strategy. Pseudo-label assignment: By measuring the distance between each unlabeled sample in Mu and the labeled sample in Ms, a pseudo-label is assigned to each unlabeled sample in Mu, and the assigned pseudo-label is associated with the corresponding unlabeled sample and stored in the second buffer Mu; Confidence Calculation: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample; Sampling and updating: Using unlabeled samples with high confidence as the sampling standard, the second buffer Mu is dynamically managed; Experience replay training: During the training of a new task, the old task samples in the second buffer Mu are mixed with the current task data for training by using the experience replay method; During hybrid training, the model minimizes the total loss function. To optimize, the total loss function includes: basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss; The Unbiased Contrastive Learning Module (UBCL) is used to calculate the unbiased contrastive learning loss to eliminate feature bias.

[0097] In practical application, this application validates the effectiveness and generality of the proposed Impartial Semi-supervised Continual Learning (ISCL) method through experiments. This includes: 1. Experimental setup: This method was also tested on three major datasets: CIFAR-10, CIFAR-100, and ImageNet-100. For fair comparison, ISCL also used ResNet-18 as the network backbone for the datasets. All datasets were trained for 250 epochs to decouple underfitting and forgetting. In all experiments, unless otherwise specified, Mu was fixed at 500, and Ms was set to 500 and 5120 respectively. The hyperparameters involved in ISCL are almost identical to those in NNCSL. Additional hyperparameters were selected by performing a grid search, where... The value of is 0.25, and α and λ are 0.1 and 0.3 respectively. ISCL is implemented based on PyTorch 1.9.1 and has been trained and tested on NVIDIA GeForce RTX 4090 GPU and NVIDIA Tesla V100 GPU.

[0098] 2. Experimental Results: The method described in this application was compared with nine other state-of-the-art methods, including ER, iCaRL, DER, GDumb, PseudoER, CIC, CCIC, PAWS, and NNCLS. All methods used the same network architecture for the same dataset to ensure a fair comparison.

[0099] The experimental results were obtained based on the average accuracy at the end of all tasks during five different initialization runs.

[0100] Table 1 shows the average accuracy comparison results of various methods on the CIFAR-10 and CIFAR-100 datasets. Observing the table, it can be seen that the ISCL method outperforms the comparison methods in all cases. Taking the CIFAR-10 dataset as an example, with a buffer capacity of 5120, the ISCL method achieves accuracies of 77.12%, 82.90%, and 85.98% with labeled data proportions of 0.8%, 5%, and 25%, respectively, which are 3.41%, 3.58%, and 4.98% higher than the second-best method, NNCLS. Table 1 also observes that compared to a buffer capacity of 500, the model performance improves more significantly with the increase in the labeled data proportion when the buffer capacity is 5120. This is because a larger capacity can be used to store labeled samples, and the increased proportion allows more labeled samples to be used to assign pseudo-labels to unlabeled data. The resulting labels have higher confidence, thus training with these high-confidence pseudo-labels yields better performance.

[0101] Furthermore, the experiments revealed that the ISCL method did not offer a significant performance improvement on the CIFAR-100 dataset compared to the simpler CIFAR-10 dataset. This is because as the number of tasks increases, unbiased contrastive learning needs to correct more biases. The process of homogenizing discriminative and representative features reduces the overall discriminative power of the features, thus diminishing its contribution to improving model performance.

[0102] Table 1. Accuracy Comparison of Various Machine Learning Methods on CIFAR10 and CIFAR100 Datasets

[0103] Table 2 shows the average accuracy comparison results of the ISCL method with various other methods on the more challenging ImageNet-100 dataset. Experiments were conducted under a continuous semi-supervised setting of 20 tasks and a buffer size of 5120. Observations show that the ISCL method outperforms the comparison methods in all cases. Specifically, the accuracy is 1.43%, 1.81%, and 2.36% higher than the second-best NNCLS method, respectively, at the settings of 1%, 5%, and 25% labeled data proportions. It is clear that the superiority of the ISCL method becomes increasingly apparent as the proportion of labeled data increases. This is because with a higher proportion of labeled samples, more labeled samples are used to calculate the confidence scores of unlabeled samples, thus obtaining higher-quality unlabeled samples for replay to retain old knowledge. Furthermore, with a larger amount of labeled data, the PAWS-based ISCL and NNCLS methods show a more significant performance improvement compared to other comparison methods. Taking labeled data proportions of 5% and 25% as examples, the average accuracy of the ISCL method is improved by at least 19.65% and 22.29% respectively compared to other comparative methods. This significant improvement demonstrates the clear advantage of methods based on nearest neighbor classification frameworks when dealing with high-resolution and large-variance images.

[0104] Table 2. Accuracy Comparison of Various Machine Learning Methods on the ImageNet-100 Dataset

[0105] 3. Ablation experiment: To evaluate the impact of the Dual Memory Replay (DMR) module and the Unbiased Contrast Learning (UBCL) module on the average accuracy of the model in the ISCL method, this application conducted relevant ablation experiments on the CIFAR-10 and CIFAR-100 datasets with a buffer size of 500. The results are shown in Table 3.

[0106] Since ISCL is an improvement upon NNCSL, NNCS was used as the baseline. Observations revealed that both DMR and UBCL improved the performance of NNCSL. However, the DMR component had a more significant impact on baseline performance compared to UBCL. For example, on the CIFAR-10 and CIFAR-100 datasets, with a labeled data ratio of 0.8%, DMR improved baseline performance by 1.22% and 0.85% more than UBCL, respectively. This is because while UBCL improves feature discriminativity, contributing to better classification performance, mitigating catastrophic forgetting has a greater impact on improving model performance in continuous learning settings. DMR further mitigates catastrophic forgetting by replaying unlabeled data. Furthermore, the combined performance of DMR and UBCL was found to be better than their individual performance, indicating that the two components are mutually reinforcing. This is because UBCL corrects feature bias and increases the confidence of pseudo-labels, while DMR can better preserve knowledge by re-inserting unlabeled samples with higher confidence. Conversely, DEM can alleviate the feature bias problem caused by the imbalance between new and old classes to a certain extent by using a double buffer, thus working together with UBCL to alleviate the bias.

[0107] Table 3. Impact of different components in ISCL on the average accuracy of the model (unit: %)

[0108] To verify the effectiveness of the confidence level sampling (CLS) strategy in the dual memory playback module, the experiment maintained the labeled data sampling strategy and Ms capacity of 500 (i.e., we used the NNCSL method as the baseline) to verify the advantages of the CLS strategy compared with other sampling strategies when Mu capacity is 500 and 5120. The results are shown in Table 4.

[0109] Observations revealed that the CLS strategy outperformed other sampling strategies in all cases, indicating that by using confidence level (LSNN) as the sampling metric, the CLS strategy can select samples that contribute more to the model. Specifically, with a Mu capacity of 500, the CLS strategy improved the performance of the baseline (NNCSL) by 3.25%, 0.66%, and 1.71% respectively when the proportion of labeled samples was 0.8%, 5%, and 25%, which is a significant improvement.

[0110] Furthermore, as the Mu capacity increases, the performance of the CLS sampling strategy improves compared to the baseline (NNCSL). For example, with a labeled sample ratio of 25%, the improvement is 4.26% with a Mu capacity of 5120, which is much higher than the 1.71% when the Mu capacity is 500. This is because when there are sufficient labeled samples, the quality of the pseudo-labels assigned to unlabeled samples is improved, and knowledge preservation can be better achieved by replaying these pseudo-labeled samples.

[0111] Furthermore, the loss-based CLS and VERS strategies achieved better results compared to other sampling strategies. This is because, unlike other sampling methods, both strategies use the loss value as the sampling standard, thus the samples collected have less impact on model performance during playback.

[0112] Table 4. Average accuracy of different sampling strategies on the CIFER-10 dataset (in %)

[0113] In addition, this application also addresses hyperparameters in practical applications. The effects of α and λ on model performance were experimentally investigated, and will not be repeated in this embodiment.

[0114] As can be seen, the ISCL proposed in this application can further solve the image classification problem in semi-supervised continuous learning. This method mitigates the catastrophic forgetting problem by constructing an unlabeled sample buffer and further utilizing unlabeled samples for replay, and addresses feature representation bias by constructing unbiased contrastive learning, thereby improving the model's feature representation capability. Experimental results show that the proposed ISCL method has good performance. Extensive experimental results demonstrate that the ISCL method is competitive with state-of-the-art methods.

[0115] In summary, the novel impartial semi-supervised continuous learning (ISCL) method proposed in this embodiment comprises two core modules: dual memory replay (DMR) and unbiased contrastive learning (UBCL). Based on NNCSL, this method optimizes traditional mechanisms through hierarchical data utilization and feature bias correction, achieving efficient knowledge preservation and unbiased feature learning.

[0116] By designing a dual memory playback (DMR) strategy, a dual buffer system with labeled and unlabeled elements is constructed, employing random sampling and a method based on... Loss confidence sampling simultaneously mitigates overfitting of labeled data and catastrophic forgetting of unlabeled data.

[0117] We propose the Unbiased Comparative Learning (UBCL) method, which integrates the idea of ​​metric learning with balanced KL regularization to eliminate feature representation bias and help the model obtain unbiased and highly discriminative features.

[0118] In addition, comparative, ablation, and hyperparameter quantification experiments were conducted on the CIFAR-10, CIFAR-100, and ImageNet-100 datasets, which fully verified the effectiveness and versatility of the ISCL method. Example 3

[0119] Figure 4 This is a flowchart illustrating a disease identification method based on medical images according to another exemplary embodiment. The method described above is applied to identify diseases in medical images, such as... Figure 4 As shown, the method includes: Step S21: Deploy a disease identification system based on semi-supervised continuous learning, and initialize two core buffers: The labeled buffer Ms stores typical medical image samples that have been labeled by experts, including labeled X-rays or CT scans of common diseases, as an initial knowledge base; Unlabeled buffer Mu: Initially empty, used to dynamically accumulate unlabeled image samples with high confidence, supporting subsequent knowledge replay; Step S22: Process the medical image learning tasks that arrive consecutively in chronological order. For each new task, use only less than a first number of labeled data and more than a second number of unlabeled data to simulate a clinical annotation scarcity scenario; where the second number is greater than the first number. Step S23: Generate strong and weak augmented views for the unlabeled medical images of the current task, extract features and calculate the similarity with the labeled samples in Ms, assign pseudo-labels to each unlabeled sample in Mu, and associate the assigned pseudo-labels with the corresponding unlabeled samples and store them in the second buffer Mu. Step S24: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample, and use the unlabeled samples with high confidence levels as the sampling standard and store them in the second buffer Mu; at the same time, randomly sample labeled samples of the new task to update the Ms buffer to ensure dynamic optimization of the buffer. Step S25: During the training process of the new task, input the training data combination: the new image of the current task and the old task image played back in Mu; Calculate the loss function: Used to ensure the quality of pseudo-tags for new tasks; Used to maintain the ability to identify learned diseases by replaying old task samples in Mu; Used to eliminate feature bias and prevent the model from being overly biased towards new disease features; Eliminating feature bias includes: dividing the samples into: Representative sample: typical cases; Discriminative samples: atypical cases; By using balanced KL regularization, the model is forced to learn both types of features equally, thereby improving its robustness in identifying atypical cases.

[0120] Preferably, the method further includes: Perform real-time reasoning on input medical images and output disease type and confidence score; Regularly evaluate the diagnostic accuracy of all learned diseases on the test set; The system dynamically manages the buffer samples based on the confidence score to ensure the system remains stable during long-term operation.

[0121] In addition, to verify the effectiveness of the semi-supervised continuous learning method based on dual memory playback proposed in this invention in the field of medical image processing, this embodiment uses the PathMNIST pathological tissue slice dataset as the test benchmark.

[0122] 1. Dataset Features: PathMNIST contains nine different types of colon pathological tissue sections (including adipose tissue, background, debris, lymphocytes, mucus, muscle, etc.). The image resolution is 28×28 pixels (interpolated to 32×32 in this embodiment to adapt to the feature extraction network), and the color space is RGB.

[0123] Task Splitting: In order to simulate the continuous learning scenario generated by batches of clinical data, this embodiment divides the 9 categories into 3 independent incremental learning tasks (Task 0, Task 1, Task 2), and each task contains 3 non-overlapping categories.

[0124] Task 1 (Task 0): Category indices 0, 1, 2; Task 2 (Task 1): Category indices 3, 4, 5; Task 3 (Task 2): Category indices 6, 7, 8; Semi-supervised setting: Simulating a scenario where medical annotations are scarce, the training set is divided into two parts: Labeled Support Set: This set comprises only 5% of the total data.

[0125] Unlabeled Query Set: This set comprises 95% of the total data and its true labels are not visible during training.

[0126] 2. System Configuration Contrastive learning strategy: The PAWS (Predicting View Assignments with SupportSamples) mechanism is used to assign pseudo-labels to each unlabeled sample in the second buffer.

[0127] Multicrop enhancement: Generates two global views and several local views for each image.

[0128] Temperature: Set to 0.1 to sharpen the predicted distribution.

[0129] ; in, and This represents the sharpening parameter.

[0130] Memory playback mechanism: Set the size of both the first and second buffers to 500.

[0131] Training hyperparameters: 100 training cycles per task, initial learning rate of 0.05, using cosine annealing strategy.

[0132] 3. Experimental Results and Engineering Analysis After completing all three stages of incremental learning tasks, this system achieved significant technical indicators on the retained validation set. Specific data and analysis are shown in the table below: Table 5 Summary of Technical Indicators

[0133] Data shows that, under the stringent condition of using only 5% labeled data, the system ultimately achieved a Top-1 accuracy of 72.07%. Considering the minimal morphological differences between PathMNIST categories (e.g., all cells are purple-stained tissues), this accuracy demonstrates that the proposed dual playback mechanism effectively suppresses catastrophic forgetting of older tasks (Task 0 and Task 1). Particularly noteworthy is the 93.80% Top-5 accuracy, indicating that the feature space extracted by the system possesses extremely high semantic convergence. Even if the first-choice prediction is incorrect, the correct answer is highly likely to fall within the high-confidence interval, which has significant practical value for engineering systems primarily used for assisted diagnosis.

[0134] Experimental logs show that the pseudo-label accuracy of unsupervised samples reached 48.57% at the end of training. This indicates that through the PAWS mechanism, the system successfully utilized 5% of the labeled data as "anchors," effectively "pulling" 95% of the unlabeled data towards the correct feature clusters. This confirms that the present invention can maintain model performance while significantly reducing medical annotation costs (saving 95% of manpower).

[0135] The regularization term eventually stabilized at -1.099. In the three-class sub-task, the theoretical maximum entropy was -1.0986. The high agreement between the experimental and theoretical values ​​proves that the model did not experience mode collapse during the entire continuous learning process, i.e., there was no degenerate phenomenon of predicting all samples as the same class in order to reduce loss. This is also an important manifestation of the engineering robustness of this invention.

[0136] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.

[0137] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.

[0138] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.

[0139] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0140] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0141] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0142] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.

[0143] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0144] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A semi-supervised continuous learning method, characterized in that, include: Step S11, Buffer Allocation: Allocate a first buffer Ms to store labeled samples and a second buffer Mu to store unlabeled samples. The capacities of Ms and Mu are fixed, and Ms is updated through a random sampling strategy, while Mu is dynamically updated through a confidence-aware sampling strategy. Step S12, Pseudo-label assignment: By measuring the distance between each unlabeled sample in Mu and the labeled sample in Ms, a pseudo-label is assigned to each unlabeled sample in Mu, and the assigned pseudo-label is associated with the corresponding unlabeled sample and stored in the second buffer Mu. Step S13, Confidence Calculation: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample; Step S14, Sampling and Update: Use unlabeled samples with high confidence as the sampling standard to dynamically manage the second buffer Mu; Step S15, Experience Replay Training: During the training of a new task, the old task samples in the second buffer Mu are mixed with the current task data for training using the experience replay method. During hybrid training, the model minimizes the total loss function. To optimize the overall loss function, the loss function includes: basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss, in order to achieve knowledge preservation and feature bias elimination.

2. The semi-supervised continuous learning method according to claim 1, characterized in that, Step S12, pseudo-tag allocation, includes: By measuring the feature space distance between each unlabeled sample in the second buffer Mu and the labeled sample in the first buffer Ms, a pseudo-label is assigned to each unlabeled sample. Among them, the feature space distance metric is based on the cosine similarity or L2 distance between feature representations, the pseudo-label assignment adopts the nearest neighbor classifier principle, and the assigned pseudo-labels are associated with the corresponding unlabeled samples and stored in the second buffer Mu.

3. The semi-supervised continuous learning method according to claim 1, characterized in that, Step S13, confidence level calculation, includes: Calculate the confidence score of the pseudo-label for each unlabeled sample. Among them, the confidence score based on Loss quantization The loss value is measured by the cross-entropy function to determine the consistency of pseudo-labels for the same sample after strong and weak augmentation. The smaller the loss value, the higher the confidence level.

4. The semi-supervised continuous learning method according to claim 3, characterized in that, Step S14, sampling and updating, includes: When the second buffer Mu is not full, directly add the current pseudo-label sample and its confidence score; When the second buffer Mu is full, the confidence-aware sampling strategy is executed: The confidence score was determined using the Z-score normalization method. Standardize the data to obtain standardized scores. : ; in, The average of the confidence scores. Let be the standard deviation, such that the mean of all standardized scores is 0 and the standard deviation is 1; The replacement probability of each pseudo-labeled sample is calculated based on the absolute value of the standardized score. : ; in, This represents the proportion of the absolute value of the standardized score of each pseudo-labeled sample to the sum of the absolute values ​​of the standardized scores of all pseudo-labeled samples. Based on the probability of replacement Weighted random sampling is performed on the samples in the second buffer Mu, and low-probability samples are replaced first to retain high-confidence samples.

5. The semi-supervised continuous learning method according to claim 4, characterized in that, Based on replacement probability Weighted random sampling is performed on the samples in the second buffer Mu, prioritizing the replacement of low-probability samples to retain high-confidence samples, including: Random index generation steps: Generate a uniformly distributed random integer i in the interval [0, N-1], where N is the fixed capacity of the second buffer Mu, and i represents the index of the potential replacement position to ensure the unbiasedness of the sampling starting point; Probability-weighted selection step: based on the replacement probability For each old pseudo-label sample in the second buffer Mu, calculate the replacement weight, where the replacement weight is related to the replacement probability. Inversely proportional; Dynamic update steps: Based on the replacement weight, randomly select an old pseudo-label sample position j from the second buffer Mu. If the replacement weight at position i is less than the replacement weight at position j, replace the old pseudo-label sample at position j with the new pseudo-label sample at position i. This ensures that the buffer always prioritizes high-confidence samples with high replacement probability, thus optimizing the replay training effect.

6. The semi-supervised continuous learning method according to claim 1, characterized in that, Step S15, experience replay training, includes: Calculate the basic semi-supervised loss The loss function is defined as: ; in, For SNN loss, For MEM loss, For LIN loss, For NND loss; where, , and For hyperparameters; Calculate the experience playback loss This is achieved by training with old task samples in the second buffer Mu mixed with the current task data Dn. The loss function is defined as: ; The first term represents the prediction loss of the old task samples in the second buffer Mu based on their pseudo-labels, the second term represents the consistency loss of the replay samples, and z and z′ represent the model output response of the samples at the current time and in past time, respectively. Let B be the loss function, B represent the replay buffer, and E represent the expected value. This indicates that the second buffer Mu contains unlabeled samples from older tasks. express The pseudo-tags that were already assigned when storing Mu This indicates that sample Xu follows the old task sample distribution Dn in the second buffer Mu. This represents the probability distribution of the model's class prediction for the unlabeled sample Xu from the old task under the current parameters θ. It is obtained by normalizing the original output of the model through softmax and is the model's final prediction result for the class to which Xu belongs. This indicates that sample Xu follows the sample distribution B of the replay buffer; Calculate unbiased contrastive learning loss , It is used to obtain unbiased and highly discriminative feature representations, which include a supervised contrastive loss term and a balanced KL regularization term; The total loss function is: ;in and To balance the hyperparameters.

7. The semi-supervised continuous learning method according to claim 6, characterized in that, The supervised comparison loss term is based on the similarity between positive and negative samples defined by pseudo-labels, and adopts the InfoNCE loss form. The calculation formula is as follows: ; in, and These represent the similarity between the anchor sample and the positive and negative samples, respectively. α is the separation margin between positive and negative samples; i and j are both uniformly distributed random integers on [0, N-1]; N is the fixed capacity of the second buffer Mu; i represents the i position in the second buffer Mu; and j represents the j position in the second buffer Mu. The equilibrium KL regularization term uses KL divergence to measure the difference in feature distributions between representative and discriminative samples, thus eliminating bias. The calculation formula is as follows: Where λ is a hyperparameter; This represents the KL constraint for balancing negative samples; This represents the KL constraint for balancing negative samples; The distance between the representative positive sample and the anchor point; The distance between the discriminative positive sample and the anchor point; The distance between the representative negative sample and the anchor point; The distance between the discriminative negative sample and the anchor point.

8. A disease identification method based on medical images, characterized in that, The method described in any one of claims 1 to 7 for identifying diseases in medical images includes: Step S21: Deploy a disease identification system based on semi-supervised continuous learning, and initialize two core buffers: The labeled buffer Ms stores typical medical image samples that have been labeled by experts, including labeled X-rays or CT scans of common diseases, as an initial knowledge base; Unlabeled buffer Mu: Initially empty, used to dynamically accumulate unlabeled image samples with high confidence, supporting subsequent knowledge replay; Step S22: Process the medical image learning tasks that arrive consecutively in chronological order. For each new task, use only less than a first number of labeled data and more than a second number of unlabeled data to simulate a clinical annotation scarcity scenario; where the second number is greater than the first number. Step S23: Generate strong and weak augmented views for the unlabeled medical images of the current task, extract features and calculate the similarity with the labeled samples in Ms, assign pseudo-labels to each unlabeled sample in Mu, and associate the assigned pseudo-labels with the corresponding unlabeled samples and store them in the second buffer Mu. Step S24: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample, and use the unlabeled samples with high confidence levels as the sampling standard and store them in the second buffer Mu; at the same time, randomly sample labeled samples of the new task to update the Ms buffer to ensure dynamic optimization of the buffer. Step S25: During the training process of the new task, input the training data combination: the new image of the current task and the old task image played back in Mu; Calculate the loss function: Used to ensure the quality of pseudo-tags for new tasks; Used to maintain the ability to identify learned diseases by replaying old task samples in Mu; Used to eliminate feature bias and prevent the model from being overly biased towards new disease features; Eliminating feature bias includes: dividing the samples into: Representative sample: typical cases; Discriminative samples: atypical cases; By using balanced KL regularization, the model is forced to learn both types of features equally, thereby improving its robustness in identifying atypical cases.

9. The disease identification method based on medical images according to claim 8, characterized in that, Also includes: Perform real-time reasoning on input medical images and output disease type and confidence score; Regularly evaluate the diagnostic accuracy of all learned diseases on the test set; The system dynamically manages the buffer samples based on the confidence score to ensure the system remains stable during long-term operation.

10. A semi-supervised continuous learning system, characterized in that, include: Dual memory playback module, used for: Buffer allocation: A first buffer Ms is allocated to store labeled samples, and a second buffer Mu is allocated to store unlabeled samples. The capacities of Ms and Mu are fixed, and Ms is updated through a random sampling strategy, while Mu is updated dynamically through a confidence-aware sampling strategy. Pseudo-label assignment: By measuring the distance between each unlabeled sample in Mu and the labeled sample in Ms, a pseudo-label is assigned to each unlabeled sample in Mu, and the assigned pseudo-label is associated with the corresponding unlabeled sample and stored in the second buffer Mu; Confidence Calculation: Calculate the confidence level of the pseudo-label corresponding to each unlabeled sample; Sampling and updating: Using unlabeled samples with high confidence as the sampling standard, the second buffer Mu is dynamically managed; Experience replay training: During the training of a new task, the old task samples in the second buffer Mu are mixed with the current task data for training by using the experience replay method; During hybrid training, the model minimizes the total loss function. To optimize, the total loss function includes: basic semi-supervised loss, empirical replay loss, and unbiased contrastive learning loss; The unbiased contrastive learning module is used to calculate the unbiased contrastive learning loss to eliminate feature bias.