Pneumonia prediction chest ct image meta-learning model training method

By optimizing the closed loop of dynamic difficulty scoring, gradient sensitivity masking, and confidence feedback signal, the problem of high-precision prediction in scenarios with imbalanced CT image data of pathogenic bacteria is solved, and high-precision prediction and confidence calibration are achieved under the condition of a small number of rare bacterial samples.

CN122391785APending Publication Date: 2026-07-14THE FIRST AFFILIATED HOSPITAL OF BENGBU MEDICAL COLLEGE

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
THE FIRST AFFILIATED HOSPITAL OF BENGBU MEDICAL COLLEGE
Filing Date
2026-05-12
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In scenarios with imbalanced CT image data of pathogenic bacteria, existing technologies struggle to achieve high-precision predictions using only a small number of rare bacterial samples, and the model training process suffers from redundant channel interference and confidence bias.

Method used

By constructing a dynamic difficulty scoring mechanism, a gradient-sensitive dynamic soft mask, and a prediction confidence feedback signal, a closed-loop optimization mechanism is formed to automatically adjust the sampling weights and channel selection of training tasks, thereby improving the model's adaptability and confidence calibration under conditions of minimal support sets.

Benefits of technology

The model achieves high-precision prediction of pathogenic bacteria with a small number of samples, even when there is abundant data on common bacteria and scarce data on rare bacteria. This improves the model's adaptability accuracy and the reliability of prediction results under extremely small support sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391785A_ABST
    Figure CN122391785A_ABST
Patent Text Reader

Abstract

The application discloses a chest CT image meta-learning model training method for pathogenic bacteria prediction, and relates to the technical field of deep learning. The method samples and constructs multiple meta-learning tasks from a labeled CT image data set through dynamic difficulty scoring, obtains gradient sensitivity scores by calculating the direction consistency of each channel loss gradient of the support set, generates a dynamic soft mask, and executes inner loop adaptation and outer loop meta update after weighting the gradient using the dynamic soft mask; meanwhile, the proportion of overconfident errors and insufficient confidence correct samples in the query set is counted and queried to generate a closed-loop feedback signal to dynamically adjust the task difficulty and the dynamic soft mask, and the cycle is iterated until convergence to output the target meta parameter. The application trains an initial model on a large amount of common pathogenic bacteria data through meta-learning, and trains a meta-learning model that can achieve high-precision prediction with only a small amount of samples, effectively solving the problem of high-precision prediction with few samples under the condition of extremely scarce CT images of rare pathogenic bacteria.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This invention relates to the field of deep learning technology, specifically to a method for training a meta-learning model of chest CT images for predicting pathogenic bacteria. Background Technology

[0002] Pulmonary infectious diseases are among the most common severe illnesses in clinical practice, and accurate identification of pathogens is crucial for developing appropriate medication regimens. Chest CT imaging, due to its non-invasive nature and rich morphological information of lesions, is widely used in the auxiliary diagnosis of pulmonary infections. However, different pathogens often exhibit similar lesion characteristics on CT images (such as ground-glass opacities, consolidation, and nodular distribution). The accuracy of relying solely on manual image interpretation for bacterial identification is affected by various factors, including physician experience and image reading conditions, and in some scenarios, it cannot fully meet the needs of rapid clinical auxiliary diagnosis. Therefore, exploring the use of deep learning models to automatically predict the types of pathogens in chest CT images is of great significance.

[0003] Meta-learning is a training framework designed to enable models to "learn how to learn." Its core idea is to train the model on a large number of auxiliary tasks, allowing it to acquire meta-initialization parameters that can quickly adapt to new tasks. This enables the model to achieve good performance on new tasks with only a small number of samples. In a meta-learning framework, each training task typically includes a support set and a query set: the support set is used for rapid adaptation in the inner loop, and the query set is used for updating meta-parameters in the outer loop. This mechanism gives meta-learning a natural ability to handle scenarios with few samples, and it has been researched and applied to some extent in fields such as image classification and natural language processing.

[0004] Introducing meta-learning into the field of pathogenic bacteria CT image prediction can achieve better prediction performance with a small number of rare bacteria labeled samples. However, during the meta-learning training process, how to effectively construct training tasks, how to improve the specificity of the inner loop adaptation, and how to ensure the reasonableness of the model output confidence significantly affect the quality and reliability of the final meta-parameters, which are urgent problems to be solved.

[0005] Therefore, a meta-learning model training method is needed that can systematically learn rapid learning capabilities on abundant data of common bacteria in order to solve the above-mentioned technical problems. Summary of the Invention

[0006] To address the problems existing in current technologies, the purpose of this invention is to train a meta-learning model capable of high-precision pathogen prediction using only a small number of rare bacteria samples in a highly imbalanced scenario where CT image data of common pathogens is abundant and data on rare pathogens is extremely scarce. This invention provides a method for training a meta-learning model based on chest CT images for pathogen prediction.

[0007] To achieve the above objectives, the technical solution of the present invention is as follows:

[0008] This application discloses a method for training a meta-learning model of chest CT images for predicting pathogenic bacteria, including the following steps:

[0009] S1. Obtain a chest CT image dataset containing various types of pathogens with real labels and a model to be trained. Initialize the initial meta-parameters of the model to be trained and the dynamic difficulty score corresponding to each meta-learning task. Based on the dynamic difficulty score, sample from the image dataset to construct multiple meta-learning tasks containing support sets and query sets.

[0010] S2. For each meta-learning task, calculate the loss gradient of the model to be trained on each feature channel based on the support set; extract the directional consistency of the loss gradient among each sample in the support set to calculate the gradient sensitivity score, and generate a dynamic soft mask accordingly.

[0011] S3. The loss gradient is weighted using the dynamic soft mask, and the initial meta-parameters are updated based on the weighted loss gradient to obtain task adaptation parameters; the query set is forward-propagated using the task adaptation parameters to obtain the predicted category, prediction confidence, and query loss; the proportion of samples with prediction confidence greater than a first preset threshold and prediction category inconsistent with the true label, and the proportion of samples with prediction confidence less than a second preset threshold and prediction category consistent with the true label are statistically analyzed, and a closed-loop feedback signal is generated based on the two sample proportions;

[0012] S4. Based on the query loss, perform meta-update on the initial meta-parameters, and dynamically adjust the dynamic difficulty score and the dynamic soft mask according to the closed-loop feedback signal; repeat steps S1 to S4 until the preset convergence condition is met, and output the target meta-parameters.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0014] 1. This invention maintains a dynamic difficulty score for each meta-learning task and generates a weighted sampling probability based on this score, enabling the training process to automatically increase its focus on high-difficulty and highly confusing tasks. Compared to a uniform sampling strategy, this mechanism allows the model to encounter more tasks valuable for improving fine-grained classification capabilities within the same training epochs, thereby improving the utilization efficiency of meta-training resources;

[0015] 2. This invention introduces a gradient sensitivity score based on the directional consistency of the loss gradient among support set samples during the inner loop parameter update, and generates a differentiable dynamic soft mask to weight the loss gradient accordingly. This mechanism enables the parameter adaptation process of each meta-learning task to focus on the feature channels most discriminative to the current task, effectively suppressing the interference of redundant channels on the inner loop adaptation, and improving the accuracy of the inner loop adaptation under the condition of a very small support set;

[0016] 3. This invention quantifies the proportions of two types of samples—overconfident errors (high-confidence misclassifications) and underconfident correct classifications (low-confidence correct classifications)—by jointly statistically analyzing predicted confidence and true labels. This proportion is then transformed into a structured closed-loop feedback signal, which is applied in real-time to adjust the dynamic difficulty score and dynamic soft mask. This mechanism enables proactive detection and correction of confidence bias during meta-training, helping to output target meta-parameters with better predictive confidence calibration and improving the reliability and practical value of the model's prediction results.

[0017] 4. This invention combines task construction, dynamic soft mask generation, feedback signal generation, and confidence feedback dynamic adjustment. The four elements promote each other in the iterative process: the feedback signal adjusts both the task sampling difficulty (affecting the distribution of training data in the next round) and the mask parameters (affecting dynamic soft mask generation), so that the overall training process forms a self-consistent adaptive optimization closed loop. Attached Figure Description

[0018] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts. Wherein:

[0019] Figure 1 This is a schematic diagram of the overall technical framework of the present invention;

[0020] Figure 2 This is a schematic diagram of the overall process of the present invention;

[0021] Figure 3 This is a schematic diagram of dynamic mask generation;

[0022] Figure 4 This is a schematic diagram of the feedback mechanism. Detailed Implementation

[0023] It is readily understood that, based on the technical solution of this invention, those skilled in the art can propose various interchangeable structural methods and implementations without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of this invention.

[0024] In existing meta-learning frameworks, training task sampling typically employs random uniform strategies or relatively simple fixed-probability methods. However, some pathogenic bacteria combinations exhibit high morphological similarity, making identification significantly more difficult than other combinations, resulting in unequal training value across different tasks. If an equal sampling strategy is applied to all training tasks, the model suffers from insufficient training exposure on highly confusing combinations, failing to adequately learn fine-grained discrimination capabilities. Therefore, a mechanism is needed to dynamically adjust the sampling weights of each task based on training feedback, adaptively tilting training resources towards more challenging tasks. Furthermore, when support samples are scarce, not all channels in the feature network possess discriminative value for the current task, and gradient noise introduced by redundant channels interferes with rapid parameter adaptation. This necessitates a channel-level filtering mechanism based on the gradient information of the current task, automatically focusing the adaptation process on features truly discriminative for the current task and suppressing interference from redundant channels. Additionally, the tilt of task sampling and the tightness of channel filtering both require continuous adjustment, but relying solely on classification loss or accuracy cannot capture two types of hidden confidence biases—the model making incorrect predictions with high confidence, or correctly predicting with low confidence. The former indicates insufficient training difficulty and inadequate screening; the latter indicates over-screening and suppression of useful information. Therefore, it is necessary to extract structured feedback signals from the model's prediction confidence to drive the targeted adjustment of the task sampling strategy and channel screening parameters, respectively.

[0025] This invention forms a complete closed loop through the above process: the feedback signal simultaneously adjusts the task sampling strategy and channel selection parameters, a new round of training generates new prediction behaviors and generates feedback again, and the loop iterates until convergence. The final output meta-initialization parameters can achieve high-precision prediction of rare pathogens with only a small number of samples. The overall scheme does not depend on a specific image modality or a specific category system.

[0026] After introducing the basic concept of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0027] Specifically, this embodiment provides a method for training a meta-learning model for predicting pathogenic bacteria in chest CT images. This method consists of four steps: meta-learning task construction (step S1), gradient-sensitive dynamic soft mask generation (step S2), mask weighted adaptation and feedback signal generation (step S3), and meta-parameter update and feedback-driven dynamic adjustment (step S4). It forms two explicit feedback closed-loop paths and performs meta-learning training on a large amount of common pathogenic bacteria data to obtain a meta-learning model that can achieve high-precision prediction with only a small number of samples.

[0028] like Figure 1 As shown, a method for training a meta-learning model of chest CT images for pathogen prediction is introduced, including:

[0029] S1. Obtain a chest CT image dataset containing various types of pathogens with real labels and a model to be trained. Initialize the initial meta-parameters of the model to be trained and the dynamic difficulty score corresponding to each meta-learning task. Based on the dynamic difficulty score, sample from the image dataset to construct multiple meta-learning tasks containing support sets and query sets.

[0030] First, constructing the meta-learning task requires obtaining the image dataset for the training task. In this embodiment, the image dataset can be retrieved from the hospital image archiving and communication system (PACS) showing chest CT images of hospitalized patients with identified pathogens through microbial culture, sputum smear, or molecular diagnosis, using the laboratory diagnosis results as the true labels. This is the preferred method, as it offers the highest label reliability.

[0031] Alternatively, multi-center data can be combined. When the sample size of a single center is insufficient, imaging data from multiple medical institutions can be combined and integrated through data sharing protocols or federated learning frameworks to expand the sample size of scarce categories to meet the requirement of no less than 50 cases per category.

[0032] In addition, publicly available medical imaging databases can be used as supplementary sources, such as publicly available CT annotated datasets related to lung infections. The selected datasets should have clear pathogenic bacteria category annotations.

[0033] Next, after acquiring the image dataset, the model to be trained needs to be configured and initialized. This model consists of a feature extraction network (parameters...). ) and classification head (parameters) This is the structure. The inner loop adaptation only updates... The outer loop element is updated synchronously. and .

[0034] The feature extraction network adopts the ResNet architecture (mainly ResNet-12 in this embodiment), consisting of four residual blocks stacked sequentially. The number of output channels for each block is {64, 128, 256, 512}, respectively. Global average pooling is applied at the end. Determined by the network structure; dynamic soft masks are generated independently for each layer channel, and the classification head consists of a linear layer. Indicates the number of floors. =1, ..., L, in this embodiment L=4.

[0035] Two initialization methods are supported: ImageNet pre-trained weight transfer is preferred; when the distribution of CT images differs significantly from that of natural images, random initialization can be used followed by a round of supervised pre-training on all common bacteria data. Uniform initialization using Xavier is adopted.

[0036] Let the feature extraction network parameters be... The classification header parameters are Loss function Using cross-entropy loss on the support set, For the cross-entropy loss on the query set, To support the cross-entropy loss on rare bacteria samples, the three methods are consistent, all calculated using the log probability of the normalized confidence output. In this embodiment, the inner loop learning rate... outer loop learning rate , usually satisfy .

[0037] After configuring and initializing the model to be trained, a basic task needs to be built. Within this task, each task... Includes support set and query set Supports random sampling from a pool of bacterial strains. Each category is extracted. CT image samples ( Take 3 to 5), number of task categories 2. This is a necessary prerequisite for meta-learning few-shot classification; it is recommended to adopt [the following approach] in practice. [3,10]; The query set comes from the same Several additional samples were drawn from each category for evaluation. The database should contain at least 10 common pathogenic bacteria categories, with no fewer than 50 annotated CT images for each category; CT images were acquired using standard lung window (slice thickness ≤ 1.5 mm, reconstruction algorithm of standard or soft tissue nucleus), and images from different equipment sources need to undergo normalization preprocessing to eliminate systematic differences between equipment.

[0038] like Figure 2 As shown, after constructing the basic tasks, it is necessary to maintain a dynamic difficulty score for the tasks and sample probabilities. Specifically, a dynamic difficulty score is maintained for each constructable task. It is initialized to a positive uniformity constant (1.0 in this embodiment). This score determines the probability of each task being sampled:

[0039] ,in, Iterate through all buildable tasks. For temperature coefficient (in this embodiment, it is taken as...) The dynamic difficulty score is dynamically updated by the feedback signal from the confidence-calibrated dual-threshold assessment and feedback step (see step S4).

[0040] Next, it is necessary to construct a confusion class pair enhancement policy and compute the distance matrix, specifically, before and after training begins, every [number of times]. Rounds, based on the meta-parameters of the current feature extraction network. Calculate the feature cosine distance matrix among all common bacterial species. Before meta-training, the feature extraction network is initialized using weights pre-trained on ImageNet or randomly initialized and then subjected to supervised pre-training on all common bacterial datasets before the first calculation of the distance matrix. This ensures that the initial feature extraction has sufficient semantic expressive power, making the initial construction of the distance matrix statistically meaningful. The final layer (the first layer) is extracted from all training samples for each bacterial species. After batch normalization and before soft masking, the global average pooling features are used to obtain the average value of the feature vectors of all samples of the same class. prototype vector The cosine distance between the prototype vectors of the two classes is used as the inter-class distance, and the specific formula is as follows:

[0041] ;

[0042] in, , Let represent the prototype vectors of category a and category b, respectively. Here, "before masking" refers to the features after batch normalization and before the application of the soft mask, ensuring that the distance matrix calculation does not depend on the task-specific mask and has cross-task comparability. During training, every E rounds, when updating the distance matrix, the overlap rate between the culprit category pair identified by feedback path one in this period and the current confused category pair set is simultaneously calculated. If, within two consecutive update periods, more than 50% of the category pairs in the culprit category pair are not in the current confused category pair set (i.e., the coverage of the confused category pair set is less than 50%), it is determined that the distance matrix update is lagging. At this time, the distance matrix is ​​recalculated using the masked features weighted by the average of the masks for each task, where the average of the masks for each task is used. The calculation method is as follows: ,in For the first Layered tasks The generated complete channel mask vector.

[0043] Distance below the threshold The bacterial species pairs are labeled as confusing category pairs. During task construction, these confusing category pairs are combined into the same task with a higher probability, forcing the model to learn to distinguish fine-grained differences. Specifically, during the extraction of N categories in each task, the samples are first grouped into the same category with a preset probability. (In this embodiment, we take 0.5) We force the selection of at least one pair of categories from the current set of confused category pairs to be included in the category set of this task, and the remaining categories are randomly supplemented from the category pool to N; when the set of confused category pairs is empty, it degenerates into pure random category extraction. To obfuscate the category pairs, the third preset threshold is set with a cosine distance range of [0,2]. This embodiment initially sets... (That is, when the cosine similarity of the prototype vectors of two categories is higher than 0.7, they are marked as confused pairs); the size can be adjusted according to the initial set size of confused category pairs, and it is recommended to cover 10% to 30% of all category pairs. The confused category pair enhancement strategy and task difficulty score sampling are applied to different stages of task construction. The confused category pair enhancement strategy determines the category composition within a single task (category-level operation), and the task difficulty score sampling determines which constructed tasks are included in the current batch (task-level operation). Specifically, a candidate task pool is first generated according to the confused category pair enhancement strategy, and then batch B is formed by sampling from the candidate task pool according to the sampling probability of the task difficulty score. Since both the support set and the query set are composed of image samples of the selected N categories, the above operation of forcibly including confused category pairs in the category selection stage is equivalent to ensuring that image data containing confused category pairs are sampled into the support set and the query set.

[0044] In this embodiment, the count variable for one round of meta-training is t, defined as follows: sampling a batch B (containing several tasks) from the task pool, completing the inner loop adaptation and one outer loop meta-update for all tasks, calculating and updating all smoothing metrics, executing feedback actions, and finally performing the global decay operation at the end of this round. "One round" is equivalent to "the complete processing of one batch".

[0045] Next, the set of confused category pairs needs to be dynamically updated. Specifically, every fixed number of training rounds... Using the current meta-parameters Recalculate the cosine distance matrix between categories, and fuse the information of highly confused category pairs found in the feedback path of S4 with the feature distance, defining the fused distance as:

[0046] ;

[0047] in The equivalent compact expression for the time-decaying exponential moving average frequency of this category pair as the culprit category pair in OE is:

[0048] ;

[0049] in, To determine the culprits in this round, Indicates the global round. Indicates the previous round. This is an indicator function; it takes the value 1 when the condition within the square brackets is true, and 0 otherwise. (All...) Same meaning The attenuation coefficient is... It is always bounded to [0,1]; It is a hyperparameter that controls the maximum influence strength of OE evidence in this embodiment. That is, the fusion distance of high-frequency culprit category pairs is compressed to 50% of the original feature distance, which enhances the labeling probability of confused pairs while retaining the reference significance of the feature distance. The initial value is uniformly set to 0, indicating that there is no historical OE evidence at the start of training, and the fused distance degenerates into pure feature distance. This ensures that the initial set of confused category pairs is entirely determined by the feature space distance. The fusion distance is then used. The bacterial species pairs are marked as confusion category pairs, and the set of confusion category pairs is updated. For details on the actual splitting execution method (unconditional attenuation and positive signal superposition), please refer to step S4.

[0050] S2. For each meta-learning task, calculate the loss gradient of the model to be trained on each feature channel based on the support set; extract the directional consistency of the loss gradient among each sample in the support set to calculate the gradient sensitivity score, and generate a dynamic soft mask accordingly.

[0051] like Figure 3 As shown, when generating a gradient-sensitive dynamic soft mask, let the first... The number of channels in the layer is ( The value of ), is determined by the network structure. For standard ResNet, the number of output channels for each residual block is {64, 128, 256, 512}, etc. This represents the current batch of tasks. This refers to the number of tasks within the batch. (In the full text) A uniform representation of the small constant for numerical stability is used, with a fixed value. The meaning is the same wherever it appears.

[0052] First, calculate the channel-level gradient sensitivity score, specifically by... Defined as loss For the first Layer The gradient of the output feature map of each channel (after activation function) (i.e., the feature map after non-linear activation such as ReLU / GELU), the scalar obtained after global average pooling in the spatial dimension, is calculated through backpropagation to obtain a shape of... The gradient plot, and then... Taking the average of the values ​​at each spatial location yields a scalar. For the first All layers Each channel performs the above operations independently, forming a channel gradient vector. ; Support for complete set Each sample is executed independently, forming .in, To support sample indexing, activation value gradients are used instead of parameter gradients. The former directly measures the impact of the channel output on the loss, which is consistent with the semantics of the channel selection target and is more computationally efficient.

[0053] For all N×K samples in the support set, independently calculate the gradient of each layer and each channel, and calculate the cosine consistency weighted magnitude:

[0054] ;

[0055] in, Indicates gradient sensitivity score, For the mean gradient, and All support set sample indexes. Let represent the number of combinations, specifically the number of combinations of selecting two samples from the NK support set samples. Since... As a scalar, cosine similarity degenerates into sign consistency; when consistency is negative, the score is set to zero. This design... It exhibits good numerical stability with extremely small sample sizes of 3 to 5, and in the scalar case, the mean gradient... It is also a scalar, and its amplitude degenerates into an absolute value. .

[0056] Next, the dimensions of the gradient magnitude need to be normalized, and the specific formula is as follows: ;

[0057] All subsequent uses were normalized. (Normalized gradient sensitivity score), all temperature parameters are dimensionless and located in the (0,1) interval. It is a very small constant.

[0058] Boundary case: If all Then the mask degenerates into (Equal weight for all channels) is equivalent to not performing channel filtering in this layer within this task. This is a reasonable safety degradation behavior and does not affect the propagation of the outer loop gradient.

[0059] After normalizing the gradient sensitivity score, a dynamic soft mask is generated. Specifically, this is achieved by calculating the approximate differentiable median (soft reference value) of the normalized gradient sensitivity score. The specific formula is as follows: ;

[0060] in To fix the hyperparameters (in this embodiment, the range is (0.05, 0.2)), the soft median's approximation of the true median is controlled, and no adjustment is needed during training; Gradient sensitivity score after normalization The true median, introduced using the stop-gradient approach. This means blocking its gradient during backpropagation, preventing it from participating in gradient propagation. The gradient sensitivity scores are sorted in ascending order to obtain an ordered sequence, and then the values ​​are taken according to the standard statistical median rule. When it is an odd number: , ,in The sort index is the position at the exact center of the sequence. After sorting in ascending order, the first Small normalized gradient sensitivity score, i.e., the only median; when When it is even: , ,in The sorting index is the position slightly to the left of the middle of the sequence. and These are the first two numbers after being sorted in ascending order. Small and First The median is the arithmetic mean of the two middle adjacent values, which is the normalized gradient sensitivity score.

[0061] The dynamic soft mask is then calculated using the following formula: ;

[0062] in, Indicates the first Layer The soft mask scalar for the channel, Sig(·), specifically refers to the sigmoid function. Indicates the first The mask temperature parameters of each layer are independent dimensionless temperature parameters. This embodiment , Initialize to when the new layer is activated After the cold start is completed, the system is regulated by a feedback mechanism. Smaller masks produce sharper edges, while larger masks produce smoother edges. The temperature parameters of the Lth layer (the layer that is initially activated) are also initialized to... This ensures that all layers start from a smooth mask (nearly uniform distribution) when they begin participating in channel filtering, and are gradually adjusted to an appropriate level by the feedback mechanism.

[0063] remember For the first The complete mask vector of a layer is composed of scalar masks for each channel, as will be discussed later. Both represent channel-by-channel multiplication with the vector.

[0064] After generating the dynamic soft mask, feature normalization and classification head alignment are required. Specifically, during support set normalization (used for inner loop loss calculation), features are extracted using the current meta-parameters, expressed as follows: ,in, This represents the eigenvalue (scalar) after masking the c-th channel of the L-th layer. This represents the original output feature value of sample x in the c-th channel of the L-th layer (after batch normalization and before masking), using... Obtained through forward propagation;

[0065] During query set inference (used for outer loop loss calculation (step S4) and confidence assessment (step S3)), features are extracted using parameters adapted for the inner loop: ,in, This represents the original output feature value of sample x in the c-th channel of the L-th layer, using the task... Internal circulation adapted parameters Obtained through forward propagation;

[0066] The normalization formula is: ;in, This represents the normalized mask eigenvalues. The channel feature mean is the feature value obtained by masking all N×K samples in the support set at the Lth layer. (Using meta-parameters) Extraction) is obtained by taking the arithmetic mean of the sample dimensions. The standard deviation of the channel features is the feature value after masking all N×K samples in the support set at the Lth layer. and channel mean The unbiased standard deviation is calculated for each sample dimension, and this value is reused in the query set, calculated on the features after masking the support set. The query set is normalized using the support set statistics to avoid information leakage. The rationale for using the support set statistics to normalize the query set is that the support set and the query set come from the same task and the same class distribution, and the mean and variance of the support set features are representative of the query set features. If the query set's own statistics were used, the normalization process would implicitly contain prior knowledge of the query set label distribution, constituting information leakage. When K is small (e.g., K=3), the support set statistics estimation contains some noise, which is an inherent limitation of few-shot learning. Intra-task normalization is mainly used to stabilize the input distribution across tasks, rather than precise data whitening. A small amount of estimation noise does not affect its stabilizing effect, ensuring that the input distribution faced by the classification head maintains statistical consistency across tasks.

[0067] S3. The loss gradient is weighted using the dynamic soft mask, and the initial meta-parameters are updated based on the weighted loss gradient to obtain task adaptation parameters. The query set is forward-propagated using the task adaptation parameters to obtain the predicted category, prediction confidence, and query loss. The proportion of samples with prediction confidence greater than a first preset threshold and prediction category inconsistent with the true label, and the proportion of samples with prediction confidence less than a second preset threshold and prediction category consistent with the true label are statistically analyzed. A closed-loop feedback signal is generated based on the two sample proportions.

[0068] like Figure 4 As shown, this step includes mask weighted adaptation, query evaluation, and feedback signal generation. Specifically, an inner loop adaptation of the mask gradient is required first. The inner loop (task adaptation) is as follows: No adaptation is performed in the inner loop; only the feature extractor is updated. The formula is as follows:

[0069] This indicates a single-step inner loop adaptation, where... This represents the parameters of the feature extraction network. Gradient operator for partial derivatives Indicates loss about gradient vector, This represents the learning rate of the inner loop; in this embodiment, the inner loop is executable. step( ∈[1,5]), which means iteratively applying the above formula. Each step uses the latest Continuing to update. More steps result in better adaptation, but the computational cost of the second-order gradient increases linearly with the number of steps. This embodiment takes a step when computational resources are sufficient. =3, when resources are limited. =1 (i.e., first-order approximation).

[0070] Forward propagation compatible processing: Channel mask in forward inference for both support set and query set. The mask is applied to the output of the residual branch (after batch normalization and before being added to the skip connections). The skip connections themselves are not masked, preserving the gradient path of the identity mapping. If the skip connections involve dimensionality transformations (such as 1×1 convolution for dimensionality increase), the mask is applied only to the residual backbone branch, while the skip branches remain unchanged to avoid operational errors caused by dimensionality misalignment. The mask is applied after batch normalization to prevent zero values ​​from suppressed channels from contaminating the mean and variance statistics of batch normalization. For network variants that use layer normalization or group normalization instead of batch normalization, the compatibility principle remains unchanged, and the mask is still applied after the normalization layer. For Pre-Activation ResNet (where normalization and activation functions are before convolution), the mask is applied after the activation function and before being added to the skip connections, maintaining the same semantic position as standard ResNet.

[0071] Backpropagation gradient mask: In the inner loop parameter update, the same mask is applied to the parameter gradient to suppress parameter updates in low-sensitivity channels. The formula is as follows:

[0072] ,in, Indicates task The internal circulation adaptation parameters;

[0073] Both masks use the same The former controls feature propagation, while the latter controls parameter updates; together, they achieve channel-level filtering. The c-th channel mask scalar All associated parameters (i.e., all elements of the convolution kernel corresponding to that output channel and their corresponding biases) are broadcast to the c-th output channel. All parameters of each output channel are scaled using the same channel mask scalar. The entire operation is visible, and the gradients of the outer loop can propagate normally.

[0074] After the inner loop adaptation of the mask gradient, query set forward propagation and output prediction are required. Specifically, this is achieved using task adaptation parameters. For query set Perform forward propagation (described in query set inference during synchronous step S2 of the feature extraction process), output the probability distribution of each category via the classification head, and obtain the predicted category. Prediction confidence and query set cross-entropy loss .

[0075] Then, calculate the N-way normalized confidence score. Let... For the model to sample Prediction categories ( For category indexing, iterate through (categories) Label it with its true category.

[0076] The formula is as follows: ;

[0077] in This represents the original prediction confidence level. For the task Number of categories This represents the prediction confidence level. Constrained by step S1. denominator The formula is defined for all legal tasks. The normalized prediction confidence is mapped to [0,1], where 0 corresponds to random guessing and 1 corresponds to complete certainty.

[0078] After calculating the N-way normalized confidence score, it is necessary to calculate the batch-level overconfidence error rate and underconfidence accuracy rate. Specifically, this is done by setting threshold constraints. (This embodiment) , ), The middle band represents a reasonable confidence level; samples falling within this range do not trigger either the OE (Outcome Exception) or UC (Understand Confidence) determination.

[0079] Batch-level expected calibration error (ECE): using equal-frequency bins, number of bins (Using the floor function):

[0080] ;

[0081] in For the first A frequency-equal bucket For the accuracy rate within the bucket, This represents the average normalized confidence level within the bucket. Indicates sample The meta-learning task it belongs to, that is, from batch Of all the tasks, the sample The specific tasks derived from its query set;

[0082] The specific operation of equal-frequency binning is as follows: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] All task query set samples are sorted by normalized confidence from smallest to largest, and then evenly divided into... Divide the sample into buckets, ensuring that the number of samples in each bucket is as equal as possible (if the total number of samples cannot be divided by 1 / 2). If divisible, then each of the first few buckets contains one more sample. The accuracy and average confidence score within each bucket are calculated independently on the samples within that bucket.

[0083] The batch-level first error rate (referred to as the overconfidence error rate, abbreviated as OE) is expressed as follows:

[0084] ,in, The first preset threshold is 0.7 (in this embodiment, it is set to 0.7).

[0085] The formula for the first-round accuracy (represented as low-confidence accuracy, abbreviated as UC) is:

[0086] ,in, The second preset threshold is 0.2 in this embodiment.

[0087] Then, the feedback signal is smoothed. All three indicators are subjected to an exponential moving average using the same smoothing coefficient ρ. The specific formula is as follows:

[0088] , , ;

[0089] in, With channel stability attenuation coefficient satisfy: ,ensure This means that the smoothing window of the feedback signal is always longer than the update window of the channel stability, thus avoiding overreaction to normal fluctuations in channel screening. In this embodiment, the value range is [0.8, 0.95]. The above formula automatically determines the value of the property, where , These represent the first error rate and the first accuracy rate after smoothing, respectively.

[0090] S4. Based on the query loss, perform meta-update on the initial meta-parameters, and dynamically adjust the dynamic difficulty score and the dynamic soft mask according to the closed-loop feedback signal; repeat steps S1 to S4 until the preset convergence condition is met, and output the target meta-parameters.

[0091] First, in the dynamic adjustment driven by feedback and meta-parameter updates, an outer loop meta-update is required. Specifically, the outer loop (meta-update) consists of θ and... These are all meta-parameters, updated synchronously in the outer loop, expressed by the following formula:

[0092] , ,in Indicates the classification header parameters Gradient operator for partial derivatives This represents the sum of the losses of all task query sets with respect to... gradient vector, This represents the outer loop learning rate.

[0093] After the outer loop element is updated, double threshold judgment and mutual exclusion locking are required. This is done by calculating the deviation between the two paths, where... The first error rate is calculated based on the smoothed first error rate and is represented as the first difference. The second difference is calculated based on the smoothed first accuracy rate; both reflect the relative degree to which the corresponding indicator deviates from the preset threshold, and the specific formula is as follows:

[0094] ;

[0095] in, This represents the preset error rate threshold, which is initially set to 0.05 in this embodiment. This represents the preset accuracy threshold, which is initially set to 0.05 in this embodiment, meaning that no more than 5% of the query samples are allowed to trigger an overconfidence error or an underconfidence error; it can be appropriately relaxed to 0.1 depending on the difficulty of the task.

[0096] like (Including draws): Execute the first update operation, activate path one, and prioritize path one in case of a draw, as a conservative design choice to curb model overconfidence; if : Perform the second update operation to activate path two; if neither of the two exceeds its respective threshold (i.e. and This round does not trigger any feedback. The two paths are mutually exclusive, avoiding simultaneous adjustments in the opposing direction.

[0097] After the threshold and dual threshold judgments, feedback path one is executed according to the corresponding conditions: dynamic difficulty score increase and mask temperature tightening. Specifically, the triggering conditions are: and .

[0098] Feedback Action 1 (Applies to the update of task dynamic difficulty score and confusion category pair in S1):

[0099] (1) Sort all class pairs in OE samples in descending order of misclassification frequency, and select those whose misclassification frequency exceeds a preset frequency threshold. (in All category pairs (average number of categories in the batch) are taken as the set of culprit category pairs, which are taken as the category pairs to be updated. If the set of culprit category pairs is not empty, then for each category pair (a,b), step (2) of increasing the task dynamic difficulty score and truncation operation and step (3) of superimposing the positive signal operation are performed independently. If the misclassification frequency of all category pairs is defined as the number of OE samples in the current batch that are predicted as category b but are actually category a divided by the total number of all query set samples in the current batch. All are lower than If so, skip the feedback action in the adaptive task building step and only execute feedback action two.

[0100] (2) Increase and truncate the dynamic difficulty score of the task. The specific formula is as follows:

[0101] ;

[0102] in, The preset dynamic difficulty score increase represents the increase in the task difficulty score for round t. Indicate category and All belong to the task A collection of categories; This embodiment is set to 5.0:

[0103] (3) For the identified culprit pair (a, b), after the global decay is executed at the end of this round, a positive signal is superimposed. The specific formula is as follows:

[0104] ;

[0105] Feedback Action 2 (Affecting the mask temperature parameter in S2): Perform a slight temperature reduction on layers that are already activated and not in the cold start protection period. Indicates the t-th round against the t-th round. The temperature adjustment step size of a layer is based on the local round timing decay of the layer. The lower limit is set to 0.05 in this embodiment to prevent the mask from being too sharp and causing information collapse. The specific formula is as follows: .

[0106] In addition to feedback path one, feedback path two is executed under corresponding conditions: mask temperature relaxation and counterfactual reward. Specifically, the triggering conditions are: and .

[0107] If UC sample set (No UC samples in this batch) Skip this round of UC feedback and proceed directly to the next batch.

[0108] Otherwise, calculate the feature missing value of each activated layer (using the inner loop adaptation parameters of the task to which each sample belongs, keeping the parameter state consistent with that during query set inference), the specific formula is as follows:

[0109] ,in, Indicates that sample x is in the th... The output feature vector of the layer (including all) (each channel), using the task to which the sample belongs. Internal circulation adaptation parameters extract;

[0110] This metric measures the proportion of suppressed feature energy to original feature energy. A higher metric indicates that more information is masked at that layer, making it more likely to be a bottleneck layer leading to insufficient confidence. (Adding the denominator...) To prevent numerical explosion when the characteristic norm is zero.

[0111] This represents the dynamic median of the InfoGap values ​​(average of the two median values ​​for even-numbered layers) for all currently activated layers that are not in the cold start protection period, ensuring that the set of layers participating in the comparison is consistent with the set of layers participating in the adjustment. Temperature adjustment is performed on the layers in the top half of the InfoGap ranking (target feature layers) that are not in the cold start protection period. The upper limit of the temperature is set to 0.5 in this embodiment, and the specific formula is as follows:

[0112] ,in The preset temperature step size represents the time interval for the t-th round. The temperature step size of the layer is increased. Indicates the first Layer mask temperature parameters;

[0113] Then, the counterfactual channel contribution is calculated for each sample in the UC sample set u: for each suppressed channel c (i.e., satisfying...) The mask of channel c is temporarily set to 1, while keeping the masks of other channels of the task to which the sample belongs unchanged. After forward propagation of a single sample, the mask is restored. The increase in prediction confidence after normalization before and after the permutation is calculated using the following formula:

[0114] ;

[0115] in, Indicates sample In the The confidence boost on channel c is used to measure the contribution of the suppressed channel to the prediction confidence level. This means that after temporarily setting the mask of channel c to full activation (i.e., setting it to 1), the model will process the sample... The normalized prediction confidence score of the output is calculated in the same way as in step S3. Completely identical Indicates sample The meta-learning task to which it belongs; For the model of the original mask, the sample The normalized prediction confidence of the output.

[0116] like ,in To pre-set a confidence enhancement threshold (0.1 in this embodiment), channel c is determined to contribute to improving the prediction confidence of the sample, and is marked as a reward channel. This criterion directly measures the contribution of the suppressed channel to the prediction confidence, which matches the essence of the UC problem (correct prediction class but insufficient confidence), avoiding the logical contradiction that arises when using "prediction class flipping" as the standard and the definition of UC samples (original prediction is already correct). The union of the judgment results of all UC samples in u on channel c is taken, that is, any UC sample satisfies Channel c is marked as the reward channel; the evaluation of all suppressed channels in the same layer can be completed in parallel in a single batch forward propagation.

[0117] Counterfactual rewards are applied after this round of EMA updates. The counterfactual reward value is added to each channel marked as a reward channel in this round and then truncated. The specific formula is as follows:

[0118] ;

[0119] in, For the first The channel stability counter for the c-th channel of layer c has a value range maintained within [0,1]. To preset the counterfactual reward value, this embodiment uses 0.1; the truncation operation ensures... It always remains within [0,1], consistent with the implicit range of EMA; this execution order ensures that the reward stacking does not affect the EMA statistics of the mask in this round.

[0120] Then, in the cross-task channel stability accumulation, a global channel stability counter is maintained for the activated and filtered layers. The initial value is 0.5; inactive feature layers remain unchanged and do not participate in the update. express A real-valued vector space. After each round of feedback actions is completed and before the counterfactual reward is accumulated, an EMA update is performed on the activated feature layers (only when the layer is active). (Executed when filter is activated), the formula is:

[0121] ;

[0122] in This is the channel stability attenuation coefficient. The EMA steady-state value naturally falls within (0,1), and the entire text discusses... All operations maintain this range constraint. The higher the value, the more reliably the channel is selected as the discriminative channel in most tasks. The complete execution logic of the EMA update and counterfactual reward superposition in each round of meta-training is as follows: ① EMA update must be executed in every round; ② Only when path two is triggered in this round and the current batch of UC samples... When the EMA update is complete, the counterfactual reward stacking is performed; ③ If path 1 is triggered or no path is triggered, the reward stacking is skipped, and the EMA update result is the result of this round. The final value of the channel stability counter. The round-by-round EMA update continuously records the evolution trajectory of the mask activation value of each channel. The change in the counter value of adjacent rounds directly reflects the degree of change in the value of the dynamic soft mask, and this is used as a basis to determine whether the layer filtering state tends to be stable.

[0123] Furthermore, an activated feature layer refers to a feature layer in which the dynamic soft mask generation step has been initiated during the current training phase. This means that each channel of this layer has generated a soft mask value ranging from (0,1) based on its gradient sensitivity score, and this value is used for channel-level weighting of feature propagation and gradient updates for this layer. Conversely, an inactive feature layer refers to a feature layer in which the dynamic soft mask generation step has not yet been initiated. All channels in this layer retain a mask value of 1, equivalent to no channel filtering being performed. This embodiment adopts a progressive strategy of activating features layer by layer from the last feature layer towards the input direction. Initially, only the last feature layer is activated, and the remaining layers are activated sequentially as channel stability meets preset conditions during training.

[0124] Then, a multi-level progressive screening strategy is implemented. Specifically, the initial state only applies to the last key layer (the first... The first layer is the active channel filter, and all other layers have a mask of 1 (equivalent to no filtering). This applies to the shallowest layer that is currently active and filtered. , This represents the currently active feature layer that generates the latest dynamic soft mask, monitoring the magnitude of stability changes. The formula is:

[0125] ,in, For the first The value of the global channel stability counter for the c-th channel of layer after the t-th round of update. The difference between the two, representing the historical data prior to its V-cycle, is used to measure the magnitude of change in the filtering state of that layer.

[0126] when When this occurs, a dynamic soft mask generation step is triggered on the adjacent inactive feature layer on the input side of the currently active feature layer, triggering a forward expansion of one layer. When all feature layers ( =1 to =L) After all channels have been activated and filtered, if the shallowest activated layer ( The stability change range of =1) Also meets the requirement of being below the preset stability threshold. Under the condition that no shallower inactive layer is available for expansion, layer expansion is no longer performed. Each activated layer continues to operate normally according to the existing dynamic soft mask and feedback mechanism until the overall convergence condition is met, at which point the first activated layer is activated. layer( This represents the preset stability threshold, which is set to 0.005 in this embodiment. (This example uses 20-50 rounds as the preset number of rounds). Record the global rounds in which this layer is triggered and activated. Local time of layer After the cold start ends (i.e., the first...) (Start the calculation from the wheel).

[0127] The temperature parameters of the newly activated layer are initialized to... Entering the cold start protection period, continuing Wheel. Initial settings in this embodiment. (The update interval is the same as that for the set of confused category pairs), and both can be adjusted independently as needed. No feedback action 2 or temperature feedback adjustment will be responded to during the cold start protection period.

[0128] Then, the adjustment amplitude is reduced and each round is completed. Specifically, the dynamic difficulty score is adjusted upwards by a preset amount. By global rounds Attenuation; temperature adjustment step size by layer, local rounds attenuation:

[0129] ,when During the cold start protection period (i.e., within the cold start protection period). Less than 0, but because this layer is exempt from all temperature regulation during cold start, the decay formula... This item is not involved in any actual calculations during this period. Only It is only used after the cold start is over and the layer officially participates in feedback adjustment.

[0130] Using the end of the cold start as the zero point, ensure that each floor enters the first round of feedback adjustment. The attenuation factor is from Starting from this point, the early-activated layer enjoys completely equivalent regulatory capabilities. The specific formula is as follows:

[0131] , ;

[0132] Among them, attenuation rate In this embodiment, Initial values ​​for this embodiment: , (exist Under the current settings, approximately 9 steps are required to complete the full range of adjustments. The dynamic difficulty score adjustment uses a global range. Temperature regulation is used locally in the layer. Both decay separately and do not interfere with each other.

[0133] After all feedback actions and rewards have been accumulated in each round, regardless of whether path one was triggered in this round, a global decay is applied to all categories, with the specific formula as follows:

[0134] ;

[0135] This step is executed unconditionally, ensuring that the time-delay is unaffected by whether Path 1 is triggered. When Path 1 is triggered, the positive signal superimposed on the culprit category is applied. This is performed after the current decay and is equivalent to the complete EMA update formula in step S1.

[0136] Finally, convergence criteria are used to terminate training. Specifically, after each round of meta-training, a comprehensive index is calculated using three smoothing values, with the following formula:

[0137] ,in The convergence threshold for ECE is set to 0.05 in this embodiment, and... , They are of equal status and can be adjusted independently according to clinical needs. All three parameters have been smoothed by exponential moving averages and have symmetrical and consistent sources.

[0138] Historical optimal parameter saving rules: Initialize to +∞ to ensure parameters are saved after the first round. Calculate in each subsequent round. After, only when the current Below the operating scalar Update , , (For all layers) =1,…,L) and refresh (Copy on write, all three are saved synchronously in the same round), ensuring and Always correspond to the same model state to avoid inconsistencies between the channel stability prior used in the fine-tuning phase and the model state of the meta-initialization parameters. Early stopping and... Both paths output the same set , ,in, The first one saved when the meta-training converges The final value of the layer global channel stability counter, with superscript * and , The asterisk (*) in the text has the same meaning, both indicating the best moment in the meta-training history (…). (When refreshing) the corresponding saved parameter or statistical snapshot.

[0139] when continuous During the round, determine if the meta-training has converged ( This embodiment uses 10 to 30 rounds.

[0140] Maximum number of training rounds (A rigid, absolute upper limit that cannot be exceeded under any circumstances): If reached It has not yet converged, and the output is the historical best. , Record the incomplete convergence indicator.

[0141] Early stop mechanism ( (Embedded early exit path): Training complete The effect begins at the rear of the wheels; the front... The round only performs normal training and saves historical best parameters; it does not evaluate early stopping conditions. After the round, if consecutive The variation range of the actual comprehensive index within the wheel was lower than that of each wheel. The specific formula is as follows:

[0142] This indicates that the maximum absolute value of the difference between the comprehensive indicators of two adjacent rounds within the most recent round P is lower than... P shares the same parameter with the early stop effective waiting round;

[0143] Then terminate early and output. , .in For the first The actual comprehensive index value of the wheel (not the historical best). In this embodiment, the value is set to 0.001. In this embodiment, 50 to 100 rounds are used, which should meet the following requirements. Much larger This is to avoid premature stopping before convergence confirmation is triggered.

[0144] Convergence judgment (S<1 for W consecutive rounds) can be accumulated from the first round of training and is not limited by the early stop effective time P. If S<1 is satisfied for W consecutive rounds within the first P rounds, convergence is also declared and training is terminated. In this case, the early stop mechanism has not yet taken effect but convergence has been achieved, which is considered normal early completion. The priority of early stopping, convergence judgment, and convergence judgment is as follows: Terminate immediately when convergence judgment is satisfied (optimal case); if convergence is not satisfied, early stopping takes precedence. If effective, it will be terminated by early termination; if neither is triggered, it will be terminated by early termination. The procedure is to terminate the order.

[0145] The main technical solutions of this application have been described above. The fine-tuning stage for rare bacteria in small sample sizes will be described below.

[0146] After the meta-training converges, high-quality meta-initialization parameters are obtained. , and global channel stability counters at each layer When encountering rare pathogens in clinical practice, a channel stability prior inheritance fine-tuning process is implemented.

[0147] Specifically, record For optimal meta-parameters The corresponding number in the middle Subset of parameters of the layer ( (This is an equivalent representation of layer-by-layer block division). Fine-tuning is performed independently at each layer, and the results are merged and restored to the complete parameters after each layer is completed.

[0148] Generate differentiated learning rate weights for each layer (if the layer...) (The filtering process has been activated during meta-training), and the specific formula is:

[0149] ;

[0150] or (otherwise). Ranking in ascending order, with a range of values. (The lowest stability channel ranking is 1, and the highest ranking is...) ), for The c-th component; when they are in parallel, fractional rank is used to ensure continuous weight distribution. The highest stability channel weight is exactly 1.0. The weights are set as a lower bound to ensure that even the lowest-ranked channels retain some update capability—because the discriminative features of rare bacteria may depend on certain channels that were not adequately considered during training for common bacteria. For layers that were not activated during meta-training due to early stopping or other reasons, a weight of 1.0 is uniformly used, which is equivalent to standard fine-tuning and avoids introducing untrained noisy priors.

[0151] The formula is as follows: ;

[0152] Specifically, for the first Layer convolution kernel parameters, Broadcast to the All associated parameters of each output channel (i.e., the convolution kernel corresponding to that channel) All elements and their corresponding biases, Indicates the kernel size. Indicates the first The number of input channels of the layer, i.e., the number of input channels of the layer. (Number of output channels in the layer), all parameters of each output channel use the same channel weight. Scaling the gradient. High-stability channels receive a larger effective learning rate, while low-stability channels receive a smaller but non-zero learning rate. Fine-tuning the learning rate. Usually taken with Same order of magnitude or smaller.

[0153] Then, in the fine-tuning stage with few rare bacteria samples, prediction inconsistency verification is also required. Specifically, since the number of validation samples for rare bacteria may be extremely small (even only 1 or 2), prediction inconsistency verification based on semantic preservation enhancement of CT images can achieve better results.

[0154] When there are more than 3 available samples for rare bacteria, a leave-one-out partitioning method is used: one sample is retained each time as a validation sample to perform prediction inconsistency verification, and the remaining samples are used as the support set for fine-tuning. All available samples are used as validation samples in turn, and the average prediction inconsistency rate (PredIncon) of all rounds is taken as the final verification metric. When there are no more than 3 available samples, all samples are used for support set fine-tuning, and the validation samples are directly taken from the support set samples themselves.

[0155] Perform on each validation sample Secondary enhancement (in this embodiment) Each enhancement uses only the following three types of operations that do not change the diagnostic semantics:

[0156] (1) Window width and window level fine adjustment: Based on the lung window (W:1500, L:-600), a random perturbation of ±5% is applied to the window width and window level respectively, without changing the spatial structure, only affecting the contrast presentation;

[0157] (2) Micro-amplitude elastic deformation: using small amplitude ( The elastic deformation field of pixels simulates micro-deformation of lung parenchyma under different respiratory phases without changing the overall anatomical structure.

[0158] (3) Low-intensity Gaussian noise injection: Add low-intensity Gaussian noise ( (pixel value range), simulating the differences in imaging noise under different scanning conditions.

[0159] During each enhancement, the three types of operations are applied simultaneously. The parameters of each operation (window width and window level perturbation amplitude, elastic deformation field parameters, and noise intensity) are independently and randomly sampled within their respective recommended ranges to ensure that each enhancement generates an independent perturbation combination, maximizing... The diversity among the sub-enhancements.

[0160] Each enhanced image is independently input into the model to obtain predictions, and calculations are performed. Inconsistency rate of the Top-1 category in the second prediction ( To enhance the recurrent index, and to integrate with the global training rounds (Irrelevant), the specific formula is:

[0161] ;

[0162] in, Indicates the prediction inconsistency rate. for The category that appeared most frequently in the prediction. This represents the top-1 predicted class (r=1,…,…) output by the model after performing the r-th semantic preservation enhancement on the validation samples. PredIncon close to 0 indicates highly consistent predictions (model stability), while close to 1 indicates highly inconsistent predictions. When there is no unique mode in the prediction Take the category with the smallest category index among the tied highest categories (as a deterministic tie-breaking rule).

[0163] Inconsistency threshold In this embodiment, the value is set to 0.2 (i.e. (If more than 80% of the predictions are consistent, it is considered stable); for high-risk clinical decision-making scenarios, the threshold can be tightened to 0.1, and for scenarios with extremely scarce samples (only 1 validation sample), it can be relaxed to 0.3.

[0164] If PredIncon If the model fine-tuning results are considered stable and reliable, the final model is output; if PredIncon If the model is considered to be overfitting to a specific pixel pattern in the support set, then the meta-parameters are reset on each retry. Learning rate based on number of retries (Starting from 1) Decreasing: the first The second retry uses the learning rate. (i.e., first trial use) The second time (And so on), repeat the prediction inconsistency check until it passes or the maximum number of retries is reached. If it still fails after reaching the maximum number of retries, output the model with the lowest PredIncon among all retried versions, and add a "Prediction consistency not fully converged" flag for reference in clinical use.

[0165] After introducing the technical process of this invention, the following description is based on experimental data.

[0166] First, the dataset for this experiment was obtained. This dataset was compiled from chest CT images from three tertiary hospitals, and pathogenic bacteria labels were confirmed through microbial culture. It covers 15 pathogenic bacteria categories, of which 12 common categories (80-300 cases per category) were used for meta-training, and 3 rare categories (only 5-8 cases per category) were used for small-sample fine-tuning and testing. CT images were uniformly processed using lung windows (1.0 mm slice thickness) and normalized preprocessing. The model to be trained used ResNet-12 as the feature extraction network, with ImageNet pre-trained weights initialized. Meta-training parameters: inner loop learning rate β=0.05, outer loop learning rate γ=0.005, inner loop steps... =3, Batch task number |B|=4, α=2.0, =0.7, =0.2. Fine-tune the learning rate. =0.005, =20. All experiments were repeated 5 times, and the mean ± standard deviation was taken.

[0167] After obtaining the dataset, the following section describes this ablation experiment.

[0168] Evaluation metrics: Classification accuracy (Acc, %) for rare bacterial categories, macro-average F1 score (F1, %), and expected calibration error (ECE, lower is better). See the table below for details.

[0169] variants Acc(%) F1(%) ECE PredIncon Complete method 74.6±1.3 72.1±1.5 0.044±0.005 0.09±0.03 Remove dynamic difficulty scores (uniform sampling) 70.3±1.6 67.8±1.8 0.055±0.007 0.12±0.04 Remove gradient-sensitive soft masks (equal weights across all channels) 68.1±1.8 65.4±2.0 0.078±0.009 0.15±0.04 Remove double-threshold closed-loop feedback (mask not dynamically adjusted). 71.5±1.5 69.0±1.7 0.098±0.011 0.11±0.03 Removing obfuscated categories to enhance strategies 72.0±1.4 69.6±1.6 0.049±0.006 0.10±0.03 Remove channel stability inheritance fine-tuning (standard fine-tuning) 72.8±1.4 70.2±1.6 0.046±0.006 0.17±0.05 Remove prediction inconsistency checks (no rollback retries) 74.6±1.3 72.1±1.5 0.044±0.005 0.16±0.05

[0170] Analysis of the experiment:

[0171] (1) The accuracy dropped the most after removing the gradient-sensitive soft mask (6.5 percentage points), indicating that channel-level feature filtering is the core performance contribution module of this method, which effectively suppresses the interference of redundant channels under the condition of a very small support set.

[0172] (2) After removing the double-threshold closed-loop feedback, the ECE increased from 0.044 to 0.098, a degradation of more than double, but the accuracy only decreased by 3.1 percentage points. This indicates that the main contribution of this module is confidence calibration rather than classification accuracy;

[0173] (3) Removing the dynamic difficulty score resulted in a 4.3 percentage point decrease in accuracy, indicating that adaptive task sampling plays an important role in the model's ability to learn fine-grained discrimination.

[0174] (4) The two modules, channel stability inheritance fine-tuning and prediction inconsistency verification, have relatively small impacts on accuracy and ECE, but have a significant impact on prediction inconsistency rate (PredIncon) - after removal, PredIncon increased from 0.09 to 0.17 and 0.16 respectively, indicating that the core value of these two modules lies in ensuring the output stability of few-sample fine-tuning.

[0175] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.

Claims

1. A method for training a meta-learning model of chest CT images for predicting pathogenic bacteria, characterized in that, Includes the following steps: S1. Obtain a chest CT image dataset containing various types of pathogens with real labels and a model to be trained. Initialize the initial meta-parameters of the model to be trained and the dynamic difficulty score corresponding to each meta-learning task. Based on the dynamic difficulty score, sample from the image dataset to construct multiple meta-learning tasks containing support sets and query sets. S2. For each meta-learning task, calculate the loss gradient of the model to be trained on each feature channel based on the support set; extract the directional consistency of the loss gradient among each sample in the support set to calculate the gradient sensitivity score, and generate a dynamic soft mask accordingly. S3. The loss gradient is weighted using the dynamic soft mask, and the initial meta-parameters are updated based on the weighted loss gradient to obtain task adaptation parameters; the query set is forward-propagated using the task adaptation parameters to obtain the prediction category, prediction confidence, and query loss. The proportion of samples whose prediction confidence is greater than a first preset threshold and whose predicted category is inconsistent with the true label is statistically analyzed, as well as the proportion of samples whose prediction confidence is less than a second preset threshold and whose predicted category is consistent with the true label. A closed-loop feedback signal is generated based on the two sample proportions. S4. Based on the query loss, perform meta-update on the initial meta-parameters, and dynamically adjust the dynamic difficulty score and the dynamic soft mask according to the closed-loop feedback signal; repeat steps S1 to S4 until the preset convergence condition is met, and output the target meta-parameters.

2. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 1, characterized in that, The process of sampling from the image dataset based on the dynamic difficulty score to construct multiple meta-learning tasks containing support sets and query sets includes: Calculate the cosine distance between each category in the image dataset, and mark category pairs with a cosine distance lower than a third preset threshold as confused category pairs; The sampling probability is calculated based on the dynamic difficulty score corresponding to each meta-learning task. The image dataset is sampled based on the sampling probability so that image data containing the confused category pairs are sampled into the support set and query set.

3. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 1, characterized in that, The step of extracting the directional consistency of the loss gradient across samples in the support set to calculate the gradient sensitivity score, and generating a dynamic soft mask accordingly, includes: The cosine consistency of the scalar gradients of the support set samples on each feature channel is calculated, and the gradient sensitivity score is obtained by combining the magnitude of the scalar gradients. After normalizing the gradient sensitivity score, the true median is calculated. The true median is used as a fixed reference value that does not participate in gradient propagation. Based on the fixed reference value and the normalization of the gradient sensitivity score, the channel weights are obtained by softmax calculation. The normalized gradient sensitivity scores are then weighted and summed to obtain the soft reference value. A mask temperature parameter is introduced, and the difference between the normalized gradient sensitivity score and the soft reference value is calculated. The difference is then compared with the mask temperature parameter, and the ratio is input into the Sigmoid function to output the dynamic soft mask. The mask temperature parameter is used to control the smoothness of the dynamic soft mask.

4. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 1, characterized in that, The generation of the closed-loop feedback signal based on the ratio of two samples includes: The proportion of samples whose prediction confidence is greater than a first preset threshold and whose predicted category is inconsistent with the true label is recorded as the first error rate. The proportion of samples whose prediction confidence is less than the second preset threshold and whose predicted category is consistent with the true label is recorded as the first accuracy rate; The first error rate and the first accuracy are processed by exponential moving average to obtain a smoothed first error rate and a smoothed first accuracy. The smoothed first error rate and the smoothed first accuracy are combined as the closed-loop feedback signal.

5. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 4, characterized in that, The step of dynamically adjusting the dynamic difficulty score and the dynamic soft mask based on the closed-loop feedback signal includes: Calculate the first difference between the smoothed first error rate and the preset error rate threshold, and calculate the second difference between the smoothed first accuracy rate and the preset accuracy threshold; If the first difference is greater than or equal to the second difference, and the first difference is greater than zero, then a first update operation is performed. The first update operation includes: increasing the dynamic difficulty score of the corresponding meta-learning task, and decreasing the mask temperature parameter to tighten the dynamic soft mask. If the first difference is less than the second difference, and the second difference is greater than zero, then a second update operation is performed. The second update operation includes: increasing the mask temperature parameter to relax the dynamic soft mask; if neither the first difference nor the second difference is greater than zero, then no update operation is performed this time.

6. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 5, characterized in that, The first update operation increases the dynamic difficulty score of the corresponding meta-learning task, including: The predicted category and the true category of each sample in the query set that generated the first error rate are counted, and the predicted category pairs that appear more frequently than a preset frequency threshold are determined as the category pairs to be updated. Determine whether the current meta-learning task contains the class pair to be updated: If included, the dynamic difficulty score corresponding to the current meta-learning task will be increased by a preset dynamic difficulty score adjustment amount. If not included, the dynamic difficulty score corresponding to the current meta-learning task remains unchanged.

7. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 5, characterized in that, The second update operation increases the mask temperature parameter to relax the dynamic soft mask, including: For the query set samples that generate the first accuracy, in each activated feature layer of the model to be trained, the ratio of the norm of the feature vector suppressed by the dynamic soft mask in each activated feature layer to the norm of the original feature vector of that layer is calculated to obtain the feature missing degree of each layer. The activated feature layer refers to the feature layer that has been generated by the dynamic soft mask. Calculate the dynamic median of feature missing values ​​for all activated feature layers, and determine the feature layers with feature missing values ​​not lower than the dynamic median as target feature layers; Increase the mask temperature parameter corresponding to the target feature layer by a preset temperature step.

8. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 1, characterized in that, The process of repeatedly executing steps S1 to S4 until the preset convergence condition is met also includes: A channel stability counter is established for each activated feature layer. After each cycle, the channel stability counter is updated based on the magnitude of the change in the value of the dynamic soft mask. Monitor the channel stability counter corresponding to the newly activated feature layer; If the channel stability counter changes less than a preset stability threshold within a set number of consecutive cycles, a dynamic soft mask generation step is initiated for the inactive feature layer immediately adjacent to the newly activated feature layer input side in the next cycle.

9. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 8, characterized in that, After outputting the target meta-parameters, a small-sample fine-tuning stage for rare pathogens is also included: Obtain target fine-tuned samples containing rare pathogens, and assign continuously distributed differentiated learning rate weights to each feature channel according to the ascending ranking of the corresponding values ​​of each feature channel in the channel stability counter. The higher the ranking of the channel, the greater the learning rate weight is assigned. The cross-entropy loss is calculated using the target fine-tuned sample. When updating the target meta-parameters in reverse, the loss gradient of the corresponding channel is scaled channel by channel using the differentiated learning rate weights to obtain the fine-tuned model parameters.

10. The method for training a meta-learning model of chest CT images for pathogen prediction according to claim 9, characterized in that, After obtaining the fine-tuned model parameters, the method further includes a prediction inconsistency verification step to assess the stability of the fine-tuning: Validation samples are divided from the target fine-tuning samples, and a preset semantic preservation enhancement process is applied to the validation samples to generate multiple enhanced samples; The enhanced samples are input into the fine-tuned model to obtain the corresponding predicted categories. The proportion of non-most frequent categories in the total number of predictions is used as the prediction inconsistency rate. If the prediction inconsistency rate is less than or equal to the inconsistency threshold, then the current fine-tuning model is output. If the prediction inconsistency rate is greater than the inconsistency threshold, the fine-tuned model is rolled back to the target meta-parameter, and the learning rate weight is reduced exponentially before fine-tuning again until the prediction inconsistency rate meets the inconsistency threshold or reaches the preset maximum number of retries. The fine-tuned model corresponding to the lowest prediction inconsistency rate is then output.