A tower corrosion degree detection method based on a spike Yolo model
By combining the Spike Yolo model with a block-to-cluster attention mechanism and a spike neural network, the problems of slow speed and high complexity of existing tower corrosion detection algorithms are solved, achieving efficient and accurate tower corrosion detection and providing an economical and safe maintenance solution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEILONGJIANG UNIV
- Filing Date
- 2025-03-11
- Publication Date
- 2026-06-09
AI Technical Summary
Existing deep learning-based algorithms for detecting corrosion in iron towers are slow and complex, making it difficult to meet the requirements for efficient detection.
A method for detecting the corrosion level of iron towers based on the Spike Yolo model is adopted. Combining a backbone network, a neck network, and a prediction head, and using a block-to-cluster attention mechanism and a spike neural network, the corrosion level of each part of the iron tower in the image is calculated to determine the most economical and safe maintenance scheme.
It improves the speed and accuracy of tower corrosion detection, reduces detection complexity, provides a reliable reference for tower repair, and reduces labor and time costs.
Smart Images

Figure CN120198395B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and corrosion detection technology, specifically relating to a method for detecting the degree of corrosion of iron towers based on the Spike Yolo model. Background Technology
[0002] To meet the needs of the rapid development of internet technology, the increase in the number of iron towers has become inevitable. Data shows that iron tower construction has broad development prospects, and the demand for iron tower maintenance services is also increasing accordingly. Whether to repair existing towers or demolish and rebuild them has become an important issue. Aging infrastructure, the promotion of 5G and future 6G networks, and equipment upgrades to meet higher technological requirements all have a significant impact on iron tower maintenance. The main cause of iron tower maintenance is infrastructure aging. Because the main body of the iron tower is made of metal, changes in environment and climate can cause corrosion. Corrosion will reduce the load-bearing capacity of the iron tower, shorten its overall service life, and even cause serious consequences such as communication interruptions and complete collapse, while also posing a serious threat to the lives and property of residents around the tower. Therefore, corrosion, as one of the key factors of infrastructure aging, has a significant impact on the structural performance and long-term stability of iron towers. Assessing the degree of aging of iron towers through the degree of corrosion is of great significance. Traditional methods for detecting iron tower corrosion mostly use manual inspection, radiographic inspection, and chemical reagent inspection, which have many problems such as high inspection costs, certain limitations in inspection requirements, incomplete inspection, and cumbersome processes. Furthermore, automated detection methods based on machine learning have been increasingly applied in recent years. These methods significantly improve detection efficiency by extracting manually designed features. However, these methods still have limitations when facing complex environments and large-scale data. To address these issues, many deep learning-based detection algorithms have proposed corresponding solutions, such as convolutional neural networks (CNNs) for image processing. Although CNNs have high accuracy in image processing, their slow computation speed and high complexity remain unavoidable. Therefore, proposing a new method for detecting the degree of corrosion of iron towers is currently urgently needed. Summary of the Invention
[0003] The purpose of this invention is to address the problems of slow computation speed and high complexity of existing deep learning-based detection algorithms, and to propose a method for detecting the degree of corrosion of iron towers based on the Spike Yolo model.
[0004] The technical solution adopted by this invention to solve the above-mentioned technical problems is: a method for detecting the degree of corrosion of iron towers based on the Spike Yolo model, the method specifically including the following steps:
[0005] Step 1: Obtain a dataset of real iron tower images and label each iron tower image in the dataset with the degree of corrosion and the location of corrosion.
[0006] Step 2: Construct a Spike Yolo model for corrosion detection in iron tower images. The Spike Yolo model includes a backbone network, a neck network, and a prediction head; wherein:
[0007] The backbone network includes a first downsampling unit, a first SNNBlock1 module, a second downsampling unit, a second SNNBlock1 module, a third downsampling unit, a first SNNBlock2 module, a fourth downsampling unit, a second SNNBlock2 module, and an SPPF module;
[0008] The neck network includes a first SNNConv layer, a first upsampling unit, a third SNNBlock2 module, a second SNNConv layer, a second upsampling unit, a third SNNBlock1 module, a third SNNConv layer, a fourth SNNBlock1 module, a fourth SNNConv layer, a fourth SNNBlock2 module, a fifth SNNConv layer, and a fifth SNNBlock2 module.
[0009] The working process of the Spike Yolo model is as follows:
[0010] The input of the Spike Yolo model is used as the input of the first downsampling unit, and the output of the first downsampling unit is used as the input of the first SNNBlock1 module.
[0011] The output of the first SNNBlock1 module is used as the input of the second downsampling unit, and the output of the second downsampling unit is used as the input of the second SNNBlock1 module.
[0012] The output of the second SNNBlock1 module is used as the input of the third downsampling unit, and the output of the third downsampling unit is used as the input of the first SNNBlock2 module.
[0013] The output of the first SNNBlock2 module is used as the input of the fourth downsampling unit, the output of the fourth downsampling unit is used as the input of the second SNNBlock2 module, and the output of the second SNNBlock2 module is used as the input of the SPPF module.
[0014] The output of the SPPF module is used as the input of the first SNNConv layer, and the output of the first SNNConv layer is used as the input of the first upsampling unit.
[0015] The output of the first upsampling unit is used as the input of the third SNNBlock2 module, and the output of the third SNNBlock2 module and the output of the first SNNBlock2 module are used as the input of the second SNNConv layer.
[0016] The output of the second SNNConv layer is used as the input of the second upsampling unit, and the output of the second upsampling unit is used as the input of the third SNNBlock1 module.
[0017] The outputs of the second SNNBlock1 module and the third SNNBlock1 module are used as the inputs of the third SNNConv layer, and the output of the third SNNConv layer is used as the input of the fourth SNNBlock1 module.
[0018] The output of the fourth SNNBlock1 module is used as the input of the fourth SNNConv layer, and the output of the fourth SNNConv layer and the output of the second SNNConv layer are used as the input of the fourth SNNBlock2 module.
[0019] The output of the fourth SNNBlock2 module is used as the input of the fifth SNNConv layer, and the output of the fifth SNNConv layer and the output of the first SNNConv layer are used as the input of the fifth SNNBlock2 module.
[0020] The outputs of the fourth SNNBlock1 module, the fourth SNNBlock2 module, and the fifth SNNBlock2 module are used as inputs to the prediction head, and the corrosion degree detection result is output through the prediction head.
[0021] Step 3: Train the Spike Yolo model using a labeled dataset to obtain a trained SpikeYolo model;
[0022] Step 4: Use the image of the tower to be detected as input to the trained Spike Yolo model, and output the tower corrosion detection result through the trained Spike Yolo model.
[0023] The beneficial effects of this invention are:
[0024] This invention adds an attention mechanism to the Yolov8 network architecture and calculates the degree of corrosion of various parts of the tower to determine the most economical and safe maintenance plan.
[0025] 1) The corrosion degree of the iron tower is divided into four types: no corrosion, light corrosion, moderate corrosion and heavy corrosion, which reduces labor and time costs and improves the detection speed of iron tower corrosion.
[0026] 2) The neck network uses a block-to-cluster attention mechanism, which fully utilizes the advantages of the block-to-cluster attention mechanism, which can analyze local areas in detail, summarize the information of each patch, and form a more comprehensive understanding of the overall image, thereby improving the accuracy of tower corrosion detection. Moreover, compared with existing methods, the model structure of the method of this invention is simpler, which effectively improves the calculation speed and reduces the complexity of detection.
[0027] 3) By comparing the number of corroded pixels in all parts of the tower in the image with the total number of pixels of the tower, it is possible to determine whether the corrosion is large-area, providing a reliable reference for resource allocation and priority handling for tower repair. Attached Figure Description
[0028] Figure 1 This is a diagram of the overall structure of the Spike Yolo model;
[0029] Figure 2(a) is an image of the uncorroded iron tower;
[0030] Figure 2(b) is an image of a lightly corroded iron tower;
[0031] Figure 2(c) shows an image of a moderately corroded iron tower;
[0032] Figure 2(d) shows an image of a severely corroded iron tower;
[0033] Figure 3(a) is an image of a steel tower with extensive corrosion.
[0034] Figure 3(b) is an image of a steel tower with extensive corrosion.
[0035] Figure 3(c) shows three images of a heavily corroded iron tower.
[0036] Figure 4 This is a flowchart of the block-to-cluster attention mechanism. Detailed Implementation
[0037] Specific implementation method one: Combining Figure 1 This embodiment describes a method for detecting the degree of corrosion of iron towers based on the SpikeYolo model. The method specifically includes the following steps:
[0038] Step 1: Obtain a dataset of real iron tower images and label each iron tower image in the dataset with the degree of corrosion and the location of corrosion.
[0039] Step 2: Construct a Spike Yolo model for corrosion detection in iron tower images. The Spike Yolo model includes a backbone network, a neck network, and a prediction head; wherein:
[0040] The backbone network includes a first downsampling unit, a first SNNBlock1 module, a second downsampling unit, a second SNNBlock1 module, a third downsampling unit, a first SNNBlock2 module, a fourth downsampling unit, a second SNNBlock2 module, and an SPPF module;
[0041] The neck network includes a first SNNConv layer, a first upsampling unit, a third SNNBlock2 module, a second SNNConv layer, a second upsampling unit, a third SNNBlock1 module, a third SNNConv layer, a fourth SNNBlock1 module, a fourth SNNConv layer, a fourth SNNBlock2 module, a fifth SNNConv layer, and a fifth SNNBlock2 module.
[0042] The working process of the Spike Yolo model is as follows:
[0043] The input of the Spike Yolo model is used as the input of the first downsampling unit, and the output of the first downsampling unit is used as the input of the first SNNBlock1 module.
[0044] The output of the first SNNBlock1 module is used as the input of the second downsampling unit, and the output of the second downsampling unit is used as the input of the second SNNBlock1 module.
[0045] The output of the second SNNBlock1 module is used as the input of the third downsampling unit, and the output of the third downsampling unit is used as the input of the first SNNBlock2 module.
[0046] The output of the first SNNBlock2 module is used as the input of the fourth downsampling unit, the output of the fourth downsampling unit is used as the input of the second SNNBlock2 module, and the output of the second SNNBlock2 module is used as the input of the SPPF (Spatial Pyramid Fusion Feature) module.
[0047] The output of the SPPF module is used as the input of the first SNNConv layer (a convolutional layer specifically designed to work with spike neural networks), and the output of the first SNNConv layer is used as the input of the first upsampling unit.
[0048] The output of the first upsampling unit is used as the input of the third SNNBlock2 module, and the output of the third SNNBlock2 module and the output of the first SNNBlock2 module are used as the input of the second SNNConv layer.
[0049] The output of the second SNNConv layer is used as the input of the second upsampling unit, and the output of the second upsampling unit is used as the input of the third SNNBlock1 module.
[0050] The outputs of the second SNNBlock1 module and the third SNNBlock1 module are used as the inputs of the third SNNConv layer, and the output of the third SNNConv layer is used as the input of the fourth SNNBlock1 module.
[0051] The output of the fourth SNNBlock1 module is used as the input of the fourth SNNConv layer, and the output of the fourth SNNConv layer and the output of the second SNNConv layer are used as the input of the fourth SNNBlock2 module.
[0052] The output of the fourth SNNBlock2 module is used as the input of the fifth SNNConv layer, and the output of the fifth SNNConv layer and the output of the first SNNConv layer are used as the input of the fifth SNNBlock2 module.
[0053] The outputs of the fourth SNNBlock1 module, the fourth SNNBlock2 module, and the fifth SNNBlock2 module are used as inputs to the prediction head, and the corrosion degree detection result is output through the prediction head.
[0054] Step 3: Train the Spike Yolo model using a labeled dataset to obtain a trained SpikeYolo model;
[0055] Step 4: Use the image of the tower to be detected as input to the trained Spike Yolo model, and output the tower corrosion detection result through the trained Spike Yolo model.
[0056] The Spike Yolo model of this invention is mainly composed of three parts in its macroscopic design: Backbone, Neck, and Head. The Backbone is responsible for extracting the basic features of the input data. It uses two different modules, SNNBlock1 and SNNBlock2, to extract features at different levels. SNNBlock1 uses standard convolution to achieve channel mixing, which is suitable for low-level features. SNNBlock2 uses reparameterized convolution to perform channel mixing, which can reduce the computational cost of the model and enhance the feature representation capability. The Neck increases the image size through multiple upsampling operations and stitches it with an image of the same size as the Backbone to fuse features at different scales and levels, thereby improving the model's multi-scale detection capability. The Neck processes pulse signals through SNN block1, SNNBlock2, and SNNConv to extract temporal and spatial features. After processing through the Patch-to-Cluster Attention mechanism, three feature vectors are obtained and fed into the Head. The Head uses the fused features to classify and locate the target, obtaining the target's bounding box, class label, and target confidence score.
[0057] Specific Implementation Method Two: This implementation method differs from Specific Implementation Method One in that, in addition to labeling each image of the iron tower in the dataset with the degree and location of corrosion, the specific steps are as follows:
[0058] Each image of the iron tower was manually labeled with its corrosion level and location. The corrosion level labels included no corrosion, light corrosion, moderate corrosion, and severe corrosion.
[0059] The other steps and parameters are the same as in Specific Implementation Method 1.
[0060] The dataset obtained in this invention includes over 300 images of iron towers. Uncorroded towers have smooth surfaces with almost no rust, having no impact on the tower. Slightly corroded surfaces show a small amount of light red or brown rust, with minimal overall impact. Moderately corroded surfaces turn a darker reddish-brown or orange, eroding part of the metal layer and reducing structural thickness. Severely corroded surfaces appear dark brown, black, or dark red, with significantly altered structural thickness, potentially leading to component deformation or failure. Therefore, the corrosion levels of the iron towers are categorized into four types. When the model identifies no corrosion, it has no impact on the tower and requires no treatment. When the model identifies slight corrosion, treatment involves grinding the corroded area or applying a paint layer. When the model identifies moderate corrosion, the corrosion thickness is further assessed and repaired, with a small number involving structural replacement. When the model identifies severe corrosion, emergency treatment is required, including thorough cleaning of the corroded area, reinforcement of components, and in some cases, structural replacement. Example images of the four corrosion levels are shown in Figures 2(a), 2(b), 2(c), and 2(d).
[0061] Specific Implementation Method Three: This implementation method differs from Specific Implementation Method One or Two in that the working process of the first SNNBlock1 module is as follows:
[0062] Input to the first SNNBlock1 module After passing through the SepConv unit, the output of the SepConv unit is then combined with the input of the first SNNBlock1 module. Add to get the sum
[0063]
[0064] Add the results As the input to the Channel Conv1 unit, the output of the Channel Conv1 unit is connected to... Add them together to get the result. Add the results As the output of the first SNNBlock1 module;
[0065]
[0066] T is the time dimension, C is the channel dimension, H is the height dimension, and W is the width dimension. SepConv(·) is a reverse separable convolutional unit that uses a 7×7 convolution to capture global features, adjusts the number of channels through a 1×1 pointwise convolution, and then uses a 3×3 depthwise convolution to further extract spatial features after fusing channel information.
[0067] The SepConv unit sequentially includes a first PWConv layer, a first BN layer, a first I-LIF (spiking neural network), a first DWConv layer, a second BN layer, a second I-LIF layer, a second PWConv layer, a second DWConv layer, and a third BN layer. SepConv(·) can be described as:
[0068]
[0069] Among them, Conv pw1 This indicates the first PWConv layer, Conv pw2 This indicates the second PWConv layer, Conv dw1 This indicates the first DWConv layer, Conv dw2 SN represents the second DWConv layer, BN represents the peak neural network, and SN represents the batch normalization layer.
[0070] Other steps and parameters are the same as in specific implementation method one or two.
[0071] The operation of other SNNBlock1 modules is the same as that of the first SNNBlock1 module. Since the images in the dataset were taken by different workers under different conditions using mobile phones, the shooting environment and equipment are inconsistent, leading to potentially significant noise in the images. This noise may cause the model to learn irrelevant or incorrect information, thus affecting detection accuracy and generalization ability. The spike neural network used in this invention has a strong ability to suppress noise and also has the advantage of low power consumption.
[0072] Specific Implementation Method Four: This implementation method differs from Specific Implementation Methods One to Three in that the working process of the first SNNBlock2 module is as follows:
[0073] Input to the first SNNBlock2 module After passing through the SepConv unit, the output of the SepConv unit is added to the input of the first SNNBlock2 module to obtain the sum.
[0074]
[0075] Add the results As the input to the Channel Conv2 unit, the output of the Channel Conv2 unit is connected to... Add them together to get the result.
[0076]
[0077] Add the results As the output of the first SNNBlock2 module.
[0078] The other steps and parameters are the same as those in one of the specific implementation methods one to three.
[0079] The operation of other SNNBlock2 modules is the same as that of the first SNNBlock2 module.
[0080] Specific Implementation Method Five: This implementation method differs from Specific Implementation Methods One to Four in that the working process of the ChannelConv1 unit is as follows:
[0081]
[0082] The other steps and parameters are the same as those in one of the specific implementation methods one to four.
[0083] Conv(·) is a standard convolution with a scaling factor of 4, meaning there are 3-pixel gaps between adjacent elements in the convolution kernel. This increases the effective receptive field of the convolution kernel, covering a wider input region while maintaining the same number of kernel parameters.
[0084] Specific Implementation Method Six: This implementation method differs from Specific Implementation Methods One to Five in that the working process of the ChannelConv2 unit is as follows:
[0085]
[0086] Among them, RepConv(·) is a reparameterized convolution with a kernel size of 3×3, which uses reparameterized convolution to minimize the parameter count;
[0087] RepConv(·) contains, in sequence, a pointwise convolutional layer, a depthwise convolutional layer, and a pointwise convolutional layer;
[0088]
[0089] Among them, Conv pw3 This indicates the third PWConv layer, Conv pw4 This indicates the fourth PWConv layer, Conv dw3 This indicates the third DWConv layer.
[0090] The other steps and parameters are the same as those in one of the specific implementation methods one to five.
[0091] Specific Implementation Method Seven: This implementation method differs from Specific Implementation Methods One through Six in that the working process of the SPPF module is as follows:
[0092] Within the SPPF module, the input first passes through a convolutional layer with a kernel size of 1×1 (extracting preliminary features), and then the output of the convolutional layer passes through three max pooling layers in sequence. The feature maps output by the three max pooling layers are concatenated along the channel dimension, and the concatenated result is used as the output of the SPPF module.
[0093] The other steps and parameters are the same as those in one of the specific implementation methods one to six.
[0094] Specific Implementation Method Eight: This implementation method differs from Specific Implementation Methods One to Seven in that the working process of the spike neural network is as follows:
[0095] Step 1: Encode each pixel value in the feature map input to the spike neural network using time coding, and encode each pixel value into a pulse code sequence.
[0096] For a pixel with a value of b, the length of the pulse-coded sequence for pixel value b is the product of b and factor. Assuming the factor is set to 5, the length of the pulse-coded sequence for pixel value 128 is 128 × 5 = 640.
[0097] Map pixel value b to the corresponding pulse intensity a:
[0098]
[0099] Assuming the expansion step size D = 4, then
[0100]
[0101] When pixel value b equals 128, a = 2 is calculated, which means that the pulse intensity corresponding to pixel value 128 is 2; that is, the first and 321st elements in the pulse code sequence of pixel value 128 are 1, and all other elements are 0.
[0102] Similarly, the pulse code sequence for each pixel value is calculated separately;
[0103] Next, add the elements at corresponding positions in each pulse coding sequence (that is, add the first element of each pulse coding sequence and use the sum as the first element of the overall pulse coding sequence, add the second element of each pulse coding sequence and use the sum as the second element of the overall pulse coding sequence, and so on), to obtain a complete pulse coding sequence. Let X be the t-th element of the complete pulse coding sequence. 0 [t], t = 1, 2, ..., T, where T is the total number of elements in the overall pulse code sequence;
[0104] And initialize the time step t = 1;
[0105] Step 2: Initialize the number of neuron layers l = 1;
[0106] Step 3, transfer signal X l-1 [t] Accumulated to historical state H l-1 [t] in (H) 0 [t] is obtained through initialization, thus obtaining the membrane potential U of the l-th layer neuron. l [t]:
[0107] U l [t] = H l-1 [t]+X l-1 [t]
[0108] Among them, X l-1 [t] represents the output of the (l-1)th layer neuron at time step t, H l-1 [t] represents the state of the (l-1)th layer neuron at time step t, U l [t] represents the membrane potential of the l-th layer neuron at time step t;
[0109] S l [t] = Clip(round(U l [t]),0,D)
[0110] Where round(·) represents the rounding operation, and the function Clip(·) satisfies:
[0111]
[0112] Where D represents the expansion step size, according to U l [t] and S l [t] Calculate the state H of the l-th layer neuron at time step t. l [t]:
[0113] H l [t]=β(U l [t]+S l [t])
[0114] Where β is the decay factor;
[0115] Step 4, S l [t] is transformed into an extended binary spike sequence (when S l When the value of [t] is a, then the values of the first to the a-th elements in the extended binary spike sequence are 1, and the values of the remaining Da elements are 0. Let the d-th element in the binary spike sequence be S. l [t,d];
[0116] According to S l[t,d] Calculates the output X of the l-th layer neuron at time step t. l [t]:
[0117]
[0118] Among them, W l This represents the weight matrix of the neurons in the l-th layer;
[0119] Step 5: Does it satisfy l = L, where L is the total number of neuron layers?
[0120] If the condition is not met, then let l = l + 1 and return to step 3.
[0121] If satisfied, proceed to step 6;
[0122] Step 6: Does t = T satisfy the condition?
[0123] If the condition is not met, then let t = t + 1 and return to step 2.
[0124] If satisfied, then X L [1],X L [2],…,X L [T] is the output of the spike neural network.
[0125] The other steps and parameters are the same as those in any of the specific implementation methods one to seven.
[0126] This invention employs a time-based encoding method, where the pulse intensities of all pixels are superimposed to obtain a total pulse intensity. Each pixel value contributes information through its pulse firing time sequence, and this total intensity is passed as input to subsequent network layers. For example, in a pulse sequence X[t] = [0,1,0,1,0], "1" indicates that a neuron fired a pulse at that moment, while "0" indicates that no pulse was fired at the next moment. This encoding method represents information through time intervals; that is, the timing of pulse firing determines the expression of that information.
[0127] Specific Implementation Method Nine: Combining Figure 4 This embodiment is described below. The difference between this embodiment and specific embodiments one through eight is that the attention mechanism within the neck network is a patch-to-cluster attention mechanism. Specifically, the patch-to-cluster attention mechanism is as follows:
[0128] The input to the block-to-cluster attention is divided into H×W blocks, and each block has a C-dimensional feature vector. The feature matrix X, composed of the feature vectors from the H×W blocks, is denoted as X, where each row represents a feature vector from one block. The feature matrix X is then transformed linearly to obtain the query.
[0129] Query = X·W Q
[0130] Where Query is the result of a linear transformation of X, and W Q It is a trainable weight matrix that maps the input features X to the Query space;
[0131] The feature vectors of each block are classified into M clusters. The feature matrix composed of the feature vectors of the M clusters is denoted as X′. Each row of the feature matrix is the arrangement result of the feature vectors of all blocks in a cluster. The feature matrix X′ is multiplied by the weight matrix C′ to obtain the overall feature Z of each cluster.
[0132] Z = X′·C′
[0133] Z is transformed into bond K:
[0134] K = Z·W K
[0135] Among them, W K It is a trainable weight matrix that maps the cluster features Z to the Key space;
[0136] The attention weights A for Query and K are calculated using the Softmax function. These weights represent the relationship between each small block and all clusters.
[0137]
[0138] Here, the superscript T represents transpose, and d is the scaling factor, which makes the attention weights output by the Softmax function smoother;
[0139] The feature Z is mapped to the Value space through a linear transformation to obtain the value V:
[0140] V = Z·W V
[0141] Among them, W V It is a trainable weight matrix that maps the cluster features Z to the Value space;
[0142] By weighting the value V using attention weights, we obtain the final output feature Y of the block-to-cluster attention:
[0143] Y = A·V
[0144] The other steps and parameters are the same as those in one of the specific implementation methods one to eight.
[0145] Traditional methods for detecting corrosion in iron towers typically rely solely on global feature extraction, making it difficult to handle complex local corrosion details. Furthermore, full image processing often requires significant computational resources and time, especially when dealing with high-resolution images. The Patch-to-Cluster Attention mechanism divides the image into multiple small patches and uses a lightweight clustering module to cluster the input sequence into a small number of meaningful clusters, focusing on cluster features to preserve important visual information. The model can analyze these cluster features more effectively, rather than being distracted by various non-critical features in the large image, thus reducing computational and memory consumption and better capturing corrosion details. Moreover, this mechanism can fuse information from various patches, achieving both key region detail detection and establishing connections within the overall structure.
[0146] Specific Implementation Method Ten: This implementation method differs from Specific Implementation Methods One to Nine in that the specific process of step four is as follows:
[0147] Step 41: For the tower to be inspected, firstly acquire images of various parts of the tower, then use the acquired images as input to the trained Spike Yolo model, and output the corrosion detection results of various parts of the tower to be inspected through the trained Spike Yolo model.
[0148] Step 42: Use the Canny edge detection and contour extraction method to process the image of the tower to be detected, and obtain the total number of pixels of the entire tower.
[0149] And count the total number of pixels in the eroded region output by the trained Spike Yolo model (the first step is to locate the eroded region by color segmentation to reduce the computational cost of subsequent contour extraction; the second step is to obtain the number of pixels in the eroded region within all detection boxes using the same contour extraction method).
[0150] Step 4.3: Calculate the percentage of the total number of pixels in the corroded area relative to the total number of pixels in the entire tower under inspection;
[0151] If the percentage exceeds 10%, the tower under inspection is considered to have large-area corrosion. An image of a tower with large-area corrosion would look like this: Figures 3(a) to 3(c) As shown, towers with extensive corrosion require priority treatment.
[0152] If the percentage does not exceed 10%, then the corrosion of individual corrosion areas will be treated sequentially (i.e., for each tower that does not belong to large-area corrosion, the heavily corroded areas within each tower will be treated first, followed by the moderately corroded areas, and finally the lightly corroded areas).
[0153] The other steps and parameters are the same as those in any of the specific implementation methods one to nine.
[0154] The above examples of the present invention are merely illustrative of the computational model and process of the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is impossible to exhaustively list all possible implementations here. Any obvious variations or modifications derived from the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A method for detecting the degree of corrosion of iron towers based on the Spike-Yolo model, characterized in that, The method specifically includes the following steps: Step 1: Obtain a dataset of real iron tower images and label each iron tower image in the dataset with the degree of corrosion and the location of corrosion. Step 2: Construct a Spike Yolo model for corrosion detection in iron tower images. The Spike Yolo model includes a backbone network, a neck network, and a prediction head; wherein: The backbone network includes a first downsampling unit, a first SNNBlock1 module, a second downsampling unit, a second SNNBlock1 module, a third downsampling unit, a first SNNBlock2 module, a fourth downsampling unit, a second SNNBlock2 module, and an SPPF module; The neck network includes a first SNNConv layer, a first upsampling unit, a third SNNBlock2 module, a second SNNConv layer, a second upsampling unit, a third SNNBlock1 module, a third SNNConv layer, a fourth SNNBlock1 module, a fourth SNNConv layer, a fourth SNNBlock2 module, a fifth SNNConv layer, and a fifth SNNBlock2 module. The working process of the Spike Yolo model is as follows: The input of the Spike Yolo model is used as the input of the first downsampling unit, and the output of the first downsampling unit is used as the input of the first SNNBlock1 module. The output of the first SNNBlock1 module is used as the input of the second downsampling unit, and the output of the second downsampling unit is used as the input of the second SNNBlock1 module. The output of the second SNNBlock1 module is used as the input of the third downsampling unit, and the output of the third downsampling unit is used as the input of the first SNNBlock2 module. The output of the first SNNBlock2 module is used as the input of the fourth downsampling unit, the output of the fourth downsampling unit is used as the input of the second SNNBlock2 module, and the output of the second SNNBlock2 module is used as the input of the SPPF module. The output of the SPPF module is used as the input of the first SNNConv layer, and the output of the first SNNConv layer is used as the input of the first upsampling unit. The output of the first upsampling unit is used as the input of the third SNNBlock2 module, and the output of the third SNNBlock2 module and the output of the first SNNBlock2 module are used as the input of the second SNNConv layer. The output of the second SNNConv layer is used as the input of the second upsampling unit, and the output of the second upsampling unit is used as the input of the third SNNBlock1 module. The outputs of the second SNNBlock1 module and the third SNNBlock1 module are used as the inputs of the third SNNConv layer, and the output of the third SNNConv layer is used as the input of the fourth SNNBlock1 module. The output of the fourth SNNBlock1 module is used as the input of the fourth SNNConv layer, and the output of the fourth SNNConv layer and the output of the second SNNConv layer are used as the input of the fourth SNNBlock2 module. The output of the fourth SNNBlock2 module is used as the input of the fifth SNNConv layer, and the output of the fifth SNNConv layer and the output of the first SNNConv layer are used as the input of the fifth SNNBlock2 module. The outputs of the fourth SNNBlock1 module, the fourth SNNBlock2 module, and the fifth SNNBlock2 module are used as inputs to the prediction head, and the corrosion degree detection result is output through the prediction head. Step 3: Train the Spike Yolo model using a labeled dataset to obtain a trained Spike Yolo model; Step 4: Use the image of the tower to be detected as input to the trained Spike Yolo model, and output the tower corrosion detection result through the trained Spike Yolo model.
2. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 1, characterized in that, The process of labeling each image of the iron tower in the dataset with the degree and location of corrosion is as follows: Each image of the iron tower was manually labeled with its corrosion level and location. The corrosion level labels included no corrosion, light corrosion, moderate corrosion, and severe corrosion.
3. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 1, characterized in that, The working process of the first SNNBlock1 module is as follows: Input to the first SNNBlock1 module After passing through the SepConv unit, the output of the SepConv unit is then combined with the input of the first SNNBlock1 module. Add to get the sum Among them, Conv pw1 This indicates the first PWConv layer, Conv pw2 This indicates the second PWConv layer, Conv dw1 This indicates the first DWConv layer, Conv dw2 SN represents the second DWConv layer, BN represents the peak neural network, and BN represents the batch normalization layer. Add the results As the input to the Channel Conv1 unit, the output of the Channel Conv1 unit is connected to... Add them together to get the result. Add the results As the output of the first SNNBlock1 module; 4. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 1, characterized in that, The working process of the first SNNBlock2 module is as follows: Input to the first SNNBlock2 module After passing through the SepConv unit, the output of the SepConv unit is added to the input of the first SNNBlock2 module to obtain the sum. Add the results As the input to the Channel Conv2 unit, the output of the Channel Conv2 unit is connected to... Add them together to get the result. Add the results As the output of the first SNNBlock2 module.
5. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 3, characterized in that, The operation process of the Channel Conv1 unit is as follows:
6. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 4, characterized in that, The operation process of the Channel Conv2 unit is as follows: Where RepConv(·) is a reparameterized convolution with a kernel size of 3×3; Among them, Conv pw3 This indicates the third PWConv layer, Conv pw4 This indicates the fourth PWConv layer, Conv dw3 This indicates the third DWConv layer.
7. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 1, characterized in that, The SPPF module works as follows: Within the SPPF module, the input first passes through a convolutional layer with a kernel size of 1×1. The output of the convolutional layer then passes through three max pooling layers in sequence. The feature maps output by the three max pooling layers are concatenated along the channel dimension, and the concatenated result is used as the output of the SPPF module.
8. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 3, characterized in that, The working process of the spike neural network is as follows: Step 1: Encode each pixel value in the feature map input to the spike neural network using time coding, and encode each pixel value into a pulse code sequence. Then, the elements at corresponding positions in each pulse code sequence are added together to obtain a complete pulse code sequence. The t-th element in the complete pulse code sequence is denoted as X. 0 [t], t = 1, 2, ..., T, where T is the total number of elements in the overall pulse code sequence; And initialize the time step t = 1; Step 2: Initialize the number of neuron layers l = 1; Step 3, transfer signal X l-1 [t] Accumulated to historical state H l-1 In [t], the membrane potential U of the l-th layer neuron is obtained. l [t]: U l [t]=H l-1 [t]+X l-1 [t] Among them, X l-1 [t] represents the output of the (l-1)th layer neuron at time step t, H l-1 [t] represents the state of the (l-1)th layer neuron at time step t, U l [t] represents the membrane potential of the l-th layer neuron at time step t; S l [t]=Clip(round(U l [t]),0,D) Where round(·) represents the rounding operation, and the function Clip(·) satisfies: Where D represents the expansion step size, according to U l [t] and S l [t] Calculate the state H of the l-th layer neuron at time step t. l [t]: H l [t]=β(U l [t]+S l [t]) Where β is the decay factor; Step 4, S l [t] is transformed into an extended binary spike sequence, and the d-th element in the binary spike sequence is denoted as S. l [t,d]; According to S l [t,d] Calculates the output X of the l-th layer neuron at time step t. l [t]: Among them, W l This represents the weight matrix of the neurons in the l-th layer; Step 5: Does it satisfy l = L, where L is the total number of neuron layers? If the condition is not met, then let l = l + 1 and return to step 3. If satisfied, proceed to step 6; Step 6: Does t = T satisfy the condition? If the condition is not met, then let t = t + 1 and return to step 2. If satisfied, then X L [1],X L [2],…,X L [T] is the output of the spike neural network.
9. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 1, characterized in that, The attention mechanism within the neck network is a block-to-cluster attention mechanism, which specifically involves: The input to the block-to-cluster attention is divided into H×W blocks. The feature matrix composed of the feature vectors of the H×W blocks is denoted as X. The feature matrix X is then transformed linearly to obtain the query. Query=X·W Q Where Query is the result of a linear transformation of X, and W Q It is a weight matrix; The feature vectors of each block are classified into M clusters. The feature matrix composed of the feature vectors of the M clusters is denoted as X′. The feature matrix X′ is multiplied by the weight matrix C′ to obtain the overall feature Z of each cluster. Z = X′·C′ Z is transformed into bond K: K=Z·W K Among them, W K It is a weight matrix; The attention weight A for Query and K is calculated using the Softmax function: Where the superscript T represents transpose and d is the scaling factor; The feature Z is mapped to the Value space through a linear transformation to obtain the value V: V=Z·W V Among them, W V It is a weight matrix; By weighting the value V using attention weights, we obtain the final output feature Y of the block-to-cluster attention: Y = A·V.
10. The method for detecting the degree of corrosion of iron towers based on the Spike Yolo model according to claim 1, characterized in that, The specific process of step four is as follows: Step 41: For the tower to be inspected, firstly acquire images of various parts of the tower, then use the acquired images as input to the trained Spike Yolo model, and output the corrosion detection results of various parts of the tower to be inspected through the trained Spike Yolo model. Step 42: Use the Canny edge detection and contour extraction method to process the image of the tower to be detected, and obtain the total number of pixels of the entire tower. And count the total number of pixels in the eroded region output by the trained Spike Yolo model; Step 4.3: Calculate the percentage of the total number of pixels in the corroded area relative to the total number of pixels in the entire tower under inspection; If the percentage exceeds 10%, the tower under inspection is considered to have large-area corrosion and requires priority treatment. If the percentage does not exceed 10%, then the corrosion should be treated sequentially according to the degree of corrosion of each individual corrosion area.
Citation Information
Patent Citations
Method for detecting corrosion of transmission tower based on attention mechanism fusion
CN116503358A
Method for training a spiking neural network for characterisation of movements and use thereof
WO2022117712A1