A medical image pathology detection model training method based on few-shot learning
By introducing graph structure relationships and meta-attention mechanisms into medical image analysis, structured category anchors are generated and historical knowledge is integrated, which solves the problems of scarce labeled data and domain differences in few-shot learning of medical images, and improves the classification accuracy and robustness of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHWEAT UNIV OF SCI & TECH
- Filing Date
- 2026-01-20
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies struggle to effectively identify medical image features in medical image analysis due to the scarcity of labeled data and domain differences, especially under conditions of few samples, where classification accuracy and generalization ability are insufficient.
We employ a meta-learning paradigm to construct graph-structured relationships, combine meta-attention and dynamic memory, generate structured category anchors through graph neural networks, and perform adaptive weight allocation and historical knowledge integration to improve the discriminativeness and robustness of category anchors.
It significantly improves the classification accuracy and generalization ability of medical image pathology detection models under conditions with few samples, enabling more accurate identification of medical image features and making it suitable for noisy clinical environments.
Smart Images

Figure CN121544970B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition technology, and in particular relates to a training method for a medical image pathology detection model based on few-sample learning. Background Technology
[0002] In the field of medical image analysis, few-shot learning is gradually becoming a research hotspot, especially in scenarios such as disease feature recognition and pathological detection. Due to the scarcity and high cost of professionally labeled data, traditional deep learning models are often difficult to apply directly.
[0003] Few-shot medical image classification aims to train models using a very small number of labeled samples, enabling them to accurately identify new categories of medical images, such as histopathological sections, dermoscopy images, or optical coherence tomography (OCT) images. To overcome the bottleneck of scarce labeled data, researchers have proposed various technical approaches. Among them, pre-trained models based on transfer learning and prototype networks based on metric learning are two representative approaches, each with its own unique training methods.
[0004] The shortcomings of pre-trained model schemes based on transfer learning mainly stem from the combined effect of domain differences and data scarcity. First, this method faces a severe information bottleneck. The feature space learned by the pre-trained model on natural images differs fundamentally from the semantic and textural features of medical images. For example, the outlines and color distributions of objects in natural images do not directly correspond to the cell structures and lesion features in medical images. This domain difference necessitates a large amount of labeled data for feature adaptation during the fine-tuning phase. However, labeled data is extremely scarce under limited sample conditions, making it impossible to support complex feature mapping learning. Consequently, the model struggles to capture the essential features of the medical field, resulting in a significant decrease in generalization ability. Second, this method is insufficient in inter-class discriminative modeling. The feature space initialized by the pre-trained model is more suitable for distinguishing natural objects with significant class differences, while medical image categories are often visually highly similar. For example, different subtypes of cancer cells or early lesions differ from normal tissue, and subtle differences require highly specialized feature representations to differentiate them. The transfer learning scheme lacks optimization mechanisms for fine-grained classification of medical images, leading to blurred classification boundaries and affecting diagnostic accuracy.
[0005] For prototype network schemes based on metric learning, their shortcomings stem from the inherent limitations of the class anchor construction and metric mechanisms, and their training process fails to effectively address these issues. The primary problem is the high sensitivity of class anchor representations to noise and outliers. Class anchor calculation employs a simple arithmetic mean, meaning that each sample in the example set contributes equally to the class anchor, including potential imaging artifacts, labeling errors, or atypical cases. Noise and outliers are common in medical images, such as motion artifacts in CT scans or uneven staining in pathological sections; a single outlier can significantly distort the position of the class anchor vector, compromising its representativeness. Secondly, this scheme is also weak in inter-class discriminative modeling. Classification decisions rely solely on the relative distance between the query sample and the class anchor, lacking explicit optimization of the global structure of the embedding space. When medical images of different classes are visually highly similar, such as different stages of diabetic retinopathy, simple distance metrics struggle to learn highly discriminative decision boundaries. Furthermore, the prototype network is designed with isolated segments, each processed independently. The training process cannot accumulate and reuse knowledge from historical segments, which further exacerbates the information bottleneck problem caused by the absolute scarcity of samples and limits the applicability of the model in continuous learning scenarios. Summary of the Invention
[0006] To address the aforementioned issues, this invention proposes a training method for a medical image pathology detection model based on few-shot learning. This method systematically integrates graph structure relationship modeling, meta-attention-driven weight allocation, and cross-segment knowledge integration mechanisms into a unified meta-learning training framework. This significantly improves the discriminativeness, robustness, and generalization ability of the learned category anchor representations to new segments with a limited number of labeled samples, thereby achieving more accurate identification of pathological features in medical images.
[0007] To achieve the above objectives, the technical solution adopted by this invention is summarized as follows: A method for training a medical image pathology detection model based on few-shot learning, comprising the following steps:
[0008] S10 adopts a meta-learning paradigm, which constructs a large number of few-shot training segments from a dataset containing multi-class labeled images through random sampling. Each segment simulates a real few-shot classification scenario and includes an example set and a target set.
[0009] S20, Construct a shared deep convolutional neural network as a feature encoder to uniformly extract features from the example set and target set of medical images in each segment;
[0010] S30, For each category of the current segment, a graph neural network is used to generate structured category anchors, and the weights of the sample samples in the example set are adaptively assigned based on the meta-attention mechanism, so as to obtain the final representation of each category anchor.
[0011] S40 introduces a dynamic memory bank and an uncertainty perception mechanism to quantify the uncertainty of category anchors and integrate them with historical knowledge to obtain enhanced category anchors;
[0012] S50 calculates the classification loss based on the cosine similarity between the target set samples and the enhanced category anchors, and obtains the final medical image pathology detection model through model parameter updates.
[0013] Furthermore, in step S10, the example set for each segment samples A image categories, and B random labeled samples are sampled under each category;
[0014] The target set consists of several unlabeled samples from the same A image categories, used to evaluate the model's classification performance on the current segment.
[0015] Furthermore, the shared feature encoder maps the input raw image pixel data to a low-dimensional embedding space to generate a corresponding feature vector representation.
[0016] Furthermore, in step S30, the structured category anchor generation process for each category in the current fragment example set includes the following steps:
[0017] S311, Treat the feature vectors of all sample sets of the same category as graph nodes, construct edges based on the cosine similarity or k-nearest neighbor relationship between nodes, and form a relationship graph of the current category of samples;
[0018] S312, the relationship graph is input into a shallow graph convolutional network. With the help of the message passing mechanism of graph convolution, each node aggregates the information of its neighboring nodes to update its own features.
[0019] S313, Perform average pooling on all updated node features, and use the resulting vector as the structured category anchor for that category.
[0020] Furthermore, the adaptive allocation of sample weights in the example set based on the meta-attention mechanism includes the following steps:
[0021] S321, Input the sample features of the example set into a meta-attention module composed of a lightweight feedforward neural network. The meta-attention module integrates the sample's own features and intra-class relationships to output the attention weight of each sample.
[0022] S322, use the obtained weights to perform a weighted average on the sample features of the example set to obtain weighted category anchors, and integrate the weighted category anchors with the structured category anchors for fine-tuning.
[0023] Furthermore, in step S40, a dynamic memory bank and an uncertainty perception mechanism are introduced to quantify the uncertainty of category anchor points and integrate historical knowledge, including the following steps:
[0024] Calculate the variance of the cosine similarity between each category anchor point and the corresponding example set sample features, and use it as the uncertainty score of the current category anchor point;
[0025] Based on cosine similarity, retrieve multiple historical category anchors most relevant to the current category anchor from the dynamic memory;
[0026] The weights are dynamically adjusted based on the uncertainty score, and the current category anchor is integrated with the retrieved historical category anchors to form an enhanced category anchor.
[0027] Furthermore, in step S50, the cosine similarity between the target set sample features and each enhanced category anchor point is calculated, converted into a probability distribution by the Softmax function, and the loss value is calculated using the cross-entropy loss function.
[0028] Furthermore, an error backpropagation mechanism based on the SGD optimization strategy is adopted to drive the feature extractor, graph neural network and meta-attention component to achieve end-to-end parameter adaptation.
[0029] The beneficial effects of adopting this technical solution are:
[0030] (1) Significantly improves the discriminative power of the anchor points of the classes learned by the classifier:
[0031] By introducing a graph neural network into the training process to model the relationships between samples in the example set, the generated structured class anchors can capture more complex distribution characteristics within a class, surpassing the representational power of a simple arithmetic mean. This allows the classifier to learn to place class anchors in the embedding space closer to the true class center, especially when dealing with medical images with diverse visual features and large intra-class differences, enabling a more accurate characterization of the class essence and thus making more accurate classification decisions.
[0032] (2) Suppress noise at the source to enhance the inherent robustness of the classifier:
[0033] The meta-attention mechanism is integrated into the training process, enabling the classifier to automatically learn to identify and reduce the weights of low-quality, low-representative samples (such as imaging artifacts and labeled anomalous samples) in the category anchor calculation, thus suppressing noise propagation at its source. Compared to strategies that rely on subsequent filtering or expansion, the training method of this invention achieves denoising in the first stage of category anchor generation, making the finally trained classifier more tolerant of fluctuations in the quality of the example set data and more suitable for real clinical environments with data noise.
[0034] (3) Optimize the training process and effectively utilize the relationships between samples:
[0035] The application of graph neural networks means that the class anchor contribution of each sample during training is no longer independent, but rather interconnected through a graph structure. This implies that even if a sample has sparse information, it can be supplemented and enhanced during training through information from its neighboring samples. This implicit information interaction alleviates the problem of insufficient information caused by the absolute scarcity of samples to some extent, improves the utilization efficiency of limited data during training, and accelerates model convergence.
[0036] (4) Enhance the generalization and adaptability of the classifier in cross-segment scenarios:
[0037] The dynamic memory bank and uncertainty-aware integration mechanism constructed in this invention are integrated into the training framework, enabling the classifier to accumulate and reuse experience during training. Combined with higher-quality category anchor generation, the trained model can adapt more quickly and stably to training tasks involving entirely new segments, providing a solid technical foundation for long-term deployment and application in continuously changing clinical environments.
[0038] In summary, this invention, by designing a collaborative training framework that integrates graph structure category anchor point generation, attention weight allocation, and cross-segment knowledge integration, not only effectively addresses the inherent shortcomings of traditional few-shot learning methods, such as sensitivity to noise, neglect of sample associations, and segment isolation, but also strives to train an intelligent system capable of continuous learning and evolution. This invention provides a practical technical solution and guarantee for building highly reliable and available intelligent diagnostic tools in medical image analysis scenarios where labeled data is severely scarce. Attached Figure Description
[0039] Figure 1 This is a schematic diagram illustrating the principle of a medical image pathology detection model training method based on few-shot learning according to the present invention.
[0040] Figure 2 This is a flowchart illustrating the sample weight allocation process based on the meta-attention mechanism in this embodiment of the invention.
[0041] Figure 3 This is a schematic diagram illustrating the working principle of the dynamic memory in an embodiment of the present invention. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings.
[0043] In this embodiment, see Figure 1 As shown, this invention proposes a training method for a medical image pathology detection model based on few-shot learning, including the following steps:
[0044] S10 employs a meta-learning paradigm, constructing a large number of few-shot training segments from a dataset containing multi-class labeled images through random sampling. Each segment simulates a real few-shot classification scenario and includes an example set and a target set.
[0045] Specifically, from a large dataset of medical images containing numerous categories and annotations (such as a histopathological slide database), A image categories are randomly selected. For each category, B labeled samples are randomly selected to form an example set. Simultaneously, another batch of samples is selected from the same A categories to form a target set. This forms a training segment. By repeatedly performing this random sampling process, a segment distribution for training is constructed.
[0046] S20, Construct a shared deep convolutional neural network as a feature encoder to uniformly extract features from the example set and target set of medical images in each segment.
[0047] All segments share a deep convolutional neural network (e.g., ResNet) as a feature encoder, which transforms the raw medical images (pixel matrices) in the example and target sets into low-dimensional, dense feature vectors. This step compresses high-dimensional visual information into a semantic space suitable for measurement and comparison.
[0048] S30: For each category of the current segment, a graph neural network is used to generate structured category anchors, and the weights of the sample samples in the example set are adaptively assigned based on the meta-attention mechanism to obtain the final representation of each category anchor.
[0049] Specifically, for the i-th category in the current fragment example set, a structured category anchor point based on a graph neural network is generated; and the sample weights in the example set are adaptively allocated based on the meta-attention mechanism to obtain the final category anchor point. Figure 2 The detailed process was shown.
[0050] Including the following steps:
[0051] S311, consider the feature vectors of all B example samples of this category as nodes in a graph. Construct an undirected graph based on the cosine similarity or k-nearest neighbor relationship between node pairs;
[0052] S312, This graph is fed into a shallow graph convolutional network. Through the message passing layer of the network, the features of each node will be aggregated with the information of its neighboring nodes, thereby obtaining the updated feature representation containing the local graph structure.
[0053] S313, Perform average pooling on all updated node features of this category, and the resulting vector will serve as the structured category anchor for this category. ;
[0054] S321: The features of the same batch of example samples are input into a lightweight meta-attention module. This module not only analyzes the feature strength of the sample itself, but also implicitly considers its similarity relationship with other samples of the same type, and finally outputs a scalar weight for each sample. ;
[0055] S322, By using these weights to perform a weighted average of the example sample features, the attention-weighted category anchor points can be obtained. ;
[0056] S323, Finally, the initial category anchor for this category. It is possible and Linear combinations are obtained, for example, by averaging or by integrating through a learnable gating mechanism, which combines structural integrity and noise resistance.
[0057] S40 introduces a dynamic memory bank and an uncertainty perception mechanism to quantify the uncertainty of category anchors and integrate historical knowledge, resulting in enhanced category anchors; such as Figure 3 As shown, this mechanism constructs an effective way to reuse knowledge across fragments.
[0058] The specific steps include:
[0059] S411, Calculate the features of all example samples in the current category and the initial category anchor. Calculate the cosine similarity between the distances and the variance of these distances. The larger the variance, the more dispersed the sample data is around the class anchor, the higher the uncertainty of the class anchor, and the lower the reliability.
[0060] S412, will By comparing the cosine similarity of the anchor points with historical category anchor points generated from previous fragments stored in the dynamic memory, the top-K most similar historical category anchor points are retrieved. ;
[0061] S413, The retrieved historical category anchors are weighted and integrated with the current category anchors to form enhanced category anchors. The integration weights are dynamically adjusted by the uncertainty score; when the uncertainty of the current category anchor is high, its weight is reduced, and more reliance is placed on reliable historical knowledge retrieved from the memory; conversely, the category anchor generated by the current segment is trusted more.
[0062] S50, classification loss calculation and model update, to obtain a medical image pathology detection model.
[0063] The specific steps include:
[0064] S511, For each sample in the target set, calculate the feature vector and the augmented class anchors for all A categories. Cosine similarity between them;
[0065] S512 converts the cosine similarity into a probability distribution using the Softmax function, representing the probability that the sample belongs to each category. The loss value of the current segment is calculated using the cross-entropy loss between the true label and the predicted probability.
[0066] S513 uses the gradient descent algorithm to backpropagate the loss while updating the parameters of all components, including the feature encoder, graph convolutional network, meta-attention module, and memory retrieval network.
[0067] The key point of this invention lies in transforming the training of a few-sample medical image classification model from a relatively static process relying on simple averaging and independent fragment processing into a dynamic, collaborative optimization process with memory and reasoning capabilities. The three main components—graph structure modeling, attention mechanisms, and memory banks—are not simply superimposed, but rather deeply synergistic within the training framework.
[0068] First, a structured category anchor generation mechanism based on graph neural networks is integrated during training. By constructing a graph structure for the example set samples of each category and using a graph convolutional network for feature propagation and aggregation, the generated category anchors can contain rich structural information between samples. This invention generates structured category anchors that can more accurately characterize the intrinsic distribution of categories by constructing a sample relationship graph during training and using a graph convolutional network to aggregate neighborhood information. This mechanism enables the classifier to learn to generate category anchors that better represent the complex data structure of categories, especially in the multimodal distribution scenarios common in medical images.
[0069] Second, an adaptive sample weight allocation mechanism based on meta-attention is implemented within the training framework. Through a learnable meta-network, the contribution weights of samples to the construction of class anchors are dynamically allocated based on their own features and their relative relationships within the class. This quantitative evaluation enables fine-grained differentiation of sample quality during training, thereby automatically reducing the influence of noisy samples at the source of class anchor calculation and improving the inherent robustness of the classifier.
[0070] Third, an adaptive ensemble mechanism combining a dynamic memory bank and uncertain weights is introduced during training. This mechanism enables the classifier to not only learn the current segment during training but also accumulate and reuse knowledge from historical segments, significantly enhancing the model's generalization ability and learning efficiency across cross-segment scenarios.
[0071] This invention aims to construct a more intelligent and robust classifier in the context of few-sample medical image classification through innovative training methods, significantly improving the practical value of the model in clinical environments where labeled data is scarce.
[0072] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A training method for a medical image pathology detection model based on few-shot learning, characterized in that, Including the following steps: S10 adopts a meta-learning paradigm, which constructs a large number of few-shot training segments from a dataset containing multi-class labeled images through random sampling. Each segment simulates a real few-shot classification scenario and includes an example set and a target set. S20, Construct a shared deep convolutional neural network as a feature encoder to uniformly extract features from the example set and target set of medical images in each segment; S30, For each category of the current segment, a graph neural network is used to generate structured category anchors, and the weights of the sample samples in the example set are adaptively allocated based on the meta-attention mechanism to obtain the final representation of each category anchor. The generation of structured category anchors includes: S311, Treat the feature vectors of all sample sets of the same category as graph nodes, construct edges based on the cosine similarity or k-nearest neighbor relationship between nodes, and form a relationship graph of the current category of samples; S312, the relationship graph is input into a shallow graph convolutional network. With the help of the message passing mechanism of graph convolution, each node aggregates the information of its neighboring nodes to update its own features. S313, Perform average pooling on all updated node features, and use the resulting vector as the structured category anchor for that category; The example set sample weights are adaptively assigned based on the meta-attention mechanism, including the following steps: S321, Input the sample features of the example set into a meta-attention module composed of a lightweight feedforward neural network. The meta-attention module integrates the sample's own features and intra-class relationships to output the attention weight of each sample. S322, use the obtained weights to perform a weighted average on the sample features of the example set to obtain weighted category anchors, and integrate the weighted category anchors with the structured category anchors for fine-tuning; S40 introduces a dynamic memory bank and an uncertainty perception mechanism to quantify the uncertainty of category anchors and integrate them with historical knowledge to obtain enhanced category anchors; The quantification and knowledge integration of category anchor uncertainty includes: Calculate the variance of the cosine similarity between each category anchor point and the corresponding example set sample features, and use it as the uncertainty score of the current category anchor point; Based on cosine similarity, retrieve multiple historical category anchors most relevant to the current category anchor from the dynamic memory; The weights are dynamically adjusted based on the uncertainty score, and the current category anchor is integrated with the retrieved historical category anchors to form an enhanced category anchor. S50 calculates the classification loss based on the cosine similarity between the target set samples and the enhanced category anchors, and obtains the final medical image pathology detection model through model parameter updates.
2. The method for training a medical image pathology detection model based on few-shot learning according to claim 1, characterized in that, In step S10, the example set for each segment samples A image categories, and B random labeled samples are sampled under each category; The target set consists of several unlabeled samples from the same A image categories, used to evaluate the model's classification performance on the current segment.
3. The method for training a medical image pathology detection model based on few-shot learning according to claim 1, characterized in that, The shared feature encoder maps the input raw image pixel data to a low-dimensional embedding space, generating the corresponding feature vector representation.
4. The method for training a medical image pathology detection model based on few-shot learning according to claim 1, characterized in that, In step S50, the cosine similarity between the target set sample features and each enhanced category anchor point is calculated, converted into a probability distribution by the Softmax function, and the loss value is calculated using the cross-entropy loss function.
5. The method for training a medical image pathology detection model based on few-shot learning according to claim 1, characterized in that, An error backpropagation mechanism based on SGD optimization strategy is adopted to drive the feature extractor, graph neural network and meta-attention component to achieve end-to-end parameter adaptation.
Citation Information
Patent Citations
Electronic signature verification method, system and device based on graph convolutional neural network and medium
CN115984975A
Medical event recognition method and system under small sample weak labeling condition
WO2023071530A1