A method for continuous learning of reasonable forgetting of visual task knowledge in an open domain environment
By updating parameters using the parameter importance method and the Hessian matrix, and combining the multi-task loss function and the model alignment loss function, the problems of forgetting imbalance and resource waste in open domain environments are solved. This achieves a balance between the retention of knowledge from old tasks and the adaptation to new tasks, thereby improving the accuracy of image classification and the robustness of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUIZHOU UNIV
- Filing Date
- 2023-12-29
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies lack effective mechanisms for selectively forgetting old task knowledge that is no longer needed in open domain environments, leading to resource waste and uneven forgetting. They cannot effectively balance the retention and forgetting of new and old task knowledge, thus affecting the model's learning ability and accuracy.
We employ a parameter importance method and Hessian information matrix to update parameters, and combine a multi-task loss function and a model alignment loss function. By focusing on important parameters and balancing new and old task knowledge, we design a reasonable forgetting strategy and optimize parameter updates and loss functions to achieve reasonable forgetting and balance of knowledge.
It significantly improves image classification accuracy, reduces forgetting, achieves a balance between preserving knowledge from old tasks and adapting to new tasks, and enhances the model's classification ability and robustness in dynamic environments.
Smart Images

Figure CN117876765B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual task knowledge technology, and in particular to a continuous learning method for reasonably forgetting visual task knowledge in an open-domain environment. Background Technology
[0002] Continuous learning plays a crucial role in artificial intelligence, enabling models to flexibly adapt to changing environments and task requirements while maintaining efficiency and accuracy. However, existing methods have some drawbacks: (1) Difficulty in selective forgetting: Existing technologies lack effective mechanisms to selectively forget old task knowledge that is no longer needed, leading to a waste of resources; (2) Uneven forgetting: The forgetting process in existing technologies does not take into account the differences in importance between tasks, resulting in the premature forgetting of knowledge from some important tasks; (3) Over-retention of old tasks: Existing technologies may over-retain knowledge from old tasks, leading to a waste of memory resources and limiting the ability to learn new tasks; (4) Balancing new and old knowledge: Existing technologies fail to effectively balance the retention and forgetting of knowledge from new and old tasks, resulting in an overemphasis on new tasks while neglecting the importance of old tasks. Summary of the Invention
[0003] This invention aims to at least solve the technical problems existing in the prior art, and in particular, it innovatively proposes a continuous learning method for reasonably forgetting visual task knowledge in an open domain environment.
[0004] To achieve the above-mentioned objectives of this invention, this invention provides a method for continuous learning in an open-domain environment that allows for the reasonable forgetting of visual task knowledge, comprising the following steps:
[0005] S1, The preprocessed image is fed into the image classification network model for visual feature extraction;
[0006] S2, execute step S3 and / or step S4;
[0007] S3, using the parameter importance method and the Hessian information matrix to update parameters to extract and update important information;
[0008] S4 utilizes the designed multi-task loss function and model alignment loss function to balance knowledge from new and old tasks.
[0009] Step S3, focusing on parameter importance, affects the model's parameter updates, while step S4, balancing and adapting to new task knowledge, affects the task's output. Step S3 focuses on and retains important parameters, thus achieving reasonable knowledge forgetting. Step S4 balances knowledge (preventing old task knowledge from being overwritten by the new task and the loss of important knowledge for the new task) and makes it better suited for learning new tasks. Therefore, jointly training the image classification model using steps S3 and S4 enables the model to achieve good image classification accuracy and low forgetting rate.
[0010] Furthermore, S3 includes the following steps:
[0011] S3-1, Calculation of parameter importance: Calculate the ratio between the norm of the parameter gradient and the norm of the parameter itself, and then normalize it to determine the degree of influence of each parameter on model training, thereby obtaining the importance of the parameter;
[0012] S3-2, Parameter Update: This section optimizes the parameter adjustment method by considering information from the Hessian matrix to adjust the parameter gradient. The goal is to adjust the gradient update by considering gradient information from previous tasks during the parameter update process. Simultaneously, it considers the cumulative impact of all old tasks to prevent the gradient of the new task from completely overwriting the knowledge of the old tasks, ensuring that the knowledge of the old tasks is not easily lost.
[0013] Furthermore, the calculation of the importance of the parameter includes:
[0014]
[0015] in This represents the parameter importance value of the i-th parameter required for model training;
[0016] Indicates taking The value with the largest ratio;
[0017] Represents the gradient norm of the parameters With parameter norm ||θ i The ratio of ||;
[0018] ||·|| represents the norm.
[0019] Furthermore, based on the important parameters selected according to their importance, a loss function with parameter importance penalty was designed.
[0020]
[0021] Where N is the number of training samples;
[0022] C is the number of categories;
[0023] (ys t ) i,j This means that only the parts relevant to the current task are considered in order to more accurately evaluate the model's performance on the current task.
[0024] f(x, θ) t ) i,j This represents the model output, where i and j are the indices of the training sample and the class, respectively.
[0025] α and β are both hyperparameters;
[0026] Let θ be the gradient of the parameter θ;
[0027] θ i The value of parameter θ;
[0028] Indicates taking The value with the largest ratio;
[0029] Represents the gradient norm of the parameters With parameter norm ||θ i The ratio of ||;
[0030] ||·|| represents the norm;
[0031] ||…|| F This represents the Frobenius norm.
[0032] Furthermore, the parameter update includes:
[0033]
[0034]
[0035] Among them, H θ It is the Hessian matrix, which measures the rate of change of the parameter gradient. It adjusts the direction and speed of the parameter gradient to ensure that knowledge of old tasks is not easily forgotten when learning new tasks.
[0036] This represents the gradient of parameter θ in the previous iteration;
[0037] This represents the gradient of parameter θ in this iteration;
[0038] The left side of equation (13) The gradient of the parameters after this iteration is given, and the right side of the equation is... This refers to the gradient of the parameters before this iteration update;
[0039] ∈ is a hyperparameter used to adjust small perturbations in the Hessian matrix to control the scale of regularization;
[0040] λ mas It is a hyperparameter (with a value of 0.3) used to ensure that the model takes into account the impact on old tasks when learning new tasks.
[0041] Furthermore, the multi-task loss includes any one or a combination of current task loss, adaptation loss, and task memory loss;
[0042] The formula for calculating the current task loss is as follows:
[0043]
[0044] in Indicates the current task loss;
[0045] (ys t ) i This indicates that only samples relevant to the current task will be considered;
[0046] N represents the number of training samples;
[0047] f(x,t) i Let y be the output of the i-th training sample of the neural network model, where x represents the input data, t is the current task number, representing the model's output under input data x and task t; and y is the true label, representing the true class of input data x.
[0048] s t This indicates the starting position of the category subset of the current task t, and is used to select the offset value of the subspace of the model output;
[0049] The formula for calculating adaptation loss is as follows:
[0050]
[0051] in Indicates adaptation loss;
[0052] N represents the number of training samples;
[0053] f(x) i This represents the model prediction output obtained after the i-th training sample in the input data x is propagated forward through the neural network.
[0054] The subscript i represents the i-th training sample;
[0055] The formula for calculating task memory loss is as follows:
[0056]
[0057] in, This indicates task memory loss;
[0058] T is the number of tasks;
[0059] t is the index of the task (1≤t≤T-1)
[0060] C is the number of categories;
[0061] one-hot(y t -s t ) c It is a one-hot encoded vector, which is a method of representing integer category labels as vectors, where only one element is 1 and the rest are 0;
[0062] y t It is the actual label on the past task t;
[0063] s t Indicates the starting position of the category subset of the current task t;
[0064] e represents the natural constant;
[0065] f(x,θ t ) c This represents the output of the model on task t of the c-th class in past tasks, which is achieved by using the parameters θ from the model f. t The predictions obtained from the input x; x is the input data, f represents the model, and θ is the input t. t The parameter represents the past task t.
[0066] Furthermore, the formula for calculating the alignment loss function is as follows:
[0067]
[0068] in, p represents the average class probability distribution of past tasks c Compared to an ideal uniform distribution q c Alignment loss function;
[0069]
[0070]
[0071] Where, p c (f,t,c) represents the average predicted probability of class c across all past tasks, which is the average prediction of class c across all past tasks;
[0072] T is the number of tasks;
[0073] N represents the number of training samples;
[0074] C is the number of categories;
[0075] s t Indicates the starting position of the category subset of the current task t;
[0076] e t This indicates the end position of the category subset of the current task t.
[0077] Furthermore, it also includes:
[0078] S5: Repeat steps S3 and / or S4 multiple times using datasets with different characteristics until the image classification network model fits.
[0079] In summary, by employing the above technical solution, this invention can better retain knowledge from old tasks while learning new tasks, significantly improving classification accuracy and effectively reducing forgetting. It achieves better retention of old knowledge while mastering new knowledge, thus maintaining strong classification capabilities and robust knowledge preservation in dynamic and constantly evolving environments. Specific advantages are as follows:
[0080] (1) Improved classification accuracy and reduced forgetting: This invention significantly improves the model classification performance in a multi-task continuous learning environment by designing a normalized parameter importance selection method and a penalized loss function, and by using a Hessian matrix to adjust parameter update strategy. Compared with existing technologies, it has made substantial progress in reducing knowledge forgetting and achieves “reasonable forgetting” of knowledge.
[0081] (2) Achieving a balance between preserving old knowledge and adapting to new tasks: Through the innovative design of the model alignment loss function and the multi-task loss function, this invention not only promotes knowledge transfer and sharing between new and old tasks, but also ensures that the model can better preserve knowledge of old tasks while learning new tasks, thus achieving the goal of balancing new and old knowledge.
[0082] (3) Innovative parameter importance calculation and optimization strategy: By designing a normalized parameter importance selection method and a loss function with parameter importance penalty, and combining Hessian matrix information for parameter update, this invention emphasizes the protection of key parameters in old tasks, optimizes task-specific training in a "reasonable forgetting" manner, improves model robustness and reduces the interference of new tasks on old knowledge.
[0083] (4) Enhanced performance of multi-task continuous learning: The method proposed in this invention takes into account the cumulative impact of each task. Through effective parameter updates and loss function design, the model can continuously improve its performance in a dynamically changing learning environment, enhance its ability to process new information in multi-task learning scenarios, and effectively control the information forgetting rate.
[0084] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0085] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0086] Figure 1 This is a flowchart of the reasonable forgetting process in continuous task learning of this invention.
[0087] Figure 2 This is a structural diagram of the strategy for overcoming catastrophic forgetting in continuous task adaptation according to the present invention.
[0088] Figure 3 This is a diagram illustrating how the accuracy of the first task changes as more tasks are learned.
[0089] Figure 4 This is a diagram illustrating the evolution of the test accuracy of the first task as more tasks are learned and each component is eliminated.
[0090] Figure 5 As more tasks are learned, L is eliminated. clt A diagram illustrating the change in test accuracy for the first task.
[0091] Figure 6 As more tasks are learned, L is eliminated. stb A diagram illustrating the change in test accuracy for the first task.
[0092] Figure 7 As more tasks are learned, L is eliminated. tml A diagram illustrating the change in test accuracy for the first task.
[0093] Figure 8 As more tasks are learned, L is eliminated. aml A diagram illustrating the change in test accuracy for the first task.
[0094] Figure 9 As more tasks are learned, H is eliminated. θ A diagram illustrating the change in test accuracy for the first task.
[0095] Figure 10 As more tasks are learned, L is eliminated. wip A diagram illustrating the change in test accuracy for the first task.
[0096] Figure 11 As more tasks are learned, L is eliminated.F A diagram illustrating the change in test accuracy for the first task. Detailed Implementation
[0097] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0098] The model of this invention is a deep learning model based on the PyTorch framework for solving image classification tasks in a continuous learning context. The image classification model uses a simplified ResNet18 as the backbone network. By training the image classification model using a proposed continuous learning method that reasonably forgets visual task knowledge in an open-domain environment, a better image classification model is obtained. The continuous learning method includes the following steps:
[0099] Step 1: Preprocess the images in the dataset, such as adjusting their resolution and size.
[0100] Step 2: The preprocessed image is fed into an image feature extractor for visual feature extraction.
[0101] Step 3: Generate an information heatmap using Grad-CAM and store it in contextual memory. After generating the heatmap using Grad-CAM, further work is done on the knowledge or features of the heatmap area.
[0102] Step 4: Use the parameter importance method, the loss function with parameter importance penalty, and the Hessian information matrix to update parameters to extract and update important information, thereby achieving "reasonable forgetting" of knowledge.
[0103] Step 5: Use the designed multi-task loss function (such as current task loss, adaptation loss and task memory loss) and model alignment loss function to achieve "balancing new and old task knowledge".
[0104] Step 6: Combine Step 4 and Step 5 to jointly train the model, thereby achieving better classification accuracy and lower forgetting rate.
[0105] Step 7: Repeat the above steps multiple times according to the characteristics of different datasets until the model fits and the optimal result is achieved.
[0106] 1. Problem Statement
[0107] Continuous learning can be viewed as an online supervised learning problem, where the model (i.e., the learner) self-regulates and updates itself based on existing knowledge and previous learning experience when it receives new data (i.e., new information or tasks). According to the learning protocol, given a sequence of tasks t = {1, 2, ..., T}, each task t... i Includes input data x i and the corresponding target y i That is, consider a training set D = {D1, D2, ..., Dt} consisting of t tasks. t},in Assume each sample (x) i ,y i (x) is an independent and identically distributed sample from a fixed probability P; each sample (x) i ,y i ) by eigenvector x i ∈X and target vector y i The goal is to learn an agent f: X → Y that can be queried at any time and predict the target y given the associated unseen input x and task t; this requires the learning agent to store only a small number of seen samples in its episodic memory; and to minimize the loss when learning a new task t. Simultaneously minimize the forgetting of previous tasks j (j < t). For task t, the objective can be expressed as:
[0108]
[0109] Here, θ are the model parameters for task t. It is the loss function of task t. This represents the introduced saliency memory mechanism, which allows the model to better understand the key parameters of each task, f(θ,θ). j The effect of model parameters θ on task j is measured, and λ and γ are the weights for balancing forgetting and learning new tasks.
[0110] 2. Solution
[0111] This section introduces a proposed method called SPIRF-CTA to address the catastrophic forgetting problem in continuous learning. It better balances new and old knowledge with reasonable forgetting, even when episodic memory stores only a small number of seen samples, allowing the model to better retain new knowledge while learning it. During parameter updates, we use information from the Hessian matrix to adjust the influence of parameter gradients, preventing the gradients of new tasks from completely overwriting the knowledge of old tasks, thus ensuring that knowledge from old tasks is not easily lost. Furthermore, to more comprehensively evaluate the contribution of parameters to the model's predictive ability, we introduce saliency memory (such as Grad-CAM) to highlight task-specific important information and use parameter gradients to evaluate parameter importance, thereby guiding parameter updates and adjustments. This allows the model to better adapt to the requirements and data characteristics of new tasks while retaining important knowledge from old tasks.
[0112] 3 Overall Structure
[0113] Our method, SPIRF-CTA, is as follows: Figure 1 As shown, this method improves memory efficiency by abstracting information and using the Hessian matrix for parameter updates and adjustments, retaining knowledge from previous tasks. It also identifies and focuses on the most important parameters for the current task through parameter importance calculation and loss functions, optimizing task-specific training to achieve "reasonable forgetting." Simultaneously, a multi-task loss function and a model alignment loss function are designed to balance knowledge from new and old tasks, thus mitigating "catastrophic forgetting." SPIRF-CTA draws on the memory pattern completion theory in cognitive neuroscience, proposing a continuous learning method that uses parameter importance selection and composite loss function training. This method reduces reliance on historical training samples by remembering interpretable abstractions of the task, thereby improving memory efficiency and achieving an effective balance between new and old task knowledge. On the one hand, we utilize information from the Hessian matrix for parameter updates and adjustments. By considering gradient information from previous tasks, we prevent the gradients of new tasks from completely overwriting the knowledge of old tasks, thus preserving the knowledge from older tasks. We employ normalized parameter importance selection and a loss function with parameter importance penalties to identify and prioritize the parameters most important to the current task, discarding less important parameters. This optimizes task-specific training, improves model accuracy and robustness, and addresses the problem of "reasonable forgetting." On the other hand, we also design multi-task loss functions and model alignment loss functions to balance new and old tasks and enhance the model's generalization ability and knowledge transfer, thereby mitigating "catastrophic forgetting."
[0114] To address the catastrophic forgetting problem in continuous learning, we propose a multi-task loss function and parameter update method. Figure 2 The overall framework diagram is provided, including the current task loss. Adaptation loss Task memory loss and alignment loss To adapt to the current task model and improve multi-task learning performance (revised to: enhance the model's adaptability to both new and old tasks and its multi-task performance), a Hessian gradient parameter update method was designed. By adjusting the gradient information during the parameter update process, this method prevents the gradient of the new task from completely overwriting the knowledge of the old task, ensuring that the knowledge of the old task is preserved. To balance the relationship between the old and new tasks, a model alignment loss function was designed. By leveraging the difference between the average class probability distribution of previous tasks and the model's output probability distribution on those tasks, the model generates similar class probability distributions across different tasks, achieving knowledge transfer and sharing and enhancing its generalization ability. Furthermore, we propose a loss function with parameter importance penalty. Importance of normalized parameters Choosing a method enables the model to identify and focus on the most important parameters in the current task, thereby optimizing task-specific training and improving the model's accuracy and robustness.
[0115] 4 Loss Function
[0116] 4.1 Current Task Losses
[0117] To measure the impact of knowledge from old tasks on knowledge for the current task, we use... This represents the model's loss on the current task *t*, measuring the difference between the model's predictions and the true label for the current task. It helps the model adapt to the requirements of different tasks while maintaining memory of previously learned tasks. This facilitates continuous performance improvement in multi-task environments and reduces forgetting of learned tasks. It calculates the cross-entropy loss between the part of the model's output relevant to the current task *t* and the true label. This part of the output is expressed through the offset value *s*. t and e t To determine this, so that losses are considered only for the parts relevant to the current task.
[0118]
[0119] Let f(x,t) represent the current task loss, and N represent the number of training samples. i Let be the output of the i-th training sample of the neural network model, where x represents the input data, t is the current task number, representing the model's output under input data x and task t; and y is the true label, representing the true class of input data x. t These represent the starting position of the category subset of the current task t, and are used to select the subspace of the model output; their purpose is to ensure that only the output relevant to the current task is considered.
[0120] 4.2 Adaptation Loss
[0121] To improve the model's performance on the current task, This is used to evaluate the model's performance on the current task. The model's prediction quality is measured by calculating the cross-entropy loss between the predictions and the true labels on the current task, allowing for the optimization of algorithms to update the neural network model's parameters to better adapt to the requirements of the current task and improve task performance.
[0122]
[0123] N represents the number of training samples, and f(x) is the model prediction output obtained after forward propagating the input data x through the neural network. It usually represents the model's processing and transformation of the input data x.
[0124] 4.3 Task memory loss
[0125] To prevent the model from forgetting knowledge of old tasks when learning new tasks, a task memory loss is introduced to help the model better retain knowledge of old tasks. For each previously observed task t, the input data M of task t is first retrieved from memory. t and the corresponding real label y t Then, the current model is used on the input data M. t Make predictions, but only consider a subset of output categories relevant to task t (by s) t and e t (Control). A prediction result is obtained. Next, the prediction result is compared with the true label y of task t. t The cross-entropy loss between tasks is used to measure the model's performance on task t. Finally, the cross-entropy losses from all previous tasks are accumulated to obtain the task memory loss. By incorporating the loss from previous tasks into the training of the current task, the model is encouraged to maintain good performance on previous tasks to avoid forgetting the ability to learn old tasks, which helps maintain the model's multi-task learning ability and memory performance. At the same time, it enables the model to continuously adapt to new tasks, and is forced to balance new and old tasks when learning new tasks, ensuring that knowledge of old tasks is retained, thus preventing forgetting and improving multi-task learning ability.
[0126] First, we designed a It is used to measure the performance of a model on past tasks, and its main goal is to measure the difference between the model's predictions and the actual labels.
[0127]
[0128] Where e represents the natural constant; f(x,θ)t ) c This represents the model's output (predicted output) on task t of the c-th class in past tasks. It is generated by model f using parameters θ. t The predictions obtained from the input x; x is the input data, f represents the model, and θ is the input t. t The parameters represent past task t, C is the number of categories, and y t It is the actual label on the past task t; one-hot (y t -s t ) c y is a one-hot encoded vector, a method of representing integer category labels as vectors where only one element is 1 and the rest are 0. Here, we use y t This represents the true class label of the past task t, which is used to select the predicted value corresponding to the actual label. Its formula expression is as follows:
[0129]
[0130] In obtaining Then, the average of the losses from all past tasks is taken to obtain...
[0131]
[0132] T is the number of tasks, t is the index of the task (1≤t≤T-1), and C is the number of categories. By averaging the losses from past tasks and adding them to the loss for the current task, its core objective is to ensure that the model does not lose knowledge of past tasks when learning new tasks. On the one hand, it encourages the model to learn new knowledge on new tasks because... It only applies to past tasks and does not negatively impact learning of new tasks. On the other hand, it ensures the model's performance stability on past tasks because knowledge from past tasks is preserved through regularization. Most importantly, this regularization method helps maintain the stability of model parameters, avoiding catastrophic forgetting caused by forgetting past tasks.
[0133] 4.4 Alignment Loss
[0134] To address the issues of models forgetting old tasks when learning new tasks and the need for the current task to better adapt to the model, an alignment loss was designed. Its design primarily considers the difference between the model's output probability distribution and the average class probability distribution on previous tasks, thereby enabling the model to achieve better classification performance while also retaining some knowledge from old tasks. Firstly, the average class probability distribution p from past tasks... c(f,t,c) is obtained by predicting from the memory data of previous tasks. This part of the prediction output is truncated, and only the part related to the current task is retained.
[0135]
[0136] f(x,θ) represents the model's predicted probability for class c on past task t; t The expression represents the model's output for class c on past task t. It is the model's prediction for past tasks. This represents the exponentially quantified score of the model output for the c-th category. This represents the sum of the exponentially normalized scores of the model outputs for all categories, used for normalization to ensure the sum of probabilities equals 1. This yields the results for each task. Then, the average of the past tasks is calculated to obtain p. c :
[0137]
[0138] p c This represents the average predicted probability of class c across all past tasks, which is the average prediction of class c across all past tasks.
[0139] To measure the differences in category distribution across different tasks, we designed an ideal uniform distribution in which all categories have equal probabilities.
[0140]
[0141] s t Indicates the starting position of the category subset of the current task t, e t This indicates the end position of the category subset for the current task t. For each category c, it calculates... With q c The KL divergence between the models is used to compare the similarity between the output distribution of the model on the current task t and the reference distribution on the previous task, and then the divergence values for all categories are summed.
[0142]
[0143] Specifically, it calculates the average class probability distribution p of past tasks. c Compared to an ideal uniform distribution q c The KL divergence is used to measure the difference in class distributions across different tasks. This is achieved by obtaining the class probability distribution of the model output for each past task and then averaging these distributions to obtain p. c Simultaneously calculate the ideal uniform distribution q c This indicates that the probability of each category is equal. By considering p...c and q c Sum of the KL divergences between them Its function is to enable the model to generate similar class probability distributions on different tasks, thereby improving knowledge transfer and sharing, enhancing the model's performance in multi-task learning, ensuring that knowledge from past tasks can be better applied to new tasks, and enhancing the model's generalization ability.
[0144] 4.5 Combined Loss
[0145] To comprehensively consider and balance the optimization objectives across different tasks, and to guide the model in parameter updates during multi-task learning, ensuring good performance on the current task without losing knowledge from past tasks, we combine the loss functions described above into a comprehensive loss function. It guides the updating of model parameters by weighing these different loss terms to achieve continuous learning across multiple tasks.
[0146]
[0147] in Indicates the current task loss;
[0148] Indicates adaptation loss;
[0149] This indicates task memory loss;
[0150] Indicates alignment loss;
[0151] λ mas This is a hyperparameter, set to 0.3 here, which serves to balance the different loss terms.
[0152] 5Hessian update parameters
[0153] When a model needs to learn a new task, it typically updates its parameters to adapt to the new task's data. However, such parameter updates may cause the model to forget its knowledge of previously learned tasks, leading to performance degradation. Therefore, we also designed a MAS regularization optimization method to adjust parameters. This method adjusts the parameter gradient by considering information from the Hessian matrix. The goal is to adjust the gradient update by considering the gradient information of previous task parameters during the parameter update process. At the same time, it considers the cumulative effect of all old tasks to prevent the gradient of the new task from completely overwriting the knowledge of the old tasks, ensuring that the knowledge of the old tasks is not easily lost.
[0154]
[0155]
[0156] Among them, the left side of the equation for The updated parameters, on the right side of the equation for Update the previous parameters. This represents the gradient of the parameter θ. H represents the gradient of parameter θ in the previous iteration (the gradient of the parameter in the previous iteration), ∈ is a hyperparameter used to adjust small perturbations of the Hessian matrix to control the scale of regularization. θ λ is the Hessian matrix, which measures the rate of change of the parameter gradient. It adjusts the direction and speed of the parameter gradient to ensure that knowledge from previous tasks is not easily forgotten when learning new tasks; mas Ensure that the model takes into account the impact on old tasks when learning new tasks.
[0157] To address the challenge of retaining prior knowledge while learning new tasks, we summarize our proposed method in Algorithm 1, based on the methods described above.
[0158]
[0159]
[0160] 6. Loss function with parameter importance penalty
[0161] In continuous learning, as new data arrives, the model needs to adapt to new knowledge and information, and the data distribution may change, rendering older features irrelevant or redundant. Calculating parameter importance helps us understand which parameters have a greater impact on the current task during continuous learning, identifying features that contribute significantly to target prediction, performing feature selection and dimensionality reduction, thereby guiding model updates and adjustments, and achieving effective and reasonable forgetting. This allows the model to better adapt to new task requirements and data characteristics, improving its accuracy and robustness. This section introduces a normalized parameter importance selection method and a loss function with parameter importance penalties. Calculating parameter importance helps the model identify and focus on the parameters most important for the current task, combined with the corresponding loss function to better optimize task-specific training.
[0162] 6.1 Parameter Importance Calculation
[0163] Given that gradients provide global information about the model and can capture complex nonlinear relationships, understanding how parameters influence the model's loss function throughout training and their interactions allows for a more comprehensive assessment of their contribution to the model's predictive ability. Here, we determine the importance of each parameter by calculating the ratio between the norm of its gradient and the norm of the parameter itself, followed by normalization.
[0164]
[0165] I i Indicates the importance of the i-th parameter (i.e. ), Let θ be the gradient of the parameter θ. i Let θ be the value of the parameter. Next, we find the maximum value among all the parameters of importance:
[0166]
[0167] Normalize the importance of each parameter to ensure they are in the range of 0 to 1, thus obtaining the value of the parameter importance we need.
[0168]
[0169] in This represents the parameter importance value of the i-th parameter required for model training;
[0170] Indicates taking The value with the largest ratio;
[0171] Represents the gradient norm of the parameters With parameter norm ||θ i The ratio of ||;
[0172] ||·|| represents the norm.
[0173] 6.2 Importance Penalty Loss Function
[0174] To enable the model to better adapt to new tasks without resisting knowledge from old tasks, we designed a penalized loss function based on the selected important parameters. This function combines classification performance and parameter importance, making the model focus more on parameters that are meaningful for the current task. At the same time, we added a regularization term to further control the complexity of the model and reduce overfitting.
[0175] First, a penalty term for the parameters is calculated to control the influence of the parameters and gradients on the model, resulting in:
[0176]
[0177] N is the number of training samples. To better measure model M... t To measure performance on classification tasks, we added cross-entropy loss to the loss function to evaluate model M. t The difference between the predicted output and the actual target.
[0178]
[0179] N is the number of training samples, C is the number of classes, (y i =j) represents y i The label value is the probability value of j, and y is the probability value of j. i It is sample x i The actual category label. p(y) i =j|x i ) is the model for sample x i Predict the probability of class yi. (The last part, "Ω", appears to be a typo and can be left as is i and Combine with a loss function with a penalty term Where α is a hyperparameter (taken as 0.1 here), used to balance the relative effects of parameter penalty and difference loss.
[0180]
[0181] in Let represent the penalized loss function; based on the above description, to prevent overfitting, we... Regularization loss was added to obtain a penalty loss function with parameter importance. It introduces a regularization term and weights the parameters according to their importance, while also performing a weighted summation based on the Frobenius norm of the parameters. This allows for control over parameter size, ensuring that in multi-task learning, the model can quickly adapt to the demands of new tasks while retaining useful information from previous tasks, thus balancing model performance and generalization ability. This is achieved through a loss function with parameter penalties. Regularization was added, resulting in a loss function with parameter importance penalty.
[0182]
[0183] exist In this context, N represents the model parameters, β is the hyperparameter (with a value of 0.02), ||…|| F This represents the Frobenius norm.
[0184] To demonstrate the effectiveness of the method of the present invention, comparative experiments were conducted based on the method of the present invention:
[0185] (1) Environment setup: Our experiment was conducted in the following environment: Intel(R) Core(TM) i9-12900KF CPU; 64GB memory; NVIDIA GeForce RTX 3090Ti GPU and Ubuntu 22.04; Python 3.8.16 and torch1.13.0+cu116.
[0186] (2) Dataset
[0187] CIFAR-10 consists of 50,000 RGB training images and 10,000 test images, with a total of 10 object classes. We set it up as 5 tasks, each containing two classes, with an image size of 32×32.
[0188] Split CIFAR-100 involves splitting the original CIFAR-100 dataset into 20 disjoint subsets, each treated as a separate task. Each task has 5 classes, randomly sampled from a total of 100 classes without replacement. We set up 20 tasks, each containing 5 classes, with an image size of 32×32.
[0189] Similar to Split CIFAR, Split mini-ImageNet is built by splitting miniImageNet, a subset of ImageNet with 100 classes and 600 images per class, into 20 disjoint subsets. We set it to 20 tasks, each containing 5 classes, with an image size of 84×84.
[0190] (3) Implementation details
[0191] We evaluate our method on the widely used benchmark datasets Split CIFAR-10, Split CIFAR-100, and Split mini-ImageNet for continuous learning tasks, and compare it with previous methods such as EWC, LwF, iCaRL, GEM, ER, MER, EBM, EEC, and SAMC. For a fair comparison, we reimplement EWC, GEM, and SAMC. We also analyze the experimental results of our proposed method through ablation experiments. The model code is implemented based on the PyTorch framework, using a simplified ResNet18 as the backbone network. We set the training iterations (epoches) to 1, the number of stored memory samples to 10, the memory strength ε to 0.5, and the threshold used for model updates. The learning rate is 0.6. We set the learning rates to 0.0027, 0.004, and 0.002 on the benchmark datasets SplitCIFAR-10, Split CIFAR-100, and Split mini-ImageNet, respectively.
[0192] (4) Comparison Methods
[0193] Finetune, a popular baseline, is trained naively on a stream of data.
[0194] EWC, a regularization-based approach, avoids catastrophic forgetting during the learning process by limiting the learning of parameters that are critical to the performance of past tasks, as calculated by the Fisher information matrix.
[0195] LwF, a method based on regularized CNNs, trains the network using only new task data (without using old data) while maintaining its ability to handle the original task.
[0196] iCaRL is a class incremental learner that uses the nearest sample algorithm for classification, employs the nearest exemplar algorithm for classification, and prevents catastrophic forgetting by using episodic memory.
[0197] GEM, a replay method based on parametric gradient contextual memory, can alleviate catastrophic forgetting while allowing knowledge to be beneficially transferred to previous tasks.
[0198] ER, a simple competitive empirical method based on reservoir sampling, stores a small number of examples from previous tasks and then replays these examples while training for future tasks. It empirically analyzes the effectiveness of storing a very small number of episodes in the memory within a continuous learning setting, where each training example is seen only once.
[0199] MER, a replay method inspired by meta-learning, combines experience replay with optimization-based meta-learning. This method learns parameters that are unlikely to interfere with future gradients and then transfers these parameters based on those future gradients.
[0200] EBM, an energy-based continuous learning method, does not address the continuous learning problem by using external memory, growth models, or regularization. Instead, it changes the basic training objective to reduce interference with previously trained learning information.
[0201] EEC, an autoencoder-based generative approach, proposes a neural style transfer method for encoding and storing images. During training on a new task, to avoid catastrophic forgetting, images reconstructed from the encoded fragments are replayed. The loss function for the reconstructed images is weighted to reduce their impact during classifier training in response to image degradation.
[0202] SAMC is a saliency-enhanced memory completion method based on continuous learning. It proposes storing the most task-relevant parts of an image in episodic memory through saliency map extraction and memory encoding. When learning a new task, previous data from memory is repaired by an adaptive data generation module whose parameters are shared across all tasks and can be jointly trained with a continuous learning classifier as a two-layer optimization.
[0203] (5) Performance metrics
[0204] We evaluate the performance of all methods using classification accuracy (ACC). To avoid the impact of randomness in neural network training on overall performance, we run all experiments five times randomly and report the average performance. We also report back transfer, i.e., using back-weighted transfer (BWT) to measure the impact of new learning on past knowledge, which is the effect of learning task t on the performance of the previous task k < t. Large negative back transfers are also known as (catastrophic) forgetting. Negative BWT indicates knowledge forgetting, so the larger the better. In addition, to better demonstrate the contribution of our proposed method to the overall performance, we also conducted ablation experiments.
[0205] (6) Comparison Results
[0206] (6.1) The degree of knowledge forgetting (BWT)
[0207] We used three commonly used image classification datasets—Split CIFAR-10, Split CIFAR-100, and Split mini-ImageNet—as our experimental benchmarks. The forgetting factor (BWT) of each method was evaluated by calculating the mean and standard deviation. The experimental results are shown in Table 2.
[0208] Based on the experimental results in Table 2, our method, SPIRF-CTA, exhibits the best performance on the Split CIFAR-10 dataset, with a BWT of -3.54%, which is 3.39% better than the best result among the other comparative methods. The BWT values of the other methods range from -17.91% to -6.93%. Furthermore, the standard deviation of our method's BWT value is relatively low at 0.86, indicating that our method has good forgetting control capabilities.
[0209] On the Split CIFAR-100 dataset, our method demonstrates a significant advantage over other methods. Our SPIRF-CTA method achieves a BWT of -8.06% on the Split CIFAR-100 dataset, a 1.68% improvement over the best-performing comparison methods, which range from -17.36% to -9.74%. Furthermore, our method's BWT standard deviation is 0.45, further demonstrating its stability in controlling for forgetting levels.
[0210] Similar to the previous two datasets, on the Split mini-ImageNet dataset, our method SPIRF-CTA also achieved the best BWT value of -5.28% compared to other contrasting methods, a 2.57% improvement. The BWT values of other methods ranged from -16.40% to -7.85%. This result further validates the effectiveness and superiority of our method in controlling for forgetting. The standard deviation of the BWT value for SPIRF-CTA is 1.08, indicating its relatively stable performance.
[0211] Table 2: Average forgetting rate (%) of the image classification dataset. The mean and standard deviation were calculated over five randomized runs. Episodic memory included 10 samples per task. (*) indicates our method for reproducing the original paper; This indicates that we are referencing results from SAMC.
[0212]
[0213] Based on the experimental results analyzed above, our method SPIRF-CTA exhibits low forgetting levels (BWT values) and good stability on the Split CIFAR-10, Split CIFAR-100, and Split mini-ImageNet datasets. Compared to other methods, our SPIRF-CTA demonstrates better forgetting control across different datasets.
[0214] (6.2) Image classification accuracy (ACC)
[0215] We used three commonly used image classification datasets—Split CIFAR-10, Split CIFAR-100, and Split mini-ImageNet—as our experimental benchmarks. The classification accuracy of each method was evaluated by calculating the mean and standard deviation. The experimental results are shown in Table 1.
[0216] On the Split CIFAR-10 dataset, according to the experimental results in Table 1, our method SPIRF-CTA exhibits the highest classification accuracy, reaching 77.02%, while the classification accuracy of other comparative methods ranges from 63.24% to 73.48%. This represents a 3.54% improvement over the best method, EEC, and a 3.6% improvement over the SAMC method. Furthermore, the standard deviation of the classification accuracy of our method, SPIRF-CTA, is relatively low at 1.73, indicating that our method possesses relatively good stability.
[0217] On the Split CIFAR-100 dataset, our method SPIRF-CTA also achieved the highest classification accuracy of 59.76%, while the classification accuracies of other comparative methods ranged from 41.06% to 55.36%. Compared with other methods, our method SPIRF-CTA showed a significant advantage on this dataset, improving the performance by 4.4% over the best-performing method SAMC. Furthermore, the standard deviation of SPIRF-CTA was 0.95, further demonstrating its stability.
[0218] Similar to the previous two datasets, on the Split mini-ImageNet dataset, our method SPIRF-CTA also achieved the highest classification accuracy of 47.32%, while the classification accuracy of other comparison methods ranged from 33.31% to 43.96%. Our method outperformed the best method, SAMC, by 3.36%. This result further validates the effectiveness and superiority of our method. The standard deviation of the SPIRF-CTA method is 1.33, indicating its relatively stable performance.
[0219] Table 1: Average accuracy (%) of the image classification dataset. The mean and standard deviation were calculated over five random runs. Episodic memory samples were used with 10 samples per task. (*) indicates our method for reproducing the original paper; This indicates that we are referencing results from SAMC.
[0220]
[0221] Based on experimental results, our proprietary method, SPIRF-CTA, demonstrates high classification accuracy and good stability on the Split CIFAR-10, Split CIFAR-100, and Split mini-ImageNet datasets. Figure 3The results show the evolution of the test accuracy on the first task as more learning tasks are added, demonstrating that our method, SPIRF-CTA, outperforms EWC, GEM, and SAMC. Compared to other methods, our method exhibits significant advantages in computer-based continuous learning image classification tasks, demonstrating considerable application potential and research value. Furthermore, our method achieves high classification accuracy and relatively stable performance on all three datasets, further proving its applicability across different tasks and datasets.
[0222] (7) Ablation test
[0223] Table 3 shows the average accuracy (%) of the image classification dataset after removing different components. The mean and standard deviation were calculated over five random runs. Episodic memory samples were used with 10 samples per task.
[0224]
[0225]
[0226] To verify the role and importance of different components, we conducted ablation experiments. These components included L... clt L stb L tml L aml H θ L wip (Include ) and L F Our goal is to investigate the impact of these components on mean accuracy (%) and mean forgetting (%) on the SplitCIFAR-10, Split CIFAR-100, and Split mini-ImageNet datasets by progressively eliminating them, and to reveal their importance in terms of model performance and knowledge retention. We will combine the experimental results for classification accuracy in Table 3 and forgetting in Table 4 for our ablation experiment analysis.
[0227] Table 4 shows the average forgetting rate (%) of the image classification dataset after removing different components. The mean and standard deviation were calculated over five random runs. Episodic memory samples were used for each task.
[0228]
[0229] exist Figure 4 In the figure, we show the changes in classification accuracy for the first task when different components are eliminated. This figure provides a more intuitive view of the impact of different components on the model, and our method, SPIRF-CTA, perfectly fits all the results after eliminating different components, demonstrating that our method, SPIRF-CTA, has good overall performance.
[0230] (7.1) Current task loss L clt Impact Analysis
[0231] Eliminate L clt This leads to a decrease in accuracy across all three datasets and increases the degree of forgetting on Split CIFAR-10 and Splitmini-ImageNet. This indicates that while it plays a role in retaining knowledge from older tasks, eliminating it makes the model prone to forgetting information from those tasks, thus also reducing the model's performance on the current task.
[0232] Specific experimental results show that on the Split CIFAR-10 dataset, the average classification accuracy decreased by approximately 1.47%, while the forgetting rate improved by 0.33%, indicating a slight improvement. On the Split CIFAR-100 dataset, the average classification accuracy decreased by approximately 1.51%, but the forgetting rate improved by an average of 1.82%. On the Split mini-ImageNet dataset, the average classification accuracy decreased by approximately 1.84%, but the forgetting rate improved by 0.71%.
[0233] exist Figure 5 From this, we can see that eliminating L clt At that time, the overall classification accuracy of the first task was lower than that of our method, SPIRF-CTA. Overall, eliminating L... clt This will reduce the accuracy of image classification and increase the degree of forgetting. However, L clt It played a crucial role in preserving knowledge from past missions by retaining L clt It can improve the performance of the current task on the model and reduce the forgetting of old tasks.
[0234] (7.2) Adaptation loss L stb Impact Analysis
[0235] On the Split CIFAR-10 dataset, eliminate L stb The impact on average image classification accuracy is significant, decreasing by 1.45%. However, the impact is even greater on the Split mini-ImageNet and Split CIFAR-100 datasets, eliminating L... stb This resulted in a 2.53% and 2.02% decrease in average accuracy scores, which may be due to L. stb On this dataset, it plays a more significant role in improving model performance. It has a significant effect on reducing knowledge forgetting, and compared to SPIRF-CTA, eliminating L... stbThe knowledge forgetting rate was improved by 0.69%, 2.23%, and 1.17% on the Split CIFAR-10, Split CIFAR-100, and Split mini-ImageNet datasets, respectively. Figure 6 Looking at the evolution of task classification accuracy presented in the data, eliminating L... stb At that time, the classification accuracy fluctuated significantly, exhibiting poor stability and overall performance worse than SPIRF-CTA. This demonstrates that with larger and more complex datasets, L... stb It can better improve the performance of the model, making it more adaptable to the current task and effectively improve the model's performance on the current task; at the same time, it can better retain and use the knowledge of the old task and reduce the forgetting of knowledge.
[0236] (7.3) Task memory loss L tml Impact Analysis
[0237] Compared to our method SPIRF-CTA, on Split CIFAR-10, L is eliminated. tml This leads to a 1.45% decrease in classification accuracy and a 0.79% increase in knowledge forgetting. On the Split CIFAR-100 and Splitmini-ImageNet datasets, eliminating L... tml This also leads to a decrease in accuracy, by 0.82% and 0.96% respectively. On the Split CIFAR-100 dataset, the forgetting rate improved by 0.94%, and on the Split mini-ImageNet dataset, the forgetting rate decreased by 0.35%. This indicates that L tml On all the above datasets, it plays a role in improving the performance of the current task and preserving knowledge from older tasks. It has a particularly positive impact on smaller datasets, improving classification accuracy and reducing knowledge forgetting; however, compared to larger datasets like Split CIFAR-100 and Split mini-ImageNet, the performance improvement may be due to the current task's loss L... clt and adaptation loss L stb Only after the impact of the loss is diminished does L seem to disappear. tml The impact on accuracy and the degree of forgetting is relatively small. From Figure 7 The elimination of L shown in the middle tml Considering the overall impact of the model on the classification accuracy of the first task, L tml It can help improve the performance of the model when it learns new tasks.
[0238] (7.4) Alignment loss L aml Impact Analysis
[0239] On the Split CIFAR-10 dataset, eliminate Laml This resulted in a 1.43% decrease in average classification accuracy, while the average level of forgetting increased by 1.38%. This indicates that L aml It plays a positive role in reducing the degree of forgetting and has a certain positive impact on model performance. On the Split CIFAR-100 dataset, eliminating L... aml This resulted in a 1.99% decrease in accuracy, while the average degree of forgetting increased by 2.81%. This indicates that L aml It effectively preserves knowledge from previous tasks, playing a crucial role in reducing forgetting and significantly impacting accuracy, thus positively affecting the model's performance. On the Split mini-ImageNet dataset, eliminating L... aml This resulted in a 1.68% decrease in accuracy, while the average rate of forgetting increased by 1.11%; it increased the rate of knowledge forgetting, indicating that L aml It plays a positive role in reducing the degree of forgetting and has a significant impact on accuracy, thus improving the model's classification performance. Compared with our method SPIRF-CTA, L... aml It can significantly improve the model's ability to retain knowledge from previous tasks, effectively improve classification accuracy, and greatly enhance overall performance. It demonstrates good generalization ability across all datasets. Figure 8 It can also be seen from this that eliminating L aml It has a significant impact on classification accuracy. Combined with the experimental results in Tables 3 and 4, it proves that L aml It plays an important role in improving the robustness and generalization of the model.
[0240] (7.5)H θ Impact analysis of updated parameters
[0241] On the Split CIFAR-10 dataset, eliminate H θ This resulted in a decrease in average accuracy of approximately 1.69%, while the average forgetting rate increased by 0.35%; on the Split CIFAR-100 dataset, eliminating H... θ This resulted in a 1.6% decrease in average accuracy and a 0.95% increase in average forgetting rate; on the Split mini-ImageNet dataset, eliminating H... θ This resulted in a 1.68% decrease in average accuracy and a 0.05% increase in average forgetting. This indicates that H θ This plays a crucial role in preventing the gradients of new tasks from completely overwriting the knowledge of old tasks, ensuring that knowledge from old tasks is not easily lost. Furthermore, this demonstrates the effectiveness of loss functions with parameter importance, such as L... wip and L amlUnder the influence of the loss function, updating parameters using the Hessian matrix plays a role in reducing the degree of forgetting; and it has a significant impact on accuracy, proving that parameter updates are geared towards adapting to the new task. Furthermore, updating parameters has a positive effect on retaining information from the old task parameters. Figure 9 As can be seen, with the increase of the number of tasks, updating the parameters of the Hessian matrix can enable the model to retain better information and improve the model's performance.
[0242] (7.6) Importance with parameters loss L wip Impact Analysis
[0243] On the Split CIFAR-10 dataset, eliminate L wip This resulted in a 2.03% decrease in average accuracy and a 1.37% increase in average forgetting rate. This indicates that on the Split CIFAR-10 dataset, L... wip It plays a role in balancing the model's adaptation to the current task and the retention of knowledge from previous tasks. Eliminating it increases the risk of performance loss and knowledge forgetting when the model adapts to new tasks. On the Split CIFAR-100 dataset, eliminating L... wip This resulted in a 1.75% decrease in average accuracy and a 0.5% increase in average forgetting rate; on the Split mini-ImageNet dataset, eliminating L... wip This resulted in a 1.97% decrease in average accuracy and a 0.49% increase in average forgetting rate. This indicates that on larger datasets, L... wip The balancing model plays a crucial role in adapting to the current task. Under the influence of other loss functions, eliminating L... wip The increased forgetting rate of model knowledge demonstrates the success of our parameter importance selection. It effectively extracts and retains important parameters, allowing old task knowledge to adapt well to training on new tasks while also protecting it from being forgotten. Figure 10 The graph showing the evolution of task accuracy shows that incorporating the selection of important parameters can effectively improve the classification performance of the task.
[0244] (7.7) Regularization term loss function L F Impact Analysis
[0245] Compared to our method SPIRF-CTA, on the Split CIFAR-10 dataset, eliminating L... F This resulted in a 1.03% decrease in average classification accuracy, while the average forgetting rate increased by 0.4%; on the Split CIFAR-100 dataset, eliminating L... FThis resulted in a decrease in average classification accuracy of approximately 1.05%, while the average forgetting rate increased by 1.09%; on the Split mini-ImageNet dataset, eliminating L... F This resulted in a 0.91% decrease in average classification accuracy, while the average level of forgetting increased by 0.62%. F While it plays a role in controlling parameter size and preventing overfitting, eliminating it may lead to decreased model performance and increased risk of overfitting. This is particularly true on the Split CIFAR-100 dataset. F It makes a good contribution to both the retention of old knowledge in the model and the classification performance of the model. Figure 11 As can be seen, the classification accuracy evolves relatively smoothly with the arrival of new tasks. Adding regularization loss can improve the performance of the model and prevent overfitting.
[0246] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A continuous learning method for reasonably forgetting visual task knowledge in an open-domain environment, characterized in that, Includes the following steps: S1, The preprocessed image is fed into the image classification network model for visual feature extraction; S2, execute step S3 and / or step S4; S3, using the parameter importance method and the Hessian information matrix to update parameters to extract and update important information; S4, using the designed multi-task loss function and model alignment loss function to balance knowledge of new and old tasks; Step S3 includes the following steps: S3-1, Calculation of parameter importance: Calculate the ratio between the norm of the parameter gradient and the norm of the parameter itself, and then normalize it to determine the degree of influence of each parameter on model training, thereby obtaining the importance of the parameter; S3-2, Parameter Update: The method of adjusting parameters is optimized by considering the information of the Hessian matrix to adjust the parameter gradient; Based on the important parameters selected according to their importance, a loss function with parameter importance penalty was designed. : , in, The number of training samples; It is the number of categories; This indicates that only the parts relevant to the current task will be considered; Indicates the model output, These are the indices of the training samples and the categories, respectively. , All are hyperparameters; For parameters The gradient; For parameters The value; Indicates taking The value with the largest ratio; Represents the gradient norm of the parameters With parameter norm The ratio; Represents the norm; Denotes the Frobenius norm; The parameter update includes: , , in, It is the Hessian matrix, which measures the rate of change of the parameter gradient. It adjusts the direction and speed of the parameter gradient to ensure that knowledge of old tasks is not easily forgotten when learning new tasks. Indicates parameters The gradient of the previous iteration; Indicates parameters The gradient of this iteration; The left side of equation (13) The gradient of the parameters after this iteration is given, and the right side of the equation is... This refers to the gradient of the parameters before this iteration update; It is a hyperparameter used to adjust small perturbations in the Hessian matrix to control the scale of regularization; These are hyperparameters used to ensure that the model takes into account the impact on old tasks when learning new tasks.
2. The continuous learning method for reasonably forgetting visual task knowledge in an open domain environment according to claim 1, characterized in that, The calculation of the importance of the parameters includes: , in The first step required for model training The importance values of each parameter; Indicates taking The value with the largest ratio; Represents the gradient norm of the parameters With parameter norm The ratio; Represents the norm.
3. The continuous learning method for reasonably forgetting visual task knowledge in an open domain environment according to claim 1, characterized in that, The multi-task loss includes any one or a combination of current task loss, adaptation loss, and task memory loss; The formula for calculating the current task loss is as follows: , in Indicates the current task loss; This indicates that only samples relevant to the current task will be considered; Indicates the number of training samples; For the neural network model The output of each training sample Indicates input data, It is the current task number, which indicates the model's position on the input data. and tasks The output below; These are real labels, representing the input data. The true category; Indicates the current task The starting position of the category subset is used to select the offset value of the subspace of the model output; The formula for calculating adaptation loss is as follows: , in Indicates adaptation loss; Indicates the number of training samples; Indicates input data The Middle The model prediction output is obtained by forward propagating a training sample through a neural network. Subscript Indicates the first One training sample; The formula for calculating task memory loss is as follows: , in, This indicates task memory loss; It refers to the number of tasks; It is the index of the task ( ) It is the number of categories; It is a one-hot encoded vector, which is a method of representing integer category labels as vectors, where only one element is 1 and the rest are 0; It is a past task The actual label on; Indicates the current task The starting position of the category subset; Represents the natural constant; The model represents the first time in past tasks. Tasks in each category The output is obtained through the model. Use parameters In the input The predictions were obtained from the above. It is the input data. Representation model, Indicates past tasks The parameters.
4. The continuous learning method for reasonably forgetting visual task knowledge in an open domain environment according to claim 1, characterized in that, The alignment loss function is calculated using the following formula: , in, Represents the average class probability distribution of past tasks Compared to an ideal uniform distribution Alignment loss function; , , in, Represents the categories in all past tasks The average predicted probability is the probability of class over all past tasks. The predicted average; It refers to the number of tasks; Indicates the number of training samples; It is the number of categories; Indicates the current task The starting position of the category subset; Indicates the current task The ending position of the category subset.
5. The continuous learning method for reasonably forgetting visual task knowledge in an open domain environment according to claim 1, characterized in that, Also includes: S5: Repeat steps S3 and / or S4 multiple times using datasets with different characteristics until the image classification network model fits.