Medical image pathology detection model training method based on few-sample learning
By introducing graph structure relationship modeling and meta-attention mechanism into the medical image pathology detection model, the problem of insufficient model performance caused by scarce labeled data is solved, and more accurate medical image pathology feature recognition and stable diagnostic tools are realized.
Patent Information
- Application Number
- CN202610071784.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-20
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2046-01-20
AI Technical Summary
Existing technologies in medical image analysis suffer from problems such as scarce labeled data, domain differences, sensitivity to noise in class anchor representations, and insufficient inter-class discriminativeness in transfer learning and metric learning methods. These issues make it difficult for models to accurately identify pathological features in medical images under conditions of few samples.
Employing a meta-learning paradigm, this approach combines graph structure relationship modeling, meta-attention-driven weight allocation, and cross-segment knowledge integration mechanisms. By sharing deep convolutional neural networks, graph neural networks, and dynamic memory banks, it generates structured category anchors and performs adaptive weight allocation, quantifying uncertainty and improving the discriminativeness and robustness of category anchors.
It significantly improves the classification accuracy and robustness of medical image pathology detection models under conditions with few samples, enhances the model's generalization ability in cross-fragment scenarios, and is suitable for clinical environments with data noise.
Smart Images

Figure CN121544970A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of image recognition, and particularly relates to a medical image pathological detection model training method based on few-shot learning. BACKGROUND
[0002] In the field of medical image analysis, few-shot learning is gradually becoming a research hotspot, especially in the scenarios of disease feature recognition and pathological detection. Due to the scarcity of professional annotation data and the high cost of acquisition, traditional deep learning models are often difficult to be directly applied.
[0003] Few-shot medical image classification aims to train a model using a very small number of labeled samples, so that the model can accurately identify new categories of medical images, such as histopathological sections, dermoscopy images or optical coherence tomography images. To overcome the bottleneck of scarce labeled data, researchers have proposed various technical ideas. Among them, the pre-trained model based on transfer learning and the prototype network based on metric learning are two representative technical routes, and their training methods have their own characteristics.
[0004] For the pre-trained model based on transfer learning scheme, its shortcomings mainly reflect the superimposed effect of domain difference and data scarcity. First, this method faces a serious information bottleneck. The feature space learned by the pre-trained model on natural images has essential differences with the semantic and texture features of medical images, such as the object contour, color distribution in natural images and the cell structure, lesion area features in medical images do not directly correspond. This domain difference leads to the need for a large amount of labeled data to complete feature adaptation in the fine-tuning stage, but under the condition of few samples, the labeled data is absolutely scarce, which cannot support complex feature mapping learning, so that the model is difficult to capture the essential features of the medical field, and the generalization ability is greatly reduced. Second, this method has shortcomings in the modeling of inter-class discrimination. The feature space initialized by the pre-trained model is more suitable for natural objects with obvious differences between classes, while medical image classes are often highly similar in vision, such as different subtypes of cancer cells or early lesions and normal tissues, and their subtle differences need highly specialized feature representation to distinguish. The transfer learning scheme lacks an optimization mechanism for fine-grained classification of medical images, resulting in blurred classification boundaries and affecting diagnostic accuracy.
[0005] For the prototype network scheme based on metric learning, its defects are rooted in the inherent limitations of class anchor construction and metric mechanism, and its training process cannot effectively solve these problems. The first problem is that the class anchor representation is highly sensitive to noise and outliers. The class anchor calculation uses a simple arithmetic average method, which means that each sample in the example set contributes equally to the class anchor, including possible imaging artifacts, labeling errors, or atypical cases. In medical images, noise and outliers are common, such as motion artifacts in CT scans or uneven staining in pathological sections. A single abnormal sample can significantly distort the position of the class anchor vector and destroy its representativeness. Secondly, this scheme is also weak in inter-class discriminant modeling. The classification decision only relies on the relative distance between the query sample and the class anchor, and lacks explicit optimization of the global structure of the embedding space. When different classes of medical images are highly similar in vision, such as different stages of diabetic retinopathy, a simple distance metric cannot learn a highly discriminative decision boundary. In addition, the design of the prototype network is fragmented, with each fragment being processed independently, and the training process cannot accumulate and reuse knowledge from historical fragments, which further exacerbates the information bottleneck problem caused by the absolute scarcity of samples, limiting the applicability of the model in continuous learning scenarios. SUMMARY
[0006] To solve the above problems, the present application proposes a medical image pathology detection model training method based on few-shot learning, which systematically integrates graph structure relationship modeling, meta-attention driven weight allocation, and cross-fragment knowledge integration mechanism into a unified meta-learning training framework, significantly improving the discriminability, robustness of the learned class anchor representation under a small number of labeled samples, and the generalization ability of the model to new fragments, thereby achieving more accurate identification of medical image pathology features.
[0007] To achieve the above purpose, the technical scheme adopted by the present application is outlined as follows: a medical image pathology detection model training method based on few-shot learning, comprising the steps of: S10, using a meta-learning paradigm, a large number of few-shot training fragments are constructed from a data set containing multi-class labeled images through random sampling, each fragment simulates a real few-shot classification scenario and contains an example set and a target set; S20, a shared deep convolutional neural network is constructed as a feature encoder to uniformly extract the features of the example set and the target set medical images in each fragment; S30, for the example set of each class in the current fragment, a structured class anchor is generated using a graph neural network, and a weight adaptive allocation is performed on the example set samples based on a meta-attention mechanism, thereby obtaining the final representation of each class anchor; S40, introducing a dynamic memory bank and an uncertainty perception mechanism, quantifying the uncertainty of the category anchor point, and integrating with historical knowledge to obtain an enhanced category anchor point; S50, calculating a classification loss based on the cosine similarity between the target set samples and the enhanced category anchor point, and obtaining a final medical image pathology detection model through model parameter updating.
[0008] Further, in the step S10, A image categories are sampled for each segment example set, and B random labeled samples are respectively sampled under each category; The target set is composed of a plurality of unlabeled samples from the same A image categories, which is used to evaluate the classification performance of the model on the current segment.
[0009] Further, the shared feature encoder maps the input original image pixel data to a low-dimensional embedding space to generate corresponding feature vector representations.
[0010] Further, in the S30 step, for each category in the current segment example set, the structured category anchor point generation process includes the following steps: S311, regarding the feature vectors of all example set samples of the same category as graph nodes, constructing edges according to the cosine similarity or k-nearest neighbor relationship between nodes to form a relationship graph of the current category sample; S312, inputting the relationship graph into a shallow graph convolutional network, and updating the features of each node by aggregating the information of its neighbor nodes through the message passing mechanism of graph convolution; S313, performing average pooling operation on all updated node features to obtain a vector as the structured category anchor point of the category.
[0011] Further, the example set sample weight adaptive allocation based on the meta-attention mechanism includes the following steps: S321, inputting the example set sample features into a meta-attention module composed of a lightweight feedforward neural network, and outputting the attention weight of each sample by the meta-attention module based on the sample features and intra-class relationships; S322, using the obtained weight to weight average the example set sample features to obtain a weighted category anchor point, and integrating the weighted category anchor point with the structured category anchor point for fine-tuning.
[0012] Further, in the S40 step, the dynamic memory bank and the uncertainty perception mechanism are introduced to quantify the uncertainty of the category anchor point and integrate with historical knowledge, including the following steps: Calculate the variance of the cosine similarity between each category anchor point and the corresponding example set sample features as the uncertainty score of the current category anchor point; retrieving a plurality of historical class anchor points most relevant to the current class anchor point from the dynamic memory based on cosine similarity; According to the uncertainty score, the weight is dynamically adjusted, and the current class anchor point is integrated with the retrieved historical class anchor point to form an enhanced class anchor point.
[0013] Further, in step S50, the cosine similarity between the target set sample feature and each enhanced class anchor point is calculated, converted into a probability distribution through a Softmax function, and the loss value is calculated using a cross-entropy loss function.
[0014] Further, an error back propagation mechanism based on an SGD optimization strategy is used to drive the feature extractor, the graph neural network and the meta-attention component to realize end-to-end parameter adaptation.
[0015] The beneficial effects of using the technical solution are: (1) Significantly improve the discriminability of the learned class anchor points of the classifier: By introducing a graph neural network to model the relationship of the sample set in the training, the generated structured class anchor points can capture more complex distribution characteristics within the class, surpassing the representation ability of simple arithmetic average. This enables the classifier to learn to place the class anchor points closer to the true class center in the embedding space, especially when dealing with medical images with diverse visual features and large intra-class differences, it can more accurately depict the nature of the class and make more accurate classification decisions.
[0016] (2) Suppress noise at the source and enhance the intrinsic robustness of the classifier: The meta-attention mechanism is integrated into the training process, which enables the classifier to automatically learn to identify and reduce the weight of low-quality, low-representative samples (such as imaging artifacts and abnormal labeled samples) in the calculation of class anchor points, thereby suppressing the propagation of noise from the source. Compared with strategies that rely on subsequent filtering or expansion, the training method of the present invention achieves noise reduction in the first stage of class anchor point generation, making the final trained classifier more tolerant to fluctuations in the quality of the sample set data and more suitable for real clinical environments with noisy data.
[0017] (3) Optimize the training process and effectively utilize the relationship between samples: The application of graph neural networks means that the contribution of the class anchor points of each sample in the training is no longer independent, but is linked through the graph structure. This means that even if a sample has sparse information, it can be supplemented and enhanced through the information of its neighbor samples in the training. This implicit information exchange to some extent alleviates the problem of insufficient information caused by absolute scarcity of samples, improves the utilization efficiency of limited data in the training process, and accelerates the model convergence.
[0018] (4) Enhance the generalization and adaptability of the classifier in the cross-fragment scene: The dynamic memory bank and the uncertainty perception integration mechanism constructed by the application are integrated in the training framework, so that the classifier has the ability to accumulate and reuse experience during the training process. Combined with higher quality class anchor point generation, the trained model can adapt more quickly and stably to the training task of a new fragment, providing a solid technical foundation for long-term deployment and application in a continuously changing clinical environment.
[0019] In summary, the application designs a collaborative training framework that integrates class anchor point generation, attention weight allocation, and cross-fragment knowledge integration. This not only effectively solves the inherent defects of traditional few-shot learning methods, such as sensitivity to noise, neglect of sample association, and fragment isolation, but also aims to train an intelligent system that can continuously learn and evolve. The application provides a practical technical solution and guarantee for building a highly reliable and usable intelligent diagnostic tool in the medical image analysis scene where labeled data is severely scarce. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 A schematic diagram of a medical image pathology detection model training method based on few-shot learning according to an embodiment of the application; Figure 2 A sample set sample weight allocation flowchart based on a meta-attention mechanism in an embodiment of the application; Figure 3 A working principle diagram of a dynamic memory bank in an embodiment of the application. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical scheme and advantages of the application clearer, the application will be further described below with reference to the drawings.
[0022] In this embodiment, referring to FIG. 1, the application proposes a medical image pathology detection model training method based on few-shot learning, including the following steps: Figure 1 S10, using a meta-learning paradigm, constructing a large number of few-shot training fragments from a data set containing multiple class-labeled images through random sampling, each fragment simulating a real few-shot classification scene and containing an example set and a target set.
[0023] Specifically, from a large number of class-labeled medical image total data sets (such as histopathology slice libraries), A image classes are randomly selected, B labeled samples are randomly selected from each class to form an example set, and another batch of samples from the same A classes is selected to form a target set. This forms a learning fragment. By repeating this random sampling process a large number of times, a fragment distribution for training is constructed.
[0024] 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.
[0025] 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.
[0026] 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.
[0027] 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.
[0028] Including the following steps: 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; 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. 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. ; 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. ; S322, By using these weights to perform a weighted average of the example sample features, the attention-weighted category anchor points can be obtained. ; 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.
[0029] 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.
[0030] The specific steps include: 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. 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. ; 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. S50, classification loss calculation and model update, to obtain a medical image pathology detection model.
[0031] The specific steps include: 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; 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. 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.
[0032] 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. 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.
[0033] 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.
[0034] 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.
[0035] 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.
[0036] 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 method for training a medical image pathology detection model based on few-shot learning, characterized in that, The method comprises the steps of: S10, using a meta-learning paradigm, constructing a large number of few-shot training segments from a data set containing multi-class labeled images by random sampling, each segment simulating a real few-shot classification scenario and containing an example set and a target set; S20, constructing a shared deep convolutional neural network as a feature encoder for uniformly extracting features of medical images in the example set and the target set in each segment; S30, for the example set of each class in the current segment, generating a structured class anchor point using a graph neural network, and adaptively assigning weights to the example set samples based on a meta-attention mechanism to obtain the final representation of the class anchor point; S40, introducing a dynamic memory bank and an uncertainty perception mechanism to quantify the uncertainty of the class anchor point and integrate it with historical knowledge to obtain an enhanced class anchor point; S50, calculating a classification loss based on the cosine similarity between the target set samples and the enhanced class anchor points, and obtaining a final medical image pathology detection model through model parameter updating.
2. The medical image pathology detection model training method based on few-shot learning according to claim 1, characterized in that, In the step S10, the example set of each segment samples A image categories, and B random labeled samples are sampled under each category; The target set is composed of a plurality of unlabeled samples from the same A image categories, and is used to evaluate the classification performance of the model on the current segment.
3. The medical image pathology detection model training method based on few-shot learning according to claim 1, characterized in that, The shared feature encoder maps the input original image pixel data to a low-dimensional embedding space to generate corresponding feature vector representations.
4. The medical image pathology detection model training method based on few-shot learning according to claim 1, characterized in that, The generation of the structured class anchor point in the step S30 comprises: S311, regarding the feature vectors of all example set samples of the same category as graph nodes, constructing edges according to the cosine similarity or k-nearest neighbor relationship between the nodes to form a relationship graph of the current category samples; S312, inputting the relationship graph into a shallow graph convolutional network, and updating the features of each node by aggregating the information of its neighbor nodes through the message passing mechanism of graph convolution; S313, performing average pooling on all updated node features to obtain a vector as the structured class anchor point of the category.
5. The medical image pathology detection model training method based on few-shot learning according to claim 4, characterized in that, The adaptive weight assignment of the example set samples based on the meta-attention mechanism comprises the steps of: S321, inputting the sample features of the example set into a meta-attention module composed of a lightweight feedforward neural network, and outputting the attention weight of each sample by the meta-attention module based on the sample features and the intra-class relationship; S322, performing weighted averaging on the sample features of the example set using the obtained weight to obtain a weighted class anchor point, and integrating the weighted class anchor point with the structured class anchor point for fine-tuning.
6. The medical image pathology detection model training method based on few-shot learning according to claim 1, characterized in that, The quantification of the uncertainty of the class anchor point and the knowledge integration in the step S40 comprise: calculating the variance of the cosine similarity between each class anchor point and the corresponding example set sample features as the uncertainty score of the current class anchor point; based on the cosine similarity, retrieving a plurality of historical class anchor points most relevant to the current class anchor point from the dynamic memory bank; according to the uncertainty score, dynamically adjusting the weight, and integrating the current class anchor point with the retrieved historical class anchor points to form an enhanced class anchor point.
7. The medical image pathology detection model training method based on few-shot learning according to claim 1, characterized in that, In step S50, the cosine similarity between the sample features of the target set and each enhanced class anchor point is calculated, converted into a probability distribution by a Softmax function, and the loss value is calculated using a cross-entropy loss function.
8. The medical image pathology detection model training method based on few-shot learning according to claim 1, characterized in that, An error back propagation mechanism based on an SGD optimization strategy is used to drive the feature extractor, the graph neural network and the meta-attention component to realize 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
Data migration method based on knowledge graph and few-sample learning
CN117391128A
Small sample image classification method based on metric element learning
CN118038167A
Medical event recognition method and system under small sample weak labeling condition
WO2023071530A1
Method for constructing cross-attention mechanism-based fracture image fine recognition network
WO2023151199A1