A method, apparatus and electronic device for incremental learning

CN123014068APending Publication Date: 2026-10-30SHENZHEN MICROBT ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510572093.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

对于目标检测模型,遗忘问题可能表现为对之前已经能够准确检测的目标,在学习新目标后,检测的精度下降,如边界框的定位不再准确,或者对一些旧目标出现漏检的情况

Benefits of technology

[0019]本发明实施例提出一种基于蒸馏训练和重参数化相结合的增量学习方法。在蒸馏训练过程中,利用教师模型(第一模型)指导学生模型(第二模型)的学习,教师模型对原始任务的输出可以作为监督信号,约束学生模型保留原始任务的知识。此外,蒸馏训练过程中,通过蒸馏损失可以传递原始任务的知识,从而可以减少对原始数据的依赖,因此无需存储大量原始数据,可以节省存储空间,提高训练效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123014068A_ABST
    Figure CN123014068A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of incremental learning method, device and electronic equipment.Therein, the method comprises: obtaining a first model, the first model is based on original data training, for executing original task;With the model structure of the first model as main structure, increase branch structure, obtain second model;Using the model parameter of the first model, the main structure of the second model is parameterized initialization, and using the diagonal matrix of element value 1, the branch structure is parameterized initialization, obtain reparameterized second model;The first model is used as teacher model, the reparameterized second model is used as student model, and incremental data is used for distillation training, and the second model of training completion is obtained;The second model of training completion is used for executing the original task and incremental task.The present application embodiment can alleviate the "catastrophic forgetting" problem in incremental learning, improve the accuracy of model after incremental learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more particularly to an incremental learning method, apparatus, and electronic device. Background Technology

[0002] Image classification models and object detection models have wide applications in computer vision and work together effectively. For example, in intelligent security systems, image classification models can perform preliminary classification of scenes in surveillance videos to determine if any anomalies exist; object detection models can further detect specific target objects, such as people and vehicles, and track their positions, achieving more precise monitoring and early warning. Similarly, in the field of autonomous driving, image classification models can identify the categories of traffic signs and traffic lights; object detection models can detect vehicles, pedestrians, and other targets on the road, providing a basis for the decision-making of autonomous vehicles.

[0003] Incremental learning is an important technique in machine learning. Its purpose is to locally adjust and update an existing model based on new data. By progressively learning information from new data, the model's parameters are continuously optimized, enabling it to adapt to changes in data distribution or learn new tasks without retraining the entire model. During the learning process, the model retains previously learned knowledge and integrates new knowledge from new data into its existing knowledge base.

[0004] For example, in image classification models, incremental learning aims to enable the model to gradually update its parameters as it receives new image data and corresponding category labels, accurately classifying newly emerging image categories while maintaining its ability to classify existing categories. Similarly, in object detection models, incremental learning aims to enable the model to gradually update its parameters as it receives new image data and corresponding object labels (including location and category information), accurately detecting the category and location of new objects while maintaining its ability to detect existing objects.

[0005] However, incremental learning often suffers from "catastrophic forgetting," meaning that the model easily forgets previously learned knowledge when learning new data. For example, in image classification models, as new categories of data are continuously added to the learning process, the model's classification accuracy for some previously learned categories decreases significantly. For object detection models, the forgetting problem may manifest as a decrease in detection accuracy for previously accurately detected targets after learning new targets; for example, the bounding box localization may become inaccurate, or some old targets may be missed. Summary of the Invention

[0006] This invention provides an incremental learning method, apparatus, and electronic device that can alleviate the "catastrophic forgetting" problem in incremental learning and improve the accuracy of the model after incremental learning without increasing additional computational overhead.

[0007] In a first aspect, embodiments of the present invention disclose an incremental learning method, the method comprising:

[0008] Obtain the first model; the first model is trained based on the original data, and the first model is used to perform the original task;

[0009] Using the model structure of the first model as the main structure, and adding branch structures, a second model is obtained;

[0010] The main structure of the second model is initialized with the model parameters of the first model, and the branch structure is initialized with the parameters of the diagonal matrix with an element value of 1, so as to obtain the reparameterized second model.

[0011] The first model is used as the teacher model, and the reparameterized second model is used as the student model. Distillation training is performed using incremental data to obtain the trained second model. The trained second model is used to perform the original task and the incremental task.

[0012] Secondly, embodiments of the present invention disclose an incremental learning device, the device comprising:

[0013] The model acquisition module is used to acquire a first model; the first model is trained based on the original data and is used to perform the original task.

[0014] The model building module is used to take the model structure of the first model as the main structure, add branch structures, and obtain the second model;

[0015] The reparameterization module is used to initialize the main structure of the second model with the model parameters of the first model, and to initialize the branch structure with the parameters of the branch structure with a diagonal matrix with an element value of 1, so as to obtain the reparameterized second model.

[0016] The distillation training module is used to use the first model as the teacher model and the reparameterized second model as the student model, and to perform distillation training using incremental data to obtain the trained second model; the trained second model is used to perform the original task and the incremental task.

[0017] Thirdly, embodiments of the present invention disclose an electronic device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, wherein the executable instruction causes the processor to perform the steps of the incremental learning method as described above.

[0018] The embodiments of the present invention have the following advantages:

[0019] This invention proposes an incremental learning method based on a combination of distillation training and reparameterization. During distillation training, a teacher model (first model) guides the learning of a student model (second model). The teacher model's output on the original task serves as a supervisory signal, constraining the student model to retain knowledge of the original task. Furthermore, during distillation training, knowledge of the original task can be transferred through distillation loss, thereby reducing reliance on the original data. Therefore, it eliminates the need to store large amounts of original data, saving storage space and improving training efficiency.

[0020] Furthermore, this embodiment of the invention utilizes a teacher model (first model) to construct a student model (second model). For parameters in the second model that share the same structure as the first model (such as the main structure), the parameters are directly initialized using the model parameters of the first model to preserve knowledge of the original task during distillation training. For newly added branch structures in the second model, parameters are initialized using diagonal matrices with element values ​​of 1 to retain more knowledge of the original task in the early stages of training. As training progresses, the original parameters of the main structure can continue to retain knowledge of the original task to a certain extent, while the heavy parameters of the newly added branch structures can learn more about the incremental task, thus balancing the conflict between the original and incremental tasks. Since the parameters of the added branch structures can be fused during the deployment phase, this embodiment of the invention can alleviate the "catastrophic forgetting" problem of incremental learning without increasing additional computational overhead, improving the accuracy of the model after incremental learning while reducing the computational load and improving model execution efficiency. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart illustrating the steps of an embodiment of the incremental learning method of the present invention;

[0023] Figure 2 This is a structural block diagram of an embodiment of the incremental learning device of the present invention;

[0024] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0026] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In embodiments of this invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0027] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of the incremental learning method of the present invention, which may include the following steps:

[0028] Step 101: Obtain the first model; the first model is trained based on the original data and is used to perform the original task;

[0029] Step 102: Using the model structure of the first model as the main structure, add branch structures to obtain the second model;

[0030] Step 103: Initialize the main structure of the second model with the model parameters of the first model, and initialize the branch structure with the parameters of the diagonal matrix with an element value of 1, to obtain the reparameterized second model;

[0031] Step 104: Using the first model as the teacher model and the reparameterized second model as the student model, perform distillation training using incremental data to obtain the trained second model; the trained second model is used to perform the original task and the incremental task.

[0032] The incremental learning method provided by this invention can be applied to electronic devices. These electronic devices may include smartphones, desktop computers, tablets, laptops, digital assistants, augmented reality (AR) / virtual reality (VR) devices, intelligent voice interaction devices, smart home appliances, smart wearable devices, in-vehicle terminal devices, and other terminal devices. The electronic devices may also be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0033] To address the "catastrophic forgetting" problem in incremental learning, this invention proposes an incremental learning method based on a combination of distillation training and reparameterization. Through distillation training, the teacher model's output on the original task can serve as a supervisory signal for training the student model. The teacher model's output on the original task supervises the student model's output on the original task, thus constraining the student model to retain knowledge of the original task and mitigating the "catastrophic forgetting" problem. Furthermore, distillation training does not rely on the original data, saving storage space and improving training efficiency. In addition, introducing reparameterization can balance the conflict between the original and incremental tasks, further mitigating the "catastrophic forgetting" problem without increasing computational overhead and improving the accuracy of the model after incremental learning.

[0034] First, we obtain the initial model. This initial model is trained on the raw data using a specific machine learning algorithm and can be used to perform the original task. It can then serve as a teacher model in subsequent distillation training.

[0035] Then, a second model is constructed based on the first model, and the second model is reparameterized. Reparameterization refers to changing the representation or connection method of parameters through mathematical transformations or structural reorganization, without changing the essential function of the model. In this embodiment of the invention, reparameterization involves adding branch structures to the original model structure. Specifically, the model structure of the first model is used as the main structure, and branch structures are added to obtain the second model. The model parameters of the first model are used to initialize the parameters of the main structure, and a diagonal matrix with element values ​​of 1 is used to initialize the parameters of the branch structures, resulting in the reparameterized second model.

[0036] The parameters of the main structure are used as original parameters to retain knowledge of the original task during training, while the parameters of the branch structure are used as re-parameters to learn knowledge of the incremental task during training.

[0037] Reparameterization refers to the temporary introduction of additional learnable parameters or computational paths during the training phase, which can be used to adjust or expand the expressive power of the model.

[0038] Optionally, the branch structure may include a convolutional layer with a kernel size of 1×1 (hereinafter referred to as a 1×1 convolutional layer). The branch structure of the 1×1 convolutional layer can be used to adjust the number of channels, fuse features, etc. By linearly combining the features of different channels, the correlation between channels can be captured, thereby improving the feature representation capability. In addition, based on the linear property of convolution operations, the convolutional layer of the main structure and the 1×1 convolutional layer of the branch structure can be merged into an equivalent convolutional layer. After fusion, only a single convolution operation is retained, and the inference speed is the same as the original convolution. This can significantly improve the model capacity without increasing the inference cost.

[0039] It should be noted that the embodiments of the present invention do not limit the form of the branch structure. For example, the branch structure may also include identity mapping, etc. Identity mapping, as part of the branch structure in scenarios such as residual connections, helps to solve the gradient vanishing problem and makes the network easier to train.

[0040] In this embodiment of the invention, the main structure of the second model is the same as the model structure of the first model. This embodiment initializes the model parameters of the second model based on the model parameters of the first model. Specifically, for parameters of structures in the second model that are identical to those in the first model (such as the main structure), the model parameters of the first model are directly used for parameter initialization. For newly added branch structures in the second model, the parameters (re-parameters) of the branch structures are initialized using a diagonal matrix with element values ​​of 1.

[0041] It is understandable that the parameters in the model refer to all learnable variables in the model, including but not limited to the weight matrix of the convolution kernel, the connection weights of the fully connected layer, and the additional offsets of each layer.

[0042] The purpose of initializing the parameters of the branch structure added to the second model in this embodiment of the invention using a diagonal matrix with an element value of 1 is as follows: In the early stage of training, the parameters of the main structure in the second model (original parameters) can remain unchanged with respect to the original task, retaining more knowledge of the original task; as training progresses, the original parameters continue to retain knowledge of the original task to a certain extent, while the parameters of the newly added branch structure (re-parameters) can learn more knowledge of the incremental task.

[0043] In this embodiment of the invention, the addition of a branch structure in the second model introduces re-parameters, which can balance the conflict between the original task and the incremental task during incremental learning training, thereby alleviating the "catastrophic forgetting" problem. These re-parameters (parameters of the branch structure) can be integrated into the original parameters (parameters of the main structure) during the deployment phase, thus avoiding the introduction of additional parameters and computational costs.

[0044] After constructing a second model based on the first model and reparameterizing the second model, a reparameterized second model is obtained. Using the first model as the teacher model and the reparameterized second model as the student model, distillation training is performed using incremental data to obtain the trained second model. The trained second model can be used to perform both the original task and the incremental task.

[0045] It should be noted that the embodiments of the present invention do not limit the types of the first model and the second model. In an optional embodiment of the present invention, the original data may include first image data and label values ​​based on the original task annotation; the incremental data may include second image data and label values ​​based on the incremental task annotation; the original task may include an image classification task for identifying a first category, and the incremental task may include an image classification task for identifying a second category; or, the original task may include a target detection task for detecting a first target, and the incremental task may include a target detection task for detecting a second target.

[0046] The original task refers to the task that the model has already trained on using the original data before incremental learning. The incremental task, on the other hand, refers to the task that the model needs to train on using incremental data during the incremental learning process, in contrast to the original task. The incremental task should preserve as much of the knowledge that the model has learned previously as possible.

[0047] Raw data refers to the dataset used to train the first model to complete the original task. Raw data consists of image data (first image data) from a specific domain or scene, along with corresponding label values ​​based on the original task. For example, in an image classification task, the image data in the raw data could be images containing objects of a first category (e.g., cats or dogs), with the label value indicating the first category (e.g., cat or dog). In an object detection task, the image data in the raw data could be images containing a first target (e.g., cars or pedestrians), and the label value could include the category of the first target, as well as the target's location information within the image (e.g., bounding box coordinates).

[0048] Incremental data refers to the dataset used for incremental learning of a second model to complete an incremental task. Incremental data consists of image data (second image data) from a specific domain or scene, along with corresponding label values ​​annotated based on the incremental task. The image data in incremental data can come from different scenes than the original data or involve different categories or targets. For example, in an image classification task, the image data in incremental data could be images containing objects of a second category (a new category distinct from the first category, such as birds or fish), with label values ​​indicating the second category (e.g., birds or fish). In an object detection task, the image data in incremental data could be images containing a second target (a new target distinct from the first target, such as bicycles), with label values ​​including the labeled category and location information of the second target.

[0049] Taking image classification as an example, a first model is trained using the original data. During training, the first model learns how to extract image features from the first image data and classify the image into a specific first category (e.g., cat or dog) based on these extracted features. After training, the first model demonstrates good performance on the original task (e.g., identifying cats and dogs) and can be used as a teacher model.

[0050] A second model is constructed based on the first model, and then reparameterized to obtain the reparameterized second model. The first model is used as the teacher model, and the reparameterized second model is used as the student model. Distillation training is performed using incremental data to obtain the trained second model. It should be noted that during the distillation training phase, only the parameters of the student model (second model) are optimized, while the parameters of the teacher model (first model) remain unchanged to avoid interfering with the performance of the original task.

[0051] During the distillation training process, a second image data point is selected from the incremental data. This second image data is then input into the teacher model (first model) to obtain its output probability distribution. For example, when given an image containing a bird, the teacher model can output the probability that the image belongs to different first categories. The teacher model's output is called the soft label, while the true labels labeled in the training data are called the hard labels. Simultaneously, this second image data (e.g., an image containing a bird) is also input into the student model (second model) to obtain its output probability distribution.

[0052] During distillation training, the total loss of the student model can be comprised of two parts: distillation loss and incremental task loss. Distillation loss measures the difference between the output probability distribution of the student model and the output probability distribution of the teacher model (soft labels). The soft labels output by the teacher model help the student model retain knowledge of the original task. Incremental task loss measures the difference between the output probability distribution of the student model and the labeled values ​​(hard labels), enabling the student model to learn knowledge of the incremental task. The total loss of the student model is obtained by weighting the distillation loss and incremental task loss. Based on this total loss, the parameters of the student model are updated using the backpropagation algorithm, while the parameters of the teacher model remain unchanged. Then, the next iteration of training begins. When the iteration stopping condition is met, the trained second model is obtained.

[0053] During distillation training, the student model not only learns how to classify the second category (such as birds and fish) in the incremental data, but also "distills" and retains knowledge about the original task (such as identifying cats and dogs) from the teacher model. After distillation training, the second model can classify both the first category (such as cats and dogs) in the original task and the second category (such as birds and fish) in the incremental task.

[0054] It should be noted that the embodiments of the present invention do not limit the methods for calculating distillation loss and incremental task loss. For example, general loss functions can be used to calculate distillation loss and incremental task loss. General loss functions include cross-entropy loss function, cosine similarity loss function, etc.

[0055] Taking object detection as an example, a first model is trained using the original data. During training, the first model learns how to extract image features from the first image data and detect the category and location of the first target (such as a car or pedestrian) based on the extracted image features. After training, the first model has good performance on the original task (such as detecting cars and pedestrians) and can be used as a teacher model.

[0056] A second model is constructed based on the first model, and then reparameterized to obtain the reparameterized second model. The first model is used as the teacher model, and the reparameterized second model is used as the student model. Distillation training is performed using incremental data to obtain the trained second model. It should be noted that during the distillation training phase, the parameters of the teacher model (first model) are fixed to avoid interfering with the performance of the original task.

[0057] During distillation training, second image data is selected from the incremental data and input into the teacher model (first model). The teacher model outputs detection results, including the category and location information (soft label) of the detected first target. Similarly, this second image data is input into the student model (second model), which also outputs detection results. The distillation loss between the detection results output by the student model and the teacher model is calculated, as well as the incremental task loss between the detection results output by the student model and the hard label. Combining the distillation loss and the incremental task loss, the total loss of the student model is calculated. Based on this total loss, the parameters of the student model are updated using the backpropagation algorithm, while the parameters of the teacher model remain unchanged. Then, the next iteration of training begins. When the iteration stopping condition is met, the trained second model is obtained.

[0058] During the distillation training process, the student model not only learns how to detect the second target (such as a bicycle) in the incremental data, but also retains knowledge about the original task (such as detecting the first target, cars and pedestrians) from the teacher model. The trained second model can perform both the original task of detecting the first target (such as cars and pedestrians) and the incremental task of detecting the second target (such as a bicycle).

[0059] It should be noted that the first category (e.g., cat, dog) and first target (e.g., car, pedestrian) in the original task, and the second category (e.g., bird, fish) and second target (e.g., bicycle) in the incremental task are all illustrative examples. This embodiment of the invention does not limit the specific task types of the original and incremental tasks, nor the specific content of the first category, second category, first target, and second target.

[0060] In this embodiment of the invention, the first model and the second model can be neural network models, and this embodiment of the invention does not limit the model structure of the first model and the second model. The model structure may include, but is not limited to, at least one or a combination, superposition, or nesting of the following: CNN (Convolutional Neural Network), LSTM (Long Short-Term Memory) network, RNN (Simple Recurrent Neural Network), Transformer network, attention neural network, etc.

[0061] This invention does not limit the main structure of the second model. In the field of image processing, the main structure typically includes multiple convolutional layers. Convolutional layers perform convolution operations by sliding convolution kernels across the image, automatically extracting various features of the image. Multiple convolutional layers are formed by stacking multiple convolutional layers sequentially. Each subsequent convolutional layer extracts higher-level features based on the output of the previous one. For example, shallow convolutional layers can extract low-level features such as edges and corners of the image, while as the depth of the convolutional layers increases, higher-level and more abstract features can be extracted, such as the parts and overall shape of an object. In image classification tasks, these features help the model distinguish between different categories of images; in object detection tasks, these features help locate and identify different target objects.

[0062] Furthermore, the main structure may also include activation layers (such as ReLU) and / or batch normalization (BN) layers. The activation layer introduces nonlinear activation functions to introduce nonlinear factors into the model, increasing its expressive power and robustness, and mitigating the gradient vanishing problem. Batch normalization layers are a normalization technique in deep learning, primarily used to accelerate training, improve model stability, and enhance generalization ability.

[0063] Depending on the main structure of the second model, different embodiments of the present invention employ different methods to add branch structures.

[0064] In an optional embodiment of the present invention, the addition of a branch structure may include:

[0065] If the main structure contains multiple convolutional layers but no batch normalization layers, then the branch structure is added after each convolutional layer.

[0066] For example, the main structure can be as follows: Input → (convolutional layer → activation layer) × N → Output, where "(convolutional layer → activation layer) × N" represents multiple convolutional layers, specifically N convolutional layers, where N is a positive integer.

[0067] Let N be the first model. t Let W be the model parameters of the first model. t Let the second model be denoted as N. s Let the model parameters of the second model be denoted as W. s The embodiments of the present invention are based on N. t Construct N s And based on W t Initialize W s .

[0068] The first model includes multiple convolutional layers, denoted as... The parameters of the multiple convolutional layers in the first model are denoted as follows: This invention constructs a second model based on a first model. The second model has the same structure as the first model, also including multiple convolutional layers. The parameters of the multiple convolutional layers in the second model are called initial parameters. In this invention, a 1×1 convolutional layer is added after each convolutional layer in the second model, denoted as... The parameters of the newly added 1×1 convolutional layer in the second model are called reparameters, denoted as follows: The second model, which adds a 1×1 convolutional layer, includes the main structure. and branching structure The second model at this point is denoted as The parameters of the second model with the added 1×1 convolutional layer include the original parameters. Sum of weight parameters The parameters of the second model at this time are denoted as follows:

[0069] In this embodiment of the invention, the same structure (main structure) in the second model as in the first model is initialized using the corresponding parameters from the first model. Specifically, the parameters of the multi-convolutional layers in the second model are initialized using the parameters of the multi-convolutional layers in the first model. For the parameters of the newly added branch structures (re-parameters) in the second model... It is initialized using a diagonal matrix with an element value of 1.

[0070] Assuming multiple convolutional layers If the number of output channels Cout is 5, then the shape of the added branch structure's parameters is Cout×Cout×1×1, where 1×1 represents the kernel size. The parameters (re-parameters) of this added branch structure can be initialized using a diagonal matrix with element-values ​​of 1:

[0071]

[0072] Specifically, the step of initializing the parameters of the branch structure using a diagonal matrix with an element value of 1 may include: assigning values ​​to the parameters at the corresponding positions in the branch structure using the element values ​​at the corresponding positions in the diagonal matrix with an element value of 1.

[0073] In this embodiment of the invention, the process of performing convolution on a convolutional layer is assumed to be represented as Y = WX, where X represents the input feature map, which is the output of a certain layer in the neural network, i.e., the activation value before adding a 1×1 convolutional layer. W represents the re-parameters initialized using a diagonal matrix with element-values ​​of 1. Y represents the output feature map obtained after the convolution operation.

[0074] In the second model initialization phase, this embodiment of the invention directly uses the model parameters of the first model to initialize the parameters of structures in the second model that are identical to those in the first model (such as the main structure). For newly added branch structures in the second model, the parameters (re-parameters) of the branch structures are initialized using a diagonal matrix with element values ​​of 1. Therefore, in the early stages of training, Y = X, which ensures that the parameters (original parameters) of the main structure in the second model play a dominant role in the early stages of training to retain the knowledge of the original task; as training progresses, the parameters of the newly added branch structures (1x1 convolutional layers) will be continuously updated to learn the knowledge of the incremental task. Assuming that Y = W at this time... new X. W new This represents the updated re-parameters during iterative training. As training progresses, the re-parameters of the branch structure are continuously optimized and gradually take a dominant role. While the main structure retains knowledge from the original task, the branch structure learns more from the incremental task, thereby balancing the conflict between the original and incremental tasks and mitigating the problem of "catastrophic forgetting".

[0075] It should be noted that during the distillation training process, the original parameters of the main structure in the second model are also updated. However, since the original task has converged to a good value, the update of the original parameters will be slower. Furthermore, in practical implementation, the update rate of the original parameters can be controlled by setting the learning rate. For example, setting the learning rate of the original parameters to a lower value can reduce their update rate.

[0076] In an optional embodiment of the present invention, the addition of a branch structure may include:

[0077] If the main structure contains multiple convolutional layers and a batch normalization layer, then the branch structure is added after the batch normalization layer.

[0078] In practical implementation, a batch normalization layer can be included after the convolutional layer. Furthermore, in cases containing multiple convolutional layers, the model structure can employ an alternating structure. An alternating structure means that each convolutional layer is immediately followed by a batch normalization layer (BN) and an activation layer (ReLU), forming a repeating unit of "convolution → batch normalization layer → activation layer". For example, the model structures of the first and second models can be as follows:

[0079] Input → [Convolutional layer → Batch normalization layer → Activation layer] × N → Output, where N is a positive integer.

[0080] In this embodiment of the invention, if the convolutional layers in the second model do not include batch normalization (BN) layers, the reparameterization process of the second model in this embodiment of the invention includes: adding a convolutional layer with a kernel size of 1×1 after each convolutional layer, and initializing the parameters of each newly added 1×1 convolutional layer using a diagonal matrix with an element value of 1.

[0081] If the convolutional layer in the second model is followed by a batch normalization (BN) layer, the reparameterization process of the second model in this embodiment of the invention includes: adding a convolutional layer with a kernel size of 1×1 only after the batch normalization layer, and initializing the parameters of the newly added 1×1 convolutional layer using a diagonal matrix with an element value of 1.

[0082] For cases including batch normalization (BN) layers, only a single 1×1 convolutional layer needs to be added after the BN layer. This is because the BN layer provides feature adjustment capabilities. Adding an additional 1×1 convolutional layer after each convolutional layer would not only offer limited benefits but also significantly increase the number of parameters and computational cost, given that the BN layer already provides feature adjustment. Since the BN layer cannot mix information from different channels, adding a 1×1 convolutional layer after it allows for cross-channel fusion, balancing model efficiency and expressive power. Furthermore, because the BN layer can be fused into the convolutional layers, during deployment, the parameters of both the BN layer and the added 1×1 convolutional layer can be integrated into the main structure's convolutional layers, ensuring model expressive power while reducing unnecessary computational overhead during inference.

[0083] In an optional embodiment of the present invention, the step of using the first model as the teacher model and the reparameterized second model as the student model, and performing distillation training using incremental data, may include:

[0084] Step S11: Determine the dynamic scaling factor for distillation training, wherein the dynamic scaling factor is used to control the weights of the original task and the incremental task during the distillation training process;

[0085] Step S12: Using the first model as the teacher model and the reparameterized second model as the student model, in the first stage of distillation training using incremental data, the dynamic scaling factor is used to increase the weight of the original task and decrease the weight of the incremental task; in the second stage of distillation training, the dynamic scaling factor is used to decrease the weight of the original task and increase the weight of the incremental task.

[0086] Distillation training is a knowledge transfer technique. Its core idea is to transfer the knowledge of a complex, pre-trained model (the teacher model) to a relatively simpler model (the student model). Teacher models typically have high performance but are computationally expensive or require large storage spaces, while student models are more lightweight and suitable for deployment in resource-constrained environments. Distillation training transfers the knowledge of the teacher model to the student model by having the student model learn its behavior, allowing the student model to achieve good performance while maintaining a smaller size.

[0087] In this embodiment of the invention, the second model is incrementally learned based on distillation training, which enables the second model to learn new tasks (incremental tasks) while retaining the original task, without the need to use a large amount of original data.

[0088] In this embodiment of the invention, a first model (the pre-trained original task model) is used as the teacher model, and a second model (the model to be incrementally learned) is used as the student model for distillation training. In this embodiment of the invention, the second model can be a model with a relatively simpler structure than the first model, or a model with the same structure, or a model with a more complex structure; this embodiment of the invention does not impose any restrictions on this.

[0089] In this embodiment of the invention, the second model is incrementally learned based on distillation training. The output of the teacher model (first model) is used as a supervision signal to constrain the parameter updates of the student model. This allows the second model to retain knowledge of the original task during the incremental learning process, alleviating the problem of "catastrophic forgetting" without relying on the original data.

[0090] During distillation training, the total loss of the second model consists of two parts: distillation loss and incremental task loss. When calculating the total loss, a hyperparameter λ can be used to set the weights corresponding to the distillation loss and incremental task loss, respectively. For example, the total loss L_total can be calculated using the following formula:

[0091] L_total=λ·L_distill+(1-λ)·L_new (1)

[0092] Where L_distill is the distillation loss, L_new is the incremental task loss, and the hyperparameter λ is used to control the weights of the distillation loss (corresponding to the original task) and the incremental task loss during training.

[0093] In practice, the hyperparameter λ can be set to a fixed value. However, due to the different learning characteristics of the original task and the incremental task at different stages of incremental learning, using a fixed hyperparameter λ will affect the effectiveness of incremental learning. For example, if λ is set to a large fixed value, the distillation loss (corresponding to the original task) will account for a large proportion throughout the training process, affecting the learning effect of the incremental task and consequently affecting the accuracy of the second model in performing the incremental task after training. If λ is set to a small fixed value, the incremental task loss will account for a large proportion throughout the training process, affecting the retention of knowledge from the original task, making it difficult to alleviate the problem of "catastrophic forgetting," and consequently affecting the accuracy of the second model in performing the original task after training.

[0094] This invention proposes an incremental learning method based on a combination of distillation training and reparameterization, and uses dynamically changing hyperparameters λ (called dynamic scaling factor) during distillation training instead of using fixed hyperparameters λ.

[0095] In incremental learning, knowledge retention for the original task mainly occurs in the early stages of training, while knowledge learning for the incremental task mainly occurs in the later stages. Therefore, this embodiment of the invention divides the distillation training process into at least two stages. In the first stage (early training stage), a dynamic scaling factor is used to assign a larger weight to the distillation loss and a smaller weight to the incremental task loss, thereby making the weight of the original task greater than the weight of the incremental task in the first stage. In the second stage (late training stage), a dynamic scaling factor is used to assign a smaller weight to the distillation loss and a larger weight to the incremental task loss, thereby making the weight of the original task less than the weight of the incremental task in the second stage.

[0096] This invention sets a dynamic scaling factor based on the importance of the original task and the incremental task at different stages of distillation training. At different stages of distillation training, the dynamic scaling factor controls the weights corresponding to the distillation loss and the incremental task loss, adapting to the learning characteristics of different tasks at each stage. In the early stages of training, the student model has limited understanding of the original task. Setting a larger weight for the distillation loss allows the student model to learn more from the teacher model's behavior and quickly learn the knowledge of the original task. As training progresses and the student model gradually masters the knowledge of the original task, the weight of the distillation loss can be dynamically reduced while the weight of the incremental task loss can be increased, allowing the student model to learn more about the incremental task. This alleviates the "catastrophic forgetting" problem while ensuring the learning effect of the incremental task.

[0097] In this embodiment of the invention, a dynamic scaling factor is determined before distillation training to control the weights of the original task and the incremental task at different stages of distillation training. This embodiment divides the distillation training process into at least two stages, such as a first stage and a second stage. The first stage and the second stage can be divided based on the number of iterations in the distillation training. Assume the number of iterations in the distillation training is T, where T is a positive integer. For example, the first iteration to the T / 2th iteration can be divided into the first stage, and the iterations from the T / 2th iteration to the Tth iteration can be divided into the second stage.

[0098] It is understood that dividing the distillation training process into two stages based solely on the number of iterations is merely an illustrative example, and this embodiment of the invention does not limit how the stages of distillation training are divided. Distillation training can be divided into more granular stages, such as three or more stages, with the weights of the original task and the incremental task in different stages controlled by a dynamic scaling factor.

[0099] During the distillation training process, training can be stopped when the iteration stopping condition is met, resulting in a trained second model. The iteration stopping condition may include the total loss being less than a preset value, or the current iteration count reaching a preset number (e.g., reaching T iterations).

[0100] In an optional embodiment of the present invention, determining the dynamic scaling factor for distillation training may include:

[0101] Step S21: Determine the initial scaling factor and the number of iterations for distillation training;

[0102] Step S22: Based on the initial scaling factor and the number of iterations, calculate the dynamic scaling factor according to a preset function; the preset function includes any one of a piecewise function, a monotonically decreasing linear function, an exponential function, and a logarithmic function.

[0103] This invention does not limit the method for calculating the dynamic scaling factor. Assume the initial scaling factor is λ0, the number of distillation training iterations is T, and the current iteration number is t. For example, the dynamic scaling factor λ can be calculated using a piecewise function as follows:

[0104]

[0105] The initial scaling factor λ0 can be an empirical value, such as 0.5. When the training reaches the t-th iteration, if... This indicates that we are currently in the first stage of distillation training. Based on equation (2) above, the dynamic scaling factor λ is calculated to be λ0. Then, λ0 is substituted into equation (1) above to calculate the total loss. If... This indicates that we are currently in the second stage of distillation training. The value of the dynamic scaling factor λ, calculated according to equation (2) above, is... Then Substitute into equation (1) above to calculate the total loss.

[0106] For example, the dynamic scaling factor can be calculated using a monotonically decreasing linear function as follows:

[0107]

[0108] in, When the training reaches the t-th iteration, the value of the dynamic scaling factor λ is calculated according to the above formula (3), and then substituted into the above formula (1) to calculate the total loss.

[0109] For example, the dynamic scaling factor can be calculated using an exponential function as follows:

[0110]

[0111] in, α>0 is used to control the decay rate. The larger the value of α, the faster the decay. When the training is performed for the t-th iteration, the value of the dynamic scaling factor λ is calculated according to the above formula (4), and substituted into the above formula (1) to calculate the total loss.

[0112] For example, the dynamic scaling factor can be calculated using an exponential function as follows:

[0113]

[0114] in, When the training reaches the t-th iteration, the value of the dynamic scaling factor λ is calculated according to the above formula (5), and then substituted into the above formula (1) to calculate the total loss.

[0115] In practice, the method for calculating the dynamic scaling factor can be selected according to actual needs, and the embodiments of the present invention do not impose any restrictions on this.

[0116] In an optional embodiment of the present invention, the method may further include:

[0117] Step S31: For the trained second model, fuse the parameters of the branch structure with the parameters of the main structure to obtain a parameter-fused second model; the number of parameters of the parameter-fused second model is the same as the number of parameters of the first model;

[0118] Step S32: Deploy the second model after parameter fusion.

[0119] The incremental learning method proposed in this invention introduces re-parameters by adding branch structures during the training phase, thereby balancing the conflict between the original task and the incremental task and alleviating the problem of "catastrophic forgetting". After training is completed, the parameters of the branch structures added during the training phase can be fused with the parameters of the main structure to obtain a second model with fused parameters. The number of parameters in the second model with fused parameters is the same as the number of parameters in the first model, thereby eliminating the additional computational overhead in the deployment phase.

[0120] Taking a 1×1 convolutional layer as an example, and assuming the main structure is a 3×3 convolutional layer, after training, the parameters of the 1×1 convolutional layer can be superimposed onto the center point of the 3×3 convolutional layer through mathematical transformation to achieve parameter fusion and ensure that the output of the model before and after parameter fusion is completely consistent.

[0121] In this embodiment of the invention, a branching structure (such as a 1×1 convolutional layer) is added to the second model, with the parameters of the branching structure serving as re-parameters. The original task is processed through the main structure, while the incremental task is processed through a combination of the main structure and the branching structure. During the distillation training phase, the branching structure enables task isolation, balancing the conflict between the original and incremental tasks. During distillation training, the loss function simultaneously optimizes the original parameters of the main structure and the re-parameters of the branching structure. That is, during the training phase, both the parameters of the main structure and the parameters of the branching structure are preserved, resulting in an increase in the number of parameters in the second model compared to the first model, and consequently, an increase in computational cost. Therefore, during the deployment phase of the second model, parameter fusion can be used to integrate the parameters of the branching structure into the parameters of the main structure, thereby restoring the number of parameters in the second model to the same level as the first model. Only the fused parameters are retained, and the model structure and number of parameters remain the same as the first model, thus eliminating the additional computational overhead caused by the branching structure after deployment.

[0122] For example, the incremental learning method of this invention may include the following steps:

[0123] Step A1: Obtain the first model; the first model is trained based on the original data and is used to perform the original task;

[0124] Step A2: Construct a second model for incremental learning based on the first model, and reparameterize the second model to obtain a reparameterized second model;

[0125] Step A3: Determine the dynamic scaling factor used for distillation training;

[0126] Step A4: Use the first model as the teacher model and the reparameterized second model as the student model. Perform distillation training based on incremental data and the dynamic scaling factor. When the iteration stopping condition is met, the trained second model is obtained. The loss function is shown in the above formula (1).

[0127] Step A5: Perform parameter fusion on the trained second model to obtain a parameter-fused second model, and deploy the parameter-fused second model; the number of parameters of the parameter-fused second model is the same as the number of parameters of the first model.

[0128] The second model after parameter fusion can be deployed on electronic devices, and the deployed second model can perform the original task and the incremental task.

[0129] Taking an image classification model as an example, the first model is trained based on the original data and can perform the original task, which is to identify objects of the first category in the image, such as cats and dogs. Using the incremental learning method of this invention, a second model is constructed and trained. The second model is based on incremental data, obtained by introducing re-parameters and distilling training based on a dynamic scaling factor. The second model can perform both the original and incremental tasks. The incremental task is to identify objects of the second category in the image, such as birds. After parameter fusion, the second model has the same number of parameters as the first model. After deployment, the second model can perform both the original and incremental tasks, such as identifying objects of the first category and objects of the second category in the image.

[0130] The target image to be identified is input into the deployed second model. The deployed second model extracts features from the target image to obtain image features. Based on the image features, the classification result corresponding to the target image is obtained. For example, the classification result includes the probability values ​​of the target image containing cats, dogs and birds respectively.

[0131] Taking an object detection model as an example, the first model is trained based on the original data and can perform the original task, which is to detect a first object in the image, such as pedestrians and vehicles. Using the incremental learning method of this invention, a second model is constructed and trained. The second model is based on incremental data, obtained by introducing re-parameters and distilling training based on a dynamic scaling factor. The second model can perform both the original and incremental tasks. The incremental task is to detect a second object in the image, such as traffic signs. After parameter fusion, the second model has the same number of parameters as the first model. After deployment, the second model can perform both the original and incremental tasks, such as detecting the first and second objects in the image.

[0132] The target image to be detected is input into the deployed second model. The deployed second model extracts features from the target image to obtain image features. Based on the image features, the detection result corresponding to the target image is obtained. The detection result includes whether the first target and the second target are detected in the target image, as well as the category and location of the first target / second target detected in the target image.

[0133] The incremental learning method of this invention can alleviate the "catastrophic forgetting" problem in the incremental learning process, thereby improving the accuracy of the second model obtained by incremental learning, such as improving the accuracy of image recognition or object detection.

[0134] In summary, this invention proposes an incremental learning method based on a combination of distillation training and reparameterization. During distillation training, a teacher model (first model) guides the learning of a student model (second model). The teacher model's output on the original task serves as a supervisory signal, constraining the student model to retain knowledge of the original task. Furthermore, during distillation training, knowledge of the original task can be transferred through distillation loss, thereby reducing reliance on the original data. Therefore, it eliminates the need to store large amounts of original data, saving storage space and improving training efficiency.

[0135] Furthermore, this embodiment of the invention utilizes a teacher model (first model) to construct a student model (second model). For parameters in the second model that share the same structure as the first model (such as the main structure), the parameters are directly initialized using the model parameters of the first model to preserve knowledge of the original task during distillation training. For newly added branch structures in the second model, parameters are initialized using diagonal matrices with element values ​​of 1 to retain more knowledge of the original task in the early stages of training. As training progresses, the original parameters of the main structure can continue to retain knowledge of the original task to a certain extent, while the heavy parameters of the newly added branch structures can learn more about the incremental task, thus balancing the conflict between the original and incremental tasks. Since the parameters of the added branch structures can be fused during the deployment phase, this embodiment of the invention can alleviate the "catastrophic forgetting" problem of incremental learning without increasing additional computational overhead, improving the accuracy of the model after incremental learning while reducing the computational load and improving model execution efficiency.

[0136] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0137] Reference Figure 2 The diagram illustrates a structural block diagram of an embodiment of the incremental learning device of the present invention, the device comprising:

[0138] The model acquisition module 201 is used to acquire a first model; the first model is trained based on the original data and is used to perform the original task.

[0139] The model building module 202 is used to take the model structure of the first model as the main structure, add branch structures, and obtain the second model;

[0140] The reparameterization module 203 is used to initialize the main structure of the second model with the model parameters of the first model, and to initialize the branch structure with the parameters of the diagonal matrix with an element value of 1, so as to obtain the reparameterized second model.

[0141] The distillation training module 204 is used to use the first model as the teacher model and the reparameterized second model as the student model, and to perform distillation training using incremental data to obtain the trained second model; the trained second model is used to perform the original task and the incremental task.

[0142] Optionally, the branch structure includes convolutional layers with a kernel size of 1×1.

[0143] Optionally, the model building module includes:

[0144] The first construction submodule is configured to add the branch structure after each convolutional layer if the main structure contains multiple convolutional layers but does not contain batch normalization layers; or,

[0145] The second construction submodule is used to add the branch structure after the batch normalization layer if the main structure contains multiple convolutional layers and a batch normalization layer.

[0146] Optionally, the distillation training module includes:

[0147] The factor determination submodule is used to determine a dynamic scaling factor for distillation training, wherein the dynamic scaling factor is used to control the weights of the original task and the incremental task during the distillation training process.

[0148] The distillation training submodule is used to perform a first stage of distillation training using the first model as the teacher model and the reparameterized second model as the student model, and to increase the weight of the original task and decrease the weight of the incremental task using the dynamic scaling factor. In the second stage of distillation training, the dynamic scaling factor is used to decrease the weight of the original task and increase the weight of the incremental task.

[0149] Optionally, the factor determination submodule is specifically used for:

[0150] Determine the initial scaling factor and the number of iterations for distillation training; based on the initial scaling factor and the number of iterations, calculate the dynamic scaling factor according to a preset function; the preset function includes any one of a piecewise function, a monotonically decreasing linear function, an exponential function, and a logarithmic function.

[0151] Optionally, the device further includes:

[0152] The parameter fusion module is used to fuse the parameters of the branch structure with the parameters of the main structure of the trained second model to obtain a parameter-fused second model; the number of parameters of the parameter-fused second model is the same as the number of parameters of the first model;

[0153] The model deployment module is used to deploy the second model after parameter fusion.

[0154] Optionally, the original data includes first image data and label values ​​based on the original task annotation; the incremental data includes second image data and label values ​​based on the incremental task annotation; the original task includes an image classification task for identifying a first category, and the incremental task includes an image classification task for identifying a second category; or, the original task includes a target detection task for detecting a first target, and the incremental task includes a target detection task for detecting a second target.

[0155] This invention proposes an incremental learning device based on a combination of distillation training and reparameterization. During distillation training, a teacher model (first model) guides the learning of a student model (second model). The teacher model's output on the original task serves as a supervisory signal, constraining the student model to retain knowledge of the original task. Furthermore, during distillation training, knowledge of the original task can be transferred through distillation loss, thereby reducing reliance on the original data. Therefore, it eliminates the need to store large amounts of original data, saving storage space and improving training efficiency.

[0156] Furthermore, this embodiment of the invention utilizes a teacher model (first model) to construct a student model (second model). For parameters in the second model that share the same structure as the first model (such as the main structure), the parameters are directly initialized using the model parameters of the first model to preserve knowledge of the original task during distillation training. For newly added branch structures in the second model, parameters are initialized using diagonal matrices with element values ​​of 1 to retain more knowledge of the original task in the early stages of training. As training progresses, the original parameters of the main structure can continue to retain knowledge of the original task to a certain extent, while the heavy parameters of the newly added branch structures can learn more about the incremental task, thus balancing the conflict between the original and incremental tasks. Since the parameters of the added branch structures can be fused during the deployment phase, this embodiment of the invention can alleviate the "catastrophic forgetting" problem of incremental learning without increasing additional computational overhead, improving the accuracy of the model after incremental learning while reducing the computational load and improving model execution efficiency.

[0157] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0158] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0159] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0160] Reference Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Figure 3 As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to execute the steps of the incremental learning method of the aforementioned embodiment.

[0161] This invention provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a terminal's program or processor, enables the terminal to perform the steps of the incremental learning method described in the foregoing embodiments.

[0162] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0163] Furthermore, the beneficial effects of using the same method will not be repeated here. For technical details not disclosed in the computer program products or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.

[0164] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.

[0165] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

[0166] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0167] The above provides a detailed description of the incremental learning method, apparatus, and electronic device provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An incremental learning method, characterized in that, The method includes: Obtain the first model; the first model is trained based on the original data, and the first model is used to perform the original task; Using the model structure of the first model as the main structure, and adding branch structures, a second model is obtained; The main structure of the second model is initialized with the model parameters of the first model, and the branch structure is initialized with the parameters of the diagonal matrix with an element value of 1, so as to obtain the reparameterized second model. The first model is used as the teacher model, and the reparameterized second model is used as the student model. Distillation training is performed using incremental data to obtain the trained second model. The trained second model is used to perform the original task and the incremental task.

2. The method according to claim 1, characterized in that, The branch structure includes convolutional layers with a kernel size of 1×1.

3. The method according to claim 1, characterized in that, The added branch structure includes: If the main structure contains multiple convolutional layers but no batch normalization layers, then the branch structure is added after each convolutional layer; or, If the main structure contains multiple convolutional layers and a batch normalization layer, then the branch structure is added after the batch normalization layer.

4. The method according to claim 1, characterized in that, The step of using the first model as the teacher model and the reparameterized second model as the student model, and performing distillation training using incremental data, includes: A dynamic scaling factor is determined for distillation training, wherein the dynamic scaling factor is used to control the weights of the original task and the incremental task during distillation training. Using the first model as the teacher model and the reparameterized second model as the student model, the first stage of distillation training is performed using incremental data. In this stage, the dynamic scaling factor is used to increase the weight of the original task and decrease the weight of the incremental task. In the second stage of distillation training, the dynamic scaling factor is used to decrease the weight of the original task and increase the weight of the incremental task.

5. The method according to claim 4, characterized in that, The determination of the dynamic scaling factor used for distillation training includes: Determine the initial scaling factor and the number of iterations for distillation training; Based on the initial scaling factor and the number of iterations, the dynamic scaling factor is calculated according to a preset function; the preset function includes any one of a piecewise function, a monotonically decreasing linear function, an exponential function, and a logarithmic function.

6. The method according to claim 1, characterized in that, The method further includes: For the trained second model, the parameters of the branch structure and the parameters of the main structure are fused to obtain a parameter-fused second model; the number of parameters in the parameter-fused second model is the same as the number of parameters in the first model; Deploy the second model after parameter fusion.

7. The method according to any one of claims 1 to 6, characterized in that, The original data includes first image data and label values ​​based on the original task annotation; the incremental data includes second image data and label values ​​based on the incremental task annotation; the original task includes an image classification task for identifying a first category, and the incremental task includes an image classification task for identifying a second category; or, the original task includes a target detection task for detecting a first target, and the incremental task includes a target detection task for detecting a second target.

8. An incremental learning device, characterized in that, The device includes: The model acquisition module is used to acquire a first model; the first model is trained based on the original data and is used to perform the original task. The model building module is used to take the model structure of the first model as the main structure, add branch structures, and obtain the second model; The reparameterization module is used to initialize the main structure of the second model with the model parameters of the first model, and to initialize the branch structure with the parameters of the branch structure with a diagonal matrix with an element value of 1, so as to obtain the reparameterized second model. The distillation training module is used to use the first model as the teacher model and the reparameterized second model as the student model, and to perform distillation training using incremental data to obtain the trained second model; the trained second model is used to perform the original task and the incremental task.

9. The apparatus according to claim 8, characterized in that, The branch structure includes convolutional layers with a kernel size of 1×1.

10. An electronic device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the steps of the incremental learning method as described in any one of claims 1 to 7.