## 2 Network Model
### Pulse Coding  
The spiking neural network simulates biological neurons receiving pulse sequences as input. In order to design an efficient SNN system, it is necessary to adopt an appropriate pulse coding strategy to encode sample data or external stimuli into discrete pulse sequences. The researchers draw on the coding mechanism of biological neurons for specific stimulation signals, and mainly provide two types of pulse coding methods: coding based on pulse frequency and coding based on pulse time. Frequency coding considers that information is contained in the firing frequency of the pulse. Compared with pulse frequency coding, the algorithm based on pulse time coding assumes that the distinguishing characteristic information is contained in the specific pulse firing time rather than the signal amplitude or pulse density. With stronger biological authenticity and computational efficiency. Considering the generalization ability and applicability of the coding algorithm, this paper converts frame-based static image data into time pulse sequence data processing, and improves it according to practical application and data knowledge.  
Due to the difference in size and format between the input images, it needs to be preprocessed first. This paper normalizes the original image uniformly, multiplies it by the symmetrical convolution kernel, and blurs it into a 28 \(\times\) 28 grayscale image. The pixel value of the image is in the range of [\(-\)2, \(-\)2], while retaining the input characteristics of the image, such as Figure 2 shows the blurring process performed on the handwritten number \"0\" with a pixel of 28 \(\times\) 28.  
Figure 1: Structure of Neural Network.  
The input pulse of the network model is represented by time encoding, and a single neuron can only emit a single pulse, which then acts on the post-neuron through weighted connections. In order to convert the input image into the input pulse sequence, the gray value of each pixel needs to be encoded. Time-to-First-Spike (TTFS) coding is a commonly used linear time coding method for grayscale images. The higher the grayscale value of a pixel, the more obvious the input feature is, and the corresponding pulse will be sent earlier. Lower grayscale values will emit later. That is, the pixels whose pixel values are in the range of \([-2,\,-2]\) after convolution are linearly mapped to the time scale of 0-T in turn. In order to ensure that the initial pulses of all input layers can have a chance to be transmitted to the output layer, the timing of the initial pulses should satisfy.  
\[t=\left|\frac{P_{\text{max}}-P}{P_{\text{max}}-P_{\text{min}}}\cdot(T-L+1)\right| \tag{1}\]  
In the formula: \(P\) is the gray value corresponding to the input pixel, \(P_{\text{max}}\) and \(P_{\text{min}}\) are the maximum and minimum values, respectively; \(T\) is the processing cycle of a single input image; \(L\) is the number of layers of the network model. The result of (1) is rounded down to make it discretized, so as to conform to the discrete-time expression form of the pulse sequence. Whenever a pulse is sent from the input layer at a certain time \(t\), the output layer can respond at least at time \(t+L-1\), which ensures the continuous transmission of the input features within the period \(T\). Apply the Formula (1) to calculate the time \(t\) for each pixel to emit a pulse. During the entire period \(T\), the corresponding pixel generates a pulse every time \(t\). TTFS coding performs discrete linear coding on the gray value for \(T\) periods, so that the pixel values in the range of \([-2,\,-2]\) are projected into the period \(T\), ensuring that most pixels generate pulses within the discrete \(T\) discrete time periods. As shown in Figure 3, the number of excitation pulses of the 784 pixels in the picture \"0\" in the period \(T\), the average number of pulses in the picture is 4.33 through statistical calculation.  
Figure 3: Diagram of Excitation Pulse.  
Figure 2: Blur Processing.