WO2021143686A1 - Neural network fixed point methods and apparatuses, electronic device, and readable storage medium - Google Patents
Neural network fixed point methods and apparatuses, electronic device, and readable storage medium Download PDFInfo
- Publication number
- WO2021143686A1 WO2021143686A1 PCT/CN2021/071311 CN2021071311W WO2021143686A1 WO 2021143686 A1 WO2021143686 A1 WO 2021143686A1 CN 2021071311 W CN2021071311 W CN 2021071311W WO 2021143686 A1 WO2021143686 A1 WO 2021143686A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- fixed
- point
- unit
- neural network
- output
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0495—Quantised networks; Sparse networks; Compressed networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Definitions
- This application relates to methods, devices, electronic equipment, and readable storage media for neural network targeting.
- Neural network fixed-point (also known as quantization) is a commonly used model acceleration algorithm, which quantizes the weight of the model and the output eigenvalue (the weight and the output eigenvalue are float type values) into fixed bits Numbers, such as 8bit, 16bit or very low 1, 2bit, can well solve the problems of complex multiplication and accumulation calculations and huge bandwidth caused by floating-point data on the hardware. The lower the number of quantized bits of the model, the more obvious the acceleration of the model on hardware.
- a certain number of sample pictures can be input to the original model at one time, the forward calculation of the model records the data distribution of the eigenvalues output by each layer, and then the eigenvalues output by each layer are calculated separately.
- the fixed-point super-parameters do not consider the impact of the fixed-pointing of the pre-layer on the post-layer, and the performance of the fixed-point neural network is low.
- this application provides a method, device, electronic device, and readable storage medium for neural network targeting.
- a neural network fixed-pointing method including: for the pending unit of the neural network, based on the situation that the fixed-pointing unit of the neural network maintains the fixed-pointing state, the pending-pointing method is provided The data distribution of the characteristic value output by the unit determines the fixed-point hyperparameter of the characteristic value output by the to-be-fixed unit; based on the fixed-point super-parameter, the characteristic value output by the to-be-fixed unit is fixed.
- a neural network fixed-pointing method including: for a neural network to-be-fixed unit, based on the situation that the fixed-pointing unit of the neural network maintains a fixed-point state, the pending point Optimizing the weights of the unit to be fixed with the characteristic value output by the quantization unit and the eigenvalue output by the unit to be fixed in the original floating-point state; and fix the optimized unit to be fixed.
- a neural network fixed-point method including: analyzing the topological structure of the input floating-point model to generate a neural network data flow graph; based on the sample picture information in the configuration file, Generate the data layer of the neural network; split and merge the topology of the neural network based on the optimization strategy of the platform to be deployed to obtain the preprocessed floating-point model; perform the preprocessing based on the above method
- the floating-point model is fixed-point.
- a neural network fixed-pointing device including: a determining module, used for a pending unit of the neural network, based on the situation that the fixed-pointed unit of the neural network maintains a fixed-pointing state Download the data distribution of the characteristic value output by the to-be-fixed unit to determine the fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit; the fixed-pointing module is used for the output of the to-be-fixed unit based on the fixed-pointing hyperparameter The characteristic value is fixed-point.
- a neural network fixed-pointing device including: an optimization module, which is used to maintain a fixed-pointing state for the fixed-pointing unit of the neural network based on the fixed-pointing unit of the neural network
- the eigenvalue output by the to-be-fixed unit and the eigenvalue output by the to-be-fixed unit in the original floating-point state optimize the weight of the to-be-fixed unit
- the fixed-point module is used to optimize the The to-be-fixed unit is fixed-pointed.
- a neural network fixed-pointing device including: an analysis module for analyzing the topological structure of an input floating-point model to generate a neural network data flow graph; a generation module, using Based on the sample picture information in the configuration file, the data layer of the neural network is generated; the processing module is used to split and merge the topology of the neural network based on the optimization strategy of the platform to be deployed to obtain preprocessing The latter floating-point model; a fixed-point module for fixed-pointing the pre-processed floating-point model based on the above method.
- an electronic device including a processor and a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and The processor is used to execute machine-executable instructions to implement the above-mentioned neural network fixed-point method.
- a machine-readable storage medium that stores machine-executable instructions in the machine-readable storage medium, and when the machine-executable instructions are executed by a processor, the above-mentioned neural network fixed point is realized ⁇ method.
- a computer program is provided, the computer program is stored in a machine-readable storage medium, and when the computer program is executed by a processor, the above neural network fixed-pointing method is realized.
- the technical solution provided in this application can at least bring about the following beneficial effects:
- For the to-be-fixed unit of the neural network the data distribution of the characteristic value output by the to-be-fixed unit based on the situation that the fixed-point unit of the neural network maintains the fixed-point state , Determine the fixed-point hyperparameter of the eigenvalue output by the to-be-fixed unit, and based on the fixed-point super-parameter, fix the eigenvalue output by the to-be-fixed unit, and perform unit-by-unit fixed-pointing on the neural network.
- the to-be-fixed unit of the neural network keeps the fixed-point unit in a fixed-point state to obtain a more realistic data distribution of the output characteristic value, thereby improving the performance of the neural network's fixed-pointing.
- Fig. 1 is a schematic flowchart of a neural network fixed point method shown in an exemplary embodiment of the present application.
- Fig. 2 is a schematic flowchart of another neural network fixed-pointing method shown in an exemplary embodiment of the present application.
- Fig. 3 is a schematic flowchart of a final fixed-pointing hyperparameter for determining the characteristic value output by the to-be-fixed unit from the first fixed-pointing superparameter candidate value range according to an exemplary embodiment of the present application.
- Fig. 4 is a schematic flowchart of another neural network fixed point method according to an exemplary embodiment of the present application.
- FIG. 5 is a schematic flowchart of a final fixed-pointing hyperparameter for determining the weight of the to-be-fixed unit from the second fixed-pointing super-parameter candidate value range according to an exemplary embodiment of the present application.
- Fig. 6 is a schematic flowchart of a neural network fixed point method according to an exemplary embodiment of the present application.
- Fig. 7 is a schematic flowchart of a neural network fixed-pointing method shown in an exemplary embodiment of the present application.
- Fig. 8 is a schematic diagram of an automated neural network pointing system shown in an exemplary embodiment of the present application.
- Fig. 9 is a schematic diagram of a functional flow chart of a fixed-point evaluation and tuning module shown in an exemplary embodiment of the present application.
- Fig. 10 is a schematic diagram showing an implementation of an optimization strategy for minimizing local errors according to an exemplary embodiment of the present application.
- Fig. 11 is a schematic structural diagram of a neural network pointing device according to an exemplary embodiment of the present application.
- Fig. 12 is a schematic structural diagram of a neural network pointing device according to an exemplary embodiment of the present application.
- Fig. 13 is a schematic structural diagram of a neural network pointing device according to an exemplary embodiment of the present application.
- Fig. 14 is a schematic diagram showing the hardware structure of an electronic device according to an exemplary embodiment of the present application.
- FIG. 1 is a schematic flowchart of a neural network fixed-pointing method provided by an embodiment of this application.
- the neural network fixed-pointing method may include the following steps S100 and S110.
- Step S100 For the to-be-fixed unit of the neural network, based on the data distribution of the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, determine the characteristic value output by the to-be-fixed unit The fixed-point super-parameters.
- the fixed-point of the feature value output by the to-be-fixed unit is determined Super parameters.
- the unit to be fixed when the unit to be fixed is the first unit to be fixed in the neural network, for example, the first unit of the neural network, the neural network does not include the fixed unit, in this case, it can be based on the
- the data distribution of the characteristic value output by the to-be-fixed unit determines the fixed-point hyperparameter of the characteristic value output by the to-be-fixed unit, and fixes the characteristic value output by the to-be-fixed unit based on the fixed super parameter.
- unit 1 and unit 2 can be fixed in sequence.
- the unit 1 is fixed (that is, the unit to be fixed is unit 1)
- a certain number of samples can be input to the neural network to calculate the data distribution of the eigenvalues output by the unit 1, and based on the eigenvalues output by the unit 1.
- the data distribution is to determine the fixed-point super-parameters of the eigenvalues output by the unit 1, and to fix the eigenvalues output by the unit 1 based on the determined fixed-point super-parameters.
- unit 1 After the fixed-pointing of unit 1 is completed, when unit 2 is fixed-pointed (that is, the unit to be fixed is unit 2), unit 1 can be kept in a fixed-point state, a certain number of samples are input to the neural network, and unit 2 is counted. Based on the data distribution of the output feature value, and based on the data distribution of the feature value output by the unit 2, the fixed-point hyperparameter of the feature value output by the unit 2 is determined.
- the to-be-fixed unit of the neural network when the to-be-fixed unit of the neural network is fixed, if there are multiple fixed-point units before the to-be-fixed unit, it can also be used in some of the multiple fixed-point units.
- the fixed-point unit maintains the fixed-point state, the pending unit is fixed-pointed, and its specific implementation is not repeated here.
- step S110 the characteristic value output by the unit to be fixed is fixed based on the fixed super parameter.
- the characteristic value output by the to-be-fixed unit can be fixed based on the fixed-pointing super-parameter. change.
- the neural network is fixed unit by unit, and for the pending unit of the neural network, the fixed unit is kept in a fixed state to obtain a more realistic output feature value. Data distribution, thus, improve the performance of neural network fixed-point.
- step S100 after determining the fixed-pointing hyperparameter of the feature value output by the to-be-fixed unit, the neural network fixed-pointing method provided in the embodiment of the present application may further include The following steps: step S101, determine a first fixed-point super-parameter candidate value range based on the fixed-point super-parameter of the characteristic value output by the to-be-fixed unit; step S102, from the first fixed-point super-parameter candidate value range Determine the final fixed-point hyperparameter of the eigenvalue output by the to-be-fixed unit.
- step S110 the characteristic value output by the to-be-fixed unit is fixed based on the to-be-fixed super-parameter, including: step S111, the final fixed-pointing super-parameter based on the characteristic value output by the to-be-fixed unit is The eigenvalues output by the pointization unit are fixed-pointed.
- the determined fixed-point super-parameter may also be optimized to obtain the actual use of the to-be-determined super-parameter.
- the eigenvalues output by the initiation unit are used for fixed-point fixed-point super-parameters (referred to as final fixed-point super-parameters in this article) to further improve the performance of the neural network fixed-point.
- the range for searching for the final fixed-pointing hyperparameters (herein referred to as the first fixed-pointing hyperparameter candidate value) may be determined. Range), and determine the final fixed-point super-parameter of the characteristic value output by the to-be-fixed unit from the first fixed-point super-parameter candidate value range.
- the first fixed-point hyperparameter candidate value range may be a numerical interval including the fixed-point hyperparameter determined in step S100.
- the lower limit and upper limit of the candidate value range of the first fixed-point super-parameter can be obtained by subtracting and adding a specific value greater than 0 on the basis of the fixed-point super-parameter determined in step S100, thereby determining the first fixed-point super-parameter.
- the range of hyperparameter candidate values is fixed.
- the fixed-point super-parameter determined in step S100 may be used as the lower limit of the first fixed-point super-parameter candidate value range, and a specific value greater than 0 can be added to the lower limit to obtain the first fixed-point super-parameter.
- the upper limit of the parameter candidate value range is determined, thereby determining the first fixed-point hyperparameter candidate value range.
- step S102 determining the final fixed-pointing hyper-parameter of the characteristic value output by the to-be-fixed unit from the first fixed-pointing super-parameter candidate value range can be implemented by the following steps: Step S1021, respectively, determine the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range; step S1022, determine the candidate value with the smallest output error of the corresponding neural network as the pending point The final fixed-point hyperparameter of the eigenvalue output by the unit.
- the fixed-point hyperparameter of the eigenvalue output by the fixed-point unit can be optimized, and the fixed-point hyperparameter that minimizes the output error of the neural network can be selected as the eigenvalue output by the to-be-fixed unit Finally, the super-parameters are fixed.
- the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range can be determined separately, and the output error of the corresponding neural network can be minimized
- the candidate value of is determined as the final fixed-pointing hyperparameter of the feature value output by the to-be-fixed-pointing unit.
- determining the candidate value with the smallest output error of the corresponding neural network as the final fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit is only the determination of the fixed-pointing hyperparameter in the embodiment of this application. It is an implementation manner and is not a limitation of the protection scope of the present application. In the embodiments of the present application, the final fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit can also be determined in other ways.
- the average value of the candidate values whose output error of the corresponding neural network is less than the preset threshold can be determined as the final fixed-pointing hyperparameter of the feature value output by the to-be-fixed unit.
- the candidate values can be sorted according to the output error of the corresponding neural network from small to large, and the average value of the previously preset number of candidate values after sorting can be determined as the final feature value output by the unit to be fixed. Fixed-point super-parameters.
- respectively determining the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range may include: for any candidate value, based on the first type feature value and The second type feature value determines the output error of the neural network corresponding to the candidate value.
- the fixed-point processing of the neural network may bring errors to the output accuracy of the neural network, and the output of the fixed-point neural network is different from the original floating-point state.
- the smaller the output error of the neural network the higher the output accuracy of the fixed-point neural network. Therefore, the fixed-point can be fixed based on the error between the output of the fixed-point neural network and the output of the neural network in the original floating-point state Super parameters are optimized.
- the characteristic value output by each unit of the neural network when using the candidate value to fix the characteristic value output by the fixed-point unit (herein (Referred to as the first type feature value), and, in the original floating point state, the feature value output by each unit of the neural network (herein referred to as the second type feature value), determine the output error of the neural network corresponding to the candidate value, which
- the specific implementation may be described below in conjunction with specific examples, and the embodiments of the present application will not be repeated here.
- the neural network positioning method provided in the embodiment of the present application may further include the following steps S400, S410, S420, and S430.
- Step S400 For the to-be-fixed unit of the neural network, based on the data distribution of the weight of the to-be-fixed unit, determine the fixed-point hyperparameter of the weight of the to-be-fixed unit.
- Step S410 based on the fixed-pointed super-parameter of the weight of the to-be-fixed unit, determine a second fixed-pointed super-parameter candidate value range.
- Step S420 Determine the final fixed super parameter of the weight value of the to-be-fixed unit from the second fixed super parameter candidate value range.
- step S430 the weight of the unit to be fixed is fixed based on the final super-parameter of the weight of the unit to be fixed.
- the to-be-fixed unit of the neural network in addition to the characteristic value output by the to-be-fixed unit can be fixed according to the method described in the above embodiment, it also needs to be fixed.
- the weight of the unit is fixed-point.
- the weight of the floating-point state of each unit has been determined when the neural network is trained (the neural network is in the original floating-point state at this time).
- the data distribution of the weights of the floating-point state of the unit is not affected by the fixation of the previous unit. Therefore, for the weights of the neural network, when the weights of the to-be-fixed units of the neural network are fixed, the The specific implementation can refer to the related implementation in the traditional neural network fixed-point solution.
- the determined Optimize the fixed-point super-parameters to obtain the fixed-point super-parameters that are actually used to fix the weights of the to-be-fixed units referred to as the final fixed-point super-parameters in this article
- the range of the final fixed-pointing super-parameters used to search for the weights of the to-be-fixed units may be determined.
- Hyperparameter candidate value range determines the final fixed-point hyperparameter of the weight of the to-be-fixed unit from the second fixed-pointed super-parameter candidate value range, and further, the final fixed-point based on the weight of the to-be-fixed unit
- the super-parameters are used to fix the weights of the units to be fixed.
- the fixed-point hyperparameter of the weight of the fixed-point unit can be optimized based on the output error of the neural network, and the fixed-point super-parameter that minimizes the output error of the neural network can be selected as the final fixed point of the weight of the to-be-fixed unit ⁇ .
- the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range can be determined separately, and the candidate with the smallest output error of the corresponding neural network can be determined The value is determined as the final fixed-pointing hyperparameter of the weight of the to-be-fixed unit.
- respectively determining the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range may include: for any candidate value, based on the third type feature value and the first The four types of feature values determine the output error of the neural network corresponding to the candidate value.
- the fixed-point processing of the neural network may bring errors to the output accuracy of the neural network, and the output of the fixed-point neural network is different from the original floating-point state.
- the smaller the output error of the neural network the higher the output accuracy of the fixed-point neural network. Therefore, the fixed-point can be fixed based on the error between the output of the fixed-point neural network and the output of the neural network in the original floating-point state Super parameters are optimized.
- the eigenvalues output by each unit of the neural network when the weight of the fixed-point unit is fixed using the candidate value (referred to herein as The third type feature value), and, in the original floating point state, the feature value output by each unit of the neural network (herein referred to as the fourth type feature value), determine the output error of the neural network corresponding to the candidate value, and its specific implementation It may be described below in conjunction with specific examples, and the embodiments of the present application will not be repeated here.
- the neural network fixed-pointing method provided in the embodiment of the present application may further include: the pending point is based on the situation that the fixed-pointed unit of the neural network maintains the fixed-pointing state The eigenvalues output by the transformation unit, and the eigenvalues output by the to-be-fixed unit in the original floating-point state, optimize the weight of the to-be-fixed unit.
- each layer of the neural network is fixed-pointed, there may be errors in accuracy. As the number of layers deepens, the cumulative error in fixed-pointing may bring a greater impact on the overall performance of the neural network. Therefore, reducing the deviation caused by the fixed-pointing of each layer can reduce the accuracy loss of each layer of the neural network after the fixed-pointing, and improve the overall performance of the neural network.
- the fixed-point unit based on the neural network may be kept fixed.
- the eigenvalue output by the to-be-fixed unit in the state of the state and the characteristic value output by the to-be-fixed unit in the original floating-point state are optimized for the weight of the to-be-fixed unit.
- the weight optimization may not be performed for the first to-be-fixed unit of the neural network handle.
- the above-mentioned neural network-based fixed-point unit maintains the fixed-point state of the characteristic value output by the to-be-fixed unit and the characteristic value output by the to-be-fixed unit in the original floating-point state.
- Optimizing the weight of the to-be-fixed unit may include: optimizing the weight of the to-be-fixed unit, so that the fixed-point unit of the neural network maintains the fixed-point state of the characteristic value output by the to-be-fixed unit , And, the error between the eigenvalues output by the to-be-fixed unit in the original floating-point state is the smallest.
- one may be determined based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network remains in the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state.
- the weight value of the unit to be fixed is optimized based on the principle of minimizing the error.
- FIG. 6 is a schematic flowchart of a neural network fixed-pointing method provided by an embodiment of this application.
- the neural network fixed-pointing method may include the following steps S600 and S610.
- Step S600 For the to-be-fixed unit of the neural network, the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the output of the to-be-fixed unit in the original floating-point state The eigenvalues of, optimize the weight of the unit to be fixed.
- the neural network in order to improve the flexibility of neural network fixed-pointing, can be divided into multiple units according to one layer or continuous multiple layers of one unit, and the neural network can be fixed-pointed unit by unit.
- the The weights of the pointized units are optimized.
- the optimization processing of the weight may not be performed.
- step S610 the optimized unit to be fixed is fixed.
- the optimized unit to be fixed when the weight of the unit to be fixed is optimized in the manner described in step S600, the optimized unit to be fixed can be fixed.
- the neural network is divided into multiple units and fixed-point processing is performed unit by unit, which improves the flexibility of the fixed-point neural network; in addition, when the unit to be fixed is fixed-pointed Previously, the weight of the fixed-point unit was optimized to reduce the error caused by the fixed-pointization of the previous fixed-point unit, reduce the accuracy loss of the neural network fixed-point, and improve the performance of the neural network fixed-point.
- the characteristic value output by the to-be-fixed unit under the condition that the neural network-based fixed-point unit remains in the fixed-point state, and the to-be-fixed unit in the original floating-point state may include: optimizing the weight of the to-be-fixed unit, so that the fixed-point unit of the neural network maintains the fixed-point state.
- the error between the characteristic value output by the initiation unit and the characteristic value output by the to-be-fixed initiation unit in the original floating-point state is the smallest.
- one may be determined based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network remains in the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state.
- the specific implementation can be described below in conjunction with specific examples, and the embodiments of the present application will not repeat them here.
- the optimization of the to-be-fixed unit may include: output of the to-be-fixed unit under the condition that the fixed-point unit based on the neural network maintains the fixed-point state According to the data distribution of the characteristic value, the optimized fixed-point hyperparameter of the characteristic value output by the to-be-fixed unit is determined, and based on the fixed-point super-parameter, the optimized characteristic value output by the to-be-fixed unit is fixed.
- the unit to be fixed when the unit to be fixed is the first unit to be fixed in the neural network, for example, the first unit of the neural network, the neural network does not include the fixed unit, in this case, it can be based on the
- the data distribution of the characteristic value output by the to-be-fixed unit determines the fixed-point super-parameter of the characteristic value output by the to-be-fixed unit, and fixes the characteristic value output by the to-be-fixed unit based on the fixed super-parameter.
- the characteristic value output by the optimized unit to be fixed can be fixed based on the determined super-parameter.
- the optimized fixed-pointing hyperparameters of the characteristic values output by the to-be-fixed unit may further include: determining the fixed-pointing hyperparameters based on the optimized characteristic values output by the to-be-fixed unit, The third fixed-point super-parameter candidate value range; the final fixed-point super-parameter of the characteristic value output by the to-be-fixed unit after optimization is determined from the third fixed-point super-parameter candidate value range.
- the above-mentioned fixed-pointing based on the fixed-pointing super-parameters on the optimized eigenvalues output by the to-be-fixed unit may include: a final fixed-pointing super-parameter pair optimized based on the eigenvalues output by the to-be-fixed unit The eigenvalue output by the to-be-fixed unit is fixed-pointed.
- the determined fixed-point super-parameter can also be optimized to obtain the to-be-fixed point that is actually used for optimization.
- the eigenvalues output by the transformation unit are used for fixed-point fixed-point super-parameters (referred to as final fixed-point super-parameters in this article) to further improve the performance of neural network fixed-point.
- the range for searching the final fixed-point super-parameters (referred to herein as the third fixed-point super-parameter candidate value) may be determined. Range), and determine the final fixed-point super-parameter of the characteristic value output by the optimized to-be-fixed unit from the third fixed-point super-parameter candidate value range.
- the foregoing determination of the optimized final fixed-pointing hyperparameters of the characteristic values output by the to-be-fixed unit after optimization from the third fixed-pointing hyperparameter candidate value range may include: respectively determining the third fixed-pointing hyperparameters The output error of the neural network corresponding to each candidate value in the candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the final fixed-pointing hyperparameter of the characteristic value output by the optimized point-to-fixed unit.
- the fixed-point hyperparameters of the characteristic value output by the fixed-point unit can be optimized based on the output error of the neural network, and the fixed-point super-parameter that minimizes the output error of the neural network can be selected as the output of the optimized to-be-fixed unit The final fixed-point hyperparameter of the eigenvalue.
- the output error of the neural network corresponding to each candidate value in the third fixed-point hyperparameter candidate value range can be determined separately, and the candidate with the smallest output error of the corresponding neural network can be determined The value is determined as the final fixed-pointing hyperparameter of the eigenvalue output by the pending-pointing unit after optimization.
- the foregoing determination of the output error of the neural network corresponding to each candidate value in the third fixed-point hyperparameter candidate value range may include: for any candidate value, based on the fifth-type feature value and the sixth-type feature The value determines the output error of the neural network corresponding to the candidate value.
- the fixed-point processing of the neural network may bring errors to the output accuracy of the neural network, and the output of the fixed-point neural network is different from the original floating-point state.
- the smaller the output error of the neural network the higher the output accuracy of the fixed-point neural network. Therefore, the fixed-point can be fixed based on the error between the output of the fixed-point neural network and the output of the neural network in the original floating-point state Super parameters are optimized.
- the characteristic value output by each unit of the neural network ( This article is called the fifth type feature value), and, in the original floating point state, the feature value output by each unit of the neural network (herein referred to as the six type feature value), determine the output error of the neural network corresponding to the candidate value,
- the fifth type feature value the characteristic value output by each unit of the neural network
- the six type feature value determine the output error of the neural network corresponding to the candidate value
- the weight of the to-be-fixed unit in addition to the characteristic value output by the to-be-fixed unit, the weight of the to-be-fixed unit needs to be fixed. Since the weight of the unit to be fixed is not affected by the fixed unit of the neural network, after optimizing the weight of the unit to be fixed according to the method shown in Figure 6, you can refer to the traditional neural network fixed-point solution In the implementation of fixed-point weighting, the weights of the optimized units to be fixed-point are fixed-pointed.
- the determined fixed-point hyperparameter can also be determined. Carry out optimization to determine the final fixed-point hyperparameters.
- the optimization of the to-be-fixed unit may include: determining the optimized weight of the to-be-fixed unit based on the data distribution of the weight of the to-be-fixed unit after optimization.
- Fixed-point super-parameter based on the optimized fixed-point super-parameter of the weight of the unit to be fixed, determine the fourth fixed-point super-parameter candidate value range; determine the optimized value from the fourth fixed-point super-parameter candidate value range
- the final fixed-pointing super parameter of the weight of the to-be-fixed unit based on the optimized final fixed-pointing super-parameter of the weight of the to-be-fixed unit, the optimized weight of the to-be-fixed unit is fixed.
- FIG. 7 is a schematic flowchart of a neural network fixed-pointing method provided by an embodiment of this application.
- the neural network fixed-pointing method may include the following steps S700, S710, S720, and S730.
- Step S700 Analyze the topological structure of the input floating-point model to generate a neural network data flow graph.
- Step S710 Generate a data layer of the neural network based on the sample picture information in the configuration file.
- Step S720 Based on the optimization strategy of the platform to be deployed in the configuration file, split and merge the topology of the neural network to obtain a preprocessed floating-point model.
- embodiments of the present application provide a solution for automatically realizing neural network positioning.
- the topological structure of the floating point model can be analyzed to generate a data flow diagram of the neural network, that is, according to the process of data from input to output, sequentially
- the structure diagram of the floating-point model determined by each layer of the floating-point model is passed, and the data layer of the neural network is generated according to the sample image information in the configuration file, such as the access path of the sample image and the preprocessing method of the sample image.
- the platform characteristics of different deployment platforms in order to optimize the effect of neural network deployment on different platforms, it can be based on the platform characteristics of the platform to be deployed in the configuration file (which can be called optimization strategy), and the topology of the neural network Splitting (such as splitting part of the topological structure of the floating-point model according to the optimization strategy of the platform to be deployed) and fusion (such as merging the BN layer of the floating-point model into the pre-Conv layer), etc., to obtain the pre-processed floating
- the point model makes the topological structure of the pre-processed floating-point model more suitable for the platform characteristics of the platform to be deployed, improves the efficiency of the pre-processed floating-point model on hardware, and optimizes the operating effect.
- Step S730 Perform fixed-point conversion on the pre-processed floating-point model.
- the pre-processed floating-point model when the preprocessing of the floating-point mode is completed, can be fixed-point to obtain a fixed-point model that can be used for deployment.
- the pre-processed floating-point model may be fixed-point processed in the manner described in any of the foregoing embodiments.
- the fixed-point simulation test can be performed on the fixed-point model to evaluate the fixed-point performance of the model.
- the preset performance evaluation methods and indicators determine whether the performance of the fixed-point model meets the demand. If the demand is met, the model can be finally converted and deployed; if the demand is not met, the fixed-point model optimization is carried out to further Improve the performance of fixed-point models.
- the model can be tuned in a more global and detailed manner.
- model training based on a fixed-point budget can be performed.
- the knowledge distillation training method can be used to guide the training and tuning of the fixed-point model using the original model.
- the tuning performance meets the requirements, the final fixed-point hyperparameter table and the model to be converted are output.
- intelligent analysis and processing can be performed based on the neural network after the fixed point, including but not limited to computer vision processing (such as image classification, target detection) Or speech segmentation, etc.) or natural language processing.
- Neural network fixed-pointization is a commonly used model acceleration algorithm. By quantizing the weight of the model and the output feature value into a fixed bit number, such as 8bit, 16bit or very low 1bit, 2bit, it can be well solved in hardware
- a fixed bit number such as 8bit, 16bit or very low 1bit, 2bit
- the automated neural network fixed-point system may include a fixed-point evaluation and tuning module and a fixed-point conversion module.
- the pre-configured fixed-point configuration information (which can be provided in the form of a configuration file), the to-be-fixed model (that is, the floating-point model), and the sample set can be used to obtain The deployed fixed-point model file.
- the specific functions of each module are described in detail below.
- FIG. 9 The functional flowchart of the fixed-point evaluation and tuning module can be shown in Figure 9, which mainly includes the following processes: floating-point model preprocessing, statistical evaluation and optimization, and fixed-point testing and tuning. Each process will be described in detail below.
- the preprocessing process of the floating-point model mainly includes: analyzing the topological structure of the input floating-point model to generate a neural network data flow diagram; based on the sample picture information in the configuration file, generating the data layer of the neural network; based on the configuration file
- the optimization strategy of the platform to be deployed splitting the topology of the neural network (such as splitting part of the topological structure of the floating-point model according to the optimization strategy of the platform to be deployed) and fusion (such as merging the BN layer of the floating-point model into Pre-Conv layer) to obtain a model that is more suitable for deployment on the platform to be deployed with a topology structure (that is, a preprocessed floating-point model).
- the pre-processed floating-point model obtained after the pre-processing of the floating-point model can be subjected to subsequent processing.
- the purpose of the fixed-point neural network is to quantify the weight of the model and the output feature value into a fixed bit value to achieve the effect of accelerating the reasoning.
- fixed-point algorithms including but not limited to linear symmetric fixed-point algorithms, linear asymmetric fixed-point algorithms, and Power-of-Two fixed-point algorithms can be used to realize neural network fixed-pointization.
- linear symmetric fixed-point algorithm linear asymmetric fixed-point algorithm
- Power-of-Two fixed-point algorithm Power-of-Two fixed-point algorithm
- X represents the original floating-point data
- C x represents the cut-off value of the absolute value of the floating-point data
- B w represents the fixed-point bit width
- X Q represents the fixed-point value
- X represents the original floating point data
- C n represents the left side truncation value of the floating point data
- C p represents the right side truncation value of the floating point data
- B w represents the bit width of the fixed point
- X Q represents the fixed-point value.
- X represents the original floating-point data
- C x represents the cutoff value of the absolute value of the floating-point data
- B w represents the bit width of the fixed-point
- X Q represents the fixed-point Value
- the cut-off value of floating-point data (that is, the fixed-point hyperparameter) needs to be used.
- the selection of the cut-off value is very important for the effect of fixed-point, and it is often determined according to the distribution of the original data.
- the weights are fixed: for the neural network of the original floating-point state, the weight of the floating-point state of each unit is determined when the neural network is trained, and the floating-point state of each unit The data distribution of the weights of is not affected by the fixed-pointing of the previous unit. Therefore, the data distributions of the weights of each unit of the neural network in the original floating-point state can be separately counted, and the fixed-point hyperparameters can be calculated.
- the neural network fixed-point solution provided by the embodiments of the present application has at least the following improvements.
- a layer-by-layer evaluation that is, a unit including a layer of the neural network as an example
- the current layer To be fixed-pointed layer
- the linear symmetric fixed-point algorithm the linear asymmetric fixed-point algorithm, and the Power-of-Two fixed-point algorithm are still taken as examples to describe the fixed-point hyperparameter calculation implemented by the layer-by-layer evaluation method in the embodiment of the present application.
- any subsequent to-be-fixed layer while the fixed-point layer remains in the fixed-point state, again input a certain number of sample pictures to the model for forward calculation, and count the feature values and weights output by the to-be-fixed layer
- the data distribution of the feature calculate the fixed super parameter of the feature value output by the to-be-fixed layer and the fixed super-parameter of the weight value, and use the formulas (1) and (2) to convert the to-be-fixed layer into a fixed-point Operation state, until all layers of the model are converted into fixed-point operation state.
- any subsequent to-be-fixed layer while the fixed-point layer remains in the fixed-point state, again input a certain number of sample pictures to the model for forward calculation, and count the feature values and weights output by the to-be-fixed layer
- the data distribution of the feature calculate the fixed super-parameter of the feature value output by the to-be-fixed layer and the fixed-point super-parameter of the weight value, and use the formulas (3) and (4) to convert the to-be-fixed layer into a fixed-point Operation state, until all layers of the model are converted into fixed-point operation state.
- any subsequent to-be-fixed layer while the fixed-point layer remains in the fixed-point state, again input a certain number of sample pictures to the model for forward calculation, and count the feature values and weights output by the to-be-fixed layer
- the data distribution of the feature calculate the fixed super parameter of the feature value output by the to-be-fixed layer and the fixed super-parameter of the weight value, and use the formulas (5), (6) and (7) to convert the to-be-fixed layer It is a fixed-point computing state until all layers of the model are converted into a fixed-point computing state.
- the determined fixed-point hyperparameters can also be optimized, that is, after the fixed-point hyperparameters (including the fixed-point hyperparameters and/or output eigenvalues of the output eigenvalues) are determined according to the above method
- the search range of the final fixed-point super-parameters can be determined based on the determined fixed-point super-parameters (such as the first fixed-point super-parameter candidate value range or the second fixed-point super-parameter above). Candidate value range, etc.), and search for the fixed-point hyperparameter that has the least impact on the output error of the neural network in the search range, as the final fixed-point hyperparameter.
- the calculation method of the neural network output error includes, but is not limited to, the mean square error, KL divergence, Euclidean distance, and the like.
- the mean square error as an example, the output error of the neural network can be determined in the following way:
- L represents the total number of layers of the model
- O i represents the output feature value of the layer in the fixed-point state
- represents the number of feature data.
- the output error of layer i of the neural network can be determined. Based on the output error of each layer of the neural network, the output error of the neural network can be determined by formula (9).
- the The weights of the pointization unit are optimized, and the specific implementation process may include the following steps 1 and 2.
- Step 1 Perform a fixed-point evaluation on the first to-be-fixed layer L 1 of the original model M to obtain a fixed-point hyperparameter, and then fix the layer to obtain a model Q 1 .
- Step 2 the calculation model and the original model M L Q 1 in the first floating point error output layer L 2 after a layer to minimize this error to optimize the power of two L principle.
- determining the output error of the original model and the quantized model in the to-be-fixed layer can be achieved through functions such as L1-loss, L2-loss, and expected deviation.
- L1-loss L2-loss
- expected deviation expected deviation
- Equation (10) and (11) Represents the forward inference function of the L 2 layer, and L 2 represent the weight of the layer and the BIAS (L 2 layer to an example convolution layer), Y is the first step extracted from the original model M eigenvalues layer L 2, X Q Q from the current model The input eigenvalues of the L 2 layer in 1, and They respectively represent the optimized weight and bias of the L 2 layer (still floating-point at this time).
- the solid-line box represents the original floating-point layer
- the dashed box represents the fixed-point layer obtained by fixed-pointing the original floating-point layer
- the solid-line box with filled squares represents the updated floating-point layer based on minimizing local errors.
- the dashed frame with filled squares represents the fixed-point layer obtained after the updated floating-point layer is fixed-point.
- the performance of the fixed-point neural network is evaluated instead of According to the error between the final output of the quantized model and the true value of the sample in the traditional neural network fixed-point solution, the performance of the neural network fixed-point is evaluated. Therefore, the sample used for the neural network fixed-point can be without annotated information The sample, which reduces the requirements on the sample, and improves the feasibility of the plan.
- the fixed-point model can be subjected to a fixed-point simulation test to evaluate the fixed-point performance of the model. According to the preset performance evaluation methods and indicators, determine whether the performance of the fixed-point model meets the demand. If the demand is met, the model can be finally converted and deployed; if the demand is not met, the fixed-point model optimization is carried out to further Improve the performance of fixed-point models.
- the model can be tuned in a more global and detailed manner.
- model training based on a fixed-point budget can be performed.
- the knowledge distillation training method can be used to guide the training and tuning of the fixed-point model using the original model.
- the tuning performance meets the requirements, the final fixed-point hyperparameter table and the model to be converted are output.
- the fixed-point conversion module can output a deployable file to deploy a quantified neural network model on the platform to be deployed based on the deployable file.
- intelligent analysis and processing can be performed based on the fixed neural network, including but not limited to computer vision processing (such as image classification, target detection, or speech segmentation, etc.) or natural language processing.
- the characteristics of the output of the to-be-fixed unit based on the situation that the fixed-point unit of the neural network maintains the fixed-point state The data distribution of the value, the fixed-point hyperparameter of the eigenvalue output by the to-be-fixed unit is determined, and the eigenvalue output by the to-be-fixed unit is fixed based on the fixed-point super-parameter, and the neural network is unit-by-unit.
- Fixed-point for the to-be-fixed unit of the neural network, keep the fixed-point unit in the fixed-point state to obtain a more realistic data distribution of the output feature value, thereby improving the performance of the fixed-point neural network.
- the neural network fixed-pointing device may include: a determination module for determining a pending unit of the neural network , Based on the data distribution of the feature value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, the fixed-point hyperparameter of the feature value output by the to-be-fixed unit is determined; the fixed-point module , Used to fix the characteristic value output by the unit to be fixed based on the fixed super parameter.
- the determining module is further configured to: determine the fixed-pointing hyperparameter based on the characteristic value output by the to-be-fixed unit The first fixed point hyperparameter candidate value range; the final fixed point hyperparameter of the characteristic value output by the to-be-fixed unit is determined from the first fixed point hyperparameter candidate value range.
- the fixed-pointing module based on the fixed-pointing super-parameter, fixes the characteristic value output by the to-be-fixed unit, including: the final fixed-pointing super-parameter based on the characteristic value output by the to-be-fixed unit to the pending point
- the eigenvalues output by the transformation unit are fixed-pointed.
- the determining module determines the final fixed-pointing hyper-parameter of the characteristic value output by the to-be-fixed unit from the range of the first fixed-pointing super-parameter candidate value, including: separately determining the first fixed-pointing hyperparameter The output error of the neural network corresponding to each candidate value in the fixed-point hyperparameter candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the final fixed-point hyperparameter of the feature value output by the to-be-fixed unit .
- the determining module separately determines the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range, including: for any candidate value, based on the first type The feature value and the second type feature value determine the output error of the neural network corresponding to the candidate value, and the first type feature value is the neural network when the feature value output by the to-be-fixed unit is fixed using the candidate value The feature value output by each unit; the second type feature value is the feature value output by each unit of the neural network in the original floating point state.
- the determining module is further configured to determine the weight of the pending unit of the neural network based on the data distribution of the weight of the pending unit The fixed-point super-parameter of the; based on the fixed-point super-parameter of the weight of the to-be-fixed unit, determine the second fixed-point super-parameter candidate value range; determine the to-be-fixed unit from the second fixed-point super-parameter candidate value range The final fixed-point hyperparameters of the weights.
- the fixed-pointing module is further configured to fix the weight of the to-be-fixed unit based on the final fixed-pointing hyperparameter of the weight of the to-be-fixed unit.
- the determining module determines the final fixed-pointing hyperparameter of the weight value of the to-be-fixed unit from the second fixed-pointing super-parameter candidate value range, including: separately determining the second fixed-pointing hyperparameter The output error of the neural network corresponding to each candidate value in the hyperparameter candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the final fixed point super parameter of the weight of the to-be-fixed unit.
- the determining module separately determines the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range, including: for any candidate value, based on a third type of feature Value and the fourth type feature value determine the output error of the neural network corresponding to the candidate value.
- the third type feature value uses the candidate value to fix the weight of the to-be-fixed unit, each of the neural networks The feature value output by the unit; the fourth type feature value is the feature value output by each unit of the neural network in the original floating point state.
- the determining module is based on the feature value output by the to-be-fixed unit in the case where the fixed-point unit of the neural network remains in a fixed-point state
- the determining module is also used to: based on the situation that the fixed-pointing unit of the neural network maintains the fixed-pointing state, the pending-pointing
- the eigenvalue output by the unit and the eigenvalue output by the to-be-fixed unit in the original floating-point state are optimized for the weight of the to-be-fixed unit.
- the determining module is based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the to-be-fixed unit in the original floating-point state
- the output characteristic value, optimizing the weight of the pending unit includes: optimizing the weight of the pending unit, so that the determined unit of the neural network maintains the fixed state when the pending unit
- the error between the characteristic value output by the initiation unit and the characteristic value output by the to-be-fixed initiation unit in the original floating-point state is the smallest.
- the unit includes one layer or successive multiple layers of the neural network, and the neural network includes a plurality of units.
- the neural network fixed-pointing device may include: an optimization module for undetermined neural network Unit, based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state, for the pending point The weight of the unit is optimized; the fixed-point module is used to fix the optimized unit to be fixed.
- the optimization module is based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network remains in the fixed-point state, and the to-be-fixed unit in the original floating-point state
- the output characteristic value, optimizing the weight of the pending unit includes: optimizing the weight of the pending unit, so that the determined unit of the neural network maintains the fixed state when the pending unit
- the error between the characteristic value output by the initiation unit and the characteristic value output by the to-be-fixed initiation unit in the original floating-point state is the smallest.
- the fixed-pointing module performs fixed-pointing on the optimized unit to be fixed, including: performing the fixed-pointing based on the situation that the fixed-pointing unit of the neural network maintains the fixed-pointing state.
- the data distribution of the eigenvalues output by the unit determine the optimized fixed-point hyperparameters of the eigenvalues output by the to-be-fixed unit, and fix the optimized eigenvalues output by the to-be-fixed unit based on the fixed-point hyperparameters change.
- the fixed-pointing module determines the optimized fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit, it is also used to: based on the optimized characteristic value output by the to-be-fixed unit Determine the third fixed-point super-parameter candidate value range; from the third fixed-point super-parameter candidate value range, determine the optimized final fixed-point super-parameter of the characteristic value output by the to-be-fixed unit.
- the fixed-pointing module fixes the optimized eigenvalues output by the unit to be fixed based on the super-parameters, including: the final fixed-point super-parameter pair optimized based on the characteristic values output by the unit to be fixed
- the eigenvalues output by the to-be-fixed unit are fixed-pointed.
- the fixed-pointing module determines from the third fixed-pointing super-parameter candidate value range the final fixed-pointing super-parameters of the characteristic values output by the to-be-fixed unit after optimization, including: respectively determining The output error of the neural network corresponding to each candidate value in the third fixed-point hyperparameter candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the eigenvalue output of the optimized unit to be fixed Finally, the super-parameters are fixed-pointed.
- the fixed-pointing module separately determines the output error of the neural network corresponding to each candidate value in the third fixed-pointing hyperparameter candidate value range, including: for any candidate value, based on the fifth type The feature value and the sixth type feature value determine the output error of the neural network corresponding to the candidate value; wherein the fifth type feature value uses the candidate value to locate the optimized feature value output by the to-be-fixed unit When, the eigenvalues output by the units of the neural network; the sixth type eigenvalues are the eigenvalues output by the units of the neural network in the original floating-point state.
- the neural network includes a plurality of units, and each unit includes one layer or successive multiple layers of the neural network.
- the neural network fixed-pointing device may include: an analysis module for analyzing the input floating-point model The topology structure is analyzed to generate a neural network data flow graph; a generation module is used to generate the data layer of the neural network based on the sample picture information in the configuration file; the processing module is used to generate the data layer of the neural network based on the configuration file to be deployed
- the optimization strategy of the platform is to split and merge the topology of the neural network to obtain the pre-processed floating-point model; the fixed-point module is used to perform the pre-processing based on the method described in the above method embodiment
- the floating-point model is fixed-point.
- FIG. 14 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of this application.
- the electronic device may include a processor 1401 and a memory 1402 storing machine-executable instructions.
- the processor 1401 and the memory 1402 may communicate via a system bus 1403.
- the processor 1401 can execute the neural network fixed-pointing method described above.
- the memory 1402 mentioned herein may be any electronic, magnetic, optical, or other physical storage device, and may contain or store information, such as executable instructions, data, and so on.
- the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard drive), solid state drive, any type of storage disk (Such as CD, DVD, etc.), or similar storage media, or a combination of them.
- a machine-readable storage medium is also provided, such as the memory 1402 in FIG. 14.
- the machine-readable storage medium stores machine-executable instructions.
- the machine-executable instructions When executed by the processor, Realize the neural network fixed-point method described above.
- the machine-readable storage medium may be ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
- a computer program is also provided, the computer program is stored in a machine-readable storage medium, and when the computer program is executed by a processor, the neural network fixed-pointing method described above is realized.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Image Analysis (AREA)
Abstract
Description
本申请涉及神经网络定点化方法、装置、电子设备及可读存储介质。This application relates to methods, devices, electronic equipment, and readable storage media for neural network targeting.
神经网络定点化(也被称为量化)是一种常用的模型加速算法,通过将模型的权值以及输出的特征值(权值和输出的特征值是float类型的值)量化成固定比特的数,如8bit、16bit或极低的1、2bit,可以很好的解决在硬件上浮点数据带来的乘累加计算复杂、带宽巨大等问题。模型量化的比特数越低,模型在硬件上的加速越明显。Neural network fixed-point (also known as quantization) is a commonly used model acceleration algorithm, which quantizes the weight of the model and the output eigenvalue (the weight and the output eigenvalue are float type values) into fixed bits Numbers, such as 8bit, 16bit or very low 1, 2bit, can well solve the problems of complex multiplication and accumulation calculations and huge bandwidth caused by floating-point data on the hardware. The lower the number of quantized bits of the model, the more obvious the acceleration of the model on hardware.
在一神经网络定点化方案中,可一次性给原始模型输入一定数量的样本图片,模型前向运算将每一层输出的特征值的数据分布记录下来,再分别计算各层输出的特征值的定点化超参,未考虑前置层定点化后对后置层的影响,神经网络定点化的性能较低。In a neural network fixed-point solution, a certain number of sample pictures can be input to the original model at one time, the forward calculation of the model records the data distribution of the eigenvalues output by each layer, and then the eigenvalues output by each layer are calculated separately. The fixed-point super-parameters do not consider the impact of the fixed-pointing of the pre-layer on the post-layer, and the performance of the fixed-point neural network is low.
发明内容Summary of the invention
有鉴于此,本申请提供一种神经网络定点化方法、装置、电子设备及可读存储介质。In view of this, this application provides a method, device, electronic device, and readable storage medium for neural network targeting.
具体地,本申请是通过如下技术方案实现的:Specifically, this application is implemented through the following technical solutions:
根据本申请实施例的第一方面,提供一种神经网络定点化方法,包括:对于神经网络的待定化单元,基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参;基于该定点化超参对该待定点化单元输出的特征值进行定点化。According to the first aspect of the embodiments of the present application, there is provided a neural network fixed-pointing method, including: for the pending unit of the neural network, based on the situation that the fixed-pointing unit of the neural network maintains the fixed-pointing state, the pending-pointing method is provided The data distribution of the characteristic value output by the unit determines the fixed-point hyperparameter of the characteristic value output by the to-be-fixed unit; based on the fixed-point super-parameter, the characteristic value output by the to-be-fixed unit is fixed.
根据本申请实施例的第二方面,提供一种神经网络定点化方法,包括:对于神经网络的待定点化单元,基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化;对优化后的该待定点化单元进行定点化。According to a second aspect of the embodiments of the present application, there is provided a neural network fixed-pointing method, including: for a neural network to-be-fixed unit, based on the situation that the fixed-pointing unit of the neural network maintains a fixed-point state, the pending point Optimizing the weights of the unit to be fixed with the characteristic value output by the quantization unit and the eigenvalue output by the unit to be fixed in the original floating-point state; and fix the optimized unit to be fixed.
根据本申请实施例的第三方面,提供一种神经网络定点化方法,包括:对输入的浮点模型的拓扑结构进行解析,以生成神经网络数据流图;基于配置文件中的样本图片信息,生成所述神经网络的数据层;基于待部署平台的优化策略,对所述神经网络的拓扑结构进行拆分和融合,以得到预处理后的浮点模型;基于上述方法对所述预处理后的浮点模型进行定点化。According to a third aspect of the embodiments of the present application, a neural network fixed-point method is provided, including: analyzing the topological structure of the input floating-point model to generate a neural network data flow graph; based on the sample picture information in the configuration file, Generate the data layer of the neural network; split and merge the topology of the neural network based on the optimization strategy of the platform to be deployed to obtain the preprocessed floating-point model; perform the preprocessing based on the above method The floating-point model is fixed-point.
根据本申请实施例的第四方面,提供一种神经网络定点化装置,包括:确定模块,用于对于神经网络的待定化单元,基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参;定点化模块,用于基于该定点化超参对该待定点化单元输出的特征值进行定点化。According to a fourth aspect of the embodiments of the present application, there is provided a neural network fixed-pointing device, including: a determining module, used for a pending unit of the neural network, based on the situation that the fixed-pointed unit of the neural network maintains a fixed-pointing state Download the data distribution of the characteristic value output by the to-be-fixed unit to determine the fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit; the fixed-pointing module is used for the output of the to-be-fixed unit based on the fixed-pointing hyperparameter The characteristic value is fixed-point.
根据本申请实施例的第五方面,提供一种神经网络定点化装置,包括:优化模块,用于对于神经网络的待定点化单元,基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化;定点化模块,用于对优化后的该待定点化单元进行定点化。According to a fifth aspect of the embodiments of the present application, there is provided a neural network fixed-pointing device, including: an optimization module, which is used to maintain a fixed-pointing state for the fixed-pointing unit of the neural network based on the fixed-pointing unit of the neural network In this case, the eigenvalue output by the to-be-fixed unit and the eigenvalue output by the to-be-fixed unit in the original floating-point state optimize the weight of the to-be-fixed unit; the fixed-point module is used to optimize the The to-be-fixed unit is fixed-pointed.
根据本申请实施例的第六方面,提供一种神经网络定点化装置,包括:解析模块, 用于对输入的浮点模型的拓扑结构进行解析,以生成神经网络数据流图;生成模块,用于基于配置文件中的样本图片信息,生成所述神经网络的数据层;处理模块,用于基于待部署平台的优化策略,对所述神经网络的拓扑结构进行拆分和融合,以得到预处理后的浮点模型;定点化模块,用于基于上述方法对所述预处理后的浮点模型进行定点化。According to a sixth aspect of the embodiments of the present application, there is provided a neural network fixed-pointing device, including: an analysis module for analyzing the topological structure of an input floating-point model to generate a neural network data flow graph; a generation module, using Based on the sample picture information in the configuration file, the data layer of the neural network is generated; the processing module is used to split and merge the topology of the neural network based on the optimization strategy of the platform to be deployed to obtain preprocessing The latter floating-point model; a fixed-point module for fixed-pointing the pre-processed floating-point model based on the above method.
根据本申请实施例的第七方面,提供一种电子设备,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令,所述处理器用于执行机器可执行指令,以实现上述神经网络定点化方法。According to a seventh aspect of the embodiments of the present application, there is provided an electronic device including a processor and a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and The processor is used to execute machine-executable instructions to implement the above-mentioned neural network fixed-point method.
根据本申请实施例的第八方面,提供一种机器可读存储介质,所述机器可读存储介质内存储有机器可执行指令,所述机器可执行指令被处理器执行时实现上述神经网络定点化方法。According to an eighth aspect of the embodiments of the present application, there is provided a machine-readable storage medium that stores machine-executable instructions in the machine-readable storage medium, and when the machine-executable instructions are executed by a processor, the above-mentioned neural network fixed point is realized化 method.
根据本申请实施例的第九方面,提供一种计算机程序,所述计算机程序存储在机器可读存储介质内,所述计算机程序被处理器执行时实现上述神经网络定点化方法。According to a ninth aspect of the embodiments of the present application, a computer program is provided, the computer program is stored in a machine-readable storage medium, and when the computer program is executed by a processor, the above neural network fixed-pointing method is realized.
本申请提供的技术方案至少可以带来以下有益效果:对于神经网络的待定点化单元,基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参,并基于该定点化超参对该待定点化单元输出的特征值进行定点化,通过对神经网络进行逐单元的定点化,对于神经网络的待定点化单元,保持已定点化单元为定点化状态,以得到更加真实的输出特征值的数据分布,从而,提升神经网络定点化的性能。The technical solution provided in this application can at least bring about the following beneficial effects: For the to-be-fixed unit of the neural network, the data distribution of the characteristic value output by the to-be-fixed unit based on the situation that the fixed-point unit of the neural network maintains the fixed-point state , Determine the fixed-point hyperparameter of the eigenvalue output by the to-be-fixed unit, and based on the fixed-point super-parameter, fix the eigenvalue output by the to-be-fixed unit, and perform unit-by-unit fixed-pointing on the neural network. The to-be-fixed unit of the neural network keeps the fixed-point unit in a fixed-point state to obtain a more realistic data distribution of the output characteristic value, thereby improving the performance of the neural network's fixed-pointing.
图1是本申请示例性实施例示出的一种神经网络定点化方法的流程示意图。Fig. 1 is a schematic flowchart of a neural network fixed point method shown in an exemplary embodiment of the present application.
图2是本申请示例性实施例示出的另一种神经网络定点化方法的流程示意图。Fig. 2 is a schematic flowchart of another neural network fixed-pointing method shown in an exemplary embodiment of the present application.
图3是本申请示例性实施例示出的一种从该第一定点化超参候选值范围中确定该待定点化单元输出的特征值的最终定点化超参的流程示意图。Fig. 3 is a schematic flowchart of a final fixed-pointing hyperparameter for determining the characteristic value output by the to-be-fixed unit from the first fixed-pointing superparameter candidate value range according to an exemplary embodiment of the present application.
图4是本申请示例性实施例示出的另一种神经网络定点化方法的流程示意图。Fig. 4 is a schematic flowchart of another neural network fixed point method according to an exemplary embodiment of the present application.
图5是本申请示例性实施例示出的一种从该第二定点化超参候选值范围中确定该待定点化单元的权值的最终定点化超参的流程示意图。FIG. 5 is a schematic flowchart of a final fixed-pointing hyperparameter for determining the weight of the to-be-fixed unit from the second fixed-pointing super-parameter candidate value range according to an exemplary embodiment of the present application.
图6是本申请示例性实施例示出的一种神经网络定点化方法的流程示意图。Fig. 6 is a schematic flowchart of a neural network fixed point method according to an exemplary embodiment of the present application.
图7是本申请示例性实施例示出的一种神经网络定点化方法的流程示意图。Fig. 7 is a schematic flowchart of a neural network fixed-pointing method shown in an exemplary embodiment of the present application.
图8是本申请示例性实施例示出的一种自动化神经网络定点化系统的示意图。Fig. 8 is a schematic diagram of an automated neural network pointing system shown in an exemplary embodiment of the present application.
图9是本申请示例性实施例示出的一种定点化评估与调优模块的功能流程示意图。Fig. 9 is a schematic diagram of a functional flow chart of a fixed-point evaluation and tuning module shown in an exemplary embodiment of the present application.
图10是本申请示例性实施例示出的一种最小化局部误差的优化策略的实现示意图。Fig. 10 is a schematic diagram showing an implementation of an optimization strategy for minimizing local errors according to an exemplary embodiment of the present application.
图11是本申请示例性实施例示出的一种神经网络定点化装置的结构示意图。Fig. 11 is a schematic structural diagram of a neural network pointing device according to an exemplary embodiment of the present application.
图12是本申请示例性实施例示出的一种神经网络定点化装置的结构示意图。Fig. 12 is a schematic structural diagram of a neural network pointing device according to an exemplary embodiment of the present application.
图13是本申请示例性实施例示出的一种神经网络定点化装置的结构示意图。Fig. 13 is a schematic structural diagram of a neural network pointing device according to an exemplary embodiment of the present application.
图14是本申请示例性实施例示出的一种电子设备的硬件结构示意图。Fig. 14 is a schematic diagram showing the hardware structure of an electronic device according to an exemplary embodiment of the present application.
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。The exemplary embodiments will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the application as detailed in the appended claims.
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terms used in this application are only for the purpose of describing specific embodiments, and are not intended to limit the application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
为了使本领域技术人员更好地理解本申请实施例提供的技术方案,并使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面结合附图对本申请实施例中技术方案作进一步详细的说明。In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of this application, and to make the above-mentioned objectives, features, and advantages of the embodiments of this application more obvious and understandable, the technical solutions in the embodiments of this application are described below with reference to the accompanying drawings. Further detailed description.
请参见图1,为本申请实施例提供的一种神经网络定点化方法的流程示意图,如图1所示,该神经网络定点化方法可以包括以下步骤S100和S110。Please refer to FIG. 1, which is a schematic flowchart of a neural network fixed-pointing method provided by an embodiment of this application. As shown in FIG. 1, the neural network fixed-pointing method may include the following steps S100 and S110.
步骤S100、对于神经网络的待定点化单元,基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参。Step S100: For the to-be-fixed unit of the neural network, based on the data distribution of the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, determine the characteristic value output by the to-be-fixed unit The fixed-point super-parameters.
本申请实施例中,考虑到一次性给原始模型输入一定数量的样本图片来实现对各层输出的特征值的定点化的实现方案中,在前的层完成定点化后,对于在后的层,其输入依然是在前的层为浮点状态下的输出,数据分布的真实性较差。In the embodiment of this application, considering that a certain number of sample pictures are input to the original model at one time to realize the fixed point of the output feature value of each layer, after the previous layer is fixed, the latter layer , The input is still the output in the floating-point state of the previous layer, and the authenticity of the data distribution is poor.
为了得到神经网络各层输出的特征值更加真实的数据分布,以提升神经网络定点化的性能,可以按照神经网络各层从前到后的顺序,以一层或连续多层为一个单元的方式,将神经网络划分为多个单元,并逐单元对神经网络进行定点化,当对神经网络的某个单元进行定点化时,保持该单元(可以称为待定点化单元)之前的单元(可以称为已定点化单元)为定点化状态,并基于已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参。In order to obtain a more realistic data distribution of the eigenvalues output by each layer of the neural network, and to improve the performance of the neural network fixed point, you can follow the order of each layer of the neural network from front to back, with one layer or continuous multiple layers as a unit, Divide the neural network into multiple units, and fix the neural network unit by unit. When a unit of the neural network is fixed, keep the unit (which can be called the pending unit) before the unit (which can be called Is a fixed-point unit) is in a fixed-point state, and based on the data distribution of the feature value output by the to-be-fixed unit under the condition that the fixed-point unit remains in the fixed-point state, the fixed-point of the feature value output by the to-be-fixed unit is determined Super parameters.
在本申请实施例中,当待定点化单元为神经网络的首个待定点化单元时,例如,神经网络的第一个单元,神经网络中未包括已定点化单元,此时,可以基于该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参,并基于该定点化超参对该待定点化单元输出的特征值进行定点化。In the embodiment of the present application, when the unit to be fixed is the first unit to be fixed in the neural network, for example, the first unit of the neural network, the neural network does not include the fixed unit, in this case, it can be based on the The data distribution of the characteristic value output by the to-be-fixed unit determines the fixed-point hyperparameter of the characteristic value output by the to-be-fixed unit, and fixes the characteristic value output by the to-be-fixed unit based on the fixed super parameter.
举例来说,假设神经网络包括两个单元(假设为单元1和单元2),则可以依次对单元1和单元2进行定点化。当对单元1进行定点化时(即待定点化单元为单元1),可以通过向神经网络输入一定数量的样本,统计单元1输出的特征值的数据分布,并基于单元1输出的特征值的数据分布,确定单元1输出的特征值的定点化超参,基于所确定的定点化超参对单元1输出的特征值进行定点化。For example, suppose the neural network includes two units (assumed as
在完成对单元1的定点化之后,当对单元2进行定点化时(即待定点化单元为单元2),可以保持单元1为定点化状态,向神经网络输入一定数量的样本,统计单元2输出的特征值的数据分布,并基于单元2输出的特征值的数据分布,确定单元2输出的特征值的定点化超参。After the fixed-pointing of
在本申请实施例中,当对神经网络的待定点化单元进行定点化时,若该待定点化单元之前存在多个已定点化单元,则也可以在该多个已定点化单元中的部分已定点化单元保持定点化状态的情况下,对该待定点化单元进行定点化,其具体实现在此不做赘述。In the embodiment of the present application, when the to-be-fixed unit of the neural network is fixed, if there are multiple fixed-point units before the to-be-fixed unit, it can also be used in some of the multiple fixed-point units. In the case that the fixed-point unit maintains the fixed-point state, the pending unit is fixed-pointed, and its specific implementation is not repeated here.
步骤S110、基于该定点化超参对该待定点化单元输出的特征值进行定点化。In step S110, the characteristic value output by the unit to be fixed is fixed based on the fixed super parameter.
本申请实施例中,当按照步骤S100中描述的方式确定了待定点化单元输出的特征 值的定点化超参时,可以基于该定点化超参对该待定点化单元输出的特征值进行定点化。In the embodiment of the present application, when the fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit is determined in the manner described in step S100, the characteristic value output by the to-be-fixed unit can be fixed based on the fixed-pointing super-parameter. change.
可见,在图1所示方法流程中,通过对神经网络进行逐单元的定点化,对于神经网络的待定点化单元,保持已定点化单元为定点化状态,以得到更加真实的输出特征值的数据分布,从而,提升神经网络定点化的性能。It can be seen that in the method flow shown in Figure 1, the neural network is fixed unit by unit, and for the pending unit of the neural network, the fixed unit is kept in a fixed state to obtain a more realistic output feature value. Data distribution, thus, improve the performance of neural network fixed-point.
在一种可能的实施例中,请参见图2,在步骤S100中,在确定待定点化单元输出的特征值的定点化超参之后,本申请实施例提供的神经网络定点化方法还可以包括以下步骤:步骤S101、基于该待定点化单元输出的特征值的定点化超参,确定第一定点化超参候选值范围;步骤S102、从该第一定点化超参候选值范围中确定该待定点化单元输出的特征值的最终定点化超参。In a possible embodiment, referring to FIG. 2, in step S100, after determining the fixed-pointing hyperparameter of the feature value output by the to-be-fixed unit, the neural network fixed-pointing method provided in the embodiment of the present application may further include The following steps: step S101, determine a first fixed-point super-parameter candidate value range based on the fixed-point super-parameter of the characteristic value output by the to-be-fixed unit; step S102, from the first fixed-point super-parameter candidate value range Determine the final fixed-point hyperparameter of the eigenvalue output by the to-be-fixed unit.
在步骤S110中,基于该待定点化超参对该待定点化单元输出的特征值进行定点化,包括:步骤S111、基于该待定点化单元输出的特征值的最终定点化超参对该待定点化单元输出的特征值进行定点化。In step S110, the characteristic value output by the to-be-fixed unit is fixed based on the to-be-fixed super-parameter, including: step S111, the final fixed-pointing super-parameter based on the characteristic value output by the to-be-fixed unit is The eigenvalues output by the pointization unit are fixed-pointed.
示例性的,在按照步骤S100中描述的方式确定了待定点化单元输出的特征值的定点化超参时,还可以对所确定的定点化超参进行优化,以得到实际用于对该待定点化单元输出的特征值进行定点化的定点化超参(本文中称为最终定点化超参),以进一步提升神经网络定点化的性能。Exemplarily, when the fixed-point super-parameter of the characteristic value output by the to-be-fixed unit is determined in the manner described in step S100, the determined fixed-point super-parameter may also be optimized to obtain the actual use of the to-be-determined super-parameter. The eigenvalues output by the initiation unit are used for fixed-point fixed-point super-parameters (referred to as final fixed-point super-parameters in this article) to further improve the performance of the neural network fixed-point.
示例性的,可以基于步骤S100中确定的待定点化单元输出的特征值的定点化超参,确定用于搜索最终定点化超参的范围(本文中称为第一定点化超参候选值范围),并从该第一定点化超参候选值范围中确定该待定点化单元输出的特征值的最终定点化超参。Exemplarily, based on the fixed-pointing hyperparameters of the feature values output by the to-be-fixed unit determined in step S100, the range for searching for the final fixed-pointing hyperparameters (herein referred to as the first fixed-pointing hyperparameter candidate value) may be determined. Range), and determine the final fixed-point super-parameter of the characteristic value output by the to-be-fixed unit from the first fixed-point super-parameter candidate value range.
示例性的,该第一定点化超参候选值范围可以为包括步骤S100中确定的定点化超参的一个数值区间。Exemplarily, the first fixed-point hyperparameter candidate value range may be a numerical interval including the fixed-point hyperparameter determined in step S100.
例如,可以通过在步骤S100中确定的定点化超参的基础上分别减去和加上一个大于0的特定值,得到第一定点化超参候选值范围的下限和上限,从而,确定第一定点化超参候选值范围。或者,可以以步骤S100中确定的定点化超参为第一定点化超参候选值范围的下限,并在该下限的基础上加上一个大于0的特定值,得到第一定点化超参候选值范围的上限,从而,确定第一定点化超参候选值范围。For example, the lower limit and upper limit of the candidate value range of the first fixed-point super-parameter can be obtained by subtracting and adding a specific value greater than 0 on the basis of the fixed-point super-parameter determined in step S100, thereby determining the first fixed-point super-parameter. The range of hyperparameter candidate values is fixed. Alternatively, the fixed-point super-parameter determined in step S100 may be used as the lower limit of the first fixed-point super-parameter candidate value range, and a specific value greater than 0 can be added to the lower limit to obtain the first fixed-point super-parameter. The upper limit of the parameter candidate value range is determined, thereby determining the first fixed-point hyperparameter candidate value range.
下文中的第二定点化超参候选值范围以及第三定点化超参候选值范围的确定同理可得,本申请实施例后续不再复述。The determination of the second fixed-pointed super-parameter candidate value range and the third fixed-pointed super-parameter candidate value range below can be obtained in the same way, and will not be repeated in the embodiments of the present application.
在一个示例中,如图3所示,步骤S102,从该第一定点化超参候选值范围中确定该待定点化单元输出的特征值的最终定点化超参,可通过以下步骤实现:步骤S1021、分别确定该第一定点化超参候选值范围中各候选值对应的神经网络的输出误差;步骤S1022、将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元输出的特征值的最终定点化超参。In an example, as shown in FIG. 3, step S102, determining the final fixed-pointing hyper-parameter of the characteristic value output by the to-be-fixed unit from the first fixed-pointing super-parameter candidate value range can be implemented by the following steps: Step S1021, respectively, determine the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range; step S1022, determine the candidate value with the smallest output error of the corresponding neural network as the pending point The final fixed-point hyperparameter of the eigenvalue output by the unit.
示例性的,可以基于神经网络的输出误差对待定点化单元输出的特征值的定点化超参进行优化,选择使神经网络的输出误差最小的定点化超参作为待定点化单元输出的特征值的最终定点化超参。Exemplarily, based on the output error of the neural network, the fixed-point hyperparameter of the eigenvalue output by the fixed-point unit can be optimized, and the fixed-point hyperparameter that minimizes the output error of the neural network can be selected as the eigenvalue output by the to-be-fixed unit Finally, the super-parameters are fixed.
在确定了第一定点化超参候选值范围时,可以分别确定第一定点化超参候选值范围中各候选值对应的神经网络的输出误差,并将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元输出的特征值的最终定点化超参。When the first fixed-point hyperparameter candidate value range is determined, the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range can be determined separately, and the output error of the corresponding neural network can be minimized The candidate value of is determined as the final fixed-pointing hyperparameter of the feature value output by the to-be-fixed-pointing unit.
在本申请实施例中,将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元输出的特征值的最终定点化超参仅仅是本申请实施例中确定定点化超参的一种实现方式,而并不是对本申请保护范围的限定,在本申请实施例中,还可以通过其他方 式确定待定点化单元输出的特征值的最终定点化超参。In the embodiment of the present application, determining the candidate value with the smallest output error of the corresponding neural network as the final fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit is only the determination of the fixed-pointing hyperparameter in the embodiment of this application. It is an implementation manner and is not a limitation of the protection scope of the present application. In the embodiments of the present application, the final fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit can also be determined in other ways.
例如,可以将对应的神经网络的输出误差小于预设阈值的候选值的平均值确定为待定点化单元输出的特征值的最终定点化超参。或者,可以按照对应的神经网络的输出误差从小到大的顺序对各候选值进行排序,并将排序后的前预设数量的候选值的平均值确定为待定点化单元输出的特征值的最终定点化超参。For example, the average value of the candidate values whose output error of the corresponding neural network is less than the preset threshold can be determined as the final fixed-pointing hyperparameter of the feature value output by the to-be-fixed unit. Alternatively, the candidate values can be sorted according to the output error of the corresponding neural network from small to large, and the average value of the previously preset number of candidate values after sorting can be determined as the final feature value output by the unit to be fixed. Fixed-point super-parameters.
在一个示例中,步骤S1021中,分别确定该第一定点化超参候选值范围中各候选值对应的神经网络的输出误差,可以包括:对于任一候选值,基于第一类型特征值以及第二类型特征值确定该候选值对应的神经网络的输出误差。In an example, in step S1021, respectively determining the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range may include: for any candidate value, based on the first type feature value and The second type feature value determines the output error of the neural network corresponding to the candidate value.
示例性的,考虑到相对于原始浮点状态的神经网络,对神经网络进行定点化处理可能会给神经网络的输出精度带来误差,而定点化后的神经网络的输出与原始浮点状态的神经网络的输出的误差越小,表明定点化后的神经网络的输出精度越高,因此,可以基于定点化后的神经网络的输出与原始浮点状态的神经网络的输出的误差来对定点化超参进行优化。Exemplarily, considering the neural network in the original floating-point state, the fixed-point processing of the neural network may bring errors to the output accuracy of the neural network, and the output of the fixed-point neural network is different from the original floating-point state. The smaller the output error of the neural network, the higher the output accuracy of the fixed-point neural network. Therefore, the fixed-point can be fixed based on the error between the output of the fixed-point neural network and the output of the neural network in the original floating-point state Super parameters are optimized.
对于第一定点化超参候选值范围中的任一候选值,可以分别确定使用该候选值对该定点化单元输出的特征值进行定点化时,神经网络各单元输出的特征值(本文中称为第一类型特征值),以及,原始浮点状态下,神经网络各单元输出的特征值(本文中称为第二类型特征值),确定该候选值对应的神经网络的输出误差,其具体实现可以在下文中结合具体实例进行说明,本申请实施例在此不做赘述。For any candidate value in the first fixed-point hyperparameter candidate value range, it is possible to determine the characteristic value output by each unit of the neural network when using the candidate value to fix the characteristic value output by the fixed-point unit (herein (Referred to as the first type feature value), and, in the original floating point state, the feature value output by each unit of the neural network (herein referred to as the second type feature value), determine the output error of the neural network corresponding to the candidate value, which The specific implementation may be described below in conjunction with specific examples, and the embodiments of the present application will not be repeated here.
在一种可能的实施例中,如图4所示,本申请实施例提供的神经网络定点化方法还可以包括以下步骤S400、S410、S420、S430。In a possible embodiment, as shown in FIG. 4, the neural network positioning method provided in the embodiment of the present application may further include the following steps S400, S410, S420, and S430.
步骤S400、对于神经网络的待定点化单元,基于该待定点化单元的权值的数据分布,确定该待定点化单元的权值的定点化超参。Step S400: For the to-be-fixed unit of the neural network, based on the data distribution of the weight of the to-be-fixed unit, determine the fixed-point hyperparameter of the weight of the to-be-fixed unit.
步骤S410、基于该待定点化单元的权值的定点化超参,确定第二定点化超参候选值范围。Step S410, based on the fixed-pointed super-parameter of the weight of the to-be-fixed unit, determine a second fixed-pointed super-parameter candidate value range.
步骤S420、从该第二定点化超参候选值范围中确定该待定点化单元的权值的最终定点化超参。Step S420: Determine the final fixed super parameter of the weight value of the to-be-fixed unit from the second fixed super parameter candidate value range.
步骤S430、基于该待定点化单元的权值的最终定点化超参对该待定点化单元的权值进行定点化。In step S430, the weight of the unit to be fixed is fixed based on the final super-parameter of the weight of the unit to be fixed.
示例性的,为了实现神经网络的定点化,对于神经网络的待定点化单元,除了可以按照上述实施例中描述的方式对待定点化单元输出的特征值进行定点化之外,还需要对待定点化单元的权值进行定点化。Exemplarily, in order to realize the fixed point of the neural network, for the to-be-fixed unit of the neural network, in addition to the characteristic value output by the to-be-fixed unit can be fixed according to the method described in the above embodiment, it also needs to be fixed. The weight of the unit is fixed-point.
由于传统的神经网络定点化方案中,对于原始浮点状态的神经网络,各单元的浮点状态的权值在神经网络训练完毕(此时神经网络为原始浮点状态)时就已经确定,各单元的浮点状态的权值的数据分布并不受在前单元的定点化的影响,因此,对于神经网络的权值,在对神经网络的待定点化单元的权值进行定点化时,其具体实现可以参考传统的神经网络定点化方案中的相关实现。Because in the traditional neural network fixed-point solution, for the neural network in the original floating-point state, the weight of the floating-point state of each unit has been determined when the neural network is trained (the neural network is in the original floating-point state at this time). The data distribution of the weights of the floating-point state of the unit is not affected by the fixation of the previous unit. Therefore, for the weights of the neural network, when the weights of the to-be-fixed units of the neural network are fixed, the The specific implementation can refer to the related implementation in the traditional neural network fixed-point solution.
示例性的,与上述实施例中描述的待定点化单元输出的特征值的定点化类似的,对于权值,在确定了待定点化单元的权值的定点化超参时,可以对所确定的定点化超参进行优化,以得到实际用于对该待定点化单元的权值进行定点化的定点化超参(本文中称为最终定点化超参),以进一步提升神经网络定点化的性能。Exemplarily, similar to the fixed-pointing of the feature value output by the to-be-fixed unit described in the foregoing embodiment, for the weight, when the fixed-pointing hyperparameter of the weight of the to-be-fixed unit is determined, the determined Optimize the fixed-point super-parameters to obtain the fixed-point super-parameters that are actually used to fix the weights of the to-be-fixed units (referred to as the final fixed-point super-parameters in this article) to further improve the fixed-pointing of the neural network performance.
示例性的,可以基于所确定的待定点化单元的权值的定点化超参,确定用于搜索待 定点化单元的权值的最终定点化超参的范围(本文中称为第二定点化超参候选值范围),并从该第二定点化超参候选值范围中确定该待定点化单元的权值的最终定点化超参,进而,基于该待定点化单元的权值的最终定点化超参对该待定点化单元的权值进行定点化。Exemplarily, based on the determined fixed-pointing super-parameters of the weights of the to-be-fixed units, the range of the final fixed-pointing super-parameters used to search for the weights of the to-be-fixed units (referred to as the second fixed-pointing in this article) may be determined. Hyperparameter candidate value range), and determine the final fixed-point hyperparameter of the weight of the to-be-fixed unit from the second fixed-pointed super-parameter candidate value range, and further, the final fixed-point based on the weight of the to-be-fixed unit The super-parameters are used to fix the weights of the units to be fixed.
在一个示例中,如图5所示,步骤S420中,从该第二定点化超参候选值范围中确定该待定点化单元的权值的最终定点化超参,可以包括以下步骤:步骤S421、分别确定该第二定点化超参候选值范围中各候选值对应的神经网络的输出误差;步骤S422、将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元的权值的最终定点化超参。In an example, as shown in FIG. 5, in step S420, determining the final fixed super parameter of the weight of the to-be-fixed unit from the second fixed super parameter candidate value range may include the following steps: step S421 , Respectively determine the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range; step S422, determine the candidate value with the smallest output error of the corresponding neural network as the weight of the to-be-fixed unit The final fixed-point hyperparameter of the value.
示例性的,可以基于神经网络的输出误差对待定点化单元的权值的定点化超参进行优化,选择使神经网络的输出误差最小的定点化超参作为待定点化单元的权值的最终定点化超参。Exemplarily, the fixed-point hyperparameter of the weight of the fixed-point unit can be optimized based on the output error of the neural network, and the fixed-point super-parameter that minimizes the output error of the neural network can be selected as the final fixed point of the weight of the to-be-fixed unit化超参.
在确定了第二定点化超参候选值范围时,可以分别确定第二定点化超参候选值范围中各候选值对应的神经网络的输出误差,并将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元的权值的最终定点化超参。When the second fixed-point hyperparameter candidate value range is determined, the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range can be determined separately, and the candidate with the smallest output error of the corresponding neural network can be determined The value is determined as the final fixed-pointing hyperparameter of the weight of the to-be-fixed unit.
在一个示例中,步骤S421中,分别确定该第二定点化超参候选值范围中各候选值对应的神经网络的输出误差,可以包括:对于任一候选值,基于第三类型特征值以及第四类型特征值确定该候选值对应的神经网络的输出误差。In an example, in step S421, respectively determining the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range may include: for any candidate value, based on the third type feature value and the first The four types of feature values determine the output error of the neural network corresponding to the candidate value.
示例性的,考虑到相对于原始浮点状态的神经网络,对神经网络进行定点化处理可能会给神经网络的输出精度带来误差,而定点化后的神经网络的输出与原始浮点状态的神经网络的输出的误差越小,表明定点化后的神经网络的输出精度越高,因此,可以基于定点化后的神经网络的输出与原始浮点状态的神经网络的输出的误差来对定点化超参进行优化。Exemplarily, considering the neural network in the original floating-point state, the fixed-point processing of the neural network may bring errors to the output accuracy of the neural network, and the output of the fixed-point neural network is different from the original floating-point state. The smaller the output error of the neural network, the higher the output accuracy of the fixed-point neural network. Therefore, the fixed-point can be fixed based on the error between the output of the fixed-point neural network and the output of the neural network in the original floating-point state Super parameters are optimized.
对于第二定点化超参候选值范围中的任一候选值,可以分别确定使用该候选值对该定点化单元的权值进行定点化时,神经网络各单元输出的特征值(本文中称为第三类型特征值),以及,原始浮点状态下,神经网络各单元输出的特征值(本文中称为第四类型特征值),确定该候选值对应的神经网络的输出误差,其具体实现可以在下文中结合具体实例进行说明,本申请实施例在此不做赘述。For any candidate value in the second fixed-point hyperparameter candidate value range, the eigenvalues output by each unit of the neural network when the weight of the fixed-point unit is fixed using the candidate value (referred to herein as The third type feature value), and, in the original floating point state, the feature value output by each unit of the neural network (herein referred to as the fourth type feature value), determine the output error of the neural network corresponding to the candidate value, and its specific implementation It may be described below in conjunction with specific examples, and the embodiments of the present application will not be repeated here.
在一种可能的实施例中,步骤S100中,对于神经网络的待定点化单元,基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参之前,本申请实施例提供的神经网络定点化方法还可以包括:基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化。In a possible embodiment, in step S100, for the to-be-fixed unit of the neural network, based on the data distribution of the feature value output by the to-be-fixed unit under the condition that the fixed unit of the neural network remains fixed, Before determining the fixed-pointing hyperparameter of the feature value output by the to-be-fixed unit, the neural network fixed-pointing method provided in the embodiment of the present application may further include: the pending point is based on the situation that the fixed-pointed unit of the neural network maintains the fixed-pointing state The eigenvalues output by the transformation unit, and the eigenvalues output by the to-be-fixed unit in the original floating-point state, optimize the weight of the to-be-fixed unit.
示例性的,考虑到对神经网络的每一层进行定点化之后,可能会出现精度上的误差,随着层数加深,定点化上的累计误差可能会对神经网络整体的性能带来较大的影响,因此,减少每一层定点化所带来的偏差,可减少神经网络的每一层在定点化后的精度损失,提升神经网络的整体性能。Exemplarily, considering that each layer of the neural network is fixed-pointed, there may be errors in accuracy. As the number of layers deepens, the cumulative error in fixed-pointing may bring a greater impact on the overall performance of the neural network. Therefore, reducing the deviation caused by the fixed-pointing of each layer can reduce the accuracy loss of each layer of the neural network after the fixed-pointing, and improve the overall performance of the neural network.
示例性的,对于神经网络的待定点化单元,在按照上述实施例中描述的方式对该待定点化单元输出的特征值进行定点化之前,可以先基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化。Exemplarily, for the to-be-fixed unit of the neural network, before the eigenvalues output by the to-be-fixed unit are fixed in the manner described in the above embodiment, the fixed-point unit based on the neural network may be kept fixed. The eigenvalue output by the to-be-fixed unit in the state of the state and the characteristic value output by the to-be-fixed unit in the original floating-point state are optimized for the weight of the to-be-fixed unit.
当待定点化单元为神经网络的首个待定点化单元时,由于该待定点化单元之前不存 在已定点化单元,因此,对于神经网络的首个待定点化单元,可不执行权值的优化处理。When the to-be-fixed unit is the first to-be-fixed unit of the neural network, since there is no fixed-point unit before the to-be-fixed unit, the weight optimization may not be performed for the first to-be-fixed unit of the neural network handle.
在一个示例中,上述基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化,可以包括:对该待定点化单元的权值进行优化,以使神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值二者之间的误差最小。In one example, the above-mentioned neural network-based fixed-point unit maintains the fixed-point state of the characteristic value output by the to-be-fixed unit and the characteristic value output by the to-be-fixed unit in the original floating-point state. Optimizing the weight of the to-be-fixed unit may include: optimizing the weight of the to-be-fixed unit, so that the fixed-point unit of the neural network maintains the fixed-point state of the characteristic value output by the to-be-fixed unit , And, the error between the eigenvalues output by the to-be-fixed unit in the original floating-point state is the smallest.
示例性的,可以基于神经网络的已定点化单元保持定点化状态的情况下待定点化单元输出的特征值,以及,原始浮点状态下,待定点化单元输出的特征值,确定二者之间的误差,以最小化该误差原则来优化待定点化单元的权值,其具体实现可以在下文中结合具体实例进行说明,本申请实施例在此不做赘述。Exemplarily, one may be determined based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network remains in the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state. The weight value of the unit to be fixed is optimized based on the principle of minimizing the error. The specific implementation can be described below in conjunction with specific examples, and the embodiments of the present application will not be repeated here.
请参见图6,为本申请实施例提供的一种神经网络定点化方法的流程示意图,如图6所示,该神经网络定点化方法可以包括以下步骤S600、S610。Please refer to FIG. 6, which is a schematic flowchart of a neural network fixed-pointing method provided by an embodiment of this application. As shown in FIG. 6, the neural network fixed-pointing method may include the following steps S600 and S610.
步骤S600、对于神经网络的待定点化单元,基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化。Step S600: For the to-be-fixed unit of the neural network, the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the output of the to-be-fixed unit in the original floating-point state The eigenvalues of, optimize the weight of the unit to be fixed.
本申请实施例中,为了提升神经网络定点化的灵活性,可以将神经网络按照一层或连续多层一个单元的方式,划分为多个单元,并逐单元对神经网络进行定点化。In the embodiments of the present application, in order to improve the flexibility of neural network fixed-pointing, the neural network can be divided into multiple units according to one layer or continuous multiple layers of one unit, and the neural network can be fixed-pointed unit by unit.
考虑到对神经网络的每一层进行定点化之后,可能会出现精度上的误差,随着层数加深,定点化上的累计误差可能会对神经网络整体的性能带来较大的影响,因此,减少每一层定点化所带来的偏差,可以减少神经网络的每一层在定点化后的精度损失,提升神经网络的整体性能。Considering that after each layer of the neural network is fixed-pointed, there may be errors in accuracy. As the number of layers deepens, the cumulative error in fixed-pointing may have a greater impact on the overall performance of the neural network, so , To reduce the deviation caused by the fixed point of each layer, can reduce the accuracy loss of each layer of the neural network after the fixed point, and improve the overall performance of the neural network.
示例性的,可以基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化。Exemplarily, based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state, the The weights of the pointized units are optimized.
对于神经网络的首个待定点化单元,由于该待定点化单元之前不存在已定点化单元,因此,可以不执行权值的优化处理。For the first to-be-fixed unit of the neural network, since there is no fixed-point unit before the to-be-fixed unit, the optimization processing of the weight may not be performed.
步骤S610、对优化后的该待定点化单元进行定点化。In step S610, the optimized unit to be fixed is fixed.
本申请实施例中,当按照步骤S600中描述的方式对待定点化单元的权值进行了优化时,可以对优化后的该待定点化单元进行定点化。In the embodiment of the present application, when the weight of the unit to be fixed is optimized in the manner described in step S600, the optimized unit to be fixed can be fixed.
可见,在图6所示方法流程中,通过将神经网络划分为多个单元,并逐单元进行定点化处理,提升了神经网络的定点化的灵活性;此外,在对待定点化单元进行定点化之前,对待定点化单元的权值进行优化,减少在前的已定点化单元的定点化带来的误差,减少了神经网络定点化的精度损失,提升了神经网络定点化的性能。It can be seen that in the method flow shown in Figure 6, the neural network is divided into multiple units and fixed-point processing is performed unit by unit, which improves the flexibility of the fixed-point neural network; in addition, when the unit to be fixed is fixed-pointed Previously, the weight of the fixed-point unit was optimized to reduce the error caused by the fixed-pointization of the previous fixed-point unit, reduce the accuracy loss of the neural network fixed-point, and improve the performance of the neural network fixed-point.
在一种可能的实施例中,步骤S600中,基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化,可以包括:对该待定点化单元的权值进行优化,以使神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值二者之间的误差最小。In a possible embodiment, in step S600, the characteristic value output by the to-be-fixed unit under the condition that the neural network-based fixed-point unit remains in the fixed-point state, and the to-be-fixed unit in the original floating-point state The output feature value, optimizing the weight of the to-be-fixed unit may include: optimizing the weight of the to-be-fixed unit, so that the fixed-point unit of the neural network maintains the fixed-point state. The error between the characteristic value output by the initiation unit and the characteristic value output by the to-be-fixed initiation unit in the original floating-point state is the smallest.
示例性的,可以基于神经网络的已定点化单元保持定点化状态的情况下待定点化单元输出的特征值,以及,原始浮点状态下,待定点化单元输出的特征值,确定二者之间的误差,以最小化该误差原则来优化待定点化单元的权值,其具体实现可以在下文中结 合具体实例进行说明,本申请实施例在此不做赘述。Exemplarily, one may be determined based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network remains in the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state. To optimize the weight of the unit to be fixed based on the principle of minimizing the error between the two, the specific implementation can be described below in conjunction with specific examples, and the embodiments of the present application will not repeat them here.
在一种可能的实施例中,步骤S610中,对优化后的该待定点化单元进行定点化,可以包括:基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定优化后的该待定点化单元输出的特征值的定点化超参,并基于该定点化超参对优化后的该待定点化单元输出的特征值进行定点化。In a possible embodiment, in step S610, the optimization of the to-be-fixed unit may include: output of the to-be-fixed unit under the condition that the fixed-point unit based on the neural network maintains the fixed-point state According to the data distribution of the characteristic value, the optimized fixed-point hyperparameter of the characteristic value output by the to-be-fixed unit is determined, and based on the fixed-point super-parameter, the optimized characteristic value output by the to-be-fixed unit is fixed.
示例性的,考虑到一次性给原始模型输入一定数量的样本图片来实现对各层输出的特征值的定点化的实现方案中,在前的层完成定点化后,对于在后的层,其输入依然是在前的层为浮点状态下的输出,数据分布的真实性较差。Exemplarily, considering that a certain number of sample pictures are input to the original model at one time to realize the fixed point of the output feature value of each layer, after the previous layer is fixed, for the latter layer, it The input is still the output in the floating-point state of the previous layer, and the authenticity of the data distribution is poor.
为了得到神经网络各层输出的特征值更加真实的数据分布,以提升神经网络定点化的性能,可以按照神经网络各层从前到后的顺序,以一层或连续多层为一个单元的方式,将神经网络划分为多个单元,并逐单元对神经网络进行定点化,当对神经网络的某个单元进行定点化时,保持该单元(即待定点化单元)之前的单元(即已定点化单元)为定点化状态,并基于已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参。In order to obtain a more realistic data distribution of the eigenvalues output by each layer of the neural network, and to improve the performance of the neural network fixed point, you can follow the order of each layer of the neural network from front to back, with one layer or continuous multiple layers as a unit, Divide the neural network into multiple units, and fix the neural network unit by unit. When a unit of the neural network is fixed, keep the unit before the unit (that is, the unit to be fixed) (that is, it has been fixed) The unit) is in a fixed-point state, and based on the data distribution of the feature value output by the to-be-fixed unit under the condition that the fixed-point unit remains in the fixed-point state, the fixed-point hyperparameter of the feature value output by the to-be-fixed unit is determined.
在本申请实施例中,当待定点化单元为神经网络的首个待定点化单元时,例如,神经网络的第一个单元,神经网络中未包括已定点化单元,此时,可以基于该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参,并基于该定点化超参对该待定点化单元输出的特征值进行定点化。In the embodiment of the present application, when the unit to be fixed is the first unit to be fixed in the neural network, for example, the first unit of the neural network, the neural network does not include the fixed unit, in this case, it can be based on the The data distribution of the characteristic value output by the to-be-fixed unit determines the fixed-point super-parameter of the characteristic value output by the to-be-fixed unit, and fixes the characteristic value output by the to-be-fixed unit based on the fixed super-parameter.
当确定了优化后的待定点化单元输出的特征值的定点化超参时,可以基于所确定的定点化超参对优化后的该待定点化单元输出的特征值进行定点化。When the fixed-point hyperparameter of the characteristic value output by the optimized unit to be fixed is determined, the characteristic value output by the optimized unit to be fixed can be fixed based on the determined super-parameter.
在一个示例中,在确定优化后的该待定点化单元输出的特征值的定点化超参之后,还可以包括:基于优化后的该待定点化单元输出的特征值的定点化超参,确定第三定点化超参候选值范围;从该第三定点化超参候选值范围中确定优化后的该待定点化单元输出的特征值的最终定点化超参。相应地,上述基于该定点化超参对优化后的该待定点化单元输出的特征值进行定点化,可以包括:基于该待定点化单元输出的特征值的最终定点化超参对优化后的该待定点化单元输出的特征值进行定点化。In an example, after determining the optimized fixed-pointing hyperparameters of the characteristic values output by the to-be-fixed unit, it may further include: determining the fixed-pointing hyperparameters based on the optimized characteristic values output by the to-be-fixed unit, The third fixed-point super-parameter candidate value range; the final fixed-point super-parameter of the characteristic value output by the to-be-fixed unit after optimization is determined from the third fixed-point super-parameter candidate value range. Correspondingly, the above-mentioned fixed-pointing based on the fixed-pointing super-parameters on the optimized eigenvalues output by the to-be-fixed unit may include: a final fixed-pointing super-parameter pair optimized based on the eigenvalues output by the to-be-fixed unit The eigenvalue output by the to-be-fixed unit is fixed-pointed.
示例性的,当确定了优化后的待定点化单元输出的特征值的定点化超参时,还可以对所确定的定点化超参进行优化,以得到实际用于对优化后的该待定点化单元输出的特征值进行定点化的定点化超参(本文中称为最终定点化超参),以进一步提升神经网络定点化的性能。Exemplarily, when the fixed-point super-parameter of the characteristic value output by the optimized to-be-fixed unit is determined, the determined fixed-point super-parameter can also be optimized to obtain the to-be-fixed point that is actually used for optimization. The eigenvalues output by the transformation unit are used for fixed-point fixed-point super-parameters (referred to as final fixed-point super-parameters in this article) to further improve the performance of neural network fixed-point.
示例性的,可以基于所确定的优化后的待定点化单元输出的特征值的定点化超参,确定用于搜索最终定点化超参的范围(本文中称为第三定点化超参候选值范围),并从该第三定点化超参候选值范围中确定该优化后的待定点化单元输出的特征值的最终定点化超参。Exemplarily, based on the determined fixed-point super-parameters of the characteristic values output by the optimized to-be-fixed unit, the range for searching the final fixed-point super-parameters (referred to herein as the third fixed-point super-parameter candidate value) may be determined. Range), and determine the final fixed-point super-parameter of the characteristic value output by the optimized to-be-fixed unit from the third fixed-point super-parameter candidate value range.
在一个示例中,上述从该第三定点化超参候选值范围中确定优化后的该待定点化单元输出的特征值的最终定点化超参,可以包括:分别确定该第三定点化超参候选值范围中各候选值对应的神经网络的输出误差;将对应的神经网络的输出误差最小的候选值,确定为优化后的该待定点化单元输出的特征值的最终定点化超参。In an example, the foregoing determination of the optimized final fixed-pointing hyperparameters of the characteristic values output by the to-be-fixed unit after optimization from the third fixed-pointing hyperparameter candidate value range may include: respectively determining the third fixed-pointing hyperparameters The output error of the neural network corresponding to each candidate value in the candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the final fixed-pointing hyperparameter of the characteristic value output by the optimized point-to-fixed unit.
示例性的,可以基于神经网络的输出误差对待定点化单元输出的特征值的定点化超参进行优化,选择使神经网络的输出误差最小的定点化超参作为优化后的待定点化单元输出的特征值的最终定点化超参。Exemplarily, the fixed-point hyperparameters of the characteristic value output by the fixed-point unit can be optimized based on the output error of the neural network, and the fixed-point super-parameter that minimizes the output error of the neural network can be selected as the output of the optimized to-be-fixed unit The final fixed-point hyperparameter of the eigenvalue.
在确定了第三定点化超参候选值范围时,可以分别确定第三定点化超参候选值 范围中各候选值对应的神经网络的输出误差,并将对应的神经网络的输出误差最小的候选值,确定为优化后的该待定点化单元输出的特征值的最终定点化超参。When the third fixed-point hyperparameter candidate value range is determined, the output error of the neural network corresponding to each candidate value in the third fixed-point hyperparameter candidate value range can be determined separately, and the candidate with the smallest output error of the corresponding neural network can be determined The value is determined as the final fixed-pointing hyperparameter of the eigenvalue output by the pending-pointing unit after optimization.
在一个示例中,上述分别确定该第三定点化超参候选值范围中各候选值对应的神经网络的输出误差,可以包括:对于任一候选值,基于第五类型特征值以及第六类型特征值确定该候选值对应的神经网络的输出误差。In an example, the foregoing determination of the output error of the neural network corresponding to each candidate value in the third fixed-point hyperparameter candidate value range may include: for any candidate value, based on the fifth-type feature value and the sixth-type feature The value determines the output error of the neural network corresponding to the candidate value.
示例性的,考虑到相对于原始浮点状态的神经网络,对神经网络进行定点化处理可能会给神经网络的输出精度带来误差,而定点化后的神经网络的输出与原始浮点状态的神经网络的输出的误差越小,表明定点化后的神经网络的输出精度越高,因此,可以基于定点化后的神经网络的输出与原始浮点状态的神经网络的输出的误差来对定点化超参进行优化。Exemplarily, considering the neural network in the original floating-point state, the fixed-point processing of the neural network may bring errors to the output accuracy of the neural network, and the output of the fixed-point neural network is different from the original floating-point state. The smaller the output error of the neural network, the higher the output accuracy of the fixed-point neural network. Therefore, the fixed-point can be fixed based on the error between the output of the fixed-point neural network and the output of the neural network in the original floating-point state Super parameters are optimized.
对于第三定点化超参候选值范围中的任一候选值,可以分别确定使用该候选值对优化后的该定点化单元输出的特征值进行定点化时,神经网络各单元输出的特征值(本文中称为第五类型特征值),以及,原始浮点状态下,神经网络各单元输出的特征值(本文中称为六类型特征值),确定该候选值对应的神经网络的输出误差,其具体实现可以在下文中结合具体实例进行说明,本申请实施例在此不做赘述。For any candidate value in the third fixed-point hyperparameter candidate value range, the characteristic value output by each unit of the neural network ( This article is called the fifth type feature value), and, in the original floating point state, the feature value output by each unit of the neural network (herein referred to as the six type feature value), determine the output error of the neural network corresponding to the candidate value, The specific implementation can be described below in conjunction with specific examples, and the embodiments of the present application will not be repeated here.
在本申请实施例中,对于神经网络的待定点化单元,除了需要对待定点化单元输出的特征值进行定点化之外,还需要对待定点化单元的权值进行定点化。由于待定点化单元的权值并不受神经网络的已定点化单元的影响,因此,在按照图6所示方法流程对待定点化单元的权值进行优化后,可以参照传统神经网络定点化方案中对权值的定点化的实现方式,对优化后的待定点化单元的权值进行定点化。In the embodiment of the present application, for the to-be-fixed unit of the neural network, in addition to the characteristic value output by the to-be-fixed unit, the weight of the to-be-fixed unit needs to be fixed. Since the weight of the unit to be fixed is not affected by the fixed unit of the neural network, after optimizing the weight of the unit to be fixed according to the method shown in Figure 6, you can refer to the traditional neural network fixed-point solution In the implementation of fixed-point weighting, the weights of the optimized units to be fixed-point are fixed-pointed.
示例性的,对于神经网络的待定点化单元,当基于优化后的该待定点化单元的权值的数据分布确定了权值的定点化超参时,还可以对所确定的定点化超参进行优化,以确定最终定点化超参。Exemplarily, for the to-be-fixed unit of the neural network, when the weighted fixed-point hyperparameter is determined based on the optimized data distribution of the weight of the to-be-fixed unit, the determined fixed-point hyperparameter can also be determined. Carry out optimization to determine the final fixed-point hyperparameters.
在一个示例中,对优化后的该待定点化单元进行定点化,可以包括:基于优化后的该待定点化单元的权值的数据分布,确定优化后的该待定点化单元的权值的定点化超参;基于优化后的该待定点化单元的权值的定点化超参,确定第四定点化超参候选值范围;从该第四定点化超参候选值范围中确定优化后的该待定点化单元的权值的最终定点化超参;基于优化后的该待定点化单元的权值的最终定点化超参对优化后的该待定点化单元的权值进行定点化。In an example, the optimization of the to-be-fixed unit may include: determining the optimized weight of the to-be-fixed unit based on the data distribution of the weight of the to-be-fixed unit after optimization. Fixed-point super-parameter; based on the optimized fixed-point super-parameter of the weight of the unit to be fixed, determine the fourth fixed-point super-parameter candidate value range; determine the optimized value from the fourth fixed-point super-parameter candidate value range The final fixed-pointing super parameter of the weight of the to-be-fixed unit; based on the optimized final fixed-pointing super-parameter of the weight of the to-be-fixed unit, the optimized weight of the to-be-fixed unit is fixed.
该示例中各步骤的具体实现可以参见上述方法实施例中的相关描述,本申请实施例在此不做赘述。For the specific implementation of each step in this example, reference may be made to the relevant description in the foregoing method embodiment, and details are not described in the embodiment of the present application.
请参见图7,为本申请实施例提供的一种神经网络定点化方法的流程示意图,如图7所示,该神经网络定点化方法可以包括以下步骤S700、S710、S720、S730。Please refer to FIG. 7, which is a schematic flowchart of a neural network fixed-pointing method provided by an embodiment of this application. As shown in FIG. 7, the neural network fixed-pointing method may include the following steps S700, S710, S720, and S730.
步骤S700、对输入的浮点模型的拓扑结构进行解析,以生成神经网络数据流图。Step S700: Analyze the topological structure of the input floating-point model to generate a neural network data flow graph.
步骤S710、基于配置文件中的样本图片信息,生成神经网络的数据层。Step S710: Generate a data layer of the neural network based on the sample picture information in the configuration file.
步骤S720、基于配置文件中的待部署平台的优化策略,对神经网络的拓扑结构进行拆分和融合,以得到预处理后的浮点模型。Step S720: Based on the optimization strategy of the platform to be deployed in the configuration file, split and merge the topology of the neural network to obtain a preprocessed floating-point model.
本申请实施例中,考虑到从一个神经网络模型的浮点训练完成到实际硬件平台上的部署的过程中,不同应用下神经网络模型结构的复杂性,以及在不同硬件平台上部署应用的限制需求,传统的神经网络定点化方案中,往往需要较多人为参与的过程,才能保证正确的定点化操作。而目前已公开的神经网络定点化工具,如Neural Network Distiller或PocketFlow等,虽然集成了较多学术界较新的算法,适合于学术研究,但是 整体框架和流程的通用性较差,针对不同的任务和模型都需要较多的人为改动,对应用人员的要求较高,算法应用效率降低。In the embodiments of this application, considering the complexity of the neural network model structure under different applications and the limitations of deploying applications on different hardware platforms from the completion of floating-point training of a neural network model to deployment on the actual hardware platform Demand, in the traditional neural network fixed-point solution, it often requires a lot of human involvement in the process to ensure the correct fixed-point operation. At present, the publicly available neural network fixed-point tools, such as Neural Network Distiller or PocketFlow, have integrated more new algorithms from academia and are suitable for academic research, but the overall framework and process have poor versatility. Both tasks and models require more manual changes, which require high application personnel and reduce the efficiency of algorithm application.
为了减少神经网络定点化过程中的人为参与,本申请实施例提供了一种自动化实现神经网络定点化的方案。In order to reduce human participation in the process of neural network positioning, embodiments of the present application provide a solution for automatically realizing neural network positioning.
示例性的,对于输入的待定点化模型(浮点模型),可以通过对该浮点模型的拓扑结构进行解析,生成神经网络的数据流图,即根据数据从输入到输出的过程中,依次经过的该浮点模型的各层所确定的浮点模型的结构图,并根据配置文件中的样本图片信息,如样本图片的访问路径、样本图片的预处理方式,生成神经网络的数据层。Exemplarily, for the input to-be-fixed point model (floating point model), the topological structure of the floating point model can be analyzed to generate a data flow diagram of the neural network, that is, according to the process of data from input to output, sequentially The structure diagram of the floating-point model determined by each layer of the floating-point model is passed, and the data layer of the neural network is generated according to the sample image information in the configuration file, such as the access path of the sample image and the preprocessing method of the sample image.
示例性的,考虑到不同部署平台的平台特性,为了优化神经网络在不同平台部署的效果,可以基于配置文件中的待部署平台的平台特性(可以称为优化策略),对神经网络的拓扑结构进行拆分(如根据待部署平台的优化策略将浮点模型的部分拓扑结构进行拆分)和融合(如将浮点模型的BN层合并入前置Conv层)等,得到预处理后的浮点模型,使预处理后的浮点模型的拓扑结构更适于待部署平台的平台特性,提高预处理后的浮点模型在硬件上运行的效率,并优化运行效果。Exemplarily, considering the platform characteristics of different deployment platforms, in order to optimize the effect of neural network deployment on different platforms, it can be based on the platform characteristics of the platform to be deployed in the configuration file (which can be called optimization strategy), and the topology of the neural network Splitting (such as splitting part of the topological structure of the floating-point model according to the optimization strategy of the platform to be deployed) and fusion (such as merging the BN layer of the floating-point model into the pre-Conv layer), etc., to obtain the pre-processed floating The point model makes the topological structure of the pre-processed floating-point model more suitable for the platform characteristics of the platform to be deployed, improves the efficiency of the pre-processed floating-point model on hardware, and optimizes the operating effect.
步骤S730、对预处理后的浮点模型进行定点化。Step S730: Perform fixed-point conversion on the pre-processed floating-point model.
本申请实施例中,完成对浮点模式的预处理时,可以对预处理后的浮点模型进行定点化,以得到可以用于部署的定点化模型。示例性的,可以采用上述任一实施例中描述的方式对预处理后的浮点模型进行定点化处理。In the embodiment of the present application, when the preprocessing of the floating-point mode is completed, the pre-processed floating-point model can be fixed-point to obtain a fixed-point model that can be used for deployment. Exemplarily, the pre-processed floating-point model may be fixed-point processed in the manner described in any of the foregoing embodiments.
本申请实施例中,对预处理后的浮点模型进行定点化之后,可以对定点化模型进行定点化的仿真测试,评估模型的定点化性能。根据预设的性能评价方式与指标,判断定点化模型的性能是否满足需求,若满足需求,则可以对模型进行最终的转换和部署;若不满足需求,则进行模型定点化调优,来进一步提升定点化模型的性能。In the embodiment of the present application, after the preprocessed floating-point model is fixed-point, the fixed-point simulation test can be performed on the fixed-point model to evaluate the fixed-point performance of the model. According to the preset performance evaluation methods and indicators, determine whether the performance of the fixed-point model meets the demand. If the demand is met, the model can be finally converted and deployed; if the demand is not met, the fixed-point model optimization is carried out to further Improve the performance of fixed-point models.
示例性的,当模型的定点化性能不满足需求时,可对模型进行更加全局和更加细致的调优。Exemplarily, when the fixed-point performance of the model does not meet the requirements, the model can be tuned in a more global and detailed manner.
在一个示例中,当具备原始数据值(带有标注的样本)和对应的真值时,可以进行基于定点化预算的模型训练。In one example, when the original data value (annotated sample) and the corresponding true value are available, model training based on a fixed-point budget can be performed.
在另一个示例中,当不具备原始数据值和对应的真值时,可以使用知识蒸馏的训练方式,利用原始模型指导定点化模型的训练调优。当调优性能满足要求后,则输出最终的定点化超参表和待转换模型。In another example, when the original data value and the corresponding truth value are not available, the knowledge distillation training method can be used to guide the training and tuning of the fixed-point model using the original model. When the tuning performance meets the requirements, the final fixed-point hyperparameter table and the model to be converted are output.
在本申请实施例中,当按照上述实施例中描述的方式完成神经网络定点化时,可以基于定点化后的神经网络进行智能分析处理,包括但不限于计算机视觉处理(如图像分类、目标检测或语音分割等)或自然语言处理。In the embodiments of this application, when the neural network is fixed according to the method described in the above embodiments, intelligent analysis and processing can be performed based on the neural network after the fixed point, including but not limited to computer vision processing (such as image classification, target detection) Or speech segmentation, etc.) or natural language processing.
为了使本领域技术人员更好地理解本申请实施例提供的技术方案,下面结合具体实例对本申请实施例提供的技术方案进行更加详细的说明。In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the technical solutions provided by the embodiments of the present application will be described in more detail below with reference to specific examples.
神经网络定点化是一种常用的模型加速算法,通过将模型的权值以及输出的特征值量化成固定比特的数,如8bit、16bit或者极低的1bit、2bit,可以很好的解决在硬件上float32类型数据带来的乘累加计算复杂、带宽巨大等问题,模型量化的比特数越低,模型在硬件上的加速越明显。Neural network fixed-pointization is a commonly used model acceleration algorithm. By quantizing the weight of the model and the output feature value into a fixed bit number, such as 8bit, 16bit or very low 1bit, 2bit, it can be well solved in hardware The above float32 type data brings complicated multiplication and accumulation calculations and huge bandwidth. The lower the number of quantized bits of the model, the more obvious the acceleration of the model on the hardware.
然而,从一个神经网络模型的浮点训练完成到实际硬件平台上的部署的过程中,不同应用下神经网络模型结构的复杂性,以及在不同硬件平台上部署应用的限制需求,传统的神经网络定点化方案中,往往需要较多人为参与的过程,才能保证正确的定点化 操作。而目前已公开的神经网络定点化工具,如Neural Network Distiller或PocketFlow等,虽然集成了较多学术界较新的算法,适合于学术研究,但是整体框架和流程的通用性较差,针对不同的任务和模型都需要较多的人为改动,对应用人员的要求较高,算法应用效率降低。However, from the completion of the floating-point training of a neural network model to the deployment on the actual hardware platform, the complexity of the neural network model structure under different applications and the restrictive requirements of deploying applications on different hardware platforms, the traditional neural network In the fixed-point scheme, it often requires more human participation in the process to ensure the correct fixed-point operation. At present, the publicly available neural network fixed-point tools, such as Neural Network Distiller or PocketFlow, have integrated many newer academia algorithms and are suitable for academic research, but the overall framework and process have poor versatility. Both tasks and models require more manual changes, which require high application personnel and reduce the efficiency of algorithm application.
在实际复杂应用场景下,神经网络的性能对精度要求较高,当对网络进行定点化后,难免出现性能下降的问题,这时需要对定点化后网络的性能问题进行分析并调优,传统的神经网络定点化方案需要人工进行调优,对应用人员的要求较高,且效率低。In actual complex application scenarios, the performance of neural networks requires high accuracy. When the network is fixed-point, performance degradation is unavoidable. At this time, it is necessary to analyze and tune the performance problems of the fixed-point network. Traditional The fixed-point neural network solution of Neural Networks requires manual tuning, which has high requirements for application personnel and low efficiency.
针对上述问题,本申请实施例提供一种自动化的神经网络定点化系统,如图8所示,该自动化的神经网络定点化系统可以包括定点化评估与调优模块和定点化转换模块。In response to the above-mentioned problems, embodiments of the present application provide an automated neural network fixed-point system. As shown in FIG. 8, the automated neural network fixed-point system may include a fixed-point evaluation and tuning module and a fixed-point conversion module.
基于图8所示的自动化的神经网络定点化系统,可以利用预先配置的定点化配置信息(可以通过配置文件的形式提供)、待定点化模型(即浮点模型)以及样本集,得到可用于部署的定点化模型文件。下面分别对各模块的具体功能进行详细说明。Based on the automated neural network fixed-point system shown in Figure 8, the pre-configured fixed-point configuration information (which can be provided in the form of a configuration file), the to-be-fixed model (that is, the floating-point model), and the sample set can be used to obtain The deployed fixed-point model file. The specific functions of each module are described in detail below.
一、定点化评估与调优模块1. Fixed-point evaluation and tuning module
请参见图9,定点化评估与调优模块的功能流程图可以如图9所示,其主要包括以下几个过程:浮点模型预处理、统计评估与优化以及定点测试与调优。下面分别对各过程进行详细说明。Refer to Figure 9. The functional flowchart of the fixed-point evaluation and tuning module can be shown in Figure 9, which mainly includes the following processes: floating-point model preprocessing, statistical evaluation and optimization, and fixed-point testing and tuning. Each process will be described in detail below.
1、浮点模型预处理1. Floating point model preprocessing
浮点模型预处理过程主要包括:会对输入的浮点模型的拓扑结构进行解析,生成神经网络数据流图;基于配置文件中的样本图片信息,生成神经网络的数据层;基于配置文件中的待部署平台的优化策略,对神经网络的拓扑结构进行拆分(如根据待部署平台的优化策略将浮点模型的部分拓扑结构进行拆分)和融合(如将浮点模型的BN层合并入前置Conv层),得到拓扑结构更适于在待部署平台上部署的模型(即预处理后的浮点模型)。经过浮点模型预处理后得到的预处理后的浮点模型,可进行后续的处理。The preprocessing process of the floating-point model mainly includes: analyzing the topological structure of the input floating-point model to generate a neural network data flow diagram; based on the sample picture information in the configuration file, generating the data layer of the neural network; based on the configuration file The optimization strategy of the platform to be deployed, splitting the topology of the neural network (such as splitting part of the topological structure of the floating-point model according to the optimization strategy of the platform to be deployed) and fusion (such as merging the BN layer of the floating-point model into Pre-Conv layer) to obtain a model that is more suitable for deployment on the platform to be deployed with a topology structure (that is, a preprocessed floating-point model). The pre-processed floating-point model obtained after the pre-processing of the floating-point model can be subjected to subsequent processing.
2、统计评估与优化2. Statistical evaluation and optimization
神经网络定点化的目的是通过将模型的权值以及输出的特征值量化成固定比特的数值,以达到加速推理的效果。The purpose of the fixed-point neural network is to quantify the weight of the model and the output feature value into a fixed bit value to achieve the effect of accelerating the reasoning.
示例性的,在该实施例中,可以采用包括但不限于线性对称定点化算法、线性非对称定点化算法、Power-of-Two定点化算法等定点化算法实现神经网络定点化。Exemplarily, in this embodiment, fixed-point algorithms including but not limited to linear symmetric fixed-point algorithms, linear asymmetric fixed-point algorithms, and Power-of-Two fixed-point algorithms can be used to realize neural network fixed-pointization.
下面分别以线性对称定点化算法、线性非对称定点化算法、Power-of-Two定点化算法为例,对传统的神经网络定点化方案中的定点化超参计算过程进行说明。The following takes linear symmetric fixed-point algorithm, linear asymmetric fixed-point algorithm, and Power-of-Two fixed-point algorithm as examples to illustrate the fixed-point hyperparameter calculation process in the traditional neural network fixed-point scheme.
对于线性对称定点化算法,可以通过公式(1)和(2)实现定点化超参的计算:For linear symmetric fixed-point algorithm, the calculation of fixed-point hyperparameters can be realized by formulas (1) and (2):
X C=max(-C x,min(X,C x)) (1) X C =max(-C x , min(X, C x )) (1)
公式(1)和(2)中,X表示原始的浮点数据,C x表示浮点数据绝对值的截断值,B w表示定点化的比特位宽,X Q表示定点化后的值。 In formulas (1) and (2), X represents the original floating-point data, C x represents the cut-off value of the absolute value of the floating-point data, B w represents the fixed-point bit width, and X Q represents the fixed-point value.
对于线性非对称定点化算法,可以通过公式(3)和(4)实现定点化超参的计算:For linear asymmetric fixed-point algorithms, the calculation of fixed-point hyperparameters can be achieved by formulas (3) and (4):
X C=max(C n,min(X,C p)) (3) X C =max(C n ,min(X,C p )) (3)
公式(3)和(4)中,X表示原始的浮点数据,C n表示浮点数据左侧截断值,C p表示浮点数据右侧截断值,B w表示定点化的比特位宽,X Q表示定点化后的值。 In formulas (3) and (4), X represents the original floating point data, C n represents the left side truncation value of the floating point data, C p represents the right side truncation value of the floating point data, and B w represents the bit width of the fixed point. X Q represents the fixed-point value.
对于Power-of-Two定点化算法,可通过公式(5)、(6)和(7)实现定点化超参的计算:For the Power-of-Two fixed-point algorithm, the calculation of fixed-point hyperparameters can be realized by formulas (5), (6) and (7):
X C=max(-C x,min(X,C x)) (5) X C =max(-C x , min(X, C x )) (5)
公式(5)、(6)和(7)中,X表示原始的浮点数据,C x表示浮点数据绝对值的截断值,B w表示定点化的比特位宽,X Q表示定点化后的值, 表示定点化等级集合, 是一个映射函数,用于确定 中与X C最接近的数。 In formulas (5), (6) and (7), X represents the original floating-point data, C x represents the cutoff value of the absolute value of the floating-point data, B w represents the bit width of the fixed-point, and X Q represents the fixed-point Value, Represents a set of fixed-point levels, Is a mapping function used to determine The number that is closest to X C.
在上述定点化算法中,都需要利用浮点数据的截断值(即定点化超参),截断值的选取对于定点化的效果非常重要,往往是根据原始数据的分布情况进行确定。In the above fixed-point algorithm, the cut-off value of floating-point data (that is, the fixed-point hyperparameter) needs to be used. The selection of the cut-off value is very important for the effect of fixed-point, and it is often determined according to the distribution of the original data.
传统的神经网络定点化方案中,对于权值的定点化:对于原始浮点状态的神经网络,各单元的浮点状态的权值在神经网络训练完毕时就已经确定,各单元的浮点状态的权值的数据分布并不受在前单元的定点化的影响,因此,可以分别对原始浮点状态的神经网络的各单元的权值的数据分布进行统计,计算得到定点化超参。In the traditional neural network fixed-point solution, the weights are fixed: for the neural network of the original floating-point state, the weight of the floating-point state of each unit is determined when the neural network is trained, and the floating-point state of each unit The data distribution of the weights of is not affected by the fixed-pointing of the previous unit. Therefore, the data distributions of the weights of each unit of the neural network in the original floating-point state can be separately counted, and the fixed-point hyperparameters can be calculated.
对于特征值的定点化:为了得到神经网络各层输出的特征值的数据分布,需要给模型输入一定数量的样本进行前向运算。For the fixed point of eigenvalues: in order to obtain the data distribution of the eigenvalues output by each layer of the neural network, a certain number of samples need to be input to the model for forward calculation.
传统的神经网络定点化方案中,为了实现对输出的特征值的定点化,一次性给原始模型输入一定数量的样本图片,通过原始模型前向计算将每一层输出的特征值的数据分布记录下来,再分别计算各层输出的特征值的定点化超参。In the traditional neural network fixed point solution, in order to realize the fixed point of the output feature value, a certain number of sample pictures are input to the original model at one time, and the data distribution of the output feature value of each layer is recorded through the original model forward calculation Next, calculate the fixed-point hyperparameters of the eigenvalues output by each layer respectively.
本申请实施例中,考虑到传统的神经网络定点化方案中,神经网络各层输出的特征值的定点化超参的计算是在模型为浮点状态下进行的,未考虑到前置层定点化后对后置层的影响,导致输出的特征值的数据分布与实际情况存在偏差,不符合定点化状态下的真实数据分布情况。In the embodiments of this application, considering that in the traditional neural network fixed-point solution, the calculation of the fixed-point hyperparameters of the eigenvalues output by each layer of the neural network is performed under the floating-point model, and the fixed-point of the pre-layer is not considered. The influence of post-modification on the post-layer causes the data distribution of the output characteristic values to deviate from the actual situation, which does not conform to the real data distribution in the fixed-point state.
基于此,在统计评估与优化过程中,本申请实施例提供的神经网络定点化方案至少进行了如下改进。Based on this, in the process of statistical evaluation and optimization, the neural network fixed-point solution provided by the embodiments of the present application has at least the following improvements.
2.1、逐层评估2.1, layer by layer evaluation
为了得到神经网络各层输出的特征值的更真实的数据分布,可以采用逐层评估(即以一个单元包括神经网络的一层为例)方式进行定点化超参的计算,在对当前层(待定点化层)进行评估时,当前层之前的全部层保持定点化状态,当前层之后的全部层保持浮点状态。In order to obtain a more realistic data distribution of the eigenvalues output by each layer of the neural network, a layer-by-layer evaluation (that is, a unit including a layer of the neural network as an example) can be used to calculate the fixed-point hyperparameters, and the current layer ( To be fixed-pointed layer) during evaluation, all layers before the current layer remain fixed-pointed state, and all layers after the current layer keep floating-point state.
下面依然以线性对称定点化算法、线性非对称定点化算法、Power-of-Two定点化算法为例,对本申请实施例中采用逐层评估方式实现的定点化超参计算进行说明。In the following, the linear symmetric fixed-point algorithm, the linear asymmetric fixed-point algorithm, and the Power-of-Two fixed-point algorithm are still taken as examples to describe the fixed-point hyperparameter calculation implemented by the layer-by-layer evaluation method in the embodiment of the present application.
对于线性对称定点化算法,在浮点运算状态下,给原始模型输入一定数量的样本图片进行前向运算,统计第一个待定点化层输出的特征值以及权值的数据分布,计算该待定点化层输出的特征值的定点化超参和权值的定点化超参,并使用公式(1)和(2)将该待定点化层转换为定点化的运算状态。For the linear symmetric fixed-point algorithm, in the floating-point operation state, input a certain number of sample pictures to the original model for forward calculation, and calculate the data distribution of the eigenvalues and weights output by the first to-be-fixed layer. The fixed-point super-parameters of the eigenvalues and the fixed-point super-parameters of the weights output by the inscription layer, and use formulas (1) and (2) to convert the to-be-fixed layer into a fixed-point operation state.
对于之后的任一待定点化层,在已定点化层保持定点化状态的情况下,再次给模型输入一定数量的样本图片进行前向运算,统计该待定点化层输出的特征值以及权值特征的数据分布,计算该待定点化层输出的特征值的定点化超参和权值的定点化超参,并使用公式(1)和(2)将该待定点化层转换为定点化的运算状态,直至将模型全部层转换成定点化运算状态。For any subsequent to-be-fixed layer, while the fixed-point layer remains in the fixed-point state, again input a certain number of sample pictures to the model for forward calculation, and count the feature values and weights output by the to-be-fixed layer The data distribution of the feature, calculate the fixed super parameter of the feature value output by the to-be-fixed layer and the fixed super-parameter of the weight value, and use the formulas (1) and (2) to convert the to-be-fixed layer into a fixed-point Operation state, until all layers of the model are converted into fixed-point operation state.
对于线性非对称定点化算法,在浮点运算状态下,给原始模型输入一定数量的样本图片进行前向运算,统计第一个待定点化层输出的特征值以及权值的数据分布,计算该待定点化层输出的特征值的定点化超参和权值的定点化超参,并使用公式(3)和(4)将该待定点化层转换为定点化的运算状态。For the linear asymmetric fixed-point algorithm, in the floating-point operation state, input a certain number of sample images to the original model for forward calculation, and calculate the data distribution of the eigenvalues and weights output by the first to-be-fixed layer The fixed-point super-parameters of the feature values and the fixed-point super-parameters of the weights output by the to-be-fixed layer, and use formulas (3) and (4) to convert the to-be-fixed layer into a fixed-point operation state.
对于之后的任一待定点化层,在已定点化层保持定点化状态的情况下,再次给模型输入一定数量的样本图片进行前向运算,统计该待定点化层输出的特征值以及权值特征的数据分布,计算 该待定点化层输出的特征值的定点化超参和权值的定点化超参,并使用公式(3)和(4)将该待定点化层转换为定点化的运算状态,直至将模型全部层转换成定点化运算状态。For any subsequent to-be-fixed layer, while the fixed-point layer remains in the fixed-point state, again input a certain number of sample pictures to the model for forward calculation, and count the feature values and weights output by the to-be-fixed layer The data distribution of the feature, calculate the fixed super-parameter of the feature value output by the to-be-fixed layer and the fixed-point super-parameter of the weight value, and use the formulas (3) and (4) to convert the to-be-fixed layer into a fixed-point Operation state, until all layers of the model are converted into fixed-point operation state.
对于Power-of-Two定点化算法,在浮点运算状态下,给原始模型输入一定数量的样本图片进行前向运算,统计第一个待定点化层输出的特征值以及权值的数据分布,计算该待定点化层输出的特征值的定点化超参和权值的定点化超参,并使用公式(5)、(6)和(7)将该待定点化层转换为定点化的运算状态。For the Power-of-Two fixed-point algorithm, in the floating-point operation state, a certain number of sample images are input to the original model for forward calculation, and the data distribution of the eigenvalues and weights output by the first to-be-fixed layer is counted. Calculate the fixed-point super-parameters of the eigenvalues output by the to-be-fixed layer and the fixed-point super-parameters of the weights, and use formulas (5), (6) and (7) to convert the to-be-fixed layer into a fixed-point operation state.
对于之后的任一待定点化层,在已定点化层保持定点化状态的情况下,再次给模型输入一定数量的样本图片进行前向运算,统计该待定点化层输出的特征值以及权值特征的数据分布,计算该待定点化层输出的特征值的定点化超参和权值的定点化超参,并使用公式(5)、(6)和(7)将该待定点化层转换为定点化的运算状态,直至将模型全部层转换成定点化运算状态。For any subsequent to-be-fixed layer, while the fixed-point layer remains in the fixed-point state, again input a certain number of sample pictures to the model for forward calculation, and count the feature values and weights output by the to-be-fixed layer The data distribution of the feature, calculate the fixed super parameter of the feature value output by the to-be-fixed layer and the fixed super-parameter of the weight value, and use the formulas (5), (6) and (7) to convert the to-be-fixed layer It is a fixed-point computing state until all layers of the model are converted into a fixed-point computing state.
2.2、定点化超参优化2.2, fixed-point hyperparameter optimization
在逐层的定点化超参评估过程中,还可以对所确定的定点化超参进行优化,即在按照上述方式确定了定点化超参(包括输出的特征值的定点化超参和/或权值的定点化超参)时,可以基于所确定的定点化超参,确定最终定点化超参的搜索范围(如上文中的第一定点化超参候选值范围或第二定点化超参候选值范围等),并在该搜索范围中搜索对神经网络的输出误差影响最小的定点化超参,作为最终定点化超参。In the process of layer-by-layer fixed-point hyperparameter evaluation, the determined fixed-point hyperparameters can also be optimized, that is, after the fixed-point hyperparameters (including the fixed-point hyperparameters and/or output eigenvalues of the output eigenvalues) are determined according to the above method When the weighted fixed-point super-parameters), the search range of the final fixed-point super-parameters can be determined based on the determined fixed-point super-parameters (such as the first fixed-point super-parameter candidate value range or the second fixed-point super-parameter above). Candidate value range, etc.), and search for the fixed-point hyperparameter that has the least impact on the output error of the neural network in the search range, as the final fixed-point hyperparameter.
以线性对称定点化算法为例,首先确定定点化超参c w的搜索范围,然后在此范围内进行遍历搜索,分别计算在不同c w下,神经网络输出的误差,选择对神经网络的输出误差影响最小的值作为最终定点化超参。 Taking the linear symmetric fixed-point algorithm as an example, first determine the search range of the fixed-point hyperparameter c w , and then perform a traversal search within this range, calculate the error of the neural network output under different c w , and select the output of the neural network The value with the least influence of error is used as the final fixed-point hyperparameter.
示例性的,神经网络输出误差的计算方式包括但不限于均方误差、KL散度、欧氏距离等。以均方误差为例,可以通过以下方式确定神经网络的输出误差:Exemplarily, the calculation method of the neural network output error includes, but is not limited to, the mean square error, KL divergence, Euclidean distance, and the like. Taking the mean square error as an example, the output error of the neural network can be determined in the following way:
公式(8)和(9)中,L表示模型总的层数,O i表示定点化状态下该层的输出特征值, 表示原始浮点状态下该层的输出特征值, 表示均方误差函数,|O i|表示特征数据的数量。 In formulas (8) and (9), L represents the total number of layers of the model, O i represents the output feature value of the layer in the fixed-point state, Represents the output feature value of the layer in the original floating point state, Represents the mean square error function, and |O i | represents the number of feature data.
通过公式(8),可以确定神经网络的层i的输出误差,基于神经网络各层的输出误差,通过公式(9),可以确定神经网络的输出误差。Through formula (8), the output error of layer i of the neural network can be determined. Based on the output error of each layer of the neural network, the output error of the neural network can be determined by formula (9).
2.3、最小化局部误差的优化策略2.3. Optimization strategies to minimize local errors
考虑到对神经网络的每一层进行定点化之后,可能会出现精度上的误差,随着层数加深,定点化上的累计误差可能会对神经网络整体的性能带来较大的影响,因此,减少每一层定点化所带来的偏差,可以减少神经网络的每一层在定点化后的精度损失,提升神经网络的整体性能。Considering that after each layer of the neural network is fixed-pointed, there may be errors in accuracy. As the number of layers deepens, the cumulative error in fixed-pointing may have a greater impact on the overall performance of the neural network, so , To reduce the deviation caused by the fixed point of each layer, can reduce the accuracy loss of each layer of the neural network after the fixed point, and improve the overall performance of the neural network.
示例性的,可以基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化,其具体实现流程可包括如下步骤1和步骤2。Exemplarily, based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state, the The weights of the pointization unit are optimized, and the specific implementation process may include the following
步骤1、对原始模型M的第一个待定点化层L
1进行定点化评估,得到定点化超参,然后对该层进行定点化,得到模型Q
1。
Step 1. Perform a fixed-point evaluation on the first to-
步骤2、计算原始模型M和模型Q 1在层L 1后的第一个浮点层L 2的输出误差,以最小化该误差为原则来优化L 2的权值。 Step 2, the calculation model and the original model M L Q 1 in the first floating point error output layer L 2 after a layer to minimize this error to optimize the power of two L principle.
示例性的,确定原始模型和量化后的模型的在待定点化层的输出误差可以通过L1-loss、L2-loss、期望偏差等函数实现。以L2-loss为例,优化函数为:Exemplarily, determining the output error of the original model and the quantized model in the to-be-fixed layer can be achieved through functions such as L1-loss, L2-loss, and expected deviation. Taking L2-loss as an example, the optimization function is:
公式(10)和(11)中, 代表L 2层的前向推理函数, 和 分别表示L 2层的权值和bias(以L 2层为卷积层为例),Y为第一步中从原始模型M中第L 2层提取的特征值,X Q为从当前模型Q 1中 第L 2层的输入特征值, 和 分别表示L 2层优化后的权值和bias(此时仍然浮点状态)。 In formulas (10) and (11), Represents the forward inference function of the L 2 layer, and L 2 represent the weight of the layer and the BIAS (L 2 layer to an example convolution layer), Y is the first step extracted from the original model M eigenvalues layer L 2, X Q Q from the current model The input eigenvalues of the L 2 layer in 1, and They respectively represent the optimized weight and bias of the L 2 layer (still floating-point at this time).
通过优化L 2层的权值和bias,使得模型Q 1中第L 2层的输出特征值与原始模型M中第L 2层输出特征值Y尽可能接近。将调优后得到的新的权值和bias(即上述 和 )赋值给L 2层,这样就完成了局部误差的修正,可以缓解模型定点化带来的误差。 By optimizing weights and BIAS layer L 2, Q 1 so that the model output characteristic of the output characteristic value of the layer L 2 of the original model M value Y of the second layer L 2 as close as possible. The new weight and bias obtained after tuning (that is, the above and ) Is assigned to the L 2 layer, which completes the correction of the local error, which can alleviate the error caused by the fixed point of the model.
重复以上两步骤,直到神经网络中的最后一层输出的特征值及权值完成定点化,就完成了模型统计评估与优化过程,其示意图可以参见图10。Repeat the above two steps until the eigenvalues and weights of the last layer in the neural network are fixed, and the model statistical evaluation and optimization process is completed. The schematic diagram can be seen in Figure 10.
如图10所示,实线框方块代表原始浮点层,虚线框方块代表原始浮点层经过定点化得到的定点化层,实线框带填充方块代表根据最小化局部误差优化更新后的浮点层,虚线框带填充方块代表更新后的浮点层经过定点化得到的定点化层。As shown in Figure 10, the solid-line box represents the original floating-point layer, the dashed box represents the fixed-point layer obtained by fixed-pointing the original floating-point layer, and the solid-line box with filled squares represents the updated floating-point layer based on minimizing local errors. For the point layer, the dashed frame with filled squares represents the fixed-point layer obtained after the updated floating-point layer is fixed-point.
在本申请实施例中,由于基于神经网络各层在原始浮点模型下输出的特征值与量化模型下输出的特征值之间的输出误差,对神经网络定点化的性能进行评估,而不再是按照传统神经网络定点化方案中基于量化模型的最终输出与样本真值之间的误差,对神经网络定点化的性能进行评估,因此,用于神经网络定点化的样本可以为不带标注信息的样本,降低了对样本的要求,提高了方案的可实现性。In the embodiment of the present application, due to the output error between the eigenvalues output by each layer of the neural network under the original floating-point model and the eigenvalue output under the quantization model, the performance of the fixed-point neural network is evaluated instead of According to the error between the final output of the quantized model and the true value of the sample in the traditional neural network fixed-point solution, the performance of the neural network fixed-point is evaluated. Therefore, the sample used for the neural network fixed-point can be without annotated information The sample, which reduces the requirements on the sample, and improves the feasibility of the plan.
3、定点化测试与调优3. Fixed-point testing and tuning
对预处理后的浮点模型进行定点化之后,可以对定点化模型进行定点化的仿真测试,评估模型的定点化性能。根据预设的性能评价方式与指标,判断定点化模型的性能是否满足需求,若满足需求,则可以对模型进行最终的转换和部署;若不满足需求,则进行模型定点化调优,来进一步提升定点化模型的性能。After the pre-processed floating-point model is fixed-point, the fixed-point model can be subjected to a fixed-point simulation test to evaluate the fixed-point performance of the model. According to the preset performance evaluation methods and indicators, determine whether the performance of the fixed-point model meets the demand. If the demand is met, the model can be finally converted and deployed; if the demand is not met, the fixed-point model optimization is carried out to further Improve the performance of fixed-point models.
示例性的,当模型的定点化性能不满足需求时,可对模型进行更加全局和更加细致的调优。Exemplarily, when the fixed-point performance of the model does not meet the requirements, the model can be tuned in a more global and detailed manner.
在一个示例中,当具备原始数据值(带有标注的样本)和对应的真值时,可以进行基于定点化预算的模型训练。In one example, when the original data value (annotated sample) and the corresponding true value are available, model training based on a fixed-point budget can be performed.
在另一个示例中,当不具备原始数据值和对应的真值时,可以使用知识蒸馏的训练方式,利用原始模型指导定点化模型的训练调优。当调优性能满足要求后,则输出最终的定点化超参表和待转换模型。In another example, when the original data value and the corresponding truth value are not available, the knowledge distillation training method can be used to guide the training and tuning of the fixed-point model using the original model. When the tuning performance meets the requirements, the final fixed-point hyperparameter table and the model to be converted are output.
二、定点化转换模块2. Fixed-point conversion module
基于定点化评估与调优模块输出的定点化超参表和待转换模型,定点化转换模块可输出可部署文件,以基于该可部署文件在待部署平台上部署量化后的神经网络模型。Based on the fixed-point hyperparameter table and the model to be converted output by the fixed-point evaluation and tuning module, the fixed-point conversion module can output a deployable file to deploy a quantified neural network model on the platform to be deployed based on the deployable file.
当完成神经网络定点化时,可基于定点化后的神经网络进行智能分析处理,包括但不限于计算机视觉处理(如图像分类、目标检测或语音分割等)或自然语言处理。When the neural network is fixed, intelligent analysis and processing can be performed based on the fixed neural network, including but not limited to computer vision processing (such as image classification, target detection, or speech segmentation, etc.) or natural language processing.
通过以上描述可以看出,在本申请实施例提供的技术方案中,对于神经网络的待定点化单元,基于神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参,并基于该定点化超参对该待定点化单元输出的特征值进行定点化,通过对神经网络进行逐单元的定点化,对于神经网络的待定点化单元,保持已定点化单元为定点化状态,以得到更加真实的输出特征值的数据分布,从而,提升神经网络定点化的性能。It can be seen from the above description that in the technical solution provided by the embodiments of the present application, for the to-be-fixed unit of the neural network, the characteristics of the output of the to-be-fixed unit based on the situation that the fixed-point unit of the neural network maintains the fixed-point state The data distribution of the value, the fixed-point hyperparameter of the eigenvalue output by the to-be-fixed unit is determined, and the eigenvalue output by the to-be-fixed unit is fixed based on the fixed-point super-parameter, and the neural network is unit-by-unit. Fixed-point, for the to-be-fixed unit of the neural network, keep the fixed-point unit in the fixed-point state to obtain a more realistic data distribution of the output feature value, thereby improving the performance of the fixed-point neural network.
以上对本申请提供的方法进行了描述。下面对本申请提供的装置进行描述。The method provided by this application is described above. The device provided by this application is described below.
请参见图11,为本申请实施例提供的一种神经网络定点化装置的结构示意图,如图11所示,该神经网络定点化装置可以包括:确定模块,用于对于神经网络的待定化单元,基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参;定点化模块,用于基于该定点化超参对该待定点化单元输出的特征值进行定点化。Please refer to FIG. 11, which is a schematic structural diagram of a neural network fixed-pointing device provided by an embodiment of this application. As shown in FIG. 11, the neural network fixed-pointing device may include: a determination module for determining a pending unit of the neural network , Based on the data distribution of the feature value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, the fixed-point hyperparameter of the feature value output by the to-be-fixed unit is determined; the fixed-point module , Used to fix the characteristic value output by the unit to be fixed based on the fixed super parameter.
在一种可能的实施例中,确定模块在确定该待定点化单元输出的特征值的定点化超参之后,还用于:基于该待定点化单元输出的特征值的定点化超参,确定第一定点化超参候选值范围;从该第一定点化超参候选值范围中确定该待定点化单元输出的特征值的最终定点化超参。相应地,所述定点化模块基于该定点化超参对该待定点化单元输出的特征值进行定点化,包括:基于该待定点化 单元输出的特征值的最终定点化超参对该待定点化单元输出的特征值进行定点化。In a possible embodiment, after determining the fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit, the determining module is further configured to: determine the fixed-pointing hyperparameter based on the characteristic value output by the to-be-fixed unit The first fixed point hyperparameter candidate value range; the final fixed point hyperparameter of the characteristic value output by the to-be-fixed unit is determined from the first fixed point hyperparameter candidate value range. Correspondingly, the fixed-pointing module, based on the fixed-pointing super-parameter, fixes the characteristic value output by the to-be-fixed unit, including: the final fixed-pointing super-parameter based on the characteristic value output by the to-be-fixed unit to the pending point The eigenvalues output by the transformation unit are fixed-pointed.
在一种可能的实施例中,所述确定模块从该第一定点化超参候选值范围中确定该待定点化单元输出的特征值的最终定点化超参,包括:分别确定该第一定点化超参候选值范围中各候选值对应的神经网络的输出误差;将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元输出的特征值的最终定点化超参。In a possible embodiment, the determining module determines the final fixed-pointing hyper-parameter of the characteristic value output by the to-be-fixed unit from the range of the first fixed-pointing super-parameter candidate value, including: separately determining the first fixed-pointing hyperparameter The output error of the neural network corresponding to each candidate value in the fixed-point hyperparameter candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the final fixed-point hyperparameter of the feature value output by the to-be-fixed unit .
在一种可能的实施例中,所述确定模块分别确定该第一定点化超参候选值范围中各候选值对应的神经网络的输出误差,包括:对于任一候选值,基于第一类型特征值以及第二类型特征值确定该候选值对应的神经网络的输出误差,所述第一类型特征值为使用该候选值对该待定点化单元输出的特征值进行定点化时所述神经网络各单元输出的特征值;所述第二类型特征值为原始浮点状态下,所述神经网络各单元输出的特征值。In a possible embodiment, the determining module separately determines the output error of the neural network corresponding to each candidate value in the first fixed-point hyperparameter candidate value range, including: for any candidate value, based on the first type The feature value and the second type feature value determine the output error of the neural network corresponding to the candidate value, and the first type feature value is the neural network when the feature value output by the to-be-fixed unit is fixed using the candidate value The feature value output by each unit; the second type feature value is the feature value output by each unit of the neural network in the original floating point state.
在一种可能的实施例中,所述确定模块,还用于对于所述神经网络的待定点化单元,基于该待定点化单元的权值的数据分布,确定该待定点化单元的权值的定点化超参;基于该待定点化单元的权值的定点化超参,确定第二定点化超参候选值范围;从该第二定点化超参候选值范围中确定该待定点化单元的权值的最终定点化超参。相应地,所述定点化模块,还用于基于该待定点化单元的权值的最终定点化超参对该待定点化单元的权值进行定点化。In a possible embodiment, the determining module is further configured to determine the weight of the pending unit of the neural network based on the data distribution of the weight of the pending unit The fixed-point super-parameter of the; based on the fixed-point super-parameter of the weight of the to-be-fixed unit, determine the second fixed-point super-parameter candidate value range; determine the to-be-fixed unit from the second fixed-point super-parameter candidate value range The final fixed-point hyperparameters of the weights. Correspondingly, the fixed-pointing module is further configured to fix the weight of the to-be-fixed unit based on the final fixed-pointing hyperparameter of the weight of the to-be-fixed unit.
在一种可能的实施例中,所述确定模块从该第二定点化超参候选值范围中确定该待定点化单元的权值的最终定点化超参,包括:分别确定该第二定点化超参候选值范围中各候选值对应的神经网络的输出误差;将对应的神经网络的输出误差最小的候选值,确定为该待定点化单元的权值的最终定点化超参。In a possible embodiment, the determining module determines the final fixed-pointing hyperparameter of the weight value of the to-be-fixed unit from the second fixed-pointing super-parameter candidate value range, including: separately determining the second fixed-pointing hyperparameter The output error of the neural network corresponding to each candidate value in the hyperparameter candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the final fixed point super parameter of the weight of the to-be-fixed unit.
在一种可能的实施例中,所述确定模块分别确定该第二定点化超参候选值范围中各候选值对应的神经网络的输出误差,包括:对于任一候选值,基于第三类型特征值以及第四类型特征值确定该候选值对应的神经网络的输出误差,所述第三类型特征值为使用该候选值对该待定点化单元的权值进行定点化时,所述神经网络各单元输出的特征值;所述第四类型特征值为原始浮点状态下,所述神经网络各单元输出的特征值。In a possible embodiment, the determining module separately determines the output error of the neural network corresponding to each candidate value in the second fixed-point hyperparameter candidate value range, including: for any candidate value, based on a third type of feature Value and the fourth type feature value determine the output error of the neural network corresponding to the candidate value. When the third type feature value uses the candidate value to fix the weight of the to-be-fixed unit, each of the neural networks The feature value output by the unit; the fourth type feature value is the feature value output by each unit of the neural network in the original floating point state.
在一种可能的实施例中,对于所述神经网络的待定点化单元,所述确定模块基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分布,确定该待定点化单元输出的特征值的定点化超参之前,所述确定模块还用于:基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化。In a possible embodiment, for the to-be-fixed unit of the neural network, the determining module is based on the feature value output by the to-be-fixed unit in the case where the fixed-point unit of the neural network remains in a fixed-point state Before determining the fixed-pointing hyperparameter of the feature value output by the to-be-fixed unit, the determining module is also used to: based on the situation that the fixed-pointing unit of the neural network maintains the fixed-pointing state, the pending-pointing The eigenvalue output by the unit and the eigenvalue output by the to-be-fixed unit in the original floating-point state are optimized for the weight of the to-be-fixed unit.
在一种可能的实施例中,确定模块基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定化单元的权值进行优化,包括:对该待定点化单元的权值进行优化,以使所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值二者之间的误差最小。In a possible embodiment, the determining module is based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the to-be-fixed unit in the original floating-point state The output characteristic value, optimizing the weight of the pending unit, includes: optimizing the weight of the pending unit, so that the determined unit of the neural network maintains the fixed state when the pending unit The error between the characteristic value output by the initiation unit and the characteristic value output by the to-be-fixed initiation unit in the original floating-point state is the smallest.
在一种可能的实施例中,所述单元包括所述神经网络的一层或连续多层,所述神经网络包括多个单元。In a possible embodiment, the unit includes one layer or successive multiple layers of the neural network, and the neural network includes a plurality of units.
请参见图12,为本申请实施例提供的一种神经网络定点化装置的结构示意图,如图12所示,该神经网络定点化装置可以包括:优化模块,用于对于神经网络的待定点化单元,基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定点化单元的权值进行优化;定点化模块,用于对优化后的该待定点化单元进行定点化。Please refer to FIG. 12, which is a schematic structural diagram of a neural network fixed-pointing device provided by an embodiment of this application. As shown in FIG. 12, the neural network fixed-pointing device may include: an optimization module for undetermined neural network Unit, based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network maintains the fixed-point state, and the characteristic value output by the to-be-fixed unit in the original floating-point state, for the pending point The weight of the unit is optimized; the fixed-point module is used to fix the optimized unit to be fixed.
在一种可能的实施例中,优化模块基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值,对该待定化单元的权值进行优化,包括:对该待定点化单元的权值进行优化,以使所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值,以及,原始浮点状态下该待定点化单元输出的特征值二者之间的误差最小。In a possible embodiment, the optimization module is based on the characteristic value output by the to-be-fixed unit under the condition that the fixed-point unit of the neural network remains in the fixed-point state, and the to-be-fixed unit in the original floating-point state The output characteristic value, optimizing the weight of the pending unit, includes: optimizing the weight of the pending unit, so that the determined unit of the neural network maintains the fixed state when the pending unit The error between the characteristic value output by the initiation unit and the characteristic value output by the to-be-fixed initiation unit in the original floating-point state is the smallest.
在一种可能的实施例中,所述定点化模块对优化后的该待定点化单元进行定点化,包括:基于所述神经网络的已定点化单元保持定点化状态的情况下该待定点化单元输出的特征值的数据分 布,确定优化后的该待定点化单元输出的特征值的定点化超参,并基于该定点化超参对优化后的该待定点化单元输出的特征值进行定点化。In a possible embodiment, the fixed-pointing module performs fixed-pointing on the optimized unit to be fixed, including: performing the fixed-pointing based on the situation that the fixed-pointing unit of the neural network maintains the fixed-pointing state. The data distribution of the eigenvalues output by the unit, determine the optimized fixed-point hyperparameters of the eigenvalues output by the to-be-fixed unit, and fix the optimized eigenvalues output by the to-be-fixed unit based on the fixed-point hyperparameters change.
在一种可能的实施例中,定点化模块在确定优化后的该待定点化单元输出的特征值的定点化超参之后,还用于:基于优化后的该待定点化单元输出的特征值的定点化超参,确定第三定点化超参候选值范围;从该第三定点化超参候选值范围中确定优化后的该待定点化单元输出的特征值的最终定点化超参。相应地,定点化模块基于该定点化超参对优化后的该待定点化单元输出的特征值进行定点化,包括:基于该待定点化单元输出的特征值的最终定点化超参对优化后的该待定点化单元输出的特征值进行定点化。In a possible embodiment, after the fixed-pointing module determines the optimized fixed-pointing hyperparameter of the characteristic value output by the to-be-fixed unit, it is also used to: based on the optimized characteristic value output by the to-be-fixed unit Determine the third fixed-point super-parameter candidate value range; from the third fixed-point super-parameter candidate value range, determine the optimized final fixed-point super-parameter of the characteristic value output by the to-be-fixed unit. Correspondingly, the fixed-pointing module fixes the optimized eigenvalues output by the unit to be fixed based on the super-parameters, including: the final fixed-point super-parameter pair optimized based on the characteristic values output by the unit to be fixed The eigenvalues output by the to-be-fixed unit are fixed-pointed.
在一种可能的实施例中,所述定点化模块从该第三定点化超参候选值范围中确定优化后的该待定点化单元输出的特征值的最终定点化超参,包括:分别确定该第三定点化超参候选值范围中各候选值对应的神经网络的输出误差;将对应的神经网络的输出误差最小的候选值,确定为优化后的该待定点化单元输出的特征值的最终定点化超参。In a possible embodiment, the fixed-pointing module determines from the third fixed-pointing super-parameter candidate value range the final fixed-pointing super-parameters of the characteristic values output by the to-be-fixed unit after optimization, including: respectively determining The output error of the neural network corresponding to each candidate value in the third fixed-point hyperparameter candidate value range; the candidate value with the smallest output error of the corresponding neural network is determined as the eigenvalue output of the optimized unit to be fixed Finally, the super-parameters are fixed-pointed.
在一种可能的实施例中,所述定点化模块分别确定该第三定点化超参候选值范围中各候选值对应的神经网络的输出误差,包括:对于任一候选值,基于第五类型特征值以及第六类型特征值确定该候选值对应的神经网络的输出误差;其中,所述第五类型特征值为使用该候选值对优化后的该待定点化单元输出的特征值进行定点化时,所述神经网络各单元输出的特征值;所述第六类型特征值为原始浮点状态下,所述神经网络各单元输出的特征值。In a possible embodiment, the fixed-pointing module separately determines the output error of the neural network corresponding to each candidate value in the third fixed-pointing hyperparameter candidate value range, including: for any candidate value, based on the fifth type The feature value and the sixth type feature value determine the output error of the neural network corresponding to the candidate value; wherein the fifth type feature value uses the candidate value to locate the optimized feature value output by the to-be-fixed unit When, the eigenvalues output by the units of the neural network; the sixth type eigenvalues are the eigenvalues output by the units of the neural network in the original floating-point state.
在一种可能的实施例中,所述神经网络包括多个单元,各单元包括所述神经网络的一层或连续多层。In a possible embodiment, the neural network includes a plurality of units, and each unit includes one layer or successive multiple layers of the neural network.
请参见图13,为本申请实施例提供的一种神经网络定点化装置的结构示意图,如图13所示,该神经网络定点化装置可以包括:解析模块,用于对输入的浮点模型的拓扑结构进行解析,以生成神经网络数据流图;生成模块,用于基于配置文件中的样本图片信息,生成所述神经网络的数据层;处理模块,用于基于所述配置文件中的待部署平台的优化策略,对所述神经网络的拓扑结构进行拆分和融合,以得到预处理后的浮点模型;定点化模块,用于基于上述方法实施例中描述的方法对所述预处理后的浮点模型进行定点化。Please refer to FIG. 13, which is a schematic structural diagram of a neural network fixed-pointing device provided by an embodiment of this application. As shown in FIG. 13, the neural network fixed-pointing device may include: an analysis module for analyzing the input floating-point model The topology structure is analyzed to generate a neural network data flow graph; a generation module is used to generate the data layer of the neural network based on the sample picture information in the configuration file; the processing module is used to generate the data layer of the neural network based on the configuration file to be deployed The optimization strategy of the platform is to split and merge the topology of the neural network to obtain the pre-processed floating-point model; the fixed-point module is used to perform the pre-processing based on the method described in the above method embodiment The floating-point model is fixed-point.
请参见图14,为本申请实施例提供的一种电子设备的硬件结构示意图。该电子设备可包括处理器1401、存储有机器可执行指令的存储器1402。处理器1401与存储器1402可经由系统总线1403通信。并且,通过读取并执行存储器1402中与编码控制逻辑对应的机器可执行指令,处理器1401可执行上文描述的神经网络定点化方法。Please refer to FIG. 14, which is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of this application. The electronic device may include a
本文中提到的存储器1402可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。The
在一些实施例中,还提供了一种机器可读存储介质,如图14中的存储器1402,该机器可读存储介质内存储有机器可执行指令,所述机器可执行指令被处理器执行时实现上文描述的神经网络定点化方法。例如,所述机器可读存储介质可以是ROM、RAM、CD-ROM、磁带、软盘和光数据存储设备等。In some embodiments, a machine-readable storage medium is also provided, such as the
在一些实施例中,还提供了一种计算机程序,所述计算机程序存储在机器可读存储介质内,所述计算机程序被处理器执行时实现上文描述的神经网络定点化方法。In some embodiments, a computer program is also provided, the computer program is stored in a machine-readable storage medium, and when the computer program is executed by a processor, the neural network fixed-pointing method described above is realized.
在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。In this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such existence between these entities or operations. The actual relationship or order. Moreover, the terms "including", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements includes not only those elements, but also those that are not explicitly listed. Other elements, or also include elements inherent to this process, method, article, or equipment. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or equipment that includes the element.
以上所述仅为本申请的一些实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above are only some embodiments of this application and are not intended to limit this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection of this application. Within the range.
Claims (25)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010038017.1 | 2020-01-14 | ||
| CN202010038017.1A CN113128659B (en) | 2020-01-14 | 2020-01-14 | Neural network localization method and device, electronic equipment and readable storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2021143686A1 true WO2021143686A1 (en) | 2021-07-22 |
Family
ID=76771130
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/071311 Ceased WO2021143686A1 (en) | 2020-01-14 | 2021-01-12 | Neural network fixed point methods and apparatuses, electronic device, and readable storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN113128659B (en) |
| WO (1) | WO2021143686A1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024149245A1 (en) * | 2023-01-13 | 2024-07-18 | 杭州海康威视数字技术股份有限公司 | Decoding method and apparatus, encoding method and apparatus, and devices thereof |
| CN119316617A (en) * | 2023-07-12 | 2025-01-14 | 杭州海康威视数字技术股份有限公司 | A decoding method, device and equipment |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116341633B (en) * | 2023-05-29 | 2023-09-01 | 山东浪潮科学研究院有限公司 | Model deployment method, device, equipment and storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150170020A1 (en) * | 2013-12-13 | 2015-06-18 | Amazon Technologies, Inc. | Reducing dynamic range of low-rank decomposition matrices |
| CN105760933A (en) * | 2016-02-18 | 2016-07-13 | 清华大学 | Method and apparatus for fixed-pointing layer-wise variable precision in convolutional neural network |
| CN106611216A (en) * | 2016-12-29 | 2017-05-03 | 北京旷视科技有限公司 | Calculation method and device based on neural network |
| CN107688849A (en) * | 2017-07-28 | 2018-02-13 | 北京深鉴科技有限公司 | A kind of dynamic strategy fixed point training method and device |
Family Cites Families (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101609416B (en) * | 2009-07-13 | 2012-11-14 | 清华大学 | Method for improving performance tuning speed of distributed system |
| CN109934331B (en) * | 2016-04-29 | 2020-06-19 | 中科寒武纪科技股份有限公司 | Apparatus and method for performing artificial neural network forward operations |
| US10621486B2 (en) * | 2016-08-12 | 2020-04-14 | Beijing Deephi Intelligent Technology Co., Ltd. | Method for optimizing an artificial neural network (ANN) |
| US10643124B2 (en) * | 2016-08-12 | 2020-05-05 | Beijing Deephi Intelligent Technology Co., Ltd. | Method and device for quantizing complex artificial neural network |
| CN106650922B (en) * | 2016-09-29 | 2019-05-03 | 清华大学 | Hardware neural network conversion method, computing device, and software-hardware cooperation system |
| CN107239826A (en) * | 2017-06-06 | 2017-10-10 | 上海兆芯集成电路有限公司 | Calculation method and device in convolutional neural network |
| KR102589303B1 (en) * | 2017-11-02 | 2023-10-24 | 삼성전자주식회사 | Method and apparatus for generating fixed point type neural network |
| CN110413255B (en) * | 2018-04-28 | 2022-08-19 | 赛灵思电子科技(北京)有限公司 | Artificial neural network adjusting method and device |
| KR102824642B1 (en) * | 2018-05-14 | 2025-06-25 | 삼성전자주식회사 | Method and apparatus for quantization of neural network |
| CN109635935B (en) * | 2018-12-29 | 2022-10-14 | 北京航空航天大学 | Adaptive Quantization Method for Deep Convolutional Neural Network Models Based on Modulo-Length Clustering |
| CN110135565B (en) * | 2019-05-20 | 2023-03-24 | 上海大学 | System for evaluating performance of integrated circuit by aiming at neural network algorithm |
-
2020
- 2020-01-14 CN CN202010038017.1A patent/CN113128659B/en active Active
-
2021
- 2021-01-12 WO PCT/CN2021/071311 patent/WO2021143686A1/en not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150170020A1 (en) * | 2013-12-13 | 2015-06-18 | Amazon Technologies, Inc. | Reducing dynamic range of low-rank decomposition matrices |
| CN105760933A (en) * | 2016-02-18 | 2016-07-13 | 清华大学 | Method and apparatus for fixed-pointing layer-wise variable precision in convolutional neural network |
| CN106611216A (en) * | 2016-12-29 | 2017-05-03 | 北京旷视科技有限公司 | Calculation method and device based on neural network |
| CN107688849A (en) * | 2017-07-28 | 2018-02-13 | 北京深鉴科技有限公司 | A kind of dynamic strategy fixed point training method and device |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024149245A1 (en) * | 2023-01-13 | 2024-07-18 | 杭州海康威视数字技术股份有限公司 | Decoding method and apparatus, encoding method and apparatus, and devices thereof |
| CN119316617A (en) * | 2023-07-12 | 2025-01-14 | 杭州海康威视数字技术股份有限公司 | A decoding method, device and equipment |
| WO2025011638A1 (en) * | 2023-07-12 | 2025-01-16 | 杭州海康威视数字技术股份有限公司 | Decoding method and apparatus, and device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113128659B (en) | 2024-06-28 |
| CN113128659A (en) | 2021-07-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20240161474A1 (en) | Neural Network Inference Acceleration Method, Target Detection Method, Device, and Storage Medium | |
| CN109165664B (en) | Attribute-missing data set completion and prediction method based on generation of countermeasure network | |
| US11341424B2 (en) | Method, apparatus and system for estimating causality among observed variables | |
| Liu et al. | Muon is scalable for LLM training | |
| CN113283426A (en) | Embedded target detection model generation method based on multi-target neural network search | |
| WO2021143686A1 (en) | Neural network fixed point methods and apparatuses, electronic device, and readable storage medium | |
| CN111027629A (en) | Prediction method and system of power outage rate in distribution network based on improved random forest | |
| CN111968744B (en) | Parameter optimization method for stroke and chronic disease models based on Bayesian optimization | |
| JP2020009301A (en) | Information processing apparatus and information processing method | |
| KR20220032861A (en) | Neural architecture search method and attaratus considering performance in hardware | |
| CN118414621A (en) | Supermarameter selection using budget-aware Bayesian optimization | |
| CN119599946A (en) | A road crack detection method, device and electronic equipment | |
| CN120296046A (en) | Intelligent routing optimization method and system for multi-table association query | |
| Gupta et al. | Grafenne: learning on graphs with heterogeneous and dynamic feature sets | |
| CN117371511A (en) | Training method, device, equipment and storage medium for image classification model | |
| CN119514647B (en) | Deep memory transfer learning method based on topological entropy decomposition | |
| CN115168326A (en) | Hadoop big data platform distributed energy data cleaning method and system | |
| CN111026661B (en) | Comprehensive testing method and system for software usability | |
| KR102248975B1 (en) | Learning method of deep convolutional neural network and the apparatus thereof | |
| CN119201130A (en) | A compilation optimization method for dynamic shape operators | |
| CN117669669A (en) | Neural network structure optimization method based on data flow chip and computing equipment | |
| CN116861373A (en) | Query selectivity estimation method, system, terminal equipment and storage medium | |
| CN119415554B (en) | Method and device for constructing a learning query optimizer based on two-stage search | |
| CN120409567B (en) | Transformer adaptive compression method and system in data-limited scenarios | |
| CN117057409B (en) | Structured pruning-based convolutional neural network componentization method under edge cloud cooperative scene |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21741215 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 21741215 Country of ref document: EP Kind code of ref document: A1 |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 21741215 Country of ref document: EP Kind code of ref document: A1 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28.02.2023) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 21741215 Country of ref document: EP Kind code of ref document: A1 |