Continuous learning algorithm based on visual prompt

Through multi-modal feature fusion of instance cue generator and global cue pool, the inconsistency problem between training and testing phases in continuous learning of visual cues is solved, the forgetting rate is reduced, the accuracy is improved, and memory is avoided in complex scenes. and privacy issues, applicable to real-life scenario applications.

CN118644722APending Publication Date: 2024-09-13XUZHOU NORMAL UNIVERSITY
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410784006.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

Existing visual cue continuous learning methods have classifier inconsistency problems in the training and testing phases, which lead to deviations in model training and inference, and are difficult to effectively solve the catastrophic forgetting problem in scenarios with limited memory and high privacy protection requirements.

Method used

The instance hint generator is used to generate instance-level hints, and the global hint pool is combined for multi-modal feature fusion. The compact bilinear structure reduces the inconsistency in the training and testing phases, improves the robustness and generalization ability of the model, and does not Task labels need to be known in advance.

Benefits of technology

Significantly reduces the forgetting rate of the model, improves accuracy, reduces inconsistency bias during training and inference, avoids memory consumption and data privacy leakage issues, is suitable for complex scenarios, and does not require pre-knowledge of task labels in real-world scenarios .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118644722A
    Figure CN118644722A
Patent Text Reader

Abstract

The invention discloses a continuous learning algorithm based on visual cues. The algorithm comprises a global cue pool model, an instance cue generator model and a multi-mode compact bilinear feature fusion structure. According to the method, global information is introduced to guide model reasoning training by utilizing knowledge shared among tasks, and the current instance-level representation application is reasonably fused into global knowledge in a multi-mode compact bilinearity manner, so that the deviation during training and testing is reduced, and catastrophic forgetting of past task data is relieved. According to the method, the deep learning model can be helped to better understand and utilize different levels of information of input data by adopting a small amount of learnable prompt parameters, and the model can better adapt to target domain data of different types and different change degrees by using instance representation, so that the generalization ability and robustness of the model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer vision continuous learning of artificial intelligence, and in particular relates to a continuous learning algorithm based on visual cues. Background Art

[0002] In contrast to ordinary supervised learning, which is trained on independent and identically distributed data, continuous learning solves the problem of training a single model on a non-stationary data distribution, such as autonomous driving and medical scenarios, where data for different classification tasks are presented sequentially. However, since the model can only access current data at a single stage in the learning cycle, it can easily overfit to the currently available data and suffer performance degradation on previously trained data due to catastrophic forgetting.

[0003] Many studies have focused on opening up a cache in memory space to store data from past tasks and train the model together with data from the current task. However, this is ineffective in scenarios where memory space is limited and privacy is important. Regularization methods do not use caches, which limits the update of important model parameters, but the effectiveness of this method is severely reduced in complex scenarios. The method of using structure and parameter sharing requires knowing the labels of data tasks in advance during the testing phase, but it is impractical to know the task labels in advance in real scenarios. Therefore, there is a need to develop a simple and efficient continuous learning method that does not require the storage of previous task data and does not require the knowledge of task labels in advance during the testing phase, so as to achieve similar or higher levels of performance as advanced work.

[0004] Influenced by the popular prompt learning method in the field of natural language processing, fixed or learnable prompts are added to large-scale pre-trained language models to guide the model to handle downstream tasks. Inspired by it, the prompt learning technology is introduced into the field of computer vision. Compared with using the cache, the prompt method encodes knowledge in a more concise way and does not need to store data of past tasks in memory, avoiding the problem of privacy exposure while solving the problem of memory shortage, and solving the problem of catastrophic forgetting from a new perspective.

[0005] The current continuous learning method of visual cues will cause inconsistency problems between classifiers during training and testing. This is manifested in the use of a multi-layer perceptron classifier to classify images. During the training phase, the classifier can only see the categories of the current task data, but during the testing phase, it needs to include the categories of the current task and previous tasks, resulting in inconsistencies in training and testing, causing deviations in reasoning during model training and testing. Summary of the invention

[0006] In order to solve the shortcomings and deficiencies of the prior art, the present invention provides a continuous learning algorithm based on visual cues. The accuracy and forgetting rate are used as measurement indicators to evaluate the effectiveness of the model. For complex target domains and complex application scenarios, an instance prompt generator is used to generate instance-level prompts to guide the model to make reasoning decisions. In view of the inconsistency of classifiers in the training and testing stages, a global prompt pool is introduced to encode the knowledge shared between tasks, and a compact bilinear structure is used to perform multimodal feature fusion on the obtained instance features and global features, thereby reducing the deviation caused by the inconsistency during model training and test reasoning. In addition, by using the pool operation, the selected prompts can be combined in a more diverse manner and more abundant information can be encoded. At the same time, the instance-level prompts have better scalability for complex target domains, improve the robustness of the model, enhance the generalization ability of the model, and facilitate the reasoning of the model.

[0007] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is as follows:

[0008] A continuous learning algorithm based on visual cues, comprising the following steps:

[0009] Step 1: Preprocess the target domain images, divide them into training sets and validation sets in proportion, and use the category incremental learning method to divide the data set according to tasks;

[0010] Step 2: Use the frozen pre-trained ViT model to obtain the query features of the current input image, then select the corresponding N global prompts from the global prompt pool according to the key-value matching strategy, concatenate the selected N global prompts, and embed them into the input of the ViT multi-head attention layer to guide the model to encode the shared knowledge of the target domain;

[0011] Step 3: Use the instance prompt generator to generate instance-level prompts based on the input of the ViT multi-head attention layer, and use the matching strategy to obtain the task to which the image belongs based on the query features in step 2. Use the dictionary lookup operation to add additional task knowledge to the generated instance prompts, and embed the instance prompts into the input of the ViT multi-head attention layer, thereby guiding the model to make more accurate reasoning decisions;

[0012] Step 4: For the output of the global cue pool model and the output of the instance cue model, a compact bilinear structure is used to perform multimodal feature fusion to obtain fine-grained representations. The obtained fine-grained representations are input into the classifier to obtain the inference results;

[0013] Step 5: Use the weight parameter file obtained in the training phase to verify the validation set. The effect evaluated on the validation set is used to adjust the hyperparameters. Finally, the test is performed and the results are evaluated.

[0014] Furthermore, in step 1, the category increment sets the dataset so that the data arrives in the order of the task sequence. Each task contains multiple categories, and its image is in three-channel RGB graphic format. Since the benchmark pre-trained model used is the ViT model, the image is scaled to 224×224 to fit the input size of the ViT model.

[0015] Furthermore, in step 2, since the change of the feature query function may cause catastrophic forgetting, the frozen pre-trained ViT model is used as the feature query function. The input image is queried through the frozen ViT model to find the features that match the image. The features of the query are matched with the keys in the global prompt pool. The key-value matching strategy uses cosine similarity as a measure of the similarity between the query features and the keys in the global pool, so as to select a suitable global prompt prefix from the global prompt pool and embed it into the key and value at the input of the ViT multi-head attention layer. The query input is not embedded with the global prompt to guide model reasoning.

[0016] Furthermore, in step 3, the instance prompt generator uses the input of the ViT multi-head attention layer to generate a prompt for the current instance image, and then uses the query features generated by the ViT model frozen in step 2 to find the task label to which the current input image belongs based on the cosine similarity, and adds task information to the generated instance prompt.

[0017] Furthermore, in step 4, a multimodal compact bilinear pooling structure is used to fuse the global representation knowledge and the instance representation knowledge, the count sketch operation is used to map the two representation vectors, the two mapped feature vectors are fast Fourier transformed respectively, and then the two vectors are dot-producted to generate a fused feature vector, and finally the fused feature vector is inversely fast Fourier transformed to obtain two fused features with different information levels, and then the features are operated with signed root and L2 regularization, and then the multilayer perceptron is used to classify the image.

[0018] Furthermore, in step 5, the effect evaluated on the validation set is used to search for and adjust hyperparameters, such as learning rate lr, epochs, momentum, batch_size, the size of the global prompt pool, the length of the prompt, and other hyperparameters.

[0019] Compared with the prior art, the beneficial technical effects of the present invention are:

[0020] The present invention designs a continuous learning algorithm based on visual cues. An instance cue generator is used to generate instance cue for input images to guide instance cue model reasoning, which can be well adapted to complex application scenarios. The operation of a global cue pool can use task sharing knowledge to guide global cue pool model reasoning, alleviating the inconsistency problem of classifiers in the training and testing stages. The pool operation can have good scalability for data domains with a large number of tasks, and can enhance the robustness of the model. The multimodal compact bilinear method is used to fuse two feature vectors, which can make full use of global knowledge and instance knowledge, thereby improving accuracy and reducing forgetting rate. At the same time, compared with the use of attention modules for fusion, the number of module parameters can be reduced.

[0021] The present invention significantly reduces the forgetting rate of the continuous learning model and improves the accuracy. A small number of learnable parameters can achieve the same performance as the advanced level model, effectively avoiding memory consumption and data privacy leakage problems. It is also applicable to complex scene models, and does not require pre-knowledge of data task labels during the reasoning stage, which is more in line with the application of real scenes. The model has stronger generalization ability and reduces the deviation caused by the inconsistency of the trainer during training and reasoning. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a flow chart of the continuous learning algorithm based on visual cues of the present invention;

[0023] Figure 2 This is a structural diagram of a prompt generator for an example of the present invention;

[0024] Figure 3 This is a diagram showing the structure of the model of the present invention.

[0025] Figure 4 This is a structural diagram of the global prompt pool model of the present invention;

[0026] Figure 5 This is a schematic diagram of the global prompt embedding function of the present invention;

[0027] Figure 6 This is a structural diagram of a multimodal compact bilinear pool module of the present invention;

[0028] Figure 7 It is the overall model structure diagram of the present invention; DETAILED DESCRIPTION

[0029] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following will be described in detail with reference to the accompanying drawings and specific embodiments. The process, conditions, experimental methods, etc. for implementing the present invention, except for the contents specifically mentioned below, are all common knowledge and common common sense in the art, and the present invention has no special restrictions.

[0030] The present invention provides a continuous learning algorithm based on visual cues. An instance cue generator is used to generate instance-based cues to guide an instance model to perform reasoning to obtain instance-level information. A global cue pool is used to encode task sharing knowledge, and a suitable global cue is found according to query features through key-value matching to guide the global cue model to perform reasoning to obtain global representation information. A multimodal compact bilinear pool is used to perform feature fusion on the two obtained representation information, and the fused representation is classified through a multi-layer perceptron.

[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0032] Figure 1 This is a flow chart of a continuous learning algorithm based on visual cues provided by the present invention. Figure 1 As shown, this embodiment includes the following steps:

[0033] Step 1: Preprocess the target domain images and divide them into training sets and validation sets in proportion. Use the setting method of category incremental learning to divide and cut the data set according to task batches. Each task contains multiple categories, and the image is in three-channel RGB graphic format. Scale the image size to 224×224 and input the image into the model in the order of the tasks.

[0034] Step 2: Input the image into the frozen pre-trained ViT model through the embedding layer, and represent the feature corresponding to the [class] token at the output of the ViT model as the query feature q(x) corresponding to the image, so that the next step can use the query feature to find the appropriate global prompt from the global prompt pool and attach additional task information to the generated instance prompt.

[0035] Step 3, Figure 2 This is the structure diagram of the strength prompt generator, which consists of an input transposition layer, a normalization layer, a feedforward layer, and a linear transformation layer. Accepting input x∈R (n+1 ) ×D , generating a prompt P that is adaptive to the current instance. The relevant process of the prompt generator is described as:

[0036]

[0037] Among them, Ψ is a linear layer whose purpose is to map two types of affine transfer parameters [γ, β], e is the input conditional embedding of the current task, and the role of transposing the input is to make the MLP layer consider the relationship between different signs, rather than considering each channel separately, in order to correctly generate better prompts for the current instance.

[0038] like Figure 2As shown in the structure diagram of the prompt generator, after the input passes through the normalization layer, the input (n+1)×D is transposed to D×(n+1) dimensions and input into the feedforward propagation layer. The instance prompt is encoded by combining each channel of the input. The instance-level prompt generated in this way considers the information of each channel. Subsequently, the feature conversion framework is used to introduce some additional guidance to encode the prompt instructions. The additional guidance helps to generate more fine-grained instance prompts. LT uses the scaling parameter γ e ∈R D and the shift parameter β e ∈R D To perform an affine transformation on the generated instance prompts, we obtain the prompts after guidance. Using the query features obtained, we use cosine similarity to find the task label closest to the current instance, and use the embedding of the task label to supplement the generated instance prompts.

[0039] Step 4, Figure 3 For the instance prompt model, the instance prompt generator is embedded in each layer of ViT, the generated instance prompt and the input are concatenated and input into the multi-head attention layer of ViT, and finally the output features of the [class] token of the last layer are used as instance-based representation information.

[0040] Step 5, Figure 4 It is a global hint model that dynamically selects hints suitable for different inputs based on the query features of the image using a key-value pair query strategy, and associates each hint in the hint pool as a learnable key-value pair {(k1,p1),(k2,p2),L,(k M ,p M )}, using cosine similarity as a measure of query features and keys in the pool, according to γ(q(x),k i ) Cosine similarity finds the most matching subset of N keys from the global prompt pool. Select the corresponding prompt from the prompt pool according to the matching key, and follow Figure 5 The prefix embedding method shown is f(p,h)=MSA(h q ,[p;h k ],[p;h v ])The prompt is embedded into the key and value of ViT, the query input is not embedded, and the output [class] token of the last multi-head attention layer is used as the global feature information.

[0041] Step 6, Figure 6It is a multimodal compact bilinear pooling structure diagram. The global feature information and instance feature information are input. After the count sketch operation, the two feature vectors are mapped, and then the fast Fourier transform is performed respectively. The transformed vectors are subjected to the dot product operation, and then the inverse fast Fourier transform is performed to obtain the fused features. The fused features are L2 regularized and input into the classifier for classification.

[0042] The effectiveness of the algorithm of the present invention is mainly evaluated by the average accuracy and forgetting rate commonly used in continuous learning. The average accuracy is an overall evaluation index, which mainly includes two aspects: stronger learning ability and less catastrophic forgetting, while the forgetting rate is mainly used as a metric for catastrophic forgetting.

[0043] Let the evaluation score be S t,τ , represents the classification accuracy on the τth task after the tth task training is completed. After the algorithm completes the tth task training, calculate the average accuracy (A t ) and the forgetting rate (F t )as follows:

[0044]

[0045] In summary, the present invention provides a continuous learning algorithm based on visual cues, which uses instance-level information for encoding in complex scenes, and introduces a global cue pool to reduce inconsistencies in continuous learning training and test classifiers, thereby improving the accuracy of reasoning and reducing the forgetting rate. Moreover, it does not require the consumption of memory space and avoids privacy leakage. It does not require the labels of the tasks to be known in advance when testing reasoning, which is more in line with the application of real-world scenarios than existing continuous learning algorithms.

[0046] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A continuous learning algorithm based on visual cues, which uses feature information of different levels of multi-granularity to enhance the performance of the visual cue model, is characterized by: The following steps are involved: Step 1: pre-process the target domain images, divide them into training sets and validation sets in proportion, and divide the data sets according to tasks according to the setting method of category incremental learning; Step 2: Use the frozen pre-trained ViT model to obtain the query features of the current input image, then select the corresponding global prompts from the global prompt pool according to the key-value matching strategy, concatenate the selected global prompts, and embed them into the input of the ViT multi-head attention layer to guide the model to encode the shared knowledge of the target domain; Step 3: Use the instance prompt generator to generate instance-level prompts based on the input of ViT’s multi-head attention layer, and obtain the task to which the image belongs through the matching strategy. Add additional task knowledge to the generated instance prompts through a dictionary lookup operation to obtain instance prompts with additional task knowledge, and perform a splicing operation with the input of ViT’s corresponding multi-head attention layer, thereby guiding the instance-level model to make more accurate reasoning decisions; Step 4: For the output of the global cue pool model and the output of the instance cue model, a compact bilinear structure is used to perform multimodal feature fusion to obtain fine-grained representations. The obtained fine-grained representations are input into the classifier to obtain the inference results; Step 5: Use the weight parameter file obtained in the training phase to verify the validation set. The effect evaluated on the validation set is used to adjust the hyperparameters. Finally, the test is performed and the results are evaluated.

2. According to the continuous learning algorithm based on visual cue consistency described in claim 1, its input image is in a three-channel RGB graphic format, the target domain data is divided according to the category increment method, each task contains multiple categories, so that the data arrives in the order of the task sequence, and since the baseline model used is a pre-trained ViT model, the image is scaled to size to adapt to the input size of the ViT model.

3. The continuous learning algorithm based on visual cue consistency according to claim 1, characterized in that: In the step 2, since the change of the feature query function may lead to catastrophic forgetting, the frozen ViT is used as the query function to obtain the query feature of the image. The key-value matching strategy uses cosine similarity as a measure of the similarity between the query feature and the key in the global pool, so as to select a suitable global hint prefix from the global hint pool and embed it into the key and value at the input of the ViT multi-head attention layer, where the query input is not embedded with the global hint to guide model reasoning.

4. The continuous learning algorithm based on visual cue consistency according to claim 1, characterized in that: In step 3, the strength prompt generator uses the input of the ViT multi-head attention layer to generate a prompt for the current instance image, then uses the frozen ViT model to generate query features, searches for the task label to which the current input image belongs based on cosine similarity, and adds task information to the generated instance prompt.

5. The continuous learning algorithm based on visual cue consistency according to claim 1, characterized in that: In the step 4, the compact bilinear structure fuses the global representation knowledge and the instance representation knowledge, uses the count sketch operation to map the two representation vectors, performs a fast Fourier transform on the two mapped feature vectors, then performs a dot product operation, and finally performs an inverse fast Fourier transform to obtain two fused features with different information levels, thereby using a multi-layer perceptron to classify the image.

6. The continuous learning algorithm based on visual cue consistency according to claim 1, characterized in that: During the training phase, the Pytorch deep learning framework is used to learn the model parameters of the training set, and the validation set is used to calculate the accuracy during the training process and adjust the hyperparameters.

Citation Information

Cited By

  • Image classification method and device based on incremental learning, medium and product

    CN119206364A

  • An image classification method, device, medium and product based on incremental learning

    CN119206364B

  • Intelligent power grid fault detection model training optimization method based on federated learning

    CN119884896A

  • A smart grid fault detection model training optimization method based on federated learning

    CN119884896B