High-resolution Image Equalizing Ring Defect Recognition Method Based on Cascade Rotation Detection
Through the cascade rotation detection method, combined with the horizontal and rotary target detection network, the problem of difficult to obtain the direction information of the equalization ring and insulator in high-resolution aerial images is solved, and higher detection accuracy and speed are achieved, which is suitable for the identification of equalization ring defects in power inspection.
Patent Information
- Application Number
- CN202310301973.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2043-03-24
AI Technical Summary
The prior art is difficult to accurately detect the direction information of the equalization ring and insulator in high-resolution aerial images, resulting in low detection accuracy of the equalization ring defect, high training difficulty, and slow prediction speed. It is difficult for traditional methods to accurately judge the equalization ring tilt defect at different shooting angles.
The cascading rotation detection method is adopted to perform coarse positioning through the first stage horizontal target detection network and the second stage rotary target detection network for precise positioning. Combined with the improved rotary RetinaNet network and data enhancement technology, the detection accuracy and speed are improved.
It realizes accurate detection of the rotation angle of the pressure equalization ring in high-resolution images at different shooting angles, improves the accuracy and speed of the pressure equalization ring defect detection, reduces the difficulty of training, and enhances the convenience and accuracy of drone inspection.
Smart Images

Figure CN116309500B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision and automatic defect recognition of power equipment, and in particular to a high-resolution image grading ring defect recognition method based on cascade rotation detection. Background Art
[0002] Insulators are crucial electrical components, providing support and insulation in power transmission lines. Due to their unique structural design, stray capacitance exists between them and objects such as transmission lines, leading to uneven voltage distribution across the insulator. This phenomenon intensifies with the increasing number of insulator segments, leading to insulator breakdown and other failures. This necessitates the addition of grading rings to insulators. However, due to their prolonged exposure to the field, grading rings are susceptible to damage and defects, seriously impacting the safe operation of the power system. Therefore, defect detection in grading rings is a crucial component of power system inspections.
[0003] With the continuous development of my country's power industry in recent years, power inspections have become a daunting task. Traditional manual inspections are not only inefficient but also inconvenient due to the high placement of grading rings. With the increasing popularity of drone-based power inspection technology, the current standard method is to use drones to capture images of the grading rings and manually inspect them to determine if they are defective. However, due to the large amount of data collected by aerial photography, this method is not only time-consuming, but also, due to factors such as the shooting angle, the human eye often has significant errors in determining whether the grading ring is tilted.
[0004] With the continuous development of deep learning-based computer vision, many studies have used it to perform automatic defect detection on grading rings, such as using target detection methods based on Faster R-CNN and instance segmentation methods based on Mask R-CNN. However, due to the variable angles of drone aerial images, it is difficult to determine the orientation of insulators and grading rings using traditional horizontal rectangular boxes, while instance segmentation methods have high labeling costs and require a large number of predicted points, which can easily lead to offsets. In addition, since drone aerial images are usually high-resolution images, scaling them during network training can easily cause image distortion and affect detection accuracy. Not scaling them requires a large amount of video memory, which places high demands on the performance of the machine used for network training. It also slows down the prediction speed when predicting grading rings.
[0005] In summary, while deep learning-based methods for detecting grading ring defects currently exist, they struggle to accurately determine the orientation of the grading ring and insulator due to the varying angles of aerial images. Furthermore, the accuracy of detecting tilted grading ring defects needs to be improved. Training and detection speed for high-resolution aerial images also need to be improved. Therefore, a new high-resolution image-based grading ring defect recognition method is urgently needed to address these issues. Summary of the Invention
[0006] The purpose of the present invention is to solve the problems of difficulty in obtaining directional information of grading rings and insulators in high-resolution aerial images, low accuracy in grading ring defect detection, high difficulty in training, and slow prediction speed. A high-resolution image grading ring defect recognition method based on cascade rotation detection is proposed. It can more accurately detect the rotation angle of the grading ring in aerial images taken at different shooting angles, improve the accuracy of grading ring defect detection, and also reduce the difficulty of training high-resolution images and increase the detection speed, thereby cooperating with drone inspections to improve the convenience and accuracy of grading ring power inspections.
[0007] To achieve the above-mentioned purpose, the present invention provides a technical solution: a high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection, comprising the following steps:
[0008] 1) Select a high-resolution drone-photographed image of the grading ring; use a labeling tool to mark a horizontal rectangular box roughly locating the grading ring and composite insulator as a whole; further use the labeling tool to mark the four vertices of the minimum circumscribed rotated rectangle of the grading ring and composite insulator respectively;
[0009] 2) Perform data augmentation on the annotated images to build a dataset and improve the detection accuracy of target objects at different rotation angles and scales;
[0010] 3) The dataset is fed into the first-stage horizontal object detection network for training. The network uses horizontal rectangular boxes to roughly locate the overall position of the grading ring and insulator in the high-resolution image.
[0011] 4) Using the coarse positioning results, the image is cropped and fed into the second-stage rotating object detection network as a rotation detection dataset for training. The network uses a rotating rectangular box to accurately locate the insulator and grading ring.
[0012] 5) Calculate the long side center axis of the rotated rectangular frame of the insulator and the grading ring respectively, and use them as the direction of both for grading ring tilt defect judgment;
[0013] 6) The pressure equalizing ring is divided into two situations: side view and top view. In the side view, the pressure equalizing ring is rectangular and does not need to be corrected in direction. In the top view, the pressure equalizing ring is elliptical and the pressure equalizing ring major axis detection algorithm needs to be used to calculate the major axis straight line equation of the pressure equalizing ring as the corrected pressure equalizing ring direction.
[0014] 7) The defects of the equalizing ring are divided into three categories: falling off, defective and tilting; for falling off defects, whether the equalizing ring has fallen off is determined by judging whether the equalizing ring is detected near the end point of the insulator; for defective defects, the equation of the equalizing ring fitting ellipse is calculated, and the pixel conditions of each point of the fitting ellipse equation on the equalizing ring threshold segmentation image are judged. When a large number of pixels are lost, it is judged as a defective equalizing ring; for tilt defects, the difference between the rotation angle of the insulator and the corrected equalizing ring is used to judge whether the equalizing ring has a tilt defect; finally, the equalizing ring defect recognition result is output.
[0015] Furthermore, in step 1), the labelme annotation tool is used to mark the circumscribed horizontal rectangular frame of the grading ring and the insulator as a whole, and the four vertex coordinates of the minimum circumscribed rotated rectangle of the grading ring and the insulator are further marked in the rectangular frame.
[0016] Furthermore, in step 2), data enhancement uses random rotation, scaling, and brightness adjustment. When the image is randomly rotated and scaled, the vertex coordinates of the minimum circumscribed rotation rectangle of the insulator and the grading ring in the label are also transformed accordingly, thereby enriching the number of targets of different angles and scales in the image and improving the generalization of the network for image detection in different shooting conditions.
[0017] Furthermore, in step 3), in order to speed up the detection of high-resolution large-scale images and alleviate the pixel distortion problem caused by image scaling, the first-stage horizontal target detection network is responsible for quickly locating the approximate positions of insulators and grading rings from the image; it adopts the fast detection speed of the YOLOv7 network, simplifies the network structure parameters through convolution reparameterization, and makes the network detection speed reach a high level. At the same time, the recall rate of the network is improved through joint learning of the guiding head and the auxiliary head, which meets the needs of coarse positioning.
[0018] Furthermore, in step 4), the image is cropped using a coarsely positioned horizontal rectangular frame. Since the original image is a high-resolution and large-scale image, the scale of the cropped image is moderate, which can speed up the training and detection speed of the second-stage rotation target detection network. The second-stage rotation target detection network adopts an improved rotation RetinaNet network, which modifies the positioning parameters of the rectangular frame on the basis of the horizontal RetinaNet network, adds a rectangular frame rotation angle θ, and uses five parameters (x, y, w, h, θ) to determine the position of the rotated rectangular frame, where x represents the horizontal coordinate of the center point of the rotated rectangular frame, y represents the vertical coordinate of the center point of the rotated rectangular frame, w represents the width of the rotated rectangular frame, h represents the height of the rotated rectangular frame, and θ represents the rotation angle of the rotated rectangular frame.
[0019] The rotation angle θ is defined as the angle between the long side of the rotated rectangle and the horizontal axis. Counterclockwise rotation angles are negative, and clockwise rotation angles are positive. Since insulators are mostly in a vertical position in aerial images, the angle range is defined as [-π / 4, 3π / 4) to avoid the angle of the rotated rectangle being at the angle definition boundary, which would increase the difficulty of regression.
[0020] To address the difficulty of angle boundary regression caused by the large aspect ratio of insulators and improve the accuracy of angle prediction, the rotation angle θ is trained using the CSL classification method instead of the conventional regression method. The entire angle range is divided into one-degree intervals, and the CSL value corresponding to each rotation angle is calculated using the following formula:
[0021]
[0022] Where k is the independent variable, θ is the rotation angle of the bounding box, r is the window size, l(k) is the window function, and Gaussian function is used;
[0023] During training, the loss function includes the regression loss of the four parameters of the prediction box (x, y, w, h), the classification loss of the prediction box rotation angle θ, and the classification loss of the object category label. The calculation formula is as follows:
[0024]
[0025] Where, L total is the total loss, λ i is the weight parameter, i=1~3, M is the number of positive samples, m represents the current sample, v' m is the position vector of the mth anchor, v m is the corresponding real box position vector, θ' m is the rotation angle of the mth anchor, θ m is the corresponding real frame rotation angle, p m is the predicted label, t m is the true label, L θ_cls and L cls They are angle classification loss and label classification loss, both using Focal Loss, L reg is the regression loss;
[0026] In order to further improve the positioning accuracy of the rotated rectangle, the regression loss L is modified reg DIoU Loss is calculated as follows:
[0027]
[0028] Where P represents the predicted box, G represents the real box, d is the Euclidean distance between the center points of the predicted box and the real box, and c is the diagonal distance of the minimum circumscribed rectangle of the union of the predicted box and the real box;
[0029] In order to make the network more suitable for the detection of objects with large aspect ratios such as insulators, the K-Means algorithm is used to cluster the aspect ratios of the insulators in the image. According to the clustering results, the aspect ratios of the anchors generated by the network are modified to 1 / 16, 1 / 8, 1 / 2, 1, 2, 8, and 16.
[0030] Furthermore, in step 5), the trained YOLOv7 network and the improved rotating RetinaNet network are cascaded. When detecting aerial images, the high-resolution image is first passed through the YOLOv7 network to quickly locate the approximate positions of the insulators and the grading rings in the image. The aerial image is intercepted using the positioning result, and the intercepted image is sent to the improved rotating RetinaNet network to accurately locate the insulators and the grading rings therein, obtaining a rotated rectangular frame of the insulator and the grading ring. The rotation angle of the rotated rectangular frame is θ, and the coordinates of the center point of the rotated rectangular frame are (x, y). The equation for the long side central axis of the rotated rectangular frame is calculated as follows:
[0031] y'=-tanθ·x'+tanθ·x+y (4)
[0032] Where y' represents the vertical coordinate of the point on the central axis, and x' represents the horizontal coordinate of the point on the central axis.
[0033] Further, in step 6), whether the pressure equalizing ring is in a side view is determined by judging whether the aspect ratio of the rotated rectangular frame of the pressure equalizing ring is greater than a preset threshold. When it is in a side view, the pressure equalizing ring is in a rectangular parallelepiped shape, and the aspect ratio of the rotated rectangular frame is greater than the preset threshold. At this time, the rotation angle of the rotated rectangular frame is directly used as the long axis direction of the pressure equalizing ring without correction;
[0034] When the aspect ratio of the rotated rectangular frame of the pressure equalizing ring is less than the preset threshold, it is a top-down situation and the pressure equalizing ring is elliptical. It is necessary to use the pressure equalizing ring major axis detection algorithm to further calculate the major axis direction of the pressure equalizing ring, including the following steps:
[0035] 6.1) Use the rotated rectangle of the pressure equalizing ring to crop the pressure equalizing ring image, and use contrast-constrained adaptive histogram equalization (CLAHE) to equalize the contrast of the pressure equalizing ring image to reduce the threshold segmentation errors caused by the brightness and shadows of the shooting;
[0036] 6.2) Use the OTSU threshold segmentation algorithm to segment the pressure equalizing ring. Since the background interference in the cropped pressure equalizing ring image is small, the OTSU threshold segmentation result is accurate;
[0037] 6.3) Use the center point of the rotating rectangular frame of the pressure equalizing ring as the center coordinate of the pressure equalizing ring. Automatically search for the equation of the pressure equalizing ring's long axis within the range [-180°, 180°] at 1° intervals. The equation of the straight line of the pressure equalizing ring's long axis is calculated as follows:
[0038] y l = -tan(θ+Δθ)·x l +tan(θ+Δθ)·x c +y c (5)
[0039] Where y l Indicates the vertical coordinate of the point on the long axis of the pressure equalizing ring, x l The horizontal coordinate of the point on the long axis of the pressure equalizing ring; x c and y c They represent the horizontal and vertical coordinates of the center point of the pressure equalizing ring, θ represents the rotation angle of the rotating rectangular frame, and Δθ∈[-180°,180°] represents the angle change;
[0040] The specific process of automatic search is as follows: taking the rotation angle of the rotating rectangular frame of the pressure equalizing ring as the initial position, Δθ is continuously increased at intervals of 1°, and the distance between the intersection of the long axis straight line and the binary image of the pressure equalizing ring after threshold segmentation is calculated. The value of Δθ when the intersection distance is the largest is selected, and the equation of the long axis of the pressure equalizing ring at this time is calculated, with θ+Δθ as the direction of the long axis of the pressure equalizing ring.
[0041] Furthermore, in step 7), the coordinates of the two end points of the insulator are calculated using the position (x, y, w, h, θ) of the rotated rectangular frame of the insulator. The calculation formula is as follows:
[0042]
[0043] Where, P u and P d are the coordinates of the two end points of the insulator;
[0044] Whether the grading ring is detached is determined by judging whether there is a grading ring detected near the two end points of the insulator. If one end point is close to the edge of the picture, it means that the grading ring was not captured during the photo shooting, and the grading ring detachment defect is not determined at this time.
[0045] Furthermore, in step 7), for the side-viewed pressure equalizing ring, the image after the pressure equalizing ring threshold segmentation is divided into two blocks using the central axis of the short side of the pressure equalizing ring, and the number of pixels in each of the two blocks is counted. When the difference in the number of pixels between the two blocks is greater than a preset threshold, it is determined that a defect exists;
[0046] For the pressure equalizing ring viewed from above, since its shape is elliptical in the image, the equation of the short axis line of the pressure equalizing ring is calculated using the coordinates (x, y) of the center point of the rotating rectangular frame of the pressure equalizing ring and the equation of the long axis line:
[0047]
[0048] Where y s and x s are the ordinate and abscissa of the point on the short axis line of the equalizing ring respectively;
[0049] Calculate the intersection of the short axis of the pressure equalizing ring and the image after the pressure equalizing ring threshold segmentation, and calculate the distance between the intersection and the center point of the pressure equalizing ring as the short axis length of the pressure equalizing ring. From this, the fitting ellipse equation of the pressure equalizing ring can be obtained:
[0050]
[0051] Where x e and y e are the horizontal and vertical coordinates of the point on the fitted ellipse, a' is the length of the semi-major axis of the ellipse, and b' is the length of the semi-minor axis of the ellipse;
[0052] The image after threshold segmentation of the pressure equalizing ring is rotated by the rotation angle θ so that the long axis of the pressure equalizing ring is in the horizontal direction. The values of the pixels on the fitted ellipse in the threshold segmentation image are counted. If a large number of pixel values are 0, it is judged as a pressure equalizing ring defect.
[0053] Furthermore, in step 7), the obtained rotation angle of the insulator and the corrected rotation angle of the grading ring are used to determine whether the grading ring has a tilt defect using the following formula:
[0054]
[0055] Where θ I is the rotation angle of the insulator, θ G is the rotation angle of the pressure equalizing ring.
[0056] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0057] 1. The present invention adopts a cascade network method to use the first-stage horizontal target detection network to roughly locate the positions of the grading ring and the insulator, and then uses the rough positioning results for precise detection, which can reduce the training difficulty of high-resolution images and improve the detection speed. In addition, since the grading ring and the insulator are positioned as a whole in the first stage, the detection recall rate of small-scale targets can be improved.
[0058] 2. This invention uses a rotating rectangular frame to inspect insulators and grading rings, providing more accurate directional information. The improved rotating RetinaNet network makes it more suitable for insulator and grading ring inspection, enabling more accurate detection of rotation angles of insulators and grading rings, and improving the accuracy of identifying grading ring tilt defects.
[0059] 3. This invention proposes a long-axis detection algorithm for the pressure equalizing ring in a top-down image. This algorithm can further improve the accuracy of the pressure equalizing ring's orientation, thereby increasing the accuracy of identifying pressure equalizing ring tilt defects. Compared to some existing methods, this algorithm can more accurately determine the pressure equalizing ring's orientation at different shooting angles.
[0060] 4. The present invention can simultaneously detect the more common defects of the pressure equalizing ring, such as tilting, falling off and missing. Compared with some current methods, the defect detection of the pressure equalizing ring is more comprehensive. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a brief flow chart of the present invention.
[0062] Figure 2 Detailed flow chart of the present invention.
[0063] Figure 3 Figure 1 is a comparison diagram of the image to be tested and the image of the result after the test in an embodiment. In the figure, (a) is an aerial image of the grading ring to be tested, and (b) is an enlarged image of the result after the test using the present invention. The insulator and the grading ring are both framed by a rotating rectangular frame, and the central axis of the two is marked by a black straight line as their respective directions, θ d is the angle between the insulator and the grading ring, and |90°-θ d The size of | can be used to determine the tilt defect of the equalizing ring. DETAILED DESCRIPTION
[0064] The present invention will be described in further detail below with reference to the embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0065] like Figure 1 and Figure 2 As shown, this embodiment provides a high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection, which includes the following steps:
[0066] 1) High-resolution drone-generated aerial images were collated, and typical images with grading rings were selected to form a dataset. The dataset was annotated using the labelme annotation tool. A horizontal rectangular box was used to enclose the insulator and grading ring as a whole for training the first-stage horizontal object detection network. The four vertices of the minimum circumscribed rotated rectangle of the insulator and grading ring were also annotated for training the second-stage rotational object detection network. Both annotations were stored in the same label file.
[0067] 2) Data augmentation is performed on the labeled images. This data augmentation uses random rotation, random scaling, and random brightness adjustment to simulate the varying shooting angles, distances, and brightness of drones, thereby improving the network's robustness to detection in various shooting conditions. Random rotation and scaling not only rotates and scales the image, but also changes the position of the points in the label file.
[0068] 3) The dataset is fed into the first-stage horizontal object detection network for training. This training utilizes only the labels for the horizontal rectangular boxes of the grading rings and insulators. The first-stage horizontal object detection network utilizes the YOLOv7 network, which has a relatively fast detection speed. Using this network to coarsely locate the insulators and grading rings in high-resolution images can accelerate detection of high-resolution images. Aerial images must be scaled to a fixed scale before being fed into the network. Because coarse positioning detects the grading rings and insulators as a whole, this approach results in larger-scale targets, making detection more convenient than detecting them separately.
[0069] 4) Use the horizontal rectangular frame roughly positioned by the first-stage horizontal target detection network to crop the image, transform the coordinates of the minimum circumscribed rotated rectangle of the insulator and the equalizing ring in the label into the coordinates of the corresponding points in the cropped image, and send the cropped image and the transformed label file into a new data set to the second-stage rotating target detection network for training. The second-stage rotating target detection network is responsible for accurately locating the insulator and the equalizing ring in the image using the rotating rectangular frame. Build the second-stage rotating target detection network. The second-stage rotating target detection network adopts the improved rotating RetinaNet network, which uses the RetinaNet network as the basic structure. During positioning, the original four parameters (x, y, w, h) are modified to five parameters (x, y, w, h, θ), so that the horizontal rectangular frame becomes a rotated rectangular frame. x represents the horizontal coordinate of the center point of the rotating rectangular frame, y represents the vertical coordinate of the center point of the rotating rectangular frame, w represents the width of the rotating rectangular frame, h represents the height of the rotating rectangular frame, and θ represents the rotation angle of the rotating rectangular frame;
[0070] θ is defined as the angle between the rotated rectangle and the horizontal axis, with counterclockwise rotations considered negative and clockwise rotations positive. The conventional angle range is [-π / 2, π / 2). However, since many insulators are vertical in aerial images, using the conventional angle range can cause the rotated rectangle of the insulator to cross boundaries near π / 2, leading to large variations in training loss and affecting network convergence. Therefore, the angle range of θ was modified to [-π / 4, 3π / 4].
[0071] To further address the difficulty of regression at the angle boundary caused by the large aspect ratio of the insulator and improve the angle prediction accuracy of the rotated rectangle, the rotation angle θ is trained using the CSL classification method. The entire angle range is divided into intervals of one degree, and the CSL value corresponding to each rotation angle is calculated using the following formula:
[0072]
[0073] Where k is the independent variable, θ is the rotation angle of the bounding box, r is the window size, and l(k) is the window function, which uses a Gaussian function.
[0074] By converting the rotation angle into the corresponding label value, we can better measure the difference between the two angles when they are at the angle definition boundary, and avoid sudden changes in the loss function when the rotation angle crosses the angle boundary. During training, the loss function includes the regression loss of the four parameters (x, y, w, h) of the prediction box, the classification loss of the rotation angle θ of the prediction box, and the classification loss of the object category label. Its calculation formula is as follows:
[0075]
[0076] Where, L total is the total loss, λ i is the weight parameter, i=1~3, M is the number of positive samples, m represents the current sample, v' m is the position vector of the mth anchor, v m is the corresponding real box position vector, θ' m is the rotation angle of the mth anchor, θ m is the corresponding real frame rotation angle, p m is the predicted label, t m is the true label, L θ_cls and L cls They are angle classification loss and label classification loss, both using Focal Loss, L reg is the regression loss;
[0077] In order to further improve the positioning accuracy of the rotated rectangle, the regression loss L regThe original Smooth L1Loss is modified to DIoU Loss, and its calculation formula is as follows:
[0078]
[0079] Where P represents the predicted box, G represents the real box, d is the Euclidean distance between the center points of the predicted box and the real box, and c is the diagonal distance of the minimum circumscribed rectangle of the union of the predicted box and the real box;
[0080] By introducing IoU into the loss function and regressing the four parameters (x, y, w, h) as a whole, the convergence speed and positioning accuracy can be improved.
[0081] In order to make the network more suitable for detecting objects with large aspect ratios such as insulators, the K-Means algorithm is used to cluster the aspect ratios of insulators in the image. According to the clustering results, the aspect ratios of the anchors generated by the network are modified to 1 / 16, 1 / 8, 1 / 2, 1, 2, 8, and 16.
[0082] 5) Cascade the trained YOLOv7 network and the improved rotating RetinaNet network. When detecting aerial images, the high-resolution image is first passed through the YOLOv7 network to quickly locate the approximate positions of the insulators and grading rings in the image. The aerial image is captured using the positioning results, and the captured image is sent to the improved rotating RetinaNet network to accurately locate the insulators and grading rings, obtaining a rotated rectangular frame of the insulators and grading rings. The rotation angle θ of the rotating rectangular frame and the coordinates (x, y) of the center point of the rotating rectangular frame are used to calculate the equation of the long side of the rotating rectangular frame as the direction of the insulator and grading ring. The calculation formula of the axis equation is as follows:
[0083] y'=-tanθ·x'+tanθ·x+y (4)
[0084] Where y' represents the vertical coordinate of the point on the central axis, and x' represents the horizontal coordinate of the point on the central axis.
[0085] 6) Determine whether the pressure equalizing ring in the aerial image is in a side view or a top view according to the aspect ratio of the rotating rectangular frame of the pressure equalizing ring. When the pressure equalizing ring is in a side view, it is rectangular in the aerial image, and the difference between width and height is large. When the pressure equalizing ring is in a top view, it is elliptical in the aerial image, and the difference between width and height is small. For the pressure equalizing ring in a top view, since it is elliptical, it is necessary to use the major axis detection algorithm to further calculate the precise position of its major axis. The specific steps of the major axis detection algorithm are as follows:
[0086] 6.1) The pressure equalizing ring image is cropped using its rotated rectangular frame and contrast-constrained adaptive histogram equalization (CLAHE) is used to equalize the contrast of the pressure equalizing ring image to prevent the pressure equalizing ring from being misidentified as background during subsequent threshold segmentation due to uneven brightness and shadows.
[0087] 6.2) Use the OTSU threshold segmentation method to perform threshold segmentation on the pressure equalizing ring image to remove background interference and obtain a binary image after pressure equalizing ring segmentation. Since the background interference is less in the cropped pressure equalizing ring image, the OTSU threshold segmentation result is more accurate.
[0088] 6.3) Use the center point of the rotating rectangular frame of the pressure equalizing ring as the center coordinate of the pressure equalizing ring. Automatically search for the equation of the pressure equalizing ring's long axis within the range [-180°, 180°] at 1° intervals. The equation of the straight line of the pressure equalizing ring's long axis is calculated as follows:
[0089] y l = -tan(θ+Δθ)·x l +tan(θ+Δθ)·x c +y c (5)
[0090] Where y l Indicates the vertical coordinate of the point on the long axis of the pressure equalizing ring, x l The horizontal coordinate of the point on the long axis of the pressure equalizing ring; x c and y c They represent the horizontal and vertical coordinates of the center point of the pressure equalizing ring, θ represents the rotation angle of the rotating rectangular frame, and Δθ∈[-180°,180°] represents the angle change;
[0091] During automatic search, the rotation angle θ of the rotating rectangular frame of the equalizing ring is used as the initial rotation angle, and Δθ is continuously increased at intervals of 1°. After each increase, a new straight line equation is calculated, and the intersection of the straight line and the threshold segmentation result of the equalizing ring is calculated. The distance between the two intersection points is calculated, and Δθ with the maximum distance is selected. The straight line equation at this time is calculated as the equation of the long axis of the equalizing ring, and θ+Δθ is used as the direction of the long axis of the equalizing ring.
[0092] 7) The defects of the grading ring are divided into three categories: falling off, missing and tilting. For the falling off defect, the coordinates of the two end points of the insulator are calculated using the position (x, y, w, h, θ) of the insulator's rotation prediction frame:
[0093]
[0094] Where, P u and P d are the coordinates of the two end points of the insulator;
[0095] Determine whether there is a rotating rectangular frame of the equalizing ring near the two end points of the insulator to determine whether the equalizing ring has fallen off. If the insulator end point is too close to the edge of the aerial image, it means that the equalizing ring was not captured during the shooting. In this case, the equalizing ring falling off defect is not determined.
[0096] For the side-view equalizing ring, the binary image after threshold segmentation of the equalizing ring is divided into two blocks along the central axis of the short side using the rotating rectangular frame of the equalizing ring. The pixel values in the two blocks are counted respectively. When the difference between the two pixel values exceeds the preset threshold, it is judged as a defect in the equalizing ring.
[0097] For the pressure equalizing ring, it appears elliptical in the image when viewed from above. The equation of the short axis line of the pressure equalizing ring is calculated using the coordinates (x, y) of the center point of the rotating rectangular frame of the pressure equalizing ring and the equation of the long axis line:
[0098]
[0099] Where y s and x s are the ordinate and abscissa of the point on the short axis line of the equalizing ring respectively;
[0100] The distance between the intersection of the short axis of the pressure equalizing ring and the image after threshold segmentation of the pressure equalizing ring and the center point of the pressure equalizing ring is calculated as the short axis length of the pressure equalizing ring. From this, the fitting ellipse equation of the pressure equalizing ring can be obtained:
[0101]
[0102] Where x e and y e are the horizontal and vertical coordinates of the point on the fitted ellipse, a' is the length of the semi-major axis of the ellipse, and b' is the length of the semi-minor axis of the ellipse.
[0103] The image after the pressure equalizing ring threshold segmentation is rotated using the rotation angle θ of the rotating rectangular frame until the long axis of the pressure equalizing ring is horizontal. The pixel values of each point on the fitted ellipse in the image are counted. If a large number of pixel values are 0, it indicates that the pressure equalizing ring has a defect.
[0104] For the tilt defect of the grading ring, use the rotation angle between the insulator and the grading ring obtained in steps 5) and 6) to determine whether the grading ring has a tilt defect using the following formula:
[0105]
[0106] Where θ I is the rotation angle of the insulator, θ G is the rotation angle of the equalizing ring, such as Figure 3 As shown, the angle between the insulator and the grading ring is set to θ d , the above formula is to judge |90°-θ d| is used to determine whether the grading ring has a tilt defect. In the original image, a rotating rectangular frame is used to locate the positions of the grading ring and the insulator. The central axis of the rotating rectangular frame is calculated as the direction of the two. The angle between the central axes is used to determine whether the grading ring has a tilt defect.
[0107] Finally, the pressure equalizing ring defect identification results are output.
[0108] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered as equivalent replacement methods and are included in the scope of protection of the present invention.
Claims
1. A high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection is characterized by: The following steps are involved: 1) Select a high-resolution drone-photographed image of the grading ring; use a labeling tool to mark a horizontal rectangular box roughly locating the grading ring and composite insulator as a whole; further use the labeling tool to mark the four vertices of the minimum circumscribed rotated rectangle of the grading ring and composite insulator respectively; 2) Perform data augmentation on the annotated images to build a dataset and improve the detection accuracy of target objects at different rotation angles and scales; 3) The dataset is fed into the first-stage horizontal object detection network for training. The network uses horizontal rectangular boxes to roughly locate the overall position of the grading ring and insulator in the high-resolution image. 4) Using the coarse positioning results, the image is cropped and fed into the second-stage rotating object detection network as a rotation detection dataset for training. The network uses a rotating rectangular box to accurately locate the insulator and grading ring. 5) Calculate the long side center axis of the rotated rectangular frame of the insulator and the grading ring respectively, and use them as the direction of both for grading ring tilt defect judgment; 6) The pressure equalizing ring is divided into two situations: side view and top view. In the side view, the pressure equalizing ring is rectangular and does not need to be corrected in direction. In the top view, the pressure equalizing ring is elliptical and the pressure equalizing ring major axis detection algorithm needs to be used to calculate the major axis straight line equation of the pressure equalizing ring as the corrected pressure equalizing ring direction. 7) The defects of the equalizing ring are divided into three categories: falling off, defective and tilting; for falling off defects, whether the equalizing ring has fallen off is determined by judging whether the equalizing ring is detected near the end point of the insulator; for defective defects, the equation of the equalizing ring fitting ellipse is calculated, and the pixel conditions of each point of the fitting ellipse equation on the equalizing ring threshold segmentation image are judged. When a large number of pixels are lost, it is judged as a defective equalizing ring; for tilt defects, the difference between the rotation angle of the insulator and the corrected equalizing ring is used to judge whether the equalizing ring has a tilt defect; finally, the equalizing ring defect recognition result is output.
2. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 1 is characterized in that: In step 1), the labelme annotation tool is used to mark the circumscribed horizontal rectangular frame of the grading ring and the insulator as a whole, and the four vertex coordinates of the minimum circumscribed rotated rectangle of the grading ring and the insulator are further marked in the rectangular frame.
3. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 2 is characterized in that: In step 2), data enhancement uses random rotation, scaling, and brightness adjustment. When the image is randomly rotated and scaled, the vertex coordinates of the minimum circumscribed rotation rectangle of the insulator and grading ring in the label are also transformed accordingly, thereby enriching the number of targets of different angles and scales in the image and improving the network's generalization of image detection in different shooting conditions.
4. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 3 is characterized in that: In step 3), to speed up the detection of high-resolution, large-scale images and alleviate pixel distortion caused by image scaling, the first-stage horizontal object detection network is responsible for quickly locating the approximate positions of insulators and grading rings in the image. It uses the fast-detection YOLOv7 network and simplifies the network structure parameters through convolutional reparameterization, so that the network's detection speed reaches a high level. At the same time, the joint learning of the guidance head and the auxiliary head improves the network's recall rate, meeting the needs of coarse positioning.
5. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 4 is characterized in that: In step 4), the image is cropped using a coarsely positioned horizontal rectangular frame. Since the original image is a high-resolution and large-scale image, the cropped image has a moderate scale, which can speed up the training and detection speed of the second-stage rotation object detection network. The second stage of the rotation target detection network uses an improved rotation RetinaNet network. Based on the horizontal RetinaNet network, the positioning parameters of the rectangular box are modified, and the rectangular box rotation angle θ is added. The position of the rotating rectangular box is determined by five parameters (x, y, w, h, θ). x represents the horizontal coordinate of the center point of the rotating rectangular box, y represents the vertical coordinate of the center point of the rotating rectangular box, w represents the width of the rotating rectangular box, h represents the height of the rotating rectangular box, and θ represents the rotation angle of the rotating rectangular box. The rotation angle θ is defined as the angle between the long side of the rotated rectangle and the horizontal axis. Counterclockwise rotation angles are negative, and clockwise rotation angles are positive. Since insulators are mostly in a vertical position in aerial images, the angle range is defined as [-π / 4, 3π / 4) to avoid the angle of the rotated rectangle being at the angle definition boundary, which would increase the difficulty of regression. To address the difficulty of angle boundary regression caused by the large aspect ratio of insulators and improve the accuracy of angle prediction, the rotation angle θ is trained using the CSL classification method instead of the conventional regression method. The entire angle range is divided into one-degree intervals, and the CSL value corresponding to each rotation angle is calculated using the following formula: Where k is the independent variable, θ is the rotation angle of the bounding box, r is the window size, l(k) is the window function, and Gaussian function is used; During training, the loss function includes the regression loss of the four parameters of the prediction box (x, y, w, h), the classification loss of the prediction box rotation angle θ, and the classification loss of the object category label. The calculation formula is as follows: Where, L total is the total loss, λ i is the weight parameter, i=1~3, M is the number of positive samples, m represents the current sample, v' m is the position vector of the mth anchor, v m is the corresponding real box position vector, θ' m is the rotation angle of the mth anchor, θ m is the corresponding real-world frame rotation angle, p m is the predicted label, t m is the true label, L θ_cls and L cls They are angle classification loss and label classification loss, both using Focal Loss, L reg is the regression loss; In order to further improve the positioning accuracy of the rotated rectangle, the regression loss L is modified reg DIoU Loss is calculated as follows: Where P represents the predicted box, G represents the real box, d is the Euclidean distance between the center points of the predicted box and the real box, and c is the diagonal distance of the minimum circumscribed rectangle of the union of the predicted box and the real box; In order to make the network more suitable for the detection of objects with large aspect ratios such as insulators, the K-Means algorithm is used to cluster the aspect ratios of the insulators in the image. According to the clustering results, the aspect ratios of the anchors generated by the network are modified to 1 / 16, 1 / 8, 1 / 2, 1, 2, 8, and 16.
6. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 5 is characterized in that: In step 5), the trained YOLOv7 network and the improved rotating RetinaNet network are cascaded. When detecting aerial images, the high-resolution image is first passed through the YOLOv7 network to quickly locate the approximate positions of the insulators and grading rings in the image. The aerial image is intercepted using the positioning result, and the intercepted image is sent to the improved rotating RetinaNet network to accurately locate the insulators and grading rings therein, obtaining a rotated rectangular frame of the insulator and the grading ring. The rotation angle of the rotated rectangular frame is θ, and the coordinates of the center point of the rotated rectangular frame are (x, y). The equation for the long side central axis of the rotated rectangular frame is calculated as follows: y'=-tanθ·x'+tanθ·x+y (4) Where y' represents the vertical coordinate of the point on the central axis, and x' represents the horizontal coordinate of the point on the central axis.
7. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 6 is characterized in that: In step 6), whether the pressure equalizing ring is in a side view is determined by judging whether the aspect ratio of the rotating rectangular frame of the pressure equalizing ring is greater than a preset threshold. When it belongs to the side view, the pressure equalizing ring is in a rectangular shape, and the aspect ratio of the rotating rectangular frame is greater than the preset threshold. At this time, the rotation angle of the rotating rectangular frame is directly used as the long axis direction of the pressure equalizing ring without correction; When the aspect ratio of the rotated rectangular frame of the pressure equalizing ring is less than the preset threshold, it is a top-down situation and the pressure equalizing ring is elliptical. It is necessary to use the pressure equalizing ring major axis detection algorithm to further calculate the major axis direction of the pressure equalizing ring, including the following steps: 6.1) Use the rotated rectangle of the pressure equalizing ring to crop the pressure equalizing ring image, and use contrast-constrained adaptive histogram equalization (CLAHE) to equalize the contrast of the pressure equalizing ring image to reduce the threshold segmentation errors caused by the brightness and shadows of the shooting; 6.2) Use the OTSU threshold segmentation algorithm to segment the pressure equalizing ring. Since the background interference in the cropped pressure equalizing ring image is small, the OTSU threshold segmentation result is accurate; 6.3) Use the center point of the rotating rectangular frame of the pressure equalizing ring as the center coordinate of the pressure equalizing ring. Automatically search for the equation of the pressure equalizing ring's long axis within the range [-180°, 180°] at 1° intervals. The equation of the straight line of the pressure equalizing ring's long axis is calculated as follows: y l =-tan(θ+Δθ)·x l +tan(θ+Δθ)·x c +y c (5) Where y l Indicates the vertical coordinate of the point on the long axis of the pressure equalizing ring, x l The horizontal coordinate of the point on the long axis of the pressure equalizing ring; x c and y c They represent the horizontal and vertical coordinates of the center point of the pressure equalizing ring, θ represents the rotation angle of the rotating rectangular frame, and Δθ∈[-180°,180°] represents the angle change; The specific process of automatic search is as follows: taking the rotation angle of the rotating rectangular frame of the pressure equalizing ring as the initial position, Δθ is continuously increased at intervals of 1°, and the distance between the intersection of the long axis straight line and the binary image of the pressure equalizing ring after threshold segmentation is calculated. The value of Δθ when the intersection distance is the largest is selected, and the equation of the long axis of the pressure equalizing ring at this time is calculated, with θ+Δθ as the direction of the long axis of the pressure equalizing ring.
8. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 7 is characterized in that: In step 7), the coordinates of the two end points of the insulator are calculated using the position (x, y, w, h, θ) of the rotated rectangular frame of the insulator. The calculation formula is as follows: Where, P u and P d are the coordinates of the two end points of the insulator; Whether the grading ring is detached is determined by judging whether there is a grading ring detected near the two end points of the insulator. If one end point is close to the edge of the picture, it means that the grading ring was not captured during the photo shooting, and the grading ring detachment defect is not determined at this time.
9. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 8 is characterized in that: In step 7), for the side-view pressure equalizing ring, the image after the pressure equalizing ring threshold segmentation is divided into two blocks along the central axis of the short side of the pressure equalizing ring, and the number of pixels in each block is counted. When the difference in the number of pixels between the two blocks is greater than a preset threshold, it is determined that a defect exists; For the pressure equalizing ring viewed from above, since its shape is elliptical in the image, the equation of the short axis line of the pressure equalizing ring is calculated using the coordinates (x, y) of the center point of the rotating rectangular frame of the pressure equalizing ring and the equation of the long axis line: Where y s and x s are the ordinate and abscissa of the point on the short axis line of the equalizing ring respectively; Calculate the intersection of the short axis of the pressure equalizing ring and the image after the pressure equalizing ring threshold segmentation, and calculate the distance between the intersection and the center point of the pressure equalizing ring as the short axis length of the pressure equalizing ring. From this, the fitting ellipse equation of the pressure equalizing ring can be obtained: Where x e and y e are the horizontal and vertical coordinates of the point on the fitted ellipse, a' is the length of the semi-major axis of the ellipse, and b' is the length of the semi-minor axis of the ellipse; The image after threshold segmentation of the pressure equalizing ring is rotated by the rotation angle θ so that the long axis of the pressure equalizing ring is in the horizontal direction. The values of the pixels on the fitted ellipse in the threshold segmentation image are counted. If a large number of pixel values are 0, it is judged as a pressure equalizing ring defect.
10. The high-resolution image pressure equalizing ring defect recognition method based on cascade rotation detection according to claim 9 is characterized in that: In step 7), the obtained rotation angle of the insulator and the corrected rotation angle of the grading ring are used to determine whether the grading ring has a tilt defect using the following formula: Where θ I is the rotation angle of the insulator, θ G is the rotation angle of the pressure equalizing ring.
Citation Information
Patent Citations
Insulator detecting and positioning method based on rotating frame recognition network
CN114299354A
Composite insulator overheating defect detection method based on rotary RetinaNet
CN115115590A