Analogical prompting-based incremental learning method, apparatus and device, and storage medium
By using analog -based methods in incremental learning, calculating and combining the analog parameters of historical task data, solving the problem of forgetting and high storage costs in incremental learning, and improving stability and plasticity.
Patent Information
- Application Number
- PCT/CN2023/137162
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-26
- Filing Date
- 2023-12-07
- Publication Date
- 2025-01-30
AI Technical Summary
In incremental learning, the model prevents the previous knowledge learned by storing a large amount of historical data, resulting in higher storage costs.
Adopt an incremental learning method based on analogial prompts, calculate the analog parameters of the historical task data, and combine it with the current task data to generate analog sample data to eliminate the clustering center of the historical task data, and then use the model to fine -tune and classify the classification Essence
Effectively prevent the knowledge learned before forgetting the model, while reducing the storage cost of the model, and improving the stability and plasticity of incremental learning.
Smart Images

Figure CN2023137162_30012025_PF_FP_ABST
Abstract
Description
Incremental learning method, device, equipment and storage medium based on analogy prompting Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an incremental learning method, apparatus, device and storage medium based on analogy prompts. Background Art
[0002] Incremental learning is a machine learning method that aims to enable a model to continuously learn new data without forgetting previously learned knowledge. However, incremental learning has always faced the problem of "catastrophic forgetting". After updating the model with new data, the neural network will adjust the weights according to the current input, resulting in previously learned knowledge being overwritten or lost. As a result, the model's ability to fit the previous data will drop sharply.
[0003] In related technologies, the historical data of the model is saved by the replay method, thereby preventing the model from forgetting the knowledge learned before. This method can effectively prevent the model from forgetting the knowledge learned before. However, storing a large amount of historical data will bring high storage costs.
[0004] Summary of the Invention
[0005] The main purpose of this application is to provide an incremental learning method, device, equipment and storage medium based on analogy prompts, aiming to solve the technical problem in related technologies that the model storage cost is high because a large amount of historical data is stored to prevent the model from forgetting previously learned knowledge.
[0006] To achieve the above objectives, an embodiment of the present application provides an incremental learning method based on analogy prompts, the method comprising:
[0007] Acquire a dataset to be classified, wherein the dataset to be classified includes training set data and test set data;
[0008] Based on the current task data and the historical task data in the training set data, analogy parameters for each category in the corresponding historical task data are calculated, and the analogy parameters are combined with the current task data to obtain analogy sample data;
[0009] Based on the current task data, fine-tune the preset classification model to obtain a fine-tuned preset classification model, and based on the analog sample data and the fine-tuned preset classification model, eliminate the offset generated by the cluster center of the historical task data to obtain cluster center data without offset;
[0010] Based on the fine-tuned preset classification model and the cluster center data, the test set data is classified to obtain classified data.
[0011] In a possible implementation of the present application, the step of calculating the analogy parameter for each category in the corresponding historical task data based on the current task data and the historical task data in the training set data includes:
[0012] Sampling a data subset of the current task data that is closest to the cluster center of each class of the historical task data;
[0013] Based on the data subset and the first preset objective function, an analogy parameter of each class in the corresponding historical task data is calculated.
[0014] In a possible implementation of the present application, the step of calculating the analogy parameter for each class in the corresponding historical task data based on the data subset and the first preset objective function includes:
[0015] Inputting the data subset into the first preset objective function;
[0016] Based on the first preset objective function, the data subset is trained to obtain analog parameters for each class in the corresponding historical task data;
[0017] Among them, the first preset objective function is expressed as
[0018] Among them, L CC represents the category conversion loss, L PP Indicates the cluster center approach loss, L DE represents the incentive diversity loss, Represents a subset of the input data.
[0019] In a possible implementation of the present application, the fine-tuned preset classification model classifies the test set data based on multiple cluster centers of each data category in the test set data, so that the feature distribution between different categories of data is clearly distinguished.
[0020] In a possible implementation of the present application, the step of fine-tuning the preset classification model based on the current task data to obtain the fine-tuned preset classification model includes:
[0021] Based on the current task data, training a second preset objective function of the preset classification model to obtain a fine-tuned preset classification model;
[0022] Wherein, the second preset objective function is expressed as: L FT =L C +L SC .;
[0023] Among them, L C Represents the cross entropy loss on the current task, LSC represents the offset consistency loss.
[0024] In a possible implementation of the present application, the step of eliminating the offset of the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain non-offset cluster center data includes:
[0025] Based on the fine-tuned preset classification model, the analog feature data and the historical task data are instance-converted to determine the offset value generated by the cluster center of the historical task data;
[0026] The cluster center value of the historical task data is added to the offset value to obtain cluster center data without offset.
[0027] In a possible implementation of the present application, the step of classifying the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data includes:
[0028] Extracting a first data feature of the test data set based on the fine-tuned preset classification model;
[0029] The first data feature and the cluster center data are input into the classification layer to calculate the first data category with the highest score and the classification data corresponding to the first data category.
[0030] The present application also provides an incremental learning device based on analogy prompts, the incremental learning device based on analogy prompts further comprising:
[0031] An acquisition module is used to acquire a data set to be classified, wherein the data set to be classified includes training set data and test set data;
[0032] A combining module is used to calculate the analogy parameters of each category in the corresponding historical task data based on the current task data and the historical task data in the training set data, and combine the analogy parameters with the current task data to obtain analogy sample data;
[0033] an elimination module, configured to fine-tune the preset classification model based on the current task data to obtain a fine-tuned preset classification model, and eliminate the offset generated by the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain cluster center data without offset;
[0034] A classification module is used to classify the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data.
[0035] The present application also provides an incremental learning device based on analogy prompts, which is a physical node device. The incremental learning device based on analogy prompts includes: a memory, a processor, and a program of the incremental learning method based on analogy prompts stored on the memory and executable on the processor. When the program of the incremental learning method based on analogy prompts is executed by the processor, the steps of the incremental learning method based on analogy prompts as described above can be implemented.
[0036] To achieve the above-mentioned purpose, a storage medium is also provided, on which an incremental learning program based on analogy prompts is stored. When the incremental learning program based on analogy prompts is executed by a processor, the steps of any of the above-mentioned incremental learning methods based on analogy prompts are implemented.
[0037] The present application provides an incremental learning method, apparatus, device and storage medium based on analogy prompts. Compared with the related art in which a large amount of historical data is stored to prevent the model from forgetting previously learned knowledge, resulting in a high storage cost of the model, in the present application, a data set to be classified is obtained, wherein the data set to be classified includes training set data and test set data; based on the current task data and historical task data in the training set data, analogy parameters for each category in the corresponding historical task data are calculated, and the analogy parameters and the current task data are combined to obtain analogy sample data; based on the current task data, the preset classification model is fine-tuned to obtain a fine-tuned preset classification model, and based on the analogy sample data and the fine-tuned preset classification model, the offset generated by the cluster center of the historical task data is eliminated to obtain cluster center data without offset; based on the fine-tuned preset classification model and the cluster center data, the test set data is classified to obtain classified data. In this application, the preset classification model is trained based on the acquired training set data, and the analogy prompt method is used to extract analogy parameters from the historical training data, and the analogy parameters are combined with the current task data to obtain analogy sample data containing the features corresponding to the historical task data. The analogy sample data is then used to eliminate the offset generated by the cluster center of the historical task data to obtain the corresponding non-offset cluster center data. The preset classification model is fine-tuned through the current task data to obtain a fine-tuned new model. Then, based on the non-offset cluster center data and the fine-tuned model, the test set data can be classified. There is no need to save historical data, but to extract analogy parameters from the historical data, and combine the analogy parameters with the current task data. The analogy sample data is used to eliminate the offset of the cluster center corresponding to the historical task data, preventing the model from forgetting the knowledge learned before, and reducing the storage cost of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] FIG1 is a flow chart of a first embodiment of an incremental learning method based on analogy prompting according to the present application;
[0039] FIG2 is a schematic diagram of a detailed flow chart of step S20 in the first embodiment of the incremental learning method based on analogy prompting of the present application;
[0040] FIG3 is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application;
[0041] FIG4 is a schematic diagram showing a comparison between the incremental learning method based on analogy prompts of the present application and the existing SDC method. DETAILED DESCRIPTION
[0042] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0043] The present application provides an incremental learning method based on analogy prompts. In a first embodiment of the incremental learning method based on analogy prompts, referring to FIG1 , the method includes:
[0044] Step S10, obtaining a data set to be classified, wherein the data set to be classified includes training set data and test set data;
[0045] Step S20, based on the current task data and the historical task data in the training set data, calculating the analogy parameters for each category in the corresponding historical task data, and combining the analogy parameters with the current task data to obtain analogy sample data;
[0046] Step S30: fine-tuning the preset classification model based on the current task data to obtain a fine-tuned preset classification model, and eliminating the offset of the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain cluster center data without offset;
[0047] Step S40: classify the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data.
[0048] The purpose of this embodiment is to generate analogy prompts by training historical data, and combine new sample data with the analogy prompts of historical data to obtain corresponding analogy sample data, thereby eliminating the offset between historical data and new sample data, and completing the fine-tuning process of the preset classification model, thereby avoiding catastrophic forgetting of the model without the need to save historical data.
[0049] In this embodiment, the technical background is:
[0050] In the incremental learning method of the model, the previously learned knowledge is used to quickly adapt to new data. However, after updating the model with new data, the neural network will adjust the weights according to the current input, which will cause the previously learned knowledge to be overwritten or lost. As a result, the model's ability to fit the previous data will drop sharply. Therefore, it is necessary to improve the stability and plasticity of the incremental learning model.
[0051] The specific steps are as follows:
[0052] Step S10, obtaining a data set to be classified, wherein the data set to be classified includes training set data and test set data;
[0053] As an example, the incremental learning method based on analogy prompts can be applied to an incremental learning device based on analogy prompts, the incremental learning device based on analogy prompts belongs to an incremental learning system based on analogy prompts, and the incremental learning system based on analogy prompts belongs to an incremental learning device based on analogy prompts.
[0054] As an example, the data set to be classified can be image data, text data, and other data that can be input into the model.
[0055] As an example, the training set data is the parameter used to train the model. The training set data is input into the model, and multiple data iterative calculations are performed to complete the model training process. After the model training is completed, the test set data is input into the model for the next step of processing.
[0056] As an example, a method of obtaining the data to be classified may be: collecting image data on a computer or receiving data from others.
[0057] As an example, define the task sequence for the incremental scenario Where T is the total number of tasks, S t represents all the tags seen before task t, S t =∪{y 1 ,y 2 ,...,y t}, X t Represents all visible samples of task t and establishes a training dataset Z t ={(x,y)|x∈X t ,y∈Y t}.
[0058] Step S20, based on the current task data and the historical task data in the training set data, calculating the analogy parameters for each category in the corresponding historical task data, and combining the analogy parameters with the current task data to obtain analogy sample data;
[0059] As an example, historical task data is the training data existing in the last or previous task, and current task data is the training data existing in the current task.
[0060] As an example, the analogy parameter can be an analogy prompt, which is specifically a feature vector obtained after training historical data. The analogy prompt is divided into multiple categories. During the training process, only analogy prompts of specific categories are trained. The analogy prompt is used to establish a link between the new data and the old data, so that the characteristics of the historical data can also be retained on the current task data / new data.
[0061] As an example, analogy parameters are combined with current task data to obtain analogy sample data including new and old analogy features.
[0062] As an example, analog sample data is feature data after analog feature symbols are added. At this time, the feature data includes analog features between new data and old data.
[0063] As an example, since incremental learning models are prone to forgetting previous knowledge, by combining analogy prompts with current task data, the combination process can be feature addition or data combination, so that an association is established between the current task data and historical task data, so that the model can recall the data categories seen before through analogy prompts.
[0064] Step S30: fine-tuning the preset classification model based on the current task data to obtain a fine-tuned preset classification model, and eliminating the offset of the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain cluster center data without offset;
[0065] As an example, in an incremental learning model, when the training tasks are different, the distribution of the data corresponding to the tasks in the feature space is also different. For example, after the data of task 1 and task 2 are trained, the cluster centers of their data will move in the feature space. The distance of the movement is the offset value of the feature data / cluster center.
[0066] As an example, the cluster center data is the data corresponding to the current task obtained after eliminating the offset.
[0067] The step of fine-tuning the preset classification model based on the current task data to obtain the fine-tuned preset classification model, and eliminating the offset of the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain cluster center data without offset includes:
[0068] Step A1: Based on the fine-tuned preset classification model, perform instance conversion on the analog feature data and the historical task data to determine the offset value generated by the cluster center of the historical task data;
[0069] As an example, by performing an instance-based transformation of analog sample data and historical data, the offset value of the corresponding data cluster center is estimated, and the offset of the representation is estimated by comparing the features extracted from the analog sample on the old model and the updated new model.
[0070] As an example, the offset value is expressed as:
[0071] Among them, δ i|y It is an instantiation conversion between new and old analogical features, is the i-th analog feature of category y in the new feature space.
[0072] As an example, since features that are close to each other in the old feature space should have similar shifts after fine-tuning, we can estimate the shift of the cluster centers as follows:
[0073] Among them, Δ y Represents the cluster center Estimated displacement.
[0074] Step A2: Add the cluster center value of the historical task data to the offset value to obtain cluster center data without offset.
[0075] As an example, after obtaining the estimated displacement, the offset value of the cluster center of the previous historical task data can be offset in the following manner to obtain the cluster center data without offset.
[0076] As an example, the way to obtain the unbiased cluster center data can be:
[0077] in, represents the cluster center of historical task data, Represents cluster center data or cluster centers after eliminating offsets.
[0078] Step S40: classify the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data.
[0079] As an example, after the model training is completed, the parameters in the preset classification model are fine-tuned to obtain a fine-tuned new model.
[0080] As an example, the preset classification model is specifically a large-scale pre-training model. The large-scale pre-training model can reduce the training cost. After training, only fine-tuning is required, and the time required for training is reduced.
[0081] As an example, the preset classification model uses Vision Transformer (ViT) as the backbone network Among them, f e is the embedding layer, which converts the input image x into tokens, f a It consists of a series of encoders, each of which includes a multi-head attention layer and a multi-layer perception layer, loaded with pre-trained weights downloaded in advance.
[0082] The step of fine-tuning the preset classification model based on the current task data to obtain the fine-tuned preset classification model includes:
[0083] Step B1: training a second preset objective function of a preset classification model based on the current task data to obtain a fine-tuned preset classification model;
[0084] Wherein, the second preset objective function is expressed as: L FT =L C +L SC .
[0085] Among them, L C Represents the cross entropy loss on the current task, L SC represents the offset consistency loss.
[0086] As an example, in order to improve training efficiency, most of the weights in the model are frozen, and only the multi-layer perceptron and classification layers need to be updated. The expression of the offset consistency loss is as follows:
[0087] Among them, Δ i is the true feature displacement of the i-th sample during fine-tuning, δ i It is the feature displacement estimated by the feature displacement of nearby samples.
[0088] The step of classifying the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data includes:
[0089] Step C1, extracting a first data feature of the test data set based on the fine-tuned preset classification model;
[0090] As an example, data features of a test data set are extracted through a fine-tuned preset classification model, wherein the first data feature is the data feature in the input test data set.
[0091] Step C2: input the first data feature and the cluster center data into the classification layer, and calculate the first data category with the highest score and the classification data corresponding to the first data category.
[0092] As an example, the classification layer is specifically a soft nearest neighbor multi-cluster center classifier. When inputting the classification layer, the cluster center data and the test set data stored in the external buffer pool are input into the classification layer, and then the scores of the input data are calculated to select the corresponding data category with the highest score. Here, taking the image category as an example, the selected image category is used as the image category of the input test data, and then the image classification is completed.
[0093] As an example, a comparison diagram of the incremental learning method based on analogy cues in this application and the existing SDC (semantic drift compensation) method is shown in Figure 4. Compared with the SDC method, this application has a smaller cluster center estimation bias and is more reasonable. The SDC method directly uses the original features of the current task as a reference to calculate the deviation of the data before and after model fine-tuning, thereby estimating the deviation of the historical cluster center. The figure below visualizes the relationship between the average reference distance and the displacement estimation bias, where the average reference distance is the average distance between the reference feature and the cluster center before fine-tuning, and the cluster center estimation bias is the distance between the corrected cluster center and the true cluster center after fine-tuning the new task. It can be seen from the figure that the larger average reference distance calculated by the SDC method will lead to a more significant cluster center estimation bias. In contrast, the cluster center estimation bias of our method is less than that of SDC because the analog features have been pushed to the cluster center of the target data during the fine-tuning of the model.
[0094] As an example, the present application reduces the inference cost by half compared to other prompt-based methods, such as L2P (cited from the literature (Learning to prompt for continual learning.In CVPR, Incremental / continuous learning based on the Prompt paradigm)), DualP (cited from the literature (Complementary prompting for rehearsal-free continual learning.arXiv,)), and S-Prompt (cited from the literature (An occam's razor for domain incremental learning.arXiv)). These methods train task-based prompts to reduce interference between tasks. Therefore, during testing, they must first perform a prompt-free inference to obtain the task ID, and then use the task ID to perform task-conditional inference to obtain the final prediction. Compared with them, we only need to perform prompt-free inference once and discard the prompt after completion, which significantly reduces the time and memory cost of inference by half.
[0095] The present application provides an incremental learning method, apparatus, device and storage medium based on analogy prompts. Compared with the related art in which a large amount of historical data is stored to prevent the model from forgetting previously learned knowledge, resulting in a high storage cost of the model, in the present application, a data set to be classified is obtained, wherein the data set to be classified includes training set data and test set data; based on the current task data and historical task data in the training set data, analogy parameters for each category in the corresponding historical task data are calculated, and the analogy parameters and the current task data are combined to obtain analogy sample data; based on the current task data, the preset classification model is fine-tuned to obtain a fine-tuned preset classification model, and based on the analogy sample data and the fine-tuned preset classification model, the offset generated by the cluster center of the historical task data is eliminated to obtain cluster center data without offset; based on the fine-tuned preset classification model and the cluster center data, the test set data is classified to obtain classified data. In this application, the preset classification model is trained based on the acquired training set data, and the analogy prompt method is used to extract analogy parameters from the historical training data, and the analogy parameters are combined with the current task data to obtain analogy sample data containing the features corresponding to the historical task data. The analogy sample data is then used to eliminate the offset generated by the cluster center of the historical task data to obtain the corresponding non-offset cluster center data. The preset classification model is fine-tuned through the current task data to obtain a fine-tuned new model. Then, based on the non-offset cluster center data and the fine-tuned model, the test set data can be classified. There is no need to save historical data, but to extract analogy parameters from the historical data, and combine the analogy parameters with the current task data. The analogy sample data is used to eliminate the offset of the cluster center corresponding to the historical task data, preventing the model from forgetting the knowledge learned before, and reducing the storage cost of the model.
[0096] Furthermore, based on the first embodiment of the present application, another embodiment of the present application is provided. In this embodiment, the step of calculating the analogy parameter for each category in the corresponding historical task data based on the current task data and the historical task data in the training set data includes:
[0097] Step S201, sampling a data subset of the current task data that is closest to the cluster center of each class of the historical task data;
[0098] As an example, extract the target cluster center from the current training data The subset X with the closest distance t :
[0099] K is the total number of samples in each historical cluster center, and K-NN(·) is the K nearest neighbors of a given feature vector.
[0100] As an example, the target cluster center is the class center feature of the target data. In each type of feature data, there are multiple class center features.
[0101] As an example, the data subset is a set composed of multiple feature data. After the target cluster center is selected, the data adjacent to the target cluster center can also be determined.
[0102] As an example, the current task data or the historical task data includes multiple data subsets. By collecting the data subsets to estimate the offset of the cluster center, the amount of calculation can be saved.
[0103] Step S202 : Based on the data subset and the first preset objective function, the analogy parameter of each class in the corresponding historical task data is calculated.
[0104] As an example, a first preset objective function is trained using a data subset to obtain corresponding analogy parameters, namely, analogy prompts, wherein each category of the data corresponds to an analogy prompt.
[0105] The step of calculating the analogy parameter of each class in the corresponding historical task data based on the data subset and the first preset objective function includes:
[0106] Step D1, inputting the data subset into the first preset objective function;
[0107] Step D2: training the data subset based on the first preset objective function to obtain analogy parameters for each class in the corresponding historical task data;
[0108] Among them, the first preset objective function is expressed as
[0109] Among them, L CC represents the category conversion loss, L PP Indicates the cluster center approach loss, L DE represents the incentive diversity loss, Represents a subset of the input data.
[0110] As an example, the first preset objective function includes three parts:
[0111] Part I CC is the class conversion loss, which remaps the analog sample to the target old class y:
[0112] Where N is the training batch size, is the i-th analog feature of category y on the old model, and h(·) is a fully connected classification layer with Softmax normalization function.
[0113] The second part is L PP It is the prototype push loss, which aims to push the feature vector of the analog sample toward the target cluster center:
[0114] The third part is the incentive diversity loss, which prevents analog features from collapsing into a single point:
[0115] in, Negative values are truncated to 0, and Ω is a constant margin, which is set to 1 in this method.
[0116] As an example, the corresponding three-part function is trained by using a data subset to calculate the analogy parameter, and then the offset value of the historical cluster center is offset according to the analogy parameter.
[0117] In this embodiment, the first preset objective function is trained based on the data subset to obtain analogy parameters, establish a connection between new and old data, and retain old knowledge by estimating and offsetting the representation offset of the cluster center of the historical task data.
[0118] Furthermore, based on the first and second embodiments of the present application, another embodiment of the present application is provided. In this embodiment, the fine-tuned preset classification model classifies the test set data based on multiple cluster centers of each data category in the test set data, so that the feature distribution between different categories of data is clearly distinguished.
[0119] In this embodiment, the cluster centers are maintained by a soft nearest neighbor multi-cluster center classifier (Soft-Neares-Multi-Prototype (SNMP)). The classifier maintains the cluster centers by calculating the average class center of each class in the feature space. Multiple cluster centers are maintained for each data category instead of a single average center for each data category, which better highlights the feature distribution and boundaries between different categories of data.
[0120] As an example, the classifier can be expressed as:
[0121] in, represents the mth cluster center of category y, where M is the total number of cluster centers for each data category. d(·,·) can be any distance function between two vectors, and the Euclidean distance is used in this invention.
[0122] As an example, after the model training is completed, the test data set and the cluster centers of multiple data categories stored in the external buffer pool are input into the classifier to calculate the scores and complete the data / image classification.
[0123] In this embodiment, a soft nearest neighbor multi-cluster center classifier is used to maintain multiple cluster centers for each data category, thereby highlighting the characteristic distribution of different data in the same category of data, making the classification more accurate.
[0124] As an example, this application conducted experiments on four challenging benchmark datasets, including CIFAR100, ImageNet-R, 5-dataset, and Core50. Multiple evaluation metrics were obtained using the final average accuracy (FAA) and final forgetting rate (FF), which evaluate the model after the last task. FAA is related to the model's plasticity and stability, while FF depends solely on the model's stability. The calculation formulas for these two metrics are as follows:
[0125] Among them, S t,T is the evaluation score of the t-th task, and T is the total number of tasks.
[0126] This application is compared with three of the most popular incremental learning methods based on prompt tuning. The following table compares this application with these incremental learning methods: L2P, DualP, and S-Prompt.
[0127] As can be seen from the table, the method of the present invention achieves the best performance on the three datasets CIFAR100, ImageNet-R, and Core50. The performance on the 5-dataset dataset is not much different from the current best performing method. It can be concluded that the method of the present invention is feasible and has high performance.
[0128] Refer to Figure 3, which is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0129] As shown in FIG3 , the analogy-based incremental learning device may include: a processor 1001 , a memory 1005 , and a communication bus 1002 . The communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005 .
[0130] Optionally, the analogy-based incremental learning device may further include a user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, a WiFi module, and the like. The user interface may include a display and an input submodule such as a keyboard. The optional user interface may also include a standard wired interface and a wireless interface. The network interface may include a standard wired interface and a wireless interface (such as a WiFi interface).
[0131] Those skilled in the art will understand that the analogy-based incremental learning device structure shown in FIG3 does not constitute a limitation on the analogy-based incremental learning device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0132] As shown in Figure 3, memory 1005, a storage medium, may include an operating system, a network communication module, and an analogy-based incremental learning program. The operating system manages and controls the hardware and software resources of the analogy-based incremental learning device, supporting the execution of the analogy-based incremental learning program and other software and / or programs. The network communication module facilitates communication between components within memory 1005, as well as with other hardware and software in the analogy-based incremental learning system.
[0133] In the analogy-based incremental learning device shown in FIG3 , the processor 1001 is configured to execute the analogy-based incremental learning program stored in the memory 1005 to implement any of the steps of the analogy-based incremental learning method described above.
[0134] The specific implementation of the incremental learning device based on analogy prompts in this application is basically the same as the embodiments of the incremental learning method based on analogy prompts mentioned above, and will not be repeated here.
[0135] The present application also provides an incremental learning device based on analogy prompts, the incremental learning device based on analogy prompts further comprising:
[0136] An acquisition module is used to acquire a data set to be classified, wherein the data set to be classified includes training set data and test set data;
[0137] A combining module is used to calculate the analogy parameters of each category in the corresponding historical task data based on the current task data and the historical task data in the training set data, and combine the analogy parameters with the current task data to obtain analogy sample data;
[0138] an elimination module, configured to fine-tune the preset classification model based on the current task data to obtain a fine-tuned preset classification model, and eliminate the offset generated by the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain cluster center data without offset;
[0139] A classification module is used to classify the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data.
[0140] In a possible implementation of the present application, the combining module includes:
[0141] a sampling unit, configured to sample a data subset of the current task data that is closest to the cluster center of each class of the historical task data;
[0142] A first calculation unit is configured to calculate an analogy parameter for each class in the corresponding historical task data based on the data subset and a first preset objective function;
[0143] In a possible implementation of the present application, the calculation unit includes:
[0144] an input subunit, configured to input the data subset into the first preset objective function;
[0145] a training subunit, configured to train the data subset based on the first preset objective function to obtain analogy parameters for each class in the corresponding historical task data;
[0146] Among them, the first preset objective function is expressed as
[0147] Among them, L CC represents the category conversion loss, L PP Indicates the cluster center approach loss, L DE represents the incentive diversity loss, Represents a subset of the input data.
[0148] In a possible implementation of the present application, the classification module includes:
[0149] A training unit, configured to train a second preset objective function of a preset classification model based on the current task data to obtain a fine-tuned preset classification model;
[0150] Wherein, the second preset objective function is expressed as: L FT =L C +L SC .;
[0151] Among them, L CRepresents the cross entropy loss on the current task, L SC represents the offset consistency loss.
[0152] In a possible implementation manner of the present application, the elimination module includes:
[0153] a determination unit, configured to perform instance conversion on the analog feature data and the historical task data based on the fine-tuned preset classification model, and determine an offset value generated by a cluster center of the historical task data;
[0154] The second calculation unit is used to add the cluster center value of the historical task data to the offset value to obtain cluster center data without offset.
[0155] In a possible implementation of the present application, the classification module further includes:
[0156] an extraction unit, configured to extract a first data feature of the test data set based on the fine-tuned preset classification model;
[0157] An input unit is used to input the first data feature and the cluster center data into a classification layer, and calculate the first data category with the highest score and the classification data corresponding to the first data category.
[0158] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0159] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0161] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An incremental learning method based on analogy prompts, characterized in that: The method comprises the following steps: Acquire a data set to be classified, wherein the data set to be classified includes training set data and test set data; Based on the current task data and the historical task data in the training set data, analogy parameters for each category in the corresponding historical task data are calculated, and the analogy parameters are combined with the current task data to obtain analogy sample data; Based on the current task data, fine-tune the preset classification model to obtain a fine-tuned preset classification model, and based on the analogy sample data and the fine-tuned preset classification model, eliminate the offset of the cluster center of the historical task data to obtain cluster center data without offset; Based on the fine-tuned preset classification model and the cluster center data, the test set data is classified to obtain classified data.
2. The incremental learning method based on analogy prompting as claimed in claim 1, characterized in that: The step of calculating the analogy parameter of each category in the corresponding historical task data based on the current task data and the historical task data in the training set data includes: Sampling a data subset in the current task data that is closest to the cluster center of each class of the historical task data; Based on the data subset and the first preset objective function, an analogy parameter of each class in the corresponding historical task data is calculated.
3. The incremental learning method based on analogy prompting as claimed in claim 2, characterized in that: The step of calculating the analogy parameter of each class in the corresponding historical task data based on the data subset and the first preset objective function includes: Inputting the data subset into the first preset objective function; Based on the first preset objective function, the data subset is trained to obtain analogy parameters for each class in the corresponding historical task data; Among them, the first preset objective function is expressed as Among them, L CC represents the category conversion loss, L PP Indicates the cluster center approach loss, L DE represents the incentive diversity loss, Represents a subset of the input data.
4. The incremental learning method based on analogy prompting as claimed in claim 1, characterized in that: The fine-tuned preset classification model classifies the test set data based on multiple cluster centers of each data category in the test set data, so that the feature distribution between different categories of data is clearly distinguished.
5. The incremental learning method based on analogy prompting as claimed in claim 1, characterized in that: The step of fine-tuning the preset classification model based on the current task data to obtain the fine-tuned preset classification model includes: Based on the current task data, training a second preset objective function of the preset classification model to obtain a fine-tuned preset classification model; Wherein, the second preset objective function is expressed as: L FT =L C +L SC .; Among them, L C represents the cross entropy loss on the current task, L SC represents the offset consistency loss.
6. The incremental learning method based on analogy prompting as claimed in claim 1, characterized in that: The step of eliminating the offset of the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain cluster center data without offset includes: Based on the fine-tuned preset classification model, the analog sample data and the historical task data are instance-converted to determine the offset value generated by the cluster center of the historical task data; The cluster center value of the historical task data is added to the offset value to obtain cluster center data without offset.
7. The incremental learning method based on analogy prompting as claimed in claim 1, characterized in that: The step of classifying the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data includes: Extracting a first data feature of the test data set based on the fine-tuned preset classification model; The first data feature and the cluster center data are input into the classification layer to calculate and obtain the first data category with the highest score and the classification data corresponding to the first data category.
8. An incremental learning device based on analogy prompts, characterized in that: The analogy-based incremental learning device comprises: An acquisition module is used to acquire a data set to be classified, wherein the data set to be classified includes training set data and test set data; A combining module, used to calculate the analogy parameters of each category in the corresponding historical task data based on the current task data and the historical task data in the training set data, and combine the analogy parameters with the current task data to obtain analogy sample data; The elimination module is used to fine-tune the preset classification model based on the current task data to obtain the fine-tuned preset classification model, and to eliminate the offset of the cluster center of the historical task data based on the analog sample data and the fine-tuned preset classification model to obtain the cluster center without offset. Heart data; A classification module is used to classify the test set data based on the fine-tuned preset classification model and the cluster center data to obtain classified data.
9. An incremental learning device based on analogy prompts, characterized in that: The device includes: a memory, a processor, and an analogy-based incremental learning program stored in the memory and executable on the processor, wherein the analogy-based incremental learning program is configured to implement the steps of the analogy-based incremental learning method as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores an incremental learning program based on analogy prompts, and when the incremental learning program based on analogy prompts is executed by a processor, the steps of the incremental learning method based on analogy prompts as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Semi-supervised learning training method and system and computer readable storage medium
CN110298415A
Image classification method and system based on incremental learning
CN112559784A
Class incremental learning method and system based on analogy learning
CN115879533A
Incremental learning method and device based on analogy prompt, equipment and storage medium
CN117009823A
System and method for incremental training of machine learning models in artificial intelligence systems, including incremental training using analysis of network identity graphs
US20220269990A1
Cited By
Unbiased animal behavior recognition method and system based on multi-scale feature fusion
CN120260142A
Class incremental learning method for high-adaptation fine tuning and pseudo sample playback under subspace integration
CN121480616A