Deep neural network continuous learning method based on anisotropic flatness and related device
By updating feature variance in deep neural networks and performing singular value decomposition, we determine training strategies that can alleviate forgetting, which solves the catastrophic forgetting phenomenon in deep learning models on natural image classification sequence tasks, and improves its continuous learning ability.
Patent Information
- Application Number
- CN202411891444.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-20
AI Technical Summary
The deep learning model has catastrophic forgetting on the sequence tasks of natural image classification, resulting in a sharp decline in the classification performance of the old task after learning on the new task, limiting its continuous learning ability.
The deep neural network continuous learning method based on anisotropic flatness is used to update the variance of the characteristics of each layer of the neural network and perform singular value decomposition to determine the training strategy that can alleviate forgetting, so as to conduct continuous learning on new tasks.
It effectively alleviates the catastrophic forgetting phenomenon faced by deep learning models on sequence tasks, improves the continuous learning ability of deep learning models, and makes it better deploy and use in the dynamically changing real world.
Smart Images

Figure CN119761409A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and specifically relates to a deep neural network continuous learning method based on anisotropic flatness and related devices. Background Art
[0002] In recent years, deep learning technology has achieved performance that surpasses that of humans in natural image classification, but its ability to continuously learn in the dynamically changing real world still needs to be improved. In the scenario of continuous learning, deep learning models need to learn on a sequence of natural image classification tasks in sequence, and eventually achieve good performance on all learned natural image classification tasks. The main challenge facing deep learning is the catastrophic forgetting phenomenon, that is, after a deep learning model learns on a new task, the classification performance on the old task drops sharply. The catastrophic forgetting phenomenon greatly limits the continuous learning ability of deep learning models, and thus limits the deployment and use of deep learning models in the dynamically changing real world. Summary of the invention
[0003] In order to solve the technical problem in the prior art that deep learning models suffer from catastrophic forgetting when they are trained on sequence tasks of natural image classification, the purpose of the present invention is to provide a deep neural network continuous learning method based on anisotropic flatness that has a mathematical basis and does not rely on the storage of historical task data and related devices. The learning method can alleviate the catastrophic forgetting phenomenon faced by deep learning models when they continue to learn on sequence tasks, thereby improving the continuous learning ability of deep learning models.
[0004] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] A method for continuous learning of a deep neural network based on anisotropic flatness comprises the following steps:
[0006] Obtain a sequence of tasks to be classified for natural images;
[0007] The deep neural network learns sequentially on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated;
[0008] Perform singular value decomposition on the variance of the updated neural network features at each layer to obtain singular vectors and singular values;
[0009] Based on the singular vectors and singular values, determine the training strategy that can alleviate forgetting;
[0010] Based on a training strategy that can alleviate catastrophic forgetting, the deep neural network can continuously learn on the t-th task and achieve image classification for the t-th task.
[0011] Furthermore, in the sequence tasks of natural images to be classified, the data of the first task contains m categories, the data of the second task contains n new categories, and the categories are not repeated with those of the first task. And so on, the tth task contains n new categories, and the categories are not repeated with those of the previous t-1 tasks. The deep neural network classifies m+(t-1)*n categories.
[0012] Furthermore, the deep neural network is sequentially learned on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated, including the following steps:
[0013] The data D of the t-1th task t-1 Input into the deep neural network f(w) with H layers to obtain the features of each layer H is the total number of layers in the deep neural network, and the variance of the features of each layer is calculated pass Incremental calculation obtains the variance of the first t-1 tasks at the lth layer in is the variance of the first t-2 tasks at the lth layer.
[0014] Furthermore, the variance of the features of each layer of the neural network is subjected to singular value decomposition to obtain singular vectors and singular values. Based on the singular vectors and singular values, a training strategy that can alleviate forgetting is determined, including the following steps:
[0015] Based on the singular vectors and singular values, the flat area of the loss function surface of the deep neural network on the t-1th task is determined, and according to the flat area, the training strategy that can alleviate forgetting is determined.
[0016] Furthermore, based on the singular vectors and singular values, the flat area of the loss function surface of the deep neural network on the t-1th task is determined;
[0017] The variance of the first t-1 tasks at layer l Perform singular value decomposition to obtain the singular vector matrix and the singular value matrix in The column vectors represent the flat directions, and the singular value matrix It is a diagonal matrix, and the diagonal elements of the singular value matrix represent the degree of flatness in the corresponding flat direction, thereby determining the flat area of the loss function surface of the deep neural network on the t-1th task.
[0018] Furthermore, based on the flat area, a training strategy that can alleviate forgetting is determined, including the following process:
[0019] In the flat region, the learning rate in the corresponding flat direction is calculated based on the singular value matrix, so that the learning rate along the flat direction with small singular values is large, which is a training strategy that can alleviate catastrophic forgetting.
[0020] Furthermore, based on a training strategy that can alleviate catastrophic forgetting, continuous learning of the deep neural network on the t-th task is achieved, and image classification of the t-th task is achieved, including the following steps:
[0021] The deep neural network is initialized with the deep neural network learned on the t-1th task, and based on a training strategy that can alleviate catastrophic forgetting, the deep neural network continues to learn on the tth task, so that the deep neural network learns on the tth task and achieves image classification of the tth task.
[0022] A deep neural network continuous learning system based on anisotropic flatness, comprising:
[0023] A module for acquiring sequence tasks for natural images to be classified, used for acquiring sequence tasks for natural images to be classified;
[0024] The variance update module is used for the deep neural network to learn sequentially on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated;
[0025] The singular value decomposition module is used to perform singular value decomposition on the variance of the updated neural network layer features to obtain singular vectors and singular values;
[0026] A training strategy determination module capable of alleviating forgetting, used for determining a training strategy capable of alleviating forgetting based on singular vectors and singular values;
[0027] The continuous learning module is used to achieve continuous learning of the deep neural network on the t-th task based on a training strategy that can alleviate catastrophic forgetting, and to achieve image classification of the t-th task.
[0028] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for continuous learning of a deep neural network based on anisotropic flatness is implemented.
[0029] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for continuous learning of a deep neural network based on anisotropic flatness is implemented.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] In the present invention, by determining the flat area of the loss function surface of the deep neural network on historical tasks (t-1 tasks), the performance of the deep neural network on the old historical tasks does not change much in this flat area. The deep neural network is still in the above-mentioned flat area after learning on the new tasks (t tasks) to maintain its performance on the historical tasks (t-1 tasks), thereby alleviating the catastrophic forgetting phenomenon. The present invention takes the performance of the deep neural network on the old historical tasks as a consideration, so that after the deep neural network learns on the new tasks, the loss function value on the historical tasks remains unchanged, which can effectively alleviate the catastrophic forgetting phenomenon and improve the effect of continuous learning. The present invention is applicable to supervised learning, unsupervised learning, reinforcement learning and self-supervised learning. In addition, the system does not need to save historical task data, which is beneficial to data security and privacy protection. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a flowchart of the deep neural network continuous learning method based on anisotropic flatness of the present invention;
[0033] Figure 2 The effect diagram of continuous learning of the present invention, wherein (a) the experimental result of adding 20 new categories to each task, (b) the experimental result of adding 10 new categories to each task, and (c) the experimental result of adding 5 new categories to each task;
[0034] Figure 3 Schematic diagram of a deep neural network continuous learning system based on anisotropic flatness. DETAILED DESCRIPTION
[0035] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. The preferred embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thoroughly and comprehensively understood.
[0036] See also Figure 1 In one embodiment of the present invention, a method for continuous learning of deep neural networks based on anisotropic flatness is provided, which is applicable to continuous learning problems on multiple tasks.
[0037] The present invention is described in detail below by taking natural image classification as an example.
[0038] In the scenario of continuous learning, the deep neural network learns sequentially on the sequence tasks of natural images to be classified. The data of the first task contains m categories, and the deep neural network needs to learn to classify the images of these m categories; the data of the second task contains n new categories (which are not repeated with the categories of the first task), and the deep neural network needs to learn to classify these m+n categories of images; and so on, the tth task contains n new categories (which are not repeated with the categories of the previous t-1 tasks), and the deep neural network needs to learn to classify these m+(t-1)*n categories.
[0039] See also Figure 1 , the following takes the learning of the deep neural network f(w) on the tth task as an example to introduce the specific implementation steps of this continuous learning method:
[0040] Step S1: obtaining a sequence task to be classified for a natural image;
[0041] Step S2: The deep neural network learns sequentially on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task (i.e., the old task data), the variance of the features of each layer of the deep neural network is updated. The specific calculation process is as follows:
[0042] The data D of the t-1th task t-1 Input into the deep neural network f(w) with H layers to obtain the features of each layer H is the total number of layers in the deep neural network, and the variance of the features of each layer is calculated pass Incremental calculation obtains the variance of the first t-1 tasks at the lth layer in is the variance of the first t-2 tasks at the lth layer (l=1,…,H); in particular, when t=1, is a zero matrix.
[0043] Step S3: Perform singular value decomposition on the variance of the updated neural network layer features to obtain singular vectors and singular values;
[0044] Step S4: Based on the singular vectors and singular values, determine a training strategy that can alleviate forgetting. The specific process is: based on the singular vectors and singular values, determine the flat area of the loss function surface of the deep neural network on the t-1th task, and determine the training strategy that can alleviate forgetting based on the flat area.
[0045] The variance of the first t-1 tasks at layer l Perform singular value decomposition to obtain the singular vector matrix and the singular value matrix in The column vectors represent the flat directions, and the singular value matrix It is a diagonal matrix whose diagonal elements represent the degree of flatness in the corresponding flat direction. The smaller the singular value, the flatter the corresponding direction, thereby determining the flat area of the loss function surface of the deep neural network on the t-1th task.
[0046] Based on the above characteristics, a training strategy that can alleviate catastrophic forgetting is determined: in the flat area, based on the singular value matrix Calculate the learning rate on the corresponding flat direction so that the learning rate along the flat direction with small singular values is large, for example in and denote the smallest singular value and the largest singular value, respectively.
[0047] Step S5: Based on the training strategy that can alleviate catastrophic forgetting, the deep neural network is continuously learned on the t-th task, and the image classification of the t-th task is realized; wherein, the training strategy that can alleviate forgetting can ensure that after training, the deep neural network can maintain the performance on the old task. The specific process is:
[0048] The deep neural network is initialized with the deep neural network learned on the t-1th task, and based on the training strategy that can alleviate catastrophic forgetting, the deep neural network is continuously learned on the tth task (new task data), so that the deep neural network still maintains the performance on the historical task after learning on the tth task (alleviating catastrophic forgetting). The specific process is as follows:
[0049] The data D of the tth task t Send it into the deep neural network to obtain the prediction result;
[0050] Using the loss function, the difference between the predicted result and the standard result (set according to actual needs) is calculated, and the gradient is calculated using the back propagation algorithm. In particular, the lth layer parameter w l The corresponding gradient is g l (l=1,…,H);
[0051] Update the lth layer parameter w of the deep neural network layer by layer l =w l -Δw l (l=1,…,H), taking the lth layer as an example, the parameter w l The corresponding parameter update Δw l for:
[0052]
[0053] in, and are the singular vectors and learning rates (l=1,…,H);
[0054] Repeat the above iterative parameter update process until the deep neural network can classify the natural images of the m+(t-1)*n categories that have been learned. At this point, the deep neural network can classify images of the tth task as well as the images of the previous t-1 tasks. This shows that this method effectively alleviates the catastrophic forgetting phenomenon and improves the ability of the deep neural network to continue learning.
[0055] After the deep neural network finishes learning on the tth task, it can continue learning on the t+1th task based on steps 1 and 2.
[0056] exist Figure 2 In (a), the first task contains 100 categories, and the second to sixth tasks contain 20 categories respectively. After learning the sixth task, the deep neural network needs to learn to classify images of 200 categories. Figure 2 In (b), the first task contains 100 categories, and the second to eleventh tasks each contain 10 categories. After learning the eleventh task, the deep neural network needs to learn to classify 200 categories of images. Figure 2 In (c), the first task contains 100 categories, and the second to the 21st tasks contain 10 categories respectively. After learning the 21st task, the deep neural network needs to learn to classify 200 categories of images. In fact, the blue solid line is the effect of the continuous learning method of the present invention, and the red dotted line is the comparison benchmark. It can be seen that the present invention effectively alleviates the catastrophic forgetting phenomenon and improves the continuous learning ability of the deep neural network.
[0057] See also Figure 3 In another embodiment of the present invention, a deep neural network continuous learning system based on anisotropic flatness is provided, comprising:
[0058] A module for acquiring sequence tasks for natural images to be classified, used for acquiring sequence tasks for natural images to be classified;
[0059] The variance update module is used for the deep neural network to learn sequentially on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated;
[0060] The singular value decomposition module is used to perform singular value decomposition on the variance of the updated neural network layer features to obtain singular vectors and singular values;
[0061] A training strategy determination module capable of alleviating forgetting, which determines a training strategy capable of alleviating forgetting based on singular vectors and singular values;
[0062] The continuous learning module is used to achieve continuous learning of the deep neural network on the t-th task based on a training strategy that can alleviate catastrophic forgetting, and to achieve image classification of the t-th task.
[0063] In the present invention, a deep neural network f(w) with parameters w and number of layers H is used in a sequence task {D1, D2, ..., D t-1 ,D t ,…}, after the deep neural network f(w) learns the old task (such as the t-1th task), the variance incremental update module is used to incrementally calculate the local variance of the old task data in each layer of the deep neural network; then the feature variance is singularly decomposed layer by layer to obtain singular values and singular vectors, and the learning rate along the corresponding singular vectors is adaptively determined using the singular values, thereby obtaining a training strategy that can alleviate forgetting. When the deep neural network is trained on a new task (such as the tth task), the deep neural network is iteratively updated using a training strategy that can alleviate forgetting until the deep neural network achieves optimal performance on the task. Repeating the above process can achieve continuous learning of the deep neural network on sequence tasks.
[0064] The present invention takes the performance of deep neural networks on historical old tasks as a consideration, designs a variance update module and a singular value SVD decomposition module to determine a training strategy that can alleviate forgetting, so that after the deep neural network is trained on a new task, its performance on historical tasks remains unchanged, that is, the present invention can effectively alleviate catastrophic forgetting and improve the effect of continuous learning. The present invention does not constrain the structure, loss function, and data annotation of the deep neural network, and can be applied to supervised learning, unsupervised learning, reinforcement learning, and self-supervised learning. In addition, the present invention does not need to save historical task data, which is beneficial to data security and privacy protection.
[0065] In another embodiment of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the anisotropic flatness-based deep neural network continuous learning method when executing the computer program.
[0066] In another embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and wherein the computer program, when executed by a processor, implements the anisotropic flatness-based deep neural network continuous learning method.
[0067] The above description is only for the best embodiment of the present invention, but it should not be understood as limiting the claims. The present invention is not limited to the above embodiments, and its specific structure is allowed to be changed. However, all changes made within the protection scope of the independent claims of the present invention are within the protection scope of the present invention.
[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
Claims
1. A method for continuous learning of deep neural networks based on anisotropic flatness, characterized in that: The following steps are involved: Obtain a sequence of tasks to be classified for natural images; The deep neural network learns sequentially on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated; Perform singular value decomposition on the variance of the updated neural network features at each layer to obtain singular vectors and singular values; Based on the singular vectors and singular values, determine the training strategy that can alleviate forgetting; Based on a training strategy that can alleviate catastrophic forgetting, the deep neural network can continuously learn on the t-th task and achieve image classification of the t-th task.
2. The method for continuous learning of a deep neural network based on anisotropic flatness according to claim 1, characterized in that: In a sequence of natural image classification tasks, the data of the first task contains m categories, the data of the second task contains n new categories, and the categories are not repeated with those of the first task. And so on, the tth task contains n new categories, and the categories are not repeated with those of the previous t-1 tasks. The deep neural network classifies m+(t-1)*n categories.
3. The method for continuous learning of a deep neural network based on anisotropic flatness according to claim 1, characterized in that: The deep neural network is sequentially learned on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated, including the following steps: The data D of the t-1th task t-1 Input into the deep neural network f(w) with H layers to obtain the features of each layer l=1,…,H, H is the total number of layers in the deep neural network, and the variance of the features of each layer is calculated pass Incremental calculation obtains the variance of the first t-1 tasks at the lth layer in is the variance of the first t-2 tasks at the lth layer.
4. The method for continuous learning of a deep neural network based on anisotropic flatness according to claim 1, characterized in that: The variance of the features of each layer of the neural network is decomposed into singular values to obtain singular vectors and singular values. Based on the singular vectors and singular values, a training strategy that can alleviate forgetting is determined, including the following steps: Based on the singular vectors and singular values, the flat area of the loss function surface of the deep neural network on the t-1th task is determined, and according to the flat area, the training strategy that can alleviate forgetting is determined.
5. The method for continuous learning of a deep neural network based on anisotropic flatness according to claim 1, characterized in that: Based on the singular vectors and singular values, determine the flat area of the loss function surface of the deep neural network on the t-1th task; The variance of the first t-1 tasks at layer l Perform singular value decomposition to obtain the singular vector matrix and the singular value matrix l=1,…,H, where The column vectors represent the flat directions, and the singular value matrix It is a diagonal matrix, and the diagonal elements of the singular value matrix represent the degree of flatness in the corresponding flat direction, thereby determining the flat area of the loss function surface of the deep neural network on the t-1th task.
6. The method for continuous learning of a deep neural network based on anisotropic flatness according to claim 5, characterized in that: Based on the flat areas, identify training strategies that can alleviate forgetting. The process includes: In the flat region, the learning rate in the corresponding flat direction is calculated based on the singular value matrix, so that the learning rate along the flat direction with small singular values is large, which is a training strategy that can alleviate catastrophic forgetting.
7. The method for continuous learning of a deep neural network based on anisotropic flatness according to claim 1, characterized in that: Based on a training strategy that can alleviate catastrophic forgetting, continuous learning of a deep neural network on the t-th task is achieved, and image classification of the t-th task is achieved, including the following steps: The deep neural network is initialized with the deep neural network learned on the t-1th task, and based on a training strategy that can alleviate catastrophic forgetting, the deep neural network continues to learn on the tth task, so that the deep neural network learns on the tth task and achieves image classification of the tth task.
8. A deep neural network continuous learning system based on anisotropic flatness, characterized in that: include: A module for acquiring sequence tasks for natural images to be classified, used for acquiring sequence tasks for natural images to be classified; The variance update module is used for the deep neural network to learn sequentially on the sequence tasks of natural images to be classified. When the deep neural network finishes learning on the t-1th task, the variance of the features of each layer of the deep neural network is updated; The singular value decomposition module is used to perform singular value decomposition on the variance of the features of each layer of the updated neural network to obtain singular vectors and singular values; A training strategy determination module capable of alleviating forgetting, used for determining a training strategy capable of alleviating forgetting based on singular vectors and singular values; The continuous learning module is used to achieve continuous learning of the deep neural network on the t-th task based on a training strategy that can alleviate catastrophic forgetting, and to achieve image classification of the t-th task.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for continuous learning of a deep neural network based on anisotropic flatness as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for continuous learning of a deep neural network based on anisotropic flatness as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
A meta-learning algorithm based on stepwise gradient correction of a meta-learner
CN109919299A
Continuous learning framework and continuous learning method of deep neural network
CN111191709A
Continuous learning image classification method and device based on deep learning
CN114463605A
Persistent evolution learning method for prompting fine tuning in null space
CN118657989A