A weak image classification method based on robust genetic programming and feature learning

Through methods based on robust genetic programming and feature learning, combined with distributed evolutionary algorithms and adversarial training, the problems of low accuracy and noise attacks in weak image classification are solved, and efficient classification and anti-noise capabilities are achieved under low-quality data sets. .

CN118608875BActive Publication Date: 2024-10-18NORTHEASTERN UNIV CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411070669.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-10-18
Estimated Expiration
2044-08-06

AI Technical Summary

Technical Problem

Existing technologies have problems with low accuracy and large amount of calculation in weak image classification, especially in smart manufacturing scenarios with limited resources, and methods based on genetic programming are vulnerable to noise attacks, leading to model failure.

Method used

A weak image classification method based on robust genetic programming and feature learning is proposed. It adopts distributed evolutionary algorithm and adversarial training algorithm, and improves the feature extraction capability and noise resistance of the model through residual-based genetic operators and adversarial sample generation. ability.

Benefits of technology

Efficient weak image classification is achieved under low-quality small data sets, improving the model's feature extraction capabilities and anti-noise capabilities, and enhancing security and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608875B_ABST
    Figure CN118608875B_ABST
Patent Text Reader

Abstract

The present invention provides a weak image classification method based on robust genetic programming and feature learning, and relates to the field of image analysis technology. The method specifically includes: obtaining weak image data to be classified and constructing a weak image data set, dividing the weak image data set into a training set according to a preset ratio; generating individuals based on a distributed evolutionary algorithm and constructing an initial population; constructing a new evolutionary model of adversarial training, and using the new evolutionary model of adversarial training to train individuals in the initial population, and using the trained individuals to construct a new population as the current population; using a distributed evolutionary algorithm to select the best individual from the current population; using the individual tree structure corresponding to the best individual as a weak image classification model, obtaining weak image data to be classified and inputting the weak image classification model, obtaining the feature vector of the weak image data and using a linear SVM for classification, and obtaining the classification result of the weak image data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image analysis, and in particular to a weak image classification method based on robust genetic programming and feature learning. Background Art

[0002] Weak image classification of low-quality small datasets is an important computer vision task, especially in resource-limited scenarios such as smart manufacturing. In recent years, many researchers have explored various techniques to achieve weak image classification in resource-limited scenarios such as smart manufacturing. The main steps include: data preprocessing, feature extraction, neural network construction, model training and tuning, and image classification. Data preprocessing is used to ensure data quality and consistency. Once the model training is completed, it can be used to classify new images.

[0003] Most of the existing methods for weak image processing use the same technology as traditional image classification, and can be roughly divided into two categories: traditional machine learning models based on support vector machines and deep learning models based on convolutional neural networks. However, traditional machine learning models based on support vector machines have the problem of low accuracy; while deep learning models based on convolutional neural networks have the problem of large computational complexity.

[0004] Although traditional image classification methods can be used to deal with recognition problems related to weak images, the distribution and characteristics of weak images are different from those of high-quality images, and most weak images exist in environments such as small factories with limited computing resources, which makes traditional image classification methods unable to be deployed efficiently and have low accuracy. In addition, more importantly, since fields such as intelligent manufacturing have extremely high requirements for model security, and the current method based on genetic programming (GP) is vulnerable to noise attacks, which can lead to model failure, the application of this method faces huge challenges. Summary of the invention

[0005] In view of the above-mentioned shortcomings of the prior art, the present invention takes into account the high variations between images, such as scale, rotation, illumination and viewpoint, as well as the distortions in images, such as blur, low contrast and noise, and proposes a weak image classification method based on robust genetic programming and feature learning, which performs well in the case of low-quality small data sets.

[0006] The present invention proposes a weak image classification method based on robust genetic programming and feature learning, which comprises the following steps:

[0007] Step 1: Obtain the weak image data to be classified and construct a weak image dataset, and divide the weak image dataset into a training set according to a preset ratio;

[0008] Step 2: Generate individuals and construct the initial population based on the distributed evolutionary algorithm DEAP;

[0009] Step 3: Use the adversarial training algorithm to train the individuals in the initial population, and use the trained individuals to construct a new population as the current population;

[0010] Step 4: Use a distributed evolutionary algorithm to select the best individual from the current population;

[0011] Step 5: Use the individual tree structure corresponding to the optimal individual as a weak image classification model, obtain the weak image data to be classified and input it into the weak image classification model, obtain the feature vector of the weak image data and use linear SVM for classification to obtain the classification result of the weak image data;

[0012] The weak image data is image data with a pixel size lower than 100x100, and the acquired weak image data contains a true label of the weak image data;

[0013] The step 2 further comprises:

[0014] Step 2.1: Construct the basic function set and the termination set;

[0015] Step 2.2: According to the basic function set and the termination set, a number of individual trees are randomly generated as individuals and constitute the initial population;

[0016] The basic function set described in step 2.1 includes a root node function, a convolution function, a pooling function, a residual function, an addition function, a subtraction function, and a scaling function;

[0017] The root node function is used to connect several images or vectors input into the function into one vector;

[0018] The convolution function is used to perform a convolution operation on an image input into the function using a filter, and replace the pixel value of the image with the weighted sum of the values ​​of the adjacent pixels of the pixel point, so as to extract image features;

[0019] The pooling function is used to perform maximum pooling on the image input into the function;

[0020] The residual function is used to perform a residual operation on the image input into the function;

[0021] The addition function is used to add every two weighted images with the same or different sizes;

[0022] The subtraction function is used to subtract every two weighted images with the same or different sizes;

[0023] The scaling function is used to scale the pixel values ​​input into the function image;

[0024] The termination set described in step 2.1 is used to define the parameter values ​​of each function in the basic function set;

[0025] The termination set includes: weak image data of size m×n, filters of several different sizes acting on the convolution function, random input values ​​n1 and n2 of the addition function or the subtraction function, and kernel parameters k1 and k2 of the pooling function; wherein m and n are the length and width of the weak image data respectively;

[0026] The individual tree in step 2.2 is: an input layer, a first convolutional layer, a second convolutional layer, a pooling layer, a connection layer and an output layer; wherein the second convolutional layer is residually connected to the pooling layer; the pooling layer is residually connected to the connection layer; the connection layer is residually connected to the output layer; the input layer is used to input weak image data; the first convolutional layer and the second convolutional layer are both used to extract features of the input weak image data through convolution operations; the pooling layer is used to reduce the dimension of the extracted features by performing maximum pooling on the features; the connection layer is used to convert the dimension of the reduced features and the features extracted by the convolutional layer to obtain a feature vector with a specific dimension; the output layer is used to obtain and output the classification result of the weak image data based on the reduced features and the feature vector;

[0027] The method for generating the individual tree is as follows: randomly selecting a function from the convolution function, the addition function, the subtraction function and the scaling function in the basic function set as the function mapping of the first convolution layer, randomly selecting a function from the convolution function, the addition function, the subtraction function and the scaling function in the basic function set as the function mapping of the second convolution layer, using the pooling function in the basic function set as the function mapping of the pooling layer, using the root node function in the basic function set as the function mapping of the connection layer, using the residual function in the basic function set as the function mapping of the residual connection, and defining the parameter values ​​of the input layer, the first convolution layer, the second convolution layer, the pooling layer, the connection layer and the output layer in the individual tree according to the termination set;

[0028] The residual connection in the individual tree uses a residual-based genetic operator, and the genetic operator is defined to include: a direct mapping part and a residual part; wherein the direct mapping part is to directly pass the features obtained in the previous network layer in the individual to the current network layer, and the residual part is composed of several cascaded convolutional layers; the weak image data is used as the input of the residual-based genetic operator, and the output values ​​of the direct mapping part and the residual part are accumulated, and then activated by the ReLU function to obtain the output result of the residual-based genetic operator;

[0029] The residual-based genetic operator is expressed as:

[0030] (2)

[0031] in represents the output of the residual-based genetic operator; Represents the nonlinear function ReLU; represents the weight within the residual-based genetic operator; is a weak image data sample randomly sampled from the training set;

[0032] The step 3 further comprises:

[0033] Step 3.1: Generate adversarial samples using the fast gradient sign method based on the weak image dataset;

[0034] The generation formula of the adversarial sample is:

[0035] (3)

[0036] in is the generated adversarial sample; is a weak image data sample randomly sampled from the training set The corresponding true label; is the learning rate; is a sign function, and when the value of the expression in the sign function is a positive number, the return result of the sign function is 1, when the value is a negative number, the return result of the sign function is -1, and when the value is 0, the return result of the sign function is 0; Express Find partial derivatives; for and The cross entropy function of

[0037] Step 3.2: Use the adversarial sample and the training set to construct a new training set, construct a cross entropy function based on adversarial learning as the loss function, and use the new training set to train the individuals in the initial population. During the training process, the loss function is maximized to generate trained individuals to form a new population as the current population;

[0038] The step 4 further comprises:

[0039] Step 4.1: Set the maximum number of iterations, crossover rate and mutation rate, set the number of elites to M, and initialize the minimum depth and maximum depth of the individual tree corresponding to each individual in the new population;

[0040] Step 4.2: Use the training set to evaluate the individuals in the current population, and calculate the fitness function values ​​of all individuals using the cross-validation method and the fitness function of the distributed evolutionary algorithm based on the evaluation results;

[0041] Step 4.3: Sort all individuals in descending order according to the fitness function value, and use the elitist strategy to select the first M individuals in the sorting result as the elite population;

[0042] Step 4.4: According to the crossover rate and mutation rate, the remaining individuals in the current population are evolved by crossover and mutation to obtain evolved individuals, and the evolved individuals are re-evaluated using the training set. Based on the evaluation results, the fitness function value of the evolved individuals is calculated using the cross-validation method and the fitness function of the distributed evolutionary algorithm;

[0043] Step 4.5: Sort the fitness function values ​​of the evolved individuals from large to small, select the first M individuals in the sorting result and the elite population to form the next generation population, and take the individual with the largest fitness function value in the next generation population as the best individual in the current iteration round and save it to the Hall of Fame hof, return to step 4.4 until the maximum number of iterations is completed;

[0044] Step 4.6: Select the individual with the largest fitness function value from the best individuals of all iteration rounds saved in the Hall of Fame hof as the optimal individual;

[0045] The method described in step 4.2 for evaluating individuals in the current population using the training set is as follows: for any individual in the current population, use the individual to extract features from all weak image data in the training set, and normalize the extracted feature vectors to obtain a normalized training set, and then use a linear support vector machine SVM to classify the weak image data in the normalized training set, calculate the classification accuracy based on the obtained classification results and the true labels of each weak image data, and use the obtained classification accuracy as the evaluation result.

[0046] The beneficial effects of adopting the above technical solution are:

[0047] Compared with the limitation of the operator space of the existing GP method, the method of the present invention proposes a new genetic operator, that is, for feature extraction, a residual-based genetic operator is proposed for the automatic evolution of the GP algorithm. Since the operator directly transfers the feature information of each network layer to the current feature layer through a cross-connection, and calculates the residual information between them, and passes the residual information as a new feature to the next layer of the network, in this way, the operator can learn the differences between different feature layers, and thus can efficiently capture the changes in features.

[0048] To address the problem that existing GP-based methods are vulnerable to noise attacks and lead to model failure, the method of the present invention proposes a new evolutionary model, namely, a new evolutionary model based on adversarial training is proposed to address the noise attack problem. By generating adversarial samples, individuals are subjected to adversarial training, simulating the process of individuals learning the characteristics of noise data, so that individuals can identify the noise data in advance, and then resist noise attacks and improve security. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of a weak image classification method based on robust genetic programming and feature learning in this embodiment;

[0050] Figure 2 is a schematic diagram of a weak image classification method based on robust genetic programming and feature learning in this embodiment;

[0051] Figure 3 is a schematic diagram of an individual tree structure in this implementation mode;

[0052] Figure 4 is a schematic diagram of a residual-based genetic operator in this implementation mode;

[0053] Figure 5 This is a schematic diagram of the crossover operator evolution used in this implementation;

[0054] Figure 6 This is a schematic diagram of the principle of using mutation operator evolution in this embodiment. DETAILED DESCRIPTION

[0055] In order to facilitate the understanding of the present application, the specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thoroughly understood.

[0056] This embodiment is a weak image classification method based on robust genetic programming and feature learning, such as Figure 1 and Figure 2 As shown, the method comprises the following steps:

[0057] Step 1: Obtain the weak image data to be classified and construct a weak image dataset, and divide the weak image dataset into training sets according to a preset ratio.

[0058] The weak image data is image data with pixels less than 100x100, and the acquired weak image data contains a true label of the weak image data.

[0059] In this embodiment, weak image data is obtained from a public data set and a weak image data set is constructed, and the constructed weak image data set is divided into a training set and a test set according to an 8:2 ratio for algorithm learning and performance evaluation. Since weak image data has the characteristics of low image resolution, small size, and poor imaging quality, traditional image classification methods cannot be deployed efficiently and have the problem of low accuracy.

[0060] Step 2: Generate individuals and construct the initial population based on the Distributed Evolutionary Algorithm in Python (DEAP).

[0061] In this embodiment, since the accuracy of individuals generated by the traditional GP algorithm on weak image data sets is very low, the genetic operator of the GP algorithm is reconstructed, and a genetic operator based on residuals is proposed, which enriches and improves the search space for GP evolutionary search. By first giving the construction process of the basic function set and the termination set for GP evolution, a new operator function based on residuals is proposed based on this. Based on the DEAP evolutionary algorithm package, the initial population is constructed using functions such as addPrimitive, and a function set containing the functions used is set, such as: subtraction function, summation function and other functions, and a termination set containing variables, constants and parameterless functions is set. The function set and the termination set determine the structure of each individual tree in the initial population. Individual is used to define the individuals that constitute the initial population in the genetic algorithm.

[0062] Step 2.1: Construct the basic function set and the termination set.

[0063] In this embodiment, the purpose of defining the basic function set is to construct a search space required for subsequent evolution of a genetic programming (GP) algorithm, where the search space is used to select a function and generate a new individual.

[0064] The basic function set includes a root node function, a convolution function, a pooling function, a residual function, an addition function, a subtraction function and a scaling function.

[0065] The root node function is used to connect several images or vectors input into the function into one vector.

[0066] In this embodiment, descriptions of all functions in the basic function set and their inputs, outputs, and function actions are shown in Table 1. The root node functions include: Root1, Root2, Root3, and Root4. The root node functions convert multiple images or vectors into one vector by connecting all arrays in the image or vector.

[0067] The convolution function is used to perform a convolution operation on an image input into the function using a filter, and replace the pixel value of the image with the weighted sum of the values ​​of adjacent pixels of the pixel point, so as to extract image features.

[0068] In this embodiment, the convolution function Conv uses the existing evolved filter to perform a convolution operation on the image input to Conv, wherein the filter is actually used as a weight to replace the pixel value of the image with the weighted sum of adjacent pixel values ​​to extract the features corresponding to the image.

[0069] The pooling function is used to perform maximum pooling on the image input into the function.

[0070] In this embodiment, the pooling function uses the MaxP function to downsample the image by returning the maximum value of each sliding window, so as to retain important information in the image while reducing the image size. The MaxP function takes the image input to the MaxP function and the kernel sizes k1 and k2 of the MaxP function as inputs to the MaxP function, and performs a downsampling operation on the image. In addition, the pooling function also includes a ZMaxP function, which is used to perform maximum pooling on the image and add zero padding around the image to maintain the size of the image unchanged.

[0071] The residual function is used to perform a residual operation on the image input into the function.

[0072] The adding function is used to add every two weighted images with the same or different sizes.

[0073] The subtraction function is used to subtract every two weighted images with the same or different sizes.

[0074] In this embodiment, both the subtraction function Sub and the addition function Add use the random number n1 and the random number n2 to perform weighted subtraction and addition operations on Root2. If the two input images are of different sizes, the Sub and Add functions will first crop the images so that the two images have the same size, and then perform weighted subtraction and addition operations.

[0075] The scaling function is used to scale the pixel values ​​of the input function image.

[0076] In this implementation, the scaling function includes: an activation function ReLU, a root function Sqrt, and an absolute value function Abs, wherein the ReLU function, the Sqrt function, and the Abs function are all used to rescale the pixel values ​​of the image.

[0077] Table 1 List of functions in the basic function set

[0078] function enter Output describe Root1 Two vectors A vector Concatenate two vectors into one vector Root2 Two images A vector Concatenate two images into one vector Root3 Three images A vector Concatenate the three images into one vector Root4 Four images A vector Concatenate four images into one vector Conv An image An image Convolve the image with a filter MaxP An image An image Perform max pooling on the image ZMaxP An image An image Perform max pooling on the image and then zero pad the image Resiual An image An image Perform residual operation on the image Sub Two images An image Subtract every two weighted images of the same or different size Add Two images An image Add every two weighted images with the same or different size Relu An image An image For each pixel in the image, returns max(0,) Sqrt An image An image Returns √ or 1 for each pixel in the image Abs An image An image For each pixel in the image, return ||

[0079] The termination set is used to define the parameter values ​​of each function in the basic function set.

[0080] The termination set includes: weak image data of size m × n, filters of several different sizes acting on the convolution function, random input values ​​n1 and n2 of the addition function or the subtraction function, and kernel parameters k1 and k2 of the pooling function; wherein m and n are the length and width of the weak image data, respectively.

[0081] In this embodiment, the termination set is used to define the size range of each function in Table 1, as shown in Table 2. The termination set includes: Image m×n 、Filter 3×3 、Filter 5×5 、Filter 7×7 , k1, k2, n1 and n2; where Image m×n Represents an input image of size m×n; Filter 3×3 、Filter 5×5 、Filter 7×7 Represents filters of different sizes as a component of the Conv function, and the values ​​in the filter are randomly initialized according to the range listed in Table 2 and automatically evolved during the genetic programming process. n1 and n2 are the inputs of the Add function and the Sub function, and n1 and n2 are randomly sampled from [0.000, 1.000]. k1 and k2 represent the kernel parameters of the MaxP and ZMaxP functions, respectively. The values ​​of k1 and k2 are randomly sampled from [1, 8] by the random function Random and automatically evolved during the evolutionary learning process.

[0082] Table 2 Data table of the termination set

[0083] termination scope describe <![CDATA[Image m×n ]]> {0, 1, 2, ..., 255} Input image of size m × n, where m and n are the length and width of the image respectively. <![CDATA[Filter 3×3 ]]> {−5, −4, ..., 5} 3×3 filter, as the size range of 3×3 Conv <![CDATA[Filter 5×5 ]]> {−5, −4, ..., 5} 5×5 filter, as the size range of 5×5 Conv <![CDATA[Filter 7×7 ]]> {−5, −4, ..., 5} 7×7 filter, as the size range of 7×7 Conv n1,n2 [0.000, 1.000) Random numbers, as child nodes of Add and Sub k1,k2 k1,k2 Kernel size for MaxP and ZMaxP

[0084] Step 2.2: According to the basic function set and the termination set, several individual trees are randomly generated as individuals and constitute the initial population.

[0085] The individual tree is: an input layer, a first convolutional layer, a second convolutional layer, a pooling layer, a connection layer and an output layer; wherein the second convolutional layer is residually connected to the pooling layer; the pooling layer is residually connected to the connection layer; the connection layer is residually connected to the output layer; the input layer is used to input weak image data; the first convolutional layer and the second convolutional layer are both used to extract features of the input weak image data through a convolution operation conv; the pooling layer is used to reduce the dimension of the extracted features by performing maximum pooling on the features; the connection layer is used to perform dimensionality conversion on the reduced-dimensional features and the features extracted by the convolutional layer to obtain a feature vector with a specific dimension; the output layer is used to obtain and output the classification result of the weak image data based on the reduced-dimensional features and the feature vector.

[0086] In this embodiment, the convolution layer mainly performs convolution operations on the image, and also has important functions such as rescaling, activation or enhancement. The pooling layer performs max pooling on the input image, one of the important purposes of which is dimensionality reduction.

[0087] The method for generating the individual tree is as follows: randomly selecting a function from the convolution function, the addition function, the subtraction function and the scaling function in the basic function set as the function mapping of the first convolution layer, randomly selecting a function from the convolution function, the addition function, the subtraction function and the scaling function in the basic function set as the function mapping of the second convolution layer, using the pooling function in the basic function set as the function mapping of the pooling layer, using the root node function in the basic function set as the function mapping of the connection layer, using the residual function in the basic function set as the function mapping of the residual connection, and defining the parameter values ​​of the input layer, the first convolution layer, the second convolution layer, the pooling layer, the connection layer and the output layer in the individual tree according to the termination set.

[0088] The residual connection in the individual tree uses a residual-based genetic operator, and the genetic operator is defined to include: a direct mapping part and a residual part; wherein the direct mapping part is to directly pass the features obtained in the previous network layer in the individual to the current network layer, and the residual part is composed of several cascaded convolutional layers; the weak image data is used as the input of the residual-based genetic operator, and the output values ​​of the direct mapping part and the residual part are accumulated, and then the output result of the residual-based genetic operator is obtained after activation by the ReLU function.

[0089] In this embodiment, the existing GP algorithm is limited by the operator space and cannot efficiently capture feature changes. For feature extraction, a residual-based genetic operator is defined to transform randomly selected cotyledons during crossover and mutation using the GP algorithm. Figure 3As shown in the figure, the direct mapping part of the residual-based genetic operator directly passes the features obtained in the previous layer to the current layer, which plays a role in enhancing the feature recognition ability of the deep network; the residual part of the residual-based genetic operator consists of several cascaded convolutional layers, which plays a role in calculating residual information. The residual-based genetic operator can solve the negative optimization problem degradation in GP evolution.

[0090] For a certain network layer in the individual tree, the residual-based genetic operator is defined as:

[0091] (1)

[0092] in is the objective function of the residual-based genetic operator; Represents a weak image data sample randomly sampled from the training set; is the optimal function of a network layer in the individual tree.

[0093] In this embodiment, if Figure 4 As shown, the objective function It is called "residual function". In order to improve the nonlinearity of GP-based evolutionary deep learning, the residual-based genetic operator is modified into the following form:

[0094] (2)

[0095] in represents the output of the residual-based genetic operator; Represents the nonlinear function ReLU; Represents the weight within the residual-based genetic operator.

[0096] In this embodiment, experiments show that most of the optimal GP individuals have selected residual-based genetic operators, and compared with the existing GP-based methods, the operator space with residual-based genetic operators has a stronger feature extraction capability. An evolutionary algorithm is used to generate a series of individual structures composed of residual-based genetic operators for low-quality image recognition tasks. However, the individual structure generated by the above steps cannot resist the attack of noisy data, that is, after the generated individuals are trained on the collected data set, encountering noisy data will cause the accuracy to be greatly reduced. In order to alleviate the above problems, a new evolutionary model based on adversarial training is proposed.

[0097] Step 3: Use the adversarial training algorithm to train the individuals in the initial population, and use the trained individuals to construct a new population as the current population.

[0098] Step 3.1: Based on the weak image dataset, the fast gradient sign method is used to generate adversarial samples.

[0099] In order to achieve adversarial training, this embodiment constructs a new evolutionary model of adversarial training, which is implemented by using the adversarial training algorithm. Specifically, the acquired weak image data is used to and its true label Generate adversarial samples, and then use these adversarial samples to train individuals to enhance their robustness. Since the implementation of generating adversarial samples depends on the specific adversarial attack algorithm, the Fast Gradient Sign Method (FGSM) is used to generate adversarial samples.

[0100] The generation formula of the adversarial sample is:

[0101] (3)

[0102] in is the generated adversarial sample; is a weak image data sample randomly sampled from the training set The corresponding true label; is the learning rate, which is used to control the degree to which the sample changes; is a sign function, and when the value of the expression in the sign function is a positive number, the return result of the sign function is 1, when the value is a negative number, the return result of the sign function is -1, and when the value is 0, the return result of the sign function is 0; Express Find partial derivatives; for and The cross entropy function of .

[0103] In this embodiment, the cross entropy function is used as the final loss function for optimization, and the gradient of the loss function is directly used to make the loss function larger by calculating the gradient of the weak image data sample in accordance with the idea of ​​back propagation. The generated adversarial sample will slightly change the pixel value of the original image to produce an erroneous prediction.

[0104] Step 3.2: Use adversarial samples and training sets to construct a new training set, construct a cross entropy function based on adversarial learning as the loss function, and use the new training set to train the individuals in the initial population. During the training process, the loss function is maximized to generate trained individuals to form a new population as the current population.

[0105] In this embodiment, a new loss function, namely the cross entropy function based on adversarial learning, is constructed to evaluate the robustness of individuals evolved by the genetic programming algorithm. Adversarial learning is only a new optimization mode. In order to generate an individual structure with the ability to resist noise attacks, it is necessary to use a new training set to train individuals in the initial population to generate new individuals, and then evaluate the fitness function value of the generated new individuals. The individual with the largest fitness function value is used as the final optimal individual for the weak image classification task, and the optimal individual has the ability to resist noise.

[0106] Step 4: Use a distributed evolutionary algorithm to select the best individual from the current population.

[0107] Step 4.1: Set the maximum number of iterations, crossover rate and mutation rate, set the number of elites to M, and initialize the minimum depth and maximum depth of the individual tree corresponding to each individual in the new population.

[0108] In this embodiment, the training set and the test set in the weak image data set are used as the input of the individual tree in the population, the toolbox.population function is used to generate the population, the number of individuals in the population is set, the number of iterations is set, the crossover rate, the mutation rate and the elite rate are set, and the minimum depth and maximum depth of the tree and the maximum depth of all trees are initialized. Since all individuals in the population are tree structures, the individuals can be used to process images to generate feature vectors corresponding to each image.

[0109] Step 4.2: Use the training set to evaluate the individuals in the current population, and calculate the fitness function values ​​of all individuals using the cross-validation method and the fitness function of the distributed evolutionary algorithm based on the evaluation results.

[0110] The method for evaluating individuals in the current population using a training set is as follows: for any individual in the current population, the individual is used to extract features from all weak image data in the training set, and the extracted feature vectors are normalized to obtain a normalized training set, and then a linear support vector machine (SVM) is used to classify the weak image data in the normalized training set, and the classification accuracy is calculated based on the obtained classification results and the true labels of each weak image data, and the obtained classification accuracy is used as the evaluation result.

[0111] In this embodiment, the training set includes several weak image data with real labels. All weak image data in the training set are converted into feature vectors by individuals, and then the obtained feature vectors are normalized using the minimum and maximum normalization method, and the normalized training set is input into the linear SVM to perform classification. Fitness refers to the accuracy of the individual on the weak image data set.

[0112] Step 4.3: Sort all individuals in descending order according to the fitness function value, and use the elitist strategy to select the first M individuals in the sorting result as the elite population.

[0113] Step 4.4: According to the crossover rate and mutation rate, the remaining individuals in the current population are evolved by crossover and mutation to obtain evolved individuals, and the evolved individuals are re-evaluated using the training set. Based on the evaluation results, the fitness function value of the evolved individuals is calculated using the cross-validation method and the fitness function of the distributed evolutionary algorithm.

[0114] In this embodiment, genetic operators are used in the evolution process of the genetic programming (GP) algorithm, which generally include: selection operator, crossover operator and mutation operator; the selection operator is used to select an individual with the highest accuracy on a specified data set from the population; the crossover operator and mutation operator act on the individual to generate a new individual by changing the structure of the individual. Figure 5 As shown in , the crossover operator first selects the individual tree with the best fitness from the population as the parent, then selects the individual tree with the second best fitness from the remaining individual trees in the population as the second individual, randomly selects a cotyledon from the parent, and then randomly selects a cotyledon from the second individual. The two selected cotyledons are composed of the functions in Table 1 and the size range of each function is shown in Table 2; the randomly selected cotyledon from the parent is replaced with the randomly selected cotyledon from the second individual to generate a new individual tree. Since the new individual tree inherits the characteristics of the parent on the one hand and retains the excellent attributes of the second individual on the other hand, in theory, the probability that the new offspring tree has a high fitness will be greater.

[0115] like Figure 6 As shown in the figure, the mutation operator first selects the individual tree with the best fitness from all populations as the blueprint, and then performs random mutation based on the structure of the blueprint, and uses the mutated part to replace the corresponding structure in the blueprint to generate a new individual. Although the blueprint itself has good genes, due to random mutations in some subtrees in the blueprint, the blueprint may mutate in a good direction or a bad direction. The uncertainty of mutation is greater than that of the crossover operator. The crossover operator and the mutation operator have strong complementarity, which is conducive to the diversity of the population. Since the fitness of the evolved new individual is invalid, the fitness function value of the individual needs to be recalculated.

[0116] Step 4.5: Sort the fitness function values ​​of the evolved individuals from large to small, select the first M individuals in the sorting result and the elite population to form the next generation population, and take the individual with the largest fitness function value in the next generation population as the best individual in the current iteration round and save it to the Hall of Fame hof, return to step 4.4 until the maximum number of iterations is completed.

[0117] Step 4.6: Select the individual with the largest fitness function value from the best individuals of all iteration rounds saved in the Hall of Fame hof as the optimal individual.

[0118] In this embodiment, the Hall of Fame hof can be used to retain the best individuals that have ever existed in the population during the evolution process, and will not be lost due to selection, crossover or mutation. The HallOfFame class is implemented in the tools module. The Halloffame object is used to implement elitism. The individuals contained in the Halloffame object are directly injected into the next generation population and are not affected by the genetic operators of selection, crossover and mutation; all the best individuals that appear in the evolution process are tracked by hof = tools.HallOfFame(1). Each iteration needs to update the value of hof so that the best individual can be returned later.

[0119] Step 5: Use the individual tree structure corresponding to the optimal individual as the weak image classification model, obtain the weak image data to be classified and input it into the weak image classification model, obtain the feature vector of the weak image data and use linear SVM for classification to obtain the classification result of the weak image data.

[0120] In order to further verify the effectiveness of the present method, this embodiment uses three weak image data sets of different sizes: Flowers, CatDog and KTH to perform weak image classification simulation tests. The test results are shown in Table 3. The traditional method used in the test is the GP algorithm without a residual operator function and a new evolutionary model based on adversarial training. According to the test results, it can be seen that compared with the existing methods, the method of the present invention has stronger noise resistance and stronger feature extraction capabilities, and can more accurately predict the weak image category.

[0121] Table 3 Weak image classification simulation test results data table

[0122] Model Flowers Dataset CatDog Dataset KTH Dataset Traditional methods Accuracy = 74.34% Accuracy = 70.32% Accuracy = 69.75% Method of the present invention Accuracy = 77.46% Accuracy = 73.67% Accuracy = 82.1%

[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.

Claims

1. A weak image classification method based on robust genetic programming and feature learning, It is characterized in that The method comprises the following steps: Step 1: Obtain the weak image data to be classified and construct a weak image dataset, and divide the weak image dataset into a training set according to a preset ratio; Step 2: Generate individuals and construct the initial population based on the distributed evolutionary algorithm DEAP; Step 2.1: Construct the basic function set and the termination set; The basic function set includes a root node function, a convolution function, a pooling function, a residual function, an addition function, a subtraction function and a scaling function; The root node function is used to connect several images or vectors input into the function into one vector; The convolution function is used to perform a convolution operation on an image input into the function using a filter, and replace the pixel value of the image with the weighted sum of the values ​​of the adjacent pixels of the pixel point, so as to extract image features; The pooling function is used to perform maximum pooling on the image input into the function; The residual function is used to perform a residual operation on the image input into the function; The addition function is used to add every two weighted images with the same or different sizes; The subtraction function is used to subtract every two weighted images with the same or different sizes; The scaling function is used to scale the pixel values ​​input into the function image; The termination set is used to define the parameter values ​​of each function in the basic function set; The termination set includes: weak image data of size m×n, filters of several different sizes acting on the convolution function, and random input values ​​n of the addition function or the subtraction function. 1 and n 2 , and the kernel parameter k of the pooling function 1 and k 2 ; Where m and n are the length and width of the weak image data respectively; Step 2.2: According to the basic function set and the termination set, a number of individual trees are randomly generated as individuals and constitute the initial population; The individual tree is: an input layer, a first convolutional layer, a second convolutional layer, a pooling layer, a connection layer and an output layer; wherein the second convolutional layer is residually connected to the pooling layer; the pooling layer is residually connected to the connection layer; the connection layer is residually connected to the output layer; the input layer is used to input weak image data; the first convolutional layer and the second convolutional layer are both used to extract features of the input weak image data through convolution operations; the pooling layer is used to reduce the dimension of the extracted features by performing maximum pooling on the features; the connection layer is used to perform dimension conversion on the reduced-dimensional features and the features extracted by the convolutional layer to obtain a feature vector with a specific dimension; the output layer is used to obtain and output the classification result of the weak image data based on the reduced-dimensional features and the feature vector; The method for generating the individual tree is as follows: randomly selecting a function from the convolution function, the addition function, the subtraction function and the scaling function in the basic function set as the function mapping of the first convolution layer, randomly selecting a function from the convolution function, the addition function, the subtraction function and the scaling function in the basic function set as the function mapping of the second convolution layer, using the pooling function in the basic function set as the function mapping of the pooling layer, using the root node function in the basic function set as the function mapping of the connection layer, using the residual function in the basic function set as the function mapping of the residual connection, and defining the parameter values ​​of the input layer, the first convolution layer, the second convolution layer, the pooling layer, the connection layer and the output layer in the individual tree according to the termination set; The residual connection in the individual tree uses a residual-based genetic operator, and the genetic operator is defined to include: a direct mapping part and a residual part; wherein the direct mapping part is to directly pass the features obtained in the previous network layer in the individual to the current network layer, and the residual part is composed of several cascaded convolutional layers; the weak image data is used as the input of the residual-based genetic operator, and the output values ​​of the direct mapping part and the residual part are accumulated, and then activated by the ReLU function to obtain the output result of the residual-based genetic operator; The residual-based genetic operator is expressed as: Where y represents the output of the residual-based genetic operator; represents the nonlinear function ReLU; W represents the weight in the residual-based genetic operator; x is a weak image data sample randomly sampled from the training set; F(·) is the objective function of the residual-based genetic operator; Step 3: Use the adversarial training algorithm to train the individuals in the initial population, and use the trained individuals to construct a new population as the current population; Step 3.1: Generate adversarial samples using the fast gradient sign method based on the weak image dataset; The generation formula of the adversarial sample is: where x adv is the generated adversarial sample; l is the true label corresponding to the weak image data sample x randomly sampled from the training set; ε is the learning rate; sign(·) is the sign function, and when the value of the expression in the sign function is positive, the return result of the sign function is 1, when the value is negative, the return result of the sign function is -1, and when the value is 0, the return result of the sign function is 0; represents the partial derivative of x; J(x,l) is the cross entropy function of x and l; Step 3.2: Use the adversarial sample and the training set to construct a new training set, construct a cross entropy function based on adversarial learning as the loss function, and use the new training set to train the individuals in the initial population. During the training process, the loss function is maximized to generate trained individuals to form a new population as the current population; Step 4: Use a distributed evolutionary algorithm to select the best individual from the current population; Step 5: Use the individual tree structure corresponding to the optimal individual as the weak image classification model, obtain the weak image data to be classified and input it into the weak image classification model, obtain the feature vector of the weak image data and use linear SVM for classification to obtain the classification result of the weak image data.

2. According to claim 1, a weak image classification method based on robust genetic programming and feature learning, It is characterized in that The weak image data is image data with pixels less than 100x100, and the acquired weak image data contains a true label of the weak image data.

3. According to claim 2, a weak image classification method based on robust genetic programming and feature learning, It is characterized in that The step 4 further comprises: Step 4.1: Set the maximum number of iterations, crossover rate and mutation rate, set the number of elites to M, and initialize the minimum depth and maximum depth of the individual tree corresponding to each individual in the new population; Step 4.2: Use the training set to evaluate the individuals in the current population, and calculate the fitness function values ​​of all individuals using the cross-validation method and the fitness function of the distributed evolutionary algorithm based on the evaluation results; Step 4.3: Sort all individuals in descending order according to the fitness function value, and use the elitist strategy to select the first M individuals in the sorting result as the elite population; Step 4.4: According to the crossover rate and mutation rate, the remaining individuals in the current population are evolved by crossover and mutation to obtain evolved individuals, and the evolved individuals are re-evaluated using the training set. Based on the evaluation results, the fitness function value of the evolved individuals is calculated using the cross-validation method and the fitness function of the distributed evolutionary algorithm; Step 4.5: Sort the fitness function values ​​of the evolved individuals from large to small, select the first M individuals in the sorting result and the elite population to form the next generation population, and take the individual with the largest fitness function value in the next generation population as the best individual in the current iteration round and save it to the Hall of Fame hof, return to step 4.4 until the maximum number of iterations is completed; Step 4.6: Select the individual with the largest fitness function value from the best individuals of all iteration rounds saved in the Hall of Fame hof as the optimal individual.

4. According to claim 3, a weak image classification method based on robust genetic programming and feature learning, It is characterized in that The method described in step 4.2 for evaluating individuals in the current population using the training set is as follows: for any individual in the current population, use the individual to extract features from all weak image data in the training set, and normalize the extracted feature vectors to obtain a normalized training set, and then use a linear support vector machine SVM to classify the weak image data in the normalized training set, calculate the classification accuracy based on the obtained classification results and the true labels of each weak image data, and use the obtained classification accuracy as the evaluation result.

Citation Information

Patent Citations

  • Method for enhancing resistance to migration attack of image sample

    CN115439377A

  • General adversarial sample generation method based on DE-CW

    CN116304703A