Image classification method based on continuous learning of constrained parameter paths

Through a continuous learning method based on parameter paths, using Riemann stochastic gradient descent and constrained path optimization algorithm DCD and memory balance strategy Recall, the problem that deep learning models are difficult to maintain old tasks in the real world is solved, and balanced learning between new and old tasks is achieved, reducing forgetting and computing consumption.

CN116310478BActive Publication Date: 2025-09-02UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211502674.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2025-09-02
Estimated Expiration
2042-11-28

AI Technical Summary

Technical Problem

Existing deep learning models are difficult to keep old tasks remembered in real-world dynamic environments while learning new tasks, resulting in catastrophic forgetting and stability and plasticity dilemma.

Method used

The continuous learning method based on parameter paths is adopted to calculate the low forgetting direction through Riemann stochastic gradient descent algorithm, and combined with the model optimization algorithm DCD of the constrained path and the memory balance strategy Recall, the parameter update process of the image classification model is optimized, and the old task is kept remembered and the learning of new and old tasks is balanced.

Benefits of technology

It effectively reduces the model's forgetting of old tasks, achieves a good balance between classification stability and plasticity, and reduces the linear increase in computing and storage consumption with the increase of tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116310478B_ABST
    Figure CN116310478B_ABST
Patent Text Reader

Abstract

The present invention provides an image classification method based on continuous learning of constrained parameter paths, by constructing an image classification model based on parameter paths; learning the parameter offset between new and old image classification tasks during training, and pre-solving a low-forgetting direction by using a spherical optimization method; using a direction-constrained descent optimizer when learning a new image classification task to make the current path consistent with the low-forgetting direction; and finally backtracking along the path through a post-processing strategy Recall to finally determine the parameters of the image classification model for the new task. The present invention uses spherical optimization to obtain the low-forgetting direction of the previous image classification task, and constrains the path between tasks to be consistent with the direction, while using the learned coefficients to scale the path to achieve a balance between the new and old tasks. The image classification model of the present invention has the characteristics of low forgetting, balanced stability and plasticity when learning parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an image classification technology based on machine learning, and in particular to a constrained learning technology in a continuous learning (CL) scenario. Background Art

[0002] With the continuous advancement of deep learning in recent years, a variety of intelligent applications have emerged in our daily lives, such as facial recognition, autonomous driving, and companion robots. However, the ever-changing dynamic environments of real-world scenarios pose numerous challenges to traditional static deep learning-based image classification models, including poor generalization, perception of unknown categories, and continuous knowledge expansion. Image classification models in real-world applications must continuously learn new task sequences while retaining their memory of previous tasks. Due to the greedy nature of learning algorithms, applying existing deep learning models to these scenarios often results in a significant degradation in performance on previous tasks, a phenomenon known as catastrophic forgetting. On the other hand, blindly maintaining performance on previous tasks can lead to an inability to learn new ones, a phenomenon known as the stability and plasticity dilemma. Therefore, to enable image classification models in real-world scenarios to continuously learn, we need to maintain memory of previous tasks while simultaneously learning new ones.

[0003] Current continuous learning algorithms can generally be divided into three parts: 1. Model, which is required to incrementally learn new tasks and maintain previous memories. Most existing methods follow the paradigm of fine-tuning the current task using the previously learned model as the starting point. The previously learned model encodes a wealth of knowledge about old tasks, and directly fine-tuning on it will overwrite the original memory. 2. Optimizer, which is used to update the parameters of the model to minimize training loss. Commonly used optimizers include: SGD and Adam. However, typical optimizers will greedily learn the current task to the point of completely forgetting the previous task. And existing research has shown that weight decay in SGD will affect the performance of continuous learning. 3. Anti-forgetting techniques, which mainly include three categories: regularization-based methods constrain changes to important parameters of old tasks. These methods rely on local approximations around the optimal point and can still cause significant forgetting when encountering task sequences with large distribution shifts; storage-based methods store partial data from old tasks and replay them in subsequent tasks. Due to the large difference between the amount of stored data and the current task data, these methods are prone to overfitting the stored data; dynamic network structure-based methods allocate a new network to the new task. Due to the mutual isolation of parameters between tasks, these methods have low forgetting, but the storage and computational consumption of these methods also increases linearly with the number of tasks. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to reduce the model's forgetfulness of old tasks by providing a new image classification model based on parameter path PM (Path-based), and to provide an image classification method with a good balance between classification stability and applicability plasticity.

[0005] The technical solution adopted by the present invention to solve the above technical problems is an image classification method based on continuous learning of constrained parameter paths, comprising the following steps:

[0006] Step 1: Determine the current task;

[0007] Step 2: Use the Riemannian stochastic gradient descent algorithm and the stored data of the previous task to calculate the low-forgetting direction of the previous task around the optimal point of the parameters of the previous task. The calculation of the low-forgetting direction is a spherical optimization process centered on the optimal point of the previous task.

[0008] Step 3: Initialize the path of the current task;

[0009] Step 4: Sample a block from the stored data of the previous task and the current task data;

[0010] Step 5: The sum of the optimal point of the parameters of the previous task and the path of the current task is used as the parameters of the current task. The loss under the path of the current task is calculated using the parameters and samples of the current task.

[0011] Step 6: Project the path of the current task toward the low-forgetting direction of the previous task, and then subtract the projection from the path of the current task to obtain the path offset component;

[0012] Step 7: On the current task data, the constrained direction optimizer uses weight decay to regularize the path offset component, then subtracts the regularized path offset component from the current task path to update the current task path. The image classification model of the current task executes the constrained path model optimization algorithm, adding the optimal point of the parameters of the previous task to the path of the current task to iteratively update the parameters of the current task. If the maximum number of iterations is reached, the last updated path of the current task is used as the final path of the current task to proceed to the next step. Otherwise, go to step 4.

[0013] Step 8: Sample each type of data from the current task data as storage data, and then enter the step of calculating the parameters of the image classification model of the current task.

[0014] Since there is no constraint on the length of the path, the end point of the path is still biased towards the new image classification task. When calculating the parameters of the image classification model for the current task, this paper proposes a new post-processing strategy Recall, which backtracks along the path to achieve a balance between new and old memories:

[0015] The steps to determine the parameters of the image classification model for the current task based on the memory balance strategy are as follows:

[0016] Step 9: Initialize the scaling factor;

[0017] Step 10: Take a block from the stored data obtained in step 8 as a new sample;

[0018] Step 11: Take the optimal point of the parameters of the previous task and the weighted sum of the scaling factor and the final path of the current task as the new parameters of the current task, and use the parameters of the new sample current task and the new sample to calculate the loss under the current scaling factor;

[0019] Step 12: Use the Riemann stochastic gradient descent algorithm to update the scaling factor. If the maximum number of steps is reached, go to step 13 and use the updated scaling factor as the final scaling factor. Otherwise, go to step 10.

[0020] Step 13: The sum of the optimal point of the parameters of the previous task and the final path of the current task weighted by the final scaling factor is taken as the optimal point of the parameters of the current task, and the trained image classification model is used for image classification processing of the current task.

[0021] Beneficial effects:

[0022] The path model-based continuous learning method proposed in the present invention has the characteristics of low forgetting, balanced stability and plasticity. The main innovation of the invention is to use spherical optimization to obtain the low forgetting direction of the previous image classification task, constrain the path between tasks to be consistent with this direction, and use the learned coefficients to scale the path to achieve a balance between the new and old tasks. Compared with existing methods, this method avoids overwriting the previous original memory by using a path-based model, avoids local approximation of the optimal point by spherical optimization, and avoids the linear growth of storage and computational consumption with the increase of image classification tasks by learning scaling coefficients to aggregate model parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a continuous learning framework based on the path model;

[0024] Figure 2 Dynamics for the DCD optimizer;

[0025] Figure 3 Schematic diagram of low-forgetting directions optimized for spheres. DETAILED DESCRIPTION

[0026] The main idea of ​​the present invention is to use a path-based model PM to learn the offset of the parameter path between the new and old tasks, and to complete the invention scheme by implementing the following four aspects:

[0027] 1. Build a path-based model PM;

[0028] 2. Solve the low forgetting direction LFD;

[0029] 3. Design constraint path model optimization algorithm DCD;

[0030] 4. Design memory balance strategy Recall.

[0031] Continuous learning requires a parameter The model f learns T sets of task sequence data {D1, ..., D t ,...,D T The data of the t-th task is a triple data stream, D t ={(x, y, t)}, where x is the input image, y is the label, and t is the task label. The prediction of model f on sample (x, y, t) is expressed as: n is the dimension of the model parameters.

[0032] After each task is completed, a small number of samples are selected for each class to be stored, where the storage of the t-th task is represented by M t , the storage of all learned tasks is represented as In the process of learning the t>1th task, a sample batch B is obtained from the stored data With the current data D t A random selection from the union of , that is: For classification tasks, the model is trained using the cross entropy loss l, with a batch size of one sample. The loss L can be expressed as follows:

[0033]

[0034] Represents a sample batch The total number of samples in .

[0035] The parameters of the i-th updated model on the t-th task are expressed as Stochastic gradient descent (SGD) is usually used to update the parameters. To minimize the loss L, that is:

[0036]

[0037] Where α is the learning rate, α>0, λ is the weight decay hyperparameter, λ≥0, This iterative optimization process will produce a parameter sequence We denote the point where the training loss reaches the minimum or the point where the maximum number of iterations is reached on the tth task as In most existing continuous learning methods, is set as the initial point of the t+1th task.

[0038] When learning the t-1th task and the tth task in sequence, and the optimal point has been obtained When learning the t-th task, the path-based image classification model PM is As the center, redistribute a set of parameters initialized with 0 To learn the parameter offset between the new and old tasks. The form of PM is as follows:

[0039]

[0040] in Part is frozen, path p t Minimize the training batch by the following update rule Losses on:

[0041]

[0042] Similarly, we express the final iterative path as The final parameters of the tth task are expressed as

[0043] The low forgetting direction is a continuous parameter trajectory starting from the previous optimal point, where all parameters along this trajectory have the minimum loss on the previous task. Figure 3 As shown, the solution to the low forgetting direction is a spherical optimization process centered on the optimal point of the previous task, which can be formalized as follows:

[0044]

[0045] where v is the ball S n-1 A point on the surface, ||v|| represents the two-norm of v, n-1 represents the dimension of the sphere, the sphere is is the center of the sphere, r is the radius, and ξ is the integral variable. However, in the process of continuous learning, we cannot obtain all the previous task data. In practice, we use stored data And minimize the average loss of several points in the radial direction to approximate the above problem, that is:

[0046]

[0047] Where F is a set of scaling coefficients such that r = max(F). We express the objective function of the above approximation problem as g(v) and use the path-based model f PM And Riemann stochastic gradient descent RSGD to solve the optimal direction. Assume that the current iteration reaches v i , use ordinary back propagation to get the gradient of the model If you use If we update the parameters, the parameters will be out of the sphere. Therefore, we need to transform the gradient to the sphere S n-1 Let the sphere S n-1 In v i The tangent plane of the point is We first project the gradient onto the tangent plane, that is:

[0048]

[0049] Usually, the exponential mapping is used to project κ i Mapped to a line on the sphere S n-1 From v i The geodesic from the point to the gradient descent point. However, this will bring more computational overhead. For simplicity, we directly normalize the update in the tangent plane to the sphere and get the new iteration point vi+1 , that is:

[0050]

[0051] Where β is the learning rate. We will The final iteration point is represented as v t-1 Experiments show that the spherical optimization direction has lower forgetting than other directions, such as random direction, direct fit storage direction, and orthogonal gradient direction (OGD).

[0052] When learning a new image classification task, we use the Constrained Direction DCD optimizer to align the current path with the low-forgetting direction. The basic idea of ​​DCD is to constrain the path's deviation from the low-forgetting direction. Therefore, we first project the path onto the low-forgetting direction, that is:

[0053]

[0054] Then subtract the projection from the path to get the offset component, that is:

[0055]

[0056] The DCD optimizer uses weight decay to regularize the offset component and then uses the regularized path update amount to update the path. The rules are as follows:

[0057]

[0058] The larger the value of the hyperparameter λ, the more the path tends to be in the low forgetting direction. is the path offset, is the path update amount after regularization.

[0059] The DCD optimizer only constrains the direction of the path to be aligned with the low forgetting direction. And as the moving distance increases, the accumulation of forgetting of old tasks will also increase. Therefore, the end point of the path may still be biased towards the new task. After the t-th task learning is completed, we use the post-processing strategy Recall to balance the new and old memories. First, in the category-balanced storage data Fine-tune parameters Where σ∈(0, 1) is a learnable parameter. Backpropagation is used to obtain the gradient of σ, and the update rule is as follows:

[0060]

[0061] We express the scaling factor obtained by the final iteration as σ * , so the parameters of the t-th task are

[0062] Example

[0063] The present invention is implemented on a GPU server experimental platform, which mainly includes the following steps:

[0064] Step 1: Image classification model learning for the initial task:

[0065] Step 1: t = 1, train the model f on the first task data D1 to obtain the optimal point

[0066] Step 2: Sample each type of data from D1 and store it as

[0067] Step 2: Learning an image classification model for a new task based on a constrained path:

[0068] Step 3: Switch to the next task, i.e. t = t + 1;

[0069] Step 4: Use RSGD algorithm and storage around Solve the low forgetting direction v t-1 ;

[0070] Step 5: Initialize path p t is a 0 vector;

[0071] Step 6: Sample a batch of samples from the stored data and the current task data

[0072] Step 7: Calculate the loss of the current path

[0073] Step 8: Change the current path to p t Towards low forgetting v t-1 Perform projection and obtain the offset component

[0074] Step 9: Use weight decay on the offset component Regularize and update the parameters using gradient descent. If the maximum number of steps is reached, go to step 10; otherwise, go to step 6.

[0075] Step 10: From D t Sampling for each type of data, updating the storage Enter the recall step;

[0076] Step 3: The memory balance strategy recall determines the parameters of the final image classification model for the new task:

[0077] Step 11: Initialize the scaling factor σ to 0.5;

[0078] Step 12: From the stored data Take a batch of samples from

[0079] Step 13: Calculate the loss under the current scaling factor:

[0080] Step 14: Update σ using gradient descent. If the maximum number of steps has been reached, go to step 15; otherwise, go to step 12.

[0081] Step 15: The optimal point of the final t-th task is If the task is completed, the algorithm terminates, otherwise go to step 3.

[0082] like Figure 1 As shown in the figure, the model of the task Task1 for classifying fruits is applied to the task Task2 for classifying images of animals through continuous learning. The model learning of the new task Task2 is completed in the following way:

[0083] Step 1:

[0084] Step 1: t = 1, the initial parameters of Task 1 are Input to the image classification model In Task1, on the task data D1, the stochastic gradient descent SGD optimizer is based on the gradient To iteratively update the parameters To minimize the loss, we can get the optimal point of the parameters.

[0085] Step 2: Sample each type of data from D1 and store it as

[0086] Step 2:

[0087] Step 3: Switch to Task 2, i.e. t = t + 1 = 2;

[0088] Step 4: Use the Riemannian Stochastic Gradient Descent (RSGD) algorithm with storage around Solve the low forgetting direction v1;

[0089] Step 5: Initialize path p2 to 0 vector;

[0090] Step 6: Sample a batch of samples from the stored data and the current task data

[0091] Step 7: Calculate the loss of the current path

[0092] Step 8: Project the current path p2 to the low forgetting direction v1 to obtain the offset component To update the path

[0093] Step 9: On Task2 task data D2, use weight decay to bias component Regularization, constraint path model optimization algorithm DCD according to path gradient To iteratively update the parameters To minimize losses, such as Figure 2 As shown, if the iteration reaches the maximum number of steps, go to step 10, otherwise, go to step 6;

[0094] Figure 2 In the example, D1 is task 1 data, and D2 is task 2 data. is the optimal parameter for task 1, the low forgetting direction of v1 task 1, Therefore To initialize the parameters obtained by fine-tuning directly on D2, due to the large amount of forgetting in Task 1, is the path parameter of task 2, is the negative gradient of the path, which will point directly to the fine-tuning point if there is no constraint location, leading to forgetfulness, It is the negative orthogonal component of the relatively low forgetting direction of the path. DCD converts the negative gradient With negative quadrature component Perform synthesis (using weight decay) and use the synthesized results to update the path parameters;

[0095] Step 10: Sample each type of data from D2 and update the storage Then through the recall step we get

Claims

1. An image classification method based on continuous learning of constrained parameter paths, characterized in that: The following steps are involved: Step 1: Determine the current task; Step 2: Use the Riemannian stochastic gradient descent algorithm and the stored data of the previous task to calculate the low-forgetting direction of the previous task around the optimal point of the parameters of the previous task; the previous task is the task before the current task that is stored in the storage area; Step 3: Initialize the path of the current task; Step 4: Sample a block from the stored data of the old task and the current task data as a sample; Step 5: The sum of the optimal point of the parameters of the previous task and the path of the current task is used as the parameters of the current task. The loss under the path of the current task is calculated using the parameters and samples of the current task. Step 6: Project the path of the current task toward the low-forgetting direction of the previous task, and then subtract the projection from the path of the current task to obtain the path offset component; Step 7: On the current task data, the constrained direction optimizer uses weight decay to regularize the path offset component and subtracts the regularized path update amount from the current path to update the parameters of the current path. The image classification model of the current task executes the constrained path model optimization algorithm, adding the optimal point of the parameters of the previous task to the path of the current task to iteratively update the parameters of the current task. If the maximum number of iterations is reached, the last updated path of the current task is used as the final path of the current task to enter the next step. Otherwise, go to step 4. Step 8: Sample each type of data from the current task data as storage data, and then proceed to the next step; The steps to determine the parameters of the final image classification model for the new task based on the memory balancing strategy are as follows: Step 9: Initialize the scaling factor; Step 10: Take a block from the stored data obtained in step 8 as a new sample; Step 11: Take the sum of the optimal point of the parameters of the previous task and the final path of the current task weighted by the scaling factor as the parameters of the new current task, and use the new parameters of the current task to calculate the loss of the new sample; Step 12: Use the stochastic gradient descent algorithm to update the scaling factor. If the maximum number of steps is reached, go to step 13 and use the updated scaling factor as the final scaling factor. Otherwise, go to step 10. Step 13: The sum of the optimal point of the parameters of the previous task and the final path of the current task weighted by the final scaling factor is taken as the optimal point of the parameters of the current task, and the trained image classification model is used for image classification processing of the current task.

2. The method according to claim 1, wherein: The image classification model learning steps for the initial task are: On the first task data, the stochastic gradient descent algorithm is used to update the image classification model parameters and train the image classification model to obtain the optimal point of the parameters. Sample each type of data from the first task data as storage data.

3. The method according to claim 1, wherein: The loss is the cross entropy loss.

4. The method according to claim 1, wherein: The solution to the low forgetting direction in step 2 is a spherical optimization process centered on the optimal point of the previous task.

Citation Information

Patent Citations

  • Remote sensing image classification method suitable for multi-task iterative learning and memory

    CN111931747A

  • Continual learning of artificial intelligence systems based on bi-level optimization

    US20210064989A1