A cross-domain insulator defect detection method, device, medium and product

By using a cross-domain detection model optimized through teacher-student collaboration, the instability of the detection model caused by the difference in distribution between artificially generated samples and real samples was solved. This improved the robustness and generalization ability of cross-domain insulator defect detection, especially the high efficiency of detection under conditions of insufficient real samples and no labeling.

CN122175934APending Publication Date: 2026-06-09NORTH CHINA ELECTRIC POWER UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTH CHINA ELECTRIC POWER UNIV
Filing Date
2026-03-10
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, artificially generated insulator defect samples differ from real-collected samples in terms of distribution, resulting in insufficient generalization ability of cross-domain insulator defect detection models in cross-domain scenarios and unstable detection results. Furthermore, the pseudo-label-based teacher-student method is susceptible to noise and cannot effectively utilize low-confidence samples.

Method used

A cross-domain detection model (TSCO) with teacher-student collaborative optimization is adopted. By introducing a cross-view invariant representation module, a low-confidence prediction-driven self-optimization module, and a course-guided hard example alignment module, the alignment of cross-domain feature distributions and the improvement of detection performance are achieved.

Benefits of technology

By making full use of artificially generated samples without the need for real sample annotation, the robustness and generalization ability of the insulator defect detection model in cross-domain scenarios are improved, the detection performance is enhanced, and the problems of insufficient real samples and annotation difficulties are alleviated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122175934A_ABST
    Figure CN122175934A_ABST
Patent Text Reader

Abstract

The application discloses a cross-domain insulator defect detection method and device, medium and product, relates to the field of power transmission line detection, and comprises the following steps: constructing a teacher-student collaborative optimization cross-domain detection model based on a structure-consistent teacher network and a student network; obtaining a trained student network based on the teacher-student collaborative optimization cross-domain detection model by using source domain data and target domain data; the student network is supervised learning by using the true value label of the source domain data, and is un-supervised training by using the pseudo label generated by the teacher and the unlabeled target domain data; a cross-view invariance representation module is introduced into the student network; a low-confidence prediction-driven self-optimization module is introduced into the teacher network; a course-guided difficult example alignment module is also introduced into the student network; and insulator defect detection is performed based on the trained student network. The application can improve the robustness and generalization ability of the insulator defect detection model in the cross-domain scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power transmission line inspection, and in particular to a method, equipment, medium, and product for detecting defects in cross-domain insulators. Background Technology

[0002] In intelligent inspection scenarios of power transmission lines, applying deep learning technology to transmission line defect detection can help improve detection efficiency. However, due to limitations such as the acquisition environment, safety conditions, and the probability of defect occurrence, the number of real defect image samples is limited, making it difficult for supervised learning-based detection models to achieve stable and reliable performance. To address the problem of insufficient training data in transmission line defect detection, existing research mainly employs two methods: data augmentation techniques and artificial intelligence model generation techniques.

[0003] (1) Data augmentation techniques based on existing samples Data augmentation techniques refer to expanding the number of training samples by performing various transformation operations on existing images without collecting additional new data, thereby improving the model's generalization ability. Common data augmentation methods include image rotation, scaling, flipping, cropping, padding, translation, affine transformation, occlusion handling, and brightness and color adjustments. The basic idea of ​​these methods is to introduce appearance changes while maintaining the semantics of the target image, enabling the model to adapt to different viewpoints, scales, and lighting conditions during training. Building on this, some studies have proposed more complex augmentation strategies. For example, existing techniques propose a method of randomly cropping and recombining images, which increases sample diversity and reduces the risk of overfitting during model training by randomly cropping local regions from four different images and stitching them together to generate new training samples. Another existing technique proposes a target instance copy-paste method, which first automatically crops the target instance from the image and then pastes it into different random backgrounds to generate new training samples for use in the model's pre-training phase. In the field of power line inspection, technicians, combining the characteristics of transmission line insulator scenarios, have constructed the Transmission Line Insulator Dataset (CPLID) using image enhancement techniques such as affine transformation, insulator target segmentation, and background fusion. This dataset contains both real-world insulator defect images and artificially synthesized defect images, providing data support for the training of subsequent defect detection models. However, the aforementioned data augmentation methods are essentially still geometric or appearance-level transformations of existing samples. The generated samples are highly similar to the original samples at the semantic level, making it difficult to generate samples containing entirely new defect morphologies or complex semantic features.

[0004] (2) Data generation technology based on generative artificial intelligence models Unlike traditional data augmentation, generative AI models can directly generate image samples with new semantic features by learning the latent distribution of large amounts of data, thus breaking through the limitations of the original data distribution. Currently, commonly used generative models mainly include Generative Adversarial Networks (GANs) and diffusion models. GANs typically consist of a generator and a discriminator. The generator is responsible for generating realistic image samples, while the discriminator distinguishes generated images from real images. Through adversarial training, the generator gradually learns the distribution characteristics of real data. For example, a multi-level generative adversarial network (CFM-GAN) proposed in existing technology refines the generated results through a multi-level structure, used to generate high-resolution images of power transmission line scenes with rich semantic details. Diffusion models, on the other hand, are trained by progressively adding noise to the image and then progressively denoising it, offering advantages in image generation quality and stability. The DetDiffusion model proposed in existing technology introduces perceptual attributes (PA Attr) during the generation process, making the generated images more suitable for object detection tasks, thereby improving the performance of subsequent detection models.

[0005] However, regardless of whether it is a simple transformation or a complex generative model, there are significant distribution differences between the generated "artificial samples" and the "real samples" collected during inspections, in terms of imaging conditions, background texture, and lighting noise, which is known as "domain differences".

[0006] In practical applications within the power industry, existing research typically mixes artificially generated defect samples with real-world defect samples as training data to improve model performance. For example, existing techniques propose a method for identifying the spontaneous explosion state of glass insulators based on hybrid data augmentation, improving the model's defect recognition ability by training both artificially generated and real samples. However, such methods generally face a key problem: artificially generated samples and real samples differ significantly in texture details, background structure, and imaging conditions. The distribution differences between samples from different sources accumulate during training, potentially limiting further improvement in the detection model's performance and even having a negative impact. To address this, existing techniques propose a cross-domain multi-level feature alignment network, treating artificial samples as source domain data and real samples as target domain data, and introducing an adversarial learning strategy to perform feature alignment at both the image and instance levels to reduce the feature distribution differences between artificial and real samples. Existing techniques have also made pioneering research in UDA for object detection, proposing a domain-adaptive Faster R-CNN detection model that achieves cross-domain feature alignment through adversarial training. Further, different alignment strategies are employed for global and local features, with strong alignment for local features and weak alignment for global features. Besides adversarial alignment methods, another type of research uses a teacher-student structure for cross-domain learning. This type of method generates pseudo-labels for target domain samples through a teacher network and uses these pseudo-labels to guide the student network's learning. Compared to purely adversarial learning, the teacher-student structure can uncover deeper semantic information. For example, the Adaptive Teacher (AT) method combines image-level feature alignment and pseudo-label adjustment mechanisms to improve the accuracy of defect detection while mitigating the distribution differences between the source and target domains. Existing techniques have constructed Harmonious Teacher models, which better coordinate the supervision signals between the source and target domains by imposing multiple consistency constraints at the category, spatial, and instance levels.

[0007] Although the above methods have improved the scale of training data and detection performance to some extent, cross-domain insulator defect detection still faces challenges in terms of stability and generalization ability due to the distribution differences between artificially generated samples and real-collected samples, and the fact that model training is susceptible to pseudo-label errors and difficult samples under unlabeled target domain conditions.

[0008] Based on existing research on insulator defect detection, artificial sample utilization, and cross-domain learning, the current technology has the following main shortcomings: (1) The distribution of artificial samples differs greatly from that of real samples, resulting in limited cross-domain generalization ability. Existing methods typically mix artificially generated insulator defect samples directly with real-world samples for model training, or perform cross-domain adaptation using simple feature alignment. However, due to significant differences between artificial and real samples in imaging conditions, background complexity, texture details, and noise characteristics, models tend to learn feature representations that are effective for artificial samples but lack generalization ability for real-world scenes, leading to decreased detection performance in practical inspection scenarios. The main reason for this is that existing methods focus primarily on overall feature or global distribution alignment, failing to adequately consider instance-level and semantic-level cross-domain differences, and lacking constraints on the stability of cross-domain features, making the models highly sensitive to changes in viewpoint, scale, and scene.

[0009] (2) The detection model is unstable and has difficulty adapting to changes across views and domains. In cross-domain defect detection tasks, detection models need to simultaneously address variations in shooting angles and scale, as well as distribution shifts caused by different data domains. However, current technologies typically train detection models based on a single view or a single prediction result, lacking cross-view compatibility. Figure 1 Explicit constraints on consistency and predictive stability. Therefore, when faced with different views or samples from different domains of the same defect target, the model is prone to inconsistent predictions, affecting the stability and reliability of the detection results.

[0010] (3) The pseudo-label-based teacher-student method is susceptible to noise and underutilizes low-confidence samples. Existing cross-domain detection methods based on a teacher-student structure typically involve a teacher network generating pseudo-labels for target domain samples and then filtering them using a confidence threshold. However, these methods generally suffer from the following problems: to reduce the impact of noise, a high confidence threshold is usually used for pseudo-label filtering, resulting in the direct discarding of a large number of low-confidence but potentially valuable difficult samples; the teacher network lacks a self-correction mechanism for low-confidence predictions, and prediction errors may gradually accumulate during iteration, thus affecting the training performance of the student network. The root cause lies in the fact that existing technologies have failed to effectively extract useful information contained in low-confidence instances and lack a mechanism to guide the teacher network to self-correct prediction biases.

[0011] (4) The instance-level cross-domain alignment process is unstable, and difficult instances are prone to causing negative migration. Some existing methods attempt to perform cross-domain feature alignment at the instance level, but in practical applications, the reliability and alignability of different instances vary. If some semantically ambiguous or noisy difficult samples are aligned too early or excessively, it can easily interfere with model training and even trigger negative transfer. Existing technologies generally lack dynamic control mechanisms for the instance alignment process, failing to gradually guide the alignment strategy according to the training stage and instance difficulty, resulting in insufficient stability of the cross-domain alignment process.

[0012] To address the shortcomings of existing technologies in utilizing artificial samples and detecting cross-domain insulator defects, there is an urgent need to provide a new method for detecting cross-domain insulator defects, in order to solve the problems of scarce real samples, significant differences in the cross-domain distribution of artificial samples, and insufficient model generalization ability. Summary of the Invention

[0013] The purpose of this application is to provide a method, device, medium and product for cross-domain insulator defect detection, which can improve the robustness and generalization ability of the insulator defect detection model in cross-domain scenarios.

[0014] To achieve the above objectives, this application provides the following solution: In a first aspect, this application provides a method for detecting defects in cross-domain insulators, the method comprising: Artificially generated labeled images of insulator defects are used as source domain data, while unlabeled real images of insulator defects are used as target domain data. A cross-domain detection model co-optimized by teachers and students is constructed based on structurally consistent teacher and student networks. Using source domain data and target domain data, a trained student network is obtained based on a teacher-student collaboratively optimized cross-domain detection model. The student network performs supervised learning using ground truth labels from the source domain data and unsupervised learning using pseudo-labels generated by the teacher from the unlabeled target domain data. A cross-view invariant representation module is introduced into the student network. This module applies weak and strong enhancements to the same source domain data to generate dual-view inputs and introduces cross-view... Figure 1 A consistency constraint mechanism is implemented for collaborative alignment of instance-level semantic alignment and spatial alignment. Semantic-aware weights are introduced to dynamically adjust the spatial alignment strength based on semantic consistency. A low-confidence prediction-driven self-optimization module is introduced in the teacher network. This module uses low-confidence predictions as anchors to expand the location of relatively reliable instances in the candidate set through position matching, and constructs a low-confidence self-calibration loss. Feature difference-aware weights are also introduced to highlight the contribution of difficult examples. A course-guided difficult example alignment module is also introduced in the student network. This module integrates course-based dynamic threshold filtering with instance-level difficult example weighting strategies, retaining more foreground instances in the early training phase to stabilize the alignment process, and focusing on high-confidence difficult examples in the later stages. Insulator defect detection results based on the trained student network.

[0015] Secondly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the cross-domain insulator defect detection method described above.

[0016] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the described method for detecting transdomain insulator defects.

[0017] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the aforementioned method for detecting transdomain insulator defects.

[0018] According to the specific embodiments provided in this application, this application has the following technical effects: This application provides a method, device, medium, and product for cross-domain insulator defect detection. It proposes a Teacher-Student Collaborative Optimization (TSCO) model for cross-domain detection. This application uses artificially generated insulator defect images as source domain data and a small number of unlabeled real insulator defect images as target domain data. Through a collaborative learning mechanism between the teacher and student networks, it achieves alignment of cross-domain feature distributions and improves detection performance. A Cross-View Invariance Enhancement (CVIE) module is introduced into the student network. By imposing semantic and spatial consistency constraints within the shared proposal space, it improves the model's representational stability under different enhanced view conditions. In the teacher network, a Low Confidence Driven Self-Refinement (LCSR) module is constructed. This module uses low-confidence instances to guide the model to gradually correct prediction biases, improving the reliability and utilization of pseudo-labels and effectively mining useful information from low-confidence difficult samples, avoiding over-reliance on high-confidence samples. Meanwhile, this application proposes a Curriculum-guided Hard Instance Alignment (CHIA) module, which uses dynamic thresholding to filter reliable foreground instances and applies weighted constraints to samples that are difficult to distinguish, achieving stable instance-level cross-domain feature alignment. This enables more refined and reliable cross-domain feature alignment between artificial and real samples while ensuring training stability. This application fully utilizes artificially generated samples without requiring manual annotation of real insulator defect images, effectively improving the robustness, generalization ability, and detection performance of the insulator defect detection model in cross-domain scenarios, while alleviating the problems of insufficient real samples and annotation difficulties. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic flowchart of a method for detecting defects in a cross-domain insulator according to an embodiment of this application; Figure 2 Images of partial insulator damage and broken pieces ( Figure 2 Part (a) is a source domain artificially synthesized image. Figure 2 (b) is the real image of the target domain. Figure 3 A schematic diagram of the cross-domain detection model structure optimized for teacher-student collaboration; Figure 4 This is a schematic diagram of the LCSR module and the CHIA module. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0023] In one exemplary embodiment, such as Figure 1 As shown, a method for detecting defects in trans-domain insulators is provided, comprising the following steps S101 to S104: Wherein: S101, use artificially generated labeled insulator defect images as source domain data and unlabeled real insulator defect images as target domain data; As a specific embodiment, the experiments in this application follow an unsupervised domain adaptation protocol, using labeled source domain images and unlabeled target domain images to train the model, and using labeled target domain images to test the model.

[0024] This application was validated on two datasets: insulator damage and insulator fragment loss. The target domain images for both datasets consisted of real-world drone images provided by a power plant; the damage dataset contained 276 real images of damaged insulators, and the fragment loss dataset contained 1324 real images of fragmented insulators. For each dataset, the target domain samples were randomly divided into training and testing sets in a 7:3 ratio. Specifically, in the damage dataset, 190 images were selected as the unlabeled target domain training set, supplementing the source domain images for model training, while the remaining 86 labeled images served as the testing set. In the fragment loss dataset, 1007 images were selected as the unlabeled target domain training set, and the remaining 317 labeled images served as the testing set. The source domain used the artificial image dataset of insulator defects released by the Smart Transmission Research Institute of Shanghai Jiao Tong University. This dataset was generated through simulation modeling in virtual 3D space and includes insulator defect images generated under different backgrounds, lighting conditions, and shooting angles. As the number of source domain samples increased, the model detection performance gradually improved; however, when the number of samples exceeded a certain threshold, the performance improvement tended to plateau. Therefore, considering both detection accuracy and training cost, 1200 images of damaged artificial insulators and 1732 images of detached artificial insulator pieces were selected as the source domain images for the two datasets, respectively; some source and target domain images are shown below. Figure 2 As shown.

[0025] S102, a cross-domain detection model co-optimized by teachers and students is constructed based on structurally consistent teacher and student networks; such as... Figure 3 As shown, this application proposes TSCO within the AT framework; S103, using source domain data and target domain data, a trained student network is obtained based on a teacher-student collaboratively optimized cross-domain detection model. The student network uses ground truth labels from the source domain data for supervised learning and unsupervised learning using pseudo-labels generated by the teacher from the unlabeled target domain data. A cross-view invariant representation module is introduced into the student network. This module applies weak and strong enhancements to the same source domain data to generate dual-view inputs and introduces cross-view... Figure 1A consistency constraint mechanism is implemented for collaborative alignment of instance-level semantic alignment and spatial alignment. Semantic-aware weights are introduced to dynamically adjust the spatial alignment strength based on semantic consistency. A low-confidence prediction-driven self-optimization module is introduced in the teacher network. This module uses low-confidence predictions as anchors to expand the location of relatively reliable instances in the candidate set through position matching, and constructs a low-confidence self-calibration loss. Feature difference-aware weights are also introduced to highlight the contribution of difficult examples. A course-guided difficult example alignment module is also introduced in the student network. This module integrates course-based dynamic threshold filtering with instance-level difficult example weighting strategies, retaining more foreground instances in the early training phase to stabilize the alignment process, and focusing on high-confidence difficult examples in the later stages. The parameters of the teacher network are updated through an exponential moving average of the parameters of the student network. This means there is mutual knowledge transfer between the teacher and student networks. During training, the teacher network does not update its parameters by directly calculating gradients via backpropagation. Student network parameters The exponential moving average (EMA) is used for iterative updates. This update method allows the teacher network to continuously integrate parameters from the historical student network during training, resulting in relatively smooth parameter changes and more stable prediction results in the target domain. The teacher network generates predictions on weakly augmented (e.g., random cropping, scaling, and flipping) views of the target domain to obtain relatively stable pseudo-labels. After confidence filtering and non-maximum suppression to eliminate duplicate prediction boxes, high-quality pseudo-labels are obtained to guide the student network's training in the target domain. The student network receives data from both the source and target domains simultaneously. For labeled source domain images, supervised loss is calculated using ground truth annotations; for target domain images, after applying strong augmentations (e.g., color jitter, blurring, and occlusion), unsupervised loss is learned using high-confidence pseudo-labels generated by the teacher network. The difference in input augmentation methods between the student and teacher networks ensures the stability of the pseudo-labels and the robustness of student training.

[0026] The training process of the student network based on the cross-view invariant representation module is as follows: Assuming for the input image Detection model (student network) Predicting the first Class probability distribution of each proposal and bounding box coordinates If the detection model For the input image and images The detection results satisfy the formula and formula ,in for If a transformation is performed, the model will have domain invariance.

[0027] By implementing the formula formula This enhances students' ability to generalize information from the internet. Firstly, for the same source domain image of an artificially synthesized insulator defect... Two views were obtained by applying strong enhancement and weak enhancement respectively, and denoted as follows: and .in, Indicates a weakly enhanced image. This represents a strongly enhanced image. Both are input into the student network feature extractor. The output yields the corresponding feature map. and In the RPN phase of the student network, only weak enhancement feature maps are used. Generate candidate boxes above: ; Then, the candidate boxes Mapping to strong feature maps and weak feature maps , obtain instance features and This ensures a consistent proposal space across different views, enabling instance-level detection alignment. (The last sentence appears to be incomplete and possibly refers to a separate point about matching candidate boxes.) The class prediction vector and bounding box prediction vector obtained from the instance feature input detection head under the two augmented views are denoted as follows: , and , Normalize the category prediction vectors under different views: ; ; To measure the consistency of the predicted distributions under the two views, a distribution difference metric is introduced, and the KL divergence is used to obtain the class consistency loss function: ; in, and These respectively represent the student networks under the same proposal in the [number]th [year]. Predicted probabilities on a class.

[0028] Furthermore, to ensure the spatial positioning of the predicted bounding boxes remains stable, this application designs bounding box consistency constraints. The positional differences of the predicted bounding boxes under different augmented views are measured using the intersection-union ratio (IUGR). ; in, This represents the intersection-union ratio (IU) between two detection boxes. In the design of consistency constraints, category consistency and bounding box consistency constrain the student network from the semantic and spatial levels, respectively. However, there may still be potential inconsistencies between category consistency and bounding box consistency: when there are significant differences in category predictions under different views, the semantic information itself is not yet stable. If strong consistency constraints are imposed on the bounding boxes at this stage, unreliable supervision signals may be introduced, thereby interfering with the spatial alignment optimization process. Therefore, this application follows the optimization principle of "semantic first, spatial second" to achieve more stable and effective optimization. To this end, this application designs a semantic-aware weight factor. : ; in, and The class prediction vectors are obtained by inputting instance features from the detection head in the same strong-weak augmented view. Semantic consistency across views is measured by normalizing the predicted class vectors and calculating cosine similarity. A weighting factor is introduced based on this metric. Adaptive adjustment of bounding box consistency constraints: When semantic consistency is low, reduce To avoid unreliable supervision; when semantic consistency is high, increase... To enhance spatial alignment and thus achieve stable and effective optimization under semantic guidance, the loss function of the cross-view invariance representation module specifically includes the following features to achieve joint constraints at the semantic and spatial levels: ; in, The consistency loss of the cross-view invariance characterization module, For class consistency loss, and The student networks under the same proposal are respectively in the first The predicted probability on the class, where K is the sum of all classes. For bounding box consistency loss, The crossover ratio between two detection frames. For semantic perception weighting factors, and To select the same candidate boxes respectively The instance features obtained under the two enhanced views are input into the detection head to obtain the category prediction vector. and For normalized and P represents the candidate boxes generated on the weakly enhanced feature map during the RPN stage of the student network. and To match identical candidate boxes The bounding box prediction vectors obtained by inputting instance features into the detection head under two enhanced views.

[0029] Furthermore, to improve the training stability of the student network, two types of source domain augmented images are introduced into the supervised learning process, thereby obtaining corresponding supervised losses. ; The training process of the teacher network based on the low-confidence prediction-driven self-optimization module is as follows: In teacher-student frameworks, the teacher network typically updates passively from the student network via exponential moving average (EMA). Its learning process primarily relies on high-confidence predictions to generate pseudo-labels, while a large number of low-confidence samples are ignored, limiting the model's discriminative ability in the target domain. To address this, this application proposes a low-confidence prediction-driven self-optimizing module (LCSR), such as... Figure 4 As shown, by applying consistency regularization to low-confidence predictions, the teacher network can proactively self-update using low-confidence samples. The LCSR module searches for potentially reliable samples through location matching for low-confidence predictions under weakly augmented views of the target domain, and then applies consistency constraints between the category prediction distributions of the weak-strong views. With this mechanism, the teacher network is no longer limited to passive updates of EMAs, but instead achieves self-optimization through low-confidence instances, generating higher-quality pseudo-labels.

[0030] Specifically, the weakly enhanced target domain real insulator defect image Input Teacher Network Feature Extractor , to obtain feature map Subsequently, through the regional recommendation network of the teacher network ( Generate a set of suggestion boxes: ; in, The number of proposal boxes is used. Each proposal box is mapped onto a feature map to obtain instance-level features, which are then input into the detector head of the teacher network to obtain the prediction results for the weakly enhanced image. ; in, Predicted class vector of a weakly enhanced image; It is the bounding box after regression; It is a region proposal box; This corresponds to the confidence score. Then, After post-processing (including) (and score filtering), set reliability thresholds The prediction results are further filtered based on the confidence score; those with a confidence score higher than a threshold are considered acceptable. The results are high-confidence predictions, and those below the threshold are low-confidence predictions. The following are low-confidence prediction results: ; ; Among them, the high confidence set Using pseudo-labels to guide students' online learning and thereby incurring unsupervised loss. Low confidence set This includes samples where category prediction is not stable but location information is relatively reliable. However, yes After NMS and confidence-based subset filtering, spatial neighborhood information is significantly compressed. Existing research shows that bounding box localization prediction is often more stable than class prediction; even with class uncertainty, candidate boxes still exhibit high reliability in spatial location. Meanwhile, traditional NMS may excessively suppress supporting instances that highly overlap with low-confidence boxes, resulting in the failure to utilize potentially useful information. Therefore, this application designs a method based on... Location-matching potential instance filtering mechanism in weakly enhanced prediction results In China, with Using the samples as anchors, potential instances are screened to obtain a set of potential samples with relatively reliable localization but uncertain category prediction. Specifically, for the low-confidence set... Prediction boxes in In the weakly enhanced prediction set Search for candidate boxes that are spatially similar to it, using Threshold controls the search range: ; For the enhanced target domain image Similarly, input the teacher network and share the proposal box set. To obtain the final prediction result. .

[0031] ; Further extraction and The corresponding prediction yields: ; And introduce it into the category prediction distribution of the corresponding weak-strong augmentation view Divergence constraint: ; Simultaneously, to enhance the optimization contribution of difficult samples, feature discrepancy-aware weights are introduced. For the proposal set... The first in For each instance, the corresponding teacher features under weak and strong augmentation views are denoted as follows: y and Perform feature analysis After normalization, calculate the cosine similarity: ; Based on this, dynamic weights are defined. : ; This is used to measure the degree of inconsistency between instance features under weak-strong views; the greater the feature difference, the higher its optimization weight. The final low-confidence self-optimizing loss is defined as: ; Building upon this, the teacher network is optimized using a combination of passive EMA updates and low-confidence-driven incremental self-updates. Specifically, the overall parameters of the teacher network are synchronized from the student network via EMA: ; in, This is the EMA smoothing coefficient, which is 0.9996 in the experimental settings of this application. Simultaneously, gradient updates with low-confidence self-optimizing loss are only introduced for the ROI Heads layer (detection head) of the teacher network: ; in, This strategy ensures the overall stability of the teacher network while gradually improving the consistency and reliability of pseudo-labels.

[0032] The training process for the course-guided difficult example alignment module is as follows: To mitigate the discrepancy in instance-level feature distribution between source domain synthesized insulator defect samples and target domain real samples, this application proposes an instance-level cross-domain feature alignment method oriented towards difficult examples, such as... Figure 4 As shown in (CHIA). Specifically, the source and target domain images are simultaneously input into the student network, where feature maps are obtained through a feature extractor, and then instance-level features are extracted by aligning the RPN (Region Proposal Network) with the RA (Region Alignment Network). The obtained instance features are uniformly denoted as... ,in, Indicates the first The first picture Individual instance characteristics; It may originate from either the source domain or the target domain, and its domain label is determined by... This paper argues that direct cross-domain alignment can easily introduce noise due to the large number of background instances in candidate regions. Furthermore, in cross-domain scenarios, some instances with high detection difficulty often have significant semantic uncertainty, and forced alignment may lead to negative transfer. To address this, this application constructs a comprehensive instance reliability metric and proposes a course-based instance filtering mechanism to dynamically filter candidate instances during the alignment phase: a lenient strategy is adopted in the early training stage to retain more candidate instances for alignment, improving the learning stability of the domain discriminator; in the later training stage, semantically unstable difficult samples are gradually filtered out, guiding the model to focus on semantically more stable instances, achieving coarse-to-fine cross-domain feature alignment.

[0033] Specifically, this application introduces a course-based dynamic threshold. And construct a comprehensive reliability metric. : ; ; in, Indicates the current iteration step. Indicates the maximum number of training steps. This represents the minimum threshold; setting it to 0 during the initial training phase indicates no filtering. This represents the maximum upper limit of the threshold. As training progresses, the threshold will gradually increase. r represents the course control index. A value greater than 1 indicates that the growth is slow in the early stage and fast in the later stage. In the early stage, the threshold is small, so more instances are introduced to stabilize the training. In the later stage, the contraction is accelerated, focusing on reliable instances. , , Indicates the current iteration step. Indicates the maximum number of training steps. By controlling the rate at which the threshold rises, the screening strategy is made more lenient in the early stages of training and gradually tightened in the later stages. and The first The first image The objectivity score and predicted class confidence of each candidate instance. The overall reliability of the instance... Higher than the current course threshold If the condition is met, it is reserved for cross-domain feature alignment; otherwise, the instance will be filtered.

[0034] Furthermore, this application constructs instance-level hard case weights. : ; This feature is used to characterize instances with strong foreground responses but uncertain semantic predictions. These instances are often more susceptible to differences in inter-domain distributions. By assigning them higher alignment weights, the model can pay more attention to potential cross-domain difficult instances.

[0035] The loss function of the difficult example alignment module in the course guidance specifically includes: ; in, For instance-level domain classification loss function, For instance-level hard cases, , and The first The first image The objectivity score and predicted class confidence of each candidate instance For domain tags, The predicted value for the feature domain of the filtered instance is N, where N is the number of images in the batch and M is the number of candidate instances in each image.

[0036] The total loss function of the trained student network specifically includes: ; in, For the total loss, The consistency loss of the cross-view invariance characterization module, The balance coefficient for the consistency loss of the cross-view invariance characterization module. For instance-level domain classification loss function, The balance coefficients of the instance-level domain classification loss function. To introduce the two source domain augmented images into the supervised learning process, the supervised loss is obtained. To monitor the balance coefficient of the loss, The unsupervised loss for the target domain under pseudo-label supervision by the teacher model. This is the balance coefficient for unsupervised loss.

[0037] As a specific embodiment, the experimental hardware configuration for training and testing in this application is an Nvidia GeForce RTX3090 graphics card, and the software environment is Ubuntu 20.04. Training is performed in a development environment using PyTorch 1.7.0, Torchvision 0.12.0, Python 3.8.3, and CUDA 0.8.1. The teacher-student collaborative optimization cross-domain detection model is based on the Faster R-CNN detection framework and the ResNet101 backbone network. Previous studies on domain adaptation have mostly used AP50 as the evaluation standard. Average precision (AP) is an indicator for measuring the performance of the teacher-student collaborative optimization cross-domain detection model, which is jointly determined by precision (P) and recall (R). The calculation methods for P and R are shown below: ; ; Where TP, FP, and FN represent the number of True Positives, False Positives, and False Negatives, respectively. The area under the PR curve, which is composed of precision and recall, is defined as AP, and the calculation formula is as follows: ; AP50 is the AP value when the confidence threshold is 0.5. In the experiment, it will be set to... , , , Set the confidence threshold for teacher online pseudo-labels to: In the LCSR module, for analyzing hyperparameters... The impact on model performance was investigated on two datasets. The model performed best in detection accuracy when a = 0.5. Therefore, the hyperparameter a was fixed at 0.5 in subsequent experiments. During the initialization phase of training, TSCO was trained using source labels for 10k iterations. Then, at the start of mutual learning, the weights were copied to the teacher and student networks, and TSCO was trained for 50k iterations. The application set the initial learning rate to 0.001 for 10k iterations throughout the training phase, and then reduced it to 0.0001. Stochastic gradient descent (SGD) was used to optimize the network. Data augmentation methods used included weak augmentation with random horizontal flipping, and strong augmentation with random color jitter, grayscale, Gaussian blur, and cropping patches. The weight smoothing coefficient parameter of the exponential moving average (EMA) of the teacher network was set to 0.9996. The batch size for each experiment was 4, consisting of 2 source domain artificial defect images and 2 real defect images.

[0038] Experimental results on a self-built dataset show that the proposed TSCO framework improves the AP50 of insulator breakage and piece drop by 9.68% and 7.06%, respectively, compared to the basic detection model trained only with artificial samples; and improves by 7.11% and 5.04% compared to the baseline model AT. Furthermore, its performance on public datasets also outperforms several mainstream domain-adaptive detection methods, fully validating the effectiveness and generalization ability of this method under conditions of insufficient real samples and no annotations.

[0039] S104, Insulator defect detection results based on the trained student network.

[0040] In an exemplary embodiment, a computer device is provided, which may be a server or a terminal. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The I / O interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for detecting cross-domain insulator defects.

[0041] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0042] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0043] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0044] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0045] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0046] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0047] In this application, all actions to acquire signals, information, or data are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with the authorization granted by the owner of the relevant device.

[0048] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0049] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for detecting defects in trans-domain insulators, characterized in that, The method for detecting defects in cross-domain insulators includes: Artificially generated labeled images of insulator defects are used as source domain data, while unlabeled real images of insulator defects are used as target domain data. A cross-domain detection model co-optimized by teachers and students is constructed based on structurally consistent teacher and student networks. Using source domain data and target domain data, a trained student network is obtained based on a teacher-student collaboratively optimized cross-domain detection model. The student network undergoes supervised learning using ground truth labels from the source domain data and unsupervised training using pseudo-labels generated by the teacher from the unlabeled target domain data. A cross-view invariant representation module is introduced into the student network. This module applies weak and strong enhancements to the same source domain data to generate dual-view inputs and introduces a cross-view consistency constraint mechanism for collaborative alignment of instance-level semantic alignment and spatial alignment. Simultaneously, semantically aware weights are introduced based on semantic consistency. The spatial alignment strength is dynamically adjusted. A low-confidence prediction-driven self-optimization module is introduced into the teacher network. This module uses low-confidence prediction as an anchor point to expand the location of relatively reliable instances in the candidate set through position matching, and constructs a low-confidence self-calibration loss. It also introduces feature difference-aware weights to highlight the contribution of difficult examples. A course-guided difficult example alignment module is also introduced into the student network. This module integrates course-based dynamic threshold filtering with instance-level difficult example weighting strategies, retaining more foreground instances in the early training phase to stabilize the alignment process, and focusing on high-confidence difficult examples in the later stages. Insulator defect detection results based on the trained student network.

2. The method for detecting defects in trans-domain insulators according to claim 1, characterized in that, The parameters of the teacher network are updated using an exponential moving average of the parameters of the student network.

3. The method for detecting defects in trans-domain insulators according to claim 1, characterized in that, The loss function of the cross-view invariance representation module specifically includes: ; in, The consistency loss of the cross-view invariance characterization module, For class consistency loss, For semantic perception weighting factors, P represents the bounding box consistency loss, where P is the candidate box generated on the weakly enhanced feature map during the RPN stage of the student network.

4. The method for detecting defects in trans-domain insulators according to claim 1, characterized in that, The loss function of the low-confidence prediction-driven self-optimization module specifically includes: ; in, For low-confidence self-optimizing loss, For dynamic weights, , For use Threshold controls the search range. for divergence constraint, and Let k be the predicted distribution of the k-th proposal in the teacher model under the weak-strong view. and Let k be the instance feature of the k-th proposal in the teacher model under the weak-strong view.

5. The method for detecting defects in trans-domain insulators according to claim 1, characterized in that, The loss function of the difficult example alignment module in the course guidance specifically includes: ; in, For instance-level domain classification loss function, For instance-level hard cases, , and The first The first image The objectivity score and predicted class confidence of each candidate instance For domain tags, The predicted value for the feature domain of the filtered instance is N, where N is the number of images in the batch and M is the number of candidate instances in each image.

6. The method for detecting defects in trans-domain insulators according to claim 5, characterized in that, The course-guided difficult example alignment module utilizes formulas. Introducing a course-based dynamic threshold and using the formula Build a comprehensive reliability metric ; in, Indicates the current iteration step. Indicates the maximum number of training steps. This represents the minimum threshold; setting it to 0 during the initial training phase indicates no filtering. This represents the maximum upper limit of the threshold, which gradually increases as training progresses. r represents the course control index, with a value greater than 1 indicating slow growth in the early stages and rapid growth in the later stages. In the early stages, a smaller threshold introduces more instances for stable training, while in the later stages, the contraction accelerates, focusing on reliable instances.

7. The method for detecting defects in trans-domain insulators according to claim 1, characterized in that, The total loss function of the trained student network specifically includes: ; in, For the total loss, The consistency loss of the cross-view invariance characterization module, The balance coefficient for the consistency loss of the cross-view invariance characterization module. For instance-level domain classification loss function, The balance coefficients of the instance-level domain classification loss function. To introduce the two source domain augmented images into the supervised learning process, the supervised loss is obtained. To monitor the balance coefficient of the loss, The unsupervised loss for the target domain under pseudo-label supervision by the teacher model. This is the balance coefficient for unsupervised loss.

8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the transdomain insulator defect detection method according to any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method for detecting transdomain insulator defects as described in any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the method for detecting transdomain insulator defects as described in any one of claims 1-6.