Insulator detection model construction method and system based on feature spectrum transfer learning

By using feature spectral transfer learning, spectral correlation graph neural networks, and adversarial training in the conditional domain, the problem of spectral distribution shift in insulator detection models under different sensor band configurations was solved. This achieved efficient cross-domain adaptation and improved detection accuracy, while reducing annotation costs.

CN122391929APending Publication Date: 2026-07-14HUANENG (FUJIAN) ENERGY DEVELOPMENT LIMITED COMPANY FUZHOU BRANCH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610514524.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-17
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing insulator detection methods suffer from spectral distribution shifts due to differences in sensor band configurations and response characteristics. Source domain models are difficult to transfer to the target domain, target domain annotation costs are high, defect sample distribution is uneven, and existing domain adaptation methods are prone to mixing insulator body and background features during overall feature alignment. Furthermore, they do not explicitly characterize band dependencies and lack a unified and repeatable construction process.

Method used

We employ a feature-based spectral transfer learning approach, which explicitly models band dependencies through a spectral correlation graph neural network. We introduce class-conditional domain adversarial training to construct stable class-conditional features and implement adversarial training through gradient inversion. This results in an iterative class prototype library that can be maintained, achieving trainable domain alignment and class-conditional constraints between the source and target domains.

Benefits of technology

It significantly improves the generalization performance and detection accuracy of insulator detection models in cross-domain scenarios, reduces the cost of target domain annotation, provides a unified model building and deployment process, and ensures effective adaptation of models under different spectral acquisition conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391929A_ABST
    Figure CN122391929A_ABST
Patent Text Reader

Abstract

The application discloses a kind of insulator detection model construction method and system based on feature spectrum transfer learning, it is related to deep learning and transfer learning technical field.The method is modeled into graph node by spectral correlation graph neural network Spectral-GNN, generates adjacent matrix using learnable edge weight generator, and outputs spectral structure embedding;Introduce global domain discriminator and class conditional domain discriminator to realize double domain adversarial training, construct class conditional features based on class prototype library through class gating mechanism;Source domain detection supervision loss, global domain adversarial loss and class conditional domain adversarial loss constitute joint loss and update model parameters.The application can realize the adaptive construction of cross-domain deep learning detection model under the condition of insufficient target domain labeling by explicitly modeling band dependency, combined with class-level domain adversarial training, significantly improve the generalization performance and detection accuracy of insulator detection model in cross-domain scenarios, reduce the labeling cost of target domain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of deep learning and transfer learning technology, specifically to a method and system for constructing an insulator detection model based on feature spectral transfer learning. Background Technology

[0002] Insulators in transmission lines and substations are exposed to the elements for extended periods, making them susceptible to contamination, humidity fluctuations, aging and cracking, damage and missing parts, and hardware obstruction. Maintenance units typically use drones or ground-based inspections to acquire image data and identify defects. Existing insulator inspection methods primarily rely on visible light images, which are significantly affected by variations in lighting, backlighting, complex backgrounds, and changes in target size.

[0003] To improve detection accuracy, some solutions introduce multispectral or hyperspectral data, leveraging the differences in material reflectance across different spectral bands to enhance target characterization. However, variations in spectral distribution due to different regions, seasons, shooting altitudes, and sensor band settings and response characteristics can lead to shifts in spectral distribution, making it difficult to directly transfer deep learning detection models trained in the source domain to the target domain. Furthermore, the annotation cost of multispectral or hyperspectral data is high, and the uneven distribution of defect samples makes it difficult to stably build usable models using conventional supervised training or direct fine-tuning methods when annotations are lacking in the target domain.

[0004] Existing domain adaptation methods often employ a global feature alignment strategy. For example, Domain Adversarial Neural Networks (DANNs) use gradient inversion layers to generate domain-invariant features from the feature extractor. However, this approach easily mixes insulator features with background features, leading to semantic confusion regarding categories. Furthermore, existing methods typically treat spectral vectors as independent-dimensional inputs to convolutional networks, failing to explicitly characterize the dependencies and structural information between bands. This results in a lack of a unified and repeatable construction process for adapting models to changes in band configuration and sensor differences.

[0005] Therefore, a new technical solution is needed to realize the cross-domain construction and deployment of insulator detection models under the conditions that there are differences between the spectral data of the source domain and the target domain and the target domain is not sufficiently labeled, in order to improve the generalization performance and detection accuracy of insulator detection models in cross-domain scenarios. Summary of the Invention

[0006] The purpose of this application is to provide a method and system for constructing an insulator detection model based on feature spectral transfer learning, in order to solve the problems in the existing technology, such as spectral distribution shift caused by differences in the configuration and response characteristics of different sensor bands, difficulty in transferring source domain models to the target domain, high target domain annotation cost, uneven distribution of defect samples, easy mixing of insulator body and background features in the overall feature alignment of existing domain adaptation methods, low domain alignment accuracy, and lack of explicit characterization of band dependencies and a unified and repeatable construction process.

[0007] Therefore, this application aims to propose a method and system for constructing an insulator detection model based on feature spectral transfer learning, which is used to construct an insulator detection model under the condition that there are differences between the spectral data of the source domain and the target domain and the target domain is insufficiently labeled. To this end, this application needs to solve the following technical problems: First, how to introduce a domain adversarial mechanism in the training process of the deep learning detection model, so as to achieve trainable domain alignment between the source domain and the target domain in the feature space, and extend the alignment process from the overall distribution constraint to the category condition constraint, so as to adapt to the distribution differences of different categories such as insulator body, hardware, dirt, damage and background.

[0008] Secondly, how to explicitly model the correlation structure between bands during the spectral feature extraction stage, represent the band dependencies as a graph structure, and perform message passing and aggregation through a spectral correlation graph neural network to form a spectral structure embedding that can be used for the detection head.

[0009] Third, how to construct stable class-conditional features and maintain an iterative class prototype library in class-conditional adversarial training, so that the input of the class-conditional domain discriminator has a definite class association method and update rules, and forms a complete training closed loop with the generation process of candidate region features in the two-stage detection structure.

[0010] To solve the above-mentioned technical problems, this application provides the following technical solution: Firstly, a method for constructing an insulator detection model based on feature spectral transfer learning, comprising, Acquire source domain spectral data and corresponding insulator detection labeling information, and acquire target domain spectral data; The source domain spectral data and the target domain spectral data are preprocessed to form training input samples; A deep learning detection model is constructed, which includes a feature extraction network, a detection head network, a global domain discriminator, and a class conditional domain discriminator. The source domain detection supervision loss is calculated based on the source domain spectral data and its corresponding detection annotation information; the method for calculating the class conditional domain adversarial loss is as follows: a class prototype library containing multiple class prototype vectors is established; based on the similarity between the candidate region features output by the detection head network and the prototype vectors of each class, a class gating coefficient vector is generated; the candidate region features are weighted using the class gating coefficient vector to construct multiple class condition features that correspond one-to-one with each preset class; the multiple class condition features are respectively input into the sub-discriminators of the corresponding class in the class conditional domain discriminator to calculate the class conditional domain adversarial loss; Calculate the global domain adversarial loss and the class-conditional domain adversarial loss based on the source domain spectral data and the target domain spectral data; The parameters of the deep learning detection model are updated based on the joint loss, and the trained insulator detection model is output.

[0011] As an optional scheme of the insulator detection model construction method based on feature spectrum transfer learning described in this application, the preprocessing includes performing normalization processing on each band data of each input sample to obtain a normalized band vector. Generate wavelength position encoding vectors based on the center wavelength of each band; The band signal-to-noise ratio indicator and band saturation flag are calculated based on the original spectral data of the input sample. The normalized band vector, the wavelength position encoding vector, the band signal-to-noise ratio indicator, and the band saturation flag are concatenated along the feature dimension to form the input tensor.

[0012] As an optional solution to the insulator detection model construction method based on feature spectral transfer learning described in this application, the feature extraction network includes a spectral correlation graph neural network (Spectral-GNN) and a spatial feature extraction sub-network. The Spectral-GNN performs graph message passing on the spectral part of the input tensor to output a spectral structure embedding, and the spatial feature extraction subnetwork performs convolutional feature extraction on the input tensor to output a spatial feature embedding. The spectral structure embedding and the spatial feature embedding are fused by the fusion module to form a fusion feature for the detection head network.

[0013] As an optional scheme of the insulator detection model construction method based on feature spectral transfer learning described in this application, wherein: the Spectral-GNN constructs a band graph with each band of the spectral data corresponding to a graph node, and uses a learnable edge weight generator to generate an adjacency matrix; The learnable edge weight generator performs linear mapping on the node features and then calculates the dot product attention score. The attention score is then normalized by Softmax to obtain the edge weight. For each graph node, only the K connections with the largest edge weights are retained to form a sparse adjacency matrix, which is used for graph message passing.

[0014] As an optional solution to the insulator detection model construction method based on feature spectral transfer learning described in this application, the detection head network is a two-stage detection structure, including a Region Proposal Network (RPN) and a Region Feature Extraction Module. The Region Proposal Network (RPN) generates candidate regions based on the fused features. The region feature extraction module performs region alignment on the candidate regions to obtain candidate region features. The candidate region features are used as inputs to the classification branch and the bounding box regression branch to output the class probability vector and the bounding box regression value.

[0015] As an optional scheme of the insulator detection model construction method based on feature spectral transfer learning described in this application, wherein: the global domain adversarial loss and the class-conditional domain adversarial loss are trained adversarially through a gradient inversion layer, and the gradient inversion layer is set between the fused features and the global domain discriminator and between the class-conditional features and the sub-discriminator.

[0016] As an optional scheme of the insulator detection model construction method based on feature spectral transfer learning described in this application, wherein: the global domain discriminator takes the global convergence vector of the fused features as input and outputs the domain discrimination result; The sub-discriminators take the corresponding class-conditional features as input and output the domain discrimination result. The joint loss is composed of the weighted sum of the source domain detection supervision loss, the global domain adversarial loss and the class-conditional domain adversarial loss and is used to update the parameters of the deep learning detection model.

[0017] Secondly, this application provides an insulator detection model construction system based on feature spectral transfer learning.

[0018] To better address the technical issues, this application provides the following technical solution: an insulator detection model construction system based on feature spectral transfer learning, comprising: a feature extraction module, a detection head module, a global domain discrimination module, a class conditional domain discrimination module, and a joint optimization and prototype update module; The feature extraction module is used to receive the preprocessed spectral input tensor, which includes a spectral correlation graph neural network Spectral-GNN and a spatial feature extraction sub-network, and outputs spectral structure embedding and spatial feature embedding respectively, which are then fused to form a fused feature. The detection head module takes the fused features as input to perform a two-stage detection process, generates candidate regions and extracts the features of the candidate regions, and outputs the category probability vector and bounding box regression of the candidate regions for detection result generation and source domain supervised training. The global domain discrimination module is used to perform global convergence on the fused features of the source domain and the target domain to obtain a global feature vector, and output the domain discrimination result, which is used to calculate the global domain adversarial loss and participate in adversarial training. The class conditional domain discrimination module calculates class gating coefficients and constructs class conditional features based on candidate region features and class prototype library. It inputs the class conditional features into the sub-discriminators corresponding to each class to output the domain discrimination results, which are used to calculate the class conditional domain adversarial loss and participate in adversarial training. The joint optimization and prototype update module is used to construct a joint loss based on the source domain detection supervision loss, the global domain adversarial loss, and the class conditional domain adversarial loss and update the model parameters. At the same time, it performs category aggregation and exponential sliding update rules on the target domain candidate region features that meet the confidence threshold and updates the class prototype library.

[0019] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the aforementioned method for constructing an insulator detection model based on feature spectral transfer learning.

[0020] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned method for constructing an insulator detection model based on feature spectral transfer learning.

[0021] The beneficial effects of this application are as follows: Compared with the prior art, this application provides a deep learning detection model construction process for spectral data. It combines the spectral structure modeling of the spectral correlation graph neural network with the conditional adversarial domain adaptation training in a unified end-to-end training framework. By using each band as a graph node and learning a sparse adjacency matrix for message passing, it can form a spectral structure embedding containing band dependencies in the feature extraction stage. After being fused with spatial features, it is input into the detection head to complete the classification and regression of candidate regions.

[0022] Furthermore, this application introduces a global domain discriminator and a class-conditional domain discriminator set according to a fixed set of categories, and uses gradient inversion to achieve adversarial training. This allows the model to be subject to both detection supervision constraints and domain discrimination constraints during training. By constructing class-conditional features through class prototype gating and setting prototype initialization, confidence threshold screening, and exponential sliding update rules, the input for class-conditional adversarial training forms a repeatable construction method and maintains a correspondence with candidate region features. This facilitates the construction and deployment of the insulator detection model according to a unified process under different spectral acquisition conditions.

[0023] The technical solutions provided by the embodiments of this application also achieve the following beneficial effects: (1) The band dependency relationship is explicitly modeled by the Spectral-GNN, each band is used as a graph node, a learnable edge weight generator is used to generate a sparse adjacency matrix, and the spectral structure is embedded by the graph message passing, so that the inter-band dependency strength is used as a learnable parameter to participate in training and updating, and the model has a clear structured adaptation capability to different sensor band configurations and scene spectral morphology changes. (2) By training adversarial training of class conditional domains, a class conditional domain discriminator is set up. A class prototype library is built based on a fixed set of five categories. Class conditional features are constructed through a class prototype gating mechanism. The domain alignment constraint is extended from overall distribution to a discrimination task decomposed by category, avoiding the mixing of insulator body and background features and improving the accuracy of cross-domain feature alignment. (3) The confidence threshold screening and exponential sliding update mechanism of the class prototype library ensure the stability and repeatability of the class condition feature construction, so that the model can still form an effective category semantic representation even when the target domain annotation is insufficient. (4) Compared with existing methods, this application completes model construction and deployment according to a unified process under different spectral acquisition conditions, which significantly improves the generalization performance and detection accuracy of the insulator detection model in cross-domain scenarios, reduces the target domain labeling cost, and provides an implementable transfer learning solution for multispectral insulator detection.

[0024] It is understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of 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.

[0026] Figure 1 This is a flowchart illustrating an insulator detection model construction method based on feature spectral transfer learning, provided as an embodiment of this application. Detailed Implementation

[0027] To make this application more apparent and understandable, the specific embodiments of this application are described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of this application.

[0028] It should be noted that the terms used in the following embodiments are defined as follows: The source domain refers to the spectral data acquisition domain with complete annotation information, and the target domain refers to the unannotated or poorly annotated spectral data acquisition domain to be adapted. Spectral structure embedding refers to the feature vector formed after modeling band dependence through a spectral correlation graph neural network; Class conditional features refer to candidate region features that are constructed through a class prototype gating mechanism and semantically bound to a specific class. Domain adversarial training refers to a training mechanism that uses gradient inversion layers to enable feature extraction networks to generate domain-invariant features that can confuse domain discriminators.

[0029] Example 1, referring to Figure 1 This is one embodiment of the present application, which provides a method for constructing an insulator detection model based on feature spectral transfer learning, including: S100: Obtain source domain spectral data and corresponding insulator detection labeling information, and obtain target domain spectral data.

[0030] S200: Preprocess the source domain spectral data and the target domain spectral data to form training input samples.

[0031] S300: Construct a deep learning detection model, which includes a feature extraction network, a detection head network, a global discriminator, and a class conditional discriminator.

[0032] S400: Calculate the source domain detection supervision loss based on the source domain spectral data and its corresponding detection annotation information.

[0033] S500: Calculate the global domain adversarial loss and the class-conditional domain adversarial loss based on the source domain spectral data and the target domain spectral data.

[0034] S600: Update the parameters of the deep learning detection model based on the joint loss and output the trained insulator detection model.

[0035] In the above method, source and target domain spectral data are acquired, and simple differences are eliminated through unified preprocessing, allowing the subsequent model to focus on learning complex domain shifts. The input spectral image is mapped to a high-dimensional feature space, which should be insensitive to domain shifts. Based on the features, the insulator location and category are output, and supervised training is only possible in the source domain. A global domain discriminator distinguishes whether features originate from the source or target domain; through adversarial training, the feature extractor generates features that "deceive" the discriminator, thereby eliminating overall domain differences. A class-conditional domain discriminator forces the feature extractor to achieve domain alignment within each category, preserving fine-grained discriminative information. The detection loss is calculated using source domain annotations to ensure the model has basic detection capabilities. Global domain adversarial loss encourages the feature extractor to confuse the global domain discriminator, making the feature distributions of the source and target domains generally similar. Class-conditional domain adversarial loss encourages the feature extractor to confuse the class-conditional domain discriminator, making the cross-domain distribution of similar samples consistent. The final output is an insulator detection model that can be directly applied to the target domain.

[0036] Example 2, an embodiment of this application, provides a method for constructing an insulator detection model based on feature spectral transfer learning, based on the previous embodiment, including: S100: Obtain source domain spectral data and corresponding insulator detection labeling information, and obtain target domain spectral data.

[0037] S200: Preprocess the source domain spectral data and the target domain spectral data to form training input samples.

[0038] S201: The preprocessing includes performing normalization processing on each band data of each input sample to obtain a normalized band vector, and generating a wavelength position encoding vector based on the center wavelength of each band.

[0039] S202: Calculate the band signal-to-noise ratio indicator and band saturation flag based on the original spectral data of the input sample.

[0040] The normalized band vector, the wavelength position encoding vector, the band signal-to-noise ratio indicator, and the band saturation flag are concatenated along the feature dimension to form the input tensor.

[0041] S300: Construct a deep learning detection model, which includes a feature extraction network, a detection head network, a global discriminator, and a class conditional discriminator.

[0042] S301: The feature extraction network includes a spectral correlation graph neural network (Spectral-GNN) and a spatial feature extraction subnetwork; the spectral correlation graph neural network (Spectral-GNN) performs graph message passing on the spectral part of the input tensor to output a spectral structure embedding, and the spatial feature extraction subnetwork performs convolutional feature extraction on the input tensor to output a spatial feature embedding.

[0043] The spectral structure embedding and the spatial feature embedding are fused by the fusion module to form a fusion feature for the detection head network.

[0044] S302: The Spectral-GNN constructs a band graph with each band of the spectral data corresponding to a graph node, and uses a learnable edge weight generator to generate an adjacency matrix; the learnable edge weight generator performs linear mapping on the node features and calculates the dot product attention score, and the attention score is normalized by Softmax to obtain the edge weight; for each graph node, only the K connections with the largest edge weights are retained to form a sparse adjacency matrix, and the sparse adjacency matrix is ​​used for graph message passing.

[0045] S303: The initial node features of each node in the band diagram are obtained by splicing the following components: the normalized reflectance value of the corresponding band, the first-order difference of the normalized reflectance value of the corresponding band, the second-order difference of the normalized reflectance value of the corresponding band, the position code of the center wavelength of the corresponding band, the signal-to-noise ratio indicator of the corresponding band, and the saturation flag of the corresponding band.

[0046] Furthermore, the detection head network is a two-stage detection structure, including a Region Proposal Network (RPN) and a Region Feature Extraction module. The RPN generates candidate regions based on the fused features, and the Region Feature Extraction module performs region alignment on the candidate regions to obtain candidate region features. The candidate region features are used as inputs to the classification branch and the bounding box regression branch to output the class probability vector and the bounding box regression value.

[0047] S304: The category set corresponding to the category probability vector consists of five categories and is fixed as insulator body category, hardware category, dirt category, damage category, and background category. The class conditional domain discriminator consists of five sub-discriminators and corresponds to each of the above five categories respectively. The candidate region features are constructed into class conditional features related to the category before being input into the five sub-discriminators.

[0048] The class condition features are constructed using a class prototype gating method. Specifically, a class prototype library containing five class prototype vectors is established, with each class corresponding to one class prototype vector. The candidate region features based on the source domain labeled samples are averaged by class to initialize the corresponding class prototype vector.

[0049] For each candidate region feature, its similarity to the prototype vectors of the five categories is calculated and normalized by Softmax to obtain a five-dimensional class gating coefficient vector. The candidate region feature is multiplied by each dimension component of the five-dimensional class gating coefficient vector to obtain five class condition features. The five class condition features are respectively input to five sub-discriminators corresponding to their respective categories.

[0050] The global adversarial loss and the class-conditional adversarial loss are trained adversarially through a gradient inversion layer, which is positioned between the fused features and the global discriminator, and between the class-conditional features and the sub-discriminators. The class-conditional adversarial loss is calculated as follows: a class prototype library containing multiple class prototype vectors is established; based on the similarity between the candidate region features output by the detection head network and each class prototype vector, a class gating coefficient vector is generated; the candidate region features are weighted using the class gating coefficient vector to construct multiple class-conditional features corresponding one-to-one with each preset class; the multiple class-conditional features are respectively input into the sub-discriminators of the corresponding class in the class-conditional discriminator to calculate the class-conditional adversarial loss.

[0051] S400: Calculate the source domain detection supervision loss based on the source domain spectral data and its corresponding detection annotation information.

[0052] In this embodiment, calculating the source domain detection supervision loss based on the source domain spectral data and its corresponding detection annotation information does not simply refer to performing conventional classification and regression to calculate the loss of the detection head output. Instead, it involves structurally binding the source domain annotation information with the output of the spectral correlation graph neural network around the training link of spectral structure embedding participating in detection supervision, forming a supervision and constraint system that can guide the learning of spectral graph edge weights, the generation of spectral structure embedding, and the synchronous convergence of detection head classification and regression.

[0053] S401: The source domain spectral data is first preprocessed to form an input tensor. The input tensor contains normalized band vectors and wavelength position codes, along with band signal-to-noise ratio indicators and band saturation flags calculated from the original spectral data. These information together constitute the initial node features of the band graph nodes. In Spectral-GNN, a sparse adjacency matrix is ​​formed based on a learnable edge weight generator, and graph message passing is performed to obtain the spectral structure embedding.

[0054] In parallel, the spatial feature extraction sub-network obtains spatial embeddings, and the two are fused together by a fusion module to form fused features. These fused features serve as the unified input to the detection head network, enabling the backpropagation of the source domain detection supervision loss to the model parameters to simultaneously affect the spatial sub-network parameters, the fusion module parameters, and the node transformation parameters and edge weight generator parameters of the Spectral-GNN. To clarify the calculation process of the detection supervision loss, The feature extraction network includes a spectral correlation graph neural network Spectral-GNN. The Spectral-GNN constructs a band graph with each band of the spectral data corresponding to a graph node, and uses a learnable edge weight generator to generate an adjacency matrix. For each graph node, only the K connections with the largest edge weights are retained to form a sparse adjacency matrix, which is used for graph message passing.

[0055] S402: A two-stage detection structure is adopted in the detection head network. The Region Proposal Network (RPN) generates a set of candidate regions with the fusion features as input and outputs the target score and candidate box parameters corresponding to the candidate regions. The candidate region features of each candidate region are extracted from the fusion features through the region alignment operation. The candidate region features are input into the classification branch to obtain the category probability vector and input into the bounding box regression branch to obtain the bounding box regression value.

[0056] Furthermore, the source domain detection annotation information includes at least the true bounding box and true category label of the insulator-related target. This application uses the overlap between the candidate region and the true bounding box as the basis for sample allocation, determines the candidate region that meets the allocation rule as a positive sample, and determines the candidate region that does not meet the allocation rule as a negative sample, and calculates the classification loss and regression loss respectively based on the allocation result.

[0057] The classification loss is calculated by taking the category probability vector output by the candidate region classification branch and the true category label as input, giving a single label to each candidate region according to a preset category set, and calculating the loss in the form of cross-entropy.

[0058] It should be noted that the preset category set is fixed at five categories: insulator body category, hardware category, dirt category, damage category, and background category. The determination of this set is based on the target object decomposition logic of the insulator inspection task.

[0059] The insulator body category corresponds to the ceramic material portion or composite material skirt portion of the insulator. This category exhibits stable spectral response characteristics in the visible to near-infrared band. The fitting category corresponds to three types of metal components: equalizing rings, vibration dampers, and connecting fittings. This category exhibits the high reflectivity characteristic unique to metal materials and has spectral absorption peaks in the short-wave infrared band that differ from ceramic materials. The contamination category corresponds to three types of surface foreign matter on the insulator surface: dirt, salt crystals, and biological deposits. This category exhibits abnormal absorption in specific wavelength bands. The damage category corresponds to three types of structural integrity defects: cracks, breaks, and missing parts. This category exhibits discontinuities in the local spectral curve. The background category corresponds to three types of non-insulator-related targets: sky, transmission towers, and vegetation. This category exhibits spectral response patterns completely different from those of insulator-related targets.

[0060] The true category label values ​​in the insulator inspection annotation information are limited to a preset category set. For each insulator target annotated in the source domain spectral data, its true category label is assigned a unique value from the insulator body category, hardware category, contamination category, damage category, and background category. When multiple physical objects exist at the same spatial location in the source domain spectral data, the true category label of the bounding box is determined according to the category of the physical object occupying the largest area of ​​the annotation bounding box.

[0061] The number of categories in the preset category set is equal to the number of sub-discriminators in the class-conditional domain discriminator. The class-conditional domain discriminator consists of five sub-discriminators, corresponding to the insulator body category, hardware category, dirt category, damage category, and background category, respectively. Each sub-discriminator is specifically responsible for the domain discrimination task of its corresponding category.

[0062] In the initialization of the class prototype library, the number of class prototype vectors is set to five, with each class prototype vector corresponding to one category in a preset category set. The insulator body category corresponds to the first class prototype vector, the fittings category to the second, the dirt category to the third, the damage category to the fourth, and the background category to the fifth. The initialization of the class prototype vectors is achieved by averaging the candidate region features of the source domain labeled samples by category. The average of all candidate region features in the source domain spectral data with the true category label of insulator body is used as the initial value of the first class prototype vector; the average of all candidate region features with the true category label of fittings is used as the initial value of the second class prototype vector; the average of all candidate region features with the true category label of dirt is used as the initial value of the third class prototype vector; the average of all candidate region features with the true category label of damage is used as the initial value of the fourth class prototype vector; and the average of all candidate region features with the true category label of background is used as the initial value of the fifth class prototype vector.

[0063] When constructing class-conditional features, each candidate region feature calculates its similarity to the prototype vectors of the five categories, and then normalizes it using Softmax to obtain a five-dimensional class-gating coefficient vector. The first component of the five-dimensional class-gating coefficient vector corresponds to the insulator body category, the second component to the fitting category, the third component to the pollution category, the fourth component to the damage category, and the fifth component to the background category. The candidate region feature is multiplied by each component of the five-dimensional class-gating coefficient vector to obtain five class-conditional features. The first class-conditional feature is input to the sub-discriminator responsible for the insulator body category, the second class-conditional feature is input to the sub-discriminator responsible for the fitting category, the third class-conditional feature is input to the sub-discriminator responsible for the pollution category, the fourth class-conditional feature is input to the sub-discriminator responsible for the damage category, and the fifth class-conditional feature is input to the sub-discriminator responsible for the background category.

[0064] During model training and inference, the preset category set remains fixed. During training, the number of sub-discriminators in the class conditional domain discriminator, the number of category prototype vectors in the class prototype library, and the number of output neurons in the classification branch of the detection head network are all kept at five. During inference, the category probability vector output from the detection of the target domain spectral data is a five-dimensional vector, with each dimension corresponding to a category in the preset category set. The final predicted category label is selected from the insulator body category, hardware category, dirt category, damage category, and background category.

[0065] The regression loss is calculated using the bounding box regression value output by the candidate region regression branch and the true bounding box as input. First, the true bounding box is parameterized and encoded, and then the SmoothL1 form loss is calculated with the regression value.

[0066] It should be noted that in the two-stage structure, the supervision loss corresponding to the target score and candidate box regression in the RPN stage can also be calculated and combined with the classification loss and regression loss in the RoI stage to form the source domain detection supervision loss. The above process is superficially similar to that of a conventional two-stage detector, but the focus of this embodiment is that the source domain detection supervision loss directly constrains the formation and update of the learnable sparse adjacency matrix in the spectral correlation graph neural network on the backpropagation path.

[0067] S403: Since the fused features are composed of both spectral structure embedding and spatial embedding, the dependence of the classification probability and bounding box regression of the candidate region on the spectral structure embedding means that the gradients of the classification loss and regression loss not only update the transformation weights of the node features, but also drive the edge weight generator to learn a band-dependent structure that is discriminative for the detection task. This means that the connection weights between certain band nodes are strengthened or weakened during training, thereby converting the detection annotation information into a structured supervision signal for the band relationship graph. This supervision signal is not represented by additional manually selected bands or fixed neighborhoods, but is naturally passed to the spectral graph structure learning module through the detection objective function at the candidate region level. This allows the detection supervision loss to not only supervise the correctness of the detection head output, but also supervise the formation method of the spectral structure representation.

[0068] S404: In the construction of candidate region features and loss calculation, node feature components related to spectral reliability are introduced. That is, after the signal-to-noise ratio indicator and saturation flag are included in the initial features of the nodes, the backpropagation of the loss function can enable Spectral-GNN to learn how to process low-reliability band features when calculating edge weights and aggregation information, forming a spectral structure embedding consistent with the detection annotation. This allows the source domain detection supervision loss and spectral quality information to be coupled under the same optimization objective, rather than fixing quality control as an independent preprocessing rule. To give this supervision constraint system a clear mathematical form, this embodiment defines the source domain detection supervision loss as a weighted sum of classification loss and bounding box regression loss, and calculates this loss for source domain samples in each training iteration to update the parameters of the feature extraction network and the detection head network.

[0069] Since global domain adversarial loss and class-conditional domain adversarial loss are subsequently introduced in parallel, the source domain detection supervision loss plays a basic constraining role in class discrimination and localization regression in the joint loss, ensuring that both spectral structure learning and domain adversarial training revolve around the output of the detection task.

[0070] In summary, in the step of calculating the source domain detection supervision loss, the source domain labeling is not only used for conventional classification and regression supervision, but also, through the design of fused features, enables the supervision gradient to drive the edge weight generation and message passing parameter update of the spectral correlation graph neural network, thereby realizing a closed-loop supervision link. This gives the step clear implementable details and inventable creative technical features.

[0071] S500: Calculate the global domain adversarial loss and the class-conditional domain adversarial loss based on the source domain spectral data and the target domain spectral data.

[0072] Simultaneously, a global domain discrimination link oriented towards fusion features and a class-conditional domain discrimination link oriented towards candidate region features are established, and adversarial optimization is formed through gradient inversion, so that the source domain and the target domain form trainable alignment constraints in the same detection task representation space.

[0073] S501: The source domain spectral data and the target domain spectral data are forward computed in the same feature extraction network to obtain their respective spectral structure embeddings and spatial embeddings, which are then fused into fused features by the fusion module. For the global domain adversarial loss, a global convergence operation is first performed on the fused features of each input sample. The global convergence operation maps the multi-scale fused features into a single global feature vector. The global feature vector is input into the global domain discriminator through a gradient inversion layer. The global domain discriminator outputs the domain discrimination result and calculates a binary cross-entropy loss with a preset domain label. The domain label of the source domain sample is set to 1, and the domain label of the target domain sample is set to 0. This binary cross-entropy loss constitutes the discriminant term of the global domain adversarial loss. During training, the domain discriminator parameters are updated by minimizing this discriminant term, and the feature extraction network parameters are updated by maximizing this discriminant term under the action of the gradient inversion layer, thereby forming a global-level adversarial optimization.

[0074] It should be noted that the preset domain labels are used to identify the domain type to which the spectral data samples belong, providing a supervision signal for binary classification of the global domain discriminator.

[0075] The assignment rules for preset domain labels are determined based on the acquisition conditions and annotation status of the spectral data. Source domain spectral data comes from a dataset acquired by a spectral imaging system equipped with complete insulator detection annotation information. For each sample in the source domain spectral data, its preset domain label is assigned a value of 1. Target domain spectral data comes from different spectral imaging systems or different acquisition environments to be adapted. The spectral data samples in this dataset do not contain insulator detection annotation information. For each sample in the target domain spectral data, its preset domain label is assigned a value of 0. The values ​​of the domain labels are limited to binary form, containing only the values ​​0 and 1.

[0076] During the forward computation, the source domain spectral data and the target domain spectral data are computed in the same feature extraction network to obtain their respective fused features. A global convergence operation is performed on the fused features of each input sample, mapping the multi-scale fused features to a single global feature vector. The global feature vector of the source domain sample is input into the global domain discriminator after passing through a gradient inversion layer. The global domain discriminator outputs a domain discrimination result, which is a scalar value between 0 and 1, representing the discriminator's confidence that the global feature vector belongs to the source domain. The domain discrimination result of the source domain is used to calculate a binary cross-entropy loss with the preset domain label 1 corresponding to the source domain sample. The global feature vector of the target domain sample is input into the global domain discriminator after passing through a gradient inversion layer. The global domain discriminator outputs a domain discrimination result, which is then used to calculate a binary cross-entropy loss with the preset domain label 0 corresponding to the target domain sample.

[0077] The binary cross-entropy loss is calculated based on the negative log-likelihood form. For source domain samples with a preset domain label of 1, the loss term is the discriminator output in the form of a negative logarithm. This loss term reaches its minimum value when the discriminator output is close to 1, prompting the global discriminator to push the discriminant output of the source domain global feature vector towards 1. For target domain samples with a preset domain label of 0, the loss term is the discriminator output complement in the form of a negative logarithm. This loss term reaches its minimum value when the discriminator output is close to 0, prompting the global discriminator to push the discriminant output of the target domain global feature vector towards 0. In the same training batch, the sum of the binary cross-entropy loss terms of the source domain samples and the target domain samples constitutes the discriminant term of the global adversarial loss.

[0078] In the domain adversarial training mechanism, the parameters of the global domain discriminator are updated by minimizing the discriminant term, enabling the discriminator to learn the discriminant boundary that can distinguish between the source domain fused features and the target domain fused features. The parameters of the feature extraction network are updated by maximizing the discriminant term under the action of the gradient inversion layer. During backpropagation, the gradient inversion layer inverts the gradient passed to the feature extraction network, making the optimization direction of the feature extraction network opposite to that of the discriminator. This allows the fused features formed by the spectral structure embedding generated by the Spectral-GNN neural network and the spatial feature embedding generated by the spatial feature extraction sub-network to confuse the discriminator's ability, achieving alignment of the distribution of source domain spectral data and target domain spectral data in the fused feature space.

[0079] In the calculation of the class-conditional adversarial loss, the preset domain label is also used to identify the domain type to which the candidate region features belong. The source domain candidate region features are constructed using a class-prototype gating method to obtain five class-conditional features. These five class-conditional features are then passed through a gradient inversion layer and input into five sub-discriminators. Each sub-discriminator outputs a domain discrimination result, which is used to calculate a binary cross-entropy loss with the preset domain label 1 corresponding to the source domain. Similarly, the target domain candidate region features are constructed using a class-prototype gating method to obtain five class-conditional features. These five class-conditional features are then passed through a gradient inversion layer and input into five sub-discriminators. Each sub-discriminator outputs a domain discrimination result, which is used to calculate a binary cross-entropy loss with the preset domain label 0 corresponding to the target domain. The binary cross-entropy loss is calculated for the domain discrimination result and domain label of each sub-discriminator and then accumulated across the five categories to obtain the class-conditional adversarial loss.

[0080] The preset domain labels maintain a fixed assignment rule throughout the training process. The source domain spectral data always corresponds to the preset domain label 1, and the target domain spectral data always corresponds to the preset domain label 0. This assignment rule enables the domain discriminator to learn the distribution difference between the source domain spectral data and the target domain spectral data in the feature space, while the feature extraction network learns the feature transformation that eliminates this distribution difference through the gradient reversal mechanism.

[0081] S502: To address the class-conditional domain adversarial loss, a fixed set of categories is used as a constraint framework. The set of categories is limited to insulator body category, hardware category, dirt category, damage category, and background category. A sub-domain discriminator is set for each of the above categories, so that the class-conditional domain discriminator consists of five sub-discriminators.

[0082] In the forward computation, the detection head network generates candidate regions by RPN and obtains candidate region features through region alignment. Then, based on the class prototype gating mechanism, each candidate region feature is constructed into five class conditional features. Specifically, the similarity between the candidate region feature and the five class prototype vectors is calculated, and after Softmax normalization, a five-dimensional class gating coefficient vector is obtained. Then, the candidate region feature is multiplied by each dimension component of the five-dimensional class gating coefficient vector to obtain the five class conditional features. The five class conditional features are respectively input into the five corresponding sub-discriminators through the gradient inversion layer to output the domain discrimination results.

[0083] S503: Calculate the binary cross-entropy loss for the domain discrimination results of each sub-discriminator and the domain label, and sum them over the five categories to obtain the class-conditional domain adversarial loss.

[0084] It should be noted that the input of the class-conditional domain adversarial loss does not directly adopt candidate region features, but is constructed deterministically through class prototype similarity, gating coefficient and class-conditional features. This ensures that the candidate region features are explicitly bound to the preset class semantics before entering the domain discriminator, thereby decomposing the domain adversarial constraint into five interrelated but independent discriminative tasks in the class dimension.

[0085] Meanwhile, the class prototype library is updated during training according to confidence threshold gating and exponential sliding rules, so that target domain samples only participate in prototype statistics when they meet the preset confidence conditions, ensuring that the generation of class condition features follows a unified update path and forms a closed loop with the calculation of domain adversarial loss.

[0086] It should be noted that the preset category semantics are achieved through the representation of category prototype vectors in the feature space. The initialization of the category prototype vectors is based on the mean vector of candidate region features of the source domain labeled samples, calculated by category. The mean vector of all candidate region features in the source domain spectral data with the true category label of insulator body is obtained, which represents the semantic center of the insulator body category in the feature space. In this way, the category prototype vectors corresponding to the fittings category, the dirt category, the damage category, and the background category are obtained respectively. When constructing class conditional features, the similarity between each candidate region feature and the five category prototype vectors is calculated. The similarity calculation is achieved by the inner product operation between the candidate region feature and the category prototype vector. The five similarity values ​​are normalized by Softmax to obtain a five-dimensional class gating coefficient vector. The candidate region feature is multiplied by each dimension of the five-dimensional class gating coefficient vector to obtain five class conditional features. The five class conditional features are input to the five sub-discriminators corresponding to their respective categories, so that the candidate region features are explicitly bound to the preset category semantics before entering the domain discriminator.

[0087] A pre-set reliability threshold is used to screen the eligibility of target domain samples to participate in the class prototype library update. For each target domain candidate region, the classification branch outputs a five-dimensional class probability vector. The maximum probability value in this vector is calculated. If the maximum probability value is greater than or equal to the pre-set reliability threshold, the target domain candidate region is deemed to meet the pre-set reliability threshold, and its corresponding candidate region features participate in the class prototype library update. If the maximum probability value is less than the pre-set reliability threshold, the target domain candidate region is deemed not to meet the pre-set reliability threshold, and its corresponding candidate region features do not participate in the class prototype library update. Target domain candidate region features that meet the pre-set reliability threshold are grouped according to the category corresponding to their maximum class probability, and the batch mean vector of the corresponding category is calculated. Then, the corresponding category prototype vector is updated according to the exponential sliding update rule. When a category does not have any target domain candidate region features that meet the pre-set reliability threshold in the current batch, the prototype vector of that category remains unchanged. In this embodiment, based on experience, the pre-set reliability threshold is 0.7.

[0088] S504: In the same iteration, the global domain adversarial loss and the class-conditional domain adversarial loss are calculated simultaneously, and they are combined with the source domain detection supervision loss to form a joint loss to participate in parameter updates. This ensures that the alignment objects of domain adversarial training are always the fusion features of the detection task and the semantic features of the candidate region, thus completing the adversarial domain constraint calculation in the detection representation space.

[0089] S600: Update the parameters of the deep learning detection model based on the joint loss and output the trained insulator detection model.

[0090] S601: In each training iteration, the source domain spectral data and the target domain spectral data are respectively input into the feature extraction network to complete the forward computation. The spectral correlation graph neural network in the feature extraction network forms a sparse adjacency matrix based on a learnable edge weight generator and performs graph message passing to obtain the spectral structure embedding. The spatial feature extraction sub-network performs convolutional feature extraction on the input tensor to obtain the spatial feature embedding. The spectral structure embedding and the spatial feature embedding are fused by the fusion module to obtain the source domain fusion feature and the target domain fusion feature.

[0091] S602: The detection head network performs a two-stage detection process with source domain fusion features and target domain fusion features as inputs. The region proposal network generates source domain candidate regions and target domain candidate regions, and the region feature extraction module performs region alignment on the candidate regions to obtain source domain candidate region features and target domain candidate region features. The source domain candidate region features are input to the classification branch and the bounding box regression branch to output the source domain category probability vector and the source domain bounding box regression value. Then, the source domain detection supervision loss is calculated based on the source domain true category label and the source domain true bounding box. The source domain detection supervision loss consists of classification loss and regression loss.

[0092] S603: The global discriminator performs global convergence on the source domain fused features and the target domain fused features to obtain the source domain global feature vector and the target domain global feature vector, respectively. The source domain global feature vector and the target domain global feature vector are input into the global discriminator through the gradient inversion layer to output the domain discrimination result and calculate the global domain adversarial loss with the domain label.

[0093] The class conditional domain discriminator calculates the similarity between the source domain candidate region features and the target domain candidate region features and the five class prototype vectors based on the class prototype library, and obtains the class gating coefficient vector by Softmax normalization.

[0094] Five class-conditional features are constructed by multiplying the candidate region features using class-gated coefficient vectors. These five class-conditional features are then passed through a gradient inversion layer and input into five sub-discriminators, respectively, to calculate the class-conditional adversarial loss using the output domain discrimination results and the domain labels.

[0095] S604: Combine the source domain detection supervision loss, global domain adversarial loss, and class conditional domain adversarial loss with preset weights to form a joint loss and perform one backpropagation.

[0096] The gradient inversion layer applies inverted gradients to the parameters of the feature extraction network and the fusion module in the same backpropagation, while applying non-inverted gradients to the parameters of the global discriminator and the class conditional discriminator. The gradient generated by the source domain detection supervision loss is applied to the parameters of the detection head network, thereby completing the parameter update for this iteration.

[0097] After completing the forward computation of this iteration, the target domain candidate region features and their maximum class probabilities obtained from the forward computation of this iteration are used to update the class prototype library. The target domain candidate region features that meet the preset confidence threshold are grouped according to the category corresponding to their maximum class probability and the batch mean vector of the corresponding category is calculated. Then, the prototype vector of the corresponding category is updated according to the exponential sliding update rule. When there are no target domain candidate region features that meet the preset confidence threshold in the current batch for a certain category, the prototype vector of that category is not updated.

[0098] S605: Repeat the above iterative update until the preset number of training rounds is reached, then solidify the parameters of the feature extraction network, fusion module and detection head network, and output the trained insulator detection model.

[0099] It should be noted that the preset number of training rounds is used to determine the termination condition for model training. This preset number of training rounds is determined based on the convergence characteristics of the source domain detection supervision loss and the domain adversarial loss. In the initial training phase, the source domain detection supervision loss decreases rapidly, the feature extraction network learns basic spectral structure and spatial features, and the detection head network learns the classification and bounding box regression capabilities of candidate regions. In the middle training phase, the global domain adversarial loss and the class-conditional domain adversarial loss gradually participate in parameter updates, and the adjacency matrix generated by the learnable edge weight generator in the Spectral-GNN gradually forms cross-domain invariant band dependencies, and the distribution difference of fused features between the source and target domains gradually decreases. In the later training phase, the source domain detection supervision loss, the global domain adversarial loss, and the class-conditional domain adversarial loss tend to stabilize, and the update magnitude of the model parameters gradually decreases. The determination of the preset number of training rounds must ensure that the Spectral-GNN completes the learning convergence of the sparse adjacency matrix, enabling the learnable edge weight generator to form a stable representation of the dependency strength between band nodes. Simultaneously, it is necessary to ensure that the class prototype library is fully updated so that the five class prototype vectors can represent the common semantic center of the source and target domain samples in each class. Too few training rounds will result in the edge weight generator not fully learning band dependencies and the class prototype vectors not fully absorbing the class semantics of the target domain samples, thus affecting the model's detection performance in the target domain. Too many training rounds will lead to overfitting of the model to the source domain samples, the domain discriminator's ability to distinguish between the source and target domains being too strong, and the adversarial gradient generated by the gradient reversal layer failing to effectively promote the feature extraction network to learn domain-invariant features. In each training iteration, the forward computation, joint loss calculation, backpropagation, and parameter update of the source and target domain spectral data are repeatedly performed until the preset number of training rounds is reached. Then, the parameters of the feature extraction network, fusion module, and detection head network are solidified, and the trained insulator detection model is output. In this embodiment, based on experience, the preset number of training rounds is 100 rounds.

[0100] Example 3, an embodiment of this application, provides a method for constructing an insulator detection model based on feature spectral transfer learning, including: It should be noted that the deep learning detection model is constructed, which includes a feature extraction network, a detection head network, a global discriminator, and a class conditional discriminator.

[0101] First, an end-to-end deep learning detection model is established, comprising a feature extraction network, a detection head network, a global domain discriminator, and a class-conditional domain discriminator. The feature extraction network does not simply treat spectral data as high-dimensional vectors and feed them directly into the convolutional network; instead, it explicitly models the internal structure of the spectral dimension as a learnable graph structure. To this end, the feature extraction network is divided into two parts: a spectral correlation graph neural network (Spectral-GNN) and a spatial feature extraction sub-network. These two sub-networks extract features based on band dependencies and target geometric texture morphology, respectively, and then form a unified fused feature through a fusion module for use by the detection head network.

[0102] Furthermore, Spectral-GNN uses the spectral information corresponding to each band in the input tensor as graph nodes. In addition to the normalized reflectance value of the corresponding band, the initial features of the nodes also introduce first-order and second-order differences to characterize the local variation trend of the spectral curve. The position encoding generated by the center wavelength of the band is also introduced so that the network has an explicit perception of wavelength order and band position during the learning process.

[0103] Based on this, Spectral-GNN uses a learnable edge weight generation mechanism to generate an adjacency matrix. That is, the node features of any two band nodes are linearly mapped to obtain the query vector and key vector respectively. The attention score is obtained by dot product and then normalized to edge weight by Softmax. Thus, the dependence strength between bands is no longer determined by a fixed neighborhood or human experience, but is adaptively formed by the training process under the constraints of the data distribution in the source and target domains.

[0104] Furthermore, to ensure that the graph structure is both feasible and highlights key connections, only the K connections with the largest edge weights are retained for each node to form a sparse adjacency matrix, so that subsequent message passing is focused on the information flow of the most relevant band pairs.

[0105] Furthermore, Spectral-GNN performs graph message passing on this sparse adjacency matrix. Each layer aggregates the features of adjacent nodes according to edge weights and updates them together with its own features to obtain the node representations that evolve layer by layer. Finally, the high-level representations of all band nodes are aggregated into a spectral structure embedding vector through graph-level aggregation. This spectral structure embedding vector semantically corresponds to the structured difference expression of insulator material, pollution deposition, damage state and background material in the band dimension.

[0106] Unlike existing solutions that commonly use band splicing + convolution or direct Transformer processing of spectral sequences, this method explicitly defines the inter-band dependencies as edge weight parameters and participates in training and updates by using learnable sparse spectral graph adjacency + graph message passing. This gives the model building process a clear structured support point for adapting to different sensor band configurations and spectral morphology changes in different scenarios. This structured support point is the adjacency matrix and its edge weight generator parameters.

[0107] Meanwhile, the spatial feature extraction subnetwork performs convolutional feature extraction on the input tensor to obtain spatial embedding vectors related to the insulator target contour, hardware shape, dirt texture and damaged edge. The output of the spatial subnetwork is a multi-scale spatial representation, which facilitates the subsequent detection head to generate candidate regions and classify and regress targets at different scales.

[0108] Furthermore, the spectral structure embedding and spatial feature embedding are fused by the fusion module to form a fused feature. The fusion module can be implemented by linear transformation after feature concatenation, and channel attention can be introduced during the fusion process to achieve a weighted combination of spectral structure information and spatial information. The final output fused feature is used as the input of the detection head network.

[0109] It should be noted that when the detection head network adopts a two-stage detection structure, the Region Proposal Network (RPN) generates candidate regions on the fused features; then, the candidate region features are obtained through region alignment. The candidate region features are input into the classification branch and the bounding box regression branch, and the output class probability vector and bounding box regression value are used to form the basis for calculating the source domain detection supervision loss.

[0110] The classification loss is calculated from the source domain true category label and the candidate region category probability vector, while the regression loss is calculated from the source domain true bounding box and the bounding box regression value. The two constitute the source domain detection supervision loss and are used to constrain the parameter updates of the feature extraction network and the detection head network.

[0111] It should be noted that, in parallel with the main detection task mentioned above, the model also constructs a global discriminator and a class-conditional discriminator to support subsequent transfer training. The global discriminator uses the global convergence vector of fused features as the input and output domain discrimination result, while the class-conditional discriminator uses the class-conditional features obtained by constructing candidate region features through class prototype gating as the input and output domain discrimination result. This allows the interface and gradient path for domain adversarial training to be reserved during the model construction stage.

[0112] Therefore, in the steps of constructing a deep learning detection model and calculating the source domain detection supervision loss, the innovative spectral structure modeling mechanism, including spectral graph nodes, learnable sparse adjacency, graph message passing, and spectral structure embedding, has been tightly coupled with the detection structured output mechanism, including candidate region features and classification regression supervision. This provides clear trainable inputs for subsequent global and class-conditional adversarial training, forming a complete insulator detection model construction framework.

[0113] Comparative Example 1 Comparative Example 1 is used to verify the adaptability of the learnable edge weight generator of the Spectral-GNN to changes in band configuration. By comparing the use of the learnable edge weight generator with the use of a fixed adjacency matrix or no graph structure, the technical advantages of Spectral-GNN in cross-band configuration scenarios are evaluated.

[0114] Comparison Method Settings: This comparison uses three methods, as detailed below: (1) Method of this application: Spectral-GNN with learnable edge weight generator is adopted. The edge weight generator generates the adjacency matrix through linear mapping → dot product attention → Softmax normalization → Top-K sparsification. The value of K is set to 10, and the number of graph message passing layers L is set to 3. (2) Comparison Method 1: GNN with fixed adjacency matrix is ​​used. The adjacency matrix is ​​constructed based on the K nearest neighbor relationship of the center wavelength of the band. The K value is fixed at 10, and the number of graph message passing layers L is set to 3. (3) Comparison method 2: without using a graph structure, the spectral vector is directly input into the ResNet-50 backbone network for feature extraction.

[0115] Experimental setup: The source domain spectral data uses a 10-band configuration, with center wavelengths of 450nm, 500nm, 550nm, 600nm, 650nm, 700nm, 750nm, 800nm, 850nm, and 900nm, respectively. A total of 1000 insulator images are included, each containing a true bounding box and category labels (five categories: insulator body, fittings, dirt, damage, and background).

[0116] The target domain spectral data uses a 12-band configuration, with the center wavelengths of the bands being 430nm, 480nm, 530nm, 580nm, 630nm, 680nm, 730nm, 780nm, 830nm, 880nm, 930nm, and 980nm, respectively. The center wavelengths of the target domain bands partially overlap with those of the source domain bands but are offset. A total of 500 insulator images are included, without any annotation information.

[0117] Training parameter settings: All three methods use the same training parameters, with a preset training epoch of 100 epochs, a batch size of 16, an initial learning rate of 0.001, which decays to 0.1 times every 30 epochs, an optimizer of Adam, a global adversarial loss weight of 0.5, and a class-conditional adversarial loss weight of 0.5.

[0118] Comparison metrics: The following metrics were used in Comparative Example 1 to evaluate the performance of the three methods: (1) Target domain detection accuracy: The mean accuracy mAP is evaluated on the target domain test set (the Intersectionover Union threshold is set to 0.5). The higher the mAP value, the better the detection accuracy. (2) Accuracy reduction under different band configurations: Compare the target domain mAP with the source domain mAP and calculate the percentage of accuracy reduction. The smaller the percentage of accuracy reduction, the stronger the cross-band configuration adaptation capability. (3) Training convergence speed: Record the number of training rounds required for the target domain mAP to reach a stable value (the change range is less than 0.5% for 10 consecutive rounds) during the training process.

[0119] Experimental results show that the target domain mAP of the proposed method reaches 0.847, which is only 5.0% lower than the source domain mAP (0.892), significantly outperforming comparative method 1 (15.3% decrease) and comparative method 2 (25.0% decrease). The proposed method reaches stability after 95 training epochs, with a faster convergence speed than comparative method 1 (110 epochs) and comparative method 2 (130 epochs). These results demonstrate that the learnable edge weight generator of Spectral-GNN can adaptively learn inter-band dependencies, enabling the model to possess a clear structured adaptation capability for different band configurations, significantly improving detection accuracy and training efficiency in cross-band configuration scenarios.

[0120] Example 4, an embodiment of this application, provides an insulator detection model construction system based on feature spectral transfer learning, including: a feature extraction module, a detection head module, a global domain discrimination module, a class conditional domain discrimination module, and a joint optimization and prototype update module.

[0121] The feature extraction module is used to receive the preprocessed spectral input tensor, which includes a spectral correlation graph neural network Spectral-GNN and a spatial feature extraction sub-network, and outputs spectral structure embedding and spatial feature embedding respectively, which are then fused to form a fused feature. The detection head module takes the fused features as input to perform a two-stage detection process, generates candidate regions and extracts the features of the candidate regions, and outputs the category probability vector and bounding box regression of the candidate regions for detection result generation and source domain supervised training. The global domain discrimination module is used to perform global convergence on the fused features of the source domain and the target domain to obtain a global feature vector, and output the domain discrimination result, which is used to calculate the global domain adversarial loss and participate in adversarial training. The class conditional domain discrimination module calculates class gating coefficients and constructs class conditional features based on candidate region features and class prototype library. It inputs the class conditional features into the sub-discriminators corresponding to each class to output the domain discrimination results, which are used to calculate the class conditional domain adversarial loss and participate in adversarial training. The joint optimization and prototype update module is used to construct a joint loss based on the source domain detection supervision loss, the global domain adversarial loss, and the class conditional domain adversarial loss and update the model parameters. At the same time, it performs category aggregation and exponential sliding update rules on the target domain candidate region features that meet the confidence threshold and updates the class prototype library.

[0122] This embodiment also provides an electronic device applicable to a method for constructing an insulator detection model based on feature spectral transfer learning, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the method for constructing an insulator detection model based on feature spectral transfer learning as proposed in the above embodiment.

[0123] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements an insulator detection model construction method based on feature spectral transfer learning as proposed in the above embodiments.

[0124] The storage medium proposed in this embodiment belongs to the same inventive concept as the method for constructing an insulator detection model based on feature spectrum transfer learning proposed in the above embodiments. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0125] Based on the above description of the implementation methods, those skilled in the art can clearly understand that this application can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0126] It should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application, and all such modifications and substitutions should be covered within the scope of the claims of this application.

Claims

1. A method for constructing an insulator detection model based on feature spectral transfer learning, characterized in that, include: Acquire source domain spectral data and corresponding insulator detection labeling information, and acquire target domain spectral data; The source domain spectral data and the target domain spectral data are preprocessed to form training input samples; A deep learning detection model is constructed, which includes a feature extraction network, a detection head network, a global domain discriminator, and a class conditional domain discriminator. The source domain detection supervision loss is calculated based on the source domain spectral data and its corresponding detection annotation information. The global adversarial loss and class-conditional adversarial loss are calculated based on the source domain spectral data and the target domain spectral data. The class-conditional adversarial loss is calculated as follows: a class prototype library containing multiple class prototype vectors is established; based on the similarity between the candidate region features output by the detection head network and the prototype vectors of each class, a class gating coefficient vector is generated; the candidate region features are weighted using the class gating coefficient vector to construct multiple class-conditional features that correspond one-to-one with each preset class. The multiple class-conditional features are respectively input into the sub-discriminators of the corresponding categories in the class-conditional domain discriminator to calculate the class-conditional domain adversarial loss; The parameters of the deep learning detection model are updated based on the joint loss, and the trained insulator detection model is output.

2. The method for constructing an insulator detection model based on feature spectral transfer learning as described in claim 1, characterized in that, The preprocessing includes: performing normalization processing on each band data of each input sample to obtain a normalized band vector; Generate wavelength position encoding vectors based on the center wavelength of each band; The band signal-to-noise ratio indicator and band saturation flag are calculated based on the original spectral data of the input sample. The normalized band vector, the wavelength position encoding vector, the band signal-to-noise ratio indicator, and the band saturation flag are concatenated along the feature dimension to form the input tensor.

3. The method for constructing an insulator detection model based on feature spectral transfer learning as described in claim 1, characterized in that, The feature extraction network includes a spectral correlation graph neural network (Spectral-GNN) and a spatial feature extraction subnetwork. The Spectral-GNN performs graph message passing on the spectral part of the input tensor to output a spectral structure embedding, and the spatial feature extraction subnetwork performs convolutional feature extraction on the input tensor to output a spatial feature embedding. The spectral structure embedding and the spatial feature embedding are fused by the fusion module to form a fusion feature for the detection head network.

4. The method for constructing an insulator detection model based on feature spectral transfer learning as described in claim 3, characterized in that, The Spectral-GNN constructs a band graph by assigning a graph node to each band of the spectral data, and uses a learnable edge weight generator to generate an adjacency matrix. The learnable edge weight generator performs linear mapping on the node features and then calculates the dot product attention score. The attention score is then normalized by Softmax to obtain the edge weight. For each graph node, only the K connections with the largest edge weights are retained to form a sparse adjacency matrix, which is used for graph message passing.

5. The method for constructing an insulator detection model based on feature spectral transfer learning as described in claim 3, characterized in that, The detection head network is a two-stage detection structure, including a Region Proposal Network (RPN) and a Region Feature Extraction module. The Region Proposal Network (RPN) generates candidate regions based on the fused features. The region feature extraction module performs region alignment on the candidate regions to obtain candidate region features. The candidate region features are used as inputs to the classification branch and the bounding box regression branch to output the class probability vector and the bounding box regression value.

6. The method for constructing an insulator detection model based on feature spectral transfer learning as described in claim 5, characterized in that, The global adversarial loss and the class-conditional adversarial loss are trained adversarially through a gradient inversion layer, which is set between the fused feature and the global discriminator, and between the class-conditional feature and the sub-discriminator.

7. A method for constructing an insulator detection model based on feature spectral transfer learning as described in claim 1 or 6, characterized in that, The global domain discriminator takes the global convergence vector of the fused features as input and outputs the domain discrimination result; The sub-discriminators take the corresponding class-conditional features as input and output the domain discrimination result. The joint loss is composed of the weighted sum of the source domain detection supervision loss, the global domain adversarial loss and the class-conditional domain adversarial loss and is used to update the parameters of the deep learning detection model.

8. A system for constructing an insulator detection model based on feature spectral transfer learning, applying the DC distribution network fault location method based on traveling wave analysis as described in any one of claims 1 to 7, characterized in that, include: Feature extraction module, detection head module, global domain discrimination module, class conditional domain discrimination module, joint optimization and prototype update module; The feature extraction module is used to receive the preprocessed spectral input tensor, which includes a spectral correlation graph neural network Spectral-GNN and a spatial feature extraction sub-network, and outputs spectral structure embedding and spatial feature embedding respectively, which are then fused to form a fused feature. The detection head module takes the fused features as input to perform a two-stage detection process, generates candidate regions and extracts the features of the candidate regions, and outputs the category probability vector and bounding box regression of the candidate regions for detection result generation and source domain supervised training. The global domain discrimination module is used to perform global convergence on the fused features of the source domain and the target domain to obtain a global feature vector, and output the domain discrimination result, which is used to calculate the global domain adversarial loss and participate in adversarial training. The class conditional domain discrimination module calculates class gating coefficients and constructs class conditional features based on candidate region features and class prototype library. It inputs the class conditional features into the sub-discriminators corresponding to each class to output the domain discrimination results, which are used to calculate the class conditional domain adversarial loss and participate in adversarial training. The joint optimization and prototype update module is used to construct a joint loss based on the source domain detection supervision loss, the global domain adversarial loss, and the class conditional domain adversarial loss and update the model parameters. At the same time, it performs category aggregation and exponential sliding update rules on the target domain candidate region features that meet the confidence threshold and updates the class prototype library.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the insulator detection model construction method based on feature spectral transfer learning as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the insulator detection model construction method based on feature spectrum transfer learning as described in any one of claims 1 to 7.