Task reasoning method and device based on neural network conversion, equipment and medium

By calculating the optimal pulse firing threshold for each neuron, the artificial neural network is transformed into a spiking neural network, which solves the pulse redundancy problem caused by ReLU activation value mapping, improves the network's task inference speed and energy efficiency, and is suitable for mobile devices and IoT terminals.

CN121052302BActive Publication Date: 2026-03-17PEKING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing technologies, when converting artificial neural networks into spiking neural networks, the method of mapping ReLU activation values ​​to pulse firing rates leads to pulse redundancy, which affects the accuracy and efficiency of subsequent task processing.

Method used

By statistically analyzing the mean and variance of each neuron on the target dataset, the optimal pulse firing threshold is calculated. A data-driven method without training is used to automatically set the threshold for converting the ReLU function into a spiking neuron, keeping the network topology unchanged, and transferring weights and biases.

Benefits of technology

It significantly improves the task inference speed and performance of the converted spiking neural network, reduces unnecessary pulse firing, and improves energy efficiency, making it suitable for application scenarios with high speed and energy consumption requirements, such as mobile devices and IoT terminals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121052302B_ABST
    Figure CN121052302B_ABST
Patent Text Reader

Abstract

The application discloses a task reasoning method and device based on neural network conversion, equipment and medium. Including: obtaining a pre-trained artificial neural network, the artificial neural network contains a plurality of neuron layers using ReLU activation function; select the target data set input the artificial neural network, respectively, statistics every neuron on the target data set mean and variance; based on the mean and variance, calculate the optimal pulse firing threshold of each neuron; based on the optimal pulse firing threshold of all neurons, the artificial neural network is converted into a pulse neural network; based on the converted pulse neural network, execute task reasoning. The application can determine the optimal pulse firing threshold of the neuron, convert the artificial neural network into the pulse neural network based on the determined optimal threshold, and significantly improve the task reasoning speed and performance of the converted pulse neural network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a task reasoning method, apparatus, device, and medium based on neural network transformation. Background Technology

[0002] Artificial neural networks are widely used in tasks such as image processing, speech processing, and language processing due to their powerful data processing capabilities. However, their training and inference processes are usually accompanied by high energy consumption, which is not conducive to deployment on resource-constrained devices. In contrast, spiking neural networks, by simulating biological neurons and transmitting information in the form of discrete pulses, have the advantage of processing spatiotemporal data and significantly improve computational efficiency through sparse activation, making them an ideal choice for achieving low-power computing.

[0003] Currently, in the process of converting artificial neural networks into spiking neural networks, many CNN networks need to map their ReLU activation values ​​to spiking rates, and the firing threshold of neurons is crucial. Traditional methods often use 99.9% of the ReLU activation value as the threshold, which may lead to spiking redundancy and affect the accuracy and efficiency of subsequent task processing. Summary of the Invention

[0004] This application provides a task reasoning method, apparatus, device, and medium based on neural network conversion, to at least solve the technical problem of low performance and efficiency of converted spiking neural networks in related technologies.

[0005] According to one aspect of the embodiments of this application, a task reasoning method based on neural network transformation is provided, including:

[0006] Obtain a pre-trained artificial neural network, which contains multiple neuron layers using the ReLU activation function;

[0007] Select a target dataset and input it into the artificial neural network, then calculate the mean and variance of each neuron on the target dataset.

[0008] Based on the mean and variance, the optimal pulse firing threshold for each neuron is calculated;

[0009] Based on the optimal pulse firing threshold of all neurons, the artificial neural network is converted into a spiking neural network;

[0010] Task inference is performed based on the transformed spiking neural network.

[0011] In one implementation, a target dataset is selected and input into the artificial neural network, and the mean and variance of each neuron on the target dataset are calculated, including:

[0012] The target dataset is input into the artificial neural network for forward propagation;

[0013] During forward propagation, the input value of each ReLU neuron is recorded;

[0014] For each ReLU neuron, the mean and variance of its input values ​​on the target dataset are calculated.

[0015] In one implementation, the optimal pulse firing threshold for each neuron is calculated based on the mean and variance, including:

[0016] Set an initial threshold for each neuron;

[0017] The scaling factor is calculated based on the mean, variance, and initial threshold of each neuron.

[0018] The threshold of each neuron is updated based on the scaling factor;

[0019] The scaling factor is updated based on the updated threshold, and the threshold is updated based on the updated scaling factor; this step is repeated until the scaling factor converges.

[0020] Based on the final scaling factor, the optimal pulse firing threshold of the neuron is calculated.

[0021] In one implementation, a scaling factor is calculated based on the mean, variance, and initial threshold of each neuron, including:

[0022]

[0023] in, Represents the proportionality coefficient. Indicates the threshold. This represents the mean. Here, represents the variance, and N represents the degree of quantification.

[0024] In one implementation, updating the threshold of each neuron based on the scaling factor includes:

[0025] The updated threshold is obtained by multiplying the proportional coefficient and the threshold.

[0026] In one implementation, the proportionality coefficient is determined to converge when it satisfies the following formula;

[0027]

[0028] in, Approaching 0.

[0029] In one implementation, the artificial neural network is converted into a spiking neural network based on the optimal spiking threshold for all neurons, including:

[0030] Each ReLU neuron in the artificial neural network is replaced with a spiking neuron in the spiking neural network, while keeping the network topology unchanged;

[0031] Based on the optimal pulse firing threshold of each layer of neurons, the pulse firing threshold in the spiking neural network is obtained;

[0032] The weights and biases in the artificial neural network are transferred to the spiking neural network to obtain the transformed spiking neural network.

[0033] According to another aspect of the embodiments of this application, a task inference apparatus based on neural network transformation is provided, comprising:

[0034] An acquisition module is used to acquire a pre-trained artificial neural network, which contains multiple neuron layers using the ReLU activation function;

[0035] The statistics module is used to select a target dataset and input it into the artificial neural network, and to calculate the mean and variance of each neuron on the target dataset.

[0036] The optimal threshold determination module is used to calculate the optimal pulse firing threshold for each neuron based on the mean and variance.

[0037] A conversion module is used to convert the artificial neural network into a spiking neural network based on the optimal spiking threshold of all neurons.

[0038] The task reasoning module is used to perform task reasoning based on the transformed spiking neural network.

[0039] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described task inference method based on neural network transformation through the computer program.

[0040] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described task inference method based on neural network transformation when it is run.

[0041] The technical solutions provided in this application embodiment may include the following beneficial effects:

[0042] This application provides a task inference method for converting artificial neural networks into spiking neural networks. It determines the optimal spiking threshold for neurons and converts the artificial neural network into a spiking neural network based on this optimal threshold, significantly improving the task inference speed and performance of the converted spiking neural network. The core of this method lies in a data-driven threshold estimation algorithm that requires no training. It automatically sets the optimal threshold for each ReLU function when converting to a spiking neuron, ensuring stable and efficient network performance after conversion. This significantly improves task inference speed, giving spiking neural networks advantages in real-time performance and energy consumption control, making them particularly suitable for applications with extremely high speed and energy consumption requirements, such as mobile devices and IoT terminals. Attached Figure Description

[0043] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0044] Figure 1 This is a flowchart of an optional task reasoning method based on neural network transformation according to an embodiment of this application;

[0045] Figure 2 This is a flowchart of another task reasoning method based on neural network transformation provided in the embodiments of this application;

[0046] Figure 3 This is a structural diagram of a task inference device based on neural network conversion according to an embodiment of this application;

[0047] Figure 4 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0048] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0049] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0050] The purpose of this application is to provide a method for calculating the optimal threshold of the neuron corresponding to the ReLU function in an artificial neural network to spiking neural network. This application proposes a data-driven threshold estimation algorithm without training, called the threshold iteration method, which automatically sets the optimal pulse firing threshold for each ReLU function when converting it to a spiking neuron, in order to minimize the error caused by mismatched activation and firing dynamics.

[0051] Assuming the input of the neuron Follow the mean variance is normal distribution Based on the above assumptions, we introduce Definition 1 to give the overall error function, which is obtained by integrating the function error over the activation value distribution.

[0052] Definition 1 (Error Function)

[0053] During the transformation over T time steps, the quantization error and clipping error of the ReLU function can be expressed as:

[0054] (1)

[0055] (2)

[0056] in, Indicates a given threshold At that time, the expected pulse coding activation value size in the spiking neural network.

[0057] For an IF neuron, N=T; if it is a multi-threshold neuron with 2n positive and negative thresholds, then approximately take... .

[0058] Since directly differentiating the error function to find the optimal threshold is difficult, we propose introducing a variable k to assist in finding the optimal threshold. Consider two cases: one is k multiplied by the output threshold magnitude (see Equation 3), and the other is k multiplied by the threshold during the firing process (see Equation 6). These two cases correspond to the following two lemmas, respectively.

[0059] Lemma 2 (Auxiliary calculation of the location of the extreme points of function 1):

[0060] (3)

[0061] (4)

[0062] When the threshold When fixed, function The minimum value is obtained under the following conditions:

[0063] (5)

[0064] Lemma 3 (Auxiliary calculation of the location of the extreme points of function 2)

[0065] (6)

[0066] (7)

[0067] When the threshold When fixed, function exist The minimum value is obtained at that time.

[0068] According to Lemmas 2 and 3, we can obtain the following inequalities and Theorem 4:

[0069] (8)

[0070] Theorem 4 (convergence proof has an optimal solution).

[0071] From any positive initial value Departure can be based on the current threshold. The mean and variance are continuously calculated using Formula 5 to obtain the proportionality coefficient. Using the update formula The iteration continues until convergence. As long as the initial threshold is greater than 0, meaning the neuron has a positive output, the iteration process will definitely converge, and the globally optimal threshold can eventually be obtained.

[0072] The task reasoning method based on neural network transformation according to embodiments of this application will be described in detail below with reference to the accompanying drawings. Figure 1 As shown, the method mainly includes the following steps:

[0073] S101 obtains a pre-trained artificial neural network containing multiple neuron layers using the ReLU activation function.

[0074] Artificial Neural Networks (ANNs) are computational models that mimic the structure and function of biological neural networks, and are widely used in machine learning and artificial intelligence. They consist of a large number of neurons (nodes) connected by weights to form complex network structures used to process and learn patterns and relationships in data.

[0075] First, obtain a pre-trained artificial neural network model, which can be a model trained for a target reasoning task, such as a pre-trained artificial neural network model for an image classification task or an artificial neural network model for an object detection task.

[0076] The model contains multiple neuron layers using the ReLU activation function, with fixed network parameters that serve as the input for subsequent threshold calculations and transformation operations.

[0077] S102 Select the target dataset and input it into the artificial neural network, and calculate the mean and variance of each neuron on the target dataset.

[0078] In one implementation, a target dataset is selected and input into an artificial neural network, and the mean and variance of each neuron on the target dataset are calculated. This includes: inputting the target dataset into the artificial neural network and performing forward propagation; recording the input value of each ReLU neuron during the forward propagation process; and calculating the mean and variance of the input value of each ReLU neuron on the target dataset.

[0079] First, the target dataset is input into the pre-trained artificial neural network for forward propagation. During propagation, the framework's hook function or a custom layer is used to record the input values ​​of each ReLU neuron in real time. After the forward propagation of the entire dataset is complete, statistical analysis is performed on the input values ​​recorded by each ReLU neuron, calculating its mean and variance. This yields the statistical characteristics of the input values ​​of each ReLU neuron across the entire target dataset, providing data support for subsequent threshold calculations or network optimization.

[0080] The target dataset can be a dataset used for object detection tasks or other inference tasks; this application does not impose any specific limitations.

[0081] S103 calculates the optimal pulse firing threshold for each neuron based on the mean and variance.

[0082] In one implementation, the optimal pulse firing threshold for each neuron is calculated using a "threshold iteration method".

[0083] Specifically, an initial threshold is set for each neuron. A scaling factor is calculated based on the mean, variance, and initial threshold of each neuron. The threshold of each neuron is updated based on the scaling factor; the scaling factor is updated based on the updated threshold; this process is repeated until the scaling factor converges.

[0084] Based on the final scaling factor, the optimal pulse firing threshold of the neuron is calculated.

[0085] In one implementation, the specific steps are as follows:

[0086] Input: Pre-trained ANN model Target dataset D;

[0087] Initialization: Set an initial threshold for each ReLU neuron. ;

[0088] Using the model Perform forward inference on dataset D. Staticly compute the input mean for each ReLU neuron. and variance ;

[0089] Repeat the following process until the scaling factor converges:

[0090] Based on the mean, variance, and initial threshold of each neuron, the scaling factor is calculated, including by the following formula:

[0091]

[0092] in, Represents the proportionality coefficient. Indicates the threshold. This represents the mean. Here, represents the variance, and N represents the degree of quantification.

[0093] Furthermore, the updated threshold is obtained based on the product of the scaling factor and the threshold.

[0094]

[0095] The proportionality coefficient is considered to converge when it satisfies the following formula;

[0096]

[0097] in, Approaching 0.

[0098] The output threshold after convergence is used as the optimal pulse firing threshold for the current neuron.

[0099] S104 converts an artificial neural network into a spiking neural network based on the optimal spiking threshold for all neurons.

[0100] Specifically, each ReLU neuron in the artificial neural network is first replaced with a spiking neuron in the spiking neural network, while keeping the network topology unchanged.

[0101] First, the network structure is mapped. Each ReLU neuron in the pre-trained artificial neural network is replaced with a spiking neuron in the spiking neural network, such as an Integrate-and-Fire (IF) neuron, while keeping the original network topology unchanged, including the number of layers, connection methods, and structural parameters such as convolution kernels.

[0102] Furthermore, based on the calculated optimal pulse firing threshold for each neuron, the pulse firing threshold in the spiking neural network is obtained.

[0103] Finally, the weights and biases in the artificial neural network are transferred to the spiking neural network to obtain the transformed spiking neural network.

[0104] The weights and biases obtained from training in artificial neural networks are initially transferred directly as the corresponding synaptic weights and biases in spiking neural networks, thus realizing the initial construction of a spiking-driven network from a continuous activation value network.

[0105] Optionally, since spiking neurons output 0 or 1 (pulse), while artificial neural networks output continuous values, there is a significant difference in their dynamic range, which can easily lead to activation saturation or information loss in the converted spiking neural network. To reduce the accuracy loss caused by dynamic range mismatch, a weight scaling method can be used, for example, scaling the weights and biases according to the following formula:

[0106]

[0107] in, Represents the weights of the pulse network. This represents the threshold for firing the l-th pulse. This represents the threshold for firing the (l+1)th pulse. Represents the weights of an artificial neural network. This indicates the pulse network bias. This indicates the bias of the artificial neural network.

[0108] Based on this step, the converted spiking neural network is obtained.

[0109] S105 performs task inference based on the transformed spiking neural network.

[0110] In one implementation, after obtaining the converted spiking neural network, task reasoning can be performed.

[0111] For example, preprocessing the image data to be detected, such as normalization and format adjustment, is performed. The converted spiking neural network model is then loaded into the test or deployment environment to ensure that the model's structure and parameters are consistent with those used during training, including key parameters such as the pulse firing threshold.

[0112] The preprocessed image is input into a spiking neural network model. The spiking neurons in the model perform integration and firing operations based on the input signal. The output pulse signal of the spiking network model is decoded into the target detection result. This may involve converting the pulse signal into a probability distribution, and then determining the target category and location based on the probability distribution.

[0113] Through the above process, the converted pulse network model can be applied to target detection tasks, enabling effective task inference operations on test sets or in actual deployment environments.

[0114] Other inference tasks can also be performed based on the converted spiking neural network model, and this application does not impose specific limitations. This application focuses on calculating the theoretically optimal threshold of the neuron corresponding to the ReLU function. This algorithm can be combined with any artificial neural network to spiking neural network conversion method to significantly improve the inference speed and performance of the converted spiking neural network.

[0115] To facilitate understanding of the methods provided in the embodiments of this application, the following description is in conjunction with the appendix. Figure 2 Further description.

[0116] like Figure 2 The diagram shows a flowchart for converting an artificial neural network with a ReLU activation function into a spiking neural network. The process is as follows:

[0117] To obtain a pre-trained artificial neural network with the ReLU activation function: First, you need a pre-trained ANN model that includes the ReLU activation function.

[0118] Statistical analysis of the mean and variance of neurons corresponding to the ReLU activation function: Perform statistical analysis on the neurons corresponding to the ReLU activation function in ANN and calculate the mean and variance of their input values.

[0119] Calculate the neuron threshold: Based on the statistical data obtained in the second step, calculate the optimal spiking threshold of the neurons in the SNN.

[0120] A method for converting any artificial neural network into a spiking neural network is used to obtain the spiking neural network.

[0121] Run the spiking neural network to complete the specified task: Finally, use the transformed spiking neural network model to perform inference operations on the test set or deployment environment to perform target tasks such as classification and detection.

[0122] The optimal impulse firing threshold calculation method proposed in this application has significant advantages over traditional methods that use the 99.9th percentile of ReLU activation as the threshold. Traditional methods may result in excessively frequent impulse firing, leading to redundancy and affecting the accuracy and efficiency of the model. Our method, by accurately calculating the optimal impulse firing threshold for each neuron, can more rationally control the activation frequency of neurons, reduce unnecessary impulse firing, and thus improve energy efficiency.

[0123] Specifically, this method calculates the optimal threshold by statistically analyzing the mean and variance of the input values ​​of ReLU neurons. This threshold better reflects the activation characteristics of neurons, resulting in more precise spiking and avoiding redundancy. Furthermore, this method exhibits good generalization ability and robustness. It can adapt to different ANN models and task requirements, providing an efficient and reliable solution for the conversion from ANN to SNN. This lays the foundation for the widespread deployment of spiking neural networks in practical applications and promotes the development of neuromorphic computing.

[0124] According to another aspect of the embodiments of this application, a task reasoning apparatus based on neural network transformation is also provided for implementing the above-described task reasoning method based on neural network transformation. For example... Figure 3 As shown, the device includes:

[0125] The acquisition module 301 is used to acquire a pre-trained artificial neural network, which contains multiple neuron layers using the ReLU activation function;

[0126] The statistics module 302 is used to select the target dataset and input it into the artificial neural network, and to calculate the mean and variance of each neuron on the target dataset.

[0127] The optimal threshold determination module 303 is used to calculate the optimal pulse firing threshold for each neuron based on the mean and variance.

[0128] The conversion module 304 is used to convert the artificial neural network into a spiking neural network based on the optimal spiking threshold of all neurons.

[0129] Task reasoning module 305 is used to perform task reasoning based on the transformed spiking neural network.

[0130] It should be noted that the task inference device based on neural network conversion provided in the above embodiments is only illustrated by the division of the above functional modules when executing the task inference method based on neural network conversion. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the task inference device based on neural network conversion provided in the above embodiments and the task inference method embodiments based on neural network conversion belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0131] According to another aspect of the embodiments of this application, an electronic device corresponding to the task reasoning method based on neural network transformation provided in the foregoing embodiments is also provided, so as to execute the task reasoning method based on neural network transformation described above.

[0132] Please refer to Figure 4 This illustrates a schematic diagram of an electronic device provided by some embodiments of this application. For example... Figure 4 As shown, the electronic device includes: a processor 400, a memory 401, a bus 402, and a communication interface 403. The processor 400, the communication interface 403, and the memory 401 are connected via the bus 402. The memory 401 stores a computer program that can run on the processor 400. When the processor 400 runs the computer program, it executes the task reasoning method based on neural network conversion provided in any of the foregoing embodiments of this application.

[0133] The memory 401 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 403 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.

[0134] Bus 402 can be an ISA bus, PCI bus, or EISA bus, etc. Buses can be divided into address buses, data buses, control buses, etc. Memory 401 is used to store programs. After receiving execution instructions, processor 400 executes the program. The task reasoning method based on neural network transformation disclosed in any of the aforementioned embodiments of this application can be applied to processor 400, or implemented by processor 400.

[0135] The processor 400 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 400 or by instructions in software form. The processor 400 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 401. The processor 400 reads the information in memory 401 and, in conjunction with its hardware, completes the steps of the above method.

[0136] The electronic device provided in this application embodiment and the task reasoning method based on neural network conversion provided in this application embodiment are based on the same inventive concept and have the same beneficial effects as the methods they adopt, run or implement.

[0137] According to another aspect of the present application, a computer-readable storage medium corresponding to the task reasoning method based on neural network transformation provided in the foregoing embodiments is also provided, wherein a computer program (i.e., a program product) is stored thereon, and the computer program, when run by a processor, executes the task reasoning method based on neural network transformation provided in any of the foregoing embodiments.

[0138] It should be noted that examples of computer-readable storage media may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.

[0139] The computer-readable storage medium provided in the above embodiments of this application and the task reasoning method based on neural network transformation provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.

[0140] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0141] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this patent should be determined by the appended claims.

Claims

1. A neural network conversion-based task inference method, characterized by comprising: The method comprises the following steps: obtaining a pre-trained artificial neural network, wherein the artificial neural network comprises a plurality of neuron layers using a ReLU activation function; inputting a target data set into the artificial neural network to respectively calculate the mean and variance of each neuron on the target data set; based on the mean and variance, calculating the optimal spike firing threshold of each neuron; including: setting the initial threshold of each neuron; based on the mean, variance and initial threshold of each neuron, calculating a proportion coefficient; updating the threshold of each neuron based on the proportion coefficient; updating the proportion coefficient based on the updated threshold, and updating the threshold based on the updated proportion coefficient; repeating the step until the proportion coefficient converges; based on the final proportion coefficient, the optimal spike firing threshold of the neuron is calculated; wherein, based on the mean, variance and initial threshold of each neuron, the proportion coefficient is calculated, including: wherein, represents a proportionality coefficient, represents a threshold value, represents a mean value, represents a variance, N represents a quantization degree; based on the optimal spike firing threshold of all neurons, converting the artificial neural network into a spiking neural network; based on the converted spiking neural network, performing task inference.

2. The method of claim 1, wherein, inputting the target data set into the artificial neural network to respectively calculate the mean and variance of each neuron on the target data set, including: inputting the target data set into the artificial neural network for forward propagation; during forward propagation, recording the input value of each ReLU neuron; for each ReLU neuron, calculating the mean and variance of the input value on the target data set.

3. The method of claim 1, wherein, updating the threshold of each neuron based on the proportion coefficient, including: based on the product of the proportion coefficient and the threshold, the updated threshold is obtained.

4. The method of claim 1, wherein, when the proportion coefficient satisfies the following formula, it is determined that the proportion coefficient converges; wherein approaches 0.

5. The method of claim 1, wherein, based on the optimal spike firing threshold of all neurons, converting the artificial neural network into a spiking neural network, including: replacing each ReLU neuron in the artificial neural network with a corresponding pulse neuron in the spiking neural network, while maintaining the topological structure of the network unchanged; based on the optimal spike firing threshold of each layer of neurons, obtaining the spike firing threshold in the spiking neural network; migrating the weights and biases in the artificial neural network to the spiking neural network to obtain the converted spiking neural network. 6.A task inference apparatus based on neural network conversion, characterized by comprising: The method comprises the following steps: an obtaining module is configured to obtain a pre-trained artificial neural network, wherein the artificial neural network comprises a plurality of neuron layers using a ReLU activation function; a statistical module is configured to input a target data set into the artificial neural network to respectively calculate the mean and variance of each neuron on the target data set; The optimal threshold determination module is configured to calculate the optimal pulse firing threshold of each neuron based on the mean and variance, and includes: setting an initial threshold of each neuron; calculating a scaling factor based on the mean, the variance and the initial threshold of each neuron; updating the threshold of each neuron based on the scaling factor; updating the scaling factor based on the updated threshold, updating the threshold based on the updated scaling factor; repeating the steps until the scaling factor converges; and calculating the optimal pulse firing threshold of each neuron based on the final scaling factor; wherein calculating the scaling factor based on the mean, the variance and the initial threshold of each neuron includes: wherein, represents a proportionality coefficient, represents a threshold value, represents a mean value, represents a variance, N represents a quantization degree; The conversion module is configured to convert the artificial neural network into a pulse neural network based on the optimal pulse firing threshold of all neurons. The task reasoning module is configured to perform task reasoning based on the converted pulse neural network.

7. An electronic device, comprising: A processor and a memory storing program instructions, the processor is configured to execute the program instructions to perform the task reasoning method based on the neural network conversion as claimed in any one of claims 1 to 5.

8. A computer readable medium characterized by A computer readable instruction is stored thereon, and the computer readable instruction is executed by a processor to implement the task reasoning method based on the neural network conversion as claimed in any one of claims 1 to 5.