Parameter quantization method and system of neural network

By using a fixed-point parameterization method for convolutional neural networks and optimizing the fixed-point encoding with a genetic algorithm, the problem of slow deployment speed of convolutional neural networks on FPGAs is solved, achieving improved deployment speed and hardware resource utilization while maintaining accuracy.

CN117131904BActive Publication Date: 2026-04-24BEIJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING UNIV OF POSTS & TELECOMM
Filing Date
2023-08-10
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing methods for fixed-point parameterization of convolutional neural networks still have room for improvement in deployment speed when deployed on field-programmable gate arrays (FPGAs), while maintaining deployment accuracy.

Method used

A genetic algorithm is used to perform fixed-point encoding of neural network parameters. By encoding the structure and parameter bit width combination of the neural network, the genetic algorithm is used to optimize the fixed-point encoding. Combined with the deployment of a prediction model, the fitness of individuals is calculated to determine the optimal fixed-point bit width.

Benefits of technology

While ensuring deployment accuracy, it significantly improved deployment speed and optimized the utilization of hardware resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117131904B_ABST
    Figure CN117131904B_ABST
Patent Text Reader

Abstract

The application discloses a parameter quantization method and system of a neural network, and relates to the technical field of neural network deployment. The method comprises the following steps: encoding the structure of the neural network to obtain network structure encoding; encoding each bit width combination of each preset parameter of the neural network to obtain parameter quantization encoding of each bit width combination; taking the parameter quantization encoding of each bit width combination and the network structure encoding as an individual in a population; based on the population, using a genetic algorithm to output optimized parameter quantization encoding; when calculating the fitness of each individual in the genetic algorithm, determining the fitness of each individual according to the accuracy and speed of predicting the network structure and the quantization bit width of the preset parameter of each individual deployed on an FPGA; and using the bit width of each preset parameter corresponding to the optimized parameter quantization encoding as the quantization bit width of each preset parameter of the neural network deployed on the FPGA. The deployment speed is improved while ensuring the deployment accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of neural network deployment technology, and in particular to a method and system for parameter localization of neural networks. Background Technology

[0002] Genetic Algorithms (GAs) are designed based on the evolutionary laws of organisms in nature. They are methods that search for optimal solutions by simulating the natural evolutionary process. The essence of a genetic algorithm is to analyze the genes on chromosomes and select chromosomes carrying those genes to solve the problem. When solving complex combinatorial optimization problems, genetic algorithms often achieve better optimization results faster than some conventional optimization algorithms. The advantage of genetic algorithms lies in their search for the optimal solution not from individual solutions, but from a set of solutions, resulting in excellent selection. Furthermore, the algorithm can be parallelized, processing multiple individuals, reducing computational load and compensating for the risk of getting trapped in local optima. In addition, genetic algorithms exhibit strong robustness.

[0003] In deep learning, Convolutional Neural Networks (CNNs) are a type of deep neural network. CNNs use a variant of the multilayer perceptron design, requiring minimal preprocessing. The basic module of a CNN consists of input and output layers and multiple hidden layers, which can be categorized as convolutional layers, pooling layers, ReLU layers, and fully connected layers. Compared to other image classification algorithms, CNNs use relatively little preprocessing; this independence from prior knowledge in feature design and human effort is a major advantage. They can be used for image and video recognition, recommendation systems, image classification, natural language processing, and more.

[0004] In convolutional neural networks (CNNs), data and parameters are frequently quantized to minimize bit width because floating-point computations are resource-intensive, especially on hardware. Converting floating-point numbers to fixed-point numbers can be considered a form of floating-point quantization. CNNs are insensitive to noise in the input data and weights, and the precision of the forward propagation of a CNN does not need to be 32-bit floating-point; fixed-point representation is sufficiently accurate. When deploying CNNs on hardware devices, as parameter precision gradually decreases, the utilization rate of various hardware resources also decreases, significantly improving the speed of model prediction.

[0005] Several parameter fixed-point methods based on convolutional neural networks have been proposed. Most of them directly specify the bit width of the fixed-point number. However, the acceleration effect of convolutional neural networks when deployed on field programmable gate arrays (FPGAs) still needs to be improved. Summary of the Invention

[0006] The purpose of this invention is to provide a method and system for fixed-point parameterization of neural networks, which improves deployment speed while ensuring deployment accuracy.

[0007] To achieve the above objectives, the present invention provides the following solution:

[0008] A method for fixed-point parameterization of a neural network, comprising:

[0009] The structure of a neural network is encoded to obtain the network structure code;

[0010] Each bit width combination of the preset parameters of the neural network is encoded separately to obtain the fixed-point encoding of the parameters for each bit width combination;

[0011] Initialize the genetic algorithm population: use the fixed-point encoding of the parameters of each bit-width combination and the network structure encoding as an individual in the population;

[0012] Based on the population, the genetic algorithm is used to output optimized fixed-point encoding of parameters; when calculating the fitness of each individual in the genetic algorithm, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA.

[0013] The bit width of each preset parameter corresponding to the optimized parameter fixed-point encoding is used as the fixed-point bit width of each preset parameter deployed on the FPGA of the neural network.

[0014] Optionally, it also includes inputting the network structure encoding and the parameter fixed-point encoding into the deployment prediction model, and outputting deployment accuracy and speed;

[0015] The deployment prediction model is obtained by training a fully connected neural network using a training set. The sample data in the training set includes input data and label data. The input data is sample encoded data, which includes the network structure encoding and parameter fixed-point encoding corresponding to the sample neural network. The label data is the accuracy and speed of the sample neural network deployed on the FPGA.

[0016] Optionally, when calculating the fitness of each individual, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA. Specifically, this includes:

[0017] The fitness of each individual is calculated using a fitness function, which is expressed as:

[0018]

[0019] Where Fitness(i) represents the fitness of the i-th individual, y i The cycle represents the accuracy of the network structure encoding and parameter fixed-point encoding corresponding to the i-th individual input to the output of the deployment prediction model. i e represents the speed at which the network structure encoding and the parameter fixed-point encoding corresponding to the i-th individual are input to the output of the deployment prediction model. i For y i The corresponding expected value, ranking() represents the ranking function.

[0020] Optionally, the selection operator in the selection operation of the genetic algorithm adopts a random traversal sampling method.

[0021] Optionally, the entire evolutionary stage of the optimized parameters output by the genetic algorithm can be divided into a first stage and a second stage.

[0022] In the first stage, the crossover operator used in the crossover operation is a uniform crossover operator, while in the second stage, the crossover operator used in the crossover operation is a single-point crossover operator.

[0023] Optionally, in the first stage, the mutation operator in the mutation operation is the inversion mutation operator, and in the second stage, the mutation operator in the mutation operation is the bit flip mutation operator.

[0024] Optionally, the formula for calculating the crossover probability in the crossover operation is expressed as:

[0025]

[0026] Among them, P c Let P be the crossover probability. c-org f is the initial crossover probability. avg f is the average fitness value of the entire population at present. max f is the maximum fitness value in the current population. min f' is the minimum fitness value in the current population, and f' is the fitness value of the contemporary crossover individual.

[0027] Optionally, the formula for calculating the mutation probability in the mutation operation is expressed as:

[0028]

[0029] Among them, P m Let P be the mutation probability. m-org f is the initial mutation probability. avg f is the average fitness value of the entire population at present. max f is the maximum fitness value in the current population. minf' represents the minimum fitness value in the current population, and f' represents the fitness value of the contemporary variant individual.

[0030] This invention discloses a fixed-point parameterization system for neural networks, comprising:

[0031] The network structure encoding module is used to encode the structure of the neural network to obtain the network structure code;

[0032] The parameter fixed-point encoding module is used to encode each bit width combination of each preset parameter of the neural network to obtain the parameter fixed-point encoding of each bit width combination.

[0033] The population initialization module is used to initialize the population of the genetic algorithm: the fixed-point encoding of the parameters of each bit-width combination and the network structure encoding are used as an individual in the population;

[0034] The parameter fixed-point encoding optimization module is used to output optimized parameter fixed-point encoding based on the population and the genetic algorithm. When calculating the fitness of each individual in the genetic algorithm, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA.

[0035] The fixed-point bit width determination module for each preset parameter is used to use the bit width of each preset parameter corresponding to the optimized parameter fixed-point encoding as the fixed-point bit width of each preset parameter deployed on the FPGA of the neural network.

[0036] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0037] This invention treats multiple bit-width combinations of preset parameters as individuals, calculates fitness based on the prediction accuracy and speed of the network deployed on the FPGA for each individual, and uses a genetic algorithm to output the bit width of each preset parameter corresponding to the optimal solution as the fixed bit width of each preset parameter of the neural network deployed on the FPGA, thereby improving deployment speed while ensuring deployment accuracy. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 A schematic flowchart of a method for parameter localization of a neural network provided in an embodiment of the present invention;

[0040] Figure 2 This is a schematic diagram of a fully connected neural network structure provided in an embodiment of the present invention;

[0041] Figure 3 This is a schematic diagram of the genetic algorithm flow provided in an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of the uniform cross principle provided in an embodiment of the present invention;

[0043] Figure 5 This is a schematic diagram of the single-point intersection principle provided in an embodiment of the present invention;

[0044] Figure 6 This is a schematic diagram illustrating the principle of inversion mutation provided in an embodiment of the present invention;

[0045] Figure 7 This is a schematic diagram illustrating the bit flip mutation principle provided in an embodiment of the present invention;

[0046] Figure 8 This is a schematic diagram of a neural network parameter fixed-point system structure provided in an embodiment of the present invention. Detailed Implementation

[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0048] The purpose of this invention is to provide a method and system for fixed-point parameterization of neural networks, which improves deployment speed while ensuring deployment accuracy.

[0049] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0050] Example 1

[0051] like Figure 1 As shown in the figure, an embodiment of the present invention provides a method for fixed-point parameterization of a neural network, which includes the following steps.

[0052] Step 101: Encode the structure of the neural network to obtain the network structure code.

[0053] Specifically, the neural network in step 101 is a convolutional neural network.

[0054] When encoding the network structure of a neural network, the method in Table 1 is followed, encoding the structure of each layer of the network sequentially, and then converting this encoding into Gray code, which is consistent with the parameter bit-width encoding method.

[0055] Table 1 Network Structure Coding Table

[0056] type kernel size coding Convolutional layer 3 0 Convolutional layer 5 1 Convolutional layer 7 2 Max pooling layer 3 3 Average pooling layer 3 4

[0057] Step 102: Encode each bit width combination of each preset parameter of the neural network to obtain the fixed-point encoding of the parameter for each bit width combination.

[0058] The simulation tool used for deploying neural networks on FPGAs is the High-Level Synthesis (HLS) tool in the FPGA field. The required fixed-point parameters (preset parameters) include the total binary bit width and the integer bit width. Therefore, both bit widths are encoded for each parameter that needs to be fixed-point quantized. Assuming a neural network has 10 parameters that need to be fixed-point quantized, each of these 10 parameters needs to be encoded. Furthermore, since the optimal fixed-point bit width for each parameter differs, this difference affects the final accuracy and the simulation speed on the HLS tool. Therefore, it is necessary to encode all possible combinations of fixed-point bit widths for each parameter.

[0059] Gray encoding is used during encoding. The n-bit Gray codeword is directly obtained from the corresponding n-bit binary codeword: For the n-bit binary codeword, number it from 0 to n-1 from right to left. If the i-th bit and the (i+1)-th bit of the binary codeword are the same, then the i-th bit of the corresponding Gray codeword is 0; otherwise, it is 1. The formula is expressed as:

[0060]

[0061] Among them, G i B represents the i-th Gray code. i B represents the i-th binary code. i+1 This represents the (i+1)th binary bit. Using Gray code for encoding can improve the local search capability of genetic algorithms.

[0062] Step 103: Initialize the population of the genetic algorithm: use the fixed-point encoding of the parameters of each bit-width combination and the network structure encoding as an individual in the population.

[0063] Step 104: Based on the population, the genetic algorithm is used to output the optimized parameter fixed-point encoding; when calculating the fitness of each individual in the genetic algorithm, the fitness of each individual is determined according to the accuracy and speed of deploying the network structure corresponding to each individual and the fixed-point bit width of the preset parameters onto the FPGA.

[0064] Step 105: Use the bit width of each preset parameter corresponding to the optimized parameter fixed-point encoding as the fixed-point bit width of each preset parameter deployed on the FPGA of the neural network.

[0065] This embodiment of a method for parameter localization of a neural network further includes: inputting the network structure encoding and the parameter localization encoding into a deployment prediction model, and outputting deployment accuracy and speed.

[0066] The deployment prediction model is obtained by training a fully connected neural network using a training set. The sample data in the training set includes input data and label data. The input data is sample encoded data, which includes the network structure encoding and parameter fixed-point encoding corresponding to the sample neural network. The label data is the accuracy and speed of the sample neural network deployed on the FPGA.

[0067] This embodiment uses a deployment prediction model to obtain the accuracy and speed of fixed-point encoding for each bit-width encoding case. For example... Figure 2 The fully connected neural network shown includes an input layer, two hidden layers (a first hidden layer and a second hidden layer), and an output layer. The fully connected neural network takes as input the neural network's structure encoding and the bit-width encoding of the required fixed-point parameters, and outputs the accuracy and the number of cycles (speed).

[0068] The ReLU activation function is used in the hidden layers. During training, this fully connected neural network uses the pre-defined fixed-point network structure and parameter encodings as training data, with the corresponding accuracy and speed as labels. After training, when faced with a new network structure and pre-defined parameter encodings, the accuracy and speed can be directly output, saving time.

[0069] In step 104, the process of using the genetic algorithm to output the optimized parameter fixed-point encoding is as follows: Figure 3 As shown.

[0070] Step 1041: Calculate fitness.

[0071] Since this embodiment predicts the bit width for fixed-point floating-point numbers, considering the factors of the number of cycles (i.e., speed) and accuracy deployed on the hardware, the fitness function is the reciprocal of the product of the square of the error between the predicted accuracy value and the expected value and the number of cycles, based on the accuracy and speed obtained from the deployment prediction model.

[0072] When calculating the fitness of each individual, the fitness of each individual is determined based on the accuracy and speed of deploying the network structure corresponding to each individual and the fixed-point bit width of the preset parameters onto the FPGA. Specifically, this includes: calculating the fitness of each individual using a fitness function, which is expressed as:

[0073]

[0074] Where Fitness(i) represents the fitness of the i-th individual, y i The cycle represents the accuracy of the network structure encoding and parameter fixed-point encoding corresponding to the i-th individual input to the output of the deployment prediction model. i e represents the speed at which the network structure encoding and the parameter fixed-point encoding corresponding to the i-th individual are input to the output of the deployment prediction model. i For y i The corresponding expected value is the expected accuracy and expected speed of the network structure and parameters corresponding to the i-th individual when deployed to the FPGA. ranking() represents the ranking function, where i takes the value 1-N and N represents the number of individuals in the population.

[0075] Step 1042: Select operation.

[0076] The selection operator in the genetic algorithm employs Stochastic Universal Sampling (SUS). This selection method prevents individuals from being selected excessively and repeatedly, thus avoiding the monopolization of the next generation by individuals with exceptionally high fitness. Therefore, it provides opportunities for individuals with lower fitness to be selected, thereby reducing unfairness. The top 20% of individuals with the highest fitness function in the encoded data are selected using this method and proceed to the next step.

[0077] The entire evolutionary process of the optimized parameters output by the genetic algorithm is divided into a first stage and a second stage. The first stage specifically consists of the first L / 2 iterations of the iterative process, and the second stage specifically consists of the last L / 2 iterations of the iterative process, where L represents the set number of iterations.

[0078] Step 1042: Cross operation.

[0079] The selected encoding from step 1042 is used for crossover. In the first stage (the beginning stage of evolution), the crossover operator used in the crossover operation is the uniform crossover operator. The schematic diagram of the uniform crossover operator is shown below. Figure 4 As shown, the reason is that this method involves more crossovers, and such a coarse search process helps maintain the diversity of the population.

[0080] In the second stage (the later stage of evolution), a meticulous search is required to prevent the optimal solution from being destroyed and to accelerate the convergence speed. Therefore, the crossover operator in the crossover operation adopts the single-point crossover operator. The principle of the single-point crossover operator is as follows: Figure 5 As shown, single-point crossover operations have the lowest probability of damaging superior individual traits and reducing individual fitness.

[0081] Since a fixed crossover probability can lead to poor diversity and weak search ability in the early stages of the optimization process, and difficulty in retaining excellent individuals in the later stages, it is modified to an adaptive crossover probability.

[0082] The formula for calculating the crossover probability (adaptive crossover probability) in the crossover operation is expressed as follows:

[0083]

[0084] Among them, P c Let P be the crossover probability. c-org f is the initial crossover probability. avg f is the average fitness value of the entire population at present. max f is the maximum fitness value in the current population. min f' is the minimum fitness value in the current population, f' is the fitness value of the contemporary crossover individual, and e represents the natural constant.

[0085] This step yields the encoded result after crossover.

[0086] Step 1043: Mutation operation. Mutate the crossover result obtained in step 1042.

[0087] In the first stage, the mutation operator used in the mutation operation is the inversion mutation operator. When inversion mutation is applied to chromosomes based on binary or integers, a random gene sequence is selected, and the gene order in the sequence is reversed, as illustrated in the diagram below. Figure 6 As shown, this allows for extensive searches while maintaining population diversity.

[0088] In the second stage, the mutation operator used in the mutation operation is the flip bit mutation operator. The mutated gene is randomly selected, and its value is flipped (complemented), as illustrated in the diagram below. Figure 7 As shown, this allows for a detailed search and prevents the optimal solution from being compromised.

[0089] Furthermore, performing multiple operations from broad search to detailed search ensures that the algorithm can guarantee both the comprehensiveness and accuracy of the search, and also quickly escape local optima, thus converging to the global optimum faster and better.

[0090] Simultaneously, the mutation probability is adaptively modified, and the formula for calculating the mutation probability in the mutation operation is expressed as:

[0091]

[0092] Among them, P m Let P be the mutation probability. m-org f is the initial mutation probability. avg f is the average fitness value of the entire population at present. max f is the maximum fitness value in the current population. min is the minimum fitness value in the current population, and f is the fitness value of the contemporary variant individual.

[0093] Step 1043 outputs the mutated encoding result.

[0094] This invention uses a genetic algorithm to determine the bit width of a floating-point to fixed-point conversion neural network for FPGA acceleration. Therefore, this is the first time a genetic algorithm neural network has been applied to the field of floating-point to fixed-point conversion, helping to accelerate the deployment of convolutional neural networks on hardware. It achieves the minimum bit width while maintaining a relatively constant neural network prediction accuracy, minimizing hardware resource utilization when the neural network is deployed on an FPGA, and simultaneously obtaining the optimal acceleration effect.

[0095] This invention proposes a fixed-point parameterization method for neural networks, specifically for determining the optimal fixed-point bit width when performing floating-point fixed-point conversion in convolutional neural networks. Compared to the common method of determining the bit width through trial and error, this method encodes the fixed-point bit width of the parameters to be fixed-point converted and the network structure as genes in a genetic algorithm. Then, it performs selection, crossover, and mutation operations to ultimately select the most suitable fixed-point bit width for each different parameter. This method provides the optimal floating-point fixed-point bit width when deploying convolutional neural networks on hardware, enabling optimal hardware acceleration. Furthermore, this invention improves the genetic algorithm for fixed-point conversion in neural networks. Generally, after each selection of the fixed-point bit width, accuracy needs to be obtained through training, which is time-consuming. Therefore, a neural network is designed to reduce the training process. The neural network takes the network structure and fixed bit width as input and outputs the accuracy and cycle count (i.e., speed). With this neural network, the accuracy and speed of a neural network with a new network structure and fixed bit width can be obtained directly without training, greatly reducing the time consumption.

[0096] Example 2

[0097] like Figure 8 As shown in the figure, this embodiment provides a parameter fixed-point system for a neural network, comprising:

[0098] The network structure encoding module 201 is used to encode the structure of the neural network to obtain the network structure encoding.

[0099] The parameter fixed-point encoding module 202 is used to encode each bit width combination of each preset parameter of the neural network to obtain the parameter fixed-point encoding of each bit width combination.

[0100] Population initialization module 203 is used to initialize the population of the genetic algorithm: the fixed-point encoding of the parameters of each bit-width combination and the network structure encoding are used as an individual in the population.

[0101] The parameter fixed-point encoding optimization module 204 is used to output the optimized parameter fixed-point encoding based on the population and the genetic algorithm. When calculating the fitness of each individual in the genetic algorithm, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA.

[0102] The fixed-point bit width determination module 205 for each preset parameter is used to use the bit width of each preset parameter corresponding to the optimized parameter fixed-point encoding as the fixed-point bit width of each preset parameter deployed on the FPGA of the neural network.

[0103] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0104] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for fixed-point parameterization of a neural network, characterized in that, include: The structure of a neural network is encoded to obtain the network structure code; The neural network is a convolutional neural network, which is used for image recognition. Each bit width combination of the preset parameters of the neural network is encoded separately to obtain the fixed-point encoding of the parameters for each bit width combination; the preset parameters include the total binary bit width and the integer bit width; Initialize the genetic algorithm population: use the fixed-point encoding of the parameters of each bit-width combination and the network structure encoding as an individual in the population; Based on the population, the genetic algorithm is used to output optimized fixed-point encoding of parameters; when calculating the fitness of each individual in the genetic algorithm, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA. When deploying a convolutional neural network on a hardware device, the bit width of each preset parameter corresponding to the optimized parameter fixed-point encoding is used as the fixed-point bit width of each preset parameter deployed on the FPGA. The method for fixed-point parameterization of the neural network further includes inputting the network structure encoding and the fixed-point parameter encoding into the deployment prediction model, and outputting the deployment accuracy and speed. The deployment prediction model is obtained by training a fully connected neural network using a training set. The sample data in the training set includes input data and label data. The input data is sample encoded data, which includes the network structure encoding and parameter fixed-point encoding corresponding to the sample neural network. The label data is the accuracy and speed of the sample neural network deployed on the FPGA. When calculating the fitness of each individual, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA. Specifically, this includes: The fitness of each individual is calculated using a fitness function, which is expressed as: ; in, Let represent the fitness of the i-th individual. This represents the accuracy of the network structure encoding and parameter fixed-point encoding corresponding to the i-th individual when input into the output of the deployment prediction model. This represents the speed at which the network structure encoding and the parameter fixed-point encoding corresponding to the i-th individual are input to the output of the deployment prediction model. for The corresponding expected value, This represents the ranking function.

2. The method for fixed-point parameterization of a neural network according to claim 1, characterized in that, The selection operator in the genetic algorithm is selected using a random traversal sampling method.

3. The method for fixed-point parameterization of a neural network according to claim 1, characterized in that, The entire evolutionary stage of the optimized parameters output by the genetic algorithm is divided into the first stage and the second stage. In the first stage, the crossover operator used in the crossover operation is a uniform crossover operator, while in the second stage, the crossover operator used in the crossover operation is a single-point crossover operator.

4. The method for fixed-point parameterization of a neural network according to claim 3, characterized in that, In the first stage, the mutation operator used in the mutation operation is the inversion mutation operator, and in the second stage, the mutation operator used in the mutation operation is the bit flip mutation operator.

5. The method for fixed-point parameterization of a neural network according to claim 3, characterized in that, The formula for calculating the crossover probability in the crossover operation is expressed as follows: ; in, For crossover probability, The initial crossover probability, This represents the average fitness value of the entire population at present. This represents the maximum fitness value in the current population. This is the minimum fitness value in the current population. This represents the fitness value of contemporary crossover individuals.

6. The method for fixed-point parameterization of a neural network according to claim 4, characterized in that, The formula for calculating the mutation probability in the mutation operation is expressed as follows: ; in, The mutation probability, The initial mutation probability, This represents the average fitness value of the entire population at present. This represents the maximum fitness value in the current population. This is the minimum fitness value in the current population. This represents the fitness value of the contemporary variant individual.

7. A parameter fixed-point system for a neural network, characterized in that, The parameter localization system of the neural network applies the parameter localization method of the neural network according to claim 1, and the parameter localization system of the neural network includes: The network structure encoding module is used to encode the structure of the neural network to obtain the network structure code; The parameter fixed-point encoding module is used to encode each bit width combination of the preset parameters of the neural network to obtain the parameter fixed-point encoding of each bit width combination; the preset parameters include the total binary bit width and the integer bit width; The population initialization module is used to initialize the population of the genetic algorithm: the fixed-point encoding of the parameters of each bit-width combination and the network structure encoding are used as an individual in the population; The parameter fixed-point encoding optimization module is used to output optimized parameter fixed-point encoding based on the population and the genetic algorithm. When calculating the fitness of each individual in the genetic algorithm, the fitness of each individual is determined based on the accuracy and speed of deploying the fixed-point bit width of the network structure corresponding to each individual and the preset parameters onto the FPGA. The fixed-point bit width determination module for each preset parameter is used to use the bit width of each preset parameter corresponding to the optimized parameter fixed-point encoding as the fixed-point bit width of each preset parameter deployed on the FPGA of the neural network.

Citation Information

Patent Citations

  • Neural network optimizing system and method based on genetic algorithms

    CN103593703A

  • FPGA implementation method of RBF plate shape recognition model

    CN110348131A