Convolutional neural network structure search method based on genetic algorithm
Through the genetic algorithm-based method, the convolutional neural network structure is searched, and the optimized FlexCell unit and deep separable convolution technology is used to solve the problem of excessive parameters in the existing method, achieving more efficient image classification accuracy and lower hardware costs.
Patent Information
- Application Number
- CN202510016864.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2045-01-06
AI Technical Summary
When searching for convolutional neural network structures, existing neural network structure search methods focus on high performance but ignore network complexity, resulting in excessive amounts of network architecture parameters generated, increasing computing resources and time costs.
The convolutional neural network structure is searched by a genetic algorithm-based method. By introducing an optimized convolutional structure FlexCell unit, combining deep separable convolution technology and multi-scale design, the structure is used using three-dimensional coding space and improved genetic algorithms. optimization.
It achieves higher image classification accuracy with fewer parameters and time costs, reducing hardware costs in industrial deployments.
Smart Images

Figure CN119398140A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a convolutional neural network structure search method based on a genetic algorithm, and belongs to the technical field of image classification. Background Art
[0002] Convolutional neural network is a deep learning model designed specifically for processing grid-structured data (such as images and audio). It automatically extracts features from data through components such as convolutional layers, pooling layers, and fully connected layers. With its powerful feature extraction capabilities, convolutional neural network has become a key technology for processing spatially structured data such as images, and is widely used in image classification, object detection, image segmentation and other application fields.
[0003] Genetic algorithms have shown great potential in the field of neural network structure search. They automatically search for the optimal neural network structure by simulating the biological evolution process. Using the selection, crossover and mutation operations of genetic algorithms, different combinations of neural network architectures, including the number of layers, number of nodes, connection methods, etc., can be efficiently explored in a huge search space. This method reduces the blindness and complexity of manually designing neural network structures, can quickly find a network structure with better performance, and improve the accuracy and generalization ability of the model.
[0004] Neural network structure search algorithms based on evolutionary computation have made great progress in network architecture design and discovered many new architectures with high classification performance. However, many neural network structure search algorithms based on evolutionary algorithms prefer network classification performance, while ignoring the complexity of the network and generating network architectures with a large number of parameters. Xie et al. [L. Xie and A. Yuille, “Genetic cnn,” in 2017 IEEE International Conferenceon Computer Vision (ICCV), Conference Proceedings, pp. 1388–1397.] used an improved genetic algorithm to discover a network with a parameter size of 156M, achieving an accuracy of 92.9% on CIFAR-10. In order to discover high classification performance architectures of the network on datasets of different sizes, many NAS algorithms usually require multiple independent search processes. The strategy of multiple search processes further increases the cost of computing resources. For example, Sun et al. [Y. Sun, B.Xue, M. Zhang, and GG Yen, “Completely automated cnn architecture designbased on blocks,” IEEE Transactions on Neural Networks and Learning Systems, vol. 31, no. 4, pp. 1242–1254, 2020.] performed independent search processes for CIFAR-10 and CIFAR-100, requiring 35 and 40 GPU days, respectively.
[0005] Many studies on neural network architecture search use training methods to evaluate the performance of candidate networks. Therefore, the search process of these algorithms requires considerable computing resources and search time. For example, NASNet [B. Zoph, V.Vasudevan, J. Shlens, and QV Le, “Learning transferable architectures forscalable image recognition,” in 2018 IEEE / CVF Conference on Computer Vision and Pattern Recognition, Conference Proceedings, pp. 8697–8710.] used 500 GPUs to search on CIFAR-10 in 4 days, producing a network with test accuracy exceeding that of manually designed networks. Liu et al. [H. Liu, K. Simonyan, and Y. Yang, “Darts: Differentiable architecture search,” ArXiv, vol. abs / 1806.09055, 2018.] pointed out that it takes 7 days to find a network structure with excellent performance on CIFAR-10. Summary of the invention
[0006] Many current neural network structure search methods focus on searching for high-performance convolutional neural network structures when searching for convolutional neural network structures, and often produce network structures with a large number of parameters. In order to balance the number of convolutional neural network parameters and performance, thereby reducing the hardware cost required for convolutional neural networks in industrial deployment, the present invention provides a convolutional neural network structure search method based on a genetic algorithm, and the technical solution is as follows: The invention discloses an automatic search method for a neural network structure for image classification. The neural network comprises: an input layer, a plurality of convolution layers and a classification layer connected in sequence; the convolution layer comprises a plurality of optimizable convolution units FlexCell connected in sequence, each FlexCell unit is composed of a standard convolution and two depth-separable convolutions, the three convolutions receive the same input data, and perform convolution calculations respectively, and the calculation results are spliced to obtain the final output of the Flex-Cell; the contribution of each convolution kernel is determined by the weight coefficient α 1. α 2 and α 3. Control, α 1. α 2 and α The sum of 3 is 1; The method comprises: Step 1: Perform three-dimensional encoding on the internal structure of the convolutional layer. The encoding process includes: Encoding the topological structure of the convolutional layer to form an adjacency matrix, wherein the adjacency matrix is represented by a directed acyclic graph DAG, and each node in the DAG represents a FlexCell unit; The weights of the three convolution kernels in the FlexCell unit in each convolution layer are encoded to form a weight matrix, where the number of columns in the weight matrix is 3, representing the weight coefficients of the three convolution kernels, and the number of rows represents the number of FlexCell units in the corresponding convolution layer; The number of output channels of the FlexCell unit in each convolutional layer is encoded to form a channel number matrix, where the number of columns in the channel number matrix is 1, and the number of rows represents the number of FlexCell units in the corresponding convolutional layer; Step 2: Using a genetic algorithm to search the adjacency matrix, weight matrix and channel number matrix to obtain the optimal topological structure, weight coefficient and channel number.
[0007] Optionally, the process of using a genetic algorithm to construct a neural network includes: Step 1: Initialize the number of individuals in the population N, the number of iterations of population evolution G, the size of the convolutional layer Cell Sc, the number of convolutional layer Cells L, the mutation rate Mr, the crossover rate Cr, the crossover mutation type probability vector V and the candidate channel list Lc; Step 2: Randomly generate the first generation population P, which contains N individuals. Each individual is composed of L different convolutional layer cells connected in series, and each convolutional layer cell is composed of Sc different FlexCell units. Step 3: Set the current population iteration number g=1; Step 4: Complete the fitness calculation for each individual in the current population P, and keep the three individuals with the highest fitness as the elite E; Step 5: Perform mutation and crossover operations on each individual in the population P with mutation rate Mr, crossover rate Cr, and crossover mutation type probability vector V to generate new individuals. All newly generated individuals constitute the offspring population Q. Step 6: Execute the roulette algorithm on populations P and Q to select N-3 individuals; merge the selected N-3 individuals with the elite E as the new population P; the current iteration number of the population g=g+1; Step 7: Repeat steps 4 to 6 until g=G and then proceed to step 8; Step 8: Take the individual with the highest fitness in population P as the final searched convolutional neural network.
[0008] Optionally, the number of parameters in the FlexCell unit is: .
[0009] in, C in Indicates the number of input channels, C out Indicates the number of output channels of the FlexCell unit.
[0010] Optionally, the adjacency matrix satisfies: except for the last row, the remaining rows are not zero; except for the first column, the remaining columns are not zero.
[0011] The present invention provides an automatic search system for neural network structure for image classification, wherein the neural network comprises: an input layer, a plurality of convolution layers and a classification layer connected in sequence; the convolution layer comprises a plurality of optimizable convolution units FlexCell connected in sequence, each FlexCell unit is composed of a standard convolution and two depth-separable convolutions, the three convolutions receive the same input data, and perform convolution calculations respectively, and the final output of the Flex-Cell is obtained after the calculation results are spliced; the contribution of each convolution kernel is determined by the weight coefficient α 1. α 2 and α 3. Control, α 1. α 2 and α The sum of 3 is 1; The system comprises: an encoding module and a search module; The encoding module is configured to perform three-dimensional encoding on the internal structure of the convolutional layer, and the encoding process includes: Encoding the topological structure of the convolutional layer to form an adjacency matrix, wherein the adjacency matrix is represented by a directed acyclic graph DAG, and each node in the DAG represents a FlexCell unit; The weights of the three convolution kernels in the FlexCell unit in each convolution layer are encoded to form a weight matrix, where the number of columns in the weight matrix is 3, representing the weight coefficients of the three convolution kernels, and the number of rows represents the number of FlexCell units in the corresponding convolution layer; The number of output channels of the FlexCell unit in each convolutional layer is encoded to form a channel number matrix, where the number of columns in the channel number matrix is 1, and the number of rows represents the number of FlexCell units in the corresponding convolutional layer; The search module is configured to use a genetic algorithm to search the adjacency matrix, weight matrix and channel number matrix to obtain the optimal topological structure, weight coefficient and channel number.
[0012] Optionally, the search module includes: The initialization module is configured to initialize the number of individuals in the population N, the number of iterations of population evolution G, the size of the convolutional layer Cell Sc, the number of convolutional layer Cells L, the mutation rate Mr, the crossover rate Cr, the crossover mutation type probability vector V and the candidate channel list Lc; The initial population generation module is configured to randomly generate the first generation population P. The first generation population P contains N individuals, each of which is composed of L different convolutional layer Cells connected in series, and each convolutional layer Cell is composed of Sc different FlexCell units; the current population iteration number g=1; The fitness calculation module is configured to complete the fitness calculation of each individual in the current population P, and keep the three individuals with the highest fitness as the elite E; The population update module is configured to execute the roulette algorithm on populations P and Q to select N-3 individuals; merge the selected N-3 individuals with the elite E as the new population P; the current iteration number of the population g=g+1; The output module is configured to: when the fitness calculation module and the population update module are repeatedly executed until g=G, output the individual with the highest fitness in the population P as the convolutional neural network finally searched out.
[0013] Optionally, the number of parameters in the FlexCell unit is: .
[0014] in, C in Indicates the number of input channels, C out Indicates the number of output channels of the FlexCell unit.
[0015] The present invention provides an image classification method, which uses a convolutional neural network to classify an input image, and the structure of the convolutional neural network is obtained using the automatic search method as described in any of the above items.
[0016] The present invention provides a neural network structure automatic search device for image classification, comprising a memory and a processor; The memory is used to store computer programs; The processor is used to implement the automatic search method for neural network structure for image classification as described in any of the above items when executing the computer program.
[0017] The present invention provides a computer-readable storage medium, characterized in that a computer program is stored on the storage medium, and when the computer program is executed by a processor, the automatic search method for a neural network structure for image classification as described in any of the above items is implemented.
[0018] The beneficial effects of the present invention are: The convolutional neural network automatic search method of the present invention introduces an optimizable convolution structure FlexCell unit, which uses deep separable convolution technology and multi-scale design. Through corresponding weight parameters, a variety of convolution structures can be generated to fully extract the features of input data, thereby improving the performance of the convolutional neural network; the present invention designs a three-dimensional coding space and combines FlexCell to generate a variety of candidate convolutional neural network structures, and uses an improved two-stage genetic algorithm and a cross-compilation operator to search for the optimal convolutional neural network structure.
[0019] Experimental data proves that the search method of the present invention can achieve higher image classification accuracy with fewer parameters and less time cost by obtaining the optimal structure of the neural network compared with the existing search methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 This is a structural diagram of the optimizable convolution unit FlexCell provided in Example 2 of the present invention.
[0022] Figure 2 A schematic diagram of a three-dimensional encoding method provided in Embodiment 2 of the present invention.
[0023] Figure 3 A schematic diagram of a variation operation provided in Embodiment 2 of the present invention.
[0024] Figure 4 A schematic diagram of a crossover operation provided in Embodiment 2 of the present invention.
[0025] Figure 5 This is an overall diagram of the convolutional network structure provided in Example 2 of the present invention.
[0026] Figure 6 This is a schematic diagram of individual coding provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0027] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0028] Embodiment 1: This embodiment provides a method for automatically searching for a neural network structure for image classification. The neural network includes: an input layer, a plurality of convolutional layers, and a classification layer connected in sequence; the convolutional layer includes a plurality of optimizable convolutional units FlexCell connected in sequence, each FlexCell unit is composed of a standard convolution and two depth-separable convolutions, the three convolutions receive the same input data, and perform convolution calculations respectively, and the calculation results are spliced to obtain the final output of the Flex-Cell; the contribution of each convolution kernel is represented by a weight coefficient α 1. α 2 and α 3. Control, α 1. α 2 and α The sum of 3 is 1; The method of this embodiment includes: Step 1: Encode the internal structure of the convolutional layer in three dimensions. The encoding process includes: The topological structure of the convolutional layer is encoded to form an adjacency matrix, which is represented by a directed acyclic graph DAG. Each node in the DAG represents a FlexCell unit. The weights of the three convolution kernels in the FlexCell unit in each convolution layer are encoded to form a weight matrix. The number of columns in the weight matrix is 3, which represents the weight coefficients of the three convolution kernels, and the number of rows represents the number of FlexCell units in the corresponding convolution layer. The number of output channels of the FlexCell unit in each convolutional layer is encoded to form a channel number matrix. The number of columns in the channel number matrix is 1, and the number of rows represents the number of FlexCell units in the corresponding convolutional layer. Step 2: Use genetic algorithm to search the adjacency matrix, weight matrix and channel number matrix to obtain the optimal topological structure, weight coefficient and channel number.
[0029] This embodiment introduces an optimizable convolution structure FlexCell unit, which uses deep separable convolution technology and multi-scale design. Through corresponding weight parameters, a variety of convolution structures can be generated to fully extract the features of input data, thereby improving the performance of the convolutional neural network. The present invention designs a three-dimensional coding space and combines FlexCell to generate a variety of candidate convolutional neural network structures, and uses genetic algorithms and cross-compilation operators to search for the optimal convolutional neural network structure.
[0030] The optimal structure of the neural network obtained by the search method of this embodiment can achieve higher image classification accuracy with fewer parameters and less time cost.
[0031] Embodiment 2: This embodiment provides an image classification method based on a neural network. The structure of the neural network is as follows: Figure 6 As shown in the figure, it consists of a Previous Layer, a group of Cells and a Classify Layer. The Previous Layer is added to the head of the neural network to extract the input image feature information. Cell is the backbone of the network, which thoroughly learns the image features. The Classify Layer is added at the end of the network to classify the features generated by the Cell. The structure of the Previous Layer and the Classify Layer in the network is fixed, and the structure of the Cell is continuously optimized during the search process. Each Cell is composed of FlexCell cells with different topological structures.
[0032] The structure of FlexCell is as follows Figure 1 As shown in Figure 1, it consists of three convolution kernels of different sizes, including a standard convolution with a kernel size of 1×1, a depth-wise separable convolution with a kernel size of 3×3, and a depth-wise separable convolution with a kernel size of 5×5. The contribution of different convolution kernels is determined by the weight coefficients α 1. α 2 and α 3. Control, α 1. α 2 and α The sum of 3 is 1.
[0033] The three convolution kernels of Flex-Cell receive the same input data and perform convolution calculations separately. Therefore, three groups of channels are generated. α 1.C. α 2. C and α 3. Output of C. The outputs generated by different convolution kernels are operated in parallel, and then pass through the batch normalization (BN) layer and the rectified linear unit (ReLU) activation function to obtain the final output of Flex-Cell.
[0034] The multi-core design of FlexCell helps improve the ability to extract features of different scales. The weight coefficients of convolution kernels of different sizes enable FlexCell to learn and capture features from data more flexibly. Adjusting the weight distribution of different convolution kernels can make FlexCell more efficient in utilizing the network capacity. Then, the output flexible cell extracts and compresses the input information of multi-scale features. Feature information of different scales is integrated through a series operation. The expression and generalization performance of the network are improved. Using depthwise separable convolution instead of ordinary convolution further reduces the number of parameters in FlexCell. When α 1. α 2 and α 3 are all greater than 0, the number of Flex-Cell parameters can be calculated as: .
[0035] in, C in Indicates the number of input channels, C out Indicates the number of output channels from FlexCell. In the above formula, the parameter of FlexCell is C in × C out + 34 × C in , not affected α 1. α 2 and α 3. In the process of optimizing the weight coefficients, the FlexCell structure is kept relatively compact.
[0036] This embodiment designs a three-dimensional encoding strategy based on FlexCell to construct a convolutional neural network structure. The three-dimensional encoding includes adjacency matrix encoding (AME), weight encoding (WE) and channel encoding (CE). AME determines the topological structure of different FlexCells, WE controls the distribution of different weights in FlexCell, and CE determines the number of channels in different cells.
[0037] In AME, the adjacency matrix is used to encode the topological structure of the Cell, which is represented by a directed acyclic graph (DAG). Each node in the DAG represents a Flex-Cell. Figure 2 The AME in Figure 4 shows a possible structure of a Cell composed of five FlexCells. Figure 2 The lower left corner of AME is set to zero to ensure the unidirectional flow of information within the cell. The value of the diagonal area is also set to 0, which means that a self-loop is not allowed in the cell. In order to ensure that there are no hanging nodes in the DAG, two principles need to be met in AME: First, all rows except the last one cannot be zero.
[0038] Second, except for the first column, the remaining columns cannot be zero.
[0039] The first principle ensures that the out-degree of all nodes except the last node is greater than zero. The second principle ensures that the in-degree of all nodes except the first node is greater than zero. These two principles together ensure that the structure of the Cell determined by AME is valid.
[0040] In WE, a matrix is encoded for the weight distribution of FlexCell in Cell. The number of columns in WE is 3, indicating the weight coefficients of three convolution kernels. The number of rows in WE indicates the number of Flex-Cells in the corresponding Cell. Figure 2 The WE in the Flex-Cell determines the α 1. α 2 and α 3. If the coefficient α If the value of is 0, there is no convolution kernel of the corresponding size in FlexCell.
[0041] CE is encoded by a constant C, which determines the number of output channels of all FlexCells in the corresponding Cell. Figure 2 In , the number of output channels of all FlexCells is set to C. Each Cell code needs to be continuously optimized during the search process.
[0042] For by k A network consisting of Cells, using k Group AME, WE and CE to control k The topological structure and weight distribution of different FlexCells in each unit. Different encoding schemes will affect the structure and performance of the convolutional neural network. Figure 4 An example of encoding a single network consisting of three cells is shown. Figure 4 In the figure, each Cell is composed of AME, WE and CE. Different colors in each Cell indicate that the AME, WE and CE of each Cell are different. If a Cell is composed of 5 FlexCells, AME is a matrix with a shape of (5,5), WE is a matrix with a shape of (5,3), and CE is a constant. The encoding of these three cells forms the individual encoding of the convolutional neural network structure.
[0043] Figure 5 It shows that the structure of a convolutional neural network consists of a Previous Layer, a group of Cells, and a Classify Layer. The Previous Layer is added to the head of the neural network to extract the input image feature information. The Cell is the backbone of the network, which thoroughly learns the image features. The Classify Layer is added at the end of the network to classify the features generated by the Cell. The structure of the Previous Layer and the Classify Layer in the network is fixed, and the structure of the Cell is continuously optimized during the search process. Each Cell is composed of FlexCell cells with different topological structures.
[0044] The neural network structure search process based on the genetic algorithm in this embodiment includes the following steps: Step 1: Initialize the number of individuals in the population N, the number of population evolution iterations G, the size of the Cell Sc, the number of Cells L, the mutation rate Mr, the crossover rate Cr, the crossover and mutation vector V (including the probability vector V1 of the first-stage crossover and mutation type and the probability vector V2 of the second-stage crossover and mutation type), and the candidate channel list Lc; the value of the crossover and mutation vector V will be set to V1 or V2 according to the current population iteration number. When the current iteration number g ≤ G / 2, V = V1, and when the current iteration number g > G / 2, V = V2.
[0045] Step 2: Randomly generate the first-generation population P according to the parameters N, Sc, L, and Lc. The first-generation population contains N individuals, and each individual is composed of L different Cells connected in series. Each Cell is composed of Sc different FlexCells. For any Cell, there is a corresponding adjacency matrix of dimension (Sc, Sc) representing a directed acyclic graph, which is used to represent the connection method of different FlexCells within the Cell.
[0046] Step 3: Let the current population iteration number g = 1 and V = V1.
[0047] Step 4: Use the ZenScore proxy function to complete the fitness calculation of each individual in the current population P, and keep the 3 individuals with the highest fitness as the elite E.
[0048] Step 5: Perform mutation and crossover operations on each individual in the population P with probabilities of Mr, Cr, and V (including the probability vector V1 of the first-stage crossover and mutation type and the probability vector V2 of the second-stage crossover and mutation type) to generate new individuals, and all the newly generated individuals form the offspring population Q.
[0049] Step 5.1: For the current individual I, a random number mr is generated from 0 to 1. When mr < Mr, the individual I will perform the corresponding mutation operation and enter Step 5.1.1.
[0050] Step 5.1.1: Select the mutation type mo according to the probability V.
[0051] Step 5.1.2: Randomly generate the position serial number Pos according to the individual length L.
[0052] If mo is the adjacency matrix encoding, randomly generate a new adjacency matrix encoding ame' to replace the adjacency matrix encoding of the Pos-th Cell of the individual I; if mo is the weight encoding, randomly generate a new weight encoding we' to replace the weight encoding of the Pos-th Cell of the individual I; if mo is the channel encoding, randomly generate a new channel encoding ce' to replace the channel encoding of the Pos-th Cell of the individual I.
[0053] Step 5.1.3: After replacement coding, put the newly generated individual I' into population Q.
[0054] Step 5.2: For the current individual I, a random number cr is generated from 0 - 1. When cr < Cr, the individual I will perform the corresponding crossover operation and enter Step 5.2.1.
[0055] Step 5.2.1: Randomly select an individual IC from population Q to perform a crossover operation with I.
[0056] Step 5.2.2: Select the crossover operation type co from probability V.
[0057] Step 5.2.3: Randomly generate the position serial number Pos according to the individual length L. If co is the adjacency matrix coding type, exchange the adjacency matrix coding of the Pos-th Cell of individuals I and IC; if co is the weight coding type, exchange the weight coding of the Pos-th Cell of individuals I and IC; if co is the channel coding type, exchange the channel coding of the Pos-th Cell of individuals I and IC.
[0058] Step 5.2.4: After exchange coding, put the newly generated individuals I' and IC' into population Q.
[0059] Step 6: Populations P and Q perform the roulette wheel algorithm to select N - 3 individuals. Combine the selected N - 3 individuals with the elite E as population P; the current iteration number g of the population is g = g + 1. If g > G / 2, then V = V2.
[0060] Step 7: Repeat Steps 4 to 6 until g = G, then enter Step 8.
[0061] Step 8: Take the individual with the highest fitness in P as the finally searched convolutional neural network.
[0062] This embodiment introduces an optimizable convolutional structure, the FlexCell unit. This structure uses depthwise separable convolution technology and multi-scale design. Through the corresponding weight parameters, diverse convolutional structures can be generated to fully extract the features of the input data, thereby improving the performance of the convolutional neural network. This embodiment uses the Zen-Score surrogate evaluation function to quantify the performance metrics of the model, which can quickly complete the performance evaluation of candidate convolutional neural networks during the search process. This embodiment designs a three-dimensional coding space and combines it with FlexCell to generate diverse candidate convolutional neural network structures, and at the same time uses an improved two-stage genetic algorithm and cross-compilation operator to search for the optimal convolutional neural network structure.
[0063] Using the optimal structure of the neural network obtained by the search method of this embodiment, higher image classification accuracy can be achieved with fewer parameters and less time cost.
[0064] Embodiment three: This example uses a series of the most advanced artificially designed network structure algorithms and neural network structure search algorithms to compare and comprehensively evaluate the performance of the method of the present invention. The experimental results take into account the test accuracy, the size of the network structure parameters, and the number of GPU days required for the search process. The performance of each algorithm on a specific data set is shown in Table 1 below: Table 1 Performance of each algorithm on a specific dataset
[0065] In Table 1, the neural network structure FC-NAS (Sd = 1, Sw = 2) obtained by the genetic algorithm search of the present invention has a test accuracy of 96.96% on CIFAR-10 and a parameter size of 1.0197M. Compared with DenseNet (k = 24), DenseNetB (k = 40) and Wide ResNet, FC-NAS achieves higher test accuracy with a smaller parameter size. Compared with ResNet, FC-NAS has a test accuracy of 3.37% higher and a parameter size of 0.7M smaller.
[0066] On CIFAR-100, the parameter size of the neural network structure FC-NAS (Sd = 3, Sw = 2) obtained by the genetic algorithm search of the present invention is 1.4843M, and the test accuracy is 82.17%. Compared with DenseNet (k = 24) and wide eResNet, FC-NAS achieves higher test accuracy at a smaller parameter size. Compared with DenseNet-B (k = 40), FCNAS has lower test accuracy. However, DenseNet-B only achieves a slight improvement of 0.65% with 40 times more parameters than FC-NAS, which shows that FC-NAS with fewer parameters has better classification performance.
[0067] On CIFAR-10, FC-NAS outperforms NAS-RL, MetaQNN, and EAS in terms of test accuracy, and has a fairly small parameter size, while significantly reducing the search time cost. DARTS and a series of improved algorithms, including P-DARTS, PC-DARTS, and SP-DARTS, can usually achieve more than 97% test accuracy, consuming more than 3M parameters. Compared with these algorithms, FC-NAS consumes fewer parameters and search time costs, while slightly lower test accuracy. Compared with FPSO, FC-NAS has a 3.24% improvement in test accuracy and a 0.3M increase in parameter size. FC-NAS has a slightly higher test accuracy than CNN-GA and SaMuNet, while FC-NAS has a smaller parameter size and requires a lower search time cost. Compared with LoNAS and EPCNAS-C, FC-NAS has a slight advantage in test accuracy. However, the parameter size of FC-NAS is 2 times smaller than that of Lo-NAS, and FC-NAS is 100 times faster than EPCNAS-C. On CIFAR-100, except for EPCNASC, FC-NAS generally has advantages in test accuracy, parameter size, and search time cost. The detection accuracy of FC-NAS is 9.31% and 2.82% higher than MetaQNN and Block-QNN-S, respectively.
[0068] In summary, on CIFAR-10 and CIFAR-100, the neural network structure FC-NAS obtained by the present invention based on the genetic algorithm search achieves higher test accuracy with fewer parameters than most artificially designed network architectures.
[0069] Some steps in the embodiments of the present invention may be implemented using software, and the corresponding software program may be stored in a readable storage medium, such as a CD or a hard disk.
[0070] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for automatically searching for a neural network structure for image classification, characterized in that: The neural network includes: an input layer, several convolution layers and a classification layer connected in sequence; the convolution layer includes several optimizable convolution units FlexCell connected in sequence, each FlexCell unit is composed of a standard convolution and two depth-separable convolutions, the three convolutions receive the same input data, and perform convolution calculations respectively, and the calculation results are spliced to obtain the final output of the Flex-Cell; the contribution of each convolution kernel is determined by the weight coefficient α 1. α 2 and α 3. Control, α 1. α 2 and α The sum of 3 is 1; The method comprises: Step 1: Perform three-dimensional encoding on the internal structure of the convolutional layer. The encoding process includes: Encoding the topological structure of the convolutional layer to form an adjacency matrix, wherein the adjacency matrix is represented by a directed acyclic graph DAG, and each node in the DAG represents a FlexCell unit; The weights of the three convolution kernels in the FlexCell unit in each convolution layer are encoded to form a weight matrix, where the number of columns in the weight matrix is 3, representing the weight coefficients of the three convolution kernels, and the number of rows represents the number of FlexCell units in the corresponding convolution layer; The number of output channels of the FlexCell unit in each convolutional layer is encoded to form a channel number matrix, where the number of columns in the channel number matrix is 1, and the number of rows represents the number of FlexCell units in the corresponding convolutional layer; Step 2: Using a genetic algorithm to search the adjacency matrix, weight matrix and channel number matrix to obtain the optimal topological structure, weight coefficient and channel number.
2. The method for automatically searching for a neural network structure for image classification according to claim 1, characterized in that: The process of using genetic algorithm to construct neural network includes: Step 1: Initialize the number of individuals in the population N, the number of iterations of population evolution G, the size of the convolutional layer Cell Sc, the number of convolutional layer Cells L, the mutation rate Mr, the crossover rate Cr, the crossover mutation type probability vector V and the candidate channel list Lc; Step 2: Randomly generate the first generation population P, which contains N individuals. Each individual is composed of L different convolutional layer cells connected in series, and each convolutional layer cell is composed of Sc different FlexCell units. Step 3: Set the current population iteration number g=1; Step 4: Complete the fitness calculation for each individual in the current population P, and keep the three individuals with the highest fitness as the elite E; Step 5: Perform mutation and crossover operations on each individual in the population P with mutation rate Mr, crossover rate Cr, and crossover mutation type probability vector V to generate new individuals. All newly generated individuals constitute the offspring population Q. Step 6: Execute the roulette algorithm on populations P and Q to select N-3 individuals; merge the selected N-3 individuals with the elite E as the new population P; the current iteration number of the population g=g+1; Step 7: Repeat steps 4 to 6 until g=G and then proceed to step 8; Step 8: Take the individual with the highest fitness in population P as the final searched convolutional neural network.
3. The method for automatically searching for a neural network structure for image classification according to claim 1, characterized in that: The number of parameters in the FlexCell unit is: ; in, C in Indicates the number of input channels, C out Indicates the number of output channels of the FlexCell unit.
4. The method for automatically searching for a neural network structure for image classification according to claim 1, characterized in that: The adjacency matrix satisfies that: except for the last row, the remaining rows are not zero; except for the first column, the remaining columns are not zero.
5. A neural network structure automatic search system for image classification, characterized in that: The neural network includes: an input layer, several convolution layers and a classification layer connected in sequence; the convolution layer includes several optimizable convolution units FlexCell connected in sequence, each FlexCell unit is composed of a standard convolution and two depth-separable convolutions, the three convolutions receive the same input data, and perform convolution calculations respectively, and the calculation results are spliced to obtain the final output of the Flex-Cell; the contribution of each convolution kernel is determined by the weight coefficient α 1. α 2 and α 3. Control, α 1. α 2 and α The sum of 3 is 1; The system comprises: an encoding module and a search module; The encoding module is configured to perform three-dimensional encoding on the internal structure of the convolutional layer, and the encoding process includes: Encoding the topological structure of the convolutional layer to form an adjacency matrix, wherein the adjacency matrix is represented by a directed acyclic graph DAG, and each node in the DAG represents a FlexCell unit; The weights of the three convolution kernels in the FlexCell unit in each convolution layer are encoded to form a weight matrix, where the number of columns in the weight matrix is 3, representing the weight coefficients of the three convolution kernels, and the number of rows represents the number of FlexCell units in the corresponding convolution layer; The number of output channels of the FlexCell unit in each convolutional layer is encoded to form a channel number matrix, where the number of columns in the channel number matrix is 1, and the number of rows represents the number of FlexCell units in the corresponding convolutional layer; The search module is configured to use a genetic algorithm to search the adjacency matrix, weight matrix and channel number matrix to obtain the optimal topological structure, weight coefficient and channel number.
6. The automatic search system for neural network structure for image classification according to claim 5, characterized in that: The search module includes: The initialization module is configured to initialize the number of individuals in the population N, the number of iterations of population evolution G, the size of the convolutional layer Cell Sc, the number of convolutional layer Cells L, the mutation rate Mr, the crossover rate Cr, the crossover mutation type probability vector V and the candidate channel list Lc; The initial population generation module is configured to randomly generate the first generation population P. The first generation population P contains N individuals, each of which is composed of L different convolutional layer Cells connected in series, and each convolutional layer Cell is composed of Sc different FlexCell units; the current population iteration number g=1; The fitness calculation module is configured to complete the fitness calculation of each individual in the current population P, and keep the three individuals with the highest fitness as the elite E; The population update module is configured to execute the roulette algorithm on populations P and Q to select N-3 individuals; merge the selected N-3 individuals with the elite E as the new population P; the current iteration number of the population g=g+1; The output module is configured to: when the fitness calculation module and the population update module are repeatedly executed until g=G, output the individual with the highest fitness in the population P as the convolutional neural network finally searched out.
7. The automatic search system for neural network structure for image classification according to claim 5, characterized in that: The number of parameters in the FlexCell unit is: ; in, C in Indicates the number of input channels, C out Indicates the number of output channels of the FlexCell unit.
8. An image classification method, characterized in that: The method uses a convolutional neural network to classify the input image, and the structure of the convolutional neural network is obtained using the automatic search method described in any one of claims 1 to 4.
9. A neural network structure automatic search device for image classification, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is used to implement the automatic search method for neural network structure for image classification as described in any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for automatically searching for a neural network structure for image classification as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Neural network structure low-cost automatic search method for image classification
CN114299344A
Convolution and self-attention fused multi-target neural architecture search method
CN116258165A
Hyperspectral image classification method based on proxy-assisted multi-objective evolutionary neural architecture search
CN118658060A
Method and apparatus for optimizing an architecture search space and an architecture of a neural network
DE102022204864A1
Cited By
Neural network structure search method and system
WO2026145296A1