Image classification method based on self-adaptive task regularization model irrelevant element learning
By introducing adaptive task regularization items into the meta-learning method, dynamically adjusting the task difficulty, the lack of the meta-learning method in handling task difficulty differences is solved, and better generalization ability is achieved in the environment of insufficient data.
Patent Information
- Application Number
- CN202411415653.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2024-12-27
AI Technical Summary
The existing meta-learning method based on scenario training ignores the difficulty differences between different tasks in task sampling, resulting in the model that may have too many contacts with simple tasks during training, ignore more challenging tasks, and be difficult to inadequate data. Effective generalization in the environment.
采用自适应任务正则化模型无关元学习方法,通过在外循环中整合任务难度作为正则化项,动态调整任务学习难度,使模型能够在训练过程中更有效地从更有价值的任务中学习,逐步增加任务难度以提升模型的适应性和泛化能力。
The model can learn effective knowledge from tasks at different times, improve its ability to generalize quickly in an environment with insufficient data, and ensure that the model has stronger adaptability and generalization ability when facing new tasks.
Smart Images

Figure CN119206360A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision and relates to an image classification method based on adaptive task regularization model-independent meta-learning. Background Art
[0002] As the cornerstone of computer vision, image classification is of great importance. It is not only related to the accuracy of visual recognition, but also has a profound impact on the progress and development of many application fields. In recent years, deep learning has made breakthrough progress in image classification tasks with its significant advantages in processing large-scale labeled data. However, the limitations of this technology have also become apparent: when faced with scenarios with scarce data, the generalization ability of deep learning models drops sharply, making it difficult to effectively cope with the challenges of new samples. This dilemma highlights the excessive reliance of traditional deep learning methods on large amounts of labeled data and their shortcomings in small sample learning scenarios.
[0003] In this context, meta-learning, as an advanced strategy that simulates human learning ability, provides a new approach to solving the problem of small sample learning. Meta-learning emphasizes the ability to "learn how to learn", that is, to use past learning experience to quickly adapt to and efficiently solve new tasks. This ability enables the model to no longer be limited to specific tasks or data sets, but to quickly adjust and optimize itself based on previous knowledge when encountering new situations, thereby achieving effective learning and generalization of small amounts of data. The introduction of meta-learning gives deep learning models a more flexible and efficient learning mechanism, and is an important step towards more intelligent artificial intelligence.
[0004] Model-Agnostic Meta-Learning (MAML) is an important implementation of meta-learning. Its core lies in learning a set of good model initialization parameters. These parameters enable the model to achieve good performance with only a small amount of gradient updates when facing new tasks. The advantage of MAML lies in its versatility. It does not rely on a specific model structure and can be flexibly applied to various deep learning models. Through the training mechanism of inner and outer loops, the model first quickly adapts to the current task in the inner loop, and then integrates the knowledge learned from multiple tasks in the outer loop, thereby realizing knowledge accumulation and transfer, effectively improving the adaptability and generalization ability of the model in a small sample environment.
[0005] However, meta-learning methods based on scenario training, such as MAML, also face certain challenges. Among them, the randomness and uniformity of task sampling is a key issue. Existing methods often ignore the difficulty differences and training value between different tasks, resulting in the model being exposed to too many simple tasks during training and ignoring more challenging tasks. For example, in image classification, the task of distinguishing between "birds" and "dogs" is less difficult than distinguishing between "shepherd dogs" and "pastoral dogs", and its contribution to model training gradually decreases as training progresses. Therefore, how to dynamically adjust the difficulty of tasks during training to ensure that the model can continue to learn from more valuable tasks has become an important direction for optimizing meta-learning strategies. Summary of the invention
[0006] In view of this, the object of the present invention is to provide an image classification method based on adaptive task regularization model-independent meta-learning.
[0007] In order to achieve the above object, the present invention provides the following technical solutions:
[0008] An image classification method based on adaptive task regularization model-independent meta-learning, comprising the following steps:
[0009] S1, obtain the data set and preprocess the data;
[0010] S2, establish image recognition model;
[0011] S3, training the image recognition model through model-independent meta-learning based on adaptive task regularization;
[0012] S4. Classify and identify images through the trained image recognition model.
[0013] Further, in step S1, a data set B is obtained, and M categories C are randomly selected from B = {C 1 ,...,C M}, K and L samples of each category are used to construct the support set S of task T = {(s k ,y k )} K×M and query set Q = {(q t ,y t )} L×M .
[0014] Further, in step S2, the backbone network of the image recognition model includes at least convolution modules and activation function layers, wherein the convolution module includes several convolution blocks, each convolution block includes a 64-channel 3×3 core filter, a batch normalization layer, a ReLU nonlinear activation function and a 2×2 maximum pooling layer, wherein the input image first passes through several convolution blocks in the four-layer convolution module in sequence, the core filter extracts image features, the batch normalization layer standardizes the input of each small batch of data, the ReLU nonlinear activation function learns the nonlinear relationship in the image, the maximum pooling layer reduces the dimension while retaining the key features of the image, and finally the activation function layer converts the model output into a probability distribution by the activation function softmax.
[0015] Further, in step S3, the image recognition model is cyclically trained according to the constructed data set, which includes:
[0016] S31, initializing the network parameters θ of the image recognition model;
[0017] S32, randomly select H tasks from the base class In each batch of tasks, the support set Train the image recognition model on
[0018] S33, calculating the loss value of the cross entropy loss function;
[0019] S34, update the model parameters by gradient descent method to obtain the parameter set θ * ;
[0020] S35. In the query set Perform forward propagation on the updated model and calculate the updated parameters θ * The loss value of the image recognition model and the weight vector of the current task;
[0021] S36, updating the model parameters again and gradually increasing the difficulty of task learning;
[0022] S37. Reselecting the support set Repeat steps S33-S36 to fine-tune the parameters of the image recognition model until the training is completed when a predetermined number of training rounds is reached on the query set.
[0023] Further, in step S33, the loss function value of the image recognition model on the support set is calculated as follows:
[0024]
[0025] In the formula, x, y represent the support set A set of sample images and corresponding class labels in f θ(x) represents the result after the sample is input into the backbone network for training. Indicates that the model The loss function on .
[0026] Further, in step S34, the process of updating the model parameters is expressed as:
[0027]
[0028] In the formula, α represents the learning rate, Indicates the model in task T i Find the gradient of the loss on θ′ i ∈θ * .
[0029] Further, in step S35, the updated model parameter θ * Substitute the following formula to calculate the loss value of the model:
[0030]
[0031] For a given task batch E = {T 1 ,T 2 ,...,T H}, binary weight vector v * = {v 1 ,v 2 ,...,v H}, where v i ∈v * , specifically expressed as:
[0032]
[0033] Among them, λ represents the learning difficulty. When the image recognition model is in the query set When the loss function value of is less than the learning difficulty λ, learning is performed, otherwise no learning is performed.
[0034] Further, in step S36, the parameter updating process is expressed as:
[0035]
[0036] The learning difficulty adjustment process is expressed as:
[0037] λ=λ+η
[0038] In the formula, β represents the learning rate of the outer loop, and η is the learning difficulty growth coefficient.
[0039] Furthermore, in step S4, the image data set to be identified and classified is input into the trained image recognition model, and the image recognition model outputs the classification result.
[0040] The beneficial effects of the present invention are:
[0041] The present invention provides an image classification method based on adaptive task regularization model-independent meta-learning, which integrates the task difficulty into a regularization term in the outer loop update so that the model can adaptively learn task experience based on what the model has learned. In this way, the model can learn effective knowledge from tasks at different times and generalize quickly in an environment with insufficient data.
[0042] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0044] Figure 1 A simplified structural diagram of the backbone network of the image recognition model of the present invention;
[0045] Figure 2 A schematic diagram of a model training process based on an adaptive task regularization model-independent meta-learning method of the present invention;
[0046] Figure 3 Schematic diagram of the model parameter updating process. DETAILED DESCRIPTION
[0047] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0048] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0049] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0050] See also Figure 1 to Figure 3 , an image classification method based on adaptive task regularization and model-independent meta-learning.
[0051] Example
[0052] This embodiment provides an image classification method based on adaptive task regularization model-independent meta-learning, which at least includes the following steps:
[0053] S1, obtain the data set and preprocess the data;
[0054] S2, establish image recognition model;
[0055] S3, training the image recognition model through model-independent meta-learning based on adaptive task regularization;
[0056] S4. Classify and identify images through the trained image recognition model.
[0057] In step S1 of this embodiment, a data set B is obtained, and M categories C={C 1 ,...,C M}, K and L samples of each category are used to construct the support set S of task T = {(s k ,y k )} K×M and query set Q = {(q t ,y t )} L×M .
[0058] In this embodiment, the acquired data set B refers to the image data set mini-ImageNet, which includes 100 categories of pictures, each category has 600 samples.
[0059] In step S2 of this embodiment, the backbone network of the image recognition model includes at least one four-layer convolution module Conv-4 and one activation function layer softmax layer, wherein the four-layer convolution module Conv-4 includes at least four convolution blocks, such as Figure 1 As shown in the figure, each convolution block includes a 64-channel 3×3 core filter, a batch normalization layer, a ReLU nonlinear activation function, and a 2×2 maximum pooling layer. The input image first passes through several convolution blocks in the four-layer convolution module in sequence, and the core filter extracts image features. The batch normalization layer standardizes the input of each small batch of data. The ReLU nonlinear activation function learns the nonlinear relationship in the image. The maximum pooling layer reduces the dimension while retaining the key features of the image. Finally, the activation function layer converts the model output into a probability distribution by the activation function softmax.
[0060] In step S3 of this embodiment, the image recognition model is cyclically trained according to the constructed data set, such as Figure 2 As shown, the specific process is:
[0061] S31, initializing the network parameters θ of the image recognition model;
[0062] S32, randomly select H tasks from the base class In each batch of tasks, the support set Train the image recognition model on
[0063] S33. Calculate the loss value of the cross entropy loss function:
[0064]
[0065] In the formula, x, y represent the support set A set of sample images and corresponding class labels in f θ (x) represents the result after the sample is input into the backbone network for training. Indicates that the model The loss function on ;
[0066] S34, update the model parameters by gradient descent method to obtain the parameter set θ * :
[0067]
[0068] In the formula, α represents the learning rate, Indicates the model in task T i Find the gradient of the loss on θ′ i ∈θ * .
[0069] S35. In the query set Perform forward propagation on the updated model and calculate the updated parameters θ * The loss value of the image recognition model and the weight vector of the current task are calculated, where the updated model parameters θ′ are i Substitute the following formula to calculate the loss value of the model:
[0070]
[0071] For a given task batch E = {T 1 ,T 2 ,...,T H}, binary weight vector v * = {v 1 ,v 2 ,...,v H}, where v i ∈v * , specifically expressed as:
[0072]
[0073] Among them, λ represents the learning difficulty. When the image recognition model is in the query set When the loss function value of is less than the learning difficulty λ, the task is used as the basis for parameter update. Otherwise, it is considered that the task is difficult for the current model. Therefore, the parameters of this task will not be referenced when the meta-parameters are updated. After the generalization ability on other tasks is enhanced, this more difficult task will be learned in the next cycle, such as Figure 3 As shown in the figure, the task difficulty is measured by weight. Each task is a binary value. For the current model, tasks whose loss function value does not exceed λ are considered to be learnable and have a weight of 1. Tasks whose loss function value exceeds λ are considered to be too difficult for the current model and have little meaning to learn, so they have a weight of 0.
[0074] S36, update the model parameters again and gradually increase the difficulty of task learning:
[0075]
[0076] λ=λ+η
[0077] In the formula, β represents the learning rate of the outer loop, and v is the learning difficulty growth coefficient. As the number of training batches increases, the generalization ability of the model on different tasks increases, and the difficulty of the tasks that can be referenced gradually increases. In this way, the experiential knowledge learned from different tasks can be effectively explored and stored in θ. In the process of meta-parameter update, a regularization term related to task difficulty is added. The meta-parameter is the initialization model parameter of each training round. It will be affected by the loss function of each task in the previous round. The model will summarize and learn the experiential knowledge in each task in the previous round. In tasks whose difficulty exceeds the current capability range of the model (loss exceeds λ), it is difficult for the model to learn useful knowledge, and it is also possible to provide the model with the wrong optimization direction. Therefore, according to the weight generation method described in claim 2, this part of knowledge can be ignored in the meta-parameter update.
[0078] S37. Reselecting the support set Repeat steps S33-S36 to fine-tune the parameters of the image recognition model until the predetermined training rounds are reached on the query set, and the training is completed. The image categories of the support set and query set used for meta-testing should not be repeated with the image categories of meta-training in the above text. The useful knowledge learned by the model in the inner loop is summarized and updated in the outer loop, so that the updated model is easier to generalize when facing similar tasks than before training. During training, the samples on the support set and query set are 5-way-5-shot or 5-way-1-shot, that is, each group of training models will only be exposed to 5 (5-way) different types of images, and each image has only 5 (5-shot) or 1 (1-shot) samples for learning, so the model must gradually have the ability to quickly extract the core knowledge of the task in an environment with a small number of samples, while avoiding learning misleading content. Tasks that are not referenced this time because of excessive difficulty will be trained by the model in subsequent cycles. As the number of training rounds increases, the upper limit of the task difficulty of the model will gradually increase.
[0079] In step S4 of this embodiment, the image data set to be identified and classified is input into the trained image recognition model, and the image recognition model outputs the classification result.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. An image classification method based on adaptive task regularization model-independent meta-learning, characterized by: It includes the following steps: S1, obtain the data set and preprocess the data; S2, establish image recognition model; S3, train the image recognition model through model-independent meta-learning based on adaptive task regularization; S4. Classify and identify images through the trained image recognition model.
2. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 1, characterized in that: In step S1, a data set B is obtained, and M categories C are randomly selected from B = {C1,...,C M }, K and L samples of each category are used to construct the support set S of task T = {(s k ,y k )} K×M and query set Q = {(q t ,y t )} L×M .
3. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 2, characterized in that: In step S2, the backbone network of the image recognition model includes at least convolution modules and activation function layers, wherein the convolution module includes several convolution blocks, each of which includes a 64-channel 3×3 core filter, a batch normalization layer, a ReLU nonlinear activation function and a 2×2 maximum pooling layer, wherein the input image first passes through several convolution blocks in the four-layer convolution module in sequence, the core filter extracts image features, the batch normalization layer standardizes the input of each small batch of data, the ReLU nonlinear activation function learns the nonlinear relationship in the image, the maximum pooling layer reduces the dimension while retaining the key features of the image, and finally the activation function layer converts the model output into a probability distribution by the activation function softmax.
4. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 3, characterized in that: In step S3, the image recognition model is cyclically trained according to the constructed data set, which includes: S31, initializing the network parameters θ of the image recognition model; S32, randomly select H tasks from the base class In each batch of tasks, the support set Train the image recognition model on S33, calculating the loss value of the cross entropy loss function; S34, update the model parameters by gradient descent method to obtain the parameter set θ * ; S35. In the query set Perform forward propagation on the updated model and calculate the updated parameters θ * The loss value of the image recognition model and the weight vector of the current task; S36, updating the model parameters again and gradually increasing the difficulty of task learning; S37. Reselecting the support set Repeat steps S33-S36 to fine-tune the parameters of the image recognition model until the training is completed when the predetermined training rounds are reached.
5. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 4, characterized in that: In step S33, the loss function value of the image recognition model on the support set is calculated as follows: In the formula, x, y represent the support set A set of sample images and corresponding class labels in f θ (x) represents the result after inputting the sample into the backbone network for training. Indicates that the model The loss function on .
6. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 5, characterized in that: In step S34, the process of updating the model parameters is expressed as: In the formula, α represents the learning rate, Indicates the model in task T i Find the gradient of the loss on θ′ i ∈θ * .
7. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 6, characterized in that: In step S35, the updated model parameter θ * Substitute the following formula to calculate the loss value of the model: For a given task batch E = {T1, T2, ..., T H }, binary weight vector v * ={v1,v2,...,v H }, where v i ∈v * , specifically expressed as: Among them, λ represents the learning difficulty. When the image recognition model is in the query set When the loss function value of is less than the learning difficulty λ, learning is performed, otherwise no learning is performed.
8. The image classification method based on adaptive task regularization model-independent meta-learning according to claim 7, characterized in that: In step S36, the parameter updating process is expressed as: The learning difficulty adjustment process is expressed as: λ=λ+η In the formula, β represents the learning rate of the outer loop, and η is the learning difficulty growth coefficient.
9. An image classification method based on adaptive task regularization model-independent meta-learning according to any one of claims 1 to 8, characterized in that: In step S4, the image data set to be identified and classified is input into the trained image recognition model, and the image recognition model outputs the classification result.
Citation Information
Patent Citations
Iris recognition method based on small sample learning
CN112949454A
Training method and application of image classification model based on meta-learning
CN115564987A
Rare fundus disease automatic classification method and system based on OCT image
CN118411573A
