A printed circuit board defect detection method based on pulse neural network
By employing a detection method based on spiking neural networks and utilizing biological synaptic structures and unsupervised learning algorithms, efficient and accurate printed circuit board defect detection has been achieved. This solves the problems of low efficiency and poor accuracy in existing technologies and meets the detection needs of complex welding defects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DALIAN UNIV
- Filing Date
- 2024-12-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies are inefficient and inaccurate in the detection of defects in printed circuit boards. They are particularly difficult to achieve ideal detection accuracy when dealing with complex soldering defects. Furthermore, automated optical inspection technology has a high false alarm rate and cannot meet the demand for high-quality and high-efficiency inspection.
A detection method based on spiking neural networks is adopted. By modeling biological synaptic structures and training spiking neural networks with unsupervised learning algorithms, and by utilizing event-driven computation and synaptic weight adjustment, high-precision defect detection is achieved.
It improves the accuracy and efficiency of printed circuit board defect detection, reduces power consumption, enhances the robustness and generalization ability of the network, and adapts to the image detection needs of different resolutions and sizes.
Smart Images

Figure CN122156034A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition technology, specifically relating to a method for detecting defects in printed circuit boards based on a spiking neural network. Background Technology
[0002] Printed circuit boards (PCBs) are widely used in mobile phones, smart wearable devices, and other electronic products, serving as the bridge connecting various electronic components and enabling their functions. In recent years, the manufacturing precision of PCBs has continuously improved, with trace widths decreasing from a few micrometers to tens of nanometers, undoubtedly posing significant challenges to the production process. However, PCB manufacturing is inevitably affected by various uncertainties, including but not limited to fluctuations in raw material quality, insufficient stability of production equipment, temperature changes, environmental humidity, and human error. These factors can all lead to various defects in PCBs, such as short circuits, open circuits, burrs, and component damage, severely impacting product performance and reliability.
[0003] Traditional methods for detecting defects in printed circuit boards (PCBs) primarily rely on manual visual inspection using tools such as microscopes. This approach is not only inefficient and costly, but the results are also susceptible to subjective factors such as the inspector's experience, eyesight, and fatigue, making it difficult to guarantee consistency and accuracy. Furthermore, as the complexity of PCBs increases, the difficulty and error rate of manual inspection also rise.
[0004] To overcome this challenge, the industry has introduced automated optical inspection technology, which uses high-precision cameras and image processing algorithms to automatically identify defects on printed circuit boards. Although automated optical inspection technology has improved inspection efficiency and reduced labor costs to some extent, it still has limitations in practical applications, such as a high false alarm rate, especially when dealing with complex welding defects, where its identification ability is limited and it is difficult to achieve ideal inspection accuracy.
[0005] Patent CN118887161A proposes a lightweight printed circuit board (PCB) inspection method, aiming to improve inspection efficiency and accuracy by optimizing data processing algorithms. However, despite the progress made in algorithm lightweighting, its inspection efficiency and accuracy still need further improvement to meet the growing demand for PCB inspection and to adapt to the urgent need of the current PCB manufacturing industry for high-quality, high-efficiency inspection technologies. Summary of the Invention
[0006] To overcome the shortcomings of existing technologies, this invention provides a method for detecting defects in printed circuit boards based on spiking neural networks. This invention can detect defects in printed circuit boards with high accuracy and high efficiency.
[0007] The above-mentioned objective of this invention is achieved through the following technical solution:
[0008] A method for detecting defects in printed circuit boards based on spiking neural networks includes the following steps:
[0009] S1. Based on the biological synaptic structure, spiking neurons are modeled, the information to be transmitted is encoded, and the response function of spiking neurons is set. Spiking neurons are combined to form a spiking neural network.
[0010] S2. Train the spiking neural network using an unsupervised learning algorithm;
[0011] S3. Adjust the synaptic weights to obtain the desired spiking neural network;
[0012] S4. Use an image acquisition device to acquire image data of the printed circuit board to be inspected, process the data, input the processed image data to be inspected into the desired spiking neural network, determine whether there are defects in the printed circuit board based on the spiking neural network, and output the inspection results.
[0013] Furthermore, the spiking neurons in step S1 are divided into presynaptic spiking neurons and postsynaptic spiking neurons. The presynaptic spiking neurons emit pulses, and the postsynaptic spiking neurons receive the pulses transmitted by the presynaptic spiking neurons. After receiving the pulse stimulation, the postsynaptic spiking neurons gradually return to a stable state. When the pulse stimulation received by the postsynaptic spiking neurons reaches a threshold, new pulses are generated according to the synaptic weights to perform event-driven calculations.
[0014] Furthermore, the encoding in step S1 is to compile the information into the frequency of pulses formed by spiking neurons.
[0015] Furthermore, the response function of the spiking neuron in step S1 is:
[0016]
[0017] In the above formula, p(t) represents the response function of the spiking neuron, k represents the number of pulses emitted by a neuron within a certain time period, and t represents the current pulse time. i This indicates the specific time point at which the pulse occurs, and δ represents the pulse function at t = t i The value at time is infinity, and the value at all other time points is zero.
[0018] Furthermore, the spiking neurons described in step S1 form a spiking neural network through synaptic connections. The spiking neural network includes an input layer, a hidden layer, and an output layer.
[0019] Furthermore, the specific steps for training the spiking neural network using the unsupervised learning algorithm described in step S2 are as follows:
[0020] T1. Select a suitable input dataset, preprocess the data, and convert the data into pulse signals;
[0021] T2. Set the initial threshold and synaptic weights;
[0022] T3. Select an unsupervised learning algorithm and input the pulse signal into the spiking neural network for training;
[0023] T4. Evaluate the performance of the trained spiking neural network using classification accuracy and clustering quality, and adjust the parameters of the spiking neural network based on the evaluation results.
[0024] Furthermore, the method for adjusting synaptic weights in step S3 includes:
[0025] Q1. Detect the firing timing of presynaptic and postsynaptic spiking neurons;
[0026] Q2. If the pulse of the presynaptic spiking neuron fires before that of the postsynaptic spiking neuron, the synaptic weight between the two spiking neurons is enhanced.
[0027] Q3. If the pulse of the presynaptic spiking neuron fires after that of the postsynaptic spiking neuron, the synaptic weight between the two spiking neurons is weakened.
[0028] Furthermore, the method for adjusting synaptic weights in step S3 includes:
[0029] W1. Input data from the input layer, and after processing by the spiking neural network, obtain the actual output of the output layer;
[0030] W2. Compare the actual output with the expected output, calculate the difference between the two, and define the difference between the two as the square of the difference between the corresponding functions of the actual pulse sequence and the expected pulse sequence.
[0031] The difference between the two is:
[0032]
[0033] In the above formula, E(t) represents the squared result of the difference between the corresponding functions of the actual pulse sequence and the expected pulse sequence. This represents the pulse sequence actually output by the spiking neural network. This represents the expected output pulse sequence of a spiking neural network.
[0034] W3. Propagate the difference signal between the two back to the pulse neural network and calculate the error gradient of each layer layer by layer.
[0035] W4. Based on the error gradient, use gradient descent to update the synaptic weights of the spiking neural network.
[0036] Furthermore, the data processing method described in step S4 includes preprocessing and pulse conversion. Preprocessing includes normalization, noise reduction, and data augmentation. Pulse conversion converts the input data into a pulse signal.
[0037] Furthermore, the input data is converted into pulse signals using one of the following methods: rate coding, time coding, or Poisson coding.
[0038] The beneficial effects of this invention compared to existing technical solutions are:
[0039] 1. The spiking neural network in this invention adopts event-driven computing, which can realize parallel computing. Since the spiking neurons are only active when receiving or emitting pulses, the spiking neural network can reduce power consumption and has high energy efficiency when processing tasks.
[0040] 2. This invention simulates a real-world spiking neural network by adjusting the synaptic strength based on the pulse time difference between presynaptic and postsynaptic spiking neurons. This strengthens the connections between interconnected neurons, enabling the formation of specific functional modules and optimizing the overall network performance.
[0041] 3. In this invention, the postsynaptic spiking neurons only generate new pulses based on synaptic weights after receiving pulse stimulation to a threshold, thus giving the spiking neural network high robustness.
[0042] 4. This invention selects an unsupervised learning algorithm to train a spiking neural network, which can learn and adjust connections autonomously based solely on the temporal and statistical characteristics of the input model, even without labeled data, thereby achieving effective representation and processing of the data.
[0043] 5. This invention quantifies the difference between the input layer and the output layer, providing a clear difference metric, which facilitates the evaluation of network performance during training.
[0044] 6. This invention adjusts the weights of each layer of the spiking neural network by adjusting the error between the input layer and the output layer, ensuring that the spiking neural network can gradually reduce the difference between the actual output and the expected output, thereby improving the accuracy and generalization ability of the network.
[0045] 7. The present invention performs preprocessing on the data of the printed circuit board before detection, which can greatly improve the accuracy of the spiking neural network detection. Attached Figure Description
[0046] Figure 1This is a flowchart of the printed circuit board defect detection method of the present invention.
[0047] Figure 2 This is a schematic diagram of the spiking neuron of the present invention.
[0048] Figure 3 This is a schematic diagram of the synaptic structure in the spiking neural network of the present invention.
[0049] Figure 2 The left side of the image shows a schematic diagram of the structure of a traditional neuron, while the right side shows a schematic diagram of the structure of the spiking neuron of this invention. Figure 3 The upper middle section is a schematic diagram of the biological synaptic structure, and the lower section is a schematic diagram of the synaptic structure in the spiking neural network of this invention. Detailed Implementation
[0050] The present invention will now be described in detail through specific embodiments, but this does not limit the scope of protection of the present invention.
[0051] Example 1
[0052] like Figure 1-3 As shown, a method for detecting defects in printed circuit boards based on spiking neural networks includes the following steps:
[0053] S1. Based on the biological synaptic structure, spiking neurons are modeled, the information to be transmitted is encoded, and the response function of spiking neurons is set. Spiking neurons are combined to form a spiking neural network.
[0054] Spiking neurons have two functions: emitting and receiving pulses. In a synaptic structure, spiking neurons are divided into presynaptic spiking neurons and postsynaptic spiking neurons. Presynaptic spiking neurons emit pulses, and postsynaptic spiking neurons receive pulses transmitted by presynaptic spiking neurons. After receiving pulse stimulation, postsynaptic spiking neurons gradually return to a stable state. When the pulse stimulation received by postsynaptic spiking neurons reaches a threshold, they will generate new pulses according to the synaptic weights to perform event-driven computation.
[0055] Spiking neural networks can only process pulse signals. Therefore, when using them, information needs to be compiled into the frequency of pulses generated by spiking neurons, that is, pulse sequences. Information is encoded and transmitted through pulse sequences. The emission time of each pulse represents specific input signal information. Therefore, this timing coding method can effectively reflect the dynamic characteristics of input information.
[0056] The spiking neuron response function refers to the neuron's response to input impulses. It describes how the spiking neuron's membrane potential changes over time and how the spiking neuron responds to impulse inputs. Specifically, the response function includes multiple impulse functions to simulate the sensitivity of biological neurons to input impulses of different times and intensities. The impulse sequence provides input information, while the spiking neuron's response function translates this information into dynamic changes in membrane potential, thereby determining when to fire impulses.
[0057] The spiking neuron response function allows spiking neurons to dynamically adjust their membrane potential based on the temporal distribution and frequency of the received pulse sequence, thereby integrating and processing information. Different response functions can simulate different types of spiking neuron characteristics (such as excitability and inhibition), enabling the network to adapt to different input patterns and learning tasks. The spiking neuron response function is sensitive to the time interval of the pulses, capturing the temporal relationship of the input pulses, thus achieving efficient information encoding and transmission. The spiking neuron response function is set as follows:
[0058]
[0059] In the above formula, p(t) represents the response function of the spiking neuron, k represents the number of pulses emitted by a neuron within a certain time period, and t represents the current pulse time. i This indicates the specific time point at which the pulse occurs, and δ represents the pulse function at t = t i The value at time is infinity, and the value at all other time points is zero.
[0060] Spiking neurons form spiking neural networks through synaptic connections. A spiking neural network includes an input layer, a hidden layer, and an output layer. Each spiking neuron can form synapses with multiple spiking neurons, and several spiking neurons are interconnected through synaptic structures to form a spiking neural network.
[0061] S2. Train the spiking neural network using an unsupervised learning algorithm;
[0062] The complete steps for training a spiking neural network using an unsupervised learning algorithm are as follows:
[0063] 1. Data Preparation. Select a suitable input dataset, preferably time-series data or image data with spatial features. Preprocess the data, including normalization, noise reduction, or data augmentation, to improve the network's learning performance.
[0064] 2. Input Encoding. The input data is converted into pulse signals using rate encoding, time encoding, or Poisson encoding. Rate encoding generates the pulse firing frequency based on the intensity of the input signal; time encoding encodes information based on the pulse transmission time; and Poisson encoding generates a random pulse sequence related to the input intensity.
[0065] 3. Network Structure Design. Select a suitable network topology and spiking neuron model. The network topology includes the number of neurons in the input, hidden, and output layers, as well as their connections. The LIF spiking neuron model is chosen to determine the dynamic characteristics of the membrane potential.
[0066] 4. Selection of Unsupervised Learning Algorithms. Unsupervised learning algorithms such as synaptic plasticity, self-organizing maps, or variational inference can be selected. Synaptic plasticity refers to adjusting the connection strength between neurons based on the time difference of pulses; self-organizing maps are generally used for clustering and feature extraction; and variational inference is used to optimize the distribution of latent variables.
[0067] 5. Evaluation and Adjustment. Evaluate the performance of the trained network using appropriate metrics (classification accuracy, clustering quality, etc.), and adjust hyperparameters such as learning rate, time constant, and impulse threshold based on the evaluation results to improve model performance.
[0068] 6. Application and Testing. Apply the trained spiking neural network model to real-world tasks (classification, clustering, etc.) and verify its performance on independent test sets to ensure its generalization ability.
[0069] 7. Results Analysis. The training process, weight changes, and impulse delivery information will be visualized to analyze the dynamic process of model learning. Successful experiences and areas for improvement during training will be summarized to provide a reference for future work.
[0070] S3. Adjust the synaptic weights to obtain the desired spiking neural network;
[0071] Synaptic weights can be adjusted based on the firing time of presynaptic and postsynaptic neuronal pulses. This utilizes the pulse time-dependent plasticity mechanism to adjust the connection strength between neurons at the synapses.
[0072] The specific method for adjusting synaptic weights based on the firing time of presynaptic and postsynaptic neuronal pulses is as follows:
[0073] 1. Detect the firing timing of presynaptic and postsynaptic spiking neurons;
[0074] 2. If the pulse of the presynaptic spiking neuron fires before that of the postsynaptic spiking neuron, the synaptic weight between the two spiking neurons is enhanced.
[0075] 3. If the pulse of the presynaptic spiking neuron fires after that of the postsynaptic spiking neuron, the synaptic weight between the two spiking neurons is weakened.
[0076] S4. Use an image acquisition device to acquire image data of the printed circuit board to be inspected, process the data, input the processed image data to be inspected into the desired spiking neural network, determine whether there are defects in the printed circuit board based on the spiking neural network, and output the inspection results.
[0077] Single-layer printed circuit boards (PCBs) acquire image data using image recognition methods, while multi-layer PCBs employ a combination of X-ray projectors and cameras. Data processing includes normalization, noise reduction, data augmentation, and conversion of the input data into pulse signals using one of rate coding, time coding, or Poisson coding.
[0078] This invention exhibits excellent scalability, allowing for flexible adjustment and optimization of the network based on different defect types and detection requirements, such as adjusting the initial input threshold and synaptic weights. Furthermore, this invention demonstrates excellent flexibility, capable of processing images of varying resolutions and sizes without requiring additional image preprocessing or scaling.
[0079] Example 2
[0080] like Figure 1-3 As shown, a printed circuit board defect detection method based on a spiking neural network differs from Embodiment 1 in that the synaptic weights in this embodiment are adjusted based on the difference between the actual output and the expected output. The overall method includes the following steps:
[0081] S1. Based on the biological synaptic structure, spiking neurons are modeled, the information to be transmitted is encoded, and the response function of spiking neurons is set. Spiking neurons are combined to form a spiking neural network.
[0082] Spiking neurons have two functions: emitting and receiving pulses. In a synaptic structure, spiking neurons are divided into presynaptic spiking neurons and postsynaptic spiking neurons. Presynaptic spiking neurons emit pulses, and postsynaptic spiking neurons receive pulses transmitted by presynaptic spiking neurons. After receiving pulse stimulation, postsynaptic spiking neurons gradually return to a stable state. When the pulse stimulation received by postsynaptic spiking neurons reaches a threshold, they will generate new pulses according to the synaptic weights to perform event-driven computation.
[0083] Spiking neural networks can only process pulse signals. Therefore, when using them, information needs to be compiled into the frequency of pulses generated by spiking neurons, that is, pulse sequences. Information is encoded and transmitted through pulse sequences. The emission time of each pulse represents specific input signal information. Therefore, this timing coding method can effectively reflect the dynamic characteristics of input information.
[0084] The spiking neuron response function refers to the neuron's response to input impulses. It describes how the spiking neuron's membrane potential changes over time and how the spiking neuron responds to impulse inputs. Specifically, the response function includes multiple impulse functions to simulate the sensitivity of biological neurons to input impulses of different times and intensities. The impulse sequence provides input information, while the spiking neuron's response function translates this information into dynamic changes in membrane potential, thereby determining when to fire impulses.
[0085] The spiking neuron response function allows spiking neurons to dynamically adjust their membrane potential based on the temporal distribution and frequency of the received pulse sequence, thereby integrating and processing information. Different response functions can simulate different types of spiking neuron characteristics (such as excitability and inhibition), enabling the network to adapt to different input patterns and learning tasks. The spiking neuron response function is sensitive to the time interval of the pulses, capturing the temporal relationship of the input pulses, thus achieving efficient information encoding and transmission. The spiking neuron response function is set as follows:
[0086]
[0087] In the above formula, p(t) represents the response function of the spiking neuron, k represents the number of pulses emitted by a neuron within a certain time period, and t represents the current pulse time. i This indicates the specific time point at which the pulse occurs, and δ represents the pulse function at t = t i The value at time is infinity, and the value at all other time points is zero.
[0088] Spiking neurons form spiking neural networks through synaptic connections. A spiking neural network includes an input layer, a hidden layer, and an output layer. Each spiking neuron can form synapses with multiple spiking neurons, and several spiking neurons are interconnected through synaptic structures to form a spiking neural network.
[0089] S2. Train the spiking neural network using an unsupervised learning algorithm;
[0090] The complete steps for training a spiking neural network using an unsupervised learning algorithm are as follows:
[0091] 1. Data Preparation. Select a suitable input dataset, preferably time-series data or image data with spatial features. Preprocess the data, including normalization, noise reduction, or data augmentation, to improve the network's learning performance.
[0092] 2. Input Encoding. The input data is converted into pulse signals using rate encoding, time encoding, or Poisson encoding. Rate encoding generates the pulse firing frequency based on the intensity of the input signal; time encoding encodes information based on the pulse transmission time; and Poisson encoding generates a random pulse sequence related to the input intensity.
[0093] 3. Network Structure Design. Select a suitable network topology and spiking neuron model. The network topology includes the number of neurons in the input, hidden, and output layers, as well as their connections. The LIF spiking neuron model is chosen to determine the dynamic characteristics of the membrane potential.
[0094] 4. Selection of Unsupervised Learning Algorithms. Unsupervised learning algorithms such as synaptic plasticity, self-organizing maps, or variational inference can be selected. Synaptic plasticity refers to adjusting the connection strength between neurons based on the time difference of pulses; self-organizing maps are generally used for clustering and feature extraction; and variational inference is used to optimize the distribution of latent variables.
[0095] 5. Evaluation and Adjustment. Evaluate the performance of the trained network using appropriate metrics (classification accuracy, clustering quality, etc.), and adjust hyperparameters such as learning rate, time constant, and impulse threshold based on the evaluation results to improve model performance.
[0096] 6. Application and Testing. Apply the trained spiking neural network model to real-world tasks (classification, clustering, etc.) and verify its performance on independent test sets to ensure its generalization ability.
[0097] 7. Results Analysis. The training process, weight changes, and impulse delivery information will be visualized to analyze the dynamic process of model learning. Successful experiences and areas for improvement during training will be summarized to provide a reference for future work.
[0098] S3. Adjust the synaptic weights to obtain the desired spiking neural network;
[0099] The synaptic weights can be adjusted based on the difference between the actual output and the expected output.
[0100] The specific adjustment method for adjusting synaptic weights based on the difference between the actual output and the expected output is as follows:
[0101] 1. Input data is taken from the input layer, processed by the spiking neural network, and then the actual output of the output layer is obtained.
[0102] 2. Compare the actual output with the expected output and calculate the difference between them. Define the difference between the two as the square of the difference between the corresponding functions of the actual pulse sequence and the expected pulse sequence. The difference can be mean square error or cross entropy, etc., and can be any form of metric, depending on the nature of the problem and the output type of the spiking neural network.
[0103] 3. Propagate the difference signal between the two back to the spiking neural network, and calculate the error gradient of each layer layer by layer;
[0104] 4. Based on the error gradient, use gradient descent to update the synaptic weights of the spiking neural network.
[0105] The difference in step 2 is represented as follows:
[0106]
[0107] In the above formula, E(t) represents the squared result of the difference between the corresponding functions of the actual pulse sequence and the expected pulse sequence. This represents the pulse sequence actually output by the spiking neural network. This represents the expected output pulse sequence of a spiking neural network.
[0108] S4. Use an image acquisition device to acquire image data of the printed circuit board to be inspected, process the data, input the processed image data to be inspected into the desired spiking neural network, determine whether there are defects in the printed circuit board based on the spiking neural network, and output the inspection results.
[0109] Single-layer printed circuit boards (PCBs) acquire image data using image recognition methods, while multi-layer PCBs employ a combination of X-ray projectors and cameras. Data processing includes normalization, noise reduction, data augmentation, and conversion of the input data into pulse signals using one of rate coding, time coding, or Poisson coding.
[0110] This invention exhibits excellent scalability, allowing for flexible adjustment and optimization of the network based on different defect types and detection requirements, such as adjusting the initial input threshold and synaptic weights. Furthermore, this invention demonstrates excellent flexibility, capable of processing images of varying resolutions and sizes without requiring additional image preprocessing or scaling.
[0111] The embodiments described above are merely preferred embodiments of the present invention, and not all feasible embodiments of the present invention. Any obvious modifications made by those skilled in the art without departing from the principles and spirit of the present invention should be considered to be included within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting defects in printed circuit boards based on spiking neural networks, characterized in that, Includes the following steps: S1. Based on the biological synaptic structure, spiking neurons are modeled, the information to be transmitted is encoded, and the response function of spiking neurons is set. Spiking neurons are combined to form a spiking neural network. S2. Train the spiking neural network using an unsupervised learning algorithm; S3. Adjust the synaptic weights to obtain the desired spiking neural network; S4. Use an image acquisition device to acquire image data of the printed circuit board to be inspected, process the data, input the processed image data to be inspected into the desired spiking neural network, determine whether there are defects in the printed circuit board based on the spiking neural network, and output the inspection results.
2. The printed circuit board defect detection method based on a spiking neural network according to claim 1, characterized in that: The spiking neurons in step S1 are divided into presynaptic spiking neurons and postsynaptic spiking neurons. The presynaptic spiking neurons emit pulses, and the postsynaptic spiking neurons receive the pulses transmitted by the presynaptic spiking neurons. After receiving the pulse stimulation, the postsynaptic spiking neurons gradually return to a stable state. When the pulse stimulation received by the postsynaptic spiking neurons reaches a threshold, new pulses are generated according to the synaptic weights to perform event-driven calculations.
3. The printed circuit board defect detection method based on a spiking neural network according to claim 2, characterized in that: The encoding in step S1 is to compile the information into the frequency of pulses formed by spiking neurons.
4. The printed circuit board defect detection method based on a spiking neural network according to claim 3, characterized in that: The response function of the spiking neuron in step S1 is: In the above formula, p(t) represents the response function of the spiking neuron, k represents the number of pulses emitted by a neuron within a certain time period, and t represents the current pulse time. i This indicates the specific time point at which the pulse occurs, and δ represents the pulse function at t = t i The value at time is infinity, and the value at all other time points is zero.
5. The printed circuit board defect detection method based on a spiking neural network according to claim 4, characterized in that: The spiking neurons described in step S1 form a spiking neural network through synaptic connections. The spiking neural network includes an input layer, a hidden layer, and an output layer.
6. The printed circuit board defect detection method based on a spiking neural network according to claim 5, characterized in that: The specific steps for training a spiking neural network using the unsupervised learning algorithm described in step S2 are as follows: T1. Select a suitable input dataset, preprocess the data, and convert the data into pulse signals; T2. Set the initial threshold and synaptic weights; T3. Select an unsupervised learning algorithm and input the pulse signal into the spiking neural network for training; T4. Evaluate the performance of the trained spiking neural network using classification accuracy and clustering quality, and adjust the parameters of the spiking neural network based on the evaluation results.
7. The printed circuit board defect detection method based on a spiking neural network according to claim 6, characterized in that: The method for adjusting synaptic weights in step S3 includes: Q1. Detect the firing timing of presynaptic and postsynaptic spiking neurons; Q2. If the pulse of the presynaptic spiking neuron fires before that of the postsynaptic spiking neuron, the synaptic weight between the two spiking neurons is enhanced. Q3. If the pulse of the presynaptic spiking neuron fires after that of the postsynaptic spiking neuron, the synaptic weight between the two spiking neurons is weakened.
8. The printed circuit board defect detection method based on a spiking neural network according to claim 6, characterized in that: The method for adjusting synaptic weights in step S3 includes: W1. Input data from the input layer, and after processing by the spiking neural network, obtain the actual output of the output layer; W2. Compare the actual output with the expected output, calculate the difference between the two, and define the difference between the two as the square of the difference between the corresponding functions of the actual pulse sequence and the expected pulse sequence. The difference between the two is: In the above formula, E(t) represents the squared result of the difference between the corresponding functions of the actual pulse sequence and the expected pulse sequence. This represents the pulse sequence actually output by the spiking neural network. This represents the expected output pulse sequence of a spiking neural network. W3. Propagate the difference signal between the two back to the pulse neural network and calculate the error gradient of each layer layer by layer. W4. Based on the error gradient, use gradient descent to update the synaptic weights of the spiking neural network.
9. A method for detecting defects in printed circuit boards based on a spiking neural network according to claim 7 or 8, characterized in that: The data processing method described in step S4 includes preprocessing and pulse conversion. Preprocessing includes normalization, noise reduction, and data augmentation. Pulse conversion converts the input data into a pulse signal.
10. The printed circuit board defect detection method based on a spiking neural network according to claim 9, characterized in that: The input data is converted into a pulse signal using one of the following methods: rate coding, time coding, or Poisson coding.