Power transmission line lightning arrester detection method based on infrared image and rotating target frame

Through the detection method based on infrared images and rotating target frames, combined with data enhancement and image preprocessing, the YOLOv5 network is improved, which solves the problem of large background interference in the horizontal target frame detection results in the existing technology, and realizes the high efficiency of lightning arresters in infrared images. Precision automatic identification and temperature monitoring.

CN118608964AActive Publication Date: 2024-09-06HEBEI BEIWEI BAOHU ELECTRIC EQUIP CO LTD

Patent Information

Application Number
CN202410752339.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-06
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Existing automatic detection methods for transmission line arresters mainly use horizontal target frames, which results in detection results containing more background parts, greater interference, and poor infrared image quality, making it difficult to achieve high-precision automatic identification.

Method used

Using a detection method based on infrared images and rotating target frames, image preprocessing through copy-paste data enhancement, local equally spaced platform histogram equalization and Laplacian sharpening, combined with the improved YOLOv5 network, using oblique convolution modules, Grouped spatial attention and adaptive feature fusion modules improve the detection head to rotate target frame detection, reduce background interference and improve detection accuracy.

Benefits of technology

It effectively reduces background interference, improves the detection accuracy and generalization ability of transmission line arresters, realizes automatic identification of arresters in infrared images, and provides a basis for automatic temperature monitoring of transmission line arresters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608964A
    Figure CN118608964A
Patent Text Reader

Abstract

The invention discloses a power transmission line lightning arrester detection method based on an infrared image and a rotating target frame, and the method comprises the steps: collecting the infrared image of a power transmission line lightning arrester through an infrared camera, and building an initial data set; increasing the data volume of the initial data set by using a copy and paste data enhancement mode, and establishing an expanded data set; performing image enhancement preprocessing on the image in the expanded data set to improve the contrast ratio and marginal definition of the image, and marking a rotating target frame of the lightning arrester; training the constructed lightning arrester detection network by using the marked data set to obtain an optimal lightning arrester detection model; and performing image enhancement preprocessing on a to-be-detected infrared image of the power transmission line, and then inputting the to-be-detected infrared image into the optimal lightning arrester detection model to obtain lightning arrester confidence and rotating target frame information. According to the method provided by the invention, automatic identification of the infrared image power transmission line lightning arrester can be realized, and the technical problems of poor quality of the infrared image and many background interferences in the horizontal target frame are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of infrared image target detection, in particular to a transmission line arrester detection method based on infrared images and a rotating target frame. Background Art

[0002] Lightning arresters are basic components of power transmission lines. Lightning arresters are in operation for a long time and are affected by environmental factors. Various faults often occur, usually in the form of overall or local abnormal heating. Therefore, temperature monitoring of lightning arresters is an important part of power transmission line safety monitoring. Since infrared thermal imaging technology has the advantages of non-contact, wide range, all-weather, and no electromagnetic interference, infrared temperature measurement is the main means of temperature monitoring of power equipment. At present, the temperature monitoring of transmission line lightning arresters mainly relies on manual target recognition on infrared images to obtain temperature. This manual recognition method is highly subjective, time-consuming, inefficient, and poorly adaptable.

[0003] In recent years, the development of deep learning-based target detection technology has made it possible to automatically identify lightning arresters in infrared images. However, the existing automatic detection methods for transmission line lightning arresters mainly use horizontal target frame detection. The detected target frame contains a lot of background parts, which has a lot of interference on the temperature monitoring of transmission line lightning arresters. At the same time, infrared images have the characteristics of low resolution, poor clarity, low signal-to-noise ratio, and poor image quality. Therefore, poor infrared image quality and background interference in the horizontal target frame are the problems that need to be solved to achieve high-precision automatic identification of transmission line lightning arresters. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a transmission line arrester detection method based on infrared images and rotating target frames, which can effectively realize the automatic identification of transmission line arresters by infrared images, provide a basis for realizing automatic temperature monitoring of transmission line arresters, and solve the technical problems of poor infrared image quality and much background interference in the horizontal target frame.

[0005] To achieve the above object, the technical solution provided by the present invention is: a transmission line arrester detection method based on infrared images and a rotating target frame, comprising the following steps:

[0006] Step 1: Use an infrared camera to collect infrared images of the transmission line arrester to establish an initial data set;

[0007] Step 2: Use copy-paste data augmentation to increase the data volume of the initial data set and establish an expanded data set;

[0008] Step 3: Perform image enhancement preprocessing on the images in the expanded data set to improve the image contrast and edge clarity, and mark the rotating target frame of the arrester;

[0009] Step 4, using the labeled data set to train the constructed arrester detection network to obtain the optimal arrester detection model; wherein the arrester detection network is an improved YOLOv5 network, which improves the feature extraction network, feature fusion network and detection head of the YOLOv5 network respectively; the improvement of the feature extraction network is: adding the AngleConv module to the feature extraction network and adopting the improved CBAM attention module with grouped spatial attention and increased input-output direct connection; the improvement of the feature fusion network is: adding feature fusion of 1 / 8 to 1 / 4 scale in the top-down feature fusion part, adding feature fusion of 1 / 4 to 1 / 8 scale in the bottom-up feature fusion part and deleting feature fusion of 1 / 16 to 1 / 32 scale, The Concat operation of the bottom-up feature fusion part is replaced by an adaptive feature fusion module, and a Conv module connecting the top-down and bottom-up feature fusion paths is added to adjust the number of channels of the input features of the adaptive feature fusion module; the improvement of the detection head is as follows: the three detection scales of the detection head are changed from 1 / 8, 1 / 16, and 1 / 32 to 1 / 4, 1 / 8, and 1 / 16, and the horizontal target frame detection head is improved to a rotation target frame detection head, and the prediction of the width and height of the horizontal target frame by the detection head is improved to the prediction of the long side and short side of the rotation target frame respectively, and 180 prediction channels are added to predict the angle of the rotation target frame, corresponding to 180 categories with an interval of 1 degree from 0 to 180 degrees, and the angle of the rotation target frame is represented by the long side;

[0010] Step 5: After the infrared image of the transmission line to be detected is subjected to image enhancement preprocessing in step 3, it is input into the optimal arrester detection model to obtain the arrester confidence and rotation target frame information.

[0011] Further, in step 2, the copy and paste data enhancement method is as follows:

[0012] Take one image as the target source image and another image as the background image, make sure the width and height of the target source image and the background image are consistent, use labelme software to mark at least one polygonal paste block on the target source image; read all polygonal paste blocks in the mark file of the target source image, initialize the list list used to record the positions of the pasted paste blocks in the new image to an empty list, remember w = image width, h = image height, and do the following operations for each polygonal paste block in turn:

[0013] a. The minimum horizontal coordinate of the current polygon paste block is x min , the maximum horizontal coordinate is x max , the minimum vertical coordinate is y min , the maximum vertical coordinate is y max ;

[0014] b. Randomly generate the horizontal translation tx and vertical translation ty of the current polygon paste block, and make tx and ty satisfy the boundary constraint condition, that is, -x min <tx<wx max And -y min <ty<hy max ;

[0015] c. Determine whether the minimum circumscribed horizontal rectangular frame of the current polygonal paste block after translation according to the translation amount (tx, ty) overlaps with the minimum circumscribed horizontal rectangular frames of the polygonal paste blocks pasted in the new image. If there is overlap, regenerate the translation amount (tx, ty) and try again to see whether the minimum circumscribed horizontal rectangular frame of the current polygonal paste block after translation according to the translation amount (tx, ty) overlaps with the minimum circumscribed horizontal rectangular frames of the polygonal paste blocks pasted in the new image. If the number of attempts exceeds the preset limit, skip the current polygonal paste block.

[0016] d. Paste the current polygon paste block onto the background image according to the translation amount (tx, ty), and record the position of the current polygon paste block in the new image in the list list (x min +tx,x max +tx,y min +ty,y max +ty), where (x min +tx,x max +tx,y min +ty,y max +ty) represent the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate of the pasted block in the new image respectively.

[0017] Further, the step 3 comprises the following steps:

[0018] Step 3.1, divide the image into blocks, determine the platform histogram threshold T, and process the original histogram of each block according to the following formula to obtain the platform histogram:

[0019]

[0020] Where k is the gray value, P T (k) is the platform histogram, P r (k) is the original histogram; then calculate the cumulative function F of the platform histogram T (k), expressed as:

[0021]

[0022] Where P T (j) represents the platform histogram value of gray value j;

[0023] Calculate the gray value R after platform histogram equalization corresponding to the gray value k T (k), expressed as:

[0024]

[0025] In the formula, F T (k) represents the value of the cumulative function of the platform histogram corresponding to the gray value k, F T (255) represents the value of the cumulative function of the platform histogram corresponding to the grayscale value 255;

[0026] R T (k) values ​​are processed at equal intervals, because R T (k)≥R T (k-1), calculate R when k ranges from 0 to 255 T The sorting of (k) values ​​is O(k), where O(0) = 0. The calculation formula of O(k) is:

[0027]

[0028] In the formula, R T (k) represents the gray value after platform histogram equalization corresponding to gray value k, R T (k-1) represents the gray value after platform histogram equalization corresponding to gray value k-1, O(k-1) represents the gray value R after platform histogram equalization corresponding to gray value k-1 T Sorting of (k-1) values;

[0029] Calculate the mapping relationship f(k) between the grayscale value after equalization of the equally spaced platform histogram and the original grayscale value. The specific calculation formula is expressed as:

[0030]

[0031] According to the mapping relationship f(k) of each block, the original image is converted into a new image, that is, an image with local equidistant platform histogram equalization is obtained;

[0032] Step 3.2, perform Laplace sharpening on the image obtained by local equidistant platform histogram equalization to obtain a preprocessed infrared image.

[0033] Further, in step 4, the first branch of the AngleConv module is connected in series with a Conv module to obtain a feature map I1, the second branch is first connected in series with a Conv module that converts the number of channels to one-fourth, and then four oblique convolution modules with angles θ1, θ2, θ3, and θ4 are connected in parallel to obtain feature maps I2, I3, I4, and I5. Then, the output I1 of the first branch and the output I2, I3, I4, and I5 of the second branch are used as inputs, and after the Concat operation, a Conv module that reduces the number of channels by half is connected in series to obtain the output feature map of the AngleConv module; the oblique convolution module specifically performs the following operations: first, the feature map Figure 4 Zero padding is performed to make the width and height of the feature map equal to the diagonal length of the feature map before zero padding. Secondly, the feature map is rotated by an angle of -θ j' , j'=1,2,3,4, and then connect a channel-by-channel convolution layer in series, and then rotate the output feature map by angle θ j' , and then remove the elements at the zero-filled positions around to restore the feature map to its original width and height, and obtain the output feature map of the oblique convolution module.

[0034] Further, in step 4, the improved CBAM attention module specifically performs the following operations: in its spatial attention module, the output features of its channel attention module are grouped into groups of 128 channels, the maximum value and average value of each group are calculated in the channel dimension, and then a convolution layer with an output channel number of 1 is connected in series and multiplied with the output of the channel attention module after passing through a Sigmoid function to obtain the output of the spatial attention module, and then multiplied with the input of the CBAM attention module through a Sigmoid function to obtain the output feature map of the improved CBAM attention module.

[0035] Further, in step 4, the adaptive feature fusion module specifically performs the following operations: taking two input feature maps as input, after Concat operation, and then serially connecting a Conv module with an output channel number of 2, and then applying a Softmax function in the channel dimension, taking the two values ​​of each spatial position as the sum weights of the two input features of the spatial position, and performing weighted summation to obtain an output feature map, which is expressed as:

[0036] O=W[0]⊙I'1+W[1]⊙I'2

[0037] W=Softmax(Conv(Concat(I'1,I'2)))

[0038] Where I'1 and I'2 represent two input feature maps, O represents the output feature map after adaptive feature fusion, W is the weight tensor of the two channels, W[0] is the weight matrix of the first channel of W, W[1] is the weight matrix of the second channel of W, ⊙ represents the dot product operation, Concat represents the Concat operation in the channel dimension, Conv represents the Conv module, and Softmax represents the Softmax operation in the channel dimension.

[0039] Further, in step 4, when training the arrester detection network, the loss L of the angle prediction training is θ The calculation formula is:

[0040]

[0041] Where, t i is the label value of the i-th angle category, p i is the predicted value of the i-th angle category, Sigmoid represents the Sigmoid function, and t i The specific calculation formula is:

[0042]

[0043] n0(i)=argmin n (|u+180×ni|), the value range of n is an integer

[0044] Where u is the angle category corresponding to the real rotation target frame, and its value range is 0, 1, 2, ..., 179. σ represents the standard deviation of the normal distribution of the angle label, and takes an appropriate value. n0(i) represents the value of n that minimizes |u-180×ni|.

[0045] The loss L for confidence prediction training obj The calculation formula is:

[0046]

[0047] L obj =-(y′log(Sigmoid(p))+(1-y′)log(1-Sigmoid(p)))

[0048] In the formula, p rbox is the predicted rotated target box, t rbox is the real rotating target frame, Inter(p rbox ,t rbox ) represents the intersection area of ​​two rotated target boxes, Union(p rbox ,t rbox) represents the union area of ​​two rotated target boxes, p is the confidence prediction value, y′ is the confidence label value, and Sigmoid represents the Sigmoid function;

[0049] Use the improved CIoU to calculate the position of the rotated target box and the prediction loss of the long and short edges. The improved CIoU calculation formula is:

[0050]

[0051] Where x, y, l, and s are the predicted target center abscissa, target center ordinate, target long side length, and target short side length, respectively. b represents a horizontal rectangular box with x, y, l, and s as the center position abscissa, center position ordinate, width, and height, respectively. b gt It represents a horizontal rectangular box with the true values ​​of x, y, l, and s as the horizontal coordinate of the center position, the vertical coordinate of the center position, the width, and the height. gt ) represents b and b gt The Euclidean distance between the center points of b and b. gt The intersection-and-union ratio of c means that it can contain both b and b gt The diagonal length of the minimum horizontal rectangular frame, l gt and gt They represent the true value of the target long side length and the true value of the short side length, v, α, is an intermediate variable.

[0052] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0053] 1. The present invention provides a copy and paste data enhancement method, which can effectively expand the amount of sample data and solve the problem of small sample data.

[0054] 2. The present invention provides an image enhancement method combining local equidistant platform histogram equalization and Laplace sharpening, which can improve image contrast and edge clarity in the image and solve the problem of poor infrared image quality.

[0055] 3. The present invention constructs an arrester detection network including an AngleConv module based on an oblique convolution module, an improved CBAM attention module that adopts grouped spatial attention and increases direct connection between input and output, an adaptive feature fusion module, and a rotating target frame detection head, which can reduce the background interference on the temperature monitoring of the transmission line arrester and improve the detection accuracy and generalization ability of the arrester detection model.

[0056] 4. The present invention uses the IoU of the predicted rotated target box and the true rotated target box as the label of the positive sample confidence, which can suppress the score of the predicted target box with a smaller overlap with the true target box, thereby reducing false detection; and designs an improved CIoU to calculate the position of the rotated target box and the long and short side prediction loss. Compared with the original CIoU loss, this loss is more adaptable to the characteristics of the large long and short side ratio of the transmission line lightning arrester, and can improve the detection accuracy and generalization ability of the lightning arrester detection model. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 The present invention is a flowchart of a method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames in an embodiment of the present invention.

[0058] Figure 2 Schematic diagram of images before and after image enhancement preprocessing; in the figure, (a) is the image before image enhancement preprocessing, and (b) is the image after image enhancement preprocessing.

[0059] Figure 3 It is an overall structural diagram of the lightning arrester detection network in an embodiment of the present invention; in the figure, AngleConv represents the AngleConv module, Attention represents the improved CBAM attention module, AdaptFusion represents the adaptive feature fusion module, Head represents the detection head, Up represents the upsampling module, Conv, C3, SPPF, and Concat represent the corresponding modules in YOLOv5 respectively, and Conv2d represents the convolutional layer.

[0060] Figure 4 It is a structural diagram of the AngleConv module in an embodiment of the present invention; in the figure, Input feature refers to the input feature map of the module, Output feature refers to the output feature map of the module, Conv represents a module including a convolutional layer, a BN layer, and a Silu layer, and Conv2d represents a convolutional layer.

[0061] Figure 5 It is a structural diagram of the improved CBAM attention module in an embodiment of the present invention; in the figure, ChannelAttention represents the channel attention of the CBAM attention module, Spatial Attention represents the improved spatial attention, and Sigmoid represents the Sigmoid function.

[0062] Figure 6 : is a structural diagram of the adaptive feature fusion module in an embodiment of the present invention; in the figure, I1', I'2 represent two input feature maps of the module, O represents the output feature map, and Softmax represents the Softmax operation in the channel dimension.

[0063] Figure 7It is a comparison diagram of the f function in the improved CIoU and the arctan function in the CIoU in an embodiment of the present invention.

[0064] Figure 8 2 is an example diagram of the detection results in the embodiment of the present invention. DETAILED DESCRIPTION

[0065] The present invention will be further described below in conjunction with specific embodiments.

[0066] This embodiment discloses a method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames. Figure 1 As shown, the method comprises the following steps:

[0067] Step 1: Use an infrared camera to collect infrared images of the transmission line arrester and establish an initial data set, including the following steps:

[0068] Step 1.1, use an infrared camera to take photos of the transmission line arrester in various scenes, including close-range shooting, long-range shooting and multi-angle shooting;

[0069] Step 1.2, perform data cleaning on the collected images and remove low-quality images without arrester targets or blurred images;

[0070] Step 1.3: Use rolabelimg software to label the retained images, including the target category and the position of the rotation box.

[0071] Step 2: Use the copy and paste data enhancement method to increase the data volume of the initial data set and establish an expanded data set; the copy and paste data enhancement method is as follows:

[0072] Take one image as the target source image and another image as the background image, make sure the width and height of the target source image and the background image are consistent, use labelme software to mark at least one polygonal paste block on the target source image; read all polygonal paste blocks in the mark file of the target source image, initialize the list list used to record the positions of the pasted paste blocks in the new image to an empty list, remember w = image width, h = image height, and do the following operations for each polygonal paste block in turn:

[0073] a. The minimum horizontal coordinate of the current polygon paste block is x min , the maximum horizontal coordinate is x max , the minimum vertical coordinate is y min , the maximum vertical coordinate is y max ;

[0074] b. Randomly generate the horizontal translation tx and vertical translation ty of the current polygon paste block, and make tx and ty satisfy the boundary constraint condition, that is, -x min <tx<wx max And -y min <ty<hy max ;

[0075] c. Determine whether the minimum circumscribed horizontal rectangular frame of the current polygonal paste block after translation according to the translation amount (tx, ty) overlaps with the minimum circumscribed horizontal rectangular frames of the polygonal paste blocks pasted in the new image. If there is overlap, regenerate the translation amount (tx, ty) and try again to see whether the minimum circumscribed horizontal rectangular frame of the current polygonal paste block after translation according to the translation amount (tx, ty) overlaps with the minimum circumscribed horizontal rectangular frames of the polygonal paste blocks pasted in the new image. If the number of attempts exceeds the preset limit, skip the current polygonal paste block.

[0076] d. Paste the current polygon paste block onto the background image according to the translation amount (tx, ty), and record the position of the current polygon paste block in the new image in the list list (x min +tx,x max +tx,y min +ty,y max +ty), where (x min +tx,x max +tx,y min +ty,y max +ty) represent the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate of the pasted block in the new image respectively.

[0077] Step 3: Perform image enhancement preprocessing on the images in the expanded dataset to improve the image contrast and edge clarity, such as Figure 2 As shown in the figure, and marking the rotating target frame of the lightning arrester, the specific steps include:

[0078] Step 3.1, divide the image into blocks, determine the platform histogram threshold T, and process the original histogram of each block according to the following formula to obtain the platform histogram:

[0079]

[0080] Where k is the gray value, P T (k) is the platform histogram, P r (k) is the original histogram; then calculate the cumulative function F of the platform histogram T (k), expressed as:

[0081]

[0082] Where P T (j) represents the platform histogram value of gray value j;

[0083] Calculate the gray value R after platform histogram equalization corresponding to the gray value k T (k), expressed as:

[0084]

[0085] In the formula, F T (k) represents the value of the cumulative function of the platform histogram corresponding to the gray value k, F T (255) represents the value of the cumulative function of the platform histogram corresponding to the grayscale value 255;

[0086] R T (k) values ​​are processed at equal intervals, because R T (k)≥R T (k-1), calculate R when k ranges from 0 to 255 T The sorting of (k) values ​​is O(k), where O(0) = 0. The calculation formula of O(k) is:

[0087]

[0088] In the formula, R T (k) represents the gray value after platform histogram equalization corresponding to gray value k, R T (k-1) represents the gray value after platform histogram equalization corresponding to gray value k-1, O(k-1) represents the gray value R after platform histogram equalization corresponding to gray value k-1 T Sorting of (k-1) values;

[0089] Calculate the mapping relationship f(k) between the grayscale value after equalization of the equally spaced platform histogram and the original grayscale value. The specific calculation formula is expressed as:

[0090]

[0091] According to the mapping relationship f(k) of each block, the original image is converted into a new image, that is, an image with local equidistant platform histogram equalization is obtained;

[0092] Step 3.2, perform Laplace sharpening on the image obtained by local equidistant platform histogram equalization to obtain a preprocessed infrared image.

[0093] Step 4: Use the labeled data set to train the constructed arrester detection network to obtain the optimal arrester detection model; wherein the arrester detection network is an improved YOLOv5 network, such as Figure 3As shown in the figure, the feature extraction network, feature fusion network and detection head of the YOLOv5 network are improved respectively; the improvement of the feature extraction network is: adding the AngleConv module to the feature extraction network and adopting the improved CBAM attention module with grouped spatial attention and increased input-output direct connection; the improvement of the feature fusion network is: adding feature fusion of 1 / 8 to 1 / 4 scale in the top-down feature fusion part, adding feature fusion of 1 / 4 to 1 / 8 scale in the bottom-up feature fusion part and deleting feature fusion of 1 / 16 to 1 / 32 scale, replacing the Concat operation of the bottom-up feature fusion part with adaptive feature fusion The module is added, and the Conv module connecting the top-down and bottom-up feature fusion paths is added to adjust the number of channels of the input features of the adaptive feature fusion module; the improvement of the detection head is as follows: the three detection scales of the detection head are changed from 1 / 8, 1 / 16, and 1 / 32 to 1 / 4, 1 / 8, and 1 / 16, and the horizontal target frame detection head is improved to a rotation target frame detection head, and the prediction of the width and height of the horizontal target frame by the detection head is improved to the prediction of the long side and short side of the rotation target frame respectively, and 180 prediction channels are added to predict the angle of the rotation target frame, corresponding to 180 categories with an interval of 1 degree from 0 to 180 degrees, and the angle of the rotation target frame is represented by the long side;

[0094] Specifically, the feature extraction network of the lightning arrester detection network first connects two Conv modules with a step size of 2, an AngleConv module, and a C3 module in series to obtain a first feature map, then connects a Conv module with a step size of 2 and a C3 module in series to obtain a second feature map, then connects a Conv module with a step size of 2 and a C3 module in series to obtain a third feature map, and then connects a Conv module with a step size of 2, a C3 module, an SPPF module, and an improved CBAM attention module in series to obtain a fourth feature map.

[0095] like Figure 4 As shown, the first branch of the AngleConv module is connected in series with a Conv module to obtain a feature map I1, the second branch is first connected in series with a Conv module that converts the number of channels to one-fourth, and then four slant convolution modules with angles θ1, θ2, θ3, and θ4 are connected in parallel to obtain feature maps I2, I3, I4, and I5. Then, the output I1 of the first branch and the output I2, I3, I4, and I5 of the second branch are used as inputs, and after the Concat operation, a Conv module that reduces the number of channels by half is connected in series to obtain the output feature map of the AngleConv module; the slant convolution module specifically performs the following operations: first, the feature Figure 4 Zero padding is performed to make the width and height of the feature map equal to the diagonal length of the feature map before zero padding. Secondly, the feature map is rotated by an angle of -θ j', j'=1,2,3,4, and then connect a channel-by-channel convolution layer in series, and then rotate the output feature map by angle θ j' , and then remove the elements at the zero-filled positions around to restore the feature map to its original width and height, and obtain the output feature map of the oblique convolution module.

[0096] like Figure 5 As shown in the figure, the specific situation of the improved CBAM attention module is: in its spatial attention module, the output features of its channel attention module are grouped into groups of 128 channels, and the maximum and average values ​​of each group are calculated in the channel dimension. Then, a convolution layer with an output channel number of 1 is connected in series and multiplied with the output of the channel attention module after passing through the Sigmoid function to obtain the output of the spatial attention module, and then multiplied with the input of the CBAM attention module through the Sigmoid function to obtain the output feature map of the improved CBAM attention module.

[0097] The feature fusion network of the lightning arrester detection network takes the fourth feature map as input, and sequentially connects a Conv module, an upsampling module with a ratio of 2, a Concat operation, a C3 module, and a Conv module to obtain a fifth feature map, wherein another input of the Concat operation is the third feature map; secondly, an upsampling module with a ratio of 2, a Concat operation, a C3 module, and a Conv module are sequentially connected to obtain a sixth feature map, wherein another input of the Concat operation is the second feature map; then, an upsampling module with a ratio of 2, a Concat operation, and a C3 module are sequentially connected to obtain a seventh feature map, wherein another input of the Concat operation is the first feature map; then, a Conv module with a step size of 2, an adaptive feature fusion module, and a C3 module are sequentially connected to obtain an eighth feature map, wherein another input of the adaptive feature fusion module is the output feature map of the sixth feature map after passing through a Conv module; finally, a Conv module with a step size of 2, an adaptive feature fusion module, and a C3 module are sequentially connected to obtain a ninth feature map, wherein another input of the adaptive feature fusion module is the output feature map of the fifth feature map after passing through a Conv module.

[0098] like Figure 6 As shown in FIG. 1 , the specific situation of the adaptive feature fusion module is: taking two input feature maps as input, after the Concat operation, and then connecting the Conv module with an output channel number of 2 in series, then applying the Softmax function in the channel dimension, taking the two values ​​of each spatial position as the sum weights of the two input features of the spatial position, and weighted summing to obtain the output feature map, which is expressed as:

[0099] O=W[0]⊙I'1+W[1]⊙I'2

[0100] W=Softmax(Conv(Concat(I'1,I'2)))

[0101] Where I'1 and I'2 represent two input feature maps, O represents the output feature map after adaptive feature fusion, W is the weight tensor of the two channels, W[0] is the weight matrix of the first channel of W, W[1] is the weight matrix of the second channel of W, ⊙ represents the dot product operation, Concat represents the Concat operation in the channel dimension, Conv represents the Conv module, and Softmax represents the Softmax operation in the channel dimension.

[0102] The detection head of the arrester detection network adopts an improved YOLOv5 detection head, which takes the seventh feature map, the eighth feature map, and the ninth feature map as input to predict target confidence, target category, the long side, the short side, the position of the rotated target box, and the angle of the rotated target box.

[0103] When training the arrester detection network, the loss L for angle prediction training is θ The calculation formula is:

[0104]

[0105] Where, t i is the label value of the i-th angle category, p i is the predicted value of the i-th angle category, Sigmoid represents the Sigmoid function, and t i The specific calculation formula is:

[0106]

[0107] n0(i)=argmin n (|u+180×ni|), the value range of n is an integer

[0108] Where u is the angle category corresponding to the real rotation target frame, and its value range is 0, 1, 2, ..., 179. σ represents the standard deviation of the normal distribution of the angle label, and takes an appropriate value. n0(i) represents the value of n that minimizes |u+180×ni|.

[0109] The loss L for confidence prediction training obj The calculation formula is:

[0110]

[0111] L obj =-(y′log(Sigmoid(p))+(1-y′)log(1-Sigmoid(p)))

[0112] In the formula, prbox is the predicted rotated target box, t rbox is the real rotating target frame, Inter(p rbox ,t rbox ) represents the intersection area of ​​two rotated target boxes, Union(p rbox ,t rbox ) represents the union area of ​​two rotated target boxes, p is the confidence prediction value, y′ is the confidence label value, and Sigmoid represents the Sigmoid function;

[0113] Use the improved CIoU to calculate the position of the rotated target box and the prediction loss of the long and short edges. The improved CIoU calculation formula is:

[0114]

[0115] Where x, y, l, and s are the predicted target center abscissa, target center ordinate, target long side length, and target short side length, respectively. b represents a horizontal rectangular box with x, y, l, and s as the center position abscissa, center position ordinate, width, and height, respectively. b gt It represents a horizontal rectangular box with the true values ​​of x, y, l, and s as the horizontal coordinate of the center position, the vertical coordinate of the center position, the width, and the height. gt ) represents b and b gt The Euclidean distance between the center points of b and b. gt The intersection-and-union ratio of c means that it can contain both b and b gt The diagonal length of the minimum horizontal rectangular frame, l gt and gt They represent the true value of the target long side length and the true value of the short side length, v, α, is an intermediate variable.

[0116] like Figure 7 As shown in the figure, compared with the arctan function, when the independent variable is large (greater than or equal to 3.2), the f function can increase the dependent variable difference when the independent variable difference is constant, and improve the sensitivity of the training network to the difference in the ratio of the long side to the short side of the target, which is suitable for the detection of targets with large ratios of the long side to the short side, such as transmission line arresters.

[0117] The steps for training the arrester detection network include:

[0118] a. Organize the data set after data augmentation and image preprocessing, and divide the data set into training set and test set in a ratio of 5:1.

[0119] b. Determine the hyperparameters of the arrester detection network, train the arrester detection network using the training set according to the determined hyperparameters, and test the performance of the training model using the test set. In this embodiment, the training batch size is 8, the input image resolution is 384×288, the initial learning rate is 0.01, the training batch is 300, and online data enhancement methods such as grayscale transformation, scale transformation, and Mosaic data enhancement are used to improve the robustness of the training model.

[0120] Step 5, inputting the infrared image of the transmission line to be detected into the optimal arrester detection model after image enhancement preprocessing in step 3 to obtain the arrester confidence and rotation target frame information; specifically comprising the following steps:

[0121] Step 5.1, perform the local equally spaced platform histogram equalization and Laplace sharpening of the infrared image to be detected in step 3, input the optimal lightning arrester detection model, and obtain the output detection result;

[0122] Step 5.2, the output detection results of step 5.1 are input into the post-processing mechanism, redundant detection results are removed, and the final arrester detection results are obtained, including the rotation target frame and confidence level, such as Figure 8 shown.

[0123] The post-processing mechanism is based on the NMS (non-maximum suppression) post-processing of the rotated target box IoU, and its steps are:

[0124] a. Select the one with the largest score in the initial detection frame set, move it into the final detection frame set, and remove it from the initial detection frame set;

[0125] b. Calculate the IoU value (intersection over union) of the rotation target frame between the detection frame selected in step a and each detection frame in the initial detection frame set. If the IoU value is greater than the set threshold, move the detection frame out of the initial detection frame;

[0126] c. Repeat steps ab until there is no detection box in the initial detection box.

[0127] In summary, the present invention can detect the confidence and rotation target frame of the lightning arrester in the infrared image, improve the detection accuracy and generalization ability of the transmission line lightning arrester detection model, and provide a basis for realizing automatic temperature monitoring of the transmission line lightning arrester, which is worthy of promotion.

[0128] The above-described embodiments are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, all changes made according to the shape and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A transmission line arrester detection method based on infrared images and rotating target frames, characterized in that: The following steps are involved: Step 1: Use an infrared camera to collect infrared images of the transmission line arrester to establish an initial data set; Step 2: Use copy-paste data augmentation to increase the data volume of the initial data set and establish an expanded data set; Step 3: Perform image enhancement preprocessing on the images in the expanded data set to improve the image contrast and edge clarity, and mark the rotating target frame of the arrester; Step 4, using the labeled data set to train the constructed arrester detection network to obtain the optimal arrester detection model; wherein the arrester detection network is an improved YOLOv5 network, which improves the feature extraction network, feature fusion network and detection head of the YOLOv5 network respectively; the improvement of the feature extraction network is: adding the AngleConv module to the feature extraction network and adopting the improved CBAM attention module with grouped spatial attention and increased input-output direct connection; the improvement of the feature fusion network is: adding feature fusion of 1 / 8 to 1 / 4 scale in the top-down feature fusion part, adding feature fusion of 1 / 4 to 1 / 8 scale in the bottom-up feature fusion part and deleting feature fusion of 1 / 16 to 1 / 32 scale, The Concat operation of the bottom-up feature fusion part is replaced by an adaptive feature fusion module, and a Conv module connecting the top-down and bottom-up feature fusion paths is added to adjust the number of channels of the input features of the adaptive feature fusion module; the improvement of the detection head is as follows: the three detection scales of the detection head are changed from 1 / 8, 1 / 16, and 1 / 32 to 1 / 4, 1 / 8, and 1 / 16, and the horizontal target frame detection head is improved to a rotation target frame detection head, and the prediction of the width and height of the horizontal target frame by the detection head is improved to the prediction of the long side and short side of the rotation target frame respectively, and 180 prediction channels are added to predict the angle of the rotation target frame, corresponding to 180 categories with an interval of 1 degree from 0 to 180 degrees, and the angle of the rotation target frame is represented by the long side; Step 5: After the infrared image of the transmission line to be detected is subjected to image enhancement preprocessing in step 3, it is input into the optimal arrester detection model to obtain the arrester confidence and rotation target frame information.

2. The method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames according to claim 1 is characterized in that: In step 2, the copy and paste data enhancement method is as follows: Take one image as the target source image and another image as the background image, make sure the width and height of the target source image and the background image are consistent, use labelme software to mark at least one polygonal paste block on the target source image; read all polygonal paste blocks in the mark file of the target source image, initialize the list list used to record the positions of the pasted paste blocks in the new image to an empty list, remember w = image width, h = image height, and do the following operations for each polygonal paste block in turn: a. The minimum horizontal coordinate of the current polygon paste block is x min , the maximum horizontal coordinate is x max , the minimum vertical coordinate is y min , the maximum vertical coordinate is y max ; b. Randomly generate the horizontal translation tx and vertical translation ty of the current polygon paste block, and make tx and ty satisfy the boundary constraint condition, that is, -x min <tx<wx max And -y min <ty<hy max ; c. Determine whether the minimum circumscribed horizontal rectangular frame of the current polygonal paste block after translation according to the translation amount (tx, ty) overlaps with the minimum circumscribed horizontal rectangular frames of the polygonal paste blocks pasted in the new image. If there is overlap, regenerate the translation amount (tx, ty) and try again to see whether the minimum circumscribed horizontal rectangular frame of the current polygonal paste block after translation according to the translation amount (tx, ty) overlaps with the minimum circumscribed horizontal rectangular frames of the polygonal paste blocks pasted in the new image. If the number of attempts exceeds the preset limit, skip the current polygonal paste block. d. Paste the current polygon paste block onto the background image according to the translation amount (tx, ty), and record the position of the current polygon paste block in the new image in the list list (x min +tx,x max +tx,y min +ty,y max +ty), where (x min +tx,x max +tx,y min +ty,y max +ty) represent the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate of the pasted block in the new image respectively.

3. The method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames according to claim 1, characterized in that: The step 3 comprises the following steps: Step 3.1, divide the image into blocks, determine the platform histogram threshold T, and process the original histogram of each block according to the following formula to obtain the platform histogram: Where k is the gray value, P T (k) is the platform histogram, P r (k) is the original histogram; then calculate the cumulative function F of the platform histogram T (k), expressed as: Where P T (j) represents the platform histogram value of gray value j; Calculate the gray value R after platform histogram equalization corresponding to the gray value k T (k), expressed as: In the formula, F T (k) represents the value of the cumulative function of the platform histogram corresponding to the gray value k, F T (255) represents the value of the cumulative function of the platform histogram corresponding to the grayscale value 255; R T (k) values ​​are processed at equal intervals, because R T (k)≥R T (k-1), calculate R when k ranges from 0 to 255 T The sorting of (k) values ​​is O(k), where O(0) = 0. The calculation formula of O(k) is: In the formula, R T (k) represents the gray value after platform histogram equalization corresponding to gray value k, R T (k-1) represents the gray value after platform histogram equalization corresponding to gray value k-1, O(k-1) represents the gray value R after platform histogram equalization corresponding to gray value k-1 T Sorting of (k-1) values; Calculate the mapping relationship f(k) between the grayscale value after equalization of the equally spaced platform histogram and the original grayscale value. The specific calculation formula is expressed as: According to the mapping relationship f(k) of each block, the original image is converted into a new image, that is, an image of local equidistant platform histogram equalization is obtained; Step 3.2, perform Laplace sharpening on the image obtained by local equidistant platform histogram equalization to obtain a preprocessed infrared image.

4. The method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames according to claim 1, characterized in that: In step 4, the first branch of the AngleConv module is connected in series with a Conv module to obtain a feature map I1, the second branch is first connected in series with a Conv module that converts the number of channels to one quarter, and then four oblique convolution modules with angles of θ1, θ2, θ3, and θ4 are connected in parallel to obtain feature maps I2, I3, I4, and I5. Then, the output I1 of the first branch and the output I2, I3, I4, and I5 of the second branch are used as inputs, and after the Concat operation, a Conv module that reduces the number of channels by half is connected in series to obtain the output feature map of the AngleConv module; the oblique convolution module specifically performs the following operations: first, the feature map is padded with zeros so that the width and height of the feature map are equal to the diagonal length of the feature map before zero padding; secondly, the feature map is rotated by an angle -θ j' , j'=1,2,3,4, and then connect a channel-by-channel convolution layer in series, and then rotate the output feature map by angle θ j' , and then remove the elements at the zero-filled positions around to restore the feature map to its original width and height, and obtain the output feature map of the oblique convolution module.

5. The method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames according to claim 1, characterized in that: In step 4, the improved CBAM attention module specifically performs the following operations: in its spatial attention module, the output features of its channel attention module are grouped into groups of 128 channels, the maximum value and average value of each group are calculated in the channel dimension, and then a convolution layer with an output channel number of 1 is connected in series and multiplied with the output of the channel attention module after passing through a Sigmoid function to obtain the output of the spatial attention module, and then multiplied with the input of the CBAM attention module through a Sigmoid function to obtain the output feature map of the improved CBAM attention module.

6. The method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames according to claim 1, characterized in that: In step 4, the adaptive feature fusion module specifically performs the following operations: taking two input feature maps as input, after the Concat operation, and then serially connecting the Conv module with an output channel number of 2, then applying the Softmax function in the channel dimension, taking the two values ​​of each spatial position as the sum weights of the two input features of the spatial position, and performing weighted summation to obtain the output feature map, which is expressed as: O=W[0]⊙I′1+W[1]⊙I′2 W=Soft max(Conv(Concat(I′1,I′2))) Where I′1 and I′2 represent two input feature maps, O represents the output feature map after adaptive feature fusion, W is the weight tensor of the two channels, W[0] is the weight matrix of the first channel of W, W[1] is the weight matrix of the second channel of W, ⊙ represents the dot product operation, Concat represents the Concat operation in the channel dimension, Conv represents the Conv module, and Softmax represents the Softmax operation in the channel dimension.

7. The method for detecting lightning arresters of power transmission lines based on infrared images and rotating target frames according to claim 1, characterized in that: In step 4, when training the arrester detection network, the loss L for angle prediction training is θ The calculation formula is: Where, t i is the label value of the i-th angle category, p i is the predicted value of the i-th angle category, Sigmoid represents the Sigmoid function, t i The specific calculation formula is: n0(i)=argmin n (|u+180×ni|), the value range of n is an integer Where u is the angle category corresponding to the real rotation target frame, and its value range is 0, 1, 2, ..., 179. σ represents the standard deviation of the normal distribution of the angle label, and takes an appropriate value. n0(i) represents the value of n that minimizes |u+180×ni|. The loss L for confidence prediction training obj The calculation formula is: L obj =-(y′log(Sigmoid(p))+(1-y′)log(1-Sigmoid(p))) In the formula, p rbox is the predicted rotated target box, t rbox is the real rotating target frame, Inter(p rbox ,t rbox ) represents the intersection area of ​​two rotated target boxes, Union(p rbox ,t rbox ) represents the union area of ​​two rotated target boxes, p is the confidence prediction value, y′ is the confidence label value, and Sigmoid represents the Sigmoid function; Use the improved CIoU to calculate the position of the rotated target box and the prediction loss of the long and short edges. The improved CIoU calculation formula is: Where x, y, l, and s are the predicted target center abscissa, target center ordinate, target long side length, and target short side length, respectively. b represents a horizontal rectangular box with x, y, l, and s as the center position abscissa, center position ordinate, width, and height, respectively. b gt It represents a horizontal rectangular box with the true values ​​of x, y, l, and s as the horizontal coordinate of the center position, the vertical coordinate of the center position, the width, and the height. gt ) represents b and b gt The Euclidean distance between the center points of b and b gt The intersection-and-union ratio of c means that it can contain both b and b gt The diagonal length of the minimum horizontal rectangular frame, l gt and gt They represent the true value of the target long side length and the true value of the short side length, v, α, is an intermediate variable.

Citation Information

Patent Citations

  • Rotating target detection method based on YOLOv5

    CN113326734A

  • Rapid curved lane line detection method based on oblique convolution

    CN116630926A

  • Method for object detection and recognition based on neural network

    US20220292311A1

Cited By

  • Power transmission line monitoring method and device based on machine vision

    CN119941719A

  • System and method for detecting rotating target in remote sensing image

    CN120032221A