A method and system for detecting defects of insulators of power transmission lines
Patent Information
- Application Number
- CN202611496285.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-24
- Publication Date
- 2026-10-30
AI Technical Summary
1.本发明通过对具有显式层级关系的标注后数据集采用多类环境退化算子组合进行增强,并利用包含支撑模块、层级约束任务对齐标签分配、层级包含一致性正则损失及层级感知软权重评分后处理的神经网络进行训练和检测,能够提高模型对复杂成像条件及小尺度缺陷的适应能力,利用层级关系约束缺陷候选与预测结果,减少复杂背景导致的误检,并提高缺陷定位稳定性及检测召回能力。
Smart Images

Figure CN123015546A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of defect detection, and more specifically, it relates to a method and system for detecting defects in insulators of power transmission lines. Background Technology
[0002] Insulators are critical components of transmission lines, and their defects (such as pollution flashover and breakage) can lead to line tripping or even large-scale power outages. Traditional inspection methods rely on manual labor or rule-based algorithms, which often lack robustness under complex backgrounds, changing perspectives, degraded lighting, and scale variations. With the development of drone / robot inspection and visual perception technologies, deep learning-based target detection methods have become an important direction for the automatic identification of insulators and defects.
[0003] In terms of detection modes, two-stage detectors (such as Faster R-CNN) have strong localization accuracy but large inference overhead, which is not conducive to real-time deployment at the edge; single-stage detectors (such as SSD, YOLO series, FCOS, etc.) achieve a better trade-off between speed and accuracy, and are therefore more suitable for engineering inspection scenarios.
[0004] However, insulator defect detection still faces common challenges: First, there is the interference of small defects and strong background. The defect box size is much smaller than the whole image, and it often coexists with similar textured structures such as conductors and tower materials, resulting in high false positives. In addition, the distribution of categories and scenes is unbalanced: defect samples are scarce, environmental degradation is diverse (haze, overexposure, noise and occlusion, etc.), and training is prone to overfitting. Second, the hierarchical structure information is not fully utilized: in a large number of insulator defect annotations, the defect target is almost always located in the "insulator string" region. If this "part-of" relationship is ignored, the sample allocation will be inconsistent with the training target, resulting in false positives outside the string or false negatives within the string. Summary of the Invention
[0005] In view of the problems in related technologies, this invention proposes a method and system for detecting defects in transmission line insulators, so as to overcome the above-mentioned technical problems existing in the existing related technologies.
[0006] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution: This invention relates to a method for detecting defects in insulators of power transmission lines, comprising: Obtain the dataset and annotate it with quintuples that have an explicit hierarchical relationship to obtain the annotated dataset; The labeled dataset is augmented by a combination of several augmentation strategies consisting of multiple types of environmental degradation operators to obtain an augmented dataset. The labeled dataset and the augmented dataset together constitute the training set; Construct a neural network that incorporates key mechanisms; The key mechanisms include a support module, hierarchical constraint task alignment label allocation, hierarchical consistency regularization loss, and hierarchical-aware soft weight scoring post-processing. The support module includes P 2. Detection head, prior branch for soft boundary regions, and small target-friendly NWD regression loss; The neural network is trained and tested using a training set, and then the trained and tested neural network is used to detect defects in insulators of transmission lines.
[0007] By enhancing labeled datasets with explicit hierarchical relationships using a combination of multiple environmental degradation operators, and training and detecting using a neural network that includes support modules, hierarchical constraint task alignment label assignment, hierarchical inclusion consistency regularization loss, and hierarchical-aware soft-weight scoring post-processing, the model's adaptability to complex imaging conditions and small-scale defects can be improved. By using hierarchical relationships to constrain defect candidates and prediction results, false detections caused by complex backgrounds can be reduced, and the stability of defect localization and detection recall can be improved.
[0008] The four components—support module, hierarchical constraint task alignment label allocation, hierarchical inclusion consistency regularization loss, and hierarchical-aware soft-weight scoring post-processing—collaborate in stages around the same hierarchical prior: "the defect should be located within the parent insulator string region." The support module first improves the visibility, region focus, and regression stability of small defect candidates through P2, soft boundary priors, and SO-NWD. HC-TAL filters candidates using parent boxes during the label allocation stage to reduce false positive samples outside the string. HCR-Loss continues to penalize geometric out-of-bounds defects during the training stage. HSR performs soft downscore reduction on out-of-string predictions during the inference stage. This forms a closed loop of "candidate generation—sample allocation—training regularization—inference correction." The P2 detection head, the soft boundary region prior branch, and the small target-friendly NWD regression loss address different aspects of small defect detection in sequence: the P2 detection head provides denser candidate locations with high-resolution features; the soft boundary region prior branch enhances the effective region response and suppresses background activation by utilizing the parent insulator string frame; and SO-NWD provides a more stable regression measure for small frame displacement for positive defect samples. P2 improves visibility, the prior branch improves accurate region identification, and SO-NWD improves frame stability; together, they provide high-quality candidates for subsequent hierarchical constraints.
[0009] Preferably, the dataset includes images of transmission line insulators and defect targets; the data in the dataset is labeled to obtain a labeled dataset; The annotation uses the YOLO format, and each target is represented as a 5-tuple, as follows: ; in, For category numbering, c =0 indicates flashover. c =1 indicates damage. c =2 represents an insulator string; Normalized coordinates of the center point of the bounding box. To normalize the width and height; YOLO format is a per-object text annotation format: each image corresponds to a label file, and each line describes an object, usually written as... , , , , , They are usually located in [0,1]; where For category numbering, , These are the normalized coordinates of the bounding box center point relative to the image width and height. , These are the normalized values of the bounding box width and height relative to the image width and height, and are usually located in [0,1].
[0010] The quintuple form has an explicit hierarchical relationship: any defect subclass target is usually located in space inside or in the neighborhood of a target frame of an insulator string.
[0011] Preferably, the labeled dataset is copied to obtain a copied dataset; data augmentation is performed on the copied dataset to obtain an augmented dataset; The augmented dataset and the labeled dataset together constitute the training set; The data augmentation strategies include: The copied dataset is divided into three levels according to the priority of scarcity defects, and different amplification ratios and enhancement intensities are set. Data augmentation is achieved using the Albumentations library, and six types of environmental degradation operators are designed to cover the complex imaging conditions in actual inspections. The six types of environmental degradation operators are as follows: The first type is the simulation of overexposure caused by snow reflection; Category 2: Haze and image transmission degradation; The third type is interference from shadows and backlighting; Category 4: Sensor noise; Category 5: Strong occlusion; The sixth category is amplitude-controlled geometric transformations; Among them, the overexposure caused by snow reflection is simulated by using nonlinear tone curves, reducing saturation, and Gamma transformation to form bright or white areas, and CLAHE can be used to compensate for local contrast; haze and image transmission degradation are simulated by grayscale conversion, reducing contrast, JPEG compression artifacts, and Gaussian blur; shadow and backlight interference are simulated by random shadows and light spots to form local dark areas or strong light interference, and CLAHE can be superimposed; sensor noise is simulated by superimposing Gaussian noise to simulate imaging device and transmission noise; strong occlusion is constructed by random rectangular block occlusion to create local information loss and difficult negative samples; amplitude-controlled geometric transformations are performed by horizontal flipping and small-range translation, scaling, and rotation, with synchronous updating of bounding boxes to simulate attitude and viewpoint changes and avoid destroying defect textures.
[0012] Three combinations of enhancement strategies are constructed based on the six types of environmental degradation operators, as follows: The enhancement operators, parameter ranges, and template / random combinations for different tiers are detailed below: Tier 1: Five deterministic templates are used, namely Snow Glare + horizontal flip, Haze + translation, scaling and rotation, Shadow SunFlare + CLAHE, Sensor Noise and Snow Glare + Haze, without introducing strong occlusion to protect the damaged texture. Tier 2: Four deterministic templates are used: Snow Glare with CLAHE, Haze + CLAHE, ShadowSunFlare + CLAHE, and Sensor Noise, which also avoid strong occlusion. Tier 3: Several types of environmental degradation operators are randomly selected each time and sequentially concatenated, and strong occlusion of Coarse Dropout is superimposed with a probability of 0.9. In this context, Tier 1, Tier 2, and Tier 3 represent the combinations of enhancement strategies 1, 2, and 3, respectively; Snow Glare represents the simulation of overexposure caused by snow reflection, corresponding to the first type of environmental degradation operator; Haze represents haze and image transmission degradation, corresponding to the second type of environmental degradation operator; Shadow SunFlare represents shadow and backlight interference, corresponding to the third type of environmental degradation operator; CLAHE represents contrast-limited adaptive histogram equalization, which is an auxiliary processing used for local contrast compensation and does not constitute one of the six categories alone; Sensor Noise represents sensor noise, corresponding to the fourth type of environmental degradation operator; Snow Glare+Haze represents the sequential combination of the first and second types of operators; Snow Glare with CLAHE represents first simulating the brightness or overexposure caused by snow reflection, and then using CLAHE for local contrast-limited compensation; Coarse Dropout represents coarse-grained random block occlusion, corresponding to the fifth type of environmental degradation operator; Horizontal flip and Haze + translation, scaling, and rotation correspond to the sixth type of environmental degradation operator.
[0013] Preferably, given an input image , The formula for predicting a set of bounding boxes and class labels in an object detection task is as follows: ; in, , These represent the input images respectively. The pixel height and pixel width; The 3 in the image indicates a three-channel image; Indicates the number of candidates; , , Let x and y represent the normalized center point of the i-th predicted bounding box, respectively. , These represent the normalized width and normalized height of the i-th predicted bounding box, respectively. Indicates category, 0 indicates flashover, 1 indicates damage, and 2 indicates an insulator string; Indicates the confidence level. ; The truth set is constructed as follows: ; when At that time, define the truth box for the defect. The corresponding parent target is If there are multiple parent targets, the selection is based on the inclusion relationship and area criterion; if there is no matching parent target, the defective sample is degraded to the normal allocation strategy to maintain recall. in, This represents the j-th truth bounding box. This indicates the category number of the truth box. This represents a set of defect categories, in this scheme These correspond to flashover and damage, respectively. This indicates the total number of ground truth objects in the current image; Define the truth box for this defect. The corresponding parent target is The specific steps include: Select insulator string frames of category c=2 from the truth set to form a parent target candidate set; For the current defect truth box Calculate the center point; Filter the parent frames that contain the center point; If there is only one, it will be matched directly; if there are multiple, it will be selected according to the principle of the smallest area. If no parent box is matched, no hierarchy filtering is applied, and the default task alignment allocation strategy is used.
[0014] The specific steps for selection based on inclusion relationships and area criteria include: First, determine if the center point of the defect box is inside the candidate parent box; only retain parent boxes that satisfy the containment relationship; when there is more than one parent box that meets the condition, calculate the area of each parent box. Choose the one with the smallest area as This is to avoid assigning defects to structural frames with too broad a scope.
[0015] The conventional allocation strategy refers to the original task alignment label allocation in YOLOv8: without using parent target hierarchy constraints, it selects candidate points that fall into the defect truth box based on... Calculate the task alignment score; select the top-k candidates with the highest scores as positive samples, where k is the preset number of positive samples. Indicates the first i The candidate point and the first j Task alignment scores between truth objectives Indicates the first i The candidate point belongs to the first j The predicted probability of each true target category. Indicates the first i The predicted bounding box obtained by regression of candidate points Represents the prediction box With truth box The intersection and union ratio, , These represent the weight indices for the category item and the positioning item, respectively. i Indicates the candidate point index. j Indicates the true value target index.
[0016] Specifically, prediction set Describes the N candidate boxes, categories, and confidence scores generated by the neural network from the input image; the truth set. Describe the M manually labeled bounding boxes and their categories in the image. During training, use the ground truth set... For supervision, predicted candidates are mapped to ground truth targets through label assignment, and classification, regression, and hierarchical losses are calculated; during inference, the output is the predicted set. Truth sets are no longer used; Preferably, the neural network uses YOLOv8 as a baseline and introduces key mechanisms, including a support module, hierarchical constraint task alignment label allocation, and hierarchical consistency regularization loss and hierarchical-aware soft weight scoring post-processing. The support module includes P 2. Detection head, prior branch for soft boundary regions, and small target-friendly NWD regression loss; The above design forms a progressively deeper closed loop: P 2. SBP-Branch improves visibility, HC-TAL improves learnability, SO-NWD improves regressibility, HCR-Loss strengthens structural consistency, and HSR controls out-of-line risks on the deployment side; additionally, YOLOv8's multi-scale detection head is typically located in { P 3, P 4, P 5) Predicting the target at the feature layer. For targets with very small pixel scales, such as insulator defects, continuous downsampling can dilute the target response in deeper features. To improve the spatial resolution of small targets, this invention introduces higher resolution features into the feature pyramid. P Two layers, see structural comparison. Figure 5 To make the detection head cover { P 2, P 3, P 4, P 5}, thus providing denser candidate locations and finer-grained localization gradients for defects; it is important to emphasize that, P The detection layer is a commonly used enhancement for small target detection. Its role is to provide a more reliable candidate basis for subsequent hierarchical constraints (HC-TAL, HCR-Loss / HSR). When the feature resolution is insufficient, the low quality of the candidates will weaken the stability of the structural prior.
[0017] Among them, P4 and P5 are feature layers of different scales in the feature pyramid: P4 is usually a feature layer downsampled by 16 times relative to the input image, focusing on medium-scale targets; P5 is usually a feature layer downsampled by 32 times, focusing on large-scale targets.
[0018] Preferably, the prior branch of the soft boundary region includes: A lightweight prior branch is added next to the multi-scale detector head consisting of P2, P3, P4, and P5, and a soft mask is generated from the parent target ground truth box. G For monitoring purposes, output a single-channel prior map. P ; The detection head refers to the multi-scale detection head composed of P2, P3, P4, and P5 and its shared feature side. The soft boundary region prior branch is set next to the detection head and is led out from the neck / detection feature as an auxiliary supervision branch.
[0019] It employs a soft boundary design, which includes: within the parent target bounding box, a distance from the boundary not less than the width of a buffer band. In the central region, the soft mask supervision value is set to 1; in the region less than [missing value] from the boundary Within the buffer area, the supervision value increases linearly from 0 to 1 according to the normalized distance from the pixel to the boundary of the parent target box; the supervision value outside the parent target box is set to 0.
[0020] The loss of the prior branch is a weighted sum of BCE and Dice, and the loss formula is as follows: ; in: ; ; In the formula, , All dimensions are from prior art. This represents the loss of the prior branch. For Dice weights; To prevent smoothing constants with a denominator of 0, SBP-Branch only provides auxiliary supervision and does not change the output of the main detection branch; This represents the binary cross-entropy loss between the predicted single-channel prior map P and the supervised soft mask G. This represents the Dice overlap loss between P and G. This represents the supervision value of the soft mask G at the u-th row and v-th column pixel. This represents the predicted probability of the prior branch output P at the same pixel position; The small-objective friendly NWD regression loss includes: A normalized Wasserstein distance regression term is introduced only for positive samples of the defect class, and a prediction box is constructed based on the distance regression term. With truth box The formula for the second-order Wasserstein distance is as follows: ; in: ; In the formula, Represents the prediction box With truth box The squared second-order Wasserstein distance between the corresponding Gaussian distributions , These represent the mean vectors (i.e., the center of the boxes) of the predicted and ground truth boxes, respectively. The square of the Euclidean norm of a vector. Denotes the squared Frobenius norm of a matrix. , Let these represent the positive definite square roots of the covariance matrices of the predicted bounding box and the true bounding box, respectively. , , These represent the x and y coordinates of the center point of the true defect box, respectively. , These represent the width and height of the truth defect box, respectively. This represents the mean. ; Describing covariance, , These represent the standard deviations of the two-dimensional Gaussian distribution corresponding to the truth box in the horizontal and vertical directions, respectively. (This scheme...) , ; The distance in the second-order Wasserstein distance formula is normalized and converted into a loss form as follows: ; in, This represents the regression loss value corresponding to the normalized Wasserstein distance. , represents the arithmetic square root of the squared second-order Wasserstein distance between the predicted bounding box and the true bounding box. This is a scale hyperparameter; in the implementation of this invention, SO-NWD only applies to the defect class (class_id=0 / 1), and uses... Control its overall weight, The overall weighting coefficient representing the SO-NWD loss is used to control the contribution of this additional regression term to the total regression loss.
[0021] Considering that smaller defects are more difficult to regress, this invention introduces an inverse area weighting for defect samples, as follows: ; in, Indicates inverse area weighting. This represents a truncation function used to truncate... Limited to the range Inside, This represents a small positive number added to the denominator of the area fraction, used to prevent division by zero and numerical instability when A=0 or the area is too small; This represents the true area of the defect frame. This is a normalization constant (which can be the within-batch mean). Inverse area weighting The upper bound; The final SO-NWD loss is as follows: ; Wherein, SO-NWD represents the small-objective-friendly NWD regression loss. This represents the final SO-NWD loss; The mean of positive samples in the defect class is calculated. (This is part of the implementation of the invention.) Cut off to This is to avoid unstable gradients caused by extremely small bounding boxes.
[0022] While high-resolution detection layers help capture small targets, the model is still prone to false detections in complex backgrounds outside the insulator region. To address this, this invention utilizes the bounding boxes of the parent insulator string to construct prior supervision, guiding the neural network to focus on feature learning in the insulator region. In addition, after completing the label assignment for structural constraints, the problem of unstable regression of small defect boxes still needs to be addressed. IoU-type losses are highly sensitive to small boundary offsets in small box scenarios, easily causing gradient jitter. To improve the stability of small defect localization, this invention only introduces a normalized Wasserstein distance regression term for positive defect samples.
[0023] Preferably, the hierarchical constraint task alignment label allocation is used to suppress out-of-string false detections caused by incorrect sample allocation; The hierarchical constraint task alignment label assignment includes parent matching, fault tolerance expansion, candidate filtering, and task alignment scoring and positive sample selection; The parent target matching is used to filter the candidate set, limiting the selection of positive samples to the insulator string region, thereby reducing false positive samples and training noise outside the string from the source; for each satisfying truth boxes ,in For the set of defect categories, select its parent box from the set of parent target truth values. When there are multiple parent targets, the parent box with the smallest area that contains the defect center point is selected first to avoid misassigning the defect to a larger range of structural boxes; if no matching parent box can be found, the defect sample will maintain the default assignment strategy. The fault-tolerant expansion is used to slightly expand both the defect box and the parent box, including: Define the expansion operator The expression is as follows: ; in: ; ; In the formula, Representation box, , , Representing boxes The horizontal and vertical coordinates in the top left corner , Representing boxes The horizontal and vertical coordinates of the bottom right corner; Indicates external proportion, Indicates the minimum pixel expansion. , , , Representing boxes Width and height; This invention employs a preset expansion ratio in the expansion of the parent frame. and in P 2-layer minimum outward pixel setting To avoid the small frame from degenerating outwards; The candidate point filtering process only retains the set of candidate points that simultaneously fall within both the outer defect box and the outer parent box region, as expressed below: ; In the formula, This represents the filtered candidate set. Indicates candidate points, This indicates a logical AND operation, meaning that a candidate point must simultaneously satisfy two conditions: falling into both the outer defect box and the outer parent box. Indicates the first A defective truth box The truth box of the matched parent insulator string; The default allocation strategy is the original task alignment label allocation of YOLOv8: without applying parent target level constraints, the task alignment score is calculated from the candidate points that fall into the defect truth box, and the top-k candidates with the highest scores are selected as positive samples.
[0024] Furthermore, geometric constraints based on the vertical projection of the parent frame are introduced to further eliminate background points below the parent frame and suppress the interference of the background region on defect learning. Specifically, it includes: Let the outer parent frame be Define its allowable range in the vertical direction as ; for candidate points After filtering the intersection of the defect box and its parent box, then make a judgment. Does it exceed the bottom boundary of the parent frame? If the candidate point is not found, delete it; otherwise, keep it. To allow for pixel tolerance, it can be 0 or the same as the minimum outward pixel; The task alignment scoring and positive sample selection include: In the filtered candidate set Within this framework, the task alignment score is still used to select the top-k positive samples, as shown in the following formula: ; in, Candidate points Category The predicted probability; Candidate points The predicted bounding box obtained from regression; , These are the hyperparameters that balance the contributions of classification and localization; top-k indicates selecting the top-scoring hyperparameters. One candidate is used as a positive sample. Indicate candidate points With the Alignment score for each truth box This represents the intersection-union ratio (IoU) between the predicted bounding boxes and the true bounding boxes. Indicates the first A true bounding box.
[0025] Preferably, although HC-TAL has reduced out-of-string pseudo-positive samples during the label assignment stage, the model may still produce out-of-bounds predictions in the early stages of training or in complex contexts. To explicitly reinforce the structural prior that "the defect box should be contained by the parent target box", this invention introduces Hierarchical Containment Regularization Loss (HCR-Loss), which only applies to positive samples that are "defect class and have a matching parent box".
[0026] The hierarchy includes consistency regularization loss, including: Let the defect prediction box be Parent target truth bounding box Based on the defect prediction box and the parent target truth bounding box, four out-of-bounds quantities are defined: ; ; ; ; in, , , , These represent the coordinates of the left, top, right, and bottom boundaries of the defect prediction box, respectively. , , , These represent the coordinates of the left, top, right, and bottom boundaries of the defect prediction box, respectively. , , , These represent the amount of the defect prediction box exceeding the left, top, right, and bottom boundaries of its parent box, respectively. when Completely located When the boundary is within the range, the out-of-bounds amount should be non-positive (or close to 0); when an out-of-bounds event occurs, the corresponding term is positive; the Softplus function is used to apply a smoothing penalty to the out-of-bounds amount to obtain the single-sample coverage loss; the purpose of applying the smoothing penalty to the out-of-bounds amount is to obtain a smooth gradient and avoid training instability caused by hard truncation; The Softplus function can be viewed as a smooth approximation of max(0,z) or ReLU: when z is negative, the output is close to 0; when z is a large positive number, it grows approximately linearly and is differentiable everywhere. Therefore, it can both penalize positive out-of-bounds quantities and avoid gradient discontinuity caused by hard truncation.
[0027] The Softplus function and the single-sample inclusion loss are as follows: ; ; Introducing a quality gating factor into HCR-Loss The regularization intensity is attenuated based on the target quality score (e.g., target score) output during the label allocation phase. The attenuation expression is as follows: ; In the formula, The level of a single positive sample contains the Hierarchical Containment Regularization Loss; HCR-Loss stands for "Hierarchical Containment Regularization Loss" in Chinese and "Hierarchical Containment Regularization Loss" in English; it is used to penalize the case where the defect prediction box goes beyond the matching parent insulator string box. The purpose of attenuating the regularization intensity is to avoid negative transfer of training due to mismatched parent boxes, and the weights of HCR-Loss use a secondary ramp that gradually increases with each training epoch to avoid excessive early prediction noise leading to training instability, including: Let the total number of rounds be , ramp The start and end rounds are , The maximum weight is ,but: ; in, For the current round, This indicates the training epoch where the HCR-Loss weights begin to increase. This indicates the training epoch where weight growth has ended and reached its maximum value. Indicates the maximum weight of HCR-Loss; For HCR-Loss, the epoch-adaptive weights are defined by the ramp function, which can be translated as "incremental weight scheduling" or "ramp-like incremental function." This means that the weights in HCR-Loss are not maximized at the start of training, but rather gradually increased during training. to The increments between rounds follow a quadratic function to reduce the interference of early training noise on the model; this invention employs a quadratic ramp and... .
[0028] Preferably, the hierarchical perceptual soft-weight scoring post-processing includes: For each defect box, check whether its center point falls within the outer region of any predicted parent target box. If not, perform confidence scaling instead of deletion. The step of checking whether its center point falls within the outer region of any predicted parent target box includes: Suppose the set of parent targets for prediction is as follows: ; in, The confidence threshold for the parent target. Indicates the first The bounding box of the predicted parent target (insulator string), Indicates the first The category number of each prediction box, Indicates the first The confidence level of each predicted bounding box; satisfying =2 and ≥ The predicted bounding box is included in the parent target set; Predicting each defect Take its center point ,like Then execute ; in, , , They represent the first i The x and y coordinates of the center point of each defect prediction box Pixel-level outward expansion boundary (for fault tolerance). This is the reduction coefficient; the present invention implements the taking , Pixels When a parent bounding box is not predicted for an image, the HSR does not perform any processing to protect recall. During inspection, "out-of-serial high-confidence defects" usually indicate false alarms; however, if the out-of-serial defect box is directly deleted, real defects may be mistakenly detected when the parent target is missed. To balance false alarm suppression and recall protection, this invention introduces hierarchical-aware soft-weighted scoring post-processing (HSR) after non-maximum suppression (NMS).
[0029] Preferably, the total loss function of the neural network during the training phase is constructed based on the supporting modules, hierarchical constraint task alignment label allocation, and hierarchical consistency regularization loss; the hierarchical perceptual soft weight scoring post-processing (HSR) is only executed during the inference phase and after NMS, and does not participate in the training loss calculation. The total loss function during the training phase is as follows: ; in, Represents the total loss function. The detection loss for YOLOv8 (including classification and regression / distribution terms). , All are hyperparameters; The HCR-Loss epoch-adaptive weights are used. During the inference phase, HSR does not change the training structure, but only affects the confidence correction after NMS, so as to achieve structural consistency risk control on the deployment side.
[0030] The present invention also discloses a detection system for insulator defects in transmission lines, including a data annotation module, a data augmentation module, a neural network training module, and an insulator defect detection module; The data annotation module is used to acquire datasets and annotate them with quintuples that have explicit hierarchical relationships. The data augmentation module is used to augment the labeled dataset by employing a combination of several augmentation strategies consisting of multiple types of environmental degradation operators; The neural network training module constructs a neural network incorporating key mechanisms and trains and tests the neural network using a training set. The insulator defect detection module is used to detect insulator defects in transmission lines through a trained and tested neural network.
[0031] The present invention has the following beneficial effects: 1. This invention enhances labeled datasets with explicit hierarchical relationships by combining multiple environmental degradation operators, and utilizes a neural network that includes support modules, hierarchical constraint task alignment label allocation, hierarchical consistency regularization loss, and hierarchical-aware soft-weight scoring post-processing for training and detection. This improves the model's adaptability to complex imaging conditions and small-scale defects, utilizes hierarchical relationships to constrain defect candidates and prediction results, reduces false detections caused by complex backgrounds, and improves defect localization stability and detection recall.
[0032] 2. In this invention, a combination mechanism for selecting, controlling intensity, and calling in layers of six types of degradation operators for power transmission line inspection scenarios is used as a technical solution. This design can cover high-frequency degradation modes such as overexposure, haze, backlight, noise, occlusion, and small geometric disturbances, and improve the robustness of the model to actual inspection domain offset.
[0033] 3. In this invention, by introducing a parent insulator string target, an effective search area is provided for defect candidates, reducing false detections caused by conductors, tower materials, and complex backgrounds; it provides a unified geometric constraint basis for subsequent HC-TAL, HCR-Loss, and HSR, enabling the training and inference phases to work collaboratively around the same structural prior; in addition, it can improve the localization stability and recall capability of small defects such as flashover and damage.
[0034] 4. The present invention adopts a hierarchical labeling of “insulator string parent class + flashover / damage defect subclass” because the defect target does not exist in isolation, but is naturally attached to the insulator string region. After introducing the parent class box, it can provide spatial constraints for sample allocation and region prior during the training phase, and provide a basis for suppressing false alarms outside the string during the inference phase, thereby reducing the number of false positive samples in complex backgrounds and improving the stability of small defect localization.
[0035] 5. This invention uses a hierarchical classification based on "scarcity defect priority," rather than image source, weather type, or uniform random proportions. This has the advantage of prioritizing enhancement resources for defect categories with scarcer samples, more fragile textures, and higher susceptibility to false detections, thereby mitigating both class imbalance and excessive perturbation of defect textures. If a uniform enhancement principle is adopted, normal samples will be further expanded, making it easier for the model to learn the background and parent class targets, while neglecting truly scarce small defects.
[0036] 6. By forming a closed-loop mechanism of "high-resolution candidate generation - parent region prior - hierarchical constraint allocation - small target friendly regression - geometric inclusion regularization - deployment-side soft score reduction", this invention can improve the detection capability of small defects, reduce false alarms with high confidence outside the serial line, enhance the stability of localization, and maintain lightweight deployment capability with a small parameter scale.
[0037] 7. The reason for constructing prior supervision using the parent insulator string bounding box in this invention is that the effective search space for defect targets is significantly smaller than the entire image. Without introducing region priors, the model is prone to misidentifying background textures such as conductors, tower materials, and shadows as defects. By generating a soft mask from the parent bounding box and using soft boundary buffers, the response of the insulator region can be enhanced without hard pruning the candidate space, while tolerating annotation bias and instance deformation. This improves the candidate quality within the parent string's neighborhood and reduces false activations outside the insulator region.
[0038] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of the invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of the overall framework of the HCL-YOLOv8 invention; Figure 2 This is an example diagram of the insulator defect dataset of the present invention; Figure 3 This is a schematic diagram of the offline data augmentation construction process of the present invention; Figure 4 This is a visualization diagram comparing the effects of the enhanced operator of the present invention, wherein (a) is the original image, (b) is the image after simulation of overexposure caused by snow reflection, (c) is the image after degradation due to haze and image transmission, (d) is the image after interference from shadows and backlight, (e) is the image after adding sensor noise, and (f) is the image after degradation due to haze and image transmission. Figure 5 This is a comparison diagram of the characteristic pyramid structure of the P2 detection layer of the present invention; Figure 6 This is a schematic diagram of the sample distribution statistics of the dataset of this invention; Figure 7 This is a schematic diagram of the training process curve of the present invention; Figure 8 This is a schematic diagram of the PR curve of the present invention; Figure 9 This is the F1-Confidence curve of the present invention; Figure 10 The image shows the detection effect of the improved algorithm of this invention. Detailed Implementation
[0041] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0042] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0043] Example 1 Insulators are critical components of transmission lines, and their defects (such as pollution flashover and breakage) can lead to line tripping or even large-scale power outages. Traditional inspection methods rely on manual labor or rule-based algorithms, which often lack robustness under complex backgrounds, changing perspectives, degraded lighting, and scale variations. With the development of drone / robot inspection and visual perception technologies, deep learning-based target detection methods have become an important direction for the automatic identification of insulators and defects.
[0044] In terms of detection modes, two-stage detectors (such as Faster R-CNN) have strong localization accuracy but large inference overhead, which is not conducive to real-time deployment at the edge; single-stage detectors (such as SSD, YOLO series, FCOS, etc.) achieve a better trade-off between speed and accuracy, and are therefore more suitable for engineering inspection scenarios.
[0045] However, insulator defect detection still faces three common challenges: (1) Small defects and strong background interference: The defect box is much smaller than the whole image and often coexists with similar textures such as wires and tower materials, resulting in a high false detection rate.
[0046] (2) Uneven distribution of categories and scenarios: defect samples are scarce and environmental degradation is diverse (smog, overexposure, noise and occlusion, etc.), making training prone to overfitting.
[0047] (3) Hierarchical structure information is not fully utilized: In a large number of insulator defect annotations, the defect target is almost always located in the "insulator string" area; if this "part-of" relationship is ignored, the sample allocation will be inconsistent with the training target, resulting in false alarms outside the string or missed detections inside the string.
[0048] To address the aforementioned issues, this invention proposes the HCL-YOLOv8 detection framework based on the core idea of "learnable prior hierarchical structure," and verifies its effectiveness on public datasets.
[0049] Early insulator detection methods relied heavily on edge, texture, and morphological rules or traditional classifiers, which lacked generalization ability in complex scenarios. In recent years, research has increasingly shifted towards deep learning: for example, frameworks such as Faster R-CNN, SSD, and CenterNet have been used for insulator or defect detection in power transmission line inspections, achieving good results, but still have shortcomings in real-time performance or robustness to small targets. Driven by the YOLO series, numerous studies have improved insulator defect detection performance by modifying backbone neural networks, feature fusion, or loss functions. For instance, Zheng et al. proposed an improved YOLOv7 insulator defect detection algorithm in Sensors, and provided strategies for constructing and enhancing public datasets, offering a reproducible experimental foundation for subsequent research. Furthermore, in industrial and power line inspection scenarios, existing work has improved YOLOv5, YOLOv8, and YOLOv7 models from directions such as lightweighting, attention mechanisms, improved NMS, and complex background suppression.
[0050] Single-stage detection started with end-to-end regression in YOLOv1, and has undergone multi-scale prediction in YOLOv3 and engineering enhancements in YOLOv4, YOLOX, and YOLOv7, continuously optimizing the trade-off between accuracy and speed.
[0051] On the other hand, feature pyramid structures such as FPN, PANet, and BiFPN / EfficientDet are widely used to improve the feature representation of multi-scale targets, especially small targets. However, small target detection is often limited by problems such as loss of detail caused by downsampling, extreme imbalance between positive and negative samples, and unstable regression. To address these issues, this research proposes several improvement directions: more refined feature layers, more reasonable sample allocation strategies, and more robust regression losses.
[0052] One of the keys to dense detection is aligning the allocation of positive and negative samples with the training target. Methods such as ATSS, PAA, and OTA improve the allocation strategy from the perspectives of adaptive thresholding, probabilistic modeling, and optimal transmission, respectively.
[0053] The Task-Aligned approach proposed by TOOD emphasizes the alignment of classification and localization, guiding sample selection through joint scores, and exhibits good generalization across multiple detectors.
[0054] Regarding regression loss, IoU family losses such as GIoU, DIoU, and CIoU are widely used. To address the issue of detection quality alignment, GFL proposed a bounding box distribution representation and a joint classification-localization representation, while VFNet further introduced IoU-aware classification scoring, which effectively improved the accuracy of dense detection.
[0055] To address the instability issue in the regression of tiny objects, the NWD (Normalized Wasserstein Distance) regression loss exhibits more favorable metric characteristics for tiny objects by modeling the bounding boxes as a Gaussian distribution and calculating the Wasserstein distance.
[0056] In industrial inspection, data augmentation is a crucial method for improving robustness and mitigating overfitting. Methods such as MixUp, CutMix, Cutout, and AutoAugment / RandAugment enhance generalization through sample mixing, local occlusion, and automatic policy search, respectively. In engineering practice, Albumentations provides efficient augmentation components and bounding box synchronization mechanisms, making it suitable for building offline augmentation pipelines and ensuring consistent annotation.
[0057] In summary, to address the three types of problems in insulator defect detection mentioned above, this invention provides a method for detecting insulator defects in transmission lines, including: S1, Dataset and Offline Data Augmentation; Specifically, it includes: S11. Dataset source, category definition, and hierarchical structure; The experimental dataset of this invention comes from the insulator defect detection research published by Zheng et al. in Sensors. This invention conducts offline data augmentation based on their dataset.
[0058] The dataset is labeled in YOLO format, and each target is represented by a 5-tuple as shown in formula (1): (1) in For category numbering, Normalized coordinates of the center point of the bounding box. To normalize the width and height, the three categories are defined as follows: c =0: Flashover (a defective subclass); c =1: Broken (a subclass of defect); c =2: Insulator string (insulator_string, parent target); It should be noted that existing technologies typically use three types of planar defects labeled as "damage / flashover / string drop," while this scheme uses a hierarchical labeling of "insulator string parent class + flashover / damage defect subclass." This is because defect targets do not exist in isolation but are naturally attached to the insulator string region. Introducing the parent class bounding box provides spatial constraints for sample allocation and region priors during the training phase, and provides a basis for suppressing false alarms outside the string during the inference phase, thereby reducing the number of false positive samples in complex backgrounds and improving the stability of small defect localization. Compared to existing technologies, the advantage of this scheme lies not in simply increasing the number of categories, but in explicitly encoding the structural information that "the defect belongs to the insulator string" into the training and inference processes.
[0059] like Figure 2 As shown, this annotation system has an explicit hierarchical relationship: any defect subclass target is usually located in space inside or in the neighborhood of a certain insulator string target box.
[0060] It should be noted that the beneficial effects of this annotation system are mainly reflected in three aspects: First, by introducing parent insulator string targets, it provides an effective search area for defect candidates, reducing false detections caused by conductors, tower materials, and complex backgrounds; Second, it provides a unified geometric constraint basis for subsequent HC-TAL, HCR-Loss, and HSR, enabling the training and inference phases to work collaboratively around the same structural prior; Third, it improves the localization stability and recall capability of small defects such as flashover and breakage.
[0061] S12, Offline Data Enhancement; Insulator defect inspection exhibits typical long-tail distribution and domain offset issues. To improve the model's robustness to complex imaging conditions and avoid enhancement perturbations to the validation and test distributions, this invention performs offline enhancement on the training set while maintaining the original training, validation, and test set distributions. The specific data construction process is as follows: Figure 3 As shown: First, the original images and labels of the training set are copied completely. Then, augmented samples are generated in the split directory corresponding to train. Finally, the training data consists of the original image and the augmented image.
[0062] Considering the scarcity of defect samples and class imbalance, this invention proposes a defect-sensitive stratified offline augmentation strategy: the samples are divided into three tiers according to the "scarcity defect priority" and different amplification ratios and enhancement intensities are set, thereby increasing the data scale while avoiding damage to the defect discrimination texture.
[0063] It's important to note that stratifying by "scarcity defect priority," rather than by image source, weather type, or uniform random proportion, has the advantage of prioritizing enhancement resources for defect categories with scarcer samples, more fragile textures, and higher sensitivity to false positives. This simultaneously alleviates class imbalance and the problem of excessive perturbation of defect textures. If a uniform enhancement principle is adopted, normal samples will be further expanded, making it easier for the model to learn the background and parent class targets, while neglecting truly scarce small defects.
[0064] This invention employs the Albumentations library for data augmentation and designs six types of environmental degradation operators to cover the complex imaging conditions in actual inspections: The first type simulates overexposure caused by snow reflections (nonlinear tone curves, desaturation, Gamma transformation, supplemented by CLAHE local contrast compensation); the second type simulates haze and image transmission degradation (grayscale conversion, contrast reduction, JPEG compression artifacts, Gaussian blur); the third type simulates shadows and backlight interference (random shadows, light spot simulation, superimposed with CLAHE); the fourth type simulates sensor noise (Gaussian noise); the fifth type simulates strong occlusion (Cutout random block occlusion, used to construct difficult negative samples); and the sixth type simulates amplitude-controlled geometric transformations (horizontal flip, small-range translation, scaling, and rotation), enabled only in specified templates to protect defect textures.
[0065] It should be noted that brightness perturbation, haze simulation, noise perturbation, flipping / rotating, and cutout—local occlusion techniques—are common data augmentation methods in computer vision. This solution does not rely on the novelty of individual operators as its invention point, but rather on a technical solution that combines scene-based selection, intensity control, and hierarchical application of six types of degradation operators for power transmission line inspection scenarios. This design can cover high-frequency degradation modes such as overexposure, haze, backlighting, noise, occlusion, and small geometric perturbations, improving the model's robustness to actual inspection domain shifts. Deleting a certain type of operator will result in insufficient coverage of the corresponding degradation scene; arbitrarily adding strong perturbation operators may damage the texture of small defect boundaries, thus reducing detection stability.
[0066] The enhancement operators, parameter ranges, and template / random combinations for different tiers are detailed below: Tier 1 (Damaged, class_id=1): 5 enhanced images are generated for each original image, using 5 deterministic templates (in order: Snow Glare + horizontal flip; Haze + translation, scaling and rotation; Shadow SunFlare + CLAHE; Sensor Noise; extreme combination of Snow Glare + Haze), without introducing strong occlusion to protect the damaged texture; Tier 2 (flashover, class_id=0 and no damage): Each image generates 4 enhancement maps, using 4 deterministic templates (Snow Glare with CLAHE; Haze + CLAHE; Shadow SunFlare + CLAHE; Sensor Noise), also avoiding strong occlusion; Tier 3 (normal, only class_id=2): 40 enhancement maps are generated in each loop. Each time, 1-2 environmental degradation operators (Snow Glare, Haze, Shadow SunFlare, Sensor Noise) are randomly selected and stitched together in sequence, and strong occlusion of Coarse Dropout is superimposed with a probability of 0.9.
[0067] In this context, Tier 1, Tier 2, and Tier 3 represent the combinations of enhancement strategies 1, 2, and 3, respectively; Snow Glare represents the simulation of overexposure caused by snow reflection, corresponding to the first type of environmental degradation operator; Haze represents haze and image transmission degradation, corresponding to the second type of environmental degradation operator; Shadow SunFlare represents shadow and backlight interference, corresponding to the third type of environmental degradation operator; CLAHE represents contrast-limited adaptive histogram equalization, which is an auxiliary processing used for local contrast compensation and does not constitute a separate type 1 of the six environmental degradation operators; Sensor Noise represents sensor noise, corresponding to the fourth type of environmental degradation operator; Snow Glare+Haze represents the sequential combination of the first and second types of environmental degradation operators; Snow Glare with CLAHE represents first simulating the brightness or overexposure caused by snow reflection, and then using CLAHE for local contrast-limited compensation; CoarseDropout represents coarse-grained random block occlusion, corresponding to the fifth type of environmental degradation operator; Horizontal flip and Haze + translation, scaling, and rotation correspond to the sixth type of environmental degradation operator.
[0068] It should be noted that the three combinations are not simply a stacking of existing operators, but rather a hierarchical enhancement strategy based on three factors: "category scarcity + texture vulnerability + whether difficult negative samples need to be constructed." Tier 1 and Tier 2 avoid strong occlusion and focus on protecting critical textures that are damaged or flashover-prone; Tier 3 amplifies a large number of normal samples and overlays strong occlusion, focusing on generating difficult negative samples to suppress background false alarms. If a single template is used uniformly, it is difficult to simultaneously protect defective textures and construct difficult negative samples; if any combination is arbitrarily replaced, the distribution of enhancement intensity between categories will be changed, destroying the specificity.
[0069] Visualization of the enhancement operator effect comparison, such as Figure 4As shown, relying on the bounding box synchronization mechanism to ensure annotation consistency, the enhanced data size is 10621 images, of which Tier 1, Tier 2 and Tier 3 are expanded to 4710 / 3820 / 2091 images respectively, achieving the design goal of prioritizing defective samples.
[0070] S2. Construct HCL-YOLOv8; Specifically, it includes: S21. Problem Definition and Hierarchical Structure Modeling; Given an input image The object detection task predicts a set of bounding boxes and category labels as shown in formula (2).
[0071] (2) in , Both represent the input resolution; Indicates the number of candidates; Normalized center point and width / height representation (or equivalent center point and width / height) express), The categories are represented as follows: 0: flashover, 1: broken, 2: insulator string. Let be the confidence level. For ease of description, let the set of truth be denoted as . .when When, its corresponding parent target is defined as If there are multiple parent targets, the selection is based on the inclusion relationship and area criterion; if there is no matching parent target, the defective sample degenerates into a regular allocation strategy to maintain recall.
[0072] Prediction set Describes the candidate boxes, categories, and confidence scores generated by a neural network for an input image, and includes the ground truth set. Describe the manually labeled target bounding boxes and their categories. For defect truth boxes... From the truth set, insulator string frames with c=2 are selected as parent target candidates, with priority given to the parent frame containing the defect center point and having the smallest area. If there is no matching parent box, no hierarchical filtering is applied, and the original task alignment tag allocation strategy of YOLOv8 is used to maintain recall.
[0073] S22. Overall Framework Overview; The overall neural network structure is as follows Figure 1 As shown, the system uses YOLOv8 as a baseline and introduces the following key mechanisms without significantly increasing the parameter size: 1. Supporting modules: P2 high-resolution detection head, soft boundary region prior branch (SBP-Branch), and small-object-aware normalized Wasserstein Distance Loss (SO-NWD). 2. Core optimizations, including: (i) Hierarchy-Constrained Task-Aligned Label Assignment (HC-TAL) (ii) The hierarchy includes Hierarchical Containment Regularization Loss (HCR-Loss) and Hierarchy-aware Soft Re-scoring (HSR).
[0074] The above design forms a progressive closed loop: P2 and SBP-Branch improve "visibility", HC-TAL improves "learnability", SO-NWD improves "regressibility", HCR-Loss strengthens "structural consistency", and HSR controls "external risks" on the deployment side.
[0075] It should be noted that, compared to the conventional YOLOv8, this solution does not merely improve a single module, but rather forms a closed-loop mechanism of "high-resolution candidate generation—parent region prior—hierarchical constraint allocation—small target-friendly regression—geometric inclusion regularization—deployment-side soft score reduction". Its comprehensive benefits are reflected in: improved detection capability of minute defects, reduced high-confidence false alarms outside the serial communication, enhanced localization stability, and maintenance of lightweight deployment capabilities with a smaller parameter scale.
[0076] S23, P2 small target detection layer; YOLOv8's multi-scale detection head is typically used in { P 3, P 4, P 5) Predicting the target at the feature layer. For targets with very small pixel scales, such as insulator defects, continuous downsampling can dilute the target response in deeper features. To improve the spatial resolution of small targets, this invention introduces higher resolution features into the feature pyramid. P Two layers, see structural comparison. Figure 5 To make the detection head cover { P 2, P 3, P 4, P5}, thus providing denser candidate locations and finer-grained localization gradients for defects. Among them, P4 is usually a feature layer downsampled by 16 times relative to the input image, focusing on medium-scale targets; P5 is usually a feature layer downsampled by 32 times, focusing on large-scale targets.
[0077] It is important to emphasize that the P2 detection layer is a commonly used enhancement for small target detection. Its role is to provide a more reliable candidate basis for subsequent hierarchical constraints (HC-TAL, HCR-Loss / HSR). When the feature resolution is insufficient, the low quality of the candidates will weaken the stability of the structural prior.
[0078] S24, Prior branch of soft boundary region; While high-resolution detection layers help capture small targets, the model is still prone to false detections in complex backgrounds outside the insulator region. To address this, this invention utilizes the bounding boxes of the parent insulator string to construct prior supervision, guiding the neural network to focus on feature learning within the insulator region. Specifically, a lightweight prior branch is added alongside the multi-scale detection head consisting of P2, P3, P4, and P5, using a soft mask G generated from the ground truth bounding box of the parent target as supervision, outputting a single-channel prior map P. This branch employs a soft boundary design: the central region within the bounding box is assigned a value close to 1 to strengthen supervision; a buffer zone is set near the boundary, and the supervision value decays smoothly according to the distance from the boundary to accommodate annotation bias and instance deformation.
[0079] It's important to note that the reason for using the parent insulator string bounding box to construct prior supervision is that the effective search space for defect targets is significantly smaller than the entire image. Without introducing region priors, the model is prone to misidentifying background textures such as conductors, tower materials, and shadows as defects. By generating a soft mask from the parent bounding box and employing soft boundary buffers, the response of the insulator region can be enhanced without hard-clipping the candidate space, while tolerating annotation bias and instance deformation. This improves the candidate quality within the parent string's neighborhood and reduces false activations outside the insulator region.
[0080] Prior branch loss Defined as the weighted sum of BCE and Dice as shown in formula (3): (3) in: (4) (5) Symbol explanation: , All dimensions are from prior art. This represents the loss of the prior branch. For Dice weights; To prevent smoothing constants with a denominator of 0, SBP-Branch only provides auxiliary supervision and does not change the output of the main detection branch; This represents the binary cross-entropy loss between the predicted single-channel prior map P and the supervised soft mask G. This represents the Dice overlap loss between P and G. This represents the supervision value of the soft mask G at the u-th row and v-th column pixel. This represents the predicted probability of the prior branch output P at the same pixel position.
[0081] S25, Hierarchical constraint task alignment label assignment; , All dimensions are from prior art. This represents the loss of the prior branch. For Dice weights; To prevent smoothing constants with a denominator of 0, SBP-Branch only provides auxiliary supervision and does not change the output of the main detection branch; This represents the binary cross-entropy loss between the predicted single-channel prior map P and the supervised soft mask G. This represents the Dice overlap loss between P and G. This represents the supervision value of the soft mask G at the u-th row and v-th column pixel. This represents the predicted probability of the prior branch output P at the same pixel position.
[0082] To suppress false positives outside the string caused by incorrect sample allocation, this invention introduces a geometric inclusion prior on the basis of task alignment allocation: by filtering the candidate set through parent target matching, the selection of positive samples is limited to the insulator string region, thereby reducing false positive samples outside the string and training noise from the source.
[0083] (1) Parent Matching: For each defect truth box Select its parent box in the parent target truth set. When multiple parent targets exist, the parent box that "contains the defect center point and has the smallest area" is selected first to avoid incorrectly assigning the defect to a larger structural box; if no matching parent box can be found, the defect sample will maintain the default assignment strategy.
[0084] (2) Margin Expansion: To accommodate annotation bias and prediction offset, both the defect box and its parent box are slightly expanded outwards. An expansion operator is defined. As shown in formula (6), the box The width and height are respectively , The external ratio is The minimum pixel is expanded to ,but (6) in , This invention employs the following method in the expansion of the parent frame: and in P 2-layer minimum outward pixel setting To avoid the small frame from degenerating outwards.
[0085] (3) Candidate Filtering: For defect classes, only the set of candidate points that fall within both the outer defect frame and the outer parent frame is retained, as shown in formula (7).
[0086] (7) In addition, geometric constraints based on the vertical projection of the parent frame are introduced to further eliminate background points below the parent frame and suppress the interference of the background region on defect learning.
[0087] (4) Task alignment scoring and positive sample selection: In the filtered candidate set Within the range, the task alignment score is still used to select the top-k positive samples, as shown in formula (8).
[0088] (8) in Candidate points Category The predicted probability; This is the predicted bounding box obtained from regression at this point; , These are the hyperparameters that balance the contributions of classification and localization; top-k represents the parameter with the highest score. One candidate is used as a positive sample.
[0089] S26, Small-goal-friendly NWD regression loss; After completing the label assignment for structural constraints, it is still necessary to address the issue of unstable regression of small defect boxes. Class loss is highly sensitive to small boundary offsets in small-box scenarios, easily causing gradient jitter. To improve the stability of small defect localization, this invention introduces a normalized Wasserstein distance regression term only for positive defect class samples.
[0090] It's important to note that the key to this approach is "introducing SO-NWD only to positive defect samples." This is because defect boxes are smaller and more sensitive to minor boundary shifts, while the parent insulator string boxes are larger and have more stable boundaries. Introducing NWD uniformly to all samples could amplify the inconsistency in training objectives between targets of different scales, weakening the focus on regressing small defects. This selective design concentrates additional regression capabilities on the most difficult-to-detect small defects, balancing recall and overall training stability.
[0091] Treat the bounding box as a two-dimensional Gaussian distribution: for the box Define the mean covariance ,in , For the prediction box With truth box Its second-order Wasserstein distance is shown in Equation (9).
[0092] (9) Further normalize the distance and convert it into a loss form: (10) in , This is a scale hyperparameter. In this invention implementation, SO-NWD only applies to defect classes (class_id=0 / 1), and uses... Control its overall weight.
[0093] Considering that smaller defects are more difficult to regress, this invention introduces an inverse area weighting for defect samples: (11) in This represents the true area of the defect frame. This is a normalization constant (which can be the within-batch mean). Indicates inverse area weighting. This means truncating the inverse area ratio at... interval, To prevent division by zero and small positive numbers with unstable values, for The upper boundary.
[0094] It should be noted that introducing an inverse area-proportional weight to defect samples is a sample reweighting mechanism proposed to address the problem that "smaller defects are more difficult to regress and are more easily overwhelmed by training signals from larger targets." Its purpose is to give smaller, more difficult-to-locate defect samples higher optimization weights, thereby improving the regression sensitivity of extremely small targets. If a uniform weight is used, the model may tend to favor larger bounding boxes that are easier to learn; if other weights unrelated to area are used, they may not accurately reflect the differences in the difficulty of detecting small targets. Therefore, this scheme chooses a weight form directly related to the target area, and uses an upper bound truncation to ensure training stability.
[0095] The final SO-NWD loss is: ; in Calculate the mean of the positive samples in the defect class. This refers to the overall weighting coefficient of SO-NWD. (In the implementation of this invention) Cut off to This is to avoid unstable gradients caused by extremely small bounding boxes.
[0096] S27. The hierarchy includes consistency regularization loss; Although HC-TAL has reduced out-of-string pseudo-positive samples during the label assignment stage, the model may still produce out-of-bounds predictions in the early stages of training or in complex contexts. To explicitly reinforce the structural prior that "the defect box should be contained by the parent target box," this invention introduces Hierarchical Containment Regularization Loss (HCR-Loss), which only applies to positive samples that are "defect class and have a matching parent box."
[0097] It's important to note that introducing hierarchical consistency regularization, which only applies to positive samples that are "defective classes and have matching parent boxes," aims to apply the structural prior that "defective boxes should be contained within parent insulator string boxes" only to samples that truly have physical and geometric meaning. This explicitly penalizes out-of-bounds predictions while avoiding applying incorrect constraints to samples without matching parent boxes or those with poor training quality in the early stages, thus reducing the risk of negative transfer. If the consistency loss were applied uniformly to all samples, it would easily introduce incorrect constraints; if a purely probabilistic hierarchical consistency loss were used, it would often only constrain class relationships and would be difficult to directly constrain geometric out-of-bounds bounding boxes.
[0098] Let the defect prediction box be The parent target truth bounding box is Define four out-of-bounds variables: ; ; ; (12) when Completely located Internally, the aforementioned out-of-bounds values should be non-positive (or close to 0); when an out-of-bounds error occurs, the corresponding term should be positive. To obtain smooth gradients and avoid training instability caused by hard truncation, this invention employs the Softplus function. A smooth penalty is applied to out-of-bounds quantities. This function can be regarded as a smooth approximation of max(0,z) or ReLU. It can both penalize positive out-of-bounds quantities and avoid gradient discontinuity, resulting in a single-sample coverage loss. (13) To avoid negative transfer during training due to mismatched parent boxes, HCR-Loss introduces a quality gating coefficient. The regularization intensity is attenuated based on the target quality score (e.g., target score) output during the label allocation phase. (14) Meanwhile, the weights of HCR-Loss employ a quadratic ramp that gradually increases with each training epoch to avoid excessive early prediction noise leading to training instability: let the total number of epochs be... The start and end rounds of the ramp are , The maximum weight is ,but: (15) in For the current epoch, This is the round in which the weight begins to increase. The round in which the weight reaches its maximum value. The maximum weight for HCR-Loss Its epoch-adaptive weights; the implementation of this invention uses a quadratic ramp and .
[0099] S28, Post-processing of hierarchical-aware soft-weight scoring; During inspection, "out-of-line high-confidence defects" usually indicate false alarms; however, directly deleting out-of-line defect boxes may mistakenly identify real defects when the parent target is missed. To balance false alarm suppression and recall protection, this invention introduces Hierarchical Aware Soft Weighted Scoring Post-processing (HSR) after Non-Maximum Suppression (NMS): for each defect box, it checks whether its center point falls within the outer region of any predicted parent target box; if not, confidence scaling is performed instead of deletion.
[0100] It's important to note that the key to HSR lies not in general post-processing, but in "recalibrating the confidence level of the defect box using the extended region of the parent target after NMS." The reason for this approach is that most high-confidence defects outside the target range in inspection scenarios are false alarms. However, if a hard deletion strategy is used, real defects might be mistakenly detected when the parent target is missed. Therefore, this solution chooses soft downsampling instead of direct deletion, striking a balance between false alarm suppression and recall protection. Without any processing, high-confidence false alarms outside the target range are difficult to control; hard filtering, on the other hand, lacks sufficient tolerance for missed parent box detections.
[0101] Specifically, let the set of parent targets for prediction be: (16) in, The confidence threshold for the parent target. Indicates the first The bounding box of the predicted parent target (insulator string), Indicates the first The category number of each prediction box, Indicates the first The confidence level of each predicted bounding box; satisfying =2 and ≥ The prediction box is included in the parent target set; for each defect prediction Take its center point ,like: (17) Then execute: (18) in Pixel-level outward expansion boundary (for fault tolerance). This is the reduction factor. The present invention achieves the following: , Pixels When a parent bounding box is not predicted for an image, the HSR does not perform any processing to protect recall.
[0102] S29, Total Loss Function; Based on the above improvements, the total loss during the training phase is: (19) in The detection loss for YOLOv8 (including classification and regression / distribution terms). and For hyperparameters, The epoch-adaptive weights for HCR-Loss are used. During the inference phase, HSR does not change the training structure, but only affects the confidence correction after NMS, in order to achieve structural consistency risk control on the deployment side.
[0103] S3. Analysis of experimental results; Specifically, it includes: S31, Experimental Dataset; This invention is based on the insulator defect detection dataset published by Zheng et al. in the journal Sensors, and expands the data scale using the defect-sensitive hierarchical offline enhancement strategy proposed by S1. The enhanced data size is 10621 images, and the original train / val / test partitioning structure is strictly maintained to avoid the validation set distribution being contaminated by the enhancement strategy. The dataset contains three target classes: flashover, broken, and insulator string (parent class). The annotation system has a clear hierarchical relationship: defect subclasses are usually located within or near the parent class insulator string region, providing a priori basis for subsequent hierarchical consistency learning and risk suppression during inference.
[0104] Figure 6 The distribution of annotations on the enhanced training set is shown. It can be seen that the scale of the bounding boxes of the two types of defect targets is significantly smaller than that of the insulator string boxes, exhibiting typical characteristics of small targets. Moreover, the spatial distribution of the targets is relatively concentrated in the central region of the image, reflecting the practical difficulties of easily missing small defects and being easily interfered with in complex backgrounds.
[0105] S32, Training Framework and Hyperparameters; This invention is based on the Ultralytics YOLOv8 training framework, trained from scratch (pretrained=False), with an input size of 800, 150 training epochs, batch size of 8, and using conventional online augmentation (Mosaic / MixUp, close_mosaic=20, mixup=0.1). Both the ablation experiments and baseline comparison experiments used the same dataset, input scale, and training epoch settings.
[0106] Ultralytics YOLOv8 is the YOLOv8 training framework implemented by Ultralytics; pretrained=False means that no pre-trained weights are loaded and training starts from random initialization; batch=8 means that each training batch contains 8 images; Mosaic is multi-image stitching enhancement; MixUp is image and label mixing enhancement; close_mosaic=20 means that Mosaic is turned off in the last 20 rounds; mixup=0.1 means that the MixUp enhancement ratio / probability is set to 0.1.
[0107] S33, Evaluation Indicators; This invention employs the target detection standard indicators Precision, Recall, and F1, as well as AP / mAP in COCO format. Let TP, FP, and FN represent the number of true positives, false positives, and false negatives, respectively. Then: Precision = TP / (TP + FP); Recall = TP / (TP + FN); F1 = 2·Precision·Recall / (Precision + Recall); AP is defined as the area under the PR curve; mAP50 represents the average AP of each category when IoU=0.5, and mAP50-95 represents the average AP under the condition that IoU ranges from 0.5 to 0.95 (step size 0.05), which better reflects the positioning accuracy and stability.
[0108] Where Precision is the percentage of targets predicted as defects that are actually defects; Recall is the percentage of actual defects that are detected; F1 is the harmonic mean of precision and recall. COCO format is the COCO target detection data and evaluation specification; AP is the area under the PR curve for a specific category; mAP is the average of AP across multiple categories, where mAP50 represents the mean when IoU = 0.5, and mAP50-95 represents the average of multiple thresholds with IoU ranging from 0.5 to 0.95 in steps of 0.05.
[0109] S34. Training convergence and threshold selection analysis, including: S341. Convergence and stability; Figure 7 The training process curves of the main scheme are shown. It can be seen that the loss function decreases rapidly in the early stage and then tends to stabilize. Precision, Recall, and mAP converge stably in the middle and late stages, without obvious oscillations or overfitting, indicating that the training process is stable and reliable.
[0110] S342, Confidence threshold and Precision–Recall trade-off; Figure 8 The PR curves of the main scheme at IoU=0.5 are presented, with an overall mAP of 0.923. The APs for flashover, broken insulators, and insulator strings are 0.845, 0.928, and 0.995, respectively. Figure 9The F1-Confidence curves show that the optimal F1 score of approximately 0.91 across all categories occurs at a confidence threshold of around 0.622. It is recommended that this value be used as the default operating point for engineering deployments to balance false positives and false negatives. The threshold selection should be consistent with the scenario objectives: if high recall is emphasized, the threshold can be appropriately lowered, and the soft downsampling mechanism of HSR can be used to control out-of-range false positives; if high precision is emphasized, the threshold can be increased, as the structural prior constraints of HSR can still effectively suppress high-confidence out-of-range false positives. This threshold analysis provides a unified evaluation benchmark for subsequent experiments and also verifies the robustness of the HSR soft strategy in engineering deployments.
[0111] The PR curve is a precision-recall curve: the horizontal axis represents recall, and the vertical axis represents precision. Different points are obtained by changing the confidence threshold. The closer the curve is to the upper right corner, the higher the precision while maintaining high recall. The area under the curve is the AP for that class, and the average AP for all classes is mAP. The F1-Confidence curve represents the effect of changes in the confidence threshold on the F1 value: the horizontal axis represents the confidence threshold, and the vertical axis represents F1.
[0112] S35, Ablation Test; Table 1 Ablation Experiment Data
[0113] Where Params(M) represents the number of model parameters, with M being millions of parameters, and GFLOPs represents billions of floating-point operations, used to measure the computational complexity of a single forward inference given the input size. The seven combinations of model configurations in Table 1, from top to bottom, can be interpreted as follows: ① YOLOv8n: nanoscale base model; ② YOLOv8n+P2 Head: adding a P2 high-resolution detection head to the baseline; ③ SBP-Branch: adding a prior auxiliary branch for soft boundary regions; ④ HC-TAL: adding hierarchical constraint task alignment label assignment; ⑤ SO-NWD: adding small target-friendly NWD regression loss for positive samples of defect classes; ⑥ HCR-Loss: adding hierarchical inclusion consistency regularization loss; ⑦ HSR: adding hierarchical-aware soft weight re-scoring in the inference stage, forming the complete HCL-YOLOv8 scheme.
[0114] The ablation experiment data are shown in Table 1. In terms of parameter quantity and computational cost, after introducing the P2 detection layer in ABL_01, the number of parameters increased from 3.01M to 3.08M, and GFLOPs increased from 8.1 to 12.5, incurring the necessary computational cost to improve small target detection capabilities. In ABL_02, after adding SBP-Branch, the number of parameters and GFLOPs increased slightly to 3.12M and 12.6 respectively, with manageable overhead. Subsequent modules (HC-TAL, SO-NWD, HCR-Loss, HSR) all optimized the training strategy without changing the inference structure, maintaining stable parameter quantity and GFLOPs, reflecting the design principle of "training optimization without increasing inference burden."
[0115] In terms of detection accuracy (mAP50), P2 and SBP-Branch gradually improved mAP50 from 0.908 to 0.918; a slight fluctuation occurred in the HC-TAL stage (0.918→0.917), which is in line with the theoretical expectation that sample tightening may temporarily affect recall; subsequently, SO-NWD and HCR-Loss improved accuracy to 0.922, and HSR finally reached 0.923, showing an overall stable upward trend.
[0116] From the perspective of localization accuracy (mAP50-95), P2 and SBP-Branch each brought an improvement of 0.005, indicating that high-resolution features and regional priors are helpful for fine-grained localization optimization. After the introduction of HC-TAL, mAP50-95 decreased from 0.606 to 0.594, a decrease of 0.012, which is a direct reflection of the limited localization diversity caused by the tightening of the positive sample space, consistent with the theoretical expectation of "increased purity and decreased localization richness". Subsequently, SO-NWD and HCR-Loss gradually compensated for localization degradation, and HSR further restored the index to 0.599, slightly higher than the baseline level, verifying the collaborative compensation mechanism between modules.
[0117] From the perspectives of precision and recall, in ABL_01, the recall increased from 0.877 to 0.887 after introducing P2, indicating that high-resolution features are helpful for detecting small targets. In ABL_02, the precision increased to 0.922 after adding SBP-Branch, while the recall decreased slightly (0.887→0.878), suggesting that while region priors suppress background false positives, they may slightly filter out some edge defects. In ABL_03, the precision further improved to 0.926 after introducing HC-TAL, and the recall rebounded to 0.887, demonstrating that the sample tightening strategy reduced false positives without excessively sacrificing recall. In ABL_04, the recall significantly increased to 0.900 after adding SO-NWD, while the precision decreased slightly (0.926→0.917), indicating that while the small target-friendly regression loss improves recall, it may introduce a small number of additional false positives. After adding HCR-Loss in ABL_05, Recall reached a peak of 0.910, while Precision remained stable at 0.919, indicating that structural consistency regularization helps improve the learning quality of positive samples and significantly improves recall. After introducing HSR in ABL_06, Precision increased to 0.923, and Recall was fine-tuned to 0.911, ultimately achieving an effective balance between precision and recall, which meets the design goal of soft filtering out-of-string false positives during inference.
[0118] In summary, the ablation experiment data exhibits a clear evolutionary logic: P2 and SBP-Branch construct features and prior knowledge, HC-TAL improves sample purity, SO-NWD and HCR-Loss compensate for recall and localization from the perspectives of regression and structural consistency, respectively, and HSR optimizes accuracy during the inference period. The fluctuations of each indicator are all within the theoretically expected range, thus validating the effectiveness and synergy of each module in the hierarchical consistency learning framework of this invention.
[0119] S36. Comparison with mainstream lightweight detectors; To evaluate the general competitiveness of the method, this invention compares the main scheme with a variety of mainstream lightweight detectors under the same training protocol, including YOLOv5n, YOLOv10n, YOLOv11n, as well as larger but still lightweight YOLOv8s and YOLOv11s.
[0120] Table 2. Comparison with mainstream detectors
[0121] In Table 2, the models are configured as follows: YOLOv8n is the YOLOv8 nanoscale lightweight model; Ours is the complete HCL-YOLOv8 lightweight model of this invention; YOLOv5n is the YOLOv5 nanoscale model; YOLOv10n is the YOLOv10 nanoscale model; YOLOv11n is the YOLOv11 nanoscale model; YOLOv8s is the YOLOv8 small model; and YOLOv11s is the YOLOv11 small model. The suffix 'n' indicates nano (nano / ultra-lightweight), and 's' indicates small (small). The comparison results in Table 2 show that, while keeping the number of parameters (3.12M) and computational cost (12.6GFLOPs) low, the method of this invention achieves an mAP50 of 0.923 and a Recall of 0.911, both of which are better than all the comparison models, demonstrating a strong ability to detect small defects. Although the mAP50-95 (0.599) is slightly lower than YOLOv11n (0.609) and YOLOv11s (0.614), the number of parameters and computational cost are reduced by about 70% and 50% respectively, achieving a better trade-off in engineering deployment between defect detection capability and computational cost.
[0122] Figure 10 The visualization results of the improved algorithm of this invention in the insulator defect detection scenario are shown. As can be seen from the figure, HCL-YOLOv8 can accurately locate the insulator string area and effectively detect two types of minor defects, flashover and breakage, in complex backgrounds (such as similar textures, lighting changes, and partial occlusion). The detection box matches the real target well, and no obvious missed detections or false alarms outside the string are observed.
[0123] This invention addresses the problems of unstable localization of small targets, strong interference from complex backgrounds, and insufficient utilization of prior knowledge in hierarchical structure in insulator defect detection of transmission lines. It proposes a lightweight detection framework, HCL-YOLOv8, enhanced by hierarchical consistency learning. Using YOLOv8 as a baseline, this method introduces hierarchical constraints around the natural hierarchical structure of "defect-insulator string," in three stages: label allocation, training loss, and post-inference processing. HC-TAL (Hierarchical Content Consistency Regularization) limits positive samples to the parent string region, suppressing false positives from the source. HCR-Loss (Hierarchical Content Consistency Regularization Loss) strengthens the geometric inclusion relationship between the defect box and the parent box during training. HSR (Hierarchical Content Consistency Regularization Loss) performs confidence reduction on defects outside the string during inference, balancing false alarm suppression and recall protection. Furthermore, this invention introduces a P2 high-resolution detection layer, SBP-Branch, and SO-NWD to further improve the localization stability and detection capability of small defects.
[0124] On the publicly available dataset and its enhanced version published by Zheng et al. in Sensors, the method of this invention, with a lightweight scale of 3.12M parameters and 12.6 GFLOPs, achieved detection performance of mAP50 of 0.923 and recall of 0.911. Compared with the YOLOv8n baseline, the recall rate was improved by 3.4 percentage points and the mAP50 by 1.5 percentage points, with a particularly significant improvement in the detection capability of flashover-type small defects. Ablation experiments verified the effectiveness and synergy of each module; comparison with mainstream lightweight detectors showed that the method of this invention achieved a better trade-off between defect detection capability and computational overhead in engineering deployment. Tiered evaluation and hierarchical consistency analysis further confirmed that the method has a stable advantage in small target detection and does not have high-confidence false alarms outside the common deployment threshold, showing good prospects for engineering applications.
[0125] Example 2 This embodiment discloses a detection system for insulator defects in transmission lines. The system can implement the methods of the above embodiments and includes a data annotation module, a data augmentation module, a neural network training module, and an insulator defect detection module. The data annotation module is used to acquire datasets and annotate them with quintuples that have explicit hierarchical relationships. The data augmentation module is used to augment the labeled dataset by employing a combination of several augmentation strategies consisting of multiple types of environmental degradation operators; The neural network training module constructs a neural network incorporating key mechanisms and trains and tests the neural network using a training set. The insulator defect detection module is used to detect insulator defects in transmission lines through a trained and tested neural network.
[0126] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0127] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to the present invention.
Claims
1. A method for detecting defects in transmission line insulators, characterized in that, include: Obtain the dataset and annotate it with quintuples that have an explicit hierarchical relationship to obtain the annotated dataset; The quintuple includes the category number, the normalized x and y coordinates of the bounding box center point, and the normalized width and height; The labeled dataset is augmented by a combination of several augmentation strategies consisting of multiple types of environmental degradation operators to obtain an augmented dataset. Multiple environmental degradation operators include simulation of overexposure caused by snow reflection, haze and image transmission degradation, shadow and backlight interference, sensor noise, strong occlusion, and amplitude-controlled geometric transformations. The labeled dataset and the augmented dataset together constitute the training set; Construct a neural network that incorporates key mechanisms; The key mechanisms include a support module, hierarchical constraint task alignment label allocation, and hierarchical consistency regularization loss and hierarchical-aware soft weight scoring post-processing. The support module includes P 2. Detection head, prior branch for soft boundary regions, and small target-friendly NWD regression loss; The soft boundary region prior branch includes: adding a lightweight prior branch next to the multi-scale detector head, using the soft mask generated by the parent target ground truth box as supervision, and outputting a single-channel prior map; adopting a soft boundary design, the supervision value is the largest in the central region within the parent box, the supervision value in the buffer zone gradually increases according to the distance to the boundary, and the supervision value is the smallest outside the parent box; the prior branch loss is the weighted sum of BCE and Dice; The hierarchical constraint task alignment label allocation includes: for each defect ground truth box, selecting the parent box with the smallest area containing the defect center point from the parent target ground truth set as the matching parent box; performing fault-tolerant expansion on both the defect box and the matching parent box, defining an expansion operator, and retaining only the candidate point set that falls within both the expanded defect box and the expanded parent box region; and introducing geometric constraints based on the vertical projection of the parent box to remove background points outside the lower boundary of the parent box; and selecting the top-k positive samples using task alignment scoring within the filtered candidate set. The neural network is trained and tested using the training set, and then the trained and tested neural network is used to detect defects in insulators of transmission lines.
2. The method for detecting defects in transmission line insulators according to claim 1, characterized in that, The dataset includes images of transmission line insulators and defect targets; the data in the dataset is labeled to obtain a labeled dataset. During the annotation process, each target is represented in the form of a quintuple, which is as follows: ; in, For category numbering, c =0 indicates flashover. c =1 indicates damage. c =2 represents an insulator string; Normalized coordinates of the center point of the bounding box. To normalize the width and height; The quintuple form has an explicit hierarchical relationship: any defect subclass target is located spatially inside or in the neighborhood of a target frame of an insulator string.
3. The method for detecting defects in transmission line insulators according to claim 2, characterized in that, Data augmentation of the labeled dataset includes: Copy the labeled dataset to obtain a copied dataset; perform data augmentation on the copied dataset to obtain an augmented dataset; The augmented dataset and the labeled dataset together constitute the training set; The data augmentation strategies include: The copied dataset is divided into three levels according to the priority of scarcity defects, and different amplification ratios and enhancement intensities are set. Six types of environmental degradation operators are designed to cover the imaging conditions in actual inspections during the data augmentation process; The six types of environmental degradation operators are as follows: The first category is simulations of overexposure caused by reflections from snow. The second category is smog and image transmission degradation; The third category is interference from shadows and backlighting; The fourth category is sensor noise; The fifth category is strong occlusion; The sixth category is amplitude-controlled geometric transformations; Three combinations of enhancement strategies are constructed based on the six types of environmental degradation operators, as follows: The enhancement operators, parameter ranges, and templates for different tiers are randomly combined as follows: Tier 1: Several deterministic templates are used, namely Snow Glare + horizontal flip, Haze + translation, scaling and rotation, Shadow SunFlare + CLAHE, Sensor Noise and Snow Glare + Haze, without introducing occlusion to protect the damaged texture. Tier 2: Several deterministic templates are used, namely Snow Glare with CLAHE, Haze + CLAHE, ShadowSunFlare + CLAHE, and Sensor Noise, to avoid occlusion; Tier 3: Each time, several types of environmental degradation operators are randomly selected and sequentially spliced together, and CoarseDropout occlusion is added with probability. In this context, Tier 1, Tier 2, and Tier 3 represent the combinations of enhancement strategies 1, 2, and 3, respectively; Snow Glare represents the simulation of overexposure caused by snow reflection, corresponding to the first type of environmental degradation operator; Haze represents haze and image transmission degradation, corresponding to the second type of environmental degradation operator; Shadow SunFlare represents shadow and backlight interference, corresponding to the third type of environmental degradation operator; CLAHE represents contrast-limited adaptive histogram equalization, which is an auxiliary processing used for local contrast compensation and does not constitute a separate type 1 of the six environmental degradation operators; Sensor Noise represents sensor noise, corresponding to the fourth type of environmental degradation operator; SnowGlare+Haze represents the sequential combination of the first and second types of environmental degradation operators; Snow Glare with CLAHE represents first simulating the brightness or overexposure caused by snow reflection, and then using CLAHE for local contrast-limited compensation; Coarse Dropout represents coarse-grained random block occlusion, corresponding to the fifth type of environmental degradation operator; Horizontal flip and Haze + translation, scaling, and rotation correspond to the sixth type of environmental degradation operator.
4. The method for detecting defects in transmission line insulators according to claim 3, characterized in that, The prior branches of the soft boundary region include: A lightweight prior branch is added next to the multi-scale detection head consisting of P2, P3, P4, and P5, and a single-channel prior map P is output with the soft mask G generated by the parent target truth box as supervision. It employs a soft boundary design, which includes: within the parent target bounding box, a distance from the boundary not less than the width of a buffer band. In the central region, the soft mask supervision value is set to 1; in the region less than [missing value] from the boundary Within the buffer area, the supervision value increases linearly from 0 to 1 according to the normalized distance from the pixel to the boundary of the parent target box; the supervision value outside the parent target box is set to 0. The loss of the prior branch is a weighted sum of BCE and Dice, and the loss formula is as follows: ; in: ; ; In the formula, , All dimensions are from prior art. This represents the loss of the prior branch. For Dice weights; To prevent smoothing constants with a denominator of 0, SBP-Branch only provides auxiliary supervision and does not change the output of the main detection branch; This represents the binary cross-entropy loss between the predicted single-channel prior map P and the supervised soft mask G. This represents the Dice overlap loss between P and G. This represents the supervision value of the soft mask G at the u-th row and v-th column pixel. This represents the predicted probability of the prior branch output P at the same pixel position.
5. The method for detecting defects in transmission line insulators according to claim 4, characterized in that, The small-objective friendly NWD regression loss includes: A normalized Wasserstein distance regression term is introduced only for positive samples of the defect class, and a prediction box is constructed based on the distance regression term. With truth box The formula for the second-order Wasserstein distance is as follows: ; in: ; In the formula, Represents the prediction box With truth box The squared second-order Wasserstein distance between the corresponding Gaussian distributions , Let represent the mean vectors of the predicted bounding box and the ground truth bounding box, respectively. The square of the Euclidean norm of a vector. Denotes the squared Frobenius norm of a matrix. , Let these represent the positive definite square roots of the covariance matrices of the predicted bounding box and the true bounding box, respectively. , , The x and y coordinates of the center point of the true defect box are represented by the x and y coordinates, respectively, and together they form the mean vector. ; , These represent the width and height of the truth defect box, respectively. Describing covariance, , These represent the standard deviations of the two-dimensional Gaussian distribution corresponding to the truth box in the horizontal and vertical directions, respectively. The second-order Wasserstein distance formula is normalized and transformed into a loss form as follows: ; in, This represents the regression loss value corresponding to the normalized Wasserstein distance. , which represents the arithmetic square root of the square of the second-order Wasserstein distance between the predicted box and the true box; To control the scale hyperparameter of the exponential normalization scale; Introduce an inverse area weighting to the defect samples, as follows: ; in, Indicates inverse area weighting. This represents a truncation function used to truncate... Limited to the range Inside, This represents a small positive number added to the denominator of the area fraction, used to prevent division by zero and numerical instability when A=0 or the area is too small; This represents the true area of the defect frame. The normalization constant is Inverse area weighting The upper bound; The final SO-NWD loss is as follows: ; Wherein, SO-NWD represents the small-objective-friendly NWD regression loss. This represents the final SO-NWD loss; Calculate the mean of the positive samples in the defect class. This represents the overall weighting coefficient of the SO-NWD loss, used to control the contribution of this additional regression term to the overall optimization.
6. The method for detecting defects in transmission line insulators according to claim 5, characterized in that, The hierarchical constraint task alignment label allocation is used to suppress out-of-string false detections caused by incorrect sample allocation; The hierarchical constraint task alignment label allocation includes parent target matching, fault tolerance expansion, candidate point filtering, and task alignment scoring and positive sample selection. The parent target matching is used to filter the candidate set, limiting the selection of positive samples to the insulator string region; for each satisfying truth boxes ,in For the set of defect categories, select its parent box from the set of parent target truth values. When there are multiple parent targets, the parent box with the smallest area that contains the center point of the defect is selected first. If no matching parent box can be found, the defective sample will retain the default assignment strategy. The fault-tolerant expansion is used to slightly expand both the defect box and the parent box, including: Define the expansion operator The expression is as follows: ; in: ; ; In the formula, Representation box, , , Representing boxes The horizontal and vertical coordinates in the top left corner , Representing boxes The horizontal and vertical coordinates of the bottom right corner; Indicates the expansion ratio. Indicates the minimum pixel expansion. , , , Representing boxes Width and height; The candidate point filtering process only retains the set of candidate points that simultaneously fall within both the outer defect box and the outer parent box region, as expressed below: ; In the formula, This represents the filtered candidate set. Indicates candidate points, This indicates a logical AND operation, meaning that a candidate point must simultaneously satisfy two conditions: falling into both the outer defect box and the outer parent box. Indicates the first A defective truth box The truth box of the matched parent insulator string; Furthermore, geometric constraints based on the vertical projection of the parent frame are introduced to further eliminate background points below the parent frame and suppress the interference of the background region on defect learning. The task alignment scoring and positive sample selection include: In the filtered candidate set Within this framework, the task alignment score is still used to select the top-k positive samples, as shown in the following formula: ; in, Candidate points Category The predicted probability; Candidate points The predicted bounding box obtained from regression; , These are the hyperparameters that balance the contributions of classification and localization; top-k indicates selecting the top-scoring hyperparameters. One candidate is used as a positive sample. Indicate candidate points With the j-th truth box Task alignment score Represents the prediction box With truth box The intersection-union ratio; top-k means taking the top k candidates with the highest scores as positive samples.
7. The method for detecting defects in transmission line insulators according to claim 6, characterized in that, The hierarchy includes consistency regularization loss, including: Let the defect prediction box be Parent target truth bounding box Based on the defect prediction box and the parent target truth bounding box, four out-of-bounds quantities are defined: ; ; ; ; in, , , , These represent the coordinates of the left, top, right, and bottom boundaries of the defect prediction box, respectively. , , , These represent the coordinates of the left, top, right, and bottom boundaries of the defect prediction box, respectively. , , , These represent the amount of the defect prediction box exceeding the left, top, right, and bottom boundaries of its parent box, respectively. When the defect prediction box Completely located outside the parent target's truth box When the boundary is inside, the out-of-bounds amount should be non-positive; when an out-of-bounds event occurs, the corresponding term is positive; the Softplus function is used to smooth the out-of-bounds amount, and Softplus is a smooth approximation of max(0,z) or ReLU, which is used to obtain smooth gradients and avoid training instability caused by hard truncation; The smoothing penalty function and the single-sample loss function are as follows: ; ; Introducing a quality gating factor into HCR-Loss The regularization intensity is attenuated based on the target quality score output during the label allocation phase. The attenuation expression is as follows: ; In the formula, The level includes consistency regularization loss for a single positive sample; HCR-Loss is the level includes consistency regularization loss, used to penalize cases where the defect prediction box goes beyond the matched parent insulator string box. Furthermore, the HCR-Loss weights employ a quadratic ramp that gradually increases with each training epoch, with progressively increasing weight scheduling; the ramp indicates that the HCR-Loss weights do not start at their maximum value, but rather are adjusted gradually. to The increments between rounds follow a quadratic function to reduce the interference of early training noise on the model, including: Let the total number of rounds be , ramp The start and end rounds are , The maximum weight is ,but: ; in, For the current round, This indicates the training epoch where the HCR-Loss weights begin to increase. This indicates the training epoch where weight growth has ended and reached its maximum value. Indicates the maximum weight of HCR-Loss; is the epoch-adaptive weight for HCR-Loss, and ramp represents incremental weight scheduling.
8. A method for detecting defects in transmission line insulators according to claim 7, characterized in that, The hierarchical perception soft weight scoring post-processing includes: For each defect box, check whether its center point falls within the outer region of any predicted parent target box. If not, perform confidence scaling. The step of checking whether its center point falls within the outer region of any predicted parent target box includes: Suppose the set of parent targets for prediction is as follows: ; in, The confidence threshold for the parent target. Indicates the first Predict the parent target bounding box, Indicates the first The category number of each prediction box, Indicates the first The confidence level of each predicted bounding box; satisfying The predicted bounding box is included in the parent target set; Predicting each defect Take its center point ,like Then execute ; in, , , They represent the first i The x and y coordinates of the center point of each defect prediction box For pixel-level outward expansion boundaries, This is the score reduction factor; when a parent bounding box is not predicted for an image, HSR does not perform any processing to protect recall.
9. A method for detecting defects in transmission line insulators according to claim 8, characterized in that, The construction of the total loss function of the neural network includes: Based on the supporting modules, hierarchical constraint task alignment label allocation, and hierarchical consistency regularization loss, the total loss function of the neural network during the training phase is constructed; the hierarchical perceptual soft weight scoring post-processing is performed during the inference phase, and the total loss function is as follows: ; in, Represents the total loss function. To detect the loss, , All of these are hyperparameters.
10. A system for implementing a method for detecting defects in transmission line insulators as described in any one of claims 1-9, characterized in that: It includes a data annotation module, a data augmentation module, a neural network training module, and an insulator defect detection module; The data annotation module is used to acquire datasets and annotate them with quintuples that have explicit hierarchical relationships. The data augmentation module is used to augment the labeled dataset by employing a combination of several augmentation strategies consisting of multiple types of environmental degradation operators; The neural network training module constructs a neural network incorporating key mechanisms and trains and tests the neural network using a training set. The insulator defect detection module is used to detect insulator defects in transmission lines through a trained and tested neural network.
