A method for identifying surface cracks of a cement pole
Patent Information
- Application Number
- CN202611147363.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]为了解决现有技术中水泥电杆裂纹图像受复杂背景干扰、局部细节易丢失、空间位置信息利用不足而导致识别准确率和稳定性受限的问题,第一方面,本发明提供了一种水泥电杆表面裂纹识别方法,包括以下步骤:
[0018]本发明通过轻量化网络为内容特征图各位置生成对应卷积核权重,并执行局部邻域卷积,结合原始特征和门控前馈网络,提取水泥电杆表面裂纹的细微局部特征。在值向量生成通路中,通过扩张卷积扩大感受野,获取裂纹上下文信息;同时融合二维坐标编码和多维空间调制系数,增强对裂纹空间分布及几何形态的表征能力。进一步利用全局查询向量与键、值向量构建注意力机制,使模型能够关注疑似裂纹区域,降低复杂背景干扰,提高裂纹识别的准确率和稳定性。
Smart Images

Figure CN122990306A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of identification, and in particular relates to a method for identifying surface cracks on cement poles. Background Technology
[0002] As crucial load-bearing components in power and communication infrastructure, the structural safety and stability of cement poles directly impact the normal operation of power networks. During long-term outdoor service, cement poles are susceptible to natural weathering, temperature and humidity fluctuations, foundation settlement, and external impacts, gradually developing surface cracks. If not detected and addressed promptly, these cracks can propagate, leading to internal steel corrosion and a decrease in structural load-bearing capacity, potentially causing pole tilting or collapse. Traditional crack detection relies primarily on manual inspections, which are labor-intensive, inefficient, and subjective. Furthermore, they are easily affected by inspector fatigue, limited viewing angles, and complex on-site environments, resulting in a high risk of missed or false detections, and posing certain operational safety hazards. With the development of image acquisition equipment and deep learning technology, using image recognition for automatic crack detection on cement pole surfaces has become an effective technological direction for improving inspection efficiency and safety.
[0003] However, cement poles are typically located in complex outdoor environments, and image acquisition is easily affected by factors such as uneven lighting, shadow occlusion, surface stains, background debris, and the rough texture of the pole. Furthermore, pole cracks are often characterized by being thin, small, low-contrast, and irregular in shape. Conventional deep learning models, during feature extraction, often struggle to fully capture contextual information along the crack's extension direction due to limited local receptive fields, and may also weaken subtle textures and edge details during deep feature transfer. Existing recognition methods incorporating attention mechanisms typically employ linear transformations of feature mapping vectors, which still do not fully utilize local spatial structure, relative pixel positions, and crack geometry. This limits the model's ability to distinguish between real, small cracks and artifact noise in complex backgrounds, leaving room for improvement in recognition accuracy and stability. Therefore, constructing a cement pole crack recognition method that can integrate local structural details, contextual information, and spatial location information has become an urgent technical problem to be solved. Summary of the Invention
[0004] To address the limitations in accuracy and stability of existing technologies for identifying cracks in cement poles due to interference from complex backgrounds, loss of local details, and insufficient utilization of spatial location information, this invention provides a method for identifying surface cracks in cement poles, comprising the following steps: An image of the surface of a cement pole is acquired, and a content feature map is extracted from the image using a backbone network. In the key vector generation path, for each position of the content feature map, a lightweight network generates convolutional kernel weights, and the convolutional kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding position to obtain key basis features. The key basis features are concatenated with the original features of the content feature map and fed into a gate control feedforward network to obtain a key vector. In the value vector generation path, the receptive field of the content feature map is expanded by dilated convolution to obtain value basis features; the value basis features are used to generate an initial value vector through a projection network; the two-dimensional coordinates are used to generate a position value vector through encoding projection; multi-dimensional spatial modulation coefficients are generated using the value basis features; and the position value vector weighted by the multi-dimensional spatial modulation coefficients is added to the initial value vector to obtain the value vector. The content feature map is used to generate a query vector with the same dimension as the key vector through global average pooling and projection mapping; the attention score of the query vector and all key vectors is calculated, and the aggregated feature is obtained by weighted summation of all value vectors based on the score; the aggregated feature is input into a multilayer perceptron classification network, and the identification result of whether the cement pole has cracks is output.
[0005] Optionally, acquiring an image of the cement pole surface and extracting the content feature map of the image through a backbone network includes: Use an industrial camera to photograph the surface of the cement pole to be inspected and obtain surface images; The surface image is input into a deep convolutional neural network model with residual connections, and multi-scale spatial detail features are extracted through layer-by-layer convolution and pooling operations. The extracted multi-scale feature maps are cropped, scaled, and stitched together to output the content feature map.
[0006] Optionally, for each location of the content feature map, a lightweight network is used to generate convolutional kernel weights, and these weights are then used to convolve the local neighborhood of the content feature map at the corresponding location to obtain key basis features, including: Extract the feature channel vector of the content feature map at the current position; The feature channel vector is input into a lightweight network containing fully connected layers and Tanh activation functions, and the output is a weight sequence normalized to a preset range. The weight sequence is reshaped into a four-dimensional convolution kernel parameter matrix; Centered on the current position, the feature tensors in a local neighborhood of a preset size are convolved using the four-dimensional convolution kernel parameter matrix to output the key-basis features that fuse local context information.
[0007] Optionally, the step of concatenating the key-based features with the original features of the content feature map and feeding them into the introductory feedforward network to obtain the key vector includes: The key-based features are concatenated with the original features at the corresponding positions along the channel dimension to obtain the concatenated feature vector. The concatenated feature vector is divided into two parallel feedforward branches; In the first feedforward branch, the spliced feature vector is output as basis information through identity mapping; In the second feedforward branch, the gate mask weights, which take values between 0 and 1, are calculated using a multilayer perceptron and a sigmoid function. The basis information is multiplied element-wise with the gate mask weights, and the multiplied features are then subjected to channel dimensionality reduction mapping to obtain the key vector.
[0008] Optionally, the step of expanding the receptive field of the content feature map through dilated convolution to obtain value-based features includes: Set an expanded convolution kernel with a dilation rate greater than 1 to perform convolution processing on the content feature map; The value basis features are obtained by normalizing and nonlinearly activating the convolution output.
[0009] Optionally, generating a position value vector by encoding and projecting the two-dimensional coordinates includes: Obtain the horizontal and vertical coordinates of each position in the content feature map; By inputting the horizontal and vertical coordinates into sine and cosine functions of different frequencies, sine and cosine position codes with multi-band absolute position information are obtained. The sine and cosine position codes of the horizontal and vertical coordinates are concatenated to obtain a two-dimensional position code vector; The two-dimensional position encoding vector is transformed by a linear projection system composed of fully connected layers, and the position value vector with the same dimension as the initial value vector is output.
[0010] Optionally, the calculation of the attention score between the query vector and all key vectors, and the weighted summation of all value vectors based on the score to obtain the aggregated feature, includes: Calculate the dot product between the query vector and the key vector at each position, divide the dot product result by the scaling factor, and then normalize it using the Softmax function to obtain the attention score for each position. Perform a scalar multiplication between the attention score at each position and the corresponding value vector; The weighted value vectors are summed in the spatial dimension to obtain the aggregated feature that incorporates global attention information.
[0011] On the other hand, the present invention also provides a surface crack identification system for cement poles, comprising the following modules: An extraction module is used to acquire images of the surface of cement poles and extract content feature maps of the images through a backbone network. In the key vector generation path, for each position of the content feature map, a lightweight network generates convolutional kernel weights, and the convolutional kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding position to obtain key basis features. The key basis features are concatenated with the original features of the content feature map and fed into a gate control feedforward network to obtain key vectors. The generation module is used to expand the receptive field of the content feature map through dilated convolution in the value vector generation path to obtain value basis features; generate an initial value vector by passing the value basis features through a projection network; generate a position value vector by passing the two-dimensional coordinates through encoding projection; generate multi-dimensional spatial modulation coefficients using the value basis features; and add the position value vector weighted by the multi-dimensional spatial modulation coefficients to the initial value vector to obtain the value vector. The recognition module is used to generate a query vector with the same dimension as the key vector by using global average pooling and projection mapping to generate the content feature map; calculate the attention score of the query vector and all key vectors, and obtain the aggregated feature by weighted summation of all value vectors based on the score; input the aggregated feature into the multilayer perceptron classification network, and output the recognition result of whether the cement pole has cracks.
[0012] Furthermore, the acquisition of the surface image of the cement pole and the extraction of the content feature map of the image through the backbone network include: Use an industrial camera to photograph the surface of the cement pole to be inspected and obtain surface images; The surface image is input into a deep convolutional neural network model with residual connections, and multi-scale spatial detail features are extracted through layer-by-layer convolution and pooling operations. The extracted multi-scale feature maps are cropped, scaled, and stitched together to output the content feature map.
[0013] Further, for each location of the content feature map, a lightweight network generates convolutional kernel weights, and these kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding location to obtain key basis features, including: Extract the feature channel vector of the content feature map at the current position; The feature channel vector is input into a lightweight network containing fully connected layers and Tanh activation functions, and the output is a weight sequence normalized to a preset range. The weight sequence is reshaped into a four-dimensional convolution kernel parameter matrix; Centered on the current position, the feature tensors in a local neighborhood of a preset size are convolved using the four-dimensional convolution kernel parameter matrix to output the key-basis features that fuse local context information.
[0014] Further, the step of concatenating the key-based features with the original features of the content feature map and feeding them into the introductory feedforward network to obtain the key vector includes: The key-based features are concatenated with the original features at the corresponding positions along the channel dimension to obtain the concatenated feature vector. The concatenated feature vector is divided into two parallel feedforward branches; In the first feedforward branch, the spliced feature vector is output as basis information through identity mapping; In the second feedforward branch, the gate mask weights, which take values between 0 and 1, are calculated using a multilayer perceptron and a sigmoid function. The basis information is multiplied element-wise with the gate mask weights, and the multiplied features are then subjected to channel dimensionality reduction mapping to obtain the key vector.
[0015] Furthermore, the receptive field of the content feature map is expanded by dilated convolution to obtain value-based features, including: Set an expanded convolution kernel with a dilation rate greater than 1 to perform convolution processing on the content feature map; The value basis features are obtained by normalizing and nonlinearly activating the convolution output.
[0016] Further, the step of generating a position value vector by encoding and projecting the two-dimensional coordinates includes: Obtain the horizontal and vertical coordinates of each position in the content feature map; By inputting the horizontal and vertical coordinates into sine and cosine functions of different frequencies, sine and cosine position codes with multi-band absolute position information are obtained. The sine and cosine position codes of the horizontal and vertical coordinates are concatenated to obtain a two-dimensional position code vector; The two-dimensional position encoding vector is transformed by a linear projection system composed of fully connected layers, and the position value vector with the same dimension as the initial value vector is output.
[0017] Further, the calculation of the attention score between the query vector and all key vectors, and the weighted summation of all value vectors based on the score to obtain the aggregated feature, includes: Calculate the dot product between the query vector and the key vector at each position, divide the dot product result by the scaling factor, and then normalize it using the Softmax function to obtain the attention score for each position. Perform a scalar multiplication between the attention score at each position and the corresponding value vector; The weighted value vectors are summed in the spatial dimension to obtain the aggregated feature that incorporates global attention information.
[0018] This invention generates corresponding convolutional kernel weights for each location in the content feature map using a lightweight network and performs local neighborhood convolutions. Combining the original features with a gated feedforward network, it extracts subtle local features of surface cracks on cement poles. In the value vector generation path, dilated convolutions expand the receptive field to acquire crack context information; simultaneously, two-dimensional coordinate encoding and multi-dimensional spatial modulation coefficients are integrated to enhance the representation of crack spatial distribution and geometric morphology. Furthermore, an attention mechanism is constructed using global query vectors and key / value vectors, enabling the model to focus on suspected crack areas, reducing interference from complex backgrounds, and improving the accuracy and stability of crack identification. Attached Figure Description
[0019] Figure 1 A flowchart of a method for identifying surface cracks on cement poles; Figure 2 A thermal diagram illustrating the distribution of convolutional kernel weights in the output of a lightweight network for key pathways; Figure 3 This is a schematic diagram of the distribution of sampling points for dilated convolution. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] Example 1 In Embodiment 1 of the present invention, a method for identifying surface cracks on cement poles is provided, such as... Figure 1 As shown, it includes the following steps: S1. Acquire an image of the surface of a cement pole and extract the content feature map of the image through a backbone network. In the key vector generation path, for each position of the content feature map, generate convolutional kernel weights through a lightweight network, and use the convolutional kernel weights to convolve the local neighborhood of the content feature map at the corresponding position to obtain key basis features. Concatenate the key basis features with the original features of the content feature map and feed them into a gate control feedforward network to obtain a key vector.
[0022] An image of the cement pole's surface is read and its size is normalized to a uniform spatial resolution of 512×512 pixels. The pixel values of the red, green, and blue channels are normalized for mean and standard deviation. The preprocessed image tensor is input into the ResNet50 backbone model, and multi-scale feature maps output from multiple residual stages of the backbone network are extracted. These multi-scale feature maps are then sized, reduced in dimensionality through channels, and fused together to obtain a content feature map with a spatial resolution of 64×64 and 256 channels.
[0023] In the key vector generation pathway, for each spatial location of the content feature map, a lightweight parameter generation network containing fully connected layers and Tanh activation functions is used to generate 3×3 channel-wise convolutional kernel weights corresponding to that location. Based on these kernel weights, the 3×3 local neighborhoods at the corresponding locations in the content feature map are convolved and aggregated to obtain 64×64×256 key basis features. These key basis features are then concatenated with the original features of the content feature map along the channel dimension and input into a gated feedforward network. Element-wise weighting is performed through the basis branch and the gated branch, followed by channel-wise dimensionality reduction mapping, outputting a key vector tensor with a spatial size of 64×64 and 256 channels.
[0024] In one possible embodiment, acquiring an image of the cement pole surface and extracting the content feature map of the image through a backbone network includes: Use an industrial camera to photograph the surface of the cement pole to be inspected and obtain surface images; The surface image is input into a deep convolutional neural network model with residual connections, and multi-scale spatial detail features are extracted through layer-by-layer convolution and pooling operations. The extracted multi-scale feature maps are cropped, scaled, and stitched together to output the content feature map.
[0025] In the acquisition phase, an industrial camera with a charge-coupled device (CCD) array was selected as the image acquisition terminal, with a resolution of 1920×1080 pixels. The shooting distance was controlled within the range of 0.5 meters to 1.5 meters, and a ring-shaped LED shadowless light source was used to reduce environmental reflection interference. The acquired surface image was sent to a preprocessing module, where it was scaled to a fixed spatial resolution of 512×512 using a bicubic interpolation algorithm, and all pixel values were normalized to the range of 0 to 1. The preprocessed image was then used as network input and fed into a deep convolutional neural network based on the ResNet50 architecture. The structure of this deep convolutional neural network model includes an initial convolutional layer, a max-pooling layer, and multiple sequentially connected residual stages. Each residual stage contains several residual blocks, and the residual blocks achieve feature identity mapping and residual learning through skip connections. The input is an image tensor with a spatial resolution of 512×512 and 3 channels, and the output is multi-scale spatial detail feature maps of different network depths.
[0026] During forward propagation, multi-scale spatial detail feature maps of the second, third, and fourth stages are sequentially extracted and derived along the residual connection layers of the network. The spatial dimensions of these three feature maps are 128×128, 64×64, and 32×32, respectively, with corresponding channel depths of 256, 512, and 1024, thus constructing a multi-scale feature system that balances shallow edge textures and deep semantic representations. Based on this multi-scale feature system, the model uses bilinear interpolation to upsample and double the resolution of the fourth-stage feature map to 64×64, and then downsamples the second-stage feature map through a pooling layer with a stride of 2, a kernel size of 3×3, and an edge padding size of 1, aligning the feature maps to the same 64×64 spatial size. For feature maps with blank edges or sizes exceeding the target input range, center clipping or boundary clipping is used for size normalization. After unifying the dimensions, a 1×1 convolution operation is applied to each branch to reduce the number of feature channels to 256. The three tensors are then concatenated along the channel dimension to produce a fusion tensor with a depth of 768 dimensions. At the end, a convolutional layer with a kernel size of 3×3, an edge padding size of 1, and batch normalization and linear rectified activation function are applied to smooth the information, resulting in a content feature map with a spatial resolution of 64×64 and a channel dimension of 256.
[0027] In one possible embodiment, for each location of the content feature map, a lightweight network generates convolutional kernel weights, and the convolutional kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding location to obtain key basis features, including: Extract the feature channel vector of the content feature map at the current position; The feature channel vector is input into a lightweight network containing fully connected layers and Tanh activation functions, and the output is a weight sequence normalized to a preset range. The weight sequence is reshaped into a four-dimensional convolution kernel parameter matrix; Centered on the current position, the feature tensors in a local neighborhood of a preset size are convolved using the four-dimensional convolution kernel parameter matrix to output the key-basis features that fuse local context information.
[0028] For a content feature map with a spatial resolution of 64×64 and a channel depth of 256, the spatial two-dimensional grid coordinates corresponding to the feature map are traversed. For any specified coordinate positions i and j, a one-dimensional feature channel vector with a length of 256 is extracted using a slicing operation.
[0029] This vector is input into a lightweight parameter generation network. This network consists of a first fully connected layer, a linear rectified activation layer, a second fully connected layer, and a hyperbolic tangent activation layer, all cascaded sequentially. The input is the extracted one-dimensional feature channel vector of length 256, and the output is a one-dimensional weight sequence of total length 2304. Internally, the network's first layer is a fully connected layer that, according to a reduction ratio of 4, projects the 256-dimensional input vector into a 64-dimensional hidden space, followed by a linear rectified activation function to achieve non-linear feature mapping. The network's last layer is a second fully connected layer, responsible for amplifying the 64-dimensional hidden feature mapping to a 2304-dimensional output space. This dimension matches the parameter requirements, i.e., a kernel size of 3 and 2304 channels corresponding to 256.
[0030] After obtaining the output, the lightweight network terminal applies numerical constraints to these 2304 elements using a hyperbolic tangent activation function, normalizing the elements to a closed interval between -1 and +1 to generate a weight sequence. Using a tensor reshaping operation, this one-dimensional sequence is reconstructed into a four-dimensional convolution kernel parameter matrix with a size arrangement of 256×1×3×3. This matrix serves as the channel-wise convolution kernel for the current pixel.
[0031] On the spatial plane of the content feature map, a local feature tensor region of physical size 3×3 is extracted using a zero-padded mechanism, centered at the current computation coordinates. Using the generated four-dimensional convolution kernel parameter matrix, a local convolution multiplication-addition operation based on a channel separation mode is performed on this local tensor region. This convolution operation balances local neighborhood modeling capability and position-adaptive feature extraction capability, and outputs a bond basis feature that maintains the original 64×64 resolution and 256 channels. This feature is used to characterize the texture direction details around the center point. A heatmap of the convolution kernel weight distribution output by the lightweight bond pathway network is shown below. Figure 2 As shown.
[0032] In one possible embodiment, the step of concatenating the key-based features with the original features of the content feature map and feeding them into a gate control feedforward network to obtain a key vector includes: The key-based features are concatenated with the original features at the corresponding positions along the channel dimension to obtain the concatenated feature vector. The concatenated feature vector is divided into two parallel feedforward branches; In the first feedforward branch, the spliced feature vector is output as basis information through identity mapping; In the second feedforward branch, the gate mask weights, which take values between 0 and 1, are calculated using a multilayer perceptron and a sigmoid function. The basis information is multiplied element-wise with the gate mask weights, and the multiplied features are then subjected to channel dimensionality reduction mapping to obtain the key vector.
[0033] After obtaining the generated key-based features, these features are concatenated and fused with the content feature map of the corresponding level along the channel dimension. Both feature spaces have a size of 64×64 and a channel dimension of 256. By performing the concatenation operation along the channel dimension, a concatenated feature vector with double the feature depth and a total of 512 channels is generated. This tensor is then fed into two parallel feedforward processing branches. In the first feedforward branch, relying on the identity mapping mechanism, a 512-dimensional concatenated feature vector containing edge information and details is output as the basis information. In the second feedforward branch, the input tensor enters the multilayer perceptron module. The structure of this multilayer perceptron network includes interconnected dimensionality-reducing fully connected layers, nonlinear activation layers, and dimensionality-upgrading fully connected layers. The input is the 512-dimensional concatenated feature vector, and the output is a 512-dimensional refined feature vector.
[0034] During operation, a first fully connected layer with a compression ratio of 8 reduces the 512-dimensional data to a 64-dimensional semantic space, and then uses a Gaussian error linear unit activation function to enhance nonlinear expressive power. A secondary fully connected layer then projects the compressed information back to the 512-dimensional space. The output of the multilayer perceptron is connected to a Sigmoid function, mapping the response value at each feature channel position to a range of 0.0 to 1.0, producing a 512-dimensional gated mask weight sequence representing channel importance. The 512-dimensional basis information from the first branch is multiplied element-wise with the gated mask weights calculated from the second branch, which helps suppress channel responses corresponding to background noise. After filtering, a 1×1 dimensionality-reducing convolutional layer is concatenated to compress the number of feature channels back to 256 dimensions, generating a key vector.
[0035] S2, in the value vector generation path, the receptive field of the content feature map is expanded by dilated convolution to obtain value basis features; the value basis features are used to generate an initial value vector through a projection network; the two-dimensional coordinates are used to generate a position value vector through encoding projection; multidimensional spatial modulation coefficients are generated using the value basis features; and the position value vector weighted by the multidimensional spatial modulation coefficients is added to the initial value vector to obtain the value vector.
[0036] In the value vector generation path, a two-dimensional dilated convolution operator is instantiated. The spatial kernel size parameter of the operator is set to 3, the dilation rate parameter is set to 2, and the edge padding size is set to 2. A dilated convolution operation is performed on the content feature map to expand the local receptive field. The operation result is passed through a batch normalization layer and a Leaky ReLU activation function in sequence, and the output value basis feature maintains a shape and size of 64×64×256. A projection network consisting of a 1×1 two-dimensional convolutional layer and a layer normalization module is constructed. The value basis feature tensor is input into the projection network, and through channel dimension mapping and normalization processing, an initial value vector tensor with 256 channels is generated. A corresponding two-dimensional Cartesian coordinate grid is generated based on the 64×64 feature map. A position encoding algorithm using alternating sine and cosine trigonometric functions is used to convert the absolute two-dimensional coordinate mapping into a continuous position feature tensor that fuses high-frequency and low-frequency data. This tensor is then input into a linear transformation layer for dimension alignment, generating a position value vector with the same number of channels of 256.
[0037] A multilayer perceptron model is constructed, comprising a first fully connected layer, a GELU activation function layer, and a second fully connected layer. Value-based features are fed into this perceptron model to extract channel modulation relationships and spatial response intensity. The sigmoid activation function restricts the element values of the output tensor to the range of 0 to 1, thereby generating a multidimensional spatial modulation coefficient tensor with a shape of 64×64×256. This multidimensional spatial modulation coefficient tensor is then weighted by performing element-wise multiplication of the position value vector channel by channel. The weighted position value vector is then bitwise added to the initial value vector at the corresponding positions to generate a value vector tensor with a size of 64×64×256.
[0038] In one possible embodiment, the step of expanding the receptive field of the content feature map through dilated convolution to obtain value-based features includes: Set an expanded convolution kernel with a dilation rate greater than 1 to perform convolution processing on the content feature map; The value basis features are obtained by normalizing and nonlinearly activating the convolution output.
[0039] The cracks on the surface of cement poles, caused by stress distribution, exhibit a long and slender morphology with a wide extension range. In this feature extraction stage, a 3×3 convolution kernel is used, and a void ratio parameter greater than 1 is assigned to the kernel. In the computational example, this void ratio is set to 2, so that during actual computation, zero-value spatial intervals with a numerical distance of 1 are inserted between adjacent mesh elements of the original 3×3 convolution kernel. This structural setting allows the equivalent receptive field area of the convolution kernel to be expanded to a 5×5 receptive scale without increasing the amount of additional parameter calculations.
[0040] This dilated convolution kernel is invoked to perform two-dimensional traversal dot product operations on a 64×64 content feature map containing 256 channels, using a sliding window mechanism with a computation stride of 1 and edge zero-padding size of 2. This padding parameter strategy can maintain the output feature tensor size at a spatial resolution of 64×64 while identifying long-range contextual dependencies across image regions.
[0041] To improve the gradient propagation stability of neural networks under illumination interference conditions and accelerate model fitting convergence, the output of dilated convolution is input into a batch normalization network for normalization processing. The momentum parameter for the statistical moving average is set to 0.1, and the constant to prevent overflow during division by zero is set to 10. -5 The normalized tensor is then fed into the Leaky ReLU activation function, with the negative half-axis leakage slope parameter set to 0.01, generating a value-based feature with a 256-dimensional channel depth. A schematic diagram of the distribution of dilated convolution sampling points is shown below. Figure 3 As shown.
[0042] In one possible embodiment, generating a position value vector by encoding and projecting the two-dimensional coordinates includes: Obtain the horizontal and vertical coordinates of each position in the content feature map; By inputting the horizontal and vertical coordinates into sine and cosine functions of different frequencies, sine and cosine position codes with multi-band absolute position information are obtained. The sine and cosine position codes of the horizontal and vertical coordinates are concatenated to obtain a two-dimensional position code vector; The two-dimensional position encoding vector is transformed by a linear projection system composed of fully connected layers, and the position value vector with the same dimension as the initial value vector is output.
[0043] To embed location information during feature abstraction, a discrete Cartesian grid coordinate system is established for the 64×64 pixel content feature map. The horizontal grid coordinates (x) and vertical grid coordinates (y) of each feature grid location are traversed and extracted, with values ranging from 0 to 63. For the frequency band index k, the coordinates are calculated separately. and Where pos is x or y, and D is the unidirectional encoding dimension, x and y are mapped to two sine and cosine position encoding vectors of length 128. After generating the sine and cosine position encoding sequences, the horizontal axis encoding vector and the vertical axis encoding vector under the same grid coordinate system are concatenated and recombined according to the feature channel dimension, forming a two-dimensional position encoding vector with a total length of 256 dimensions, so that each set of vectors contains a two-dimensional spatial distribution pattern across frequency bands.
[0044] To integrate geometric prior information into the semantic representation space, a linear mapping projection network is constructed, comprising two fully connected layers with learnable weights. This projection network consists of a cascaded first fully connected layer, a linear rectified activation layer, and a second fully connected layer. The input is a 256-dimensional two-dimensional position encoding vector with dimension concatenation, and the output is a dimension-aligned 256-dimensional position value vector. In this mapping process, the 2D position encoding vector is input into the first fully connected layer of the projection system, where matrix multiplication expands the encoding vector to a hidden dimension of 512. A linear rectified activation function is interleaved during this process to impart non-linear fitting capability to the mapping process. The data flows through the second fully connected layer and is reprojected and compressed back to the target dimension of 256, thus outputting a dimension-aligned position value vector.
[0045] S3, the content feature map is processed by global average pooling and projection mapping to generate a query vector with the same dimension as the key vector; the attention score of the query vector and all key vectors is calculated, and the aggregated feature is obtained by weighted summation of all value vectors based on the score; the aggregated feature is input into a multilayer perceptron classification network, and the identification result of whether the cement pole has cracks is output.
[0046] An adaptive global average pooling process is applied to the 64×64×256 content feature map, calculating the average across two spatial dimensions to obtain a 1×1×256 global feature tensor, which is then linearly mapped to generate a query vector. The 64×64×256 key vector tensor and value vector tensor are flattened into a 4096×256 two-dimensional sequence matrix. The inner product similarity between the query vector and each key vector is calculated, and Softmax normalization is applied to obtain attention score weights of length 4096. The value vector sequence is then weighted and summed according to these attention score weights to obtain a 256-dimensional aggregated feature vector.
[0047] A classification network based on a multilayer perceptron architecture is constructed. This network sequentially includes a fully connected layer with 256 input neurons, a ReLU nonlinear activation function layer, a Dropout random deactivation regularization layer, and a fully connected layer with two output neurons. The aforementioned one-dimensional aggregated feature vector is input into this multilayer perceptron classification network. After forward propagation to the terminal, the probability distribution values for the two categories of no cracks and cracks are calculated using a softmax normalization function. The index value corresponding to the maximum value in the output probability distribution is extracted. When the index value is one, the cement pole is identified and output as having surface cracks; when the index value is zero, the cement pole is not identified as having surface cracks.
[0048] In one possible embodiment, the calculation of the attention score between the query vector and all key vectors, and the weighted summation of all value vectors based on the score to obtain the aggregated feature, includes: Calculate the dot product between the query vector and the key vector at each position, divide the dot product result by the scaling factor, and then normalize it using the Softmax function to obtain the attention score for each position. Perform a scalar multiplication between the attention score at each position and the corresponding value vector; The weighted value vectors are summed in the spatial dimension to obtain the aggregated feature that incorporates global attention information.
[0049] In the initial stage of the computation process, the model pre-extracts the semantic global query vector Q, which is generated after global average pooling. This tensor matrix has a shape of 1×256 row vectors. The key vector set K, representing all spatial grid nodes generated by the preceding lightweight network path, is obtained and flattened. The matrix shape of the key vector set K is then transformed to 4096×256, where 4096 represents the total number of pixel grids in the feature plane. The size of the corresponding value vector set V remains 4096×256. The query vector Q and the transposed key vector matrix are then computed. The dot product operation between them is equivalent to calculating the expression This operation will produce a raw, unscaled correlation tensor with a shape dimension of 1×4096. Each term in the tensor represents a preliminary measure of the association between the current grid point features and the global crack semantics.
[0050] The model introduces a scaling factor. This scaling factor is set to the square root of the channel depth. When the channel depth is set to 256, the calculated scaling factor constant is 16. Each independent element in the original dot product tensor is uniformly divided by this scaling factor of 16 to reduce the risk of Softmax function saturation and maintain gradient stability. After scaling, a normalized exponential probability activation function is applied along the spatial sequence dimension of the tensor to normalize the associated values output at all positions, outputting an attention similarity weight score sequence containing 4096 floating-point elements, with values between the open interval 0 and 1, and a sum equal to 1.0.
[0051] In the information extraction step, the model performs element-wise scalar multiplication on each weight value in the attention score sequence with the corresponding value vector containing 256-dimensional features in the value vector set V, achieving spatial attention information filtering. After filtering, these 4096 filtered value vectors are summed along the spatial sequence dimension, resulting in a 1×256-dimensional aggregated feature vector. This aggregated feature vector can reduce background noise response and enhance the global contextual representation of surface cracks on cement poles.
[0052] The aggregated feature vector is input into a multilayer perceptron classification network with hierarchical decay of neuron nodes in the backend. The structure of this classification network includes sequentially connected feature flattening layers, hidden fully connected layers, activation layers, and classification output fully connected layers. The input is a 1×256-dimensional aggregated feature vector, and the output is a probability judgment value indicating whether there are crack defects on the surface of the cement pole, which is used to give a probability judgment result of whether surface crack anomalies are detected.
[0053] Example 2 Embodiment 2 of the present invention proposes a surface crack identification system for cement poles, comprising the following modules: An extraction module is used to acquire images of the surface of cement poles and extract content feature maps of the images through a backbone network. In the key vector generation path, for each position of the content feature map, a lightweight network generates convolutional kernel weights, and the convolutional kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding position to obtain key basis features. The key basis features are concatenated with the original features of the content feature map and fed into a gate control feedforward network to obtain key vectors. The generation module is used to expand the receptive field of the content feature map through dilated convolution in the value vector generation path to obtain value basis features; generate an initial value vector by passing the value basis features through a projection network; generate a position value vector by passing the two-dimensional coordinates through encoding projection; generate multi-dimensional spatial modulation coefficients using the value basis features; and add the position value vector weighted by the multi-dimensional spatial modulation coefficients to the initial value vector to obtain the value vector. The recognition module is used to generate a query vector with the same dimension as the key vector by using global average pooling and projection mapping to generate the content feature map; calculate the attention score of the query vector and all key vectors, and obtain the aggregated feature by weighted summation of all value vectors based on the score; input the aggregated feature into the multilayer perceptron classification network, and output the recognition result of whether the cement pole has cracks.
[0054] The above description represents the preferred embodiments of the present invention. It should be noted that, for those skilled in the art, various improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for identifying surface cracks on cement utility poles, characterized in that, Includes the following steps: An image of the surface of a cement pole is acquired, and a content feature map is extracted from the image using a backbone network. In the key vector generation path, for each position of the content feature map, a lightweight network generates convolutional kernel weights, and the convolutional kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding position to obtain key basis features. The key basis features are concatenated with the original features of the content feature map and fed into a gate control feedforward network to obtain a key vector. In the value vector generation path, the receptive field of the content feature map is expanded by dilated convolution to obtain value basis features; the value basis features are used to generate an initial value vector through a projection network; the two-dimensional coordinates are used to generate a position value vector through encoding projection; multi-dimensional spatial modulation coefficients are generated using the value basis features; and the position value vector weighted by the multi-dimensional spatial modulation coefficients is added to the initial value vector to obtain the value vector. The content feature map is used to generate a query vector with the same dimension as the key vector through global average pooling and projection mapping; the attention score of the query vector and all key vectors is calculated, and the aggregated feature is obtained by weighted summation of all value vectors based on the score; The aggregated features are input into a multilayer perceptron classification network, which outputs the identification result of whether the cement pole has cracks.
2. The method according to claim 1, characterized in that, The process of acquiring an image of the cement pole surface and extracting the content feature map of the image through a backbone network includes: Use an industrial camera to photograph the surface of the cement pole to be inspected and obtain surface images; The surface image is input into a deep convolutional neural network model with residual connections, and multi-scale spatial detail features are extracted through layer-by-layer convolution and pooling operations. The extracted multi-scale feature maps are cropped, scaled, and stitched together to output the content feature map.
3. The method according to claim 2, characterized in that, For each location of the content feature map, a lightweight network generates convolutional kernel weights. These kernel weights are then used to convolve the local neighborhood of the content feature map at the corresponding location to obtain key basis features, including: Extract the feature channel vector of the content feature map at the current position; The feature channel vector is input into a lightweight network containing fully connected layers and Tanh activation functions, and the output is a weight sequence normalized to a preset range. The weight sequence is reshaped into a four-dimensional convolution kernel parameter matrix; Centered on the current position, the feature tensors in a local neighborhood of a preset size are convolved using the four-dimensional convolution kernel parameter matrix to output the key-basis features that fuse local context information.
4. The method according to claim 1, characterized in that, The step of concatenating the key-based features with the original features of the content feature map and feeding them into the introductory feedforward network to obtain the key vector includes: The key-based features are concatenated with the original features at the corresponding positions along the channel dimension to obtain the concatenated feature vector. The concatenated feature vector is divided into two parallel feedforward branches; In the first feedforward branch, the spliced feature vector is output as basis information through identity mapping; In the second feedforward branch, the gate mask weights, which take values between 0 and 1, are calculated using a multilayer perceptron and a sigmoid function. The basis information is multiplied element-wise with the gate mask weights, and the multiplied features are then subjected to channel dimensionality reduction mapping to obtain the key vector.
5. The method according to claim 1, characterized in that, The process of expanding the receptive field of the content feature map through dilated convolution to obtain value-based features includes: Set an expanded convolution kernel with a dilation rate greater than 1 to perform convolution processing on the content feature map; The value basis features are obtained by normalizing and nonlinearly activating the convolution output.
6. The method according to claim 1, characterized in that, The step of generating a position value vector by encoding and projecting two-dimensional coordinates includes: Obtain the horizontal and vertical coordinates of each position in the content feature map; By inputting the horizontal and vertical coordinates into sine and cosine functions of different frequencies, sine and cosine position codes with multi-band absolute position information are obtained. The sine and cosine position codes of the horizontal and vertical coordinates are concatenated to obtain a two-dimensional position code vector; The two-dimensional position encoding vector is transformed by a linear projection system composed of fully connected layers, and the position value vector with the same dimension as the initial value vector is output.
7. The method according to claim 1, characterized in that, The process of calculating the attention score between the query vector and all key vectors, and then weighting and summing all value vectors based on the score to obtain the aggregated feature, includes: Calculate the dot product between the query vector and the key vector at each position, divide the dot product result by the scaling factor, and then normalize it using the Softmax function to obtain the attention score for each position. Perform a scalar multiplication between the attention score at each position and the corresponding value vector; The weighted value vectors are summed in the spatial dimension to obtain the aggregated feature that incorporates global attention information.
8. A surface crack identification system for cement utility poles, characterized in that, Includes the following modules: An extraction module is used to acquire images of the surface of cement poles and extract content feature maps of the images through a backbone network. In the key vector generation path, for each position of the content feature map, a lightweight network generates convolutional kernel weights, and the convolutional kernel weights are used to convolve the local neighborhood of the content feature map at the corresponding position to obtain key basis features. The key basis features are concatenated with the original features of the content feature map and fed into a gate control feedforward network to obtain key vectors. The generation module is used to expand the receptive field of the content feature map through dilated convolution in the value vector generation path to obtain value basis features; generate an initial value vector by passing the value basis features through a projection network; generate a position value vector by passing the two-dimensional coordinates through encoding projection; generate multi-dimensional spatial modulation coefficients using the value basis features; and add the position value vector weighted by the multi-dimensional spatial modulation coefficients to the initial value vector to obtain the value vector. The recognition module is used to generate a query vector with the same dimension as the key vector by using global average pooling and projection mapping to transform the content feature map; calculate the attention score between the query vector and all key vectors; and obtain the aggregated feature by weighted summation of all value vectors based on the score. The aggregated features are input into a multilayer perceptron classification network, which outputs the identification result of whether the cement pole has cracks.
9. The system according to claim 8, characterized in that, The process of acquiring an image of the cement pole surface and extracting the content feature map of the image through a backbone network includes: Use an industrial camera to photograph the surface of the cement pole to be inspected and obtain surface images; The surface image is input into a deep convolutional neural network model with residual connections, and multi-scale spatial detail features are extracted through layer-by-layer convolution and pooling operations. The extracted multi-scale feature maps are cropped, scaled, and stitched together to output the content feature map.
10. The system according to claim 8, characterized in that, For each location of the content feature map, a lightweight network generates convolutional kernel weights. These kernel weights are then used to convolve the local neighborhood of the content feature map at the corresponding location to obtain key basis features, including: Extract the feature channel vector of the content feature map at the current position; The feature channel vector is input into a lightweight network containing fully connected layers and Tanh activation functions, and the output is a weight sequence normalized to a preset range. The weight sequence is reshaped into a four-dimensional convolution kernel parameter matrix; Centered on the current position, the feature tensors in a local neighborhood of a preset size are convolved using the four-dimensional convolution kernel parameter matrix to output the key-basis features that fuse local context information.