Image classification method and apparatus, device, medium, and product

The VTR-LIF neuron model with dynamic parameters and ASL function improves SNNs' accuracy, sparsity, and energy efficiency, addressing the limitations of fixed-parameter SNNs in image classification.

US20260378212A1Pending Publication Date: 2026-11-26YUNNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/446653
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Priority Date
2025-05-20
Filing Date
2026-01-12
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing spiking neural networks (SNNs) face challenges in achieving high accuracy, sparsity, and low energy consumption, particularly in image processing tasks, due to fixed firing thresholds and input resistances, which limit adaptability and increase computational complexity and energy consumption.

Method used

The introduction of a variable threshold resist-LIF (VTR-LIF) neuron model with dynamic firing thresholds and input resistances, combined with an adaptive sparse loss (ASL) function, optimizes synaptic weights using a backpropagation algorithm to enhance SNN performance.

Benefits of technology

The VTR-LIF model achieves high classification accuracy (up to 96.25% on CIFAR-10), sparsity, and low energy consumption, making it suitable for edge computing and diverse data processing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260378212A1-D00000_ABST
    Figure US20260378212A1-D00000_ABST
Patent Text Reader

Abstract

The present application provides an image classification method and apparatus, a device, a medium, and a product. The method includes: acquiring to-be-classified image data; and performing classification based on the to-be-classified image data using a classification model, to obtain a classification category, where the classification model is a trained spiking neural network (SNN), the SNN includes a plurality of neural layers, each neural layer includes a plurality of neurons, and each neuron includes a firing threshold and an input resistance; and a process of training the classification model specifically includes: using sample image data as input and a sample classification category as output for the SNN, and optimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm, of the SNN, that is determined based on a cross-entropy loss and an adaptive sparse loss (ASL), to obtain the classification model.
Need to check novelty before this filing date? Find Prior Art

Description

CROSS REFERENCE TO RELATED APPLICATION

[0001] This patent application claims the benefit and priority of Chinese Patent Application No. 202510649907.9, filed with the China National Intellectual Property Administration on May 20, 2025, the disclosure of which is incorporated by reference herein in its entirety as part of the present application.TECHNICAL FIELD

[0002] The present application relates to the technical field of image classification, and in particular, to an image classification method and apparatus, a device, a medium, and a product.BACKGROUND

[0003] Spiking neural networks (SNNs), recognized as the third generation of neural networks, have gained significant attention in recent years within the fields of artificial intelligence and neuromorphic computing due to biological interpretability and low energy consumption. SNNs utilize discrete binary spikes to transmit information, emulating the spike-firing mechanism of biological neurons. In comparison to traditional artificial neural networks (ANNs), SNNs offer potential advantages in processing temporal information and enhancing energy efficiency. However, SNNs currently employed in image processing still struggle with low accuracy.SUMMARY

[0004] The purpose of the present application is to provide an image classification method and apparatus, a device, a medium, and a product, to improve the classification accuracy.

[0005] To achieve the above objective, the present application provides the following technical solutions.

[0006] According to a first aspect, the present application provides an image classification method, including:

[0007] acquiring to-be-classified image data; and

[0008] performing classification based on the to-be-classified image data using a classification model, to obtain a classification category, where the classification model is a trained SNN, the SNN includes a plurality of neural layers, each neural layer includes a plurality of neurons, and each neuron includes a firing threshold and an input resistance; and

[0009] a process of training the classification model specifically includes:

[0010] using sample image data as input and a sample classification category as output for the SNN, and optimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm based on a total loss function, of the SNN, that is determined based on a cross-entropy loss and an adaptive sparse loss (ASL), to obtain the classification model.

[0011] In an embodiment, the performing classification based on the to-be-classified image data using a classification model, to obtain a classification category specifically includes:

[0012] determining a membrane potential based on the to-be-classified image data, the synaptic weight, and the input resistance; and

[0013] comparing the membrane potential with the firing threshold to determine the classification category.

[0014] In an embodiment, in the backpropagation algorithm, the synaptic weight, the firing threshold, and the input resistance are updated using a triangular surrogate gradient.

[0015] In an embodiment, an expression of the ASL is:LS=αl⁢∑l∈L[ρ⁢ log⁡(ρρl_)+(1-ρ)⁢log⁡(1-ρ1-ρl_)]

[0016] where, LS is the ASL, ρ is a target firing rate, l is a number of neural layers, L is the total loss function, ρl is an average firing rate of neurons in an lth layer, and αl is a dynamic coefficient.

[0017] In an embodiment, an expression of the dynamic coefficient is:αl=max⁡(0,ρl_-ρt⁢h⁢r⁢e⁢s⁢h⁢o⁢l⁢d)

[0018] where, ρthreshold is a threshold hyperparameter.

[0019] In an embodiment, an expression of the membrane potential is:uit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,n where,uit,nis the membrane potential, τ is a decay constant,oit-1,nis a spike output of an ith neuron in an nth layer, Rn is the input resistance,Iit,nis a synaptic input current of the ith neuron in the nth layer, and t is a time step.According to a second aspect, the present application provides an image classification apparatus, including:an acquisition module configured to acquire to-be-classified image data; anda classification module configured to perform classification based on the to-be-classified image data using a classification model, to obtain a classification category, where the classification model is a trained SNN, the SNN includes a plurality of neural layers, each neural layer includes a plurality of neurons, and each neuron includes a firing threshold and an input resistance; anda process of training the classification model specifically includes:using sample image data as input and a sample classification category as output for the SNN, and optimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm based on a total loss function, of the SNN, that is determined based on a cross-entropy loss and an adaptive sparse loss (ASL), to obtain the classification model.According to a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the image classification method.

[0026] According to a fourth aspect, the present application provides a computer-readable storage medium, storing a computer program thereon, where the computer program, when executed by a processor, implements the image classification method.

[0027] According to a fifth aspect, the present application provides a computer program product, including a computer program, where the computer program, when executed by a processor, implements the image classification method.

[0028] According to specific embodiments provided in the present application, the present application discloses the following technical effects:

[0029] The present application provides an image classification method and apparatus, a device, a medium, and a product. Classification is performed based on to-be-classified image data using a classification model, to obtain a classification category. The classification model is a trained SNN, the SNN includes a plurality of neural layers, each neural layer includes a plurality of neurons, and each neuron includes a firing threshold and an input resistance. A process of training the classification model specifically includes: using sample image data as input and a sample classification category as output for the SNN, and optimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm based on a total loss function, of the SNN, that is determined based on a cross-entropy loss and an ASL, to obtain the classification model. By setting the firing threshold and the input resistance in the neurons of the SNN, and incorporating the ASL, the neural network can achieve high accuracy, sparsity, and low energy consumption. As a result, the resulting classification model also exhibits advantages of high accuracy, sparsity, and low energy consumption.BRIEF DESCRIPTION OF THE DRAWINGS

[0030] To describe the technical solutions in the embodiments of the present application more clearly, the following briefly describes the accompanying drawings required for the embodiments. Apparently, the accompanying drawings in the following description show merely some examples of the present application, and a person of ordinary skill in the art may still derive other accompanying drawings from these accompanying drawings without creative efforts.

[0031] FIG. 1 is an application environment diagram of an image classification method according to an embodiment of the present application;

[0032] FIG. 2 is a schematic flowchart of an image classification method according to an embodiment of the present application;

[0033] FIG. 3 is a schematic diagram of functional modules in an image classification apparatus according to an embodiment of the present application; and

[0034] FIG. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application.DETAILED DESCRIPTION OF THE EMBODIMENTS

[0035] The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the drawings in the embodiments of the present application. Apparently, the described embodiments are only some rather than all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts should fall within the protection scope of the present application.

[0036] In the prior art, commonly used neuron models include the leaky integrate-and-fire (LIF) model and its variants, which generate spike outputs by comparing the integrated membrane potential with a threshold.

[0037] In terms of training methods, traditional SNNs mainly adopt the following two strategies:

[0038] 1. Method based on ANN-to-SNN conversion: The model is first trained on the ANN, then weights are mapped to the SNN, and spike outputs are used to approximate the continuous activation values. While this method has been successful in static tasks (such as image classification), the accuracy loss during the conversion process is significant, particularly in time-series tasks (such as Dynamic Vision Sensor (DVS) data).

[0039] 2. Direct training method: The backpropagation algorithm (such as backpropagation through time (BPTT)) combined with the surrogate gradient is directly used to optimize SNN parameters. Recently, the direct training method based on the LIF model achieves high accuracy (for example, 95.03%) on datasets like CIFAR-10, which significantly outperforms the conversion method.

[0040] However, despite these advances of SNNs in theory and application, existing solutions still face several technical challenges:

[0041] Difficulty in balancing accuracy and sparsity: The traditional LIF model adopts fixed firing threshold and input resistance, limiting the neuron ability to respond to input. To improve accuracy, the network often increases the firing rate, which reduces sparsity, thus increasing computational complexity and energy consumption. For instance, the average firing rate in existing S-SNN models typically ranges from 0.3 to 0.5, much higher than the ideal sparsity level.

[0042] Insufficient dynamic adaptability: Parameters (such as the firing threshold) of existing models are usually fixed during both training and inference, unable to dynamically adjust based on features of input data. This restricts the robustness and generalization capabilities of SNNs in handling diverse tasks (such as static image classification and dynamic neuromorphic data).

[0043] High energy consumption: Traditional SNNs lack explicit constraints on spike outputs, resulting in high energy consumption on neuromorphic hardware. This is a challenge for low-power scenarios, such as edge computing. For example, the energy consumption of the traditional LIF-SNN is often more than 50% higher than theoretical expectations.

[0044] In response to these challenges, the research and development of the present application are inspired by an in-depth analysis of the performance bottlenecks of SNNs and the exploration of biological neural systems. Biological neurons exhibit high heterogeneity and adaptability, with firing thresholds and synaptic input responses that can dynamically adjust to external stimuli. However, the fixed-parameter design of traditional LIF models fails to fully simulate this characteristic, leading to the limited performance of SNNs in complex tasks. To address this, the research and development team proposes an improved approach: A variable threshold resist-LIF (VTR-LIF) neuron model which incorporates the variable firing threshold and variable input resistance is introduced and combined with the direct training method, to enhance both the expressive capacity and efficiency of SNNs.

[0045] The existing direct training methods are capable of optimizing the synaptic weight but fail to adequately adjust intrinsic neuronal parameters (such as the threshold). Moreover, sparsity, a key feature contributing to the low energy consumption of SNNs, lacks effective control mechanisms. To overcome these shortcomings in the prior art, the present application introduces an SNN training method and output adjustment method based on the VTR-LIF model, addressing the following issues:

[0046] Balance between accuracy and sparsity: By leveraging the variable parameters of the VTR-LIF model and incorporating a sparsity constraint via the ASL function, the average firing rate is controlled at approximately 0.1 while maintaining high accuracy (for example, 96.25% on CIFAR-10), significantly improving sparsity.

[0047] Limited dynamic adaptability: Through dynamic computation of the variable firing threshold and input resistance, combined with a joint optimization mechanism, the present application enables the network to adaptively adjust the parameters, thereby enhancing robustness across diverse tasks (for example, DVS-CIFAR10).

[0048] High energy consumption: By optimizing sparsity and adjusting parameters, the present application reduces spike activity and overall energy consumption, making it more suitable for neuromorphic hardware and edge computing scenarios.

[0049] In summary, building upon existing technologies, the present application overcomes the limitations of traditional SNNs in terms of accuracy, efficiency, and adaptability through the innovative VTR-LIF model and training strategy, offering a new solution for the advancement of SNNs.

[0050] To make the above objectives, features, and advantages of the present application more obvious and easy to understand, the present application will be further described in detail with reference to the accompanying drawings and specific implementations.

[0051] An image classification method provided in the embodiments of the present application may be applied to the application environment shown in FIG. 1. A terminal 102 communicates with a server 104 over a network. A data storage system can store data to be processed by the server 104. The data storage system may be set up separately, integrated on the server 104, or provided on the cloud or other servers. The terminal 102 sends the to-be-classified image data to the server 104. After the server 104 receives the to-be-classified image data, the server 104 classifies the to-be-classified image data by using a classification model based on the to-be-classified image data, to obtain a classification category. The server 104 can feed back to the terminal 102 the classification category. In addition, in some embodiments, the image classification method may be realized by the server 104 or the terminal 102 independently. For example, the terminal 102 directly classifies the to-be-classified image data, or the server 104 obtains the to-be-classified image data from the data storage system and classifies the to-be-classified image data.

[0052] The terminal 102 may be, but is not limited to, various desktop computers, laptops, smartphones, tablets, Internet of Things (IoT) devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, or the like. Portable wearable devices may be smart watches, smart bracelets, headsets, or the like. The server 104 may can be implemented by a standalone server or a server cluster consisting of a plurality of servers, or may be a cloud server.

[0053] In an exemplary embodiment, as shown in FIG. 2, an image classification method is provided. The method is executed by a computer device, specifically, executed separately by a computer device such as the terminal or server, or executed jointly by the terminal and server. In this embodiment of the present application, the method applied to the server 104 in FIG. 1 is used as an example for description. The method includes the following steps 201 to 202. Specifically:

[0054] In step 201, to-be-classified image data is acquired.

[0055] In step 202, classification is performed based on the to-be-classified image data using a classification model, to obtain a classification category. The classification model is a trained SNN, the SNN includes a plurality of neural layers, each neural layer includes a plurality of neurons, and each neuron includes a firing threshold and an input resistance.

[0056] A process of training the classification model specifically includes:

[0057] Sample image data is used as input and a sample classification category as output for the SNN, and a synaptic weight, the firing threshold, and the input resistance of the SNN are optimized using a backpropagation algorithm based on a total loss function, of the SNN, that is determined based on a cross-entropy loss and an ASL, to obtain the classification model. In practical application, the firing threshold and the input resistance are both variable parameters.

[0058] During implementation of the above steps 201 and 202, by setting the firing threshold and the input resistance in the neurons of the SNN, and incorporating the ASL, the neural network can achieve high accuracy, sparsity, and low energy consumption. As a result, the resulting classification model also exhibits advantages of high accuracy, sparsity, and low energy consumption.

[0059] In an exemplary embodiment, the performing classification based on the to-be-classified image data using a classification model, to obtain a classification category specifically includes: determining a membrane potential based on the to-be-classified image data, the synaptic weight, and the input resistance; and comparing the membrane potential with the firing threshold to determine the classification category.

[0060] In an exemplary embodiment, in the backpropagation algorithm, the synaptic weight, the firing threshold, and the input resistance are updated using a triangular surrogate gradient.

[0061] In an exemplary embodiment, the expression of the ASL is:LS=αl⁢∑l∈L[ρ⁢ log⁡(ρρl_)+(1-ρ)⁢log⁡(1-ρ1-ρl_)]

[0062] LS is the ASL, ρ is a target firing rate, l is a number of neural layers, L is the total loss function, ρl is an average firing rate of neurons in an lth layer, and a is a dynamic coefficient.

[0063] In an exemplary embodiment, the expression of the dynamic coefficient is:αl=max(0,ρl−ρthreshold)

[0064] ρthreshold is a threshold hyperparameter.

[0065] In an exemplary embodiment, the expression of the membrane potential is:uit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,nuit,nis the membrane potential, τ is a decay constant,oit-1,nis a spike output of an ith neuron in an nth layer, Rn is the input resistance,Iit,nis a synaptic input current of the ith neuron in the nth layer, and t is a time step, which determines the time step of the spiking neuron.In an exemplary embodiment, the present application further provides a specific process of training the SNN, including:The method uses the VTR-LIF neuron model to directly train the SNN, and the synaptic weight, and the variable firing threshold and input resistance are jointly optimized using the BPTT algorithm. This method can dynamically adjust the neuron parameters during the training process, improving both the time-memory capabilities and sparsity of the network. This method can be applied to image classification (for example, CIFAR-10, CIFAR-100, or Tiny-ImageNet) and neuromorphic data processing (for example, DVS-CIFAR10). The output distribution of VTR-LIF neurons is adjusted by using the ASL function, while the firing rate of neurons is dynamically constrained by the Kullback-Leibler (KL) divergence, ensuring the sparsity and energy efficiency of the SNN. This method adopts cross-entropy loss and balances task performance and network energy consumption through hyperparameters. It can be used to optimize the output of the inference stage of the SNN, reduce energy consumption, and maintain high accuracy.The learnable parameters (the firing threshold and the input resistance) of the VTR-LIF model and synergy with the ASL function represent the core innovations, significantly enhancing SNN performance (for example, achieving 96.25% accuracy on CIFAR-10 and 81.03% on CIFAR-100).The SNN training and output adjustment methods based on the VTR-LIF model are executed by a computer device to train the SNN. The VTR-LIF neuron model (hereinafter referred to as VTR-LIF neuron) which incorporates the variable firing threshold and variable input resistance is introduced and combined with the ASL function, to achieve high accuracy, sparsity, and low energy consumption of the neural network. The method includes the following steps:In step 1, parameters of the SNN are initialized.

[0071] The SNN is constructed on the computer device and includes a plurality of neural layers, and each layer includes a plurality of VTR-LIF neurons. The framework of the SNN adopts the existing framework, in which the neurons are VTR-LIF neurons, that is, neurons with variable firing thresholds and variable input resistances.

[0072] Synaptic weights (w), the firing threshold (⊗n), and the input resistance (Rn) of each layer of VTR-LIF neurons of the network are initialized. n indicates an nth neural layer. The initial parameters are provided for subsequent training to ensure that the network can receive input data and generate initial spike outputs.

[0073] In step 2, the VTR-LIF neuron dynamically calculates a membrane potential and generates a spike output.

[0074] The computer device calculates the membrane potential (ut) of each layer of VTR-LIF neurons at each time step (t) according to the input data (such as the image data or neuromorphic data), and generates the binary spike output (ot) by comparing the membrane potential with the firing threshold. By dynamically adjusting the input resistance and firing threshold, the heterogeneity and adaptability of the neurons are enhanced, and the network ability to process temporal information is improved. A specific calculation process is as follows:

[0075] 1. A synaptic input current(Iit,n)of an ith neuron in an nth layer is calculated: The synaptic input current is the input data. Specifically, neurons in the first layer receive external input (input data), which is multi-temporal data. Neurons at each layer receive data spanning multiple time steps, not just data from the first time step, and output data also span multiple time steps.Iit,n=∑j∈I⁡(n-1)wi,jn-1⁢ojt,n-1ojt,n-1is the spike output of a jth neuron in an (n−1)th layer.wi,jn-1is a synaptic weight between the jth neuron in the (n−1)th layer and the ith neuron in the nth layer, and the known initial value is assigned using a random distribution. I(n−1) is a synaptic input current of the (n−1)th layer.2. The membrane potentialuit,nis updated:uit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,nτ is a decay constant, that is, a known hyperparameter, and the initial value is usually set to 0.5. Rn is the input resistance of the nth layer. Rn is the input resistance of the neurons in the nth layer, and the initial value is a hyperparameter, which may be set to 0.75, 1, or 1.25.The spike outputoit,nis generated:oit,n=f⁡(uit,n,ϑn)={1,if⁢ uit,n>ϑn0,otherwise⊗n is the firing threshold of the neurons in the nth layer, and the initial value is the hyperparameter, which may be set to 0.75, 1, or 1.25, and can be automatically optimized in the training process.In step 3, the network parameters are jointly optimized and the spike output distribution is adjusted.The computer device uses the backpropagation algorithm (such as BPTT) to jointly optimize the synaptic weight w, the firing threshold ⊗n, and the input resistance Rn, and adjusts the spike output distribution of the neurons through the ASL function. Specific steps are as follows:1. The total loss function (L) is calculated as follows:L=(1−λ)LCE+λLS LCE is the cross-entropy loss:LCE(O,Y)=-∑ i=1C⁢yi⁢log⁡(Oi).O is a spike train (a predicted value) of an output layer, Y is a target label, and C is the number of categories. All of these are known values.O can be understood as the output spike train of the neurons in the final layer,oit,ncan be regarded as a vector component (the nth layer) of the vector On, and indicates the spike output of the jth neuron in the nth layer. The relationship between the two is that the output On of each layer (hidden layer) of neurons is transmitted to the next layer (output layer) of neurons until the neurons output the predicted value O. Image classification is to determine which category the input image belongs to, for example, determining whether the image is of a cat or a dog. The image size is H*W*C (height*width*number of channels), and C is the number of image classification categories (there may a plurality of categories in total).The specific prediction method is as follows: First, the image is converted from a tensor of H*W*C dimensions to the spike input signal of the SNN (this step has been integrated into the SNN, and the image feature tensor is directly input into the SNN without the need for prior conversion into a spike signal train), and then the SNN generates the output spike train O according to the input signal. O is the predicted value (the output spike train of the neural network), with a dimension of t*C. An output spike Oi with the highest probability value is selected as the predicted value (the firing rate p can be used as a classification index, and the one outputting most 1s within t time steps, that is, the one with the highest firing count, is selected) for classification, and the index i(i∈C) corresponds to the classification category.Y is a target label, that is, the true value. yi is a vector component of Y. The index i indicates whether the category of an ith category is true (encoded using one-hot encoding, where only the true category is assigned a value of 1 and all other categories are assigned 0). The method to determine whether the prediction is correct is to determine whether the corresponding indexes of Y and 0 are consistent (for example, the index corresponding to the predicted value O is 4, and the index corresponding to the true value Y is 5, which are inconsistent, indicating the prediction is incorrect). LCE is a cross-entropy loss function used to evaluate the model performance. It can be simply understood that the higher the number of correct predictions, the lower the value of LCE, and vice versa. Updating the synaptic weight of the model through the backpropagation algorithm is to make the loss value of the loss function smaller as much as possible.LS is the ASL:LS=αl⁢∑l∈L[ρ⁢ log⁡(ρρl_)+(1-ρ)⁢log⁡(1-ρ1-ρl_)]ρ is the target firing rate (which is a known hyperparameter, for example, 0.1). αl=max(0, ρl−ρthreshold) is a dynamic coefficient. ρthreshold is the threshold for constraining the firing rate, which is a threshold hyperparameter (for example, 0.2). λ is a balance factor (which is a known hyperparameter, for example, 0.5). ρl is the average firing rate.ρl is the average firing rate of neurons in the lth layer, and the calculation formula is:ρl_=1T·Nl⁢∑t∑l∈L oit,lT is the time step, because the spiking neurons are iterative with the time step t, and it is possible to output spikes at each time step. l is the number of layers and Nl is the total number of neurons. This formula is used to calculate the average firing rate of neurons in a layer, that is, the probability that neurons in this layer output 1 (a neuron outputting 1 indicates firing).The gradients are calculated and parameters are updated:The gradients of w, ⊗n, and Rn are:∇L⁡(w,Rn,ϑn)=[∂L∂w,∂L∂Rn,∂L∂ϑn] ∂L∂Rn⁢ and⁢ ∂L∂ϑnare calculated through the chain rule.∂L∂wn=∑t(∂L∂ot,n⁢∂ot,n∂ut,n+∂L∂ut+1,n⁢∂ut+1,n∂ut,n)⁢∂ut,n∂It,n⁢∂It,nwn=
Rn⁢∑t(∂L∂ot,n⁢∂ot,n∂ut,n+∂L∂ut+1,n⁢∂ut+1,n∂ut,n)⁢∂It,nwn∂L∂Rn=∑t(∂L∂ot,n⁢∂ot,n∂ut,n+∂L∂ut+1,n⁢∂ut+1,n∂ut,n)⁢∂ut,n∂Rn=
∑t(∂L∂ot,n⁢∂ot,n∂ut,n+∂L∂ut+1,n⁢∂ut+1,n∂ut,n)⁢It,n, ∂L∂ϑn=∑t=1T ∂L∂ot,n⁢∂ot,n∂ϑn=
∑t=1T∂L∂ot,n⁢∂f⁡(uit,n,ϑn)ϑn=-∑t=1T∂L∂ot,n⁢f′(uit,n,ϑn).In the present application, the triangular surrogate gradient is used to solve the problem that the spike output is not derivable:∂ot,n∂ut,n=1γ2⁢max⁡(0,γ-<semantics definitionURL="">❘<annotation encoding="Mathematica">"\[LeftBracketingBar]"< / annotation>< / semantics>ut,n-ϑn<semantics definitionURL="">❘<annotation encoding="Mathematica">"\[RightBracketingBar]"< / annotation>< / semantics>)γ is a hyperparameter (for example, 1).As shown in the derivation formula above,∂ot,n∂ut,nis included, and the term is not differential (non-derivative), such that the triangular surrogate gradient is selected to approximate the gradient.3. w, ⊗n, and Rn are updated to minimize the loss function.LThe parameter weight updating method involves the backpropagation algorithm. Weights such as w, R, and ⊗ (which can alternatively be referred to as learnable parameter values or weights) are updated as follows according to the calculated gradient:w=w-η⁢∂L∂wR=R-η⁢∂L∂Rϑ=ϑ-η⁢∂L∂ϑη is the learning rate, which is a parameter set manually. The weights are updated using the gradient values calculated above.When the loss value (error value) of the loss function is smaller than the expected loss value, the synaptic weight of the current SNN does not need to be updated, that is, the synaptic weight does not need to be changed, and the initial synaptic weight can be reused.In the present application, a new spiking neuron, VTR-LIF, and a sparsity loss function, ASL, are proposed. More neurons with learnable parameters are introduced into the SNN model, and the parameters are trained using a specialized computer device, resulting in a new model that improves classification accuracy. Additionally, during the training process, the sparsity loss function is employed to constrain the number / distribution of neuron spike outputs (the higher the number of neuron spike outputs, the greater the energy consumption), achieving high energy efficiency.

[0101] The target firing rate is defined, and the KL divergence is used as the loss function Ls to measure the difference between the target firing rate and the actual firing rate. By minimizing this difference, the sparsity constraint is enforced, and the distribution of neuron spike outputs is adjusted accordingly.

[0102] The KL divergence, also known as relative entropy, is an asymmetric metric used to measure the difference between two probability distributions. It is widely employed in information theory, machine learning, and statistics, particularly for comparing model distributions with real-world distributions.

[0103] The adaptive adjustment of neuron parameters is achieved through joint optimization. The ASL function constrains the spike outputs in layers with high firing rates, thereby improving both the sparsity and energy efficiency of the network.

[0104] The following problems can be resolved:1. Low-Power Image Classification on Edge Devices

[0105] Scenario: An intelligent camera monitors wildlife (for example, identifying bears and deer) in wild areas. The device is battery-powered and needs to operate continuously for long term.

[0106] Challenge: Traditional CNNs, which run on GPUs or CPUs, consume significant power (ranging from tens to hundreds of watts), being unsuitable for edge devices with limited resources and causing short battery life.SNN-Based Solutions:

[0107] The SNN encodes image pixels as spike trains. Features are extracted using a spike convolution layer, and the animal classification is determined by counting the number of spikes. The SNN is deployed on a neuromorphic chip (such as Intel Loihi). The sparse computation nature of the SNN dramatically reduces power consumption (for example, Loihi consumes approximately 1 mW when processing the MNIST dataset, while a traditional GPU may require over 50 W). On a smaller subset such as ImageNet, the SNN can achieve accuracy exceeding 90%, while also significantly extending the operational time of the device.

[0108] Problem resolved: This approach resolves high energy consumption and resource constraints, making it suitable for scenarios without an external power supply.2. Real-Time Dynamic Visual Processing (Such as Autonomous Driving)

[0109] Scenario: Self-driving cars use event-based cameras to detect pedestrians or obstacles on the road.

[0110] Challenge: Traditional CNNs require substantial computational power and experience high latency (tens of milliseconds per frame) when processing frame data, being unsuitable for high-speed environments. Additionally, CNNs are sensitive to static frames and fail to fully utilize dynamic information.SNN-Based Solutions:

[0111] Approach: The event-based camera records only pixel changes and outputs a sparse spike stream, which aligns naturally with the SNN. The SNN processes the spike stream, and classifies objects in real-time using temporal coding and spike convolution (for example, “pedestrian” corresponds to a high-frequency spike).

[0112] Results: The SNN achieves classification accuracy of 85%-90% on the DVS dataset (for example, N-Caltech101), with a latency as low as microseconds, which is far superior to the millisecond latency of CNNs. This makes the SNN better suited for high-speed decision-making.

[0113] Problems resolved: This approach resolves high latency and inefficient dynamic data processing, enhancing real-time performance and robustness.3. Sparse Data Classification of Biomedical Signals

[0114] Scenario: Portable electroencephalogram (EEG) equipment is used to analyze sparse EEG signals at low power consumption, aiming to detect epileptic seizures.

[0115] Challenge: Traditional ANNs are inefficient at processing sparse signals, requiring extensive computations, which makes it difficult to meet the real-time and energy consumption constraints of portable devices.SNN-Based Solutions:

[0116] Approach: EEG signals are encoded into spike trains (for example, voltage peak-triggered spikes). The SNN captures epileptic features (such as abnormal high-frequency spikes) through temporal dynamics and outputs classification results (normal / epileptic).

[0117] Results: Research (for example, a paper in Nature Communications in 2020), demonstrates that the SNN can achieve up to 95% accuracy in EEG classification tasks, with power consumption over 10 times lower than traditional methods.

[0118] Problems resolved: This approach achieves efficient processing of sparse signals and meets low-power consumption requirements, making SNNs ideal for wearable medical devices.4. Real-Time Gesture Recognition in Robot Control

[0119] Scenario: The service robot recognizes user gestures (such as “Stop” and “Forward”) through a camera and responds quickly.

[0120] Challenge: Traditional CNNs require numerous floating-point operations, which lead to high latency and power consumption, limiting the performance of robots on low-computing hardware.SNN-Based Solutions:

[0121] Approach: Gesture images are captured by a depth camera and converted into a spike stream. The SNN classifies gestures based on spike frequency. Spike-timing-dependent plasticity (STDP) rules are adopted to enable online learning.

[0122] Results: The SNN achieves 90% accuracy on gesture datasets (such as the DVS gesture dataset), with power consumption reduced to 1 / 50 of traditional methods. The response time is also shortened to less than 10 ms.

[0123] Problems resolved: This approach resolves high latency and computational complexity, enhancing the real-time interaction capabilities of robots.

[0124] Compared to the prior art, the SNN training method and output adjustment method based on the VTR-LIF model provided in the present application offer significant advantages in classification accuracy, computational efficiency, sparsity, energy consumption, robustness, and more.1. Higher Classification Accuracy

[0125] The classification accuracy of the present application on a plurality of benchmark datasets outperforms traditional SNNs and some existing enhanced models. For instance, the accuracy achieved is as follows: 96.25% on the CIFAR-10 dataset, 81.03% on the CIFAR-100 dataset, 63.81% on the Tiny-ImageNet dataset, 88.10% on the DVS-CIFAR10 dataset. All of these surpass traditional technologies (for example, LIF-SNN with fixed parameters, which achieves 95.03% accuracy on the CIFAR-10 dataset).

[0126] A new neuron model is used to train the SNN, improving the classification accuracy. The VTR-LIF model (spike neuron model) introduces learnable neuron firing threshold and learnable resistance to replace the previously fixed parameters. Additionally, the ASL function is incorporated, improving the accuracy.

[0127] Dynamic calculation of membrane potential and spike output generation through VTR-LIF neurons: By introducing the variable firing threshold ⊗n and input resistance Rn, the present application dynamically adjusts the membrane potentialuit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,n,enhancing the heterogeneity of neurons and improving the ability to process temporal information. This dynamic nature allows the network to more accurately capture the spatio-temporal features of the input data, thereby improving classification accuracy.Joint optimization of network parameters and adjustment of spike output distribution: The BPTT algorithm is used to simultaneously optimize the synaptic weight w, firing threshold ⊗n, and input resistance Rn, allowing neuron parameters to be adjusted adaptively during training. Compared to traditional LIF models with fixed parameters, the present application demonstrates higher accuracy in complex tasks.

[0129] Explanation: Traditional SNNs typically use fixed firing threshold and input resistance, which limits the dynamic response of neurons to input. In the present application, the network expressive capability is enhanced through learnable parameters, particularly when handling high-dimensional datasets (such as CIFAR-100 and Tiny-ImageNet), enabling it to better fit complex patterns.2. Higher Computational Efficiency and Sparsity

[0130] The present application significantly improves the sparsity of spike output while maintaining high accuracy. The average firing rate ρl can be controlled at a lower level (for example, approximately 0.1), which is 50%-70% lower than that of traditional SNNs (for example, the average firing rate of S-SNN is around 0.3-0.5). This reduction in firing rate decreases computational load, making the network more suitable for efficient inference.

[0131] Joint optimization of network parameters and adjustment of spike output distribution: The spike output in high-firing-rate layers is dynamically constrained by the ASL function. The dynamic coefficient further ensures that only layers exceeding the threshold are penalized, achieving a balance between accuracy and sparsity.

[0132] Explanation: Traditional SNNs lack explicit control over the firing rate, which can lead to excessive spike activity and increased computational costs. In the present application, the KL divergence is used to optimize the output distribution through the ASL function. Combined with the dynamic adjustment capability of the VTR-LIF model, the network can maintain high performance even under sparse conditions.3. Lower Energy Consumption

[0133] In the present application, thanks to improvements in spike sparsity, the energy consumption of the SNN during the inference stage is significantly reduced. Compared to the traditional LIF model (which consumes about 1.5 to 2 times more energy), the present application achieves a reduction in energy consumption by approximately 30%-50% for the same task. This makes it particularly well-suited for edge computing scenarios with limited resources.

[0134] Joint optimization of network parameters and adjustment of spike output distribution: By optimizing the firing threshold ⊗n and the input resistance Rn, in combination with the ASL function, spike activityρl_=1T·Nl⁢∑ t⁢∑ i∈l⁢oit,lis reduced, resulting in a decrease in the energy consumption of each spike trigger.Explanation: The energy consumption of SNNs primarily comes from spike generation and transmission. In the present application, sparsity optimization reduces the number of spikes, while dynamic parameter adjustments help avoid redundant calculations. Compared to traditional fixed-parameter models, the energy consumption advantage is significant.4. Stronger Robustness and Adaptability

[0136] The present application demonstrates excellent performance across various types of datasets (static images such as CIFAR-10 and dynamic neuromorphic data such as DVS-CIFAR10), while maintaining high accuracy even in noisy environments. The robustness outperforms that of traditional SNNs.

[0137] The VTR-LIF neuron dynamically calculates the membrane potential and generates spike outputs. The variable firing threshold ⊗n and input resistance Rn enable the neuron to adjust adaptively based on the features of the input data, addressing issues of overfitting or underfitting that arise from fixed parameters in traditional LIF models.

[0138] Explanation: Traditional SNNs rely on fixed parameters, limiting the ability to adapt to changes in data distribution. In contrast, the learnable parameters and dynamic adjustment mechanisms in the present application allow flexible adaptation to diverse task requirements.

[0139] Compared to the prior art, the present application has the following core advantages:

[0140] High accuracy: Achieved through the dynamic calculation of the VTR-LIF model in step 2 and the joint optimization in step 3.

[0141] High efficiency and low energy consumption: Resulting from the sparsity constraint of the ASL function and parameter optimization in step 3.

[0142] Strong adaptability: Enabled by the variable parameter design in the dynamic calculation mechanism in step 2.

[0143] These advantages stem from innovations in the method solutions (such as the variable parameters of the VTR-LIF model and the dynamic adjustment of the ASL function), resulting in significant practical value and a competitive edge in the training and application of SNNs.Training Method Based on the Traditional LIF Model Combined with Sparse Regularization

[0144] Description: Building on the traditional LIF model, this approach optimizes synaptic weights through direct training methods (such as BPTT combined with surrogate gradient). An L1 or L2 regularization term is added to the loss function to constrain the spike output distribution of neurons, thereby improving sparsity.Feasibility Analysis:

[0145] Advantages: L1 regularization helps reduce spike output, improves sparsity, decreases energy consumption, and is simple to implement.Limitations:

[0146] Limited accuracy: The LIF model with fixed parameters lacks dynamic adjustment, making it challenging to achieve the high accuracy in the present application (for example, 96.25% on CIFAR-10). Accuracy typically stabilizes around 95%.

[0147] Insufficient sparsity control: L1 regularization imposes a global constraint on spike distribution. Unlike the dynamic adjustment offered by the ASL function in the present application, it cannot specifically adjust layers with high firing rates, limiting the ability to balance sparsity and accuracy effectively.

[0148] Weak adaptability: The fixed threshold and resistance lack the flexibility to adapt to diverse tasks (such as DVS-CIFAR10), resulting in reduced robustness.

[0149] Conclusion: While this solution can improve sparsity to some extent, it falls short of meeting the comprehensive goals of the present application, namely, achieving high accuracy, adaptability, and energy efficiency.2. The Method for Optimizing Spike Coding Based on ANN-to-SNN Conversion

[0150] Description: The model is first trained on a traditional ANN and then converted into an SNN. By optimizing the spike coding mode of the input data (such as rate coding or temporal coding), spike activity is reduced, improving efficiency and sparsity.Feasibility Analysis:

[0151] Advantages: ANN training is well-established, and the high accuracy of the pre-trained model can be leveraged after conversion. Coding optimization reduces spike activity, which helps to improve sparsity.Limitations:

[0152] Accuracy loss: The conversion process inevitably introduces errors, particularly for time-series tasks (for example, DVS-CIFAR10, where accuracy often drops below 88%). This accuracy is lower than that achieved through direct training in the present application.

[0153] Limited sparsity: Coding optimization only affects the input layer and cannot dynamically constrain spike distribution across the entire network, as the ASL function in step 3 of the present application can.

[0154] Energy consumption and efficiency: The converted SNN requires more time steps to approximate the ANN output, leading to higher energy consumption compared to the sparse direct training method used in the present application.

[0155] Conclusion: This solution is effective for static tasks, but it cannot replace the present application for dynamic tasks or for optimizing energy consumption.3. Training Method Based on a Dynamic Threshold LIF Model

[0156] Description: The dynamic threshold is integrated into the traditional LIF model, where the threshold is adaptively adjusted based on the historical membrane potential or input strength. Both the weight and the threshold are optimized through BPTT to improve network performance.Feasibility Analysis:

[0157] Advantages: The dynamic threshold enhances neuron adaptability, potentially improving both accuracy and sparsity. This approach is similar to the variable threshold design in step 2 of the present application.Limitations:

[0158] Lack of input resistance adjustment: By only adjusting the threshold and ignoring the input resistance (for example, Rn in step 2 of the present application), the dynamic response of neurons to input currents is limited. As a result, accuracy and robustness are lower than those achieved in the present application.

[0159] Lack of sparsity control: The absence of an explicit sparsity constraint, such as the ASL function in step 3, makes it difficult to maintain a target average firing rate around 0.1.

[0160] Optimization complexity: The threshold adjustment rules (for example, a) need to be manually designed, which makes joint optimization with weights more challenging. Consequently, the training efficiency is lower than that of the present application.

[0161] Conclusion: This solution shares some dynamic characteristics with the present application but lacks the synergistic effects of input resistance and sparse loss. As a result, it cannot fully achieve the multi-objective optimization that the present application aims for.

[0162] Based on the same inventive concept, the embodiments of the present application further provides an image classification apparatus for realizing the above image classification method. The solution provided by the apparatus is similar to that described in the above method. For specific limitations on one or more embodiments of the image classification apparatus, reference may be made to the limitations on the above image classification method. Details are not described herein again.

[0163] In an exemplary embodiment, as shown in FIG. 3, an image classification apparatus is provided, including an acquiring module and a classification module.

[0164] The acquiring module is configured to acquire to-be-classified image data.

[0165] The classification module is configured to perform classification based on the to-be-classified image data using a classification model, to obtain a classification category, where the classification model is a trained SNN. The SNN includes a plurality of neural layers, each neural layer includes a plurality of neurons, and each neuron includes a firing threshold and an input resistance.

[0166] A process of training the classification model specifically includes:

[0167] Sample image data is used as input and a sample classification category as output for the SNN, and a synaptic weight, the firing threshold, and the input resistance of the SNN are optimized using a backpropagation algorithm based on a total loss function, of the SNN, that is determined based on a cross-entropy loss and an ASL, to obtain the classification model.

[0168] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and an internal structure thereof may be as shown in FIG. 4. The computer device includes a processor, a memory, an input / output (I / O) interface and a communication interface. The processor, the memory and the I / O interface are connected through a system bus. The communication interface is connected to the system bus through the I / O interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer apparatus includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for operations of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store image classification data. The input / output interface of the computer device is configured to exchange information between the processor and an external device. The communication interface of the computer device is configured to communicate with an external terminal through a network. When the computer program is executed by the processor, an image classification method is implemented.

[0169] Those skilled in the art may understand that the structure shown in FIG. 4 is only a block diagram of a part of the structure related to the solutions of the present application and does not constitute a limitation on a computer device to which the solutions of the present application are applied. Specifically, the computer device may include more or less components than those shown in the figure, or combine some components, or have different component arrangements. In an embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the computer program is executed by the processor to implement the above method embodiments.

[0170] In an embodiment, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the above method embodiments.

[0171] In an exemplary embodiment, a computer program product is provided, including a computer program. The computer program, when executed by a processor, implements the above method embodiments.

[0172] It is to be noted that user information (including but not limited to device information of the user, personal information of the user and the like) and data (including but not limited to data for analysis, data for storage, data for exhibition and the like) in the present application are information and data authorized by the user or fully authorized by each party, and relevant data shall be acquired, used and processed according to laws, regulations and standards of related countries and regions.

[0173] In the present application, all actions related to obtaining signals, information, or data are conducted in full compliance with the relevant data protection laws and policies of the local country. Additionally, authorization is obtained from the respective apparatus owner prior to data collection.

[0174] Those of ordinary skill in the art may understand that all or some of the procedures in the method of the foregoing embodiments may be implemented by a computer program instructing related hardware. The computer program may be stored in a nonvolatile computer-readable storage medium. When the computer program is executed, the procedures in the embodiments of the foregoing method may be performed. Any reference to a memory, a database, or other media used in the embodiments of the present application may include a non-volatile and / or volatile memory. The nonvolatile memory may include a read-only memory (ROM), a magnetic tape, a floppy disk, a flash memory, an optical memory, a high-density embedded nonvolatile memory, a resistive random access memory (ReRAM), a magnetoresistive random access memory (MRAM), a ferroelectric random access memory (FRAM), a phase change memory (PCM), a graphene memory, and the like. The volatile memory may include a random access memory (RAM) or an external cache memory. As an illustration rather than a limitation, the RAM may be in various forms, such as a static random access memory (SRAM) or a dynamic random access memory (DRAM).

[0175] The database in the embodiments of the present application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on a blockchain, but is not limited thereto. The processor in the embodiments of the present application may be a general processor, a central processor, a graphics processor, a digital signal processor (DSP), a programmable logic device, and a data processing logic device based on quantum computing, but is not limited thereto.

[0176] The technical characteristics of the above embodiments can be employed in arbitrary combinations. To provide a concise description of these embodiments, all possible combinations of all the technical characteristics of the above embodiments may not be described; however, these combinations of the technical characteristics should be construed as falling within the scope defined by the specification as long as no contradiction occurs.

[0177] Several examples are used herein for illustration of the principles and implementations of this application. The description of the foregoing examples is used to help illustrate the method of this application and the core principles thereof. In addition, those of ordinary skill in the art can make various modifications in terms of specific implementations and scope of application in accordance with the teachings of this application. In conclusion, the content of the present specification shall not be construed as a limitation to this application.

Claims

1. An image classification method, comprising:acquiring to-be-classified image data; andperforming classification based on the to-be-classified image data using a classification model, to obtain a classification category, wherein the classification model is a trained spiking neural network (SNN), the SNN comprises a plurality of neural layers, each neural layer comprises a plurality of neurons, and each neuron comprises a firing threshold and an input resistance; anda process of training the classification model specifically comprises:using sample image data as input and a sample classification category as output for the SNN to obtain the classification model, and optimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm based on a total loss function, of the SNN, the total loss function is determined based on a cross-entropy loss and an adaptive sparse loss (ASL).

2. The image classification method according to claim 1, wherein the performing classification based on the to-be-classified image data using a classification model, to obtain a classification category specifically comprises:determining a membrane potential based on the to-be-classified image data, the synaptic weight, and the input resistance; andcomparing the membrane potential with the firing threshold to determine the classification category.

3. The image classification method according to claim 1, wherein in the backpropagation algorithm, the synaptic weight, the firing threshold, and the input resistance are updated using a triangular surrogate gradient.

4. The image classification method according to claim 1, wherein an expression of the ASL is as follows:Ls=αl⁢∑l∈L[ρlog⁡(ρρl_)+(1-ρ)⁢log⁡(1-ρ1-ρl_)]wherein, LS is the ASL, ρ is a target firing rate, l is a number of neural layers, L is the total loss function, ρl is an average firing rate of neurons in an lth layer, and αl is a dynamic coefficient.

5. The image classification method according to claim 4, wherein an expression of the dynamic coefficient is as follows:αl=max(0,ρl−ρthreshold)wherein, ρthreshold is a threshold hyperparameter.

6. The image classification method according to claim 2, wherein an expression of the membrane potential is as follows:uit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,nwherein,uit,nis the membrane potential, τ is a decay constant,oit-1,nis a spike output of an ith neuron in an nth layer, Rn is the input resistance,Iit,nis a synaptic input current of the ith neuron in the nth layer, and t is a time step.

7. (canceled)8. (canceled)9. (canceled)10. The process of claim 21, wherein the performing classification based on the to-be-classified image data using the classification model to obtain a classification category comprises:determining a membrane potential based on the to-be-classified image data, the synaptic weight, and the input resistance; andcomparing the membrane potential with the firing threshold to determine the classification category.

11. The process of claim 21, wherein in the backpropagation algorithm, the synaptic weight, the firing threshold, and the input resistance are updated using a triangular surrogate gradient.

12. The process of claim 21, wherein an expression of the ASL is as follows:Ls=αl⁢∑l∈L[ρlog⁡(ρρl_)+(1-ρ)⁢log⁡(1-ρ1-ρl_)]wherein, LS is the ASL, ρ is a target firing rate, l is a number of neural layers, L is the total loss function, ρl is an average firing rate of neurons in an lth layer, and αl is a dynamic coefficient.

13. The process of claim 12, wherein an expression of the dynamic coefficient is as follows:αl=max(0,ρl−ρthreshold)wherein, ρthreshold is a threshold hyperparameter.

14. The process of claim 10, wherein an expression of the membrane potential is as follows:uit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,nwherein,uit,nis the membrane potential, τ is a decay constant,oit-1,nis a spike output of an ith neuron in an nth layer, Rn is the input resistance,Iit,nis a synaptic input current of the ith neuron in the nth layer, and t is a time step.

15. The non-transitory computer-readable storage medium according to claim 20, wherein the performing classification based on the to-be-classified image data using a classification model, to obtain a classification category specifically comprises:determining a membrane potential based on the to-be-classified image data, the synaptic weight, and the input resistance; andcomparing the membrane potential with the firing threshold to determine the classification category.

16. The non-transitory computer-readable storage medium according to claim 20, wherein in the backpropagation algorithm, the synaptic weight, the firing threshold, and the input resistance are updated using a triangular surrogate gradient.

17. The non-transitory computer-readable storage medium according to claim 20, wherein an expression of the ASL is as follows:Ls=αl⁢∑l∈L[ρlog⁡(ρρl_)+(1-ρ)⁢log⁡(1-ρ1-ρl_)]wherein, LS is the ASL, ρ is a target firing rate, l is a number of neural layers, L is the total loss function, ρl is an average firing rate of neurons in an lth layer, and αl is a dynamic coefficient.

18. The non-transitory computer-readable storage medium according to claim 17, wherein an expression of the dynamic coefficient is as follows:αl=max(0,ρl−ρthreshold)wherein, ρthreshold is a threshold hyperparameter.

19. The non-transitory computer-readable storage medium according to claim 15, wherein an expression of the membrane potential is as follows:uit,n=τ⁢oit-1,n(1-oit-1,n)+Rn⁢Iit,nwherein,uit,nis the membrane potential, τ is a decay constant,oit-1,nis a spike output of an ith neuron in an nth layer, Rn is the input resistance,Iit,nis a synaptic input current of the ith neuron in the nth layer, and t is a time step.

20. A non-transitory computer-readable storage medium, storing a computer program thereon, wherein the computer program, when executed by a processor, is configured to execute:acquiring to-be-classified image data;performing classification based on the to-be-classified image data using a classification model, to obtain a classification category, whereinthe classification model is a trained spiking neural network (SNN), the SNN comprises a plurality of neural layers, each neural layer comprises a plurality of neurons, and each neuron comprises a firing threshold and an input resistance; andtraining the classification model, whereinthe training of the classification model comprisesusing sample image data as input and a sample classification category as output for the SNN to obtain the classification model, andoptimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm, based on a total loss function, of the SNN, the total loss function is determined based on a cross-entropy loss and an adaptive sparse loss (ASL).

21. An image classification process, comprising:training the classification model specifically comprises:using sample image data as input and a sample classification category as output for the SNN, and optimizing a synaptic weight, the firing threshold, and the input resistance of the SNN using a backpropagation algorithm based on a total loss function, of the SNN, that is determined based on a cross-entropy loss and an adaptive sparse loss (ASL), to obtain the classification model.