Active incremental learning method based on route selection and prototype learning
By using the pre-trained visual backbone model to extract category prototypes and build routing selection networks in active incremental learning, the most valuable samples are selected for incremental model training, which solves the problem of insufficient sample selection ability and low generalization ability in the existing technology. problem, achieving higher classification accuracy and lower catastrophic forgetting.
Patent Information
- Application Number
- CN202410845596.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-24
AI Technical Summary
Existing active incremental learning methods cannot effectively improve the sample selection ability during the incremental process, resulting in reduced generalization ability of the model on new data sets and prone to the problem of catastrophic forgetting.
Use the pre-trained visual backbone model to extract feature vectors from the incremental data set input images, merge the feature vectors of each category to form a category prototype, build a routing network, select the most valuable samples through the routing network for incremental model training, and update the routing network parameters to improve sample selection capabilities and model generalization capabilities.
Significantly improves classification accuracy on multiple data sets, reduces catastrophic forgetting, and enhances the model's generalization ability and adaptability.
Smart Images

Figure CN118690826A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine learning, and in particular relates to an active incremental learning method based on routing selection and prototype learning. Background Art
[0002] Active incremental learning is a combination of active learning and incremental learning. Active learning, also known as query learning, is a machine learning method that aims to dynamically select the most valuable samples to train the model in order to improve learning efficiency under a limited sample annotation budget. Traditional machine learning methods usually require a large amount of labeled sample data to train the model, and then apply the model to unlabeled data for prediction. However, the acquisition of labeled samples is often expensive, time-consuming, and labor-intensive. The goal of active learning is to make better use of limited annotation resources during the training process by intelligently selecting which unlabeled samples should be labeled. Incremental learning refers to training models in a continuous data stream while retaining and integrating old knowledge to solve the problem of catastrophic forgetting. It can continuously process continuous information flows in the real world, retaining or even integrating and optimizing old knowledge while absorbing new knowledge. Active incremental learning is very similar to the learning process of people in the real world. It imitates the way humans learn when facing unknown fields. In human learning, people tend to focus on the most difficult or uncertain tasks at the current level of knowledge, and obtain the greatest learning benefits by solving these tasks. In practical applications, a large amount of streaming data cannot be fully labeled. The cost of full labeling is high and the training speed is slow. The active incremental learning strategy enables the model to identify the samples that are most challenging to its current knowledge system, and then continuously learn from these samples through incremental learning, gradually improving the performance and adaptability of the model. This learning method not only improves learning efficiency, but also enables the model to better generalize to new, unseen data, just as humans can apply learned knowledge to new situations. Active incremental learning is one of the important basic research for realizing artificial intelligence, and it has great practical and commercial value.
[0003] At present, the active incremental learning method is just a basic combination of active learning and incremental learning processes, using random sampling, query function learning and other conventional active learning methods for sample selection, which cannot improve the sample selection ability in the incremental process. And because active incremental learning only uses a part of the samples selected by active learning for incremental model training, the small number of samples that can be trained can easily lead to a decrease in the generalization ability of the model in the new data set, deepening catastrophic forgetting. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the present invention provides an active incremental learning method based on routing selection and prototype learning. First, a pre-trained visual backbone model is used to extract a set of feature vectors from the input image of the incremental data set. On this basis, the feature vectors of each type of image are merged into a feature matrix, and the feature vectors are averaged and placed in the first row of the feature matrix. The feature is input into the pre-trained visual backbone model to obtain a processed feature matrix. The feature vectors in the first row of the feature matrix are taken as the category prototype of the category. The category prototype contains the common characteristics of the category and can represent the overall characteristics of a category. All category prototypes of a training set together constitute the classifier of the model, so that the model can more clearly distinguish different image categories. Finally, a part of the incremental images are selected in the incremental data set through an active learning method based on routing selection, and the selected images are used as the training set of the incremental model for training to update the model. The classification accuracy of this method on multiple data sets has achieved outstanding progress.
[0005] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0006] Step 1: Given all the input images of the incremental data, the feature vector of each image is encoded by the pre-trained visual backbone model with frozen parameters ,in, represents the feature vector of the jth image of the i-th class, is the set of real numbers, represents the number of features, The number of channels representing each feature;
[0007] Step 2: Merge the feature vectors of all images in each category Get the feature matrix for each category ,in Represents the number of images in the i-th category;
[0008] Step 3: For each category The feature vector of the image Take the average, ,Will Merge to The first column of , the merged feature matrix The input frozen parameters of the pre-trained visual backbone model are encoded , extract the dependencies between features, and take The first row of feature vectors is normalized as the category prototype of the i-th category ,According to this process, the category prototypes of all classes of the training data are obtained;
[0009] Step 4: Merge all category prototypes to obtain the category prototype matrix , m is the number of sample types in the training set, that is, there are m category prototypes; modify the classifier of a visual backbone model and convert the category prototype matrix The features of the output of the second-to-last layer of the model Multiply to get the predicted probability matrix , n is the number of samples trained on the model at one time, Represents the predicted probability that these n samples belong to m classes, and the modified visual backbone model is used as the incremental model;
[0010] Step 5: Add a softmax layer at the end of a visual backbone model encoder and use the softmax function for normalization to form a routing network; Input the routing network and get the i-th type of data The selection probability matrix of samples ;according to The probability size, except for the probability of the first k samples with the highest probability, will The rest The selection probability of the sample is set to 0;
[0011] Step 6: Transform the feature vector of each sample Multiply The corresponding weights in get the feature vector of the weighted sample, that is , as part of the new training set of the incremental model; perform this operation on each class to obtain a new training set for the incremental model, and select the most valuable samples in the incremental data ;
[0012] Step 7: Add samples of the training set to the incremental model Input into the incremental model constructed in step 4 to obtain the final classification score ,Will The cross entropy loss is used for training, namely: ,in is the temperature parameter;
[0013] Step 8: Use stochastic gradient descent SGD optimizer to optimize the loss function Minimize and optimize all trainable parameters in the method; the final classification result is , the argmax function can find the maximum value of the independent variable;
[0014] Step 9: Repeat steps 1 to 8 whenever there is incremental data to be learned until all data has been learned.
[0015] Preferably, the .
[0016] The beneficial effects of the present invention are as follows:
[0017] The method of the present invention uses the pre-trained visual backbone model to obtain the category prototype for each category in the incremental data, and uses these category prototypes as the final classifier of the incremental model, thereby improving the generalization ability of the model. At the same time, in terms of active learning, a learnable routing network is constructed, and the parameters of the routing network are updated during the training process of the incremental model, thereby improving the sample selection ability. Compared with previous methods, the classification accuracy of this method on multiple data sets has achieved outstanding progress. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of the structure of the method of the present invention. DETAILED DESCRIPTION
[0019] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0020] The present invention provides an active incremental learning method based on routing selection and prototype learning. The method can update the routing network following the training process of the incremental model, select the most valuable samples through the routing network for subsequent model training, improve the sample selection ability, and use the category prototype as the classifier of the model to improve the generalization ability of the model and reduce catastrophic forgetting.
[0021] The technical solution of the present invention mainly includes seven parts: the first part is to use a pre-trained visual model to extract features from an input image; the second part is a process of merging the feature vectors of each category to obtain a feature matrix of each category; the third part is a process of using the feature matrix of each category to obtain a category prototype of each category; the fourth part is to combine the category prototypes of each category as the final classifier of the model; the fifth part is to input the feature matrix of each category into a routing network, and the routing network calculates the selection probability of each sample according to the input feature matrix; the sixth part is to select a part of samples with a higher probability according to the calculated selection probability and add them to a training set; the seventh part is to use the training set to train the model to complete the learning of the incremental data set.
[0022] The method consists of the following main steps:
[0023] (1) After receiving a set of input images from the incremental data, these images are passed to a visual backbone network model that has been pre-trained on a large dataset. The parameters of the model remain unchanged to ensure that it maintains its original feature extraction capabilities when processing these new images. Through this process, the feature vector of each image is obtained. ,in, represents the feature vector of the jth image of the i-th class, is the set of real numbers, represents the number of features, Represents the number of channels for each feature.
[0024] (2) Merge the feature vectors of all images in each category Get the feature matrix for each category ,in Represents the number of images in the i-th category.
[0025] (3) For each category The feature vector of the image Take the average, ,Will Merge to The first column of , the merged feature matrix The input frozen parameters of the pre-trained visual backbone model are encoded ,Pick The first row of feature vectors is normalized as the category prototype of the i-th category ,According to this process, the category prototypes of all classes of the training data are obtained;
[0026] (4) Merge all category prototypes to obtain the category prototype matrix , m is the number of sample types in the training set, that is, there are m category prototypes. Modify the classifier of a visual backbone model and convert the category prototype matrix The features of the output of the second-to-last layer of the model Multiply to get the predicted probability matrix , n is the number of samples trained on the model at one time, represents the predicted probability that these n samples belong to m classes. The modified visual backbone model is used as the incremental model.
[0027] (5) Add a softmax layer at the end of a visual backbone model encoder and use the softmax function for normalization to form a routing network; Input the routing network and get the i-th type of data The selection probability matrix of samples ;according to The probability size, except for the probability of the first k samples with the highest probability, will The rest The selection probability of the sample is set to 0.
[0028] (6) The feature vector of each sample Multiply Get the feature vector of the weighted sample, that is , as part of the new training set of the incremental model; perform this operation on each class to obtain a new training set for the incremental model, and select the most valuable samples in the incremental data .
[0029] (7) Samples of the training set of the incremental model Input the incremental model constructed in (4) to obtain the final classification score ,Will The cross entropy loss is used for training, namely: ,in is the temperature parameter. When the temperature parameter is small, the predicted output of the model is close to 0 or 1.
[0030] (8) Use the Stochastic Gradient Descent (SGD) optimizer to optimize the loss function Minimize and optimize all trainable parameters in the method. The final classification result is , the argmax function can find the maximum value of the independent variable.
[0031] (9) Repeat steps (1) to (8) whenever there is incremental data to be learned until all the data has been learned.
[0032] Example:
[0033] The pre-trained ResNet18 model with frozen parameters is used as the backbone model for extracting feature vectors, the pre-trained visual Transformer model with frozen parameters is used as the backbone model for finding category prototypes, the pre-trained visual Transformer model is used as the backbone model for the routing network, and the untrained ResNet18 model is used as the backbone model for the incremental model. Training is performed on the training set of the CIFAR100 dataset, where the CIFAR100 dataset is divided into a batch of incremental data for every 10 categories, with a total of 10 batches of data and 100 categories.
[0034] 1. Extract image features;
[0035] Given the first batch of incremental data, i.e. the first 10 categories of data, scale all images in the incremental data set to 224×224 size, input them into the pre-trained ResNet18 model, and extract the visual feature vector of each image. .
[0036] 2. Obtain the feature matrix for each category;
[0037] Merge the feature vectors of all images for each class Get the feature matrix for each category , where the training set of each category of images in the CIFAR100 dataset is 500, so The dimensions are 500×1×512.
[0038] 3. Obtain the category prototype of each category;
[0039] Feature vectors for 500 images per category Take the average, ,Will Merge to The first line of , the merged feature matrix Input the pre-trained visual Transformer model encoding with frozen parameters , extract the dependencies between features, and take The first row of feature vectors is normalized as the category prototype of the i-th category According to this process, we can obtain the category prototypes of all classes in the training set. , ,......, , the first batch of incremental data has 10 categories, so 10 category prototypes are found;
[0040] 4. Construct an incremental model based on prototype learning;
[0041] Merge all category prototypes to get the category prototype matrix , modify the classifier of an untrained ResNet18 model and convert the category prototype matrix The features of the output of the second-to-last layer of the model Multiply to get the predicted probability matrix , n is the number of samples trained on the model at one time, It represents the predicted probability that these n samples belong to 10 categories, so that the category prototype can be used as the final classifier of the model to classify the input image. The modified visual backbone model is used as the incremental model.
[0042] 5. Construct a routing network for active learning;
[0043] A pre-trained visual Transformer model is used as the backbone model of the routing network. A softmax layer is added to the end of the model and the softmax function is used for normalization to form a routing network. The softmax function can convert the output score of the Transformer model into a selection probability. Input the routing network and obtain the selection probability matrix of 500 samples of the i-th category data . Assume that active learning here needs to select 20% of the most valuable samples, that is samples, according to Probability size, except for the selection probability of the top 100 samples with the highest probability, The selection probability of the remaining 400 samples is set to 0.
[0044] 6. Construct the incremental model input data set;
[0045] The feature vector of each sample Multiply The corresponding weights in get the feature vector of the weighted sample, that is , as part of the new training set for the incremental model. The probability of the remaining 400 samples is 0, which can make the model parameter update more concentrated on the top 100 samples, thereby achieving the key training and learning of the top 100 samples to a certain extent. This operation is performed for each class to obtain a new training set for the incremental model, that is, 100 samples for each class, and 1000 samples for ten classes in total. In this way, the top 20% of the most valuable samples in the incremental data are selected. .
[0046] 7. Classify the input image;
[0047] The samples of the training set of the incremental model Input into the incremental model constructed in step 4 to obtain the final classification score .
[0048] 8. Model training;
[0049] right The cross entropy loss is used for training, namely: , using SGD optimizer for the loss function Minimize and optimize all trainable parameters in the method. The final classification result is The CIFAR100 dataset has a total of 10 batches of incremental data. Repeat the first 7 steps until all incremental data are learned.
[0050] The above is the end-to-end training process of the present invention for the CIFAR100 dataset. Each time a batch of incremental data is input to the network, Figure 1 A schematic diagram of the invention structure under this embodiment is given. When the model is formally trained, three data sets, namely CIFAR100, ImageNet100 and Food101, are used for model training and evaluation testing. The batch size is set to 16 input images, the initial learning rate is set to 0.1, and 1 NVIDIA A100 graphics card is used to iterate 80 rounds of all images in the training set of each data set, and the SGD optimizer is used for gradient descent.
[0051] 9. Model application;
[0052] In the above training process, when the model achieves better index results, all trainable parameters in the model are saved. When testing, the model parameters with the best index (the best test effect on the validation set) are selected for application. It is only necessary to adjust the image to 224x224 size and normalize it before using it as the input of the model. The parameters of the entire network model are fixed, and only the input image needs to be propagated forward. The model can extract the feature vector of the image and finally obtain the classification result of the image. Based on the present invention, a higher active incremental learning accuracy can be obtained.
Claims
1. An active incremental learning method based on routing selection and prototype learning, characterized in that: The steps include: Step 1: Given all the input images of the incremental data, the feature vector of each image is encoded by the pre-trained visual backbone model with frozen parameters ,in, represents the feature vector of the jth image of the i-th class, is the set of real numbers, represents the number of features, The number of channels representing each feature; Step 2: Merge the feature vectors of all images in each category Get the feature matrix for each category ,in Represents the number of images in the i-th category; Step 3: For each category The feature vector of the image Take the average, ,Will Merge to The first column of , the merged feature matrix The input frozen parameters of the pre-trained visual backbone model are encoded , extract the dependencies between features, and take The first row of feature vectors is normalized as the category prototype of the i-th category ,According to this process, the category prototypes of all classes of the training data are obtained; Step 4: Merge all category prototypes to obtain the category prototype matrix , m is the number of sample types in the training set, that is, there are m category prototypes; modify the classifier of a visual backbone model and convert the category prototype matrix The features of the output of the second-to-last layer of the model Multiply to get the predicted probability matrix , n is the number of samples trained on the model at one time, Represents the predicted probability that these n samples belong to m classes, and the modified visual backbone model is used as the incremental model; Step 5: Add a softmax layer at the end of a visual backbone model encoder and use the softmax function for normalization to form a routing network. Input the routing network and get the i-th type of data The selection probability matrix of samples ;according to The probability size, except for the probability of the first k samples with the highest probability, will The rest The selection probability of the sample is set to 0; Step 6: Transform the feature vector of each sample Multiply The corresponding weights in get the feature vector of the weighted sample, that is , as part of the new training set of the incremental model; perform this operation on each class to obtain a new training set for the incremental model, and select the most valuable samples in the incremental data ; Step 7: Samples of the training set of the incremental model Input into the incremental model constructed in step 4 to obtain the final classification score ,Will The cross entropy loss is used for training, namely: ,in is the temperature parameter; Step 8: Use stochastic gradient descent SGD optimizer to optimize the loss function Minimize and optimize all trainable parameters in the method; the final classification result is , the argmax function can find the maximum value of the independent variable; Step 9: Repeat steps 1 to 8 whenever there is incremental data to be learned until all data has been learned.
2. The active incremental learning method based on routing selection and prototype learning according to claim 1, characterized in that: Said .
Citation Information
Patent Citations
Method for overcoming catastrophic forgetting based on adversarial incremental clustering dynamic routing network
CN112115998A
Method and System for Dynamic Compositional General Continual Learning
US20230385644A1
