Detection model updating method based on lifelong learning and lightweight parameter optimization

Through the lightweight parameter optimization method combined with LoRA module and EWC, the catastrophic forgetting problem in mobile deep learning model updates is solved, and efficient model updates and multi-scene adaptation are achieved in resource-constrained environments.

CN120561574APending Publication Date: 2025-08-29HANGZHOU ZHONGKE RUIJIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510453097.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-11
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

Under the limitations of hardware resources of mobile devices, frequent updates of deep learning object detection models lead to catastrophic forgetting, and the number of data samples is small, making it difficult to meet the needs of immediate updates.

Method used

The lightweight parameter optimization method combined with LoRA module and EWC is adopted to freeze the original weight by inserting a low-rank matrix, build a loss function, and update the model weights using the Prodigy optimizer to reduce the calculation and storage requirements.

Benefits of technology

Effectively protect the model's memory of old tasks, reduce the probability of forgetting, adapt to mobile resource-constrained scenarios, and realize lightweight model updates and multi-scenario deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120561574A_ABST
    Figure CN120561574A_ABST
Patent Text Reader

Abstract

The invention relates to a detection model updating method based on lifelong learning and lightweight parameter optimization. The method is suitable for the technical fields of artificial intelligence and deep learning. According to the technical scheme, the detection model updating method based on lifelong learning and lightweight parameter optimization comprises the steps that a LoRA module is constructed for a target detection model, and an original weight matrix of the target detection model aims at a first detection task; calculating the importance of each weight to the first detection task based on an original weight matrix of the target detection model, and constructing a first loss function based on the importance of each weight; freezing an original weight matrix of the target detection model, and training the combination of the target detection model and the LoRA module based on the data set of the second detection task and the first loss function to obtain a LoRA module low-rank weight matrix for the second detection task; the low-rank weight matrix of the LoRA module can be used for being combined with the original weight matrix of the target detection model to update the weight matrix of the target detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a detection model updating method based on lifelong learning and lightweight parameter optimization, which is applicable to the fields of artificial intelligence and deep learning technology. Background Art

[0002] With the widespread adoption of mobile applications, deep learning-based object detection models are being widely used in scenarios such as real-time image recognition, augmented reality, and edge computing. However, due to the hardware resource limitations of mobile devices, the parameter size and computational efficiency of detection models must meet strict requirements. Furthermore, in practical applications, models need to be lightweight to facilitate portability and deployment on the device side, and they require frequent updates to adapt to environmental changes or the addition of new detection targets. However, each model update can lead to catastrophic forgetting, meaning that the new model may lose its ability to detect old targets.

[0003] On the other hand, model updates often arise from business-side demands for certain types of data with weaker detection capabilities. These demands are immediate and require timely and cost-effective responses. Furthermore, the collection of this type of data often involves small sample sizes and a single collection channel. Therefore, model training for these problems often lacks the conditions for large-scale training, requiring only small, targeted fine-tuning within constraints. Summary of the Invention

[0004] The technical problem to be solved by the present invention is: to address the above-mentioned problems, to provide a detection model updating method based on lifelong learning and lightweight parameter optimization.

[0005] The technical solution adopted by the present invention is: a detection model updating method based on lifelong learning and lightweight parameter optimization, comprising:

[0006] Build a LoRA module for the target detection model whose original weight matrix is ​​for the first detection task;

[0007] Based on the original weight matrix of the target detection model, calculating the importance of each weight to the first detection task, and constructing a first loss function based on the importance of each weight;

[0008] Freeze the original weight matrix of the target detection model, and train the combination of the target detection model and the LoRA module based on the dataset of the second detection task and the first loss function to obtain a low-rank weight matrix of the LoRA module for the second detection task;

[0009] The low-rank weight matrix of the LoRA module can be used to combine with the original weight matrix of the target detection model to update the weight matrix of the target detection model.

[0010] The LoRA module is constructed for the target detection model, including:

[0011] Insert low-rank matrices into key layers of the object detection model, including convolutional layers and / or fully connected layers.

[0012] The original weight matrix based on the target detection model is used to calculate the importance of each weight to the first detection task, including:

[0013] Based on the original weight matrix of the target detection model, the Fisher information matrix is ​​used to calculate the importance of each weight for the first detection task.

[0014] The constructing of a first loss function based on the importance of each weight includes:

[0015]

[0016] Among them: F i is the i-th weight parameter θ i the importance of is the i-th weight parameter θ i The optimal weight for the first detection task; λ is the regularization coefficient.

[0017] The combination of the training target detection model and the LoRA module includes:

[0018] Parameter updates are performed using the Prodigy optimizer.

[0019] Based on the detection effect of the target detection model on the second detection task after weight update, the rank size of the LoRA module is adjusted.

[0020] A detection model updating device based on lifelong learning and lightweight parameter optimization, comprising:

[0021] A LoRA building module, configured to build a LoRA module for a target detection model whose original weight matrix is ​​for a first detection task;

[0022] A loss function construction module, configured to calculate the importance of each weight to the first detection task based on the original weight matrix of the target detection model, and to construct a first loss function based on the importance of each weight;

[0023] A training module is used to freeze the original weight matrix of the target detection model, and based on the data set of the second detection task and the first loss function, train the combination of the target detection model and the LoRA module to obtain a low-rank weight matrix of the LoRA module for the second detection task;

[0024] The low-rank weight matrix of the LoRA module can be used to combine with the original weight matrix of the target detection model to update the weight matrix of the target detection model.

[0025] A storage medium stores a computer program that can be executed by a processor, and when the computer program is executed, the steps of the detection model updating method based on lifelong learning and lightweight parameter optimization are implemented.

[0026] A detection model updating device comprises a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the computer program is executed, the steps of the detection model updating method based on lifelong learning and lightweight parameter optimization are implemented.

[0027] A detection model detection method, based on the detection model update method based on lifelong learning and lightweight parameter optimization, comprising:

[0028] Based on the task to be detected, the low-rank weight matrix of the LoRA module for the task to be detected is retrieved;

[0029] Combine the retrieved low-rank weight matrix of the LoRA module with the original weight matrix of the target detection model to update the weight matrix of the target detection model;

[0030] The target detection model with updated weights processes the task to be detected.

[0031] The beneficial effect of the present invention is that the present invention adds the importance of each weight to the first detection task as a constraint term into the loss function, penalizes the update of important weights, protects the model's memory of old tasks, and reduces the probability of model forgetting.

[0032] The present invention uses the LoRA technology training model to reduce the number of training parameters and storage requirements, can adapt to scenarios with limited mobile resources, and reduces dependence on memory and computing power.

[0033] The present invention can separate and store the low-rank weight matrix of the LoRA module and the original weight matrix of the target detection model, realize lightweight model updating and sharing, and facilitate multi-scenario deployment and iteration. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 Optimize the schematic diagram for EWC.

[0035] Figure 2 This is a schematic diagram of the overall structure of the target detection model and the LoRA module in the embodiment. DETAILED DESCRIPTION

[0036] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and are not to be construed as limiting the present invention. The step numbers in the following embodiments are provided for ease of explanation only and do not limit the order of the steps. The order of execution of the steps in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0037] In the description of the present invention, "a plurality" means two or more. The terms "first" and "second" are used solely to distinguish technical features and are not to be construed as indicating or implying relative importance, or as implicitly indicating the number of the indicated technical features, or as implicitly indicating the order of the indicated technical features. Furthermore, unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art.

[0038] In lifelong learning technology, a method called Elastic Weight Consolidation (EWC) is proposed. By calculating weight importance coefficients, it protects important parameters during model updates and reduces the probability of forgetting. However, EWC requires high computing resources when training large models. Although model parameters are updated in the form of changes during training, the model is finally saved as a whole. The EWC loss function is as follows:

[0039]

[0040] Among them, L task is the loss of the new task, Ω i is the weight importance coefficient, The old task weight.

[0041] The working principle of EWC is as follows Figure 1 As shown in the figure, point A is the convergence point based on task A training. If task B is trained based on point A and only the gradient of task B is considered, the optimal loss point that converges to task B will be obtained, which is the direction of the blank arrow. EWC, on the other hand, uses constraints to make the convergence direction towards the overlapping part of task A and task B, which is the direction indicated by the dotted arrow.

[0042] Low-Rank Adaptation of Large Language Models (LoRA) is a lightweight model training method that significantly reduces parameter updates and training resource requirements by inserting a small number of trainable weight matrices into the existing model, freezing the original model parameters and training only the newly added low-rank weights. Therefore, LoRA is particularly suitable for rapid iterative updates of models in resource-constrained scenarios. At the same time, the updated model increments are saved independently, minimizing changes to the existing model in the scenario.

[0043] Example 1: This example is a detection model updating method based on lifelong learning and lightweight parameter optimization, which specifically includes the following steps:

[0044] S100: Construct a LoRA module for a target detection model, wherein the original weight matrix of the target detection model is for a first detection task.

[0045] For object detection network models, architectures such as YOLO, RetinaNet, and Faster R-CNN are commonly used. In this example, the efv2s detection model, commonly used for client-side deployment, is selected. In these models, LoRA can be applied to key layers such as the network's convolutional layers (Conv2d), fully connected layers (Linear), and self-attention layers (if the model uses Transformer).

[0046] In this embodiment, the low-rank matrix of the LoRA module can be inserted into the following layers:

[0047] Convolutional layer (Conv2d): In convolutional neural networks, LoRA can adapt to model changes by adding a low-rank matrix after the convolutional layer.

[0048] Fully connected layer (Linear): Usually applied in the classification head or regression head of the network, LoRA can reduce the number of model parameters.

[0049] In this embodiment, the hyperparameters rank (rank) and alpha (scaling factor) of the LoRA module are determined according to different training data and training models. In this example, rank=64 and alpha=1 are selected.

[0050] S200. Based on the original weight matrix of the target detection model, the Fisher Information Matrix is ​​used to calculate the importance of each weight to the first detection task, and a first loss function is constructed based on the importance of each weight.

[0051] In this embodiment, the first loss function is the EWC loss function, which is usually defined as:

[0052]

[0053] Among them: F i is the i-th weight parameter θ i The importance of (obtained through the Fisher information matrix); is the i-th weight parameter θ i The optimal weight for the first detection task; λ is the regularization coefficient used to control the intensity of the penalty.

[0054] S300, freeze the original weight matrix of the target detection model, and based on the data set of the second detection task and the first loss function, train the combination of the target detection model and the LoRA module (such as Figure 2 As shown), the low-rank weight matrix of the LoRA module for the second detection task is obtained.

[0055] The low-rank weight matrix of the LoRA module can be combined with the original weight matrix of the target detection model to update the weight matrix of the target detection model. In this example, the low-rank weight matrix of the LoRA module can be stored separately from the original weight matrix of the target detection model. The low-rank weight matrices of the LoRA module for the second, third, and fourth detection tasks can be stored simultaneously, facilitating multi-scenario deployment and iteration.

[0056] In this embodiment, in addition to the standard loss function, the EWC loss function is also added during the training process to prevent forgetting.

[0057] This example uses the Prodigy optimizer for parameter updates. The Prodigy optimizer is an adaptive optimizer that automatically adjusts the learning rate based on the different parts of the model. It adjusts the learning rate based on the amount of each parameter update and its impact on the objective function, thereby improving training efficiency.

[0058] Perform regular validation to evaluate the performance of the model on the second detection task after the weight update, and observe whether the model has forgotten on the first detection task. Compare the detection results of the new model on the second detection task to observe whether its detection ability has been improved, and compare the detection ability of the new model on the first detection task to observe whether it has forgotten. Adjust hyperparameters such as the size of LoRA's low-rank matrix and the EWC regularization coefficient to balance performance and computational complexity. If the detection ability on the second detection task does not improve much, but the detection ability on the first detection task has not forgotten, it means that the rank size of LoRA needs to be increased to improve its learning ability on the second detection task, and vice versa.

[0059] This implementation combines Elastic Weight Consolidation (EWC) with Low-Rank Adaptation (LoRA), enabling deep learning models to continuously learn across multiple tasks while effectively reducing computational resource consumption. EWC helps prevent catastrophic forgetting, while LoRA reduces the computation and storage required for model fine-tuning through low-rank adaptation. Combined with the Prodigy optimizer, network models can be updated more efficiently to adapt to complex object detection tasks.

[0060] Embodiment 2: This embodiment is a detection model updating device based on lifelong learning and lightweight parameter optimization, including:

[0061] A LoRA building module, configured to build a LoRA module for a target detection model whose original weight matrix is ​​for a first detection task;

[0062] A loss function construction module, configured to calculate the importance of each weight to the first detection task based on the original weight matrix of the target detection model, and to construct a first loss function based on the importance of each weight;

[0063] A training module is used to freeze the original weight matrix of the target detection model, and based on the data set of the second detection task and the first loss function, train the combination of the target detection model and the LoRA module to obtain a low-rank weight matrix of the LoRA module for the second detection task;

[0064] The low-rank weight matrix of the LoRA module can be used to combine with the original weight matrix of the target detection model to update the weight matrix of the target detection model.

[0065] Example 3: This example is a storage medium on which a computer program that can be executed by a processor is stored. When the computer program is executed, the steps of the detection model updating method based on lifelong learning and lightweight parameter optimization described in Example 1 are implemented.

[0066] Example 4: This example is a detection model updating device having a memory and a processor. The memory stores a computer program that can be executed by the processor. When the computer program is executed, the steps of the detection model updating method based on lifelong learning and lightweight parameter optimization described in Example 1 are implemented.

[0067] Example 5: A detection method for a detection model, specifically comprising the following steps:

[0068] A. Based on the task to be detected, the low-rank weight matrix of the LoRA module for the task to be detected is retrieved. The low-rank weight matrix of the LoRA module is calculated using the detection model update method based on lifelong learning and lightweight parameter optimization described in Example 1.

[0069] B. Combine the retrieved low-rank weight matrix of the LoRA module with the original weight matrix of the target detection model to update the weight matrix of the target detection model.

[0070] C. The target detection model with updated weights processes the task to be detected.

[0071] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the above-mentioned functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More specifically, given the properties, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the module will be understood within the routine skills of an engineer. Therefore, a person skilled in the art can implement the present invention set forth in the claims using ordinary skills without undue experimentation. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0072] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the above methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.

[0073] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0074] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable media on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.

[0075] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0076] In the above description of this specification, reference to the terms "one embodiment / example," "another embodiment / example," or "certain embodiments / examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

[0077] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.

[0078] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A detection model updating method based on lifelong learning and lightweight parameter optimization, characterized in that: include: Build a LoRA module for the target detection model whose original weight matrix is ​​for the first detection task; Based on the original weight matrix of the target detection model, calculating the importance of each weight to the first detection task, and constructing a first loss function based on the importance of each weight; Freeze the original weight matrix of the target detection model, and train the combination of the target detection model and the LoRA module based on the dataset of the second detection task and the first loss function to obtain a low-rank weight matrix of the LoRA module for the second detection task; The low-rank weight matrix of the LoRA module can be used to combine with the original weight matrix of the target detection model to update the weight matrix of the target detection model.

2. The detection model updating method based on lifelong learning and lightweight parameter optimization according to claim 1 is characterized in that: The LoRA module is constructed for the target detection model, including: Insert low-rank matrices into key layers of the object detection model, including convolutional layers and / or fully connected layers.

3. The detection model updating method based on lifelong learning and lightweight parameter optimization according to claim 1 is characterized in that: The original weight matrix based on the target detection model is used to calculate the importance of each weight to the first detection task, including: Based on the original weight matrix of the target detection model, the Fisher information matrix is ​​used to calculate the importance of each weight for the first detection task.

4. The detection model updating method based on lifelong learning and lightweight parameter optimization according to claim 1 or 3, characterized in that: The constructing of a first loss function based on the importance of each weight includes: Among them: F i is the i-th weight parameter θ i the importance of is the i-th weight parameter θ i The optimal weight for the first detection task; λ is the regularization coefficient.

5. The detection model updating method based on lifelong learning and lightweight parameter optimization according to claim 1, characterized in that: The combination of the training target detection model and the LoRA module includes: Parameter updates are performed using the Prodigy optimizer.

6. The detection model updating method based on lifelong learning and lightweight parameter optimization according to claim 1, characterized in that: Based on the detection effect of the target detection model on the second detection task after weight update, the rank size of the LoRA module is adjusted.

7. A detection model updating device based on lifelong learning and lightweight parameter optimization, characterized in that: include: A LoRA building module, configured to build a LoRA module for a target detection model whose original weight matrix is ​​for a first detection task; A loss function construction module, configured to calculate the importance of each weight to the first detection task based on the original weight matrix of the target detection model, and to construct a first loss function based on the importance of each weight; A training module is used to freeze the original weight matrix of the target detection model, and based on the data set of the second detection task and the first loss function, train the combination of the target detection model and the LoRA module to obtain a low-rank weight matrix of the LoRA module for the second detection task; The low-rank weight matrix of the LoRA module can be used to combine with the original weight matrix of the target detection model to update the weight matrix of the target detection model.

8. A storage medium storing a computer program executable by a processor, characterized in that: When the computer program is executed, the steps of the detection model updating method based on lifelong learning and lightweight parameter optimization according to any one of claims 1 to 6 are implemented.

9. A detection model updating device comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, wherein: When the computer program is executed, the steps of the detection model updating method based on lifelong learning and lightweight parameter optimization according to any one of claims 1 to 6 are implemented.

10. A detection method for a detection model, characterized in that: The detection model updating method based on lifelong learning and lightweight parameter optimization according to any one of claims 1 to 6 comprises: Based on the task to be detected, the low-rank weight matrix of the LoRA module for the task to be detected is retrieved; Combine the retrieved low-rank weight matrix of the LoRA module with the original weight matrix of the target detection model to update the weight matrix of the target detection model; The target detection model with updated weights processes the task to be detected.