Few-shot image classification method based on hierarchical learning genetic programming algorithm
Disclosed is a few-shot image classification method based on a hierarchical learning genetic programming algorithm: constructing a few-shot image classification system based on the hierarchical learning genetic programming algorithm; dividing the image data set into a training set and a test set; performing image preprocessing and feature extraction operations on the training set to construct a feature storage table; constructing an ensemble solution by using features in the feature storage table as terminal inputs, and optimizing a final classification effect by using an ensemble strategy based on an individual difference value; using the test set as an input of an image classification solution, outputting predicted class labels of the test set, and evaluating a performance of the image classification solution according to an actual label of the test set; using to-be-classified image data as the input of the image classification solution, and outputting an image classification result.
1 . A few-shot image classification method based on a hierarchical learning genetic programming algorithm, comprising the following steps:
step 1: constructing a few-shot image classification system based on the hierarchical learning genetic programming algorithm, wherein the few-shot image classification system is provided with an image acquisition module, the image acquisition module is connected with a hierarchical evolutionary learning framework, and the hierarchical evolutionary learning framework is provided with a parallel exploration genetic programming (PEGP) module on a first layer and a development-ensemble genetic programming (DEGP) module on a second layer;
the PEGP module is provided with three different types of feature exploration blocks in parallel, the three feature exploration blocks are respectively a first feature exploration block, a second feature exploration block, and a third feature exploration block, program structures, function sets and terminal sets of the first feature exploration block, the second feature exploration block and the third feature exploration block are respectively set, and the first feature exploration block, the second feature exploration block and the third feature exploration block generate three feature construction blocks with different evolutionary directions in parallel;
step 2: acquiring an image data set, and dividing the image data set into a training set and a test set by the image acquisition module;
step 3: acquiring training set data, and performing image preprocessing and feature extraction operations on the training set data to construct a feature storage table, and then transferring the feature storage table to the DEGP module by the PEGP module;
step 4: further constructing an ensemble solution by using features in the feature storage table as terminal inputs, and finally optimizing a final classification effect by using an ensemble strategy based on an individual difference value by the DEGP module, thereby outputting a high-performance image classification solution;
step 5: using the test set as an input of the image classification solution, then, outputting predicted class labels of the test set, and finally, evaluating a performance of the image classification solution according to an actual label of the test set; and
step 6: acquiring to-be-classified image data, using the to-be-classified image data as the input of the image classification solution, and outputting an image classification result by the image acquisition module.
2 . The few-shot image classification method based on a hierarchical learning genetic programming algorithm of claim 1 , wherein the first feature exploration block adopts a linear genetic programming (LGP) algorithm focusing on local features, and the program structure of the first exploration block comprises a region extraction layer, a first image filtering layer, a first feature extraction layer, and a first feature concatenation layer;
the second feature exploration block adopts a grammar-guided genetic programming (GGP) algorithm focusing on global features, and the program structure of the second feature exploration block comprises a second image filtering layer and a second feature extraction layer; and
the third feature exploration block adopts a Cartesian genetic programming (CGP) algorithm focusing on concatenated features, and the program structure of the third feature exploration block comprises a third image filtering layer, a maximum pooling layer, a third feature extraction layer, and a second feature concatenation layer.
3 . The few-shot image classification method based on a hierarchical learning genetic programming algorithm of claim 2 , wherein a terminal set of the PEGP module comprises a training set and parameters required by functions in the LGP algorithm, the GGP algorithm, and the CGP algorithm.
4 . The few-shot image classification method based on a hierarchical learning genetic programming algorithm of claim 1 , wherein in step 3, the PEGP module constructs the feature storage table, which comprises the following steps:
step A1: initializing a population: acquiring the training set data, and initializing a population by the feature exploration blocks according to a predetermined program structure, function set and terminal set;
step A2: evaluating the fitness of an individual: extracting features from the training set, and then inputting the extracted features to a support vector machine (SVM) by each individual in the population, and outputting the predicted class labels, and then evaluating the individual by the SVM by adopting a classification accuracy to obtain a fitness value corresponding to the individual; wherein a computation expression of the classification accuracy is show as follows:
Fitness
=
(
N
correct
N
total
)
×
100
%
wherein N correct is a correctly predicted number of examples, N total is a total number of the examples, and Fitness is the fitness value of the individual;
step A3: performing an elite operation: selecting an optimal individual in the population by adopting an elite strategy, and directly copying the optimal individual to a next-generation population;
step A4: performing a selection operation: selecting a certain number of individuals from the population by adopting a tournament selection method, wherein each individual has an equal probability of being selected; and selecting an individual with the best fitness value according to the fitness value of each individual to perform crossover and mutation operations to generate a new individual;
step A5: repeating steps A2-A4 until a maximum number of iterations is reached, and then, performing step A6;
step A6: selecting the top 50% of individuals in a final-generation population as the feature construction blocks; and
step A7: extracting corresponding features from the training set by using the feature construction blocks, numbering the features, storing the features into the feature storage table, and using the features as inputs for second-layer learning.
5 . The few-shot image classification method based on a hierarchical learning genetic programming algorithm of claim 1 , wherein a new program structure, function set and terminal set are set for the DEGP module, and the program structure of the DEGP module comprises a feature construction layer, a classification layer, and a combination layer;
the feature construction layer is configured to use at least two features in the feature storage table as inputs and return one concatenated feature or construct new features according to parameters;
the classification layer is configured to use output features of the feature construction layer as inputs and output the predicted class labels; and
the combination layer is configured to perform a voting or weighting method by using at least two sets of the predicted class labels outputted by the classification layer as inputs so as to output a new predicted class label.
6 . The few-shot image classification method based on a hierarchical learning genetic programming algorithm of claim 5 , wherein in step 4, the DEGP module further constructs the ensemble solution, which comprises the following steps:
(1) population evolutionary learning
step B1: initializing a population: acquiring the features in the feature storage table, and initializing a population by the DEGP module according to a new program structure, function set and terminal set;
step B2: evaluating the fitness of an individual: extracting the features from the feature storage table, outputting the predicted class labels, and then evaluating a fitness value of the individual by each individual in the population;
step B3: performing an elite operation: selecting an optimal individual in the population by adopting an elite strategy, and directly copying the optimal individual to a next-generation population;
step B4: performing a selection operation: selecting a certain number of individuals from the population by adopting a tournament selection method, and selecting an individual with the best fitness value according to the fitness value of each individual to perform crossover and mutation operations to generate a new individual;
step B5: repeating steps B2-B4 until a preset upper limit of iterations is reached, and then, performing step B6;
(2) ensemble strategy based on individual difference value
step B6: selecting an individual with an optimal performance in the final-generation population as a benchmark, computing a difference value of other individuals in the population, and evaluating feature differences of the optimal individual and other individuals in the population according to the computed difference value;
wherein an expression of the computed difference value is shown as follows:
D
(
best
,
i
)
=
❘
"\[LeftBracketingBar]"
S
best
⋃
S
i
❘
"\[LeftBracketingBar]"
-
❘
"\[RightBracketingBar]"
S
best
⋂
S
i
❘
"\[RightBracketingBar]"
wherein S best represents the number of feature labels of the optimal individual in the population, D represents the difference value, and Si represents the number of feature labels of other individuals in the population; and
step B7: selecting seven individuals with the maximum difference value S best to perform voting ensemble to obtain the image classification solution.
7 . The few-shot image classification method based on a hierarchical learning genetic programming algorithm of claim 6 , wherein the image classification solution comprises the seven individuals formed by voting ensemble, and in step 6, image classification prediction is respectively performed on the to-be-classified image data by the seven individuals, the predicted class labels are respectively outputted, and a predicted class label with the highest cumulative count is selected as the image classification result for output.