A genetic programming-based meta-learning small sample image classification method

By automatically generating neural network architectures through genetic programming and combining them with the MAML algorithm, the problem of feature extraction difficulties caused by fixed network structures in image classification during meta-learning is solved, thereby improving the accuracy and generalization ability of image classification.

CN118799617BActive Publication Date: 2026-07-21NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NORTHEASTERN UNIV CHINA
Filing Date
2024-06-12
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing meta-learning-based methods in image classification suffer from difficulties in feature extraction and classification performance due to their fixed network structure, which makes it hard to adapt to the high degree of variation and distortion between images.

Method used

A neural network architecture is automatically generated using genetic programming, combined with the MAML algorithm for meta-learning. Genetic programming generates flexible tree-structured individuals, automatically generating feature extraction networks that adapt to different images, thereby improving classification performance.

Benefits of technology

By using an automatically generated neural network architecture, the accuracy and generalization ability of image classification are improved in the case of a small number of samples, and the problem of feature extraction under image changes and distortions with a fixed network structure is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799617B_ABST
    Figure CN118799617B_ABST
Patent Text Reader

Abstract

The application discloses a meta-learning small sample image classification method based on genetic programming, and relates to the technical fields of machine learning and image processing. The mode N-way K-shot learning of meta-learning is determined; a meta-training set and a meta-test set are acquired; a training batch and a verification batch are constructed; an initial population is acquired; the MAML algorithm is combined with genetic programming to acquire the best individual; the neural network architecture corresponding to the best individual is taken as the final neural network architecture; an image to be classified is input into the final neural network architecture to obtain a feature vector; and the feature vector is input into a support vector machine classifier to acquire a classification result. In the prior art, the network structure is arbitrarily selected by reusing the most popular classification network structure, and the structure is fixed. Due to the high variation between images and the distortion in the images, it is difficult for the network with the fixed structure to extract good features from different images. In the application, the automatically generated architecture in the genetic programming is used in the meta-learning algorithm to extract better features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine learning and image processing technology, and in particular to a meta-learning few-sample image classification method based on genetic programming. Background Technology

[0002] Few-sample image classification is an important computer vision task, especially in resource-constrained scenarios such as healthcare. Most existing patents are based on meta-learning methods. In scenarios where data samples are difficult to obtain, meta-learning methods are used to train classification models with good generalization performance. These models can be competent for new classification tasks by learning from a small number of new class samples.

[0003] The goal of meta-learning is to enable models to quickly learn new tasks from a small number of samples. To achieve this, the model needs to be trained on a large number of different tasks to acquire the ability to learn quickly. The underlying idea of ​​Model Agnostic Meta-Learning (MAML) is quite simple: train a set of initial parameters for the model so that the model can maximize the performance of a new task with only one or a few gradient updates on a small number of samples. This process can be seen as maximizing the sensitivity of the new task's loss function to the model parameters: when the sensitivity is high, even a small change in the model parameters can lead to a large improvement in the task's loss function.

[0004] The MAML algorithm is an optimization-based meta-learning algorithm whose goal is to establish a good initial state for a neural network, which can then be adapted to any new task using several optimization steps. In MAML, its backbone architecture is a fixed four-block convolutional architecture. Due to the height variations between images and distortions within the images, using a fixed-structure network makes good feature extraction from diverse images difficult. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention considers that most current meta-learning-based methods use fixed network architectures, while images exhibit significant variations such as scale, rotation, lighting, and viewpoint, as well as distortions in images such as blur, low contrast, and noise. Therefore, this invention provides a genetic programming-based meta-learning few-sample image classification method that performs well with a small number of training samples.

[0006] The technical solution of this invention is as follows:

[0007] A meta-learning few-sample image classification method based on genetic programming includes the following steps:

[0008] Step 1: Based on the classification requirements, determine the meta-learning mode N-way K-shot learning, where N is the number of categories and K is the amount of data for each category;

[0009] Step 2: Obtain the meta-training set D meta-train Heyuan test set D meta-test The meta-training set D meta-train Includes Xa images with labeled categories, and the meta-test set D meta-test It includes Xn images with labeled categories, and the categories in the meta-test set are different from those in the meta-training set;

[0010] Step 3: In the N-way K-shot learning mode, based on the meta-training set D meta-train Heyuan test set D meta-test Construct training and validation batches;

[0011] The method for constructing training batches is as follows: randomly select a set number of categories from the meta-training set, select a set number of images from each category, and use each image as a support set. Then select a set number of images, and use each image as a query set to form a task. Repeat the selection process to obtain several training batches, and each training batch includes several tasks.

[0012] The method for constructing the verification batch is as follows: randomly select a set number of categories from the meta-test set, select a set number of images from each category, and use each image as a support set'. Then select a set number of images, and use each image as a query set' to form a task'. Repeat the selection process to obtain several verification batches', and each verification batch' includes several task's.

[0013] Step 4: Obtain the initial population; the initial population includes N GP individuals in a tree structure;

[0014] The method for generating GP individuals is as follows: A function set and a terminal set are constructed. N GP individuals are randomly generated using a tree generation method. Each GP individual constructs its internal nodes and root node by selecting functions from the function set and constructing leaf nodes by selecting terminals from the terminal set, resulting in a tree-structured GP individual. The terminals include images and function parameters. The root node includes a feature concatenation node. The internal nodes include filtering nodes, feature extraction nodes, pooling nodes, and filtering or pooling nodes. The leaf nodes include image nodes and function parameter nodes.

[0015] Each GP individual includes a first image node, a first function parameter node, a first filter node, a first pooling node, a first filter or pooling node, a second image node, a second function parameter node, a second pooling node, a second filter or pooling node, a feature extraction node, and a feature concatenation node. Among them, the first filter node, the second pooling node, the first filter or pooling node, and the second filter or pooling node are flexible nodes, and whether to generate them is determined according to the needs.

[0016] Both the first image node and the second image node represent images of the input GP individual;

[0017] The first function parameter node and the second function parameter node both represent function parameters in the input GP individual;

[0018] The first filter node represents a filter function used to perform a filter operation on the image represented by the first image node;

[0019] The first pooling node represents a pooling function used to perform max pooling on the image output by the filtering node and reduce its size;

[0020] The first filtering or pooling node represents a filtering function or a pooling function, used to filter or max pool the image output by the first pooling node;

[0021] The second pooling node represents a pooling function used to perform max pooling on the image represented by the second image node and reduce its size;

[0022] The second filtering or pooling node represents a filtering function or a pooling function, used to filter or max pool the image output by the second pooling node;

[0023] The feature extraction node is used to represent a feature extraction function, which is used to extract features from the image output by the second filtering or pooling node to obtain a feature vector.

[0024] The feature concatenation node is used to represent a feature concatenation function, which combines different feature vectors output by the feature extraction node and the first filtering or pooling node to obtain the final feature vector.

[0025] Step 5: Combine the MAML algorithm with genetic programming, and use training batches and validation batches to obtain the best individuals among the GP individuals;

[0026] Step 5.1: Use the images in the training batch to perform meta-training on the GP individuals in the current population to obtain several trained GP individuals;

[0027] Step 5.1.1: Transform each GP individual in the current population into a neural network architecture M. meta ;

[0028] The conversion method is specifically as follows:

[0029] S1: Starting from the root node in the tree structure of each GP individual, recursively visit each child node; the child nodes include internal nodes and leaf nodes;

[0030] S2: Map all nodes in the tree structure of each GP individual to a component of the neural network;

[0031] Specifically, internal nodes are mapped to layers of the neural network, leaf nodes are mapped to neurons, and root nodes are mapped to connections. Specifically, image nodes in leaf nodes serve as input neurons of the neural network, filter nodes, pooling nodes, and feature extraction nodes in internal nodes serve as filter layers, pooling layers, and feature extraction layers in the neural network, respectively, function parameter nodes in leaf nodes correspond to hyperparameters of filter layers, pooling layers, and feature extraction layers, and feature concatenation nodes in root nodes serve as connection layers in the neural network.

[0032] S3: Based on the mapping results, construct the neural network architecture M using a deep learning framework. meta ;

[0033] Step 5.1.2: Set up the neural network architecture M meta The initialization parameter φ, and the batch number t = 0;

[0034] Step 5.1.3: Train the neural network architecture using the support set from each task in the t-th training batch. Calculate the updated parameters after training for each task.

[0035]

[0036] in, Let be the new parameters obtained after a single gradient descent operation on a task, where i is the task number; η is the learning rate; and l(φ) is the loss function on the support set of the current task. This represents the gradient of the loss function with respect to the parameter φ;

[0037] Step 5.1.4: Use the query set in the task to update the parameters obtained from the support set in the task. The loss function on the query set in each task is obtained by verification, and then the total loss function is calculated.

[0038] The total loss function is:

[0039]

[0040] Where L(φ) is the total loss function; bs is the number of tasks; l i The loss function is defined on the query set for each task.

[0041] Step 5.1.5: After obtaining the total loss function, update the neural network architecture M based on the total loss function. meta The current parameters are incremented by 1, the batch number t is incremented, and the process returns to step 5.1.3 until t reaches the set training batch or neural network architecture M. meta Once the parameters converge, training ends, and several trained GP individuals are obtained.

[0042]

[0043] Where φ' is the updated neural network architecture M meta Parameters;

[0044] Step 5.2: Using images from the validation batch, analyze the current neural network architecture M corresponding to several trained GP individuals. meta Perform meta-tests and evaluate the neural network architecture M. meta By adjusting the parameters, several adjusted neural network architectures M are obtained. fine-tune And calculate the adjusted neural network architecture M fine-tune The accuracy rate;

[0045] Step 5.2.1: Utilize the support set 'in each task ' in the validation batch' to evaluate the current neural network architecture M. meta The parameters are adjusted, and after k adjustments and updates, the adjusted neural network architecture M is obtained. fine-tune ;

[0046] In multi-step gradient descent, for k iterations, the update rule is:

[0047]

[0048] in, The updated parameters; Indicates the parameters before the update; T i' This represents the current task, where i' represents the task number; j represents the number of gradient descent operations in each task, and j = 0...k-1; α is the learning rate. The loss function is expressed as follows: The gradient; Represents the loss function for the current task;

[0049] Step 5.2.2: Using accuracy as the evaluation metric, evaluate the adjusted network architecture M using the query set of each task in the validation batch. fine-tune An evaluation was conducted, and the adjusted network architecture M was calculated. fine-tune The accuracy rate;

[0050] Step 5.3: Use the accuracy obtained in Step 5.2 as the fitness value of the corresponding GP individual, and use genetic programming to obtain the optimal GP individual;

[0051] Step 5.3.1: Set the initial iteration count to 0;

[0052] Step 5.3.2: Calculate the fitness value of each GP individual in the current population; the fitness value is the adjusted neural network architecture M. fine-tune The accuracy rate;

[0053] Step 5.3.3: Select the Z GP individuals with the highest fitness values ​​from the current population in an elitist manner according to the elite number Z;

[0054] Step 5.3.4: Perform crossover and mutation on the remaining GP individuals in the current population to obtain new GP individuals;

[0055] The method of crossover is as follows: arbitrarily select two GP individuals and randomly select a non-leaf node as the crossover point, swap the crossover point and its subtrees to obtain two new GP individuals. These two new sub-individuals will participate in the next round of evolution as a new generation of individuals.

[0056] The mutation method is as follows: randomly select a GP individual and randomly select a node from all nodes to perform random mutation. Mutation includes inserting a new node, deleting a node, replacing a node, or randomly changing the parameters of the node. The individual obtained after mutation will participate in the next round of evolution as a new generation of individuals.

[0057] Step 5.3.5: Calculate the fitness value of the new GP individuals, and select the M GP individuals with the highest fitness values ​​to construct a new generation population with the GP individuals in the elite population;

[0058] Step 5.3.6: Store the best GP individual in the current population in the Hall of Fame (hof), increment the iteration count by 1, and determine whether the current iteration count has reached the set maximum iteration count. If so, output the GP individual with the largest fitness value in the Hall of Fame (hof) as the best individual among the GP individuals; otherwise, return to step 5.3.3.

[0059] Step 6: Use the best neural network architecture for the best individual as the final neural network architecture. Input the image to be classified into the final neural network architecture to obtain the feature vector. Input the feature vector into the support vector machine classifier to obtain the classification result.

[0060] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0061] Existing meta-learning-based methods arbitrarily choose network structures by reusing the most popular classification network structures, resulting in fixed structures. Due to height variations and distortions between images, it is difficult to extract good features from different images using networks with fixed structures. This invention improves classification performance by using an automatically generated architecture through genetic programming in a meta-learning algorithm to achieve better feature extraction. Attached Figure Description

[0062] Figure 1 This is a flowchart of a meta-learning few-sample image classification method based on genetic programming in an embodiment of the present invention;

[0063] Figure 2 This is a structural diagram of a GP individual in an embodiment of the present invention. Detailed Implementation

[0064] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0065] Genetic Programming (GP) offers a flexible representation that enables automated image preprocessing and feature extraction without human intervention. GP-based evolutionary deep learning aims to implement deep learning using GP because it can automatically evolve models / solutions with sufficient complexity. In recent years, GP-based evolutionary deep learning has been widely applied in image classification. By automatically designing tree-like neural network structures using GP's evolutionary algorithm, better feature extraction from images is achieved. Therefore, using the automatically generated architecture of GP in meta-learning algorithms improves feature extraction and enhances classification performance.

[0066] A meta-learning few-sample image classification method based on genetic programming, such as Figure 1 As shown, it includes the following steps:

[0067] Step 1: Based on the classification requirements, determine the meta-learning mode N-way K-shot learning, where N is the number of categories and K is the amount of data for each category;

[0068] The goal of this implementation is to train a model that can identify which of the N classes a test image belongs to with K training samples (usually set to 1 or 5).

[0069] Step 2: Obtain the meta-training set D meta-train Heyuan test set D meta-test The meta-training set D meta-tain Includes Xa images with labeled categories, and the meta-test set D meta-test It includes Xn images with labeled categories, and the categories in the meta-test set are different from those in the meta-training set;

[0070] In this implementation, the meta-training set helps train the meta-learning model, and then the model is fine-tuned on the meta-test set to obtain the final model.

[0071] Step 3: In the N-way K-shot learning mode, based on the meta-training set D meta-train Heyuan test set D meta-test Construct training and validation batches;

[0072] The method for constructing training batches is as follows: randomly select a set number of categories from the meta-training set, select a set number of images from each category, and use each image as a support set. Then select a set number of images, and use each image as a query set to form a task. Repeat the selection process to obtain several training batches, and each training batch includes several tasks.

[0073] The method for constructing the verification batch is as follows: randomly select a set number of categories from the meta-test set, select a set number of images from each category, and use each image as a support set'. Then select a set number of images, and use each image as a query set' to form a task'. Repeat the selection process to obtain several verification batches', and each verification batch' includes several task's.

[0074] In this implementation, the model training process revolves around tasks. Assuming a 5-way 5-shot experimental setup, during the training phase, five classes are randomly selected from Xa, and 20 labeled samples are randomly selected from each class to form a task. The five labeled samples are called the support set, and the other 15 samples are called the query set. This task is equivalent to a training data point in a typical deep learning model training process. Several such tasks are repeatedly drawn from the training data distribution to form a batch. During the testing phase, the meanings of task, support set, and query set remain the same as in the training phase.

[0075] Step 4: Obtain the initial population; the initial population includes N GP individuals in a tree structure;

[0076] The method for generating GP individuals is as follows: A function set and a terminal set are constructed. N GP individuals (trees) are randomly generated using a tree generation method. Each GP individual (tree) constructs its internal nodes and root node by selecting functions from the function set and its leaf nodes by selecting terminals from the terminal set, resulting in a tree-structured GP individual. This GP individual can be used to process images to generate feature vectors corresponding to each image. The terminals include images and function parameters; the root node includes feature concatenation nodes; the internal nodes include filtering nodes, feature extraction nodes, pooling nodes, and filtering or pooling nodes; the leaf nodes include image nodes and function parameter nodes.

[0077] Flexible program structures were developed in GP, ​​integrating function sets and terminals into a single tree, such as... Figure 2 As shown, each GP individual includes a first image node, a first function parameter node, a first filtering node, a first pooling node, a first filtering or pooling node, a second image node, a second function parameter node, a second pooling node, a second filtering or pooling node, a feature extraction node, and a feature concatenation node.

[0078] Both the first image node and the second image node represent images of the input GP individual;

[0079] The first function parameter node and the second function parameter node both represent function parameters in the input GP individual;

[0080] The first filter node represents a filter function used to perform a filter operation on the image represented by the first image node;

[0081] The first pooling node represents a pooling function used to perform max pooling on the image output by the filtering node and reduce its size;

[0082] The first filtering or pooling node represents a filtering function or a pooling function, used to filter or max pool the image output by the first pooling node;

[0083] The second pooling node represents a pooling function used to perform max pooling on the image represented by the second image node and reduce its size;

[0084] The second filtering or pooling node represents a filtering function or a pooling function, used to filter or max pool the image output by the second pooling node;

[0085] The feature extraction node is used to represent a feature extraction function, which is used to extract features from the image output by the second filtering or pooling node to obtain a feature vector.

[0086] The feature concatenation node is used to represent a feature concatenation function, which combines different feature vectors output by the feature extraction node and the first filtering or pooling node to obtain the final feature vector.

[0087] like Figure 2 As shown, the nodes circled in dashed lines are flexible, indicating that they may appear in the GP procedure. These flexible nodes allow the GP procedure to have multiple filtering and pooling nodes to extract features. This procedural structure allows the GP to evolve into a shallow tree containing some functions, or a deep tree with multiple layers of pooling and / or filtering. Through this procedural structure, the GP can generate various types and numbers of features, flexibly solving different image classification tasks.

[0088] The GP function set uses a set of image correlation operators, which are divided into filtering functions, pooling functions, feature extraction functions, and feature concatenation functions according to the structure of individual GPs;

[0089] The filtering functions: GP's filtering nodes use 16 functions, as shown in Table 1. The Gau function takes the image and standard deviation σ as input and returns the image after convolution with a Gaussian kernel. GauD has three parameters: standard deviation σ, o1, and o2. Parameters o1 and o2 represent the order of the derivative along the X and Y axes, respectively. The Lap function is generated by discretization and approximation of the Laplacian operator and can detect flat regions or edges. The LoG1 and LoG2 functions convolve a Laplacian filter with a Gaussian function to reduce noise in the image. Among these filters, the Gau, Med, and Mean filters are commonly used for image denoising and smoothing. Filters including GauD, Lap, LoG1, LoG2, Sobel, SobelX, and SobelY can detect edges or flat regions in the image. The Mean, Med, Min, and Max functions have a kernel size of 3×3, which is a commonly used kernel size. The kernel size of other filters is based on their parameters or default settings. The W-Add and W-Sub functions are used to add or subtract two weighted images of different or the same size, where the weights are n1 and n2. When the two images are of different sizes, W-Add and W-Sub overlap the pixels at coordinate (0,0), cropping the excess portion of the larger image before performing the addition or subtraction operation. ReLU is the Corrected Linear Unit. Sqrt calculates the square root of each pixel value in the image, returning 1 if the pixel value is negative. ReLU and Sqrt can rescale the input image by converting negative pixel values ​​to non-negative values.

[0090] Table 1 Filtering Functions

[0091]

[0092] The pooling functions: GP's pooling nodes use two functions, as shown in Table 2. The MaxP function takes three parameters as input: the image and kernel sizes k1 and k2, and returns a smaller image. The MaxP function in GP can not only extract important features but also reduce the dimensionality of the features. k1 and k2 are the two parameters of MaxP, used as two temporary random constants in GP. The values ​​of k1 and k2 are randomly selected from a predefined range during the initialization step and can be mutated during evolution using the mutation operator. The ZMaxP function performs max pooling on the image and adds zero padding around the image to maintain its size.

[0093] Table 2: Pooling Functions

[0094]

[0095] The feature extraction functions used in GP are three functions, as shown in Table 3. To reduce the search space of GP, HOG, LBP, and SIFT, the three most commonly used methods, are employed for feature extraction. These three functions generate high-level feature maps that provide rich information.

[0096] Table 3: Feature Extraction Functions

[0097]

[0098]

[0099] The concatenation functions: GP uses five functions for its concatenation nodes, as shown in Table 4. To concatenate the features generated by different functions, five different concatenation functions (Root2, Root3, Root4, FeaCon2, and FeaCon3) were adopted and developed. Each concatenation function can be used as the root node of the program tree or a child node of another concatenation function. Through these functions, the GP tree can output various numbers of features from the input image.

[0100] Table 4: Concatenation Functions

[0101]

[0102] As shown in Table 5, the terminal set of GP includes the input image (Image) and function parameters, namely σ, o1, o2, n1, n2, k1, and k2. Image represents the input image, which is a two-dimensional array whose values ​​are normalized to [0,1]. The other terminal sets represent temporary random constants of GP, appearing only when the corresponding function is used. The values ​​of these terminals are randomly selected from a predefined range during the initialization step and can be modified by the mutation operator during evolution.

[0103] Table 5: Terminal Sets

[0104]

[0105] Step 5: Combine the MAML algorithm with genetic programming, and use training batches and validation batches to obtain the best individuals among the GP individuals;

[0106] Step 5.1: Use the images in the training batch to perform meta-training on the GP individuals in the current population to obtain several trained GP individuals;

[0107] Step 5.1.1: Transform each GP individual in the current population into a neural network architecture M. meta In general, GP individuals are usually represented as a tree structure, while neural network architectures are usually graphical structures composed of layers, neurons, connections, etc.

[0108] The conversion method is specifically as follows:

[0109] S1: In order to parse the tree structure of each GP individual, start from the root node in the tree structure of each GP individual and recursively visit each child node; the child node includes internal nodes and leaf nodes;

[0110] S2: Map all nodes in the tree structure of each GP individual to a component of the neural network;

[0111] Specifically, internal nodes are mapped to layers of the neural network, leaf nodes are mapped to neurons, and root nodes are mapped to connections. Specifically, image nodes in leaf nodes serve as input neurons of the neural network, filter nodes, pooling nodes, and feature extraction nodes in internal nodes serve as filter layers, pooling layers, and feature extraction layers in the neural network, respectively, function parameter nodes in leaf nodes correspond to hyperparameters of filter layers, pooling layers, and feature extraction layers, and feature concatenation nodes in root nodes serve as connection layers in the neural network.

[0112] S3: Based on the mapping results, construct a neural network architecture using a deep learning framework (TensorFlow);

[0113] For each iteration of the genetic programming process, the GP individuals in the population are transformed into a neural network architecture M. meta In step 1, the meta-training set and meta-test set have been defined, and the meta-training set D... meta-train Heyuan test set D meta-test The data is divided into support set and query set.

[0114] Step 5.1.2: Set up the neural network architecture M meta The initialization parameter φ, and the batch number t = 0;

[0115] The neural network architecture used for training is M. meta The purpose of training is to ensure that the neural network architecture has excellent initialization parameters. The ultimate goal is to learn a model that can be used on dataset D. meta-train The classification model is M fine-tune M fine-tune and M meta The structures are exactly the same; the only difference is the model parameters.

[0116] Step 5.1.3: Train the neural network architecture using the support set from each task in the t-th training batch. Calculate the updated parameters after training for each task.

[0117]

[0118] in, Let η be the new parameters obtained after a single gradient descent operation on a task, i be the task number, η be the learning rate (a positive scalar that determines how far to move along the gradient descent direction during parameter updates), and l(φ) be the loss function on the support set of the current task, which measures the performance of the model parameters on the current task. This represents the gradient of the loss function with respect to the parameter φ. The gradient is used to adjust the parameter φ to reduce the task's loss as quickly as possible.

[0119] In this embodiment, the support set of one task is used to train M. meta Here we perform the first type of gradient descent, assuming that each task performs gradient descent only once, that is... So when performing the second training task, there is After executing the batch-size task, there is

[0120] Step 5.1.4: Use the query set in the task to update the parameters obtained from the support set in the task. The loss function on the query set in each task is obtained by verification, and then the total loss function is calculated.

[0121] The total loss function is:

[0122]

[0123] Where L(φ) is the total loss function, which is the sum of the query set losses for all tasks. It represents the model's performance after learning from the support set and validating on the query set across a series of different tasks. Minimizing this total loss during training helps the model better learn how to quickly adapt to new and unseen tasks; bs is the number of tasks; l i The loss function is defined on the query set for each task.

[0124] Step 5.1.5: After obtaining the total loss function, the second type of gradient descent is applied to update the neural network architecture M based on the total loss function. meta The current parameters are incremented by 1, the batch number t is incremented, and the process returns to step 5.1.3 until t reaches the set training batch or neural network architecture M. meta Once the parameters converge, training ends, and several trained GP individuals are obtained.

[0125]

[0126] Where φ' is the updated neural network architecture M meta Parameters;

[0127] Ultimately, we can obtain relatively good initialization parameters for the model on the dataset.

[0128] Step 5.2: Using images from the validation batch, analyze the current neural network architecture M corresponding to several trained GP individuals. meta Perform meta-tests and evaluate the neural network architecture M. meta By adjusting the parameters, several adjusted neural network architectures M are obtained. fine-tune And calculate the adjusted neural network architecture M fine-tune The accuracy rate;

[0129] Step 5.2.1: Utilize the support set 'in each task ' in the validation batch' to evaluate the current neural network architecture M. meta The parameters are adjusted, and after k adjustments and updates, the adjusted neural network architecture M is obtained. fine-tune ;

[0130] Based on step 5.1, obtain the trained parameters and the neural network architecture M. meta We use dataset D meta-test supportset for each task to M meta Fine-tuning to obtain M fine-tune At this point, the number of gradient descent steps can be set to be more, unlike during training (when only one gradient descent step is performed).

[0131] Multistep gradient descent: For k iterations, the update rule is:

[0132]

[0133] in, The updated parameters; Indicates the parameters before the update; T i' This represents the current task, where i' represents the task number; j represents the number of gradient descent operations in each task, and j = 0...k-1; α is the learning rate. The loss function is expressed as follows: The gradient; This represents the loss function for the current task.

[0134] The initialization parameters obtained in step 5.1 are updated k times. The fine-tuned model parameters are obtained by performing k gradient descent operations on the support set for the i-th task.

[0135] Step 5.2.2: Using accuracy as the evaluation metric, evaluate the adjusted network architecture M using the query set of each task in the validation batch. fine-tune An evaluation was conducted, and the adjusted network architecture M was calculated. fine-tune The accuracy rate;

[0136] The calculation method involves predicting the samples in the query set and then comparing the consistency between the predicted labels and the true labels, i.e., the number of correctly predicted samples divided by the total number of samples.

[0137] Step 5.3: Use the accuracy obtained in Step 5.2 as the fitness value of the corresponding GP individual, and use genetic programming to obtain the optimal GP individual;

[0138] For each GP individual, after undergoing meta-training and meta-testing phases, the accuracy obtained in the meta-test is used as the fitness value of that GP individual.

[0139] Step 5.3.1: Set the initial iteration count to 0;

[0140] Step 5.3.2: Calculate the fitness value of each GP individual in the current population; the fitness value is the accuracy.

[0141] Step 5.3.3: Select the Z GP individuals with the highest fitness values ​​from the current population in an elitist manner according to the elite number Z;

[0142] Step 5.3.4: Perform crossover and mutation on the remaining GP individuals in the current population to obtain new GP individuals;

[0143] The method of crossover is as follows: arbitrarily select two GP individuals and randomly select a non-leaf node as the crossover point, swap the crossover point and its subtrees to obtain two new GP individuals. These two new sub-individuals will participate in the next round of evolution as the new generation of individuals.

[0144] The mutation method is as follows: randomly select a GP individual and randomly select a node from all nodes to perform random mutation. Mutation includes inserting a new node, deleting a node, replacing a node, or randomly changing the parameters of the node. The individual obtained after mutation will participate in the next round of evolution as a new generation of individuals.

[0145] Step 5.3.5: Calculate the fitness value of the new GP individuals, and select the M GP individuals with the highest fitness values ​​to construct a new generation population with the GP individuals in the elite population;

[0146] Step 5.3.6: Store the best GP individual in the current population in the Hall of Fame (hof), increment the iteration count by 1, and determine whether the current iteration count has reached the set maximum iteration count. If so, output the GP individual with the largest fitness value in the Hall of Fame (hof) as the best individual among the GP individuals; otherwise, return to step 5.3.3.

[0147] In GP, ​​"hof" stands for "Hall of Fame." This is a mechanism for storing the best individuals that emerge during algorithm execution. By preserving these historically best individuals, it ensures that excellent solutions already obtained are not lost due to the randomness of genetic operations such as crossover and mutation.

[0148] Step 6: Use the best neural network architecture for the best individual as the final neural network architecture. Input the image to be classified into the final neural network architecture to obtain the feature vector. Input the feature vector into the support vector machine (SVM) classifier to obtain the classification result.

Claims

1. A meta-learning few-sample image classification method based on genetic programming, characterized in that, Includes the following steps: Step 1: Based on the classification requirements, determine the meta-learning mode N-way K-shot learning, where N is the number of categories and K is the amount of data for each category; Step 2: Obtain the meta-training set Heyuan Test Set The meta-training set The meta-test set includes Xa images with labeled categories. It includes Xn images with labeled categories, and the categories in the meta-test set are different from those in the meta-training set; Step 3: In N-way K-shot learning mode, based on the meta-training set Heyuan Test Set Construct training and validation batches; Step 4: Obtain the initial population; the initial population includes N GP individuals in a tree structure; Step 5: Combine the MAML algorithm with genetic programming, and use training batches and validation batches to obtain the best individuals among the GP individuals; Step 5 specifically includes: Step 5.1: Use the images in the training batch to perform meta-training on the GP individuals in the current population to obtain several trained GP individuals; Step 5.2: Use the images in the validation batch to analyze the current neural network architecture corresponding to several trained GP individuals. Perform meta-tests and evaluate the neural network architecture. By adjusting the parameters, several adjusted neural network architectures were obtained. And calculate the adjusted neural network architecture The accuracy rate; Step 5.3: Use the accuracy obtained in Step 5.2 as the fitness value of the corresponding GP individual, and use genetic programming to obtain the optimal GP individual; Step 6: Use the best neural network architecture for the best individual as the final neural network architecture. Input the image to be classified into the final neural network architecture to obtain the feature vector. Input the feature vector into the support vector machine classifier to obtain the classification result.

2. The meta-learning few-sample image classification method based on genetic programming according to claim 1, characterized in that, The method for constructing training batches in step 3 is as follows: randomly select a set number of categories from the meta-training set, select a set number of images from each category, and use each image as a support set. Then select a set number of images, and use each image as a query set to form a task. Repeat the selection process to obtain several training batches. Each training batch includes several tasks. The method for constructing the verification batch is as follows: randomly select a set number of categories from the meta-test set, select a set number of images from each category, and use each image as a support set'. Then select a set number of images, and use each image as a query set' to form a task'. Repeat the selection process to obtain several verification batches', and each verification batch' includes several task's.

3. The meta-learning few-sample image classification method based on genetic programming according to claim 2, characterized in that, The method for generating GP individuals in step 4 is as follows: construct a function set and a terminal set, randomly generate N GP individuals using a tree generation method, and construct internal nodes and root nodes for each GP individual by selecting functions from the function set and constructing leaf nodes by selecting terminals from the terminal set, thus obtaining a tree-structured GP individual; the terminals include images and function parameters; the root nodes include feature concatenation nodes; The internal nodes include filtering nodes, feature extraction nodes, pooling nodes, and filtering or pooling nodes; the leaf nodes include image nodes and function parameter nodes. Each GP individual includes a first image node, a first function parameter node, a first filter node, a first pooling node, a first filter or pooling node, a second image node, a second function parameter node, a second pooling node, a second filter or pooling node, a feature extraction node, and a feature concatenation node. Among them, the first filter node, the second pooling node, the first filter or pooling node, and the second filter or pooling node are flexible nodes, and whether to generate them is determined according to the needs. Both the first image node and the second image node represent images of the input GP individual; The first function parameter node and the second function parameter node both represent function parameters in the input GP individual; The first filter node represents a filter function used to perform a filter operation on the image represented by the first image node; The first pooling node represents a pooling function used to perform max pooling on the image output by the filtering node and reduce its size; The first filtering or pooling node represents a filtering function or a pooling function, used to filter or max pool the image output by the first pooling node; The second pooling node represents a pooling function used to perform max pooling on the image represented by the second image node and reduce its size; The second filtering or pooling node represents a filtering function or a pooling function, used to filter or max pool the image output by the second pooling node; The feature extraction node is used to represent a feature extraction function, which is used to extract features from the image output by the second filtering or pooling node to obtain a feature vector. The feature concatenation node is used to represent a feature concatenation function, which combines different feature vectors output by the feature extraction node and the first filtering or pooling node to obtain the final feature vector.

4. The meta-learning few-sample image classification method based on genetic programming according to claim 1, characterized in that, Step 5.1 specifically includes: Step 5.1.1: Convert each GP individual in the current population into a neural network architecture. ; The conversion method is specifically as follows: S1: Starting from the root node in the tree structure of each GP individual, recursively visit each child node; the child nodes include internal nodes and leaf nodes; S2: Map all nodes in the tree structure of each GP individual to a component of the neural network; Specifically, internal nodes are mapped to layers of the neural network, leaf nodes are mapped to neurons, and root nodes are mapped to connections. Specifically, image nodes in leaf nodes serve as input neurons of the neural network, filter nodes, pooling nodes, and feature extraction nodes in internal nodes serve as filter layers, pooling layers, and feature extraction layers in the neural network, respectively, function parameter nodes in leaf nodes correspond to hyperparameters of filter layers, pooling layers, and feature extraction layers, and feature concatenation nodes in root nodes serve as connection layers in the neural network. S3: Based on the mapping results, construct a neural network architecture using a deep learning framework. ; Step 5.1.2: Set up the neural network architecture initialization parameters The batch number for training is t=0; Step 5.1.3: Train the neural network architecture using the support set from each task in the t-th training batch. Calculate the updated parameters after training for each task. ; ; in, These are the new parameters obtained after a single gradient descent pass through a task. The task number; For learning rate, Let the loss function be the support set for the current task. This indicates the loss function with respect to the parameters. The gradient; Step 5.1.4: Use the query set in the task to update the parameters obtained from the support set in the task. The loss function on the query set in each task is obtained by verification, and then the total loss function is calculated. The total loss function is: ; in, This is the total loss function; The number of tasks; The loss function is defined on the query set for each task. Step 5.1.5: After obtaining the total loss function, update the neural network architecture based on the total loss function. The current parameters are incremented by 1, the batch number t is incremented, and the process returns to step 5.1.3 until t reaches the set training batch or neural network architecture. Once the parameters converge, training ends, and several trained GP individuals are obtained. ; in, For the updated neural network architecture The parameters.

5. The meta-learning few-sample image classification method based on genetic programming according to claim 1, characterized in that, Step 5.2 specifically includes: Step 5.2.1: Utilize the support set from each task in the validation batch to evaluate the current neural network architecture. The parameters are adjusted, and the adjusted neural network architecture is obtained after k adjustments and updates. ; In multi-step gradient descent, for k iterations, the update rule is: ; in, The updated parameters; This indicates the parameters before the update; Indicates the current task. Indicates the task number; This represents the number of gradient descent iterations in each task', and =0……k-1; α is the learning rate; The loss function is expressed as follows: The gradient; Represents the loss function for the current task; Step 5.2.2: Using accuracy as the evaluation metric, evaluate the adjusted network architecture using the queryset of each task in the validation batch. An evaluation was conducted, and the adjusted network architecture was calculated. The accuracy rate.

6. The meta-learning few-sample image classification method based on genetic programming according to claim 1, characterized in that, Step 5.3 specifically includes: Step 5.3.1: Set the initial iteration count to 0; Step 5.3.2: Calculate the fitness value of each GP individual in the current population; the fitness value is the adjusted neural network architecture. The accuracy rate; Step 5.3.3: Select the Z GP individuals with the highest fitness values ​​from the current population in an elitist manner according to the elite number Z; Step 5.3.4: Perform crossover and mutation on the remaining GP individuals in the current population to obtain new GP individuals; The method of crossover is as follows: arbitrarily select two GP individuals and randomly select a non-leaf node as the crossover point, swap the crossover point and its subtrees to obtain two new GP individuals. These two new sub-individuals will participate in the next round of evolution as a new generation of individuals. The mutation method is as follows: randomly select a GP individual and randomly select a node from all nodes to perform random mutation. Mutation includes inserting a new node, deleting a node, replacing a node, or randomly changing the parameters of the node. The individual obtained after mutation will participate in the next round of evolution as a new generation of individuals. Step 5.3.5: Calculate the fitness value of the new GP individuals, and select the M GP individuals with the highest fitness values ​​to construct a new generation population with the GP individuals in the elite population; Step 5.3.6: Store the best GP individual in the current population in the Hall of Fame (hof), increment the iteration count by 1, and determine whether the current iteration count has reached the set maximum iteration count. If so, output the GP individual with the largest fitness value in the Hall of Fame (hof) as the best individual among the GP individuals; otherwise, return to step 5.3.3.