Convolutional neural network structure optimization method based on agent-assisted evolutionary algorithm

By optimizing the structural parameters of convolutional neural networks based on a surrogate-assisted evolutionary algorithm, the problems of limited improvement in network prediction performance and low optimization efficiency in existing technologies are solved, achieving more efficient network optimization and performance improvement.

CN115879509BActive Publication Date: 2025-10-28XIDIAN UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202211449687.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2025-10-28
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

The structural design of convolutional neural networks in existing technologies is difficult, resulting in limited improvement in network prediction performance and low optimization efficiency.

Method used

The structural parameters of convolutional neural networks are optimized using surrogate-assisted evolutionary algorithms, including global surrogate-assisted hybrid evolutionary algorithm, local surrogate-assisted distribution estimation algorithm, and continuous surrogate-assisted differential evolutionary algorithm. These algorithms optimize the structural parameters of convolutional and fully connected layers and use surrogate models to replace time-consuming training and validation evaluation.

Benefits of technology

It significantly improves the prediction performance of convolutional neural networks, increases optimization efficiency, and saves computing resources and time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115879509B_ABST
    Figure CN115879509B_ABST
Patent Text Reader

Abstract

This invention discloses a convolutional neural network (CNN) structure optimization method based on a surrogate-assisted evolutionary algorithm, addressing the technical problems of limited improvement in network prediction performance and low optimization efficiency in existing technologies. The implementation steps are: obtaining training and validation sample sets; obtaining the structural parameters of the CNN; initializing the parameter sample set and validation accuracy set; and optimizing the structural parameters based on the surrogate-assisted evolutionary algorithm. This invention employs a hybrid evolutionary algorithm with global or local surrogate assistance to globally optimize the structural parameters. This approach balances exploration and development during the optimization process, improving the search capability and leading to better structural parameters. Consequently, it significantly enhances the prediction performance of the optimized CNN. The surrogate model is used to predict the validation accuracy, replacing the extensive and time-consuming training and validation processes required during evolutionary optimization, saving significant computational resources and evaluation time, and improving optimization efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent optimization and relates to a method for optimizing the structure of a convolutional neural network, specifically a method for optimizing the structure of a convolutional neural network based on a surrogate-assisted evolutionary algorithm. Background Technology

[0002] Convolutional Neural Networks (CNNs) are widely used neural network models in fields such as computer vision, natural language processing, speech recognition, and semantic analysis. Their basic structure consists of an input layer, convolutional layers, pooling layers, fully connected layers, and an output layer. Convolutional layers extract features through convolution operations, while pooling layers reduce the resolution of feature surfaces to obtain spatially invariant features. Common pooling methods include max pooling and mean pooling. Fully connected layers integrate class-discriminative feature information. Dropout techniques are used in fully connected layers to reduce network complexity, enabling neurons to learn more robust features. However, the structural design of CNNs is crucial and challenging, as different structural parameters significantly impact model performance. When empirically designed or classic network structures fail to meet task requirements, optimizing network structural parameters becomes essential.

[0003] For example, in their patent application "A Method for Directly Determining the Weights of a Neural Network Based on PSO for Optimizing its Structure" (Application No.: CN201811024634.5, Publication No.: CN109344961A), South China University of Technology and Foshan Shunde Zhike Intelligent Technology Co., Ltd. disclosed a method for directly determining the weights of a neural network based on PSO for optimizing its structure. This method applies the PSO algorithm to optimize the network structure and finds the optimal number of neurons in the neural network. The trained network has a strong approximation ability and high practical value. However, the drawback of this method is that it optimizes the continuous structural parameter of the number of neurons, but does not tune discrete structural parameters such as the activation function type, which have a significant impact on the network model. Therefore, the improvement in the prediction performance of the optimized network is limited.

[0004] For example, Northwestern Polytechnical University disclosed a method for optimizing deep neural network structures based on the fusion of prediction mechanisms and genetic algorithms in its patent application, "A Deep Neural Network Structure Optimization Method Based on the Fusion of Prediction Mechanism and Genetic Algorithm" (Application No.: CN201910696239.X, Publication No.: CN110490320A), which aims to solve the technical problem of low search efficiency in existing network structure search methods. However, this method can optimize the structure of convolutional layers but not the structure of fully connected layers. Therefore, the improvement in the prediction performance of the optimized network is limited. Furthermore, in the process of genetic algorithm optimization, training and validation require a lot of time during evaluation, resulting in low optimization efficiency. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the existing technology and propose a convolutional neural network structure optimization method based on surrogate-assisted evolution algorithm to solve the technical problems of limited improvement in network prediction performance and low optimization efficiency in the existing technology.

[0006] To achieve the above objectives, the technical solution adopted by the present invention includes the following steps:

[0007] (1) Obtain the training sample set and the validation sample set:

[0008] Obtain M images of category C, label the category of each image, and then combine V images and their corresponding labels to form a training image sample set D. train The remaining MV images and their corresponding labels form the verification image sample set D. val Where C≥2, M≥50000, V>M / 2;

[0009] (2) Obtaining the structural parameters of the convolutional neural network:

[0010] Obtain the structural parameters s of a convolutional neural network model O consisting of A convolutional layers, B pooling layers, and E fully connected layers. s includes continuous parameters x, which consist of the number of convolutional kernels in the A convolutional layers, the number of neurons in the first E-1 fully connected layers, and the random inactivation rate of neurons. It also includes discrete parameters z, which consist of the size of the convolutional kernels in the A convolutional layers, the type of activation function used, and the type of pooling function used in the B pooling layers. Here, A≥1, B≥1, E≥2, the number of parameters in x is L=A+2E-2, and the number of parameters in z is R=2A+B.

[0011] (3) Initialize the parameter sample set and the validation accuracy set:

[0012] Perform N random samplings on the structural parameter s, and set the resulting parameter sample set S1 = {s1, s2, ..., s...} n ,...,sN Each parameter sample s in} n The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples, and the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as s. n The corresponding verification accuracy f n Finally, the validation accuracy set F1 = {f1, f2, ..., f1} corresponding to the parameter sample set S1 is obtained. n ,...,f N}, where N≥100, s n f represents the nth parameter sample. n s n The corresponding validation accuracy is e≥10;

[0013] (4) Optimize structural parameters based on surrogate-assisted evolutionary algorithm:

[0014] (4a) Initialize the number of iterations to t, the maximum number of iterations to T, T≥200, the diversity threshold to τ, 0<τ<1, and the population to P. t And let t = 1, P1 = S1;

[0015] (4b) Calculate the current population P t Diversity index R t And determine R t If τ is true, proceed to step (4c); otherwise, proceed to step (4d).

[0016] (4c) A global proxy-assisted hybrid evolutionary algorithm is used to globally optimize the structural parameters s, and the optimized structural parameters are then used to optimize the structural parameters. The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. The corresponding validation accuracy f1 tUpdate the parameter sample set S' t and the corresponding validation accuracy set F t ', F t '=F t-1 ∪{f1 t}, and execute step (4e);

[0017] (4d) A local surrogate-assisted distribution estimation algorithm is used to locally optimize the structural parameters s, and the optimized structural parameters are then used to perform local optimization. The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. Corresponding verification accuracy And update the parameter sample set S' t and the corresponding validation accuracy set F t ',

[0018] (4e) will be transferred from the current population P t The individual with the highest verification accuracy selected from among them and from the parameter sample set S t N selected cb The discrete parameters take values ​​of The samples constitute the sample parameter set Then determine N. cb If ≥5×L is true, proceed to step (4f); otherwise, proceed to step (4g).

[0019] (4f) The continuous structure parameter x is optimized using a continuous surrogate-assisted differential evolution algorithm to obtain the optimized continuous structure parameter. combination and Received The structural parameters of convolutional neural network model O are used to obtain the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. Corresponding verification accuracy Update parameter sample set S t and the corresponding validation accuracy set F t ,

[0020] (4g) Determine whether t = T holds true. If so, output the parameter sample set S. T and the corresponding validation accuracy set F T And from S T Get F T The structural parameter s with the highest verification accuracy in China best ={x best ,z best} is used as the structural parameters of the convolutional neural network model O to obtain the optimal convolutional neural network. Otherwise, let t = t + 1, S t =S' t , F t =F t ', and from the parameter sample set S t Select F from t The top N parameter samples with the highest validation accuracy are used as the current population P. t Then proceed to step (4b).

[0021] Compared with the prior art, the present invention has the following advantages:

[0022] First, in the process of optimizing the structural parameters of the convolutional neural network, this invention selects a hybrid evolutionary algorithm with global proxy assistance for global optimization of the structural parameters or a local proxy-assisted distribution estimation algorithm for local optimization based on the population diversity index. This can take into account the exploration and development in the optimization process, improve the search capability of optimization, thereby finding better structural parameters and significantly improving the prediction performance of the optimized convolutional neural network.

[0023] Second, this invention uses a surrogate-assisted evolutionary algorithm to optimize structural parameters including the number of convolutional kernels, kernel size, activation function type, number of neurons in fully connected layers, and neuron inactivation rate. This provides a more comprehensive optimization of the structural parameters of the convolutional neural network. Furthermore, the use of hybrid operators to process structural parameters during the optimization process can eliminate quantization errors and accuracy loss during encoding, resulting in a convolutional neural network with better network prediction performance.

[0024] Third, this invention uses a surrogate model to predict the verification accuracy, replacing the large amount of expensive and time-consuming training and verification required during the evaluation process in evolutionary optimization, saving a lot of computing resources and evaluation time, and improving optimization efficiency. Attached Figure Description

[0025] Figure 1 This is a flowchart illustrating the implementation of the present invention.

[0026] Figure 2 This is a flowchart of the optimization of structural parameters based on the surrogate-assisted evolutionary algorithm of the present invention.

[0027] Figure 3 This is a flowchart of the present invention, which uses a global proxy-assisted hybrid evolutionary algorithm to globally optimize structural parameters.

[0028] Figure 4 This is a flowchart of the optimization of continuous structural parameters using a continuous agent-assisted differential evolution algorithm according to the present invention. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:

[0030] See attached document Figure 1 The present invention includes the following steps:

[0031] (1) Obtain the training sample set and the validation sample set:

[0032] Obtain M images of category C, label the category of each image, and then combine V images and their corresponding labels to form a training image sample set D. train The remaining MV images and their corresponding labels form the verification image sample set D. val Where C≥2, M≥50000, V>M / 2;

[0033] In this embodiment, the image dataset is the training set portion of the CIFAR-10 dataset, with M=50000, C=10, V=45000, and MV=5000.

[0034] (2) Obtaining the structural parameters of the convolutional neural network:

[0035] Obtain the structural parameters s of a convolutional neural network model O consisting of A convolutional layers, B pooling layers, and E fully connected layers. s includes continuous parameters x, which consist of the number of convolutional kernels in the A convolutional layers, the number of neurons in the first E-1 fully connected layers, and the random inactivation rate of neurons. It also includes discrete parameters z, which consist of the size of the convolutional kernels in the A convolutional layers, the type of activation function used, and the type of pooling function used in the B pooling layers. Here, A≥1, B≥1, E≥2, the number of parameters in x is L=A+2E-2, and the number of parameters in z is R=2A+B.

[0036] In this embodiment, the convolutional neural network model O is LeNet-5, whose structure includes two convolutional layers, two pooling layers, and three fully connected layers, i.e., A=2, B=2, E=3. The structural parameters s of the convolutional neural network model O include six continuous parameter variables consisting of the number of convolutional kernels in the two convolutional layers, the number of neurons in the first two fully connected layers, and the random inactivation rate of neurons. L=6, and six discrete parameter variables consisting of the kernel size of the two convolutional layers, the type of activation function used, and the type of pooling function used in the two pooling layers. R = 6.

[0037] (3) Initialize the parameter sample set and the validation accuracy set:

[0038] Perform N random samplings on the structural parameter s, and set the resulting parameter sample set S1 = {s1, s2, ..., s...} n ,...,s N Each parameter sample s in} n The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples, and the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as s. n The corresponding verification accuracy f n Finally, the validation accuracy set F1 = {f1, f2, ..., f1} corresponding to the parameter sample set S1 is obtained. n ,...,f N}, where N≥100, s n f represents the nth parameter sample. n s n The corresponding validation accuracy is e≥10;

[0039] In this embodiment, the range of values ​​for the structural parameters s of the convolutional neural network model O, the number of convolutional kernels in the two convolutional layers, and the number of neurons in the two fully connected layers are first determined based on practical experience. Random inactivation rate of two fully connected layers Kernel size of two convolution layers Activation function types for two convolutional layers Where 0 represents the "ReLU" function, 1 represents the "Sigmoid" function, and 2 represents the "tanh" function, indicating a two-level pooling type. 0 represents max pooling, 1 represents average pooling, Latin hypercube sampling is used to perform uniform random sampling within the parameter definition interval, the number of samplings N=100, the number of training iterations e=10, during the iterative training of the neural network, the loss function is cross-entropy loss, the optimization method is stochastic gradient descent, and the learning rate is set to 0.01.

[0040] (4) Refer to Appendix Figure 2 The structural parameters are optimized based on a proxy-assisted evolutionary algorithm.

[0041] (4a) Initialize the number of iterations to t, the maximum number of iterations to T, T≥200, the diversity threshold to τ, 0<τ<1, and the population to P. t And let t = 1, P1 = S1;

[0042] In this embodiment, the maximum number of iterations T = 200, and the diversity threshold τ = 0.9.

[0043] (4b) Calculate the current population P t Diversity index R t And determine R t If τ is true, proceed to step (4c); otherwise, proceed to step (4d).

[0044] Among them, the current population P t Diversity index R t The calculation formula is as follows:

[0045]

[0046]

[0047] Among them, DI t DI1 and DI1 represent the current population P, respectively. t The degree of diversity of the initial population P1, x nl Population P t The value of the l-th continuous parameter of the n-th individual. Population P t The average value of the l-th continuous parameter of all individuals in the dataset, z nrPopulation P t The value of the r-th discrete parameter of the nth individual, w r Population P t The mode of the r-th discrete parameter values ​​for all individuals. Represents the XOR operation;

[0048] (4c) A global proxy-assisted hybrid evolutionary algorithm is used to globally optimize the structural parameter s. The implementation steps are shown in the appendix. Figure 3 :

[0049] (4c1) Combine the parameter sample set and the validation accuracy set {S} t ,F t As input to the radial basis function network (RBF network), the weights and biases between the hidden and output layers are calculated using matrix least squares. This weighted and biased RBF network model is then used as a global proxy model. The formulas for calculating the radial basis functions and Gower distance used in the model are as follows:

[0050]

[0051]

[0052] Where exp represents the exponential operation with base e to the natural constant, c k This represents the k-th center point of the hidden layer, σ represents the spread constant, which is twice the average distance between center points, and x l With z r Let them represent the l-th continuous parameter vector and the r-th discrete parameter vector, respectively. and Let cx and cx represent the upper and lower bounds of the l-th continuous parameter vector, respectively. l With cz r These represent the values ​​of the l-th continuous parameter and the r-th discrete parameter at the k-th center point of the hidden layer, respectively.

[0053] (4c2) Initialize the number of iterations to w. g The maximum number of iterations is W. g Using the current population P t As the initial population NP for the algorithm, a global surrogate model is used to predict the fitness values ​​of all individuals in the population NP, where 30 ≤ W g ≤100, and let w g =1;

[0054] (4c3) Differential mutation and crossover are performed on the continuous part of the individuals in the population NP to obtain the continuous part of the offspring population, and genetic crossover and mutation are performed on the discrete part to obtain the discrete part of the offspring population. The continuous part and the discrete part of the offspring population are combined to obtain the offspring population NP'.

[0055] (4c4) Use the global surrogate model to predict the fitness values ​​of all individuals in the offspring population NP', compare the predicted fitness values ​​of the corresponding individuals in the population NP and the offspring population NP', and retain the individuals with the larger predicted fitness values ​​in NP;

[0056] (4c5) Determine w g =W g If true, output the individual with the maximum fitness value in the population NP as the optimized structure parameter. Otherwise, let w g =w g +1, and execute step (4c3).

[0057] The optimized structural parameters The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. The corresponding validation accuracy f1 t Update the parameter sample set S' t and the corresponding validation accuracy set F t '=F t-1 ∪{f1 t}, and execute step (4e);

[0058] In this embodiment, the center points of the radial basis function network model are obtained by performing K-means clustering on the training samples, and the number of center points is set to... ||S|| represents the number of training samples, and the maximum number of iterations W. g =30, the differential evolution operator uses binomial crossover and DE / rand / 1 mutation operator, the crossover probability is set to 0.8, the scaling factor is set to 0.5, the genetic operator performs binary encoding on the discrete part, the crossover probability is set to 0.8, and the mutation probability is 0.3.

[0059] (4d) The structural parameter s is locally optimized using a local surrogate-assisted distribution estimation algorithm. The steps are as follows:

[0060] (4d1) Calculate the parameter sample set S t Among all samples and the individual with the highest current validation accuracy Using the Euclidean distance, select the u samples with the smallest distance. The corresponding set of validation accuracy is Will As input to the radial basis function network, the weights and biases between the hidden and output layers of the radial basis function network are calculated using the matrix least squares method. The radial basis function network model with these weights and biases is then used as a local surrogate model.

[0061] (4d2) From the current population P t Select the top N with high verification accuracy b The i-th parameter sample is selected as the best parameter sample, and the validation accuracy ratio α of the best parameter sample is calculated. i The calculation formula is as follows:

[0062]

[0063] Where f i Let be the validation accuracy corresponding to the i-th excellent parameter sample;

[0064] (4d3) Construct a Gaussian distribution for the continuous parameter. The expected value and standard deviation of the Gaussian distribution for the l-th continuous parameter are μ, respectively. l and σ l The calculation formula is as follows:

[0065]

[0066]

[0067] Where x nl This represents the value of the l-th continuous parameter in the nth excellent parameter sample;

[0068] (4d4) Construct a histogram probability distribution for the discrete parameter, where the r-th dimension of the discrete parameter is in its set of values. The value of the middle is The probability is p rq The calculation formula is as follows:

[0069]

[0070] Where z nr This represents the value of the r-th discrete parameter in the nth excellent parameter sample, and ⊙ represents the XOR operation;

[0071] (4d5) Random sampling of a Gaussian distribution yields N s A continuous parameter sample set X new Discrete parameters select values ​​according to probability within a defined set of values, and the probability distribution of the sampled histogram is used to obtain N. s A discrete parameter sample set Z new Combination X new and Z new The samples at the corresponding positions in the middle are used to obtain N. s A new parameter sample set S new Predicting S using a local surrogate model new The validation accuracy of each sample is used to obtain the set of prediction validation accuracies. choose Structural parameters corresponding to the maximum prediction validation accuracy As optimized structural parameters.

[0072] The optimized structural parameters The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. Corresponding verification accuracy And update the parameter sample set S' t and the corresponding validation accuracy set F t ',

[0073] In this embodiment, the number of samples with the smallest distance is selected as u = 100. The center points of the radial basis function network model are obtained by performing K-means clustering on the training samples, and the number of center points is set to... Number of excellent parameter samples N b =45, the number of new samples N s =200.

[0074] (4e) will be transferred from the current population P t The individual with the highest verification accuracy selected from among them and from the parameter sample set S t N selected cb The discrete parameters take values ​​of The samples constitute the sample parameter set Then determine N. cbIf ≥5×L is true, proceed to step (4f); otherwise, proceed to step (4g).

[0075] (4f) The continuous structure parameter x is optimized using a continuous surrogate-assisted differential evolution algorithm. The implementation steps are shown in the appendix. Figure 4 :

[0076] (4f1) from A continuous parameter sample set is constructed by extracting the continuous parameter portion of each parameter sample. The corresponding set of validation accuracy is Will Input a Gaussian process regression model and maximize the marginal likelihood function to obtain the optimal hyperparameter θ of the model. * The Gaussian process regression model with optimal hyperparameters is taken as the continuous surrogate model;

[0077] (4f2) Initialize the number of iterations to w. l The maximum number of iterations is W. l Using continuous parameter sample sets As the initial population NX for the algorithm, a continuous surrogate model is used to predict the fitness value of each individual in the population NX, where 30 ≤ W l ≤100, and let w l =1;

[0078] (4f3) Perform differential mutation and crossover on individuals in the population NX to obtain the offspring population NX';

[0079] (4f4) Use the continuous surrogate model to predict the fitness value of each individual in the offspring population NX', compare the predicted fitness values ​​of the corresponding individuals in the population NX and the offspring population NX', and retain the individuals with larger predicted fitness values ​​in NX;

[0080] (4f5) Determine w l =W l If true, output the individual with the highest fitness value in the population NX. As the optimized continuous structure parameter, otherwise, let w l =w l +1, then execute step (4f3);

[0081] Optimized continuous structural parameters were obtained combination and Received The structural parameters of convolutional neural network model O are used to obtain the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. Corresponding verification accuracy Update parameter sample set S' t and the corresponding validation accuracy set F t ',

[0082] In this embodiment, the initial value of the hyperparameter of the Gaussian process regression model is θ = 0.01, and the maximum number of iterations is W. l =30, the differential evolution operator uses binomial crossover and DE / rand / 1 mutation operator, the crossover probability is set to 0.8, and the scaling factor is set to 0.5.

[0083] (4g) Determine whether t = T holds true. If so, output the parameter sample set S. T and the corresponding validation accuracy set F T And from S T Get F T The structural parameter s with the highest verification accuracy in China best ={x best ,z best} is used as the structural parameters of the convolutional neural network model O to obtain the optimal convolutional neural network. Otherwise, let t = t + 1, S t =S' t , F t =F t ', and from the parameter sample set S t Select F from t The top N parameter samples with the highest validation accuracy are used as the current population P. t and perform step (4b);

[0084] In this embodiment, the optimal convolutional neural network is obtained. Then, the training set of the CIFAR10 dataset is input into the optimal convolutional neural network. Iterative training was performed with p=200 iterations. The loss function was cross-entropy loss, and stochastic gradient descent was used for optimization. The learning rate was set to 0.01 for the first 80 iterations and 0.001 for the next 120 iterations. The results were then tested on a test set. In this embodiment of the invention, on the CIFAR10 test dataset, the optimized LeNet-5 achieved a 13.80% improvement in classification accuracy compared to the original LeNet-5.

[0085] In summary, because this invention uses a hybrid evolutionary algorithm with global surrogate assistance, a distribution estimation algorithm with local surrogate assistance, and a differential evolutionary algorithm with continuous surrogate assistance to optimize the structural parameters of the convolutional neural network, it can effectively optimize the structure of the convolutional neural network and thus improve the prediction accuracy of the convolutional neural network. The use of hybrid evolutionary operators can eliminate quantization errors and accuracy loss, and the use of surrogate models can save a lot of computational resources for training and validation as well as evaluation time.

[0086] The above description is a specific embodiment of the present invention and does not constitute any limitation on the present invention. It should be understood that, for those skilled in the art, after understanding the principles of the present invention, any improvements or modifications to the form, details, and parameters based on the above description should fall within the protection scope of the appended claims.

Claims

1. A method for optimizing the structure of a convolutional neural network based on a surrogate-assisted evolutionary algorithm, characterized in that, Includes the following steps: (1) Obtain the training sample set and the validation sample set: Obtain M images of category C, label the category of each image, and then combine V images and their corresponding labels to form a training image sample set D. train The remaining MV images and their corresponding labels form the verification image sample set D. val Where C≥2, M≥50000, V>M / 2; (2) Obtaining the structural parameters of the convolutional neural network: Obtain the structural parameters s of a convolutional neural network model O consisting of A convolutional layers, B pooling layers, and E fully connected layers. s includes continuous parameters x, which consist of the number of convolutional kernels in the A convolutional layers, the number of neurons in the first E-1 fully connected layers, and the random inactivation rate of neurons. It also includes discrete parameters z, which consist of the size of the convolutional kernels in the A convolutional layers, the type of activation function used, and the type of pooling function used in the B pooling layers. Here, A≥1, B≥1, E≥2, the number of parameters in x is L=A+2E-2, and the number of parameters in z is R=2A+B. (3) Initialize the parameter sample set and the validation accuracy set: Perform N random samplings on the structural parameter s, and set the resulting parameter sample set S1 = {s1, s2, ..., s...} n ,...,s N Each parameter sample s in} n The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples, and the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as s. n The corresponding verification accuracy f n Finally, the validation accuracy set F1 = {f1, f2, ..., f1} corresponding to the parameter sample set S1 is obtained. n ,...,f N }, where N≥100, s n Let f represent the nth parameter sample. n s n The corresponding validation accuracy is e≥10; (4) Optimize structural parameters based on surrogate-assisted evolutionary algorithm: (4a) Initialize the number of iterations to t, the maximum number of iterations to T, T≥200, the diversity threshold to τ, 0<τ<1, and the population to P. t And let t = 1, P1 = S1; (4b) Calculate the current population P t Diversity index R t And determine R t If τ is true, proceed to step (4c); otherwise, proceed to step (4d). (4c) A global proxy-assisted hybrid evolutionary algorithm is used to globally optimize the structural parameters s, and the optimized structural parameters are then used to optimize the structural parameters. The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. The corresponding validation accuracy f1 t Update the parameter sample set S' t and the corresponding validation accuracy set F t ', F t '=F t-1 ∪{f1 t }, and execute step (4e); (4d) A local surrogate-assisted distribution estimation algorithm is used to locally optimize the structural parameters s, and the optimized structural parameters are then used to perform local optimization. The structural parameters of the convolutional neural network model O are used to obtain the values ​​of the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. Corresponding verification accuracy And update the parameter sample set S' t and the corresponding validation accuracy set F t ', (4e) will be transferred from the current population P t The individual with the highest verification accuracy selected from among them and from the parameter sample set S t N selected cb The discrete parameters take values ​​of The samples constitute the sample parameter set Then determine N. cb If ≥5×L is true, proceed to step (4f); otherwise, proceed to step (4g). (4f) The continuous structure parameter x is optimized using a continuous surrogate-assisted differential evolution algorithm to obtain the optimized continuous structure parameter. combination and Received The structural parameters of convolutional neural network model O are used to obtain the convolutional neural network. Then the training image sample set D train As a convolutional neural network The input is used for e iterations of training, and then the validation image sample set D is used. val As a trained convolutional neural network The input is used to predict the category of the validation image samples. Finally, the ratio of the number of samples whose predicted category matches the true label to the total number of validation image samples (MV) is calculated as the result. Corresponding verification accuracy Update parameter sample set S' t and the corresponding validation accuracy set F t ', (4g) Determine whether t = T holds true. If so, output the parameter sample set S. T and the corresponding validation accuracy set F T And from S T Get F T The structural parameter s with the highest verification accuracy in China best ={x best ,z best } are used as structural parameters for the convolutional neural network model O, resulting in the optimal convolutional neural network O. sbest Otherwise, let t = t + 1, S t =S' t F t =F t ', and from the parameter sample set S t Select F from t The top N parameter samples with the highest validation accuracy are used as the current population P. t Then proceed to step (4b).

2. The convolutional neural network structure optimization method based on surrogate-assisted evolutionary algorithm according to claim 1, characterized in that, The current population P mentioned in step (4b) t Diversity index R t The calculation formula is as follows: Among them, DI t DI1 and DI2 represent the current population P, respectively. t The degree of diversity of the initial population P1, x nl Population P t The value of the l-th continuous parameter of the n-th individual. Population P t The average value of the l-th continuous parameter of all individuals in the dataset, z nr Population P t The value of the r-th discrete parameter of the nth individual, w r Population P t The mode of the r-th discrete parameter values ​​for all individuals. This represents the XOR operation.

3. The convolutional neural network structure optimization method based on surrogate-assisted evolutionary algorithm according to claim 1, characterized in that, The optimization of structural parameters s using a global proxy-assisted hybrid evolutionary algorithm described in step (4c) is implemented as follows: (4c1) Combine the parameter sample set and the validation accuracy set {S} t ,F t As input to the radial basis function network (RBF network), the weights and biases between the hidden and output layers are calculated using matrix least squares. This weighted and biased RBF network model is then used as a global proxy model. The formulas for calculating the radial basis functions and Gower distance used in the model are as follows: Where exp represents the exponential operation with base e to the natural constant, c k This represents the k-th center point of the hidden layer, σ represents the spread constant, which is twice the average distance between center points, and x l With z r Let them represent the l-th continuous parameter vector and the r-th discrete parameter vector, respectively. and Let cx and cx represent the upper and lower bounds of the l-th continuous parameter vector, respectively. l With cz r These represent the values ​​of the l-th continuous parameter and the r-th discrete parameter at the k-th center point of the hidden layer, respectively. (4c2) Initialize the number of iterations to w. g The maximum number of iterations is W. g Using the current population P t As the initial population NP for the algorithm, a global surrogate model is used to predict the fitness values ​​of all individuals in the population NP, where 30 ≤ W g ≤100, and let w g =1; (4c3) Differential mutation and crossover are performed on the continuous part of the individuals in the population NP to obtain the continuous part of the offspring population, and genetic crossover and mutation are performed on the discrete part to obtain the discrete part of the offspring population. The continuous part and the discrete part of the offspring population are combined to obtain the offspring population NP'. (4c4) Use the global surrogate model to predict the fitness values ​​of all individuals in the offspring population NP', compare the predicted fitness values ​​of the corresponding individuals in the population NP and the offspring population NP', and retain the individuals with the larger predicted fitness values ​​in NP; (4c5) Determine w g =W g If true, output the individual with the maximum fitness value in the population NP as the optimized structure parameter. Otherwise, let w g =w g +1, and execute step (4c3).

4. The method for optimizing the structure of a convolutional neural network based on a surrogate-assisted evolutionary algorithm according to claim 1, characterized in that, The optimization of structural parameters s using the local surrogate-assisted distribution estimation algorithm described in step (4d) is implemented as follows: (4d1) Calculate the parameter sample set S t Among all samples and the individual with the highest current validation accuracy Using the Euclidean distance, select the u samples with the smallest distance. The corresponding set of validation accuracy is Will As input to the radial basis function network, the weights and biases between the hidden and output layers of the radial basis function network are calculated using the matrix least squares method. The radial basis function network model with these weights and biases is then used as a local surrogate model. (4d2) From the current population P t Select the top N with high verification accuracy b The i-th parameter sample is selected as the best parameter sample, and the validation accuracy ratio α of the best parameter sample is calculated. i The calculation formula is as follows: Where f i Let be the validation accuracy corresponding to the i-th excellent parameter sample; (4d3) Construct a Gaussian distribution for the continuous parameter. The expected value and standard deviation of the Gaussian distribution for the l-th continuous parameter are μ, respectively. l and σ l The calculation formula is as follows: Where x nl This represents the value of the l-th continuous parameter in the nth excellent parameter sample; (4d4) Construct a histogram probability distribution for the discrete parameter, where the r-th dimension of the discrete parameter is in its set of values. The value of the middle is The probability is p rq The calculation formula is as follows: Where z nr This represents the value of the r-th discrete parameter in the nth excellent parameter sample, and ⊙ represents the XOR operation; (4d5) Random sampling of a Gaussian distribution yields N. s A continuous parameter sample set X new Discrete parameters select values ​​according to probability within a defined set of values, and the probability distribution of the sampled histogram is used to obtain N. s A discrete parameter sample set Z new Combination X new and Z new The samples at the corresponding positions in the middle are used to obtain N. s A new parameter sample set S new Predicting S using a local surrogate model new The validation accuracy of each sample is used to obtain the set of prediction validation accuracies. choose Structural parameters corresponding to the maximum prediction validation accuracy As optimized structural parameters.

5. The convolutional neural network structure optimization method based on surrogate-assisted evolutionary algorithm according to claim 1, characterized in that, The optimization of the continuous structure parameter x using the continuous surrogate-assisted differential evolution algorithm described in step (4f) is implemented as follows: (4f1) from A continuous parameter sample set is constructed by extracting the continuous parameter portion of each parameter sample. The corresponding set of validation accuracy is Will Input a Gaussian process regression model, maximize the marginal likelihood function to obtain the optimal hyperparameters of the model, and take the Gaussian process regression model with the optimal hyperparameters as the continuous surrogate model; (4f2) Initialize the number of iterations to w. l The maximum number of iterations is W. l Using continuous parameter sample sets As the initial population NX for the algorithm, a continuous surrogate model is used to predict the fitness value of each individual in the population NX, where 30 ≤ W l ≤100, and let w l =1; (4f3) Perform differential mutation and crossover on individuals in the population NX to obtain the offspring population NX'; (4f4) Use the continuous surrogate model to predict the fitness value of each individual in the offspring population NX', compare the predicted fitness values ​​of the corresponding individuals in the population NX and the offspring population NX', and retain the individuals with larger predicted fitness values ​​in NX; (4f5) Determine w l =W l If true, output the individual with the highest fitness value in the population NX. As the optimized continuous structure parameter, otherwise, let w l =w l +1, then proceed to step (4f3).

Citation Information

Patent Citations

  • A PSO-based method for directly determining weights of neural network structure optimization is presented

    CN109344961A

  • Deep neural network structure optimization method based on fusion of prediction mechanism and genetic algorithm

    CN110490320A

  • A Deep Neural Network Structure Optimization Method Based on the Fusion of Prediction Mechanism and Genetic Algorithm

    CN110490320B

  • Multi-objective optimization evolution calculation method of convolutional neural network agent model based on decomposition thought

    CN112633500A

  • Optimization method and application of particle swarm algorithm based on global and local agent assistance

    CN113283159A