An incremental learning method for class-domain granularity random partitioning scenarios

CN122049528BActive Publication Date: 2026-09-18SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610212865.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-13
Publication Date
2026-09-18
Estimated Expiration
2046-02-13

AI Technical Summary

Technical Problem

[0006]为解决背景技术中存在的问题,本发明提出了一种面向类-域粒度随机划分场景的增量学习方法,可在复杂多域、长尾分布的增量场景中,有效缓解灾难性遗忘问题,大幅提升旧类别知识保持性能与模型整体分类精度,同时优化模型输出的置信度校准效果

Benefits of technology

[0016] The beneficial effects of this invention are as follows: This scheme simulates the data flow structure of real-world scenarios, constructing a data format with "class-domain" as the data unit and random partitioning, further applying incremental learning research to the stochastic application scenarios of real-world scenarios. Based on this, this method proposes a priority replay strategy based on class centroid shift. By calculating the drift score of each old class, priority sampling is performed on the replay samples, precisely focusing the limited replay budget on categories with higher forgetting risk. In complex stochastic incremental learning scenarios, this strategy can significantly improve model learning accuracy and effectively reduce catastrophic forgetting rates compared to traditional uniform replay methods. Simultaneously, addressing the data imbalance problem in stochastic incremental learning scenarios, this invention proposes a "class-domain" granular rebalancing strategy, which is more adaptable and has a higher fit than traditional "class" granular rebalancing strategies. Furthermore, multiple nodes are maintained for the same semantic category in the incremental classifier's classification head. Through aggregation based on logarithms and exponentials and temperature adaptation driven by class frequency, a frequency-calibration-aware incremental classifier is realized, combined with prior calibration strategies such as logarithmic adjustment and balanced softmax, and node expansion rules with evidence gating. Therefore, compared with existing incremental learning methods, this invention can effectively reduce catastrophic forgetting, improve old class retention performance and overall classification accuracy, and improve the confidence calibration of model output in complex multi-domain, long-tailed incremental scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122049528B_ABST
    Figure CN122049528B_ABST
Patent Text Reader

Abstract

The application relates to the field of artificial intelligence and computer vision technology, and provides an incremental learning method for class-domain granularity random division scenes, which comprises the following steps: constructing a data form simulated under real data flow, wherein the data form is randomly divided in "class-domain" units; constructing a feature extraction network and an incremental classifier based on frequency-calibration perception; constructing an accurate playback strategy based on old class drift scoring; introducing a "class-domain" granularity rebalancing strategy; and training and evaluating the incremental classifier. The scheme can effectively reduce catastrophic forgetting in a complex multi-domain, long-tail distribution incremental scene, improve old class retention performance and overall classification accuracy, and improve the confidence calibration of model output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and computer vision technology, specifically to an incremental learning method for scenarios with random partitioning at the class-domain granularity. Background Technology

[0002] In applications such as industrial visual inspection, security monitoring, and autonomous driving, the data to be processed typically originates from different equipment, operating conditions, and environmental conditions, exhibiting significant multi-domain characteristics. As time progresses, new equipment, processes, and defect types continuously emerge, requiring models to continuously absorb new knowledge without complete retraining. This makes incremental learning an important research direction.

[0003] In existing technologies, typical incremental learning settings include category incremental learning, domain incremental learning, and cross-domain / cross-category incremental learning. Under these settings, the model learns sequentially according to the task order; to save storage space, not all samples from old tasks are usually retained completely, and only a small number of samples can be selectively replayed. The aforementioned incremental learning settings are all based on ideal partitioning conditions of task data. For incremental forms with uncertain categories or domains in real-world data streams, they are prone to severe catastrophic forgetting problems and cannot adapt to the incremental learning needs of real-world applications. Furthermore, in actual multi-domain scenarios, the number of samples from different categories, different domains, and different "class-domain" combinations is often highly unbalanced, exhibiting a typical long-tail distribution. If training is still performed using conventional cross-entropy loss, the model will be significantly biased towards high-frequency categories and dominant domains, resulting in insufficient recognition performance for tail categories and weak domains.

[0004] Existing resampling and reweighting methods mostly address sample imbalance at the single-class level, failing to address the fine-grained joint imbalance at the class-domain level. Furthermore, the incremental learning process continuously alters the prior distribution of classes. Traditional fixed-structure classifiers and standard normalized exponential function training methods are prone to confidence bias and calibration errors; that is, the model is overly confident in high-frequency classes and overly conservative in low-frequency classes. This problem directly reduces the safety and reliability of model deployment.

[0005] In summary, existing incremental learning techniques cannot be adapted to real-world multi-domain random incremental applications, and they have technical shortcomings in areas such as sample replay, handling class-domain joint imbalance, and classifier calibration. Therefore, there is an urgent need to develop a new incremental learning method to effectively reduce catastrophic forgetting and improve overall classification performance. Summary of the Invention

[0006] To address the problems existing in the background technology, this invention proposes an incremental learning method for class-domain granular random partitioning scenarios. In complex multi-domain, long-tailed incremental scenarios, it can effectively alleviate the catastrophic forgetting problem, significantly improve the retention performance of old category knowledge and the overall classification accuracy of the model, and optimize the confidence calibration effect of the model output.

[0007] To achieve the above objectives, the present invention adopts the following solution: An incremental learning method for class-domain granularity random partitioning scenarios, the method comprising: Step S1: Construct a data format that simulates a real data flow, with "class-domain" as the data block unit and randomly divided. Step S2: Based on the data format, construct a feature extraction network and an incremental classifier based on frequency-calibration perception; Step S3: Based on the random incremental learning scenario, construct an accurate replay strategy based on the old category drift score; Step S4: Analyze the challenges faced by the random incremental learning scenario and introduce a rebalancing strategy at the "class-domain" granularity. Step S5: Train and evaluate the incremental classifier based on the accurate replay strategy and the rebalancing strategy.

[0008] Optionally, step S1 specifically includes: Step S1.1, define a multi-domain dataset, its expression is: (1) In the formula, x i For the first i One sample, y j Label it as a category. d k For domain tags, N The total number of samples, C The total number of categories, M The total number of domains; Step S1.2: Divide the data into categories by type to obtain a subset of categories at the category level. The expression for this subset is: (2) Step S1.3: Within the category subset, further divide the data into blocks by domain to obtain data block units with category-domain granularity, the expression of which is: (3) Step S1.4: Randomly allocate the data block units to the task sequence. T 0, T 2, ..., T n-1The model learns sequentially according to the task sequence.

[0009] Optionally, step S2 specifically includes: Step S2.1: Construct an image encoding network based on a visual self-attention mechanism as a feature extraction network to extract features from the input image and output a fixed-dimensional image feature vector; the feature extraction network includes a convolutional embedding layer, a multi-layer self-attention encoding layer, and a global feature aggregation layer; Step S2.2: Initialize the parameters of the feature extraction network, including loading parameters from the pre-trained model and initializing parameters based on a random distribution; Step S2.3: Construct an incremental classifier, set one or more classification nodes for the same semantic category, assign a weight vector and bias parameters to each classification node, and establish a mapping table between semantic categories and classification nodes; Step S2.4: Connect the output features of the feature extraction network to the incremental classifier so that the incremental classifier receives the image feature vector and completes multi-class prediction.

[0010] Optionally, step S3 specifically includes: Step S3.1: In each incremental task of random incremental learning, the feature extraction network is used to perform forward inference on the current task sample to obtain the image feature vector corresponding to each sample. Step S3.2, for each category in the replay cache c Based on the image feature vector of its sample, calculate its performance in the total number of training rounds. t (The current centroid is set to 5 training rounds per task) The calculation formula is: (4) In the formula, For replay cache in training rounds t End of category c Number of samples selected For the sample x i The image feature vector; where, at the start of the current incremental task, the initial centroids of each old category are obtained before the start of each task training round according to the above formula (4). ; Step S3.3, in the training rounds t When the model learning is complete, the centroids of each old class are updated using the EMA strategy, resulting in the training epochs. t At the end of the EMA centroid The update process satisfies the formula: (5) In the formula, For category c Training rounds t The centroid of the EMA obtained at the end of -1; These are weight parameters; Step S3.4: After each round of training for the current task, based on the current centroid... Initial centroid The previous EMA centroid The formula for calculating the two types of centroid drift is as follows: (6) In the formula, Representative category c The EMA drift between the current training round and the previous training round. Representative category c The historical drift of the current training round from the initial centroid at the start of the current task; Step S3.5: Linearly fuse the EMA drift amount and the historical drift amount to obtain the comprehensive drift amplitude, calculated using the following formula: (7) In the formula, l Used to balance the effects of "short-term drift between two adjacent rounds" and "long-term drift relative to the initial centroid of the mission"; Step S3.6: Normalize the overall drift magnitude of all old categories in the same round to obtain the normalized drift score in the [0,1] interval. Its formula is: (8) In the formula, e To prevent extremely small constants with a denominator of zero; C old A set of categories consisting of historical tasks; Step S3.7: Maintain a sliding window of length L for each old category, record the normalized drift scores obtained from the most recent L training rounds, and calculate their arithmetic mean as the final drift score for that category in the current task. S c Its formula is: (9) In the formula, For category c exist The overall drift amplitude obtained at each moment; Step S3.8, assign the final drift score S cNormalized to a probability distribution, it serves as the replay priority weight for each old category; under the constraint of a limited replay sample budget, more replay opportunities are allocated to the old category with higher drift scores according to the aforementioned priority weight.

[0011] Optionally, step S4 specifically includes: Step S4.1: At the beginning of each incremental task, count the number of samples for each semantic category and its corresponding domain in the current task training set, and construct a two-dimensional sample distribution for categories and domains. The current task training set contains... N j,k Each of the above units is a "class-domain" unit, and each unit corresponds to a combination of a category label and a domain label; Step S4.2: Based on the sample distribution, adaptively calculate the corresponding rebalancing weight according to the sample frequency in each "class-domain" unit, using the following formula: (10) In the formula, β For smoothing hyperparameters; Step S4.3: Normalize and truncate the rebalancing weights, scaling all weights to an average value of 1 only on the "class-domain" units that actually appear in the current task, and setting a weight cap. oh max ,Right now: (11) In the formula, For all occurrences in the current task Y j,k The average value corresponding to the weights; These are the normalized rebalancing weights; Step S4.4: When training the incremental task, the loss function is weighted according to the combination of the category and domain to which the sample belongs, using the corresponding processed weights.

[0012] Optionally, step S5 specifically includes: Step S5.1, in the n At the start of each incremental task, forward inference is first performed using the current model on the training set for that task, targeting the currently known set of categories. C cur Each category c Statistical analysis of its recognition accuracy Acc c n Current task sample ratio r c n and the cumulative sample proportion of all learned tasks r c all; Step S5.2, set the accuracy threshold i acc and sample proportion threshold i task 、the total When category c satisfy Acc c n < i acc 、r c n ≥ i task and r c all ≥ i total It is determined to be a category to be expanded and added to the set to be expanded. ; Step S5.3, for each Add a new classification node to the output layer of the current classification head, where for each category to be expanded... c Row with the original weight of the corresponding node and bias As initialization parameters for new nodes, the weight matrix and bias vector are expanded, and the mapping relationship between nodes and categories and the corresponding task timestamps are maintained internally. Step S5.4: The input sample is processed by a feature extraction network to obtain a feature vector. Then, the expanded classification head outputs the predicted score vector. For the same semantic category c The corresponding multiple output nodes are aggregated through a gating aggregation module to generate the final predicted score vector for that category. ; Step S5.5: After training of each category group is completed, the classification head parameters of the trained category group are saved as a distillation snapshot; when the subsequent incremental task involves the same category group again, the corresponding distillation snapshot is used as the teacher classification head, and distillation constraints are applied to the current expanded classification head.

[0013] Optionally, in step S5.2, the accuracy threshold i acc The accuracy threshold is generated dynamically by using the difference between the average accuracy of each category in historical tasks and the accuracy of the current task. Different accuracy thresholds are adaptively set for each category, and the thresholds are non-linearly compressed and truncated to obtain an extended threshold specific to that category, which replaces a fixed global accuracy threshold.

[0014] Optionally, in step S5.4, the gated aggregation module uses a logarithmic summation and exponential pooling method to aggregate data within the same semantic category. c Corresponding node index set L c The outputs of all nodes are aggregated, and the logarithmic summation and exponential pooling method is as follows: (13) In the formula, For category The temperature parameters, and Adaptively adjust based on the cumulative number of samples for that category in historical data; For category c No. j The predicted score vector of each output node.

[0015] Optionally, in step S5.5, the distillation constraint specifically involves: when training the current task, inputting the same feature vector into the current expanded classifier head and the teacher classifier head respectively, and outputting the predicted score vector and the teacher predicted score; for the parts of each category involved in the current task that have not yet added nodes, calculating the relative entropy between the output of the current expanded classifier head and the teacher classifier head as the distillation loss, and weighting the distillation loss and the classification loss together to update the model parameters.

[0016] The beneficial effects of this invention are as follows: This scheme simulates the data flow structure of real-world scenarios, constructing a data format with "class-domain" as the data unit and random partitioning, further applying incremental learning research to the stochastic application scenarios of real-world scenarios. Based on this, this method proposes a priority replay strategy based on class centroid shift. By calculating the drift score of each old class, priority sampling is performed on the replay samples, precisely focusing the limited replay budget on categories with higher forgetting risk. In complex stochastic incremental learning scenarios, this strategy can significantly improve model learning accuracy and effectively reduce catastrophic forgetting rates compared to traditional uniform replay methods. Simultaneously, addressing the data imbalance problem in stochastic incremental learning scenarios, this invention proposes a "class-domain" granular rebalancing strategy, which is more adaptable and has a higher fit than traditional "class" granular rebalancing strategies. Furthermore, multiple nodes are maintained for the same semantic category in the incremental classifier's classification head. Through aggregation based on logarithms and exponentials and temperature adaptation driven by class frequency, a frequency-calibration-aware incremental classifier is realized, combined with prior calibration strategies such as logarithmic adjustment and balanced softmax, and node expansion rules with evidence gating. Therefore, compared with existing incremental learning methods, this invention can effectively reduce catastrophic forgetting, improve old class retention performance and overall classification accuracy, and improve the confidence calibration of model output in complex multi-domain, long-tailed incremental scenarios. Attached Figure Description

[0017] Figure 1 This is a flowchart of the incremental learning method of the present invention; Figure 2 This is a visualization of the incremental learning method in an embodiment of the present invention. Detailed Implementation

[0018] To make the present invention clearer and more understandable, the present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the given embodiments are only one implementation method and do not represent all embodiments.

[0019] Combination Figure 1 , Figure 2 This invention provides an incremental learning method for a random partitioning scenario at the class-domain granularity, comprising the following steps: Step S1: Construct a data format that simulates real data flow, with "class-domain" as the data unit and randomly divided.

[0020] Specifically, step S1 includes: Step S1.1: To simulate the randomness of real data streams, a multi-domain dataset is defined. S i,j,k Its expression is: (1) In the formula, x i For the first i One sample, y j Label it as a category. d k For domain tags, N The total number of samples, C The total number of categories, M The total number of domains; Step S1.2: Divide the data into categories by type to obtain category subsets at the category level. Y j Its expression is: (2) Step S1.3: Within the category subset, further divide the data into blocks by domain to obtain data block units Y with category-domain granularity. j,k Its expression is: (3) Step S1.4: Randomly allocate data block units to the task sequence. T 0, T 2, ..., T n-1 The model learns sequentially according to the task sequence.

[0021] Step S2: Based on the data format, construct a feature extraction network and an incremental classifier based on frequency-calibration perception.

[0022] Specifically, step S2 includes: Step S2.1: Construct an image encoding network based on a visual self-attention mechanism as a feature extraction network. The feature extraction network divides the input image into a series of image blocks and maps them into feature sequences through a front-end convolutional embedding layer. After processing the feature sequences through multi-layer self-attention encoding, a fixed-dimensional image feature vector is obtained through global feature aggregation.

[0023] Step S2.2: Initialize the parameters of the feature extraction network, including loading parameters from the pre-trained model and initializing parameters based on random distribution, in order to improve the convergence speed and generalization ability of the model on multi-domain data.

[0024] Step S2.3: Construct an incremental classifier. One or more classification nodes are set in the incremental classifier for the same semantic category to support subsequent dynamic expansion and multi-node aggregation. Furthermore, in the incremental classifier, a corresponding weight vector and bias parameters are set for each classification node, and a mapping table between semantic categories and classification nodes is established to register and manage newly added nodes during incremental learning.

[0025] Step S2.4: Connect the output features of the feature extraction network to the incremental classifier so that the incremental classifier receives the image feature vector and completes multi-class prediction.

[0026] Step S3: Based on the random incremental learning scenario, construct an accurate replay strategy based on the old category drift score.

[0027] Specifically, step S3 includes: Step S3.1: In each incremental task of random incremental learning, the feature extraction network is used to perform forward inference on the current task sample to obtain the image feature vector corresponding to each sample. Step S3.2, for each category in the replay cache c Based on its sample feature vector, calculate its performance in the total number of training rounds. t (Each task training round is set to 5) Current centroid The calculation formula is: (4) In the formula, For replay cache in training rounds t End of category c Number of samples selected For the samplex i The image feature vector; where, at the start of the current incremental task, the initial centroids of each old category are obtained before the start of each task training round according to the above formula (4). This serves as a benchmark for measuring the degree of shift in the distribution of features of the old category when new samples are added to the learning process. Step S3.3, based on the current centroid, in the training round t When the model learning is complete, the centroids of each old class are updated using the EMA strategy, resulting in the training epochs. t At the end of the EMA centroid To reduce the noise impact of random sampling, the update process satisfies the following formula: (5) In the formula, For category c In training rounds t The centroid of the EMA obtained at the end of -1; The weighting parameter is used to reduce interference from noise.

[0028] Step S3.4: During the current task training process, as new samples are continuously added to the learning process, the feature distribution of the old categories will drift, and their centroids will also change dynamically. Therefore, after each round of training, based on the current centroid... Initial centroid The previous EMA centroid The formula for calculating the two types of centroid drift is as follows: (6) In the formula, Representative category c The EMA drift between the current training round and the previous training round. Representative category c The historical drift of the current training round from the initial centroid at the start of the current task.

[0029] Step S3.5: Normalize the calculated EMA drift and historical drift to obtain the category-specific drift score. Specifically, for any category... c ,exist t At the end of the training round, the EMA drift of the current round is linearly fused with the historical drift according to the preset anchor weights to obtain the comprehensive drift amplitude. The specific calculations are as follows: (7) In the formula, lIt is used to balance the effects of "short-term drift between two adjacent rounds" and "long-term drift relative to the initial centroid of the mission".

[0030] Step S3.6: Normalize the overall drift magnitude of all old categories in the same round to obtain the normalized drift score in the [0,1] interval. Its formula is: (8) In the formula, e To prevent extremely small constants with a denominator of zero; C old A set of categories consisting of historical tasks; Step S3.7: Maintain a sliding window of length L for each old category, record the normalized drift scores obtained from the most recent L training rounds, and calculate their arithmetic mean as the final drift score for that category in the current task. S c Its formula is: (9) In the formula, For category c exist The overall drift amplitude obtained at each moment; Step S3.8, Scoring Sc The larger the value, the more it indicates the category. c The more severe the overall drift of the feature centroids in the current task relative to the initial state, the higher the risk of them being forgotten. Therefore, in the subsequent replay sample selection stage, the final drift score is used... Sc Normalized to a probability distribution, it serves as the replay priority weight for each old category; under the constraint of a limited replay sample budget, more replay opportunities are allocated to old categories with higher drift scores according to the aforementioned priority weight, in order to improve the ability to retain old knowledge and reduce catastrophic forgetting.

[0031] Step S4: Analyze the challenges faced by the random incremental learning scenario and introduce a rebalancing strategy at the "class-domain" granularity.

[0032] Specifically, step S4 includes: Step S4.1: At the start of each incremental task, count the number of samples for each semantic category and its corresponding domain in the current task training set, constructing a two-dimensional sample distribution for categories and domains. To characterize the long-tail distribution of "class-domain" level data, the current task training set includes... N j,k Each of the "class-domain" units corresponds to a combination of a category label and a domain label.

[0033] Furthermore, in this embodiment, the current task training set is denoted as... ,in, J and K These represent the sets of category label numbers and domain label numbers contained in the training set for this task, respectively.

[0034] Step S4.2: Based on the sample distribution, adaptively calculate the corresponding rebalancing weights according to the sample frequency in each "class-domain" unit. oh j,k Its formula is: (10) In the formula, β To smooth hyperparameters, when the number of class samples is small, oh j,k Larger values ​​increase the contribution of tail data to the loss; as the number of samples increases, the weights gradually stabilize. Step S4.3: Based on formula (10), in order to avoid excessive weights affecting training stability, the rebalance weights are normalized and truncated. Only in the "class-domain" units that actually appear in the current task (excluding replay data), all weights are scaled to an average value of 1, and a weight upper limit is set. oh max ,Right now: (11) In the formula, For all occurrences in the current task Y j,k The average value corresponding to the weights; This represents the normalized rebalancing weights. For cases where only category-level or domain-level rebalancing is used, the weights can be adjusted accordingly. oh j or oh k Perform similar normalization and truncation.

[0035] Step S4.4: When training the incremental task, the loss function is weighted according to the combination of the category and domain to which the sample belongs, so as to alleviate the class imbalance and domain imbalance problems caused by random incremental partitioning.

[0036] Step S5 involves training and evaluating the incremental classifier based on the precise replay strategy and the rebalancing strategy. Specifically, in each incremental task, the classification head of the incremental classifier constructed in step S2 is adaptively expanded by combining the old class drift information obtained in step S3 and the "class-domain" statistical information obtained in step S4. Furthermore, multiple classification nodes of the same semantic category are integrated through a gating aggregation mechanism, thereby completing the training and evaluation on the multi-task data stream.

[0037] Specifically, step S5 includes: Step S5.1: At the start of the nth incremental task, firstly, perform forward inference on the training set of the task using the current model, targeting the currently known set of categories. C cur Each category c Statistical analysis of its recognition accuracy Acc c n Current task sample ratio r c n and the cumulative sample proportion of all learned tasks r c all .

[0038] Step S5.2, set the accuracy threshold i acc and sample proportion threshold i task 、the total If and only if the following condition is met: Acc c n < i acc That is, the current category head for the category c Insufficient ability to distinguish; r c n ≥ i task and r c all ≥ i total This means that the category has sufficient sample support in both the current and historical tasks, belonging to the "frequent but difficult to classify" category. A category is considered valid only if all of the above conditions are met. c With sufficient sample evidence, it is determined to be a category to be expanded, and then added to the set to be expanded. Otherwise, even if the accuracy is low, the classification nodes for that category will not be expanded, but will be handled by rebalancing or calibration strategies to avoid overfitting to a very small number of sample categories.

[0039] Specifically, the accuracy threshold i acc It can be generated dynamically: based on the difference between the average accuracy of each category in historical tasks and the accuracy of the current task, different accuracy thresholds are adaptively set for each category, and the thresholds are subjected to nonlinear compression and lower limit truncation to obtain an extended threshold specific to that category, in order to replace a fixed global accuracy threshold.

[0040] Step S5.3, for each Add a new classification node to the output layer of the current classification head, where for each category to be expanded... c Row with the original weight of the corresponding node and bias As initialization parameters for new nodes, the weight matrix and bias vector are expanded, and the mapping relationship between nodes and categories, as well as the corresponding task timestamps, are maintained internally. Specifically, the existing classification head is denoted as a linear layer, and its weight matrix is... The bias vector is ,in The number of existing nodes, The feature dimension is defined as follows. The weight matrix and bias vector are expanded as follows: (12) In the formula, W c For category c The weight matrix of the newly added node; b c For category c The bias of the newly added node.

[0041] Step S5.4: The input sample is processed by a feature extraction network to obtain a feature vector. Then, the predicted score vector is output through the expanded classification head. Among them, for the same semantic category c To ensure that the output still corresponds one-to-one with the semantic category, this embodiment sets up a gated aggregation module after the classification head to aggregate multiple nodes of the same category.

[0042] Specifically, record the categories The set of node indices corresponding to the current category header is L c The gated aggregation module uses a logarithmic summation and exponential pooling method to process { z j ( x )| j ∈ L c The data is aggregated to obtain the final predicted score vector at the category level. Then, the cross-entropy loss and evaluation metric are calculated. The logarithmic summation exponential pooling method is as follows: (13) In the formula, For category c No. j The predicted score vector of each output node; For category The temperature parameters, and The tail category is adaptively adjusted based on the cumulative number of samples in historical data, resulting in a higher temperature and smoother activation response.

[0043] S5.5 To avoid disrupting the decision boundaries learned in historical tasks when expanding new nodes in incremental tasks, this embodiment saves the classification head parameters of the trained category group as a distillation snapshot after each category group is trained; when subsequent incremental tasks involve the same category group again, the corresponding distillation snapshot is used as the teacher classification head, and distillation constraints are applied to the currently expanded classification head.

[0044] Specifically, during training for the current task, the same feature vector is input into both the currently expanded classifier head and the teacher classifier head. The currently expanded classifier head outputs a predicted score vector, and the teacher classifier head outputs the teacher's predicted score. For the categories involved in the current task for which no new nodes have been added, the relative entropy between the outputs of the currently expanded classifier head and the teacher classifier head is calculated, i.e., the Kullback-Leibler divergence (KL divergence). This relative entropy is then used as a weighted sum of the distillation loss and the classification loss to update the model parameters. By using the distillation head snapshot as the teacher model, the performance of difficult-to-classify categories can be improved by introducing new nodes while preserving the discriminative ability of existing nodes for historical tasks as much as possible.

[0045] In summary, this invention simulates the data flow structure of real-world scenarios, constructing a randomly partitioned data format with "class-domain" as the data unit, further applying incremental learning research to stochastic real-world scenarios. Building upon this, the method proposes a priority replay strategy based on class centroid shift. By calculating the drift score of each old class, priority sampling is performed on replay samples, precisely focusing the limited replay budget on categories with higher forgetting risk. In complex stochastic incremental learning scenarios, this strategy significantly improves model learning accuracy and effectively reduces catastrophic forgetting rates compared to traditional uniform replay methods. Furthermore, addressing the data imbalance problem in stochastic incremental learning scenarios, this invention proposes a "class-domain" granular rebalancing strategy, which offers stronger adaptability and higher fit compared to traditional "class" granular rebalancing strategies. Further, multiple nodes are maintained for the same semantic category in the incremental classifier's classification head. Through logarithmic and exponential aggregation and class-frequency driven temperature adaptation, a frequency-calibration-aware incremental classifier is achieved, combined with prior calibration strategies such as logarithmic adjustment and balanced softmax, along with evidence-gated node expansion rules. Compared to existing incremental learning methods, this invention can effectively reduce catastrophic forgetting, improve old class retention performance and overall classification accuracy in complex multi-domain, long-tailed incremental scenarios, and improve the confidence calibration of model output.

[0046] The specific embodiments of the present invention have been described in detail above with reference to the figures, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.

Claims

1. An incremental learning method for class-domain granularity random partitioning scenarios, characterized in that, The method includes: Step S1: Construct a data format that simulates a real data flow, using "class-domain" as the data block unit and randomly partitioned; this includes: Step S1.1, Define the multi-domain dataset S i,j,k Its expression is: (1) In the formula, x i For the first i One sample, y j Label it as a category. d k For domain tags, N The total number of samples, C The total number of categories, M The total number of domains; Step S1.2: Divide the data into categories by type to obtain category subsets at the category level. Y j Its expression is: (2) Step S1.3: Within the category subset, further divide the data into blocks by domain to obtain data block units Y with category-domain granularity. j,k Its expression is: (3) Step S1.4: Randomly allocate the data block units to the task sequence. T 0, T 2, ..., T n-1 The model learns sequentially according to the task sequence. Step S2: Based on the data format, construct a feature extraction network and an incremental classifier based on frequency-calibration perception; Step S3: Based on the random incremental learning scenario, construct an accurate replay strategy based on the old category drift score; which includes: Step S3.1: In each incremental task of random incremental learning, the feature extraction network is used to perform forward inference on the current task sample to obtain the image feature vector corresponding to each sample. Step S3.2, for each category in the replay cache c Based on the image feature vector of its sample, calculate its current centroid in the total training epochs t. The calculation formula is: (4) In the formula, For replay cache in training rounds t End of category c Number of samples selected For the sample x i The image feature vector; where, at the start of the current incremental task, the initial centroids of each old category are obtained before the start of each task training round according to the above formula (4). ; Step S3.3, in the training rounds t When the model learning is complete, the centroids of each old class are updated using the EMA strategy, resulting in the training epochs. t At the end of the EMA centroid The update process satisfies the formula: (5) In the formula, For category c In training rounds t The centroid of the EMA obtained at the end of -1; These are weight parameters; Step S3.4: After each round of training for the current task, based on the current centroid... Initial centroid The previous EMA centroid The formula for calculating the two types of centroid drift is as follows: (6) In the formula, Representative category c The EMA drift between the current training round and the previous training round. Representative category c The historical drift of the current training round from the initial centroid at the start of the current task; Step S3.5: Linearly fuse the EMA drift and the historical drift to obtain the comprehensive drift amplitude. The calculation formula is as follows: (7) In the formula, λ Used to balance the effects of "short-term drift between two adjacent rounds" and "long-term drift relative to the initial centroid of the mission"; Step S3.6: Normalize the overall drift magnitude of all old categories in the same round to obtain the normalized drift score in the [0,1] interval. Its formula is: (8) In the formula, ε To prevent extremely small constants with a denominator of zero; C old A set of categories consisting of historical tasks; Step S3.7: Maintain a sliding window of length L for each old category, record the normalized drift scores obtained from the most recent L training rounds, and calculate their arithmetic mean as the final drift score for that category in the current task. S c Its formula is: (9) In the formula, For category c exist The overall drift amplitude obtained at each moment; Step S3.8, assign the final drift score S c Normalized to a probability distribution, it serves as the replay priority weight for each old category; under the constraint of a limited replay sample budget, more replay opportunities are allocated to the old category with higher drift scores according to the aforementioned priority weight; Step S4: Analyze the challenges faced by the random incremental learning scenario and introduce a rebalancing strategy at the "class-domain" granularity. Step S5: Train and evaluate the incremental classifier based on the accurate replay strategy and the rebalancing strategy.

2. The incremental learning method for class-domain granularity random partitioning scenarios according to claim 1, characterized in that, Step S2 specifically includes: Step S2.1: Construct an image encoding network based on a visual self-attention mechanism as a feature extraction network to extract features from the input image and output a fixed-dimensional image feature vector; the feature extraction network includes a convolutional embedding layer, a multi-layer self-attention encoding layer, and a global feature aggregation layer; Step S2.2: Initialize the parameters of the feature extraction network, including loading parameters from the pre-trained model and initializing parameters based on a random distribution; Step S2.3: Construct an incremental classifier, set one or more classification nodes for the same semantic category, assign a weight vector and bias parameters to each classification node, and establish a mapping table between semantic categories and classification nodes; Step S2.4: Connect the output features of the feature extraction network to the incremental classifier so that the incremental classifier receives the image feature vector and completes multi-class prediction.

3. The incremental learning method for class-domain granularity random partitioning scenarios according to claim 1, characterized in that: Step S4 specifically includes: Step S4.1: At the beginning of each incremental task, count the number of samples for each semantic category and its corresponding domain in the current task training set, and construct a two-dimensional sample distribution for categories and domains. The current task training set contains... N j,k Each of the above units is a "class-domain" unit, and each unit corresponds to a combination of a category label and a domain label; Step S4.2: Based on the sample distribution, adaptively calculate the corresponding rebalancing weights according to the sample frequency in each "class-domain" unit. ω j,k Its formula is: (10) In the formula, β For smoothing hyperparameters; Step S4.3: Normalize and truncate the rebalancing weights, scaling all weights to an average value of 1 only on the "class-domain" units that actually appear in the current task, and setting a weight cap. ω max ,Right now: (11) In the formula, For all occurrences in the current task Y j,k The average value corresponding to the weights; These are the normalized rebalancing weights; Step S4.4: When training the incremental task, the loss function is weighted according to the combination of the category and domain to which the sample belongs, using the corresponding processed weights.

4. The incremental learning method for class-domain granularity random partitioning scenarios according to claim 1, characterized in that: Step S5 specifically includes: Step S5.1, in the n At the start of each incremental task, forward inference is first performed using the current model on the training set for that task, targeting the currently known set of categories. C cur Each category c Statistical analysis of its recognition accuracy Acc c n Current task sample ratio r c n and the cumulative sample proportion of all learned tasks r c all ; Step S5.2, set the accuracy threshold θ acc and sample proportion threshold θ task θ total When category c satisfy Acc c n < θ acc 、 r c n ≥ θ task and r c all ≥ θ total It is determined to be a category to be expanded and added to the set to be expanded. ; Step S5.3, for each Add a new classification node to the output layer of the current classification head, where for each category to be expanded... c Row with the original weight of the corresponding node and bias As initialization parameters for new nodes, the weight matrix and bias vector are expanded, and the mapping relationship between nodes and categories and the corresponding task timestamps are maintained internally. Step S5.4: The input sample is processed by a feature extraction network to obtain a feature vector. Then, the predicted score vector is output through the expanded classification head. For the same semantic category c The corresponding multiple output nodes are aggregated through a gating aggregation module to generate the final predicted score vector for that category. ; Step S5.5: After training of each category group is completed, the classification head parameters of the trained category group are saved as a distillation snapshot; when the subsequent incremental task involves the same category group again, the corresponding distillation snapshot is used as the teacher classification head, and distillation constraints are applied to the current expanded classification head.

5. The incremental learning method for class-domain granularity random partitioning scenarios according to claim 4, characterized in that: In step S5.2, the accuracy threshold θ acc The accuracy threshold is generated dynamically by using the difference between the average accuracy of each category in historical tasks and the accuracy of the current task. Different accuracy thresholds are adaptively set for each category, and the thresholds are non-linearly compressed and truncated to obtain an extended threshold specific to that category, which replaces a fixed global accuracy threshold.

6. The incremental learning method for class-domain granularity random partitioning scenarios according to claim 4, characterized in that: In step S5.4, the gated aggregation module uses logarithmic summation and exponential pooling to perform aggregation on the same semantic category. c Corresponding node index set L c The outputs of all nodes are aggregated, and the logarithmic summation exponential pooling equation is: (13) In the formula, For category c No. j The predicted score vector of each output node; For category The temperature parameters, and The system adaptively adjusts based on the cumulative number of samples for that category in historical data.

7. The incremental learning method for class-domain granularity random partitioning scenarios according to claim 4, characterized in that: In step S5.5, the distillation constraint specifically involves: when training the current task, inputting the same feature vector into the current expanded classifier head and the teacher classifier head respectively, and outputting the predicted score vector and the teacher predicted score; for the parts of each category involved in the current task that have not yet added nodes, calculating the relative entropy between the output of the current expanded classifier head and the teacher classifier head as the distillation loss, and weighting the distillation loss and the classification loss together to update the model parameters.

Citation Information

Patent Citations

  • Image incremental learning method based on dynamic correction vector

    CN111199242A

  • Meta-learning-based domain increment method

    CN112308211A