Method for detecting slender object target in electric power operation field based on interpretability
By introducing lightweight convolutional attention mechanism (LCA) into the YOLOv7 model, the problems of poor interpretability and insufficient real-time performance in the detection of targets of slender objects in the power operation field are solved, and efficient and robust target detection effects are achieved.
Patent Information
- Application Number
- CN202411756040.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-25
AI Technical Summary
The existing object detection algorithms have poor interpretability in the field of power operations, especially when dealing with slender objects with extreme aspect ratios, the real-time and detection accuracy of the model are insufficient, and the amount of parameters is large, and more training data is needed to avoid overfitting.
A method for detecting elongated objects in the field of electric power operations based on interpretability is proposed. The lightweight convolutional attention mechanism (LCA) is adopted, and it is introduced into the neck part of the YOLOv7 model, which improves the attention of the model on elongated objects and reduces the impact of background columnar disturbances.
The detection accuracy of the YOLOv7 model for elongated targets is significantly improved, background interference is reduced, and the robustness and interpretability of the model are improved. At the same time, the detection speed is maintained and the parameter quantity is small.
Smart Images

Figure CN119693618A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a method for detecting slender objects in the field of electric power operations based on interpretability. Background Art
[0002] The power production and operation process is relatively complex. If the operation is improper or there is no protective equipment, it is easy to cause safety accidents. Grid operators need to perform power inspection and power-off operations on site every day. Manual inspections on the operation site take a long time and are prone to missed inspections. In order to further reduce labor costs, it is necessary to study efficient target detection algorithms. Using target detection algorithms to safely monitor the compliance of power site operations will help ensure the safety of power operations.
[0003] Mainstream target detection algorithms are mainly divided into two categories: traditional target detection algorithms and deep learning-based target detection algorithms. Among them, traditional target detection algorithms mainly use sliding windows to search for targets in images, and then use manual features such as SURF and SIFT to input into classifiers such as SVM and Adaboost for identification. Traditional target detection algorithms rely on manually designed features, have low generalization ability and detection accuracy, are difficult to cope with complex scenes, and have low computational efficiency. The target detection algorithm based on deep learning automatically learns features through deep neural networks, has better adaptability and detection effect, and is suitable for tasks with high real-time and precision requirements in actual application scenarios. With the improvement of convolutional neural network theory and the improvement of computer computing power, detection algorithms based on deep learning have been applied to safety-sensitive fields such as electricity and medical care because of their stronger representation ability and robustness.
[0004] The current research objects of target detection in the power field are concentrated on helmets, ladders, fires at substations, large trucks, and workers. The size differences of the above targets are small, and there are almost no slender targets with large aspect ratios. However, the power operation dataset used for compliance of power field operations has a complex background, many similar interferences, slender objects with extreme aspect ratios, and large differences in target size. In addition, the existing methods do not pay attention to the interpretability of the model. The target detection algorithms currently used in the power field generally have poor interpretability, which is also one of the main obstacles to the application of deep learning algorithms in safety-sensitive fields such as power operations.
[0005] The Chinese invention patent application with application number CN115546468A discloses a transformer-based method for detecting slender objects. Based on the features of slender objects, a data set of slender objects is obtained, and data enhancement operations are performed on the extracted data set; a network detection architecture for slender objects is constructed, and the network architecture mainly includes an improved ResNet feature extraction module and a transformer network detection module; a model is trained using a training set on the target detection network, and verified on a validation set to select the optimal detection model; based on the optimal detection model selected in step 3, the images in the test set are predicted to obtain the final detection effect. The disadvantage of this method is that it causes the model to require a longer reasoning time, the real-time performance of target detection is reduced, and the rapid growth of the number of parameters also requires more training data to avoid overfitting. Summary of the invention
[0006] In order to solve the above technical problems, the present invention proposes a target detection method for slender objects in the field of power operations based on interpretability. It adopts a new lightweight convolutional attention mechanism LCA, which significantly improves the attention of the YOLOv7 model to slender targets and reduces the influence of background columnar interference. It also performs well on other types of targets and has strong robustness.
[0007] The present invention provides a method for detecting slender objects in the field of electric power operation based on interpretability, comprising acquiring an electric power operation data set and performing format conversion, and further comprising the following steps:
[0008] Step 1: After introducing the LCA attention mechanism into the SPPCSPC module of the neck part of the YOLOv7 model, the LCA-YOLOv7 network model is obtained;
[0009] Step 2: Train the LCA-YOLOv7 network model using the power operation dataset;
[0010] Step 3: Input the image to be detected into the LCA-YOLOv7 network model and output the detection result.
[0011] Preferably, the LCA attention mechanism includes a channel attention mechanism and a spatial attention mechanism. Assuming that the feature map input by the LCA attention mechanism is Then the output feature map It can be expressed as
[0012]
[0013] Among them, C, H and W represent the number of channels, height and width of the input feature map F respectively. represents the channel attention weight, represents the spatial attention weight, Indicates M C (F) is broadcast along the H and W dimensions and then multiplied element-wise with the input feature map F, M S (F′) is broadcast along the C dimension and then multiplied element-wise with the intermediate feature map F′.
[0014] In any of the above schemes, it is preferred that the channel attention mechanism includes directly globally pooling the two-dimensional feature map of each channel with CBAM, obtaining different channel attention weights through two layers of two-dimensional convolution mapping, LCA performs feature aggregation on the two-dimensional feature map along two vertical directions, and then uses two layers of one-dimensional convolution to realize cross-channel information interaction.
[0015] In any of the above schemes, preferably, the working method of the channel attention mechanism includes the following sub-steps:
[0016] Step 101: Direction feature aggregation;
[0017] Step 102: Interact across channels.
[0018] In any of the above schemes, preferably, step 101 includes, for each channel of the input feature map F, using pooling kernels of (1, W) and (H, 1) respectively to perform feature aggregation along the horizontal axis x direction and the vertical axis y direction, and the aggregation result can be expressed as
[0019]
[0020] Among them, F c (h,i) represents the pixel value of the hth row and ith column of the cth channel of the feature map F. Represents the feature map of the cth channel The aggregation result of the hth row along the x-axis, F c (j,w) represents the pixel value of the cth channel, hth row, jth row, and wth column of the feature map F. Represents the feature map F of the cth channel c Aggregation result of the wth column along the y-axis.
[0021] In any of the above solutions, preferably, step 102 comprises performing one-dimensional convolution using a convolution kernel with a depth of H and W respectively. Realize the feature map F after aggregation along the x-axis direction H And the feature map F after aggregation along the y-axis W The local cross-channel interaction can be obtained and The formula is
[0022]
[0023] Among them, Conv 1d represents one-dimensional convolution, k is the size of the convolution kernel;
[0024] In any of the above solutions, preferably, step 102 further includes: H ′ and F W ' are spliced together and passed through a one-dimensional convolution with a kernel depth of 2 and a size of k After the sigmoid function, the attention weight M of each channel is obtained. C (F).
[0025] In any of the above solutions, preferably, the step 102 further includes modifying the original feature map F according to the following formula to obtain an intermediate feature map F′, whose dimension is the same as that of the original feature map F,
[0026]
[0027] In any of the above schemes, preferably, the input of the spatial attention mechanism is the intermediate feature map F′.
[0028] In any of the above schemes, preferably, the working method of the spatial attention mechanism includes the following sub-steps:
[0029] Step 111: Perform average pooling and maximum pooling along the channel dimension, with the pooling kernel size of 1×C, to obtain and
[0030] Step 112: After concatenating the two along the channel dimension, a two-dimensional convolution with a kernel depth of 2 and a size of 3×3 is used to extract spatial attention information;
[0031] Step 113: Obtain the spatial attention weight M through the sigmoid function S (F′), and then the final feature map F″ after the LCA attention mechanism correction is obtained according to the following formula:
[0032]
[0033] In any of the above schemes, preferably, step 3 includes using the pre-trained weights of the YOLOv7 original network in the backbone network part, freezing the backbone network part, and only training the neck and head parts after the LCA attention mechanism is introduced.
[0034] In any of the above solutions, preferably, step 3 also includes setting the number of training iterations to 100, and saving the weight of each training during the training process.
[0035] The present invention proposes a method for detecting slender objects in the field of power operations based on interpretability. For the substation power operation dataset, it is proposed to use saliency maps to guide network improvement from the perspective of interpretability analysis, and to move from machine learning to machine teaching, making deep learning models more interpretable, avoiding the massive experimental work required for blind model improvement, and providing visual method guidance for improving the network.
[0036] LCA attention stands for Lightweight Convolutional Attention.
[0037] The neck part indicates that the neck network enhances the feature expression capability.
[0038] SPPCSPC stands for "Spatial Pyramid Pooling (SPP)-Cross Stage Partial networks (CSP)". SPP is a technology that applies pooling operations of different scales on feature maps, and CSP is a network structure. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 The present invention is a flowchart of a preferred embodiment of a method for detecting slender objects in the field of electric power operations based on explainability.
[0040] Figure 2 A feature map of an embodiment of a saliency map of a method for detecting elongated objects in a power operation field based on interpretability according to the present invention.
[0041] Figure 3 It is a structural schematic diagram of an embodiment of the attention mechanism of the method for detecting slender objects in the field of power operations based on interpretability according to the present invention.
[0042] Figure 4 It is a schematic diagram of an embodiment of the dimension of the input feature map F of the interpretability-based slender object detection method in the power operation field according to the present invention.
[0043] Figure 5 It is a schematic diagram of an embodiment of introducing the LCA attention mechanism into LCA-Yolov7 of the interpretable-based slender object target detection method in the power operation field according to the present invention.
[0044] Figure 6 Schematic diagram of saliency mapping comparison between LCA and another attention mechanism according to an embodiment of the interpretability-based method for detecting elongated objects in the power operation field of the present invention. DETAILED DESCRIPTION
[0045] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments.
[0046] Embodiment 1
[0047] like Figure 1 As shown, step 100 is executed to obtain the power operation data set and perform format conversion.
[0048] Execute step 110, introduce the LCA attention mechanism into the SPPCSPC module of the neck part of the YOLOv7 model, and obtain the LCA-YOLOv7 network model. The LCA attention mechanism includes a channel attention mechanism and a spatial attention mechanism. Assume that the feature map input by the LCA attention mechanism is Then the output feature map It can be expressed as
[0049]
[0050] Among them, C, H and W represent the number of channels, height and width of the input feature map F respectively. represents the channel attention weight, represents the spatial attention weight, Indicates M C (F) is broadcast along the H and W dimensions and then multiplied element-wise with the input feature map F, M S (F′) is broadcast along the C dimension and then multiplied element-wise with the intermediate feature map F′.
[0051] The channel attention mechanism includes directly globally pooling the two-dimensional feature map of each channel with CBAM, and then obtaining different channel attention weights through two layers of two-dimensional convolution mapping. LCA aggregates the features of the two-dimensional feature map along two vertical directions, and then uses two layers of one-dimensional convolution to realize cross-channel information interaction.
[0052] The working method of the channel attention mechanism includes the following sub-steps:
[0053] Step 1101 is executed to aggregate features in different directions, including using pooling kernels (1, W) and (H, 1) to aggregate features along the horizontal axis x and the vertical axis y for each channel of the input feature map F. The aggregation result can be expressed as
[0054]
[0055]
[0056] Among them, F c (h,i) represents the pixel value of the hth row and ith column of the cth channel of the feature map F. Represents the feature map of the cth channel The aggregation result of the hth row along the x-axis, F c(j,w) represents the pixel value of the cth channel, hth row, jth row, and wth column of the feature map F. Represents the feature map F of the cth channel c Aggregation result of the wth column along the y-axis.
[0057] Execute step 1102, cross-channel interaction, including using a one-dimensional convolution with a convolution kernel depth of H and W respectively Realize the feature map F after aggregation along the x-axis direction H And the feature map F after aggregation along the y-axis W The local cross-channel interaction can be obtained and The formula is
[0058]
[0059] Among them, Conv 1d Represents one-dimensional convolution, k is the size of the convolution kernel, k determines the interaction range of adjacent channels and is an odd number with adjustable size;
[0060] F H′ and F W′ Spliced together, through a one-dimensional convolution with a kernel depth of 2 and a size of k After the sigmoid function, the attention weight M of each channel is obtained. C (F);
[0061] The original feature map F is modified according to the following formula to obtain the intermediate feature map F′, whose dimension is the same as the original feature map F,
[0062]
[0063] The input of the spatial attention mechanism is the intermediate feature map F′.
[0064] The working method of the spatial attention mechanism includes the following sub-steps:
[0065] Execute step 1111, perform average pooling and maximum pooling along the channel dimension respectively, and the pooling kernel size is 1×C, and obtain and
[0066] Execute step 1112, after splicing the two along the channel dimension, use a two-dimensional convolution with a convolution kernel depth of 2 and a size of 3×3 to extract spatial attention information;
[0067] Execute step 1113 and obtain the spatial attention weight M through the sigmoid function S (F′), and then the final feature map F″ after the LCA attention mechanism correction is obtained according to the following formula:
[0068]
[0069] Execute step 120 to train the LCA-YOLOv7 network model using the power operation data set. The backbone network uses the pre-trained weights of the original YOLOv7 network, freezes the backbone network, and only trains the neck and head parts after the LCA attention mechanism is introduced. Set the number of training iterations to 100, and save each training weight during the training process.
[0070] Execute step 130, input the image to be detected into the LCA-YOLOv7 network model, and output the detection result.
[0071] Embodiment 2
[0072] There are a large number of slender targets such as "electricity test pens" and "operating rods", as well as background columnar interferences in the power operation dataset. In particular, the features of the electrician test pens and operating rods are very similar, which has a great impact on the detection accuracy. The detection effect of classic target detection algorithms such as YOLOv7 on this dataset is not good. In order to solve the above problems, we explored the model structure improvement method under the guidance of interpretability and proposed a new lightweight convolutional attention mechanism LCA. This mechanism can significantly improve the attention of the YOLOv7 model to slender targets, reduce the influence of background columnar interferences, and perform well on other types of targets, with strong robustness. It can be seen that the LCA attention mechanism is more suitable for target detection in complex power operation sites.
[0073] 1. YOLOv7 based on improved attention mechanism
[0074] In order to improve the detection accuracy of YOLOv7 on slender targets in the power operation dataset, we tried to introduce attention mechanisms such as ECA (Efficient Channel Attention), CBAM (Convolutional Block Attention Module), and CA (Coordinate Attention f) after the SPPCSPC module in the neck part to improve the model's attention to target features. The experimental results are shown in Table 1.
[0075] Table 1 Performance of different attention mechanisms on YOLOv7
[0076]
[0077]
[0078] It is not difficult to see from Table 1 that although the ECA-YOLOv7 model after introducing the ECA attention mechanism does not perform best in slender target detection and overall target detection of the dataset, the increased number of parameters is negligible. The CA-YOLOv7 model after introducing the CA attention mechanism has the best detection effect on the slender targets operatingbar and powerchecker with similar appearances, which are improved by 1.8% and 1.3% respectively, but the overall performance of all target detection is not outstanding, and the number of parameters has increased significantly. In order to further explore the impact of introducing different attention mechanisms on target attention, we use the Grad-cam saliency mapping algorithm to visualize the decision basis, such as Figure 2 As shown in the figure. The red part is the decision-making area, and the darker the color, the greater the influence weight on the target detection result.
[0079] The saliency map feature map of the original YOLOv7 model is as follows Figure 2 As shown in the first row of the graph, the columnar interference objects (towers, circuit breakers, etc.) outside the target detection box also have a large red focus area. This shows that the model is greatly affected by the background interference objects at the substation site, resulting in the model's attention being scattered and the ability to capture the important features of the slender target power checker and operating bar being weak. Figure 2 The second row shows the saliency map feature map of the ECA-Yolov7 model after the introduction of the ECA attention mechanism. In general, the red attention area falling on columnar interferences such as towers has been reduced, but it is not very obvious. Figure 2 The third row shows the saliency map feature map of CA-YOLOv7. It can be seen that the red focus area falling on columnar interferences such as towers is significantly reduced. Figure 2 The fourth row shows the saliency map feature map of CBAM-YOLOv7. It is not difficult to see that the red focus area falling on columnar interferers such as towers is further reduced, and the model pays more attention to the detected target feature area.
[0080] Considering Table 1 and Figure 2From the results shown, we found that after introducing different attention mechanisms, the detection accuracy of the model is not completely consistent with the anti-interference ability of its saliency map feature map. This is because Grad-CAM multiplies the gradient weight information by the feature maps on all channels and then superimposes them to obtain the final saliency map feature map. When the weak attention information that was originally invalid in all channels is accumulated, it will also be reflected in the final saliency map feature map. It can be seen that the saliency map feature map based on Grad-CAM is not completely accurate, but it is still instructive for us to design the structure of the new attention mechanism, because the saliency map feature map of the CA-YOLOv7 model with the highest accuracy in detecting slender targets is not much worse than that of the CBAM-YOLOv7 model.
[0081] 2. Structure of LCA Attention Mechanism
[0082] Since the "electricity test pen" and "operating rod" in the power operation compliance detection targets are not only highly similar in appearance, but also have a large number of columnar background interferences, how to maximize the detection accuracy of these two difficult categories without affecting the detection effect of other targets is a very big challenge. Based on the advantages and disadvantages of attention mechanisms such as ECA, CBAM, and CA, we designed a new lightweight convolutional attention mechanism LCA, whose structure is as follows Figure 3 As shown, it includes two parts: channel attention and spatial attention.
[0083] Assume that the feature map input by the LCA attention mechanism is like Figure 4 As shown, C, H, W represent the number of channels, height and width of the input feature map F respectively. Then the output feature map It can be expressed as
[0084]
[0085] in represents the channel attention weight, represents the spatial attention weight, Indicates M C (F) is broadcast (copied) along the H and W dimensions and then multiplied element-wise with the input feature map F. Similarly, M S (F′) is broadcast (copied) along the C dimension and then multiplied element-wise with the intermediate feature map F′.
[0086] 1. Channel Attention
[0087] Unlike CBAM, which directly globally pools the two-dimensional feature maps of each channel and then obtains the channel attention weight through two layers of two-dimensional convolution mapping, LCA aggregates the features of the two-dimensional feature maps along two vertical directions and then uses two layers of one-dimensional convolution to achieve cross-channel information interaction. It not only obtains more effective attention weights but also reduces the amount of parameters. It is a lightweight and more efficient attention mechanism.
[0088] (1) Directional feature aggregation
[0089] First, for each channel of the input feature map F, the pooling kernels (1, W) and (H, 1) are used to perform feature aggregation along the horizontal axis x and the vertical axis y respectively. The aggregation result can be expressed as
[0090]
[0091] where F c (h,i) represents the pixel value of the hth row and ith column of the cth channel of the feature map F. Represents the feature map of the cth channel The aggregation result of the hth row along the x-axis; F c (j,w) represents the pixel value of the jth row and wth column of the cth channel of the feature map F. Represents the feature map F of the cth channel c The aggregation result of the wth column along the y-axis direction. Formula (2) aggregates the long-range dependencies along the horizontal direction while retaining the precise position information in the vertical direction. Similarly, formula (3) aggregates the long-range dependencies along the vertical direction while retaining the precise position information in the horizontal direction. The span of the slender target in the x-axis and y-axis directions is relatively large, so the above-mentioned directional feature aggregation is more conducive to extracting the feature information of the slender target in two directions.
[0092] For the entire feature map F, c∈{1,2,…C}, h∈{1,2,…H}, the feature map after aggregation along the x-axis direction can be obtained by formula (2): Similarly, w∈{1,2,…W}, the feature map after aggregation along the y-axis direction can be obtained by formula (3)
[0093] (2) Cross-channel interaction
[0094] First, a one-dimensional convolution with a convolution kernel depth of H and W is used respectively. Implement F H and F W The local cross-channel interaction can be obtained and As shown in formula (4) and formula (5) respectively.
[0095]
[0096] Among them, Conv 1d represents a one-dimensional convolution, and k is the size of the convolution kernel. k determines the interaction range of adjacent channels and is an odd number with adjustable size, usually set to 3, 5, 7 or 9. Next, F H ′ and F W ' are spliced together and passed through a one-dimensional convolution with a depth of 2 and a size of k After the sigmoid function, the attention weight M of each channel can be obtained. C (F). Then, according to formula (1), the original feature map F can be modified to obtain the intermediate feature map F′, whose dimension is exactly the same as the original feature map F.
[0097] During the training process, the convolution kernel of each channel of CNN updates its parameters based on gradient descent, and gradually adapts to detecting specific feature types. Each channel can be regarded as a dedicated feature detector to capture different features of the input image. Therefore, local cross-channel interactions are conducive to learning more effective attention weights.
[0098] 2. Spatial Attention
[0099] The input of the spatial attention mechanism is the intermediate feature map F′. First, average pooling and maximum pooling are performed along the channel dimension, and the pooling kernel size is 1×C. and Then, after splicing the two along the channel dimension, a two-dimensional convolution with a kernel depth of 2 and a size of 3×3 is used to extract the spatial attention information. Next, the spatial attention weight M is obtained through the sigmoid function S (F′), and then according to formula (1), we can get the final feature map F″ after the LCA attention mechanism correction.
[0100] Embodiment 3
[0101] The existing YOLOv7 algorithm has low detection accuracy (mAP) for slender targets and weak interpretability on power operation datasets. This paper explores the model structure improvement method under the guidance of interpretability and proposes a new lightweight convolutional attention mechanism LCA. This mechanism can significantly improve the YOLOv7 model's attention to slender targets, reduce the impact of background columnar interference, and perform well on other types of targets, with strong robustness.
[0102] In this embodiment, a slender target detection method based on LCA-YOLOv7 is used to detect slender targets. To verify the effect of our proposed new lightweight LCA attention mechanism on slender target detection, a comparative experiment is conducted on the power operation dataset. The experimental steps are as follows:
[0103] Step 1: Download the power operation dataset, convert the dataset format to suit YOLOv7, and divide the training set and test set into a ratio of 8:2.
[0104] Step 2: After introducing the LCA attention mechanism into the SPPCSPC module of the neck part of the YOLOv7 model, the LCA-YOLOv7 network model is obtained, as shown in Figure 5 shown.
[0105] Step 3: Train the LCA-YOLOv7 network model using the power operation dataset. The backbone network can use the pre-trained weights of the original YOLOv7 network, freeze the backbone network, and only train the neck and head parts after the LCA attention mechanism is introduced. Set the number of training iterations to 100, and save the weights of each training during the training process.
[0106] Step 4: Compare the detection accuracy and saliency map feature map of LCA-YOLOv7 with the original YOLOv7, ECA-YOLOv7, CBAM-YOLOv7, CA-YOLOv7 and other models, as shown in Table 2 and Figure 6 As shown, the effect of the proposed new lightweight attention mechanism LCA is verified.
[0107] Table 2 Performance comparison of LCA and other attention mechanisms
[0108]
[0109] As shown in Table 2, the overall performance of the LCA attention mechanism is better than that of the ECA, CBAM and CA attention mechanisms. It not only has the highest accuracy in detecting slender targets, but also performs best in overall target detection, and its parameter count is relatively small. This shows that the LCA attention mechanism is more suitable for target detection in complex power operation site datasets.
[0110] The saliency map of the LCA attention mechanism is shown below: Figure 6 As shown in (e), it is not difficult to see that there are relatively few red attention areas falling on columnar interferences such as towers, and they are basically concentrated on slender targets such as operating rods and electrician testers. This shows that the LCA-Yolov7 model based on the LCA attention mechanism has strong important feature extraction and positioning capabilities and good interpretability.
[0111] Aiming at the substation power operation dataset, the present invention proposes to use significance mapping diagrams to guide network improvement from the perspective of interpretable analysis, moving from machine learning to machine teaching, making deep learning models more interpretable, avoiding the massive experimental work required for blind model improvement, and providing visual method guidance for improving the network.
[0112] In addition, the LCA attention mechanism proposed in the present invention is more lightweight than CA (high detection accuracy) and CBAM (good interpretability), with the number of parameters being 1 / 3 and 1 / 4 respectively, which hardly affects the detection speed of the original Yolov7 model. Although the number of parameters is higher than that of ECA, the performance and interpretability are significantly improved. In short, the present invention improves the model from the perspective of interpretability, and for the first time proposes an attention mechanism LCA for slender objects with extreme aspect ratios, which contributes to improving the detection effect of slender targets in the power field.
[0113] In the prior art, CN115546468A first extracts image features through ResNet, and then sends the feature map as a sequence into the Transformer network. The self-attention mechanism in Transformer enables the model to view the entire input sequence, which is a global attention mechanism. It can better mine the correlation features between the entire image area, but it also brings about a rapid increase in the number of parameters. This inevitably leads to a longer reasoning time for the model, reduced real-time target detection, and the rapid increase in the number of parameters also requires more training data to avoid overfitting. In addition, CN115546468A verifies the model performance through the COCO dataset. The COCO dataset has a total of 80 categories labeled, among which skis, baseball bats, skateboards, surfboards, etc. are considered slender object targets, but their slenderness is far less extreme than the electrician's pen and joystick in the power operation dataset.
[0114] In order to better understand the present invention, the above is described in detail in conjunction with the specific embodiments of the present invention, but it is not intended to limit the present invention. Any simple modifications made to the above embodiments based on the technical essence of the present invention still fall within the scope of the technical solution of the present invention. Each embodiment in this specification focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referenced to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A method for detecting slender objects in the field of electric power operation based on interpretability, comprising obtaining an electric power operation data set and performing format conversion, characterized in that: The following steps are also included: Step 1: After introducing the LCA attention mechanism into the SPPCSPC module of the neck part of the YOLOv7 model, the LCA-YOLOv7 network model is obtained; Step 2: Train the LCA-YOLOv7 network model using the power operation dataset; Step 3: Input the image to be detected into the LCA-YOLOv7 network model and output the detection result.
2. The method for detecting slender objects in the electric power operation field based on interpretability according to claim 1, characterized in that: The LCA attention mechanism includes a channel attention mechanism and a spatial attention mechanism. Assume that the feature map input by the LCA attention mechanism is Then the output feature map It can be expressed as Among them, C, H and W represent the number of channels, height and width of the input feature map F respectively. represents the channel attention weight, represents the spatial attention weight, Indicates M C (F) is broadcast along the H and W dimensions and then multiplied element-wise with the input feature map F, M S (F′) is broadcast along the C dimension and then multiplied element-wise with the intermediate feature map F′.
3. The method for detecting slender objects in the field of electric power operation based on interpretability according to claim 2, characterized in that: The channel attention mechanism includes directly globally pooling the two-dimensional feature map of each channel with CBAM, and then obtaining different channel attention weights through two layers of two-dimensional convolution mapping. LCA aggregates the features of the two-dimensional feature map along two vertical directions, and then uses two layers of one-dimensional convolution to realize cross-channel information interaction.
4. The method for detecting slender objects in the electric power operation field based on interpretability according to claim 3 is characterized in that: The working method of the channel attention mechanism includes the following sub-steps: Step 101: Direction feature aggregation; Step 102: Interact across channels.
5. The method for detecting slender objects in the electric power operation field based on interpretability according to claim 4, characterized in that: The step 101 includes, for each channel of the input feature map F, using the pooling kernels of (1, W) and (H, 1) respectively to perform feature aggregation along the horizontal axis x direction and the vertical axis y direction. The aggregation result can be expressed as Among them, F c (h,i) represents the pixel value of the hth row and ith column of the cth channel of the feature map F. Represents the feature map of the cth channel The aggregation result of the hth row along the x-axis, F c (j,w) represents the pixel value of the jth row and wth column of the cth channel of the feature map F. Represents the feature map F of the cth channel c Aggregation result of the wth column along the y-axis.
6. The method for detecting elongated objects in the electric power operation field based on interpretability according to claim 5, characterized in that: The step 102 comprises performing one-dimensional convolution using a convolution kernel with a depth of H and W respectively. Realize the feature map F after aggregation along the x-axis direction H And the feature map F after aggregation along the y-axis direction W The local cross-channel interaction can be obtained and The formula is Among them, Conv 1d represents one-dimensional convolution, and k is the size of the convolution kernel.
7. The method for detecting elongated objects in the electric power operation field based on interpretability according to claim 6, characterized in that: The step 102 also includes the step of H ′ and F W ' are spliced together and passed through a one-dimensional convolution with a kernel depth of 2 and a size of k After the sigmoid function, the attention weight M of each channel is obtained. C (F).
8. The method for detecting elongated objects in the electric power operation field based on interpretability according to claim 7, characterized in that: The step 102 further includes modifying the original feature map F according to the following formula to obtain an intermediate feature map F′, whose dimension is the same as that of the original feature map F:
9. The method for detecting elongated objects in the electric power operation field based on interpretability according to claim 8, characterized in that: The input of the spatial attention mechanism is the intermediate feature map F′.
10. The method for detecting elongated objects in the electric power operation field based on interpretability according to claim 9, characterized in that: The working method of the spatial attention mechanism includes the following sub-steps: Step 111: Perform average pooling and maximum pooling along the channel dimension, with the pooling kernel size of 1×C, to obtain and Step 112: After concatenating the two along the channel dimension, a two-dimensional convolution with a kernel depth of 2 and a size of 3×3 is used to extract spatial attention information; Step 113: Obtain the spatial attention weight M through the sigmoid function S (F′), and then the final feature map F″ after the LCA attention mechanism correction is obtained according to the following formula:
Citation Information
Patent Citations
Transform-based slender object target detection method
CN115546468A