Rapid scoring pulse neural network architecture optimization method and system

Search the optimal branches sequence through multi -target optimization algorithm and adopt training methods to solve the time -dependence and sparseness of the existing technology of the medium pulse neural rosewood cutting and destruction of the existing technology. Reduce calculation overhead.

CN119378617APending Publication Date: 2025-01-28HOHAI UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411609139.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In the prior art, when using pulsed neural network pruning, structured pruning may destroy timing dependence and biological authenticity, while non-structured pruning will aggravate sparseness, affect pulse delivery efficiency, and be difficult to fully utilize in hardware. Sparseness, and pruning increases the complexity of gradient updates, affecting the training effect.

Method used

Search the optimal branches sequence through multi -target optimization algorithm, and transform the pre -trained SNN model's channel pruning problem into the search problem of the optimal pruning sequence. During the search process, the exemption method is used to quickly evaluate the sub -network performance. And customize the lightweight SNN model according to user needs.

Benefits of technology

Realize the performance of the pulse neural network architecture quickly in a short period of time. It can customize the lightweight SNN model according to the needs of the user, maintain the integrity of the network structure, adapt to the parallel computing and memory access mode of the existing hardware accelerator, and reduce unnecessary unnecessary unnecessary Calculate expenses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119378617A_ABST
    Figure CN119378617A_ABST
Patent Text Reader

Abstract

The invention discloses a fast scoring spiking neural network architecture optimization method and system, and the method comprises the steps: constructing a data set, and determining a multi-objective optimization equation; initializing a population, and obtaining a sub-network structure score through a training-free method; performing non-dominated sorting and crowding degree calculation, and selecting a tournament; performing selection, crossover and mutation operation; and training the optimal sub-network again. According to the method, the optimal channel pruning structure of the pre-trained spiking neural network can be quickly identified, the optimal pruning SNN model is obtained on the premise of ensuring the minimum precision loss, and the lightweight SNN model can be customized according to user requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of pulse neural networks, and in particular relates to a method and system for optimizing a pulse neural network architecture that does not require training. Background Art

[0002] Spiking Neural Networks (SNNs) is a neural network model that mimics the activity of brain neurons. Unlike traditional artificial neural networks, it transmits information through discrete pulses. SNN neurons only emit pulses when their membrane potential exceeds a certain threshold, which is similar to the working principle of biological neurons and is therefore closer to the biological behavior of the brain. SNNs have the characteristics of sparseness and time encoding, which can process timing information more efficiently. At the same time, due to its event-driven computing method, it has the potential for energy saving and is particularly suitable for low-power embedded systems and neuromorphic computing.

[0003] Neural network model pruning algorithm is an important technology in the field of deep learning. It aims to simplify and compress the network by removing unnecessary connections or parameters in the neural network, thereby improving the efficiency and performance of the model. With the widespread application of deep learning models in various application fields, the scale of the model continues to increase, resulting in a large number of model parameters and huge computational and storage overhead. Pruning can be divided into unstructured pruning and structured pruning. Unstructured pruning is based on the size of the parameters, that is, directly pruning parameters less than a certain threshold without considering the overall structure of the network. Unstructured pruning mainly targets every parameter in the neural network. Structured pruning is based on the structure of the network. That is, the pruned network still maintains the same structure as the original network, but some of the connections or parameters are pruned. Structured pruning mainly targets some structures in the entire neural network, such as the entire neuron, a whole layer of connections, etc.

[0004] Although the current research has used the above method to obtain an ANN with better pruning effect, the above method still has significant disadvantages when applied to spiking neural networks: structured pruning may destroy the timing dependence and biological authenticity of SNN, and although unstructured pruning reduces network parameters, it will increase sparsity and affect the efficiency of pulse transmission, and current hardware is difficult to fully utilize this sparsity. Pruning may also increase the complexity of gradient updates, affect training results, and weaken the network's sensitivity to temporal information, reducing reasoning efficiency. In general, there is no universal and efficient SNN pruning method today. Summary of the invention

[0005] Most existing methods use inner loop training to evaluate the performance of each architecture when using genetic algorithms to search for pruning sequences. This method is not only time-consuming, but also the results obtained are relatively poor. In response to this technical problem, the purpose of the present invention is to provide an efficient pulse neural network pruning method, which converts the channel pruning problem of a pre-trained SNN model into a search problem for an optimal pruning sequence, searches for the optimal pruning sequence through a multi-objective optimization algorithm, uses a training-free method in the search process, quickly evaluates the performance of the sub-network in a short time, and can customize a lightweight SNN model according to user needs.

[0006] In a first aspect, the present invention discloses a method for optimizing a pulse neural network architecture for fast scoring, the method comprising the following steps:

[0007] S1, construct a data set T, and divide the data set T into a training set T according to a certain ratio train and the test set T test ;

[0008] S2, construct a pre-trained spiking neural network model N, and express the channel structure of the pre-trained SNN model N as C = (c 1 , c 2 , ..., c L ), where c j is the number of channels in the jth layer of the network; for the pruned SNN model N′, its channel structure is represented as C′=(c′ 1 , c′ 2 , ..., c′ L ), where c′ j ≤c j , c′ j Represents the number of channels in the jth layer of the pruned network;

[0009] S3, determine the multi-objective optimization equation (C′) * = argmax C acc(N′(C′, W′; T train );T test ), where the channel structure of the pruned model satisfies c′ j ∈{0.1c i , 0.2c i , ..., αc i}, α = 10%, 20%, ..., 100% is a given constant;

[0010] S4, converting the channel pruning problem of the pre-trained SNN model into a search problem for an optimal pruning sequence, and searching for the optimal pruning sequence through a multi-objective optimization algorithm; wherein, in the search process, a training-free method is used to obtain a sub-network structure score, and the sub-network structure score is used to reflect the accuracy values ​​of different sub-networks, and the sub-network with the highest score is used as the solution of the multi-objective optimization equation in step S3;

[0011] S5, get the optimal sub-network S according to the optimal pruning sequence best , for the optimal subnetwork S best Perform secondary training to obtain the trained optimal SNN pruning model.

[0012] In step S3, when the sub-network accuracy is maximized, the multi-objective optimization equation satisfies the following conditions: P channel (C′)≥T chann , P FLOP (C′)≥T FLOPs and P params (C′)≥T params ;

[0013] Where T chann , T FLOPs and T params They are the target channel pruning rate, target FLOPs pruning rate and target parameter pruning rate, respectively. chann (C′), P FLOPs (C′) and P params (C′) represents the channel pruning rate, FLOPs pruning rate, and parameter pruning rate, respectively;

[0014]

[0015]

[0016]

[0017] in Represents the total number of channels of the pre-trained model, represents the total number of channels of the pruned model, and the FlOPs of the i-th layer of the pre-trained network is F i , the FLOPs of the i-th layer of the network after pruning is F′ i , the number of parameters of the i-th layer of the pre-trained network is P i , the number of parameters of the i-th layer of the network after pruning is P i ′.

[0018] In step S4, the NSGA-II algorithm is selected to solve the optimization problem of the two conflicting objectives of channel pruning rate and pruning network performance, which specifically includes the following steps:

[0019] S41, perform population initialization operation and set the population size to P num , the dimension of the decision variable is D, the size of D is related to the number of layers to be pruned in the spiking neural network, then the initial population can be expressed as The i-th individual represents the value of the j-th decision variable of the ith individual;

[0020] S42, using a training-free method to calculate each individual The fitness value of

[0021] S43, perform crowding distribution and calculate each initialized individual The congestion level:

[0022]

[0023] Where M represents the number of objective functions, Represents an individual The value of the mth objective function;

[0024] S44, performing non-dominated sorting to obtain a non-dominated sorting result;

[0025] S45, in the selection phase, calculate the current population P t The crowding degree of each individual is summed up for non-dominated sorting, and the parent generation of the next generation population is selected by the competitive selection strategy according to the non-dominated sorting result; the elite retention selection strategy is to sequentially select and decompose from the sorted frontier to form a new selection population P t , until the number of selected solutions reaches the population size P num ;

[0026] S46, in the crossover stage, the parent individuals selected in step S45 have a certain crossover probability for crossover operation For the two individuals selected for crossover and have:

[0027]

[0028]

[0029] in and They are the t+1th generation individuals generated after crossover, and are the selected individuals of the tth generation, β qi is the uniform distribution factor, calculated as:

[0030]

[0031] where u i is a random number in [0, 1), η is the crossover distribution index;

[0032] S47, in the mutation stage, the individuals after crossover have a certain probability of mutation for mutation operation For individuals who choose to mutate have:

[0033]

[0034] in is the selected individual of generation t, yes The t+1th generation individual obtained after mutation, p max and p min are the upper and lower bounds of the decision variables, δ t is an adjustment factor calculated as:

[0035]

[0036] where r k is a uniformly distributed random number, η m is the variation distribution index;

[0037] S48, after each round of iteration, the current population will add the newly generated individuals after crossover and mutation to obtain a temporary population; calculate the non-dominated sorting and crowding degree in the temporary population, and select the P with higher fitness num Individuals get a new population;

[0038] S49, determine whether the current number of iterations reaches It max , if it reaches max , then go to step S410; if it has not reached max , then return to step S46 to continue execution;

[0039] S410, select the individual with the best fitness in the Pareto front as the optimal subsequence, and obtain the optimal subnetwork S according to the optimal subsequence best , for the optimal subnetwork S best Perform secondary training to obtain the trained optimal SNN pruning model.

[0040] Step S42 further includes:

[0041] For the i-th output of the l-th layer in a neural network with rectified linear units Weighted input of layer l have:

[0042]

[0043]

[0044] Where n l-1 is the number of units in the l-1th layer, is the weight connecting the jth unit in the l-1th layer and the ith unit in the lth layer, is the bias term;

[0045] Introducing the binary indicator b i Indicates the active state of the i-th unit:

[0046]

[0047] when When b i =1, indicating active state; when When b i =0, indicating inactive state;

[0048] For a small batch of data Through the neural network mapping to f(x i ), the indicator variables from the rectified linear unit in f are in x i A binary code is formed at:

[0049] code(x i )=(b 1 , b 2 , ..., b n )

[0050] Using the Hamming distance d H (b i , b j ) to measure the similarity between two inputs, where the binary code b i and b j is generated by an untrained network on two inputs;

[0051] Calculate the Hamming distance between the binary codes of the mini-batch data to obtain a kernel matrix K H :

[0052]

[0053] The dimension of the kernel matrix is ​​N×N, N A is the number of rectified linear units;

[0054] Based on the determinant of the kernel matrix |K H The logarithmic score S = log | K H | to predict the final performance of the untrained network.

[0055] Step S44 further comprises:

[0056] Calculate the number of dominant solutions n for each solution i and the dominating solution set S i :

[0057]

[0058] S i ={x j |x i <x j}

[0059] Where P is the current population, 1(·) is an indicator function, which is 1 if the condition is true and 0 otherwise;

[0060] Calculate the non-dominated front F of the first layer 1 ={x i |n i = 0}, for each subsequent solution x in the non-dominated front i ∈F k , for its non-dominated solution x j ∈S i , update its dominant solution number n j =n j -1; if n j =0, then x j Classified as the next layer of non-dominated frontier F k+1 ; There are N in the kth non-dominated front k Individuals, represented by Where N k is the number of individuals on the frontier k; if a total of T non-dominated frontiers can be divided, the result of non-dominated sorting is

[0061] In a second aspect, the present invention discloses a fast scoring pulse neural network architecture optimization system, the pulse neural network architecture optimization system comprising:

[0062] The data set construction module is used to construct the data set T and divide the data set T into the training set T according to a certain ratio. train and the test set T test ;

[0063] The model building module is used to build a pre-trained pulse neural network model N, and the channel structure of the pre-trained SNN model N is represented as C = (c 1 , c 2 , ..., c L ), where c j is the number of channels in the jth layer of the network; for the pruned SNN model N′, its channel structure is represented as C′=(c′ 1 , c′2 , ..., c′ L ), where c′ j ≤c j , c′ j Represents the number of channels in the jth layer of the pruned network;

[0064] Multi-objective optimization equation building module, determine the multi-objective optimization equation (C′) * = argmax C acc(N′(C′, W′; T train );T test ), where the channel structure of the pruned model satisfies c′ j ∈{0.1c i , 0.2c i , ..., αc i}, α = 10%, 20%, ..., 100% is a given constant;

[0065] The optimal pruning sequence search module converts the channel pruning problem of the pre-trained SNN model into the optimal pruning sequence search problem, and searches for the optimal pruning sequence through a multi-objective optimization algorithm; wherein, in the search process, a training-free method is used to obtain the sub-network structure score, and the sub-network structure score is used to reflect the accuracy value of different sub-networks, and the sub-network with the highest score is used as the solution of the multi-objective optimization equation in step S3;

[0066] The optimal model training module obtains the optimal sub-network S according to the optimal pruning sequence best , for the optimal subnetwork S best Perform secondary training to obtain the trained optimal SNN pruning model.

[0067] Beneficial effects:

[0068] First, the fast scoring pulse neural network architecture optimization method and system of the present invention removes the entire convolution kernel or channel through channel pruning to maintain the integrity of the network structure, which enables the pruned SNN to better adapt to the parallel computing and memory access mode of existing hardware accelerators. Compared with unstructured pruning, channel pruning is easier to accelerate in hardware and reduces unnecessary computing overhead;

[0069] Second, the fast scoring pulse neural network architecture optimization method and system of the present invention adopts a training-free method, which can quickly determine the performance of each architecture in a very short time.

[0070] Third, the fast scoring pulse neural network architecture optimization method and system of the present invention maximizes the channel pruning rate and maximizes performance. These two goals are usually conflicting, that is, increasing the pruning rate will lead to performance degradation, while maintaining high performance requires retaining more channels, thereby reducing the pruning rate. Traditional single-objective optimization algorithms cannot take these two goals into account at the same time. The genetic algorithm in the present invention adopts the multi-objective optimization algorithm NSGA-II to obtain a Pareto solution between the pruned network performance and the pruning rate, and can find the optimal balance point between multiple conflicting goals. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 A flow chart of the fast scoring spiking neural network architecture optimization method of the present invention;

[0072] Figure 2 It is a diagram illustrating the training-free method of the present invention;

[0073] Figure 3 This is a partial result diagram of the pulse neural network pruning algorithm of the present invention. DETAILED DESCRIPTION

[0074] The following examples will enable those skilled in the art to more fully understand the present invention, but are not intended to limit the present invention in any way.

[0075] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0076] like Figure 1 As shown, the present invention discloses a fast scoring spiking neural network model pruning method, the input is a pre-trained SNN model, and the output is an optimal pruning model. The spiking neural network model pruning method mainly includes the following steps:

[0077] Step 1: Prepare a dataset for the image classification task, such as CIFAR-10, and divide the dataset into a training dataset T and a training dataset T according to an appropriate ratio. train And the test data set T test ,Preprocessing of these two datasets is a key step to improve model performance. Common preprocessing methods include normalizing image pixels (Normalize) to accelerate model convergence and converting images to tensor format (ToTensor) to enable efficient calculation on GPU.

[0078] For the training dataset T trainData augmentation is an important means to prevent model overfitting. By performing random cropping, random rotation, horizontal flipping, and vertical flipping operations on images, the diversity of training data can be increased. These augmentation methods help the model learn a wider range of features under different conditions and improve its generalization ability on unseen data.

[0079] Step 2: Use the classic error back propagation algorithm to train a pre-trained network with good representation, learning and generalization capabilities. Taking the VGG16 network as an example, the specific training steps are:

[0080] First, randomly initialize the weight parameters of N:

[0081] w t ~Random Initialization

[0082] For each training sample (x i ,y i )∈T train , calculate the prediction results of the sample:

[0083]

[0084] Calculate the loss between the predicted results and the actual labels of all training samples:

[0085]

[0086] Calculate the loss function L for the model parameters w t The gradient is:

[0087]

[0088] Update the model parameters using the gradient descent optimization algorithm:

[0089]

[0090] Repeat the above training steps until the model converges or reaches the predetermined number of training rounds.

[0091] Step 3: Construct the pruned network channel structure C′, and use C = (c 1 , c 2 , ..., c 16 ) is expressed as C′=(c′ 1 , c′ 2 , ..., c′ 16 ), where c′ i∈{0.1c i , 0.2c i , ..., αc i}, α = 10%, 20%, ..., 100% is a given constant.

[0092] Step 4: Determine the multi-objective optimization equation (C′) * = argmax C acc(N′(C′, W′; T train );T test ), while satisfying the maximum performance of the sub-network, it is also necessary to satisfy P chann (C′)≥T chann , P FLOPs (C′)≥T FLOPs and P params (C′)≥T params , where T channe , T FLOPs and T params They are the target channel pruning rate, target FLOPs pruning rate and target parameter pruning rate, respectively. channel (C′), P FLOPs (C′) and P params (C′) represents the channel pruning rate, FLOPs pruning rate and parameter pruning rate respectively.

[0093] Step 5: Select the NSGA-II algorithm to solve the optimization problem of the two conflicting objectives of channel pruning rate and pruning network performance. First, initialize the population, set the population size to 100, and the dimension of the decision variable to 16. Then the initial population can be expressed as The i-th individual represents the value of the j-th decision variable of the ith individual. Figure 3 This is the algorithm framework diagram of the VGG16 network structure using the training-free method and NSGA-II for channel pruning.

[0094] Step 6: Use the training-free method to calculate each individual In the training-free method, for the i-th output of the l-th layer in VGG16 Introducing the binary indicator b i represents the active state of the i-th unit,

[0095]

[0096] when When b i =1, indicating active state; when When b i =0, indicating inactive state.

[0097] For a mini-batch of data in CIFAR10 Through the neural network mapping to f(x i ), the indicator variables from the rectified linear unit in f are in x i A binary code code(x i )=(b 1 , b 2 , ..., b n ), using the Hamming distance d H (b i , b j ) to measure the similarity between two inputs.

[0098] Calculate the Hamming distance between the binary codes of the mini-batch data to obtain a kernel matrix K H

[0099]

[0100] The dimension of the kernel matrix is ​​N×N, N A is the number of rectified linear units. The specific description of the training-free method is as follows Figure 2 shown.

[0101] The fitness value of each individual in the initial population is

[0102] Step 7: Perform crowding distribution and calculate each initialized individual The congestion

[0103]

[0104] Where M represents the number of objective functions, Represents an individual The value of the mth objective function.

[0105] Step 8: Perform non-dominated sorting and calculate the number of dominated solutions n for each solution i and the dominating solution set S i

[0106]

[0107] S i ={x j |x i <x j}

[0108] Then calculate the non-dominated front F of the first layer 1 ={x i |n i= 0}, for each subsequent solution x in the non-dominated front i ∈F k , for its non-dominated solution x j ∈S i , update its dominant solution number n j =n j -1. If n j =0, then x j Classified as the next layer of non-dominated frontier F k+1 There are N k Individuals, represented by Where N k is the number of individuals on the frontier k. If there are T non-dominated frontiers in total, the result of non-dominated sorting is

[0109] Step 9: Selection phase, calculate the current population P t The crowding degree of each individual is summed up for non-dominated sorting, and the parent generation of the next generation population is selected by the competitive selection strategy based on the non-dominated sorting result. The elite retention selection strategy is to sequentially select decompositions from the sorted frontier to form a new selection population P t , until the number of selected solutions reaches the population size of 100.

[0110] Step 10: Crossover phase, the parent individuals selected in step 9 have a certain crossover probability for crossover operation For the two individuals selected for crossover and

[0111]

[0112]

[0113] in and They are the t+1th generation individuals generated after crossover, and are the selected individuals of the tth generation, β qi is the uniform distribution factor, calculated as:

[0114]

[0115] where u i is a random number in [0,1), and η is the crossover index, which is set to 10 in this method.

[0116] Step 11: Mutation stage, the individuals after crossover have a certain probability of mutation and perform mutation operation For individuals who choose to mutate

[0117]

[0118] in is the selected individual of generation t, yes The t+1th generation individual obtained after mutation, p max and p min are the upper and lower bounds of the decision variables, δ t is an adjustment factor calculated as:

[0119]

[0120] where r k is a uniformly distributed random number, η m is the variation distribution index, which is set to 20 in this method.

[0121] Step 12: After each iteration, the current population will be added with the newly generated individuals after crossover and mutation to obtain a temporary population. The non-dominated sorting and crowding degree are calculated in the temporary population, and 100 individuals with higher fitness are selected to obtain a new population.

[0122] Step 13: Determine whether the current number of iterations has reached 30. If so, proceed to step 14; if not, return to step 9 and continue execution.

[0123] Step 14: Select the individual with the best fitness in the Pareto front as the optimal subsequence, and obtain the optimal subnetwork S based on the optimal subsequence best , for S best Perform secondary training to obtain the trained optimal SNN pruning model.

[0124] Based on the same inventive concept, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the aforementioned fast-scoring-based pulse neural network architecture optimization method and system are implemented.

[0125] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the aforementioned fast-scoring-based pulse neural network architecture optimization method and system are implemented.

[0126] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD ROM, optical storage, etc.) containing computer-usable program code.

[0127] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0130] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A fast scoring spiking neural network architecture optimization method, characterized in that: The pulse neural network architecture optimization method comprises the following steps: S1, construct a data set T, and divide the data set T into a training set T according to a certain ratio train and the test set T test ; S2, construct a pre-trained spiking neural network model N, and express the channel structure of the pre-trained SNN model N as C = (c1, c2, ..., c L ), where c j is the number of channels in the jth layer of the network; for the pre-trained SNN sub-network model N′, its channel structure is represented as C′=(c′1,c′2,…,c′ L ), where c′ j ≤c j , c′ j ′ Represents the number of channels in the jth layer of the pruned network; S3, determine the multi-objective optimization equation (C′) * = argmax C acc(N′(C′,W′;T train );T test ), used to find the optimal sub-network structure, where the channel structure of the pruned model satisfies c′ j ∈{0.1c i ,0.2c i ,…,αc i }, α = 10%, 20%, ..., 100% are given constants; S4, converting the channel pruning problem of the pre-trained SNN model into a search problem for an optimal pruning sequence, and searching for the optimal pruning sequence through a multi-objective optimization algorithm; wherein, in the search process, a training-free method is used to obtain a sub-network structure score, and the sub-network structure score is used to reflect the accuracy values ​​of different sub-networks, and the sub-network with the highest score is used as the solution of the multi-objective optimization equation in step S3; S5, get the optimal sub-network S according to the optimal pruning sequence best , for the optimal subnetwork S best Perform secondary training to obtain the trained optimal SNN pruning model.

2. The fast scoring spiking neural network architecture optimization method according to claim 1, characterized in that: In step S3, when the sub-network accuracy is maximized, the multi-objective optimization equation satisfies the following conditions: P channel (C ′ )≥T chann , P FLOPs (C ′ )≥T FLOPs and P params (C ′ )≥T params ; Where T chann , T FLOPs and T params They are the target channel pruning rate, target FLOPs pruning rate and target parameter pruning rate, respectively. channel (C ′ ), P FLOPs (C ′ ) and P params (C ′ ) represent the channel pruning rate, FLOPs pruning rate and parameter pruning rate respectively; in Represents the total number of channels of the pre-trained model, represents the total number of channels of the pruned model, and the FlOPs of the i-th layer of the pre-trained network is F i , the FLOPs of the i-th layer of the network after pruning is F i ′ , the number of parameters of the i-th layer of the pre-trained network is P i , the number of parameters of the i-th layer of the network after pruning is P i ′ .

3. The fast scoring pulse neural network architecture optimization method according to claim 1, characterized in that: In step S4, the NSGA-II algorithm is selected to solve the optimization problem of the two conflicting objectives of channel pruning rate and pruning network performance, which specifically includes the following steps: S41, perform population initialization operation and set the population size to P num , the dimension of the decision variable is L, then the initial population is expressed as Each individual in the population represents a subnetwork structure, where the i-th individual represents the number of channels of the jth layer of the i-th individual; S42, using a training-free method to calculate each individual The fitness value of S43, perform crowding distribution and calculate each initialized individual The congestion level: Where M represents the number of objective functions, Represents an individual The value of the mth objective function; S44, performing non-dominated sorting to obtain a non-dominated sorting result; S45, in the selection phase, calculate the current population P t The crowding degree of each individual is summed up for non-dominated sorting, and the parent generation of the next generation population is selected by the competitive selection strategy according to the non-dominated sorting result; the elite retention selection strategy is to sequentially select and decompose from the sorted frontier to form a new selection population P t , until the number of selected solutions reaches the population size P num ; S46, in the crossover stage, the parent individuals selected in step S45 have a certain crossover probability for crossover operation For the two individuals selected for crossover and have: in and They are the t+1th generation individuals generated after crossover, and are the selected individuals of the tth generation, β qi is the uniform distribution factor, calculated as: where u i is a random number in [0,1), η is the crossover distribution index; S47, in the mutation stage, the individuals after crossover have a certain probability of mutation for mutation operation For individuals who choose to mutate have: in is the selected individual of generation t, yes The t+1th generation individual obtained after mutation, p max and p min are the upper and lower bounds of the decision variables, δ t is an adjustment factor calculated as: where r k is a uniformly distributed random number, η m is the variation distribution index; S48, after each round of iteration, the current population will add the newly generated individuals after crossover and mutation to obtain a temporary population; calculate the non-dominated sorting and crowding degree in the temporary population, and select the P with higher fitness num Individuals get a new population; S49, determine whether the current number of iterations reaches It max , if it reaches It max , then go to step S410; if it has not reached max , then return to step S46 to continue execution; S410, select the individual with the best fitness in the Pareto front as the optimal subsequence, and obtain the optimal subnetwork S according to the optimal subsequence best , for the optimal subnetwork S best Perform secondary training to obtain the trained optimal SNN pruning model.

4. The fast scoring pulse neural network architecture optimization method according to claim 3 is characterized in that: Step S42 further includes: For the i-th output of the l-th layer in a neural network with rectified linear units Weighted input of layer l have: where n l-1 is the number of units in the l-1th layer, is the weight connecting the jth unit in the l-1th layer and the ith unit in the lth layer, is the bias term; Introducing the binary indicator b i Indicates the active state of the i-th unit: when When b i =1, indicating active state; when When b i =0, indicating inactive state; For a small batch of data Through the neural network mapping to f(x i ), the indicator variables from the rectified linear unit in f are in x i A binary code is formed at: code(x i )=(b1,b2,…,b n ) Using the Hamming distance d H (b i ,b j ) to measure the similarity between two inputs, where the binary code b i and b j is generated by an untrained network on two inputs; Calculate the Hamming distance between the binary codes of the mini-batch data to obtain a kernel matrix K H : The dimension of the kernel matrix is ​​N×N, N A is the number of rectified linear units; Based on the determinant of the kernel matrix |K H The logarithmic score S = log | K H | to predict the final performance of the untrained network.

5. The fast scoring pulse neural network architecture optimization method according to claim 3 is characterized in that: Step S44 further comprises: Calculate the number of dominant solutions n for each solution i and the dominating solution set S i : S i ={x j |x i <x j } Where P is the current population, 1(·) is an indicator function, which is 1 if the condition is true and 0 otherwise; Calculate the non-dominated front F1 of the first layer = {x i |n i = 0}, for each subsequent solution x in the non-dominated front i ∈F k , for its non-dominated solution x i ∈S i , update its dominant solution number n j =n j –1; if n j =0, then x j Classified as the next layer of non-dominated frontier F k+1 ; There are N in the kth non-dominated front k Individuals, represented by Where N k is the number of individuals on the frontier k; if a total of T non-dominated frontiers can be divided, the result of non-dominated sorting is 6. A fast scoring spiking neural network architecture optimization system based on the method according to any one of claims 1 to 5, characterized in that: The pulse neural network architecture optimization system comprises: The data set construction module is used to construct the data set T and divide the data set T into the training set T according to a certain ratio. train and the test set T test ; The model building module is used to build a pre-trained pulse neural network model N, and the channel structure of the pre-trained SNN model N is represented as C = (c1, c2, ..., c L ), where c j is the number of channels in the jth layer of the network; for the pruned SNN model N′, its channel structure is represented as C′=(c′1,c′2,…,c′ L ), where c′ j ≤c j , c′ j Represents the number of channels in the jth layer of the pruned network; Multi-objective optimization equation building module, determine the multi-objective optimization equation (C′) * = argmax c acc(N′(C′,W′;T train );T test ), where the channel structure of the pruned model satisfies c′ j ∈{0.1c i ,0.2c i ,…,αc i }, α = 10%, 20%, ..., 100% are given constants; The optimal pruning sequence search module converts the channel pruning problem of the pre-trained SNN model into the optimal pruning sequence search problem, and searches for the optimal pruning sequence through a multi-objective optimization algorithm; wherein, in the search process, a training-free method is used to obtain the sub-network structure score, and the sub-network structure score is used to reflect the accuracy value of different sub-networks, and the sub-network with the highest score is used as the solution of the multi-objective optimization equation in step S3; The optimal model training module obtains the optimal sub-network S according to the optimal pruning sequence best , for the optimal subnetwork S best Perform secondary training to obtain the trained optimal SNN pruning model.

Citation Information

Cited By

  • Pruning method of image classification model, classification method, equipment and storage medium

    CN122551079A

  • Pruning method, classification method, device and storage medium of image classification model

    CN122551079B