Image classification method and device based on small sample continuous learning and singular value fine tuning
By using singular value decomposition in small sample continuous learning to build incremental adapters and optimizing incremental parameters, the model performance degradation and overfitting problems caused by small sample continuous learning is solved, and better model adaptation and performance maintenance is achieved.
Patent Information
- Application Number
- CN202411873076.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-15
AI Technical Summary
Continuous learning of small samples will lead to a significant decline in model performance and may overfitting, affecting the performance of the model on tasks.
By constructing small samples, continuously learning image classification datasets, iteratively performing model training steps, building incremental adapters using singular value decomposition, and optimizing incremental parameters to balance the model's adaptability and overfitting risks.
It effectively reduces the risk of overfitting the model in the continuous learning scenario of small samples, and at the same time reduces the problem of catastrophic forgetting, improving the overall performance of the model in multi-task learning.
Smart Images

Figure CN119832300A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of continuous learning technology, and in particular to an image classification method and device based on small sample continuous learning and singular value fine-tuning. Background Art
[0002] Continuous learning, also known as incremental learning, refers to the system constantly learning new knowledge from new samples while retaining most of the previously learned knowledge. Given the unprecedented growth in computing resources and data availability, the ability to continuously learn from new data while retaining previously acquired knowledge is essential for developing truly intelligent systems. Continuous learning requires the model to adapt to changes in data distribution while retaining knowledge of previously learned categories by sequentially introducing new categories. However, in practical applications, it is difficult to obtain large-scale data sets for new categories, which greatly limits the application of continuous learning in real-world scenarios.
[0003] Few-shot continual learning refers to a continual learning scenario where newly introduced categories have only a limited number of samples. Unlike traditional continual learning, few-shot continual learning first trains on a task with a large enough dataset to build prior knowledge. Subsequent tasks are few-shot tasks, i.e., a small number of samples containing only a small number of categories. This scenario highlights the model's ability to sequentially learn new categories from limited samples while retaining previously learned knowledge, thereby enhancing its practical applicability in real-world settings. However, the practical setting of incremental learning with limited samples also introduces two key issues in the few-shot continual learning scenario: after training on a new task, the model's performance on previously learned tasks will drop significantly. In addition, due to the limited data of the new task, the model may overfit to the training data of the current task, which will negatively affect the model's performance on these tasks. Summary of the invention
[0004] The embodiments of the present application solve the problem in the prior art that continuous learning of small samples may have a negative impact on model performance by providing an image classification method and device based on continuous learning of small samples and fine-tuning of singular values.
[0005] In the first aspect, an embodiment of the present application provides an image classification method based on small sample continuous learning and singular value fine-tuning, including: constructing a small sample continuous learning image classification dataset; wherein the small sample continuous learning image classification dataset includes multiple image classification tasks, and each of the image classification tasks includes multiple categories of image samples and their corresponding category labels; iteratively executing a model training step to train a pre-trained model until a stopping condition is met to obtain a classification model; wherein the model training step includes: training a pre-trained model using the image classification task in the small sample continuous learning image classification dataset; constructing an incremental adapter of the pre-trained model based on the task category of the image classification task, and optimizing the incremental parameters of the incremental adapter using the current model parameters of the pre-trained model; updating the current model parameters, and replacing the image classification task in the small sample continuous learning image classification dataset, and executing the model training step; using the classification model to output the classification result of the image to be processed.
[0006] In combination with the first aspect, in a possible implementation method, constructing an incremental adapter of a pre-trained model based on the task category of the image classification task includes: obtaining the current model parameters of the pre-trained model; performing singular value decomposition on the current model parameters of the pre-trained model to obtain a singular vector matrix and singular values; and constructing an incremental adapter based on the singular vector matrix and the singular values.
[0007] In combination with the first aspect, in a possible implementation manner, constructing an incremental adapter based on the singular vector matrix and the singular values is as follows:
[0008] Δθ t =UΔS t V T ;
[0009] In the formula, Δθ t represents the incremental adapter of the t-th task, t represents the t-th task, U and V represent the left and right singular vector matrices, S represents the singular value matrix, T represents the matrix transpose, θ represents the current model parameters, ΔS t represents a diagonal matrix.
[0010] In combination with the first aspect, in a possible implementation, the optimizing the incremental parameters of the incremental adapter using the current model parameters of the pre-trained model includes: the singular vector matrix remains fixed, and the singular values are optimized using the current model parameters of the pre-trained model.
[0011] In combination with the first aspect, in a possible implementation manner, before obtaining the classification model, the method further includes:
[0012] The weights of the classifier of the classification model are replaced with the feature centers of each category in the small sample continuous learning image classification dataset; wherein the feature centers are as follows:
[0013]
[0014] In the formula, p c represents the feature center of the cth category, x i represents the i-th image sample of the c-th category, i=1,…,N c , N c represents the total number of image samples in the cth category, θ t represents the current model parameters of the tth task.
[0015] In combination with the first aspect, in a possible implementation manner, the current model parameters are as follows:
[0016] θ t =θ t-1 +Δθ t ;
[0017] In the formula, θ t represents the current model parameters of the t-th task, θ t-1 represents the current model parameters of the previous task of the t-th task, Δθ t Represents the incremental adapter for the tth task.
[0018] In combination with the first aspect, in a possible implementation manner, after outputting the classification result of the image to be processed using the classification model, the method further includes: evaluating the accuracy of the classification result using an average classification accuracy and a precision decay index; the average classification accuracy is as follows:
[0019]
[0020] The precision reduction indicators are as follows:
[0021]
[0022] Where ACC represents the average classification accuracy, T represents the total number of image classification tasks contained in the small sample continuous learning dataset, and acc t,T represents the prediction accuracy of the t-th task of the classification model, that is, the ratio of the number of successful predictions to the total number of image samples in the task. FM represents the precision decay index, and acc * is the maximum prediction accuracy of the t-th task in the model training step.
[0023] In the second aspect, an embodiment of the present application provides an image classification device based on small sample continuous learning and singular value fine-tuning, including: a construction module, used to construct a small sample continuous learning image classification dataset; wherein the small sample continuous learning image classification dataset includes multiple image classification tasks, and each of the image classification tasks includes multiple categories of image samples and their corresponding category labels; a training module, used to iteratively execute model training steps to train a pre-trained model until a stopping condition is met to obtain a classification model; wherein the model training steps include: training the pre-trained model using the image classification task in the small sample continuous learning image classification dataset; constructing an incremental adapter of the pre-trained model based on the task category of the image classification task, and optimizing the incremental parameters of the incremental adapter using the current model parameters of the pre-trained model; updating the current model parameters, and replacing the image classification task in the small sample continuous learning image classification dataset, and executing the model training steps; a classification module, used to output the classification results of the image to be processed using the classification model.
[0024] In a third aspect, an embodiment of the present application provides a device, comprising: a processor; a memory for storing processor-executable instructions; when the processor executes the executable instructions, it implements the method described in the first aspect or any possible implementation method of the first aspect.
[0025] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium includes a medium for storing a computer program or instructions, which, when executed, enables the method described in the first aspect or any possible implementation method of the first aspect to be implemented.
[0026] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0027] The embodiment of the present application constructs an incremental adapter according to the task category of the image classification task, which can treat tasks with different sample sizes equally, help retain prior knowledge in the incremental adapter, and effectively overcome forgetting; by optimizing the incremental parameters of the incremental adapter, it can avoid overfitting on small sample tasks, effectively reduce the amount of learnable parameters, and reduce the risk of overfitting. It effectively solves the problem in the prior art that continuous learning of small samples will have a negative impact on model performance. It achieves the reduction of the risk of overfitting of the model in the scenario of continuous learning of small samples, and effectively alleviates the problem of catastrophic forgetting. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0029] Figure 1 A flowchart of an image classification method based on small sample continuous learning and singular value fine-tuning provided in an embodiment of the present application;
[0030] Figure 2 A schematic diagram of the structure of an image classification device based on small sample continuous learning and singular value fine-tuning provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.
[0033] Figure 1 1 is a flowchart of an image classification method based on small sample continuous learning and singular value fine-tuning provided in an embodiment of the present application, including steps 101 to 106. Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of the image classification method based on small sample continuous learning and singular value fine-tuning. In the case that the final result can be achieved, Figure 1 The steps shown may be performed in parallel or reversed.
[0034] Step 101: Construct a small sample continuous learning image classification dataset. The small sample continuous learning image classification dataset includes multiple image classification tasks, and each image classification task includes image samples of multiple categories and their corresponding category labels. In an embodiment of the present application, the small sample continuous learning image classification dataset includes a series of image classification tasks, and each image classification task includes image samples of multiple categories and their corresponding category labels. In the present application, the first image classification task contains a large number of image samples of multiple categories and their category labels, while subsequent image classification tasks only contain a small number of image samples of a few categories and their category labels.
[0035] Specifically, the present application can use the CIFAR-100 dataset downloaded from the official website and public datasets (an image classification dataset for the field of machine vision, with 20 major categories, a total of 100 minor categories, each minor category containing 600 image samples, including 500 training image samples and 100 test image samples), the CUB200-2011 dataset (a public fine-grained dataset, with a total of 11,788 bird image samples, including 200 categories of bird subcategories, including 5,994 training image samples and 5,794 test image samples, each image sample provides image class labeling information, as well as bird attribute information) and the miniImageNet dataset (containing 100 categories, a total of 6,000 color image samples, each category has 600 image samples, and the division ratio of training image samples to test image samples is 5:1) as small sample continuous learning image classification datasets.
[0036] This application takes the CIFAR-100 data set as an example, wherein the data set of the test image sample is invisible during training, and is used to finally evaluate the prediction accuracy of the classification model. A small sample continuous learning image classification data set is constructed using the CIFAR-100 data set, and the CIFAR-100 data set is divided into 9 disjoint image classification tasks, wherein the first image classification task contains all image samples of 60 categories, which is called a multi-sample benchmark task. The subsequent 8 image classification tasks all contain 5 categories, and each category contains only a small amount of image samples (e.g., each category contains only 5 image samples), which is called a small sample task. Based on the technical thinking of continuous learning, the pre-trained model needs to be learned with these continuously arriving image classification tasks, and it is necessary to be able to accurately predict all learned image classification tasks. The training of the pre-trained model can only be exposed to image classification tasks that have not been learned, and the training image samples and test image samples of the learned image classification tasks are not visible.
[0037] For example, the training image dataset of the tth task is recorded as: Among them, N trepresents the number of training image samples in the training image dataset, Represents the i-th training image of the t-th task and its corresponding category label The image samples are composed of. The test image dataset of the tth task is recorded as: in, Represents the number of test image samples in the test image dataset, Represents the i-th test image sample of the t-th task and its corresponding category label The image samples are composed.
[0038] Step 102: Use small samples to continuously learn the image classification task in the image classification dataset to train the pre-trained model. In the embodiment of the present application, the pre-trained model is a model pre-trained on other public large-scale datasets, which can be used to process image classification problems.
[0039] Specifically, the parameters of the pre-trained model can be obtained from the official website or a public third-party library. This application takes the Vision Transformer (ViT) network as an example. The structure adopts a self-attention mechanism, which can effectively capture long-distance dependencies in images. After training on large-scale data sets (such as the ImageNet-1k data set), it can provide strong feature extraction capabilities, thereby achieving more accurate classification.
[0040] The pre-trained model is continuously trained with training image samples in different image classification tasks in the small sample continuous learning image classification dataset. Each time, an image classification task is obtained from the small sample continuous learning image classification dataset, and the pre-trained model is trained with the training image samples in the image classification task.
[0041] Step 103: Construct an incremental adapter of the pre-trained model based on the task category of the image classification task, and use the current model parameters of the pre-trained model to optimize the incremental parameters of the incremental adapter. In this embodiment of the present application, the pre-trained model is continuously trained by continuously learning training image samples in different image classification tasks in the image classification dataset using small samples, and an incremental adapter is rebuilt each time a new image classification task is learned.
[0042] In an embodiment of the present application, current model parameters of the pre-trained model are obtained, singular value decomposition is performed on the current model parameters of the pre-trained model to obtain a singular vector matrix and singular values, and an incremental adapter is constructed based on the singular vector matrix and singular values.
[0043] Specifically, the current model parameters of the pre-trained model are obtained, and singular value decomposition is performed on the current model parameters of the pre-trained model as follows:
[0044] θ=USV T .
[0045] Where θ represents the current model parameter, U and V represent the left and right singular vector matrices respectively, S represents the singular value matrix, whose diagonal elements are the singular values of the current model parameter θ, and the off-diagonal elements are 0, and T represents the matrix transpose.
[0046] Construct an incremental adapter based on the singular vector matrix and singular values as follows:
[0047] Δθ t =UΔS t V T .
[0048] In the formula, Δθ t represents the incremental adapter of the t-th task, t represents the t-th task, U and V represent the left and right singular vector matrices, S represents the singular value matrix, T represents the matrix transpose, θ represents the current model parameters, ΔS t represents a diagonal matrix.
[0049] In an embodiment of the present application, the singular vector matrix remains fixed, and the singular values are optimized using the current model parameters of the pre-trained model.
[0050] Specifically, during the optimization process, the left and right singular vector matrices remain fixed, and only the diagonal elements (i.e., singular values) of the diagonal matrix participate in the optimization. The current model parameters at this time are: θ t =θ t-1 +Δθ t , where θ t represents the current model parameters of the t-th task, θ t-1 represents the current model parameters of the previous task of the t-th task, Δθ t Represents the incremental adapter for the tth task.
[0051] In addition, the weights of the classifier of the classification model are replaced with the feature centers of each category in the small sample continuous learning image classification dataset. The feature centers are as follows:
[0052]
[0053] In the formula, p c represents the feature center of the cth category, x i represents the i-th image sample of the c-th category, i=1,…,N c , N c represents the total number of image samples in the cth category, θ t Represents the current model parameters for the t-th task.
[0054] By replacing the weights of the classifier of the classification model with the feature centers of each category in the small sample continuous learning image classification dataset, the small sample transfer capability of the pre-trained model can be effectively utilized.
[0055] Step 104: Determine whether the stop condition is met. In the embodiment of the present application, the stop condition includes that the number of model training times reaches the preset number of iterations, that is, the number of model training steps executed reaches the preset number of iterations. Or the value of the classification loss decreases to less than a preset threshold. The preset number of iterations is set to 3 times, and the preset threshold is set to 10. -5 If the current pre-trained model meets the stopping condition, step 106 is executed; if the stopping condition is not met, step 105 is executed.
[0056] Step 105: Update the current model parameters and replace the image classification task in the small sample continuous learning image classification dataset. In the embodiment of the present application, the Adam optimizer is used to update the current model parameters of the pre-trained model and replace the image classification task in the small sample continuous learning image classification dataset. Then, step 102 to step 104 are performed again.
[0057] It should be noted that in the process of iteratively executing the model training steps of the present application, the image classification task used in each training should be an image classification task that has not been used before. Based on the new image classification task, a new incremental adapter is rebuilt and the previous incremental adapter is retained, so that each image classification task has a corresponding incremental adapter, thereby quickly learning new knowledge while retaining old knowledge.
[0058] Step 106: Output the classification result of the image to be processed using the classification model. In the embodiment of the present application, when the pre-trained model meets the stopping condition, the model training step is stopped, and the pre-trained model at this time is used as the classification model.
[0059] In an embodiment of the present application, the test image sample of each image classification task is input into the classification model to obtain a predicted classification result. If the predicted classification result is consistent with the category label of the test image sample, it is deemed that the prediction of the classification model is successful. The prediction accuracy of each image classification task is defined as the ratio of the number of successful predictions to the total number of test image samples in the image classification task. The maximum prediction accuracy of each image classification task is the highest prediction accuracy achieved by the image classification task during the entire training process. The average value of the prediction accuracy of all image classification tasks is calculated as the average classification accuracy of the classification model. The difference between the prediction accuracy of all image classification tasks and the maximum prediction accuracy is calculated, and the average value is calculated as the precision decay indicator.
[0060] Specifically, the average classification accuracy and precision decay indicators are used to evaluate the accuracy of the classification results.
[0061] The average classification accuracy is as follows:
[0062]
[0063] The precision reduction indicators are as follows:
[0064]
[0065] In the formula, ACC represents the average classification accuracy, T represents the total number of image classification tasks contained in the small sample continuous learning dataset, and acc t,T It represents the prediction accuracy of the t-th task of the classification model, that is, the ratio of the number of successful predictions to the total number of image samples in the task. FM represents the precision decay index, and acc * is the maximum prediction accuracy of the t-th task in the model training step.
[0066] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in this embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in sequence or in parallel according to the method shown in this embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment).
[0067] like Figure 2 As shown, the embodiment of the present application also provides an image classification device 200 based on small sample continuous learning and singular value fine-tuning. The device includes: a construction module 201, a training module 202 and a classification module 203, as follows.
[0068] The construction module 201 is used to construct a small sample continuous learning image classification dataset, wherein the small sample continuous learning image classification dataset includes multiple image classification tasks, and each image classification task includes multiple categories of image samples and their corresponding category labels.
[0069] The training module 202 is used to iteratively execute the model training steps to train the pre-trained model until a stop condition is met to obtain a classification model.
[0070] The model training steps include:
[0071] Use small sample continuous learning to train pre-trained models on image classification tasks in image classification datasets.
[0072] An incremental adapter of a pre-trained model is constructed based on the task category of the image classification task, and the incremental parameters of the incremental adapter are optimized using the current model parameters of the pre-trained model.
[0073] Update the current model parameters and replace the image classification task in the small sample continuous learning image classification dataset to perform the model training step.
[0074] The classification module 203 is used to output the classification result of the image to be processed by using the classification model.
[0075] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0076] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.
[0077] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program codes (such as software or firmware) that can be executed by the (micro) processor, logic gates, switches, application-specific integrated circuits (English: Application Specific Integrated Circuit; Abbreviation: ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.
[0078] An embodiment of the present application further provides a device, comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, the method described in the embodiment of the present application is implemented.
[0079] The embodiments of the present application also provide a non-volatile computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed, the method described in the embodiments of the present application is implemented.
[0080] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist independently, or two or more modules may be integrated into one module.
[0081] The above storage media include but are not limited to random access memory (RAM), read-only memory (ROM), cache, hard disk (HDD) or memory card. The memory can be used to store computer program instructions.
[0082] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0083] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0084] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.
Claims
1. An image classification method based on small sample continuous learning and singular value fine-tuning, characterized in that: include: Constructing a small sample continuous learning image classification dataset; wherein the small sample continuous learning image classification dataset includes multiple image classification tasks, and each of the image classification tasks includes image samples of multiple categories and their corresponding category labels; Iteratively execute the model training steps to train the pre-trained model until the stopping condition is met to obtain a classification model; Wherein, the model training step includes: Using the small sample to continuously learn the image classification task in the image classification dataset to train a pre-trained model; Building an incremental adapter of a pre-trained model based on the task category of the image classification task, and optimizing incremental parameters of the incremental adapter using current model parameters of the pre-trained model; Updating the current model parameters, replacing the image classification task in the small sample continuous learning image classification data set, and executing the model training step; The classification model is used to output the classification result of the image to be processed.
2. The method according to claim 1, characterized in that: The incremental adapter for building a pre-trained model based on the task category of the image classification task includes: Obtaining the current model parameters of the pre-trained model; Performing singular value decomposition on the current model parameters of the pre-trained model to obtain a singular vector matrix and singular values; A delta adapter is constructed based on the singular vector matrix and the singular values.
3. The method according to claim 2, characterized in that The incremental adapter is constructed based on the singular vector matrix and the singular values as follows: Δθ t =UΔS t V T ; In the formula, Δθ t represents the incremental adapter of the t-th task, t represents the t-th task, U and V represent the left and right singular vector matrices respectively, S represents the singular value matrix, T represents the matrix transpose, θ represents the current model parameters, ΔS t represents a diagonal matrix.
4. The method according to claim 3, characterized in that The optimizing the incremental parameters of the incremental adapter by using the current model parameters of the pre-trained model includes: The singular vector matrix remains fixed, and the singular values are optimized using the current model parameters of the pre-trained model.
5. The method according to claim 1, characterized in that: Before obtaining the classification model, the method further includes: The weights of the classifier of the classification model are replaced with the feature centers of each category in the small sample continuous learning image classification dataset; wherein the feature centers are as follows: In the formula, p c represents the feature center of the cth category, x i represents the i-th image sample of the c-th category, i=1,…,N c , N c represents the total number of image samples in the cth category, θ t represents the current model parameters of the t-th task.
6. The method according to claim 1, characterized in that The current model parameters are as follows: i t =θ t-1 +Δθ t ; In the formula, θ t represents the current model parameters of the t-th task, θ t-1 represents the current model parameters of the previous task of the t-th task, Δθ t Represents the incremental adapter for the tth task.
7. The method according to claim 1, characterized in that After the classification result of the image to be processed is outputted using the classification model, the method further includes: The accuracy of the classification results is evaluated using the average classification accuracy and precision decay indicators; The average classification accuracy is as follows: The precision reduction indicators are as follows: Where ACC represents the average classification accuracy, T represents the total number of image classification tasks contained in the small sample continuous learning dataset, and acc t,T represents the prediction accuracy of the t-th task of the classification model, that is, the ratio of the number of successful predictions to the total number of image samples in the task. FM represents the precision decay index, and acc * is the maximum prediction accuracy of the t-th task in the model training step.
8. An image classification device based on small sample continuous learning and singular value fine-tuning, characterized in that: include: A construction module is used to construct a small sample continuous learning image classification dataset; wherein the small sample continuous learning image classification dataset includes multiple image classification tasks, and each of the image classification tasks includes image samples of multiple categories and their corresponding category labels; A training module, used for iteratively executing the model training steps to train the pre-trained model until a stop condition is met to obtain a classification model; Wherein, the model training step includes: Using the small sample to continuously learn the image classification task in the image classification dataset to train a pre-trained model; Building an incremental adapter of a pre-trained model based on the task category of the image classification task, and optimizing incremental parameters of the incremental adapter using current model parameters of the pre-trained model; Updating the current model parameters, replacing the image classification task in the small sample continuous learning image classification data set, and executing the model training step; The classification module is used to output the classification result of the image to be processed using the classification model.
9. A device for performing an image classification method based on small sample continuous learning and singular value fine-tuning, characterized in that: include: processor; a memory for storing processor-executable instructions; When the processor executes the executable instructions, the method according to any one of claims 1 to 7 is implemented.
10. A non-volatile computer-readable storage medium, characterized in that: The device comprises a computer program or an instruction for storing the computer program or the instruction, which, when executed, enables the method according to any one of claims 1 to 7 to be implemented.
Citation Information
Patent Citations
Image classification method and device based on small sample continuous learning, and storage medium
CN113762402A
Class incremental learning method and system suitable for small sample medical image classification
CN114663696A
Image classification model training method and classification method based on incremental learning
CN115359316A
Model parameter adjustment method and device, model application method and device, equipment and medium
CN117034090A
3D small sample continuous learning method based on 2D pre-training model
CN117744706A
Cited By
Injection mold surface defect detection method based on visual inspection
CN121049290A