Substation equipment defect prediction analysis method based on comparative learning

By constructing a substation equipment defect prediction and analysis method based on contrastive learning, and utilizing instance-proposed contrastive branches and context enhancement modules, the problem of detection accuracy and reliability under small sample conditions in substation equipment defect prediction is solved, and efficient identification of defects such as bushing cracks, low oil level, and missing nuts is achieved.

CN119272921APending Publication Date: 2025-01-07LVLIANG POWER SUPPLY CO OF STATE GRID SHANXI ELECTRIC POWER CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411309413.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Existing technologies rely on training with a large number of labeled samples in substation equipment defect prediction, which makes it difficult to effectively mine the relationships between instances in the image, and lacks effective feature extraction methods when defect samples are scarce, resulting in insufficient detection accuracy and reliability.

Method used

A substation equipment defect prediction and analysis method based on contrastive learning is adopted. By constructing instance proposal contrastive branches and instance-level context enhancement modules, combined with the Faster RCNN detector, the method uses contrastive learning to extract equipment defect features under small sample conditions, including the detection of defect types such as bushing cracks, low oil level and missing nuts.

Benefits of technology

It improves the accuracy and robustness of defect detection, and can effectively identify equipment defects in complex environments under small sample conditions, especially casing cracks, low oil level and missing nuts. It shows good generalization ability and the ability to identify obscured targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272921A_ABST
    Figure CN119272921A_ABST
Patent Text Reader

Abstract

The invention discloses a transformer substation equipment defect prediction analysis method based on comparative learning, and belongs to the technical field of deep learning. Aiming at the problem of how to predict and analyze the defects of the transformer substation equipment and evaluate the damage degree and health state of the transformer substation equipment under the condition that only a small number of transformer substation equipment defect samples exist, a comparative learning framework is constructed, and a normal sample learning data feature representation technology is utilized to evaluate the damage degree and health state of the transformer substation equipment. Therefore, the model can perform accurate feature extraction and defect identification in different equipment states, effectively extract substation equipment defect information and evaluate the equipment health state, thereby realizing prediction and analysis of substation equipment defects, facilitating operation and maintenance personnel to timely discover and process potential equipment problems, and improving the efficiency of the operation and maintenance personnel. Safe and stable operation of the transformer substation is ensured, and equipment faults are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of deep learning, and specifically relates to a method for predicting and analyzing substation equipment defects based on contrastive learning. Background Art

[0002] As the power system's requirements for equipment operation stability and reliability are increasing, the importance of substation defect prediction is becoming more and more prominent. It plays a vital role in preventing power equipment failures, avoiding power outages and other potential serious consequences. However, traditional defect prediction methods are highly dependent on a large number of labeled samples for model training. However, due to the complex image structure of power equipment components, existing methods are limited to more effective migration of prior knowledge obtained from basic training of a large number of labeled data sets, lacking methods to enable models to obtain better representation capabilities; and failing to fully explore the relationship between instances in the image, it is difficult to deal with the interference of easily confused targets and noise in the image on defect detection. This poses a great challenge in the actual situation where the equipment operating environment is complex and changeable and defect samples are scarce.

[0003] As an unsupervised learning method, contrastive learning can effectively extract the core features of data by deeply exploring the similarities and differences between samples, even in the absence of labeled data. Therefore, at this stage, a method is needed to overcome the problem of limited defect data of substation equipment to improve the accuracy and reliability of defect prediction. Summary of the invention

[0004] In order to solve the problem of how to predict and analyze the defects of substation equipment and evaluate the damage degree and health status of substation equipment when there are only a small number of substation equipment defect samples, the present invention provides a substation equipment defect prediction and analysis method based on contrastive learning.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] A method for predicting and analyzing substation equipment defects based on contrastive learning, the method comprising the following steps:

[0007] Step 1: Construct a small sample image dataset of substation defects; divide the image dataset into two parts: training set and test set; ensure that the dataset covers three defect types: casing cracks, low oil level line, and missing nuts, and includes samples in normal state for comparison;

[0008] Step 2: Build a small sample defect detection model for substation equipment that includes instance proposal comparison branch, instance-level context enhancement module, and Faster RCNN detector;

[0009] Step 2.1: Construct instance proposal comparison branch;

[0010] Step 2.1.1: Input the training image X into the Faster RCNN detector, extract multi-scale features through the backbone network ResNet101 and FPN (Feature Pyramid Network), then RPN and ROI Align generate a certain number of proposed regions on feature maps of different scales and unify the sizes to obtain the proposed region features N Roi represents the number of proposed regions;

[0011] Step 2.1.2: The proposed region feature V′ is transformed into a dimension through two fully connected layers in the Box Head Then the proposed region feature V′ is converted into a comparison vector through the projector Projector as a target enhancement view required for contrastive learning;

[0012] Steps 2.1.1 and 2.1.2 are formally expressed as:

[0013] C′=Pro(BH(RA(RPN(F FPN (X)),F FPN (X))))

[0014] Among them, F FPN (·) is the backbone network combined with FPN, RPN(·), RA(·), BH(·), and Pro(·) represent RPN, ROI-Align, BoxHead, and Projector, respectively;

[0015] Step 2.1.3: Use the position information in the training image X label to crop all the objects A in the image and reshape them to a size of 224×224, that is, N GT is the number of instance targets in the training image X;

[0016] Step 2.1.4: Use the backbone network ResNet101 and Box Head in the instance proposal comparison branch to extract and encode the features of all targets A. The backbone network ResNet101 and Box Head have the same structure as the Faster RCNN detector and share network parameters, so the instance target features are obtained after Box Head. Then send it to the parameter-sharing projector Projector to convert the instance target features Convert to contrast vector As the target original view required for contrastive learning;

[0017] Steps 2.1.3 and 2.1.4 are formally expressed as:

[0018] C=Pro(BH((F FPN (Crop(X)))))

[0019] Among them, Crop(·) means cropping the instance target from the input;

[0020] Step 2.2: Construct an instance level context enhancement module (ICE).

[0021] Step 2.2.1: Extract the score vector matrix for all proposed regions after the linear layer in the classification head Classifier of the FasterRCNN detector Each row corresponds to the representation of the proposed region information;

[0022] Step 2.2.2: Add a linear layer that shares parameters with the linear layer of the FasterRCNN detector after the backbone network Box Head in the instance proposal comparison branch to generate a score vector matrix of the instance target cropped from the input image. Each row corresponds to the representation of instance target information, where N GT is the number of instance targets in the training image X, that is, the number of real boxes, C b is the number of base class categories, and the instance target score vector matrix S is used as context information to enhance the proposed area;

[0023] Step 2.2.3: Pass the proposed region score vector matrix Q and the instance target score vector matrix S through the fully connected layers y(·) and q(·) with residual structures respectively, and then perform matrix multiplication to obtain the context relationship matrix The i-th row vector of the context matrix W Represents the relationship weight between the i-th proposed region and the instance target in the image;

[0024] Step 2.2.4: Obtain the weighted context information matrix by multiplying the context relationship matrix W with the instance target score vector matrix S

[0025] Step 2.2.5: Add the proposed region score vector matrix Q to the context information matrix E to aggregate the context information into the proposed region to obtain the enhanced proposed region score vector matrix

[0026] Steps 2.2.1 to 2.2.5 are formally expressed as:

[0027]

[0028] Step 2.2.6: Add a dimension C between the output of the instance-level context enhancement module and the classification head Classifier n The linear layer N_linear is used to transform the score vector matrix The rich semantic space information in the Among them C n is the number of new categories;

[0029] Step 2.2.7: Score the new class After being concatenated with the original linear layer output in the classification head Classifier, it is sent to the Softmax function to obtain the prediction results of the proposed area content on the base class and the new class.

[0030] Steps 2.2.6 to 2.2.7 are formally expressed as:

[0031]

[0032] Among them, Concat() means concatenating the base class and the new class prediction score vector;

[0033] Step 2.3: Design instance proposal comparison loss function;

[0034] Step 2.3.1: For a certain instance C i , and the contrast vectors of the n proposal regions whose intersection over union (IoU) is greater than the threshold σ are taken as instances C i Positive sample C' + , forming a positive sample pair (C i ,C' + ), the contrast vectors of the remaining m proposal regions are used as instances C i Negative samples C' - , forming a negative sample pair (C i ,C' - );

[0035] Step 2.3.2: Select the cosine similarity function cos_sim(x,y) as the kernel function for measuring the similarity between positive and negative sample pairs, which is expressed as follows:

[0036]

[0037] ||x|| and ||y|| represent the modulus of vector x and y, i.e., the length of the vector. In the cosine similarity function, their function is to normalize the vector to ensure that the calculated similarity is only related to the direction of the vector, but not to the size of the vector.

[0038] Step 2.3.3: Add filter g(u ij) controls whether the loss of a positive sample is included in L IPC , which is expressed as follows:

[0039]

[0040] Among them, u ij For example C i With a positive sample C' +j The IoU (Intersection over Union) value, when u ij When g(u ij )=0, the loss of this positive sample is not included in L IPC ;

[0041] Therefore, the instance proposal comparison loss function is expressed as:

[0042]

[0043] Where N is the number of instances in the image, C and C′ are the instance target contrast vector and the proposed region contrast vector, respectively, and τ is the temperature coefficient, which determines L IPC The degree of attention paid to negative samples that are easily misclassified as positive samples, i.e., hard-to-classify negative samples;

[0044] Step 2.3.4: The original view feature C and the enhanced view feature C′ are compared and the contrast loss is calculated according to the instance proposal contrast loss function. The unfrozen parameters in the Faster RCNN, Projector and instance-level context enhancement modules are further updated, and the instance proposal contrast branch stops gradient updating.

[0045] Step 3: Develop model training strategy and parameter settings;

[0046] Step 3.1: Basic training, train the Faster-RCNN detector on normal part samples;

[0047] Step 3.1.1: Determine the parameter settings for the basic training phase; unify the input image size to 1368×912, set the batch size to 4, and the number of iterations to 30,000. Use the SGD optimizer with an initial learning rate of 0.01 and a momentum coefficient of 0.9 to update the model parameters. The learning rate decays with the number of training iterations, and the decay coefficient is 1×10 -4 ;

[0048] Step 3.1.2: Perform basic training. Use a sufficient amount of base class samples, i.e. normal samples, to train the Faster RCNN detector to provide rich prior knowledge for the fine-tuning stage. All its components participate in gradient descent to update parameters. The loss function of this stage is expressed as follows:

[0049] Lb =L rpn +L cls +L reg

[0050] Where L rpn is the binary cross entropy loss of RPN for the candidate box, L cls Represents the multi-classification cross entropy loss generated by Classifier, L reg The smoothed-L1 loss output by Regressor is used for bounding box regression;

[0051] Step 3.2: Add instance proposal comparison branch and instance-level context enhancement module to the basic training, and fine-tune using a defect category dataset with only K instances per category;

[0052] Step 3.2.1: Determine the parameter settings for the fine-tuning training phase. Based on the parameter values ​​determined in step 3.1.1, the number of iterations is changed to 6000, the initial learning rate is changed to 0.001, the temperature coefficient τ = 0.2, φ = 0.7, σ = 0.4;

[0053] Step 3.2.2: Perform fine-tuning training. In the fine-tuning stage, the instance proposal comparison branch and the instance-level context enhancement module are added to achieve the purpose of instance proposal comparison learning and context enhancement. In order to avoid introducing too many additional parameters and causing overfitting, the backbone network and ROIAlign of the FasterRCNN detector are frozen, and the instance proposal comparison branch stops gradient descent to prevent model collapse. The backbone network, Box Head and other parts contained in it share parameters with FasterRCNN detection. In addition, K instances of each new class are randomly sampled from the new class samples (defect samples) in the training set to form a small sample defect class data set, and fine-tuning is performed on the basis of the training stage. The loss function of this stage is expressed as follows:

[0054] L c =L rpn +L cls +L reg +λL IPC

[0055] Where L IPC is the contrast loss function described in step 2.3, λ = 0.3;

[0056] Step 3.3: Model reasoning, during model reasoning, the instance proposal comparison branch is removed, and the input of the instance-level context enhancement module is changed from the instance target score vector and the proposal region score vector to only the proposal region score vector;

[0057] Step 4: Extract image features, identify characteristic defects, extract equipment defect-related parameters, and determine the degree of defects;

[0058] Step 5: Analyze the defect detection results of power equipment components and deduce the health status of the equipment; clarify the damaged state of the equipment, and then predict the development trend of future defects, and then determine the health status of the equipment to facilitate timely maintenance and avoid subsequent safety hazards. Among them, the health status is divided into healthy, good, and unhealthy, and defect-free equipment is healthy.

[0059] Compared with the prior art, the present invention has the following advantages:

[0060] Compared with the current detection methods based on data enhancement, metric learning, graph convolution and other technologies, the advantages of this invention are mainly reflected in the following three aspects:

[0061] (1) Good precision performance. The performance of this model is evaluated by measuring the average AP value of three types of defects: casing cracks, low oil level lines, and missing nuts. The detection effect of the proposed method on 10 shots is 1.4%, 2.7%, and 4.0% higher than that of other mainstream small sample target detection models VFA, FSOD-KI, and DMNet, respectively, showing good defect detection accuracy.

[0062] (2) Strong robustness. The method of the present invention uses the features of the cropped instances in contrastive learning to guide the model to generate key features in the region proposal to distinguish between the target and the background that are difficult to separate structurally, so it has a better detection effect on dense small targets and targets with large background noise. In addition, because the ICE module can use contextual information as supplementary knowledge to enhance the discrimination of targets, the present invention has a stronger recognition ability for occluded targets.

[0063] (3) Rich types of defect detection. The defect types that can be detected by the method proposed in the present invention include but are not limited to casing cracks, low oil level lines, and missing nuts. The three selected defects, especially the surface defect category of casing cracks, are difficult to detect. Therefore, the present invention is a small sample defect detection method with good generalization. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 This is a flow chart of a method for predicting and analyzing substation equipment defects based on contrastive learning;

[0065] Figure 2 It is a schematic diagram of the overall frame structure;

[0066] Figure 3 This is a schematic diagram of the ICE module. DETAILED DESCRIPTION

[0067] In order to gain a deeper understanding of the present invention, we will provide a comprehensive and detailed description of the present invention. However, the present invention has multiple implementations and is not limited to the specific examples listed herein. The presentation of these examples is intended to deepen the comprehensive understanding of the disclosure of the present invention.

[0068] A method for predicting and analyzing substation equipment defects based on contrastive learning, the flow chart of the method is as follows: Figure 1 As shown, the method comprises the following steps:

[0069] Step 1: Construct a small sample image dataset of substation defects; ensure that the dataset covers three types of defects: casing cracks, low oil level line, and missing nuts, and include samples of normal state for comparison; use the Pascal VOC dataset format to construct a small sample image dataset of substation defects. This small sample image dataset of substation defects is divided into two parts: training set and test set, which contain 2936 and 978 images respectively. The image pixel size is 5472×3648. The dataset covers the categories of power equipment components. The distribution of different categories in the image dataset is shown in Table 1. According to the benchmark of the small sample target detection dataset, the normal category with a large amount of training data is used as the base class, and the defect category is used as the new class, that is, the normal categories such as safe oil level, fixed nut, and casing are used as the base class, and the three defect categories of casing cracks, low oil level line, and missing nuts are used as new classes. Make a K-shot (K=1,5,10,20) small sample dataset of the new class, that is, randomly sample K instances of each new class.

[0070] Table 1 Dataset distribution table

[0071]

[0072]

[0073] Step 2: Build a small sample defect detection model for substation equipment that includes instance proposal comparison branch, instance-level context enhancement module, and Faster RCNN detector; its overall framework is as follows Figure 2 As shown;

[0074] Step 2.1: Construct instance proposal comparison branch;

[0075] Step 2.1.1: Input the training image X into the Faster RCNN detector, extract multi-scale features through the backbone network ResNet101 and FPN (Feature Pyramid Network), then RPN and ROI Align generate a certain number of proposed regions on feature maps of different scales and unify the sizes to obtain the proposed region features N Roi represents the number of proposed regions;

[0076] Step 2.1.2: The proposed region feature V′ is transformed into a dimension through two fully connected layers in the Box Head Then the proposed region feature V′ is converted into a comparison vector through the projector Projector as a target enhancement view required for contrastive learning;

[0077] Steps 2.1.1 and 2.1.2 are formally expressed as:

[0078] C′=Pro(BH(RA(RPN(F FPN (X)),F FPN (X))))

[0079] Among them, F FPN (·) is the backbone network combined with FPN, RPN(·), RA(·), BH(·), and Pro(·) represent RPN, ROI-Align, BoxHead, and Projector, respectively;

[0080] Step 2.1.3: Use the position information in the training image X label to crop all the objects A in the image and reshape them to a size of 224×224, that is, N GT is the number of instance targets in the training image X;

[0081] Step 2.1.4: Use the backbone network ResNet101 and Box Head in the instance proposal comparison branch to extract features and encode all targets A. The backbone network ResNet101 and Box Head have the same structure as the Faster RCNN detector and share network parameters, such as Figure 2 As shown in the instance proposal comparison branch; therefore, the instance target feature is obtained after the Box Head Then send it to the parameter-sharing projector Projector to convert the instance target features Convert to contrast vector As the target original view required for contrastive learning;

[0082] Steps 2.1.3 and 2.1.4 are formally expressed as:

[0083]

[0084] Among them, Crop(·) means cropping the instance target from the input;

[0085] Step 2.2: Construct an instance level context enhancement module (ICE).

[0086] Step 2.2.1: Extract the score vector matrix for all proposed regions after the linear layer in the classification head Classifier of the FasterRCNN detector Each row corresponds to the representation of the proposed region information;

[0087] Step 2.2.2: Add a linear layer that shares parameters with the linear layer of the FasterRCNN detector after the backbone network Box Head in the instance proposal comparison branch, such as Figure 3 As shown, it is used to generate the score vector matrix of the instance target cropped from the input image Each row corresponds to the representation of instance target information, where N GT is the number of instance targets in the training image X, that is, the number of real boxes, C b is the number of base class categories, and the instance target score vector matrix S is used as context information to enhance the proposed area;

[0088] Step 2.2.3: Pass the proposed region score vector matrix Q and the instance target score vector matrix S through the fully connected layers y(·) and q(·) with residual structures respectively, and then perform matrix multiplication to obtain the context relationship matrix The i-th row vector of the context matrix W Represents the relationship weight between the i-th proposed region and the instance target in the image;

[0089] Step 2.2.4: Obtain the weighted context information matrix by multiplying the context relationship matrix W with the instance target score vector matrix S

[0090] Step 2.2.5: Add the score vector matrix Q of the proposed region to the context information matrix E, aggregate the context information into the proposed region, and obtain the enhanced score vector matrix of the proposed region

[0091] Steps 2.2.1 to 2.2.5 are formally expressed as:

[0092]

[0093] Step 2.2.6: Add a dimension C between the output of the instance-level context enhancement module and the classification head Classifier n The linear layer N_linear is used to transform the score vector matrix The rich semantic space information in the Among them C n is the number of new categories;

[0094] Step 2.2.7: Score the new class After being concatenated with the original linear layer output in the classification head Classifier, it is sent to the Softmax function to obtain the prediction results of the proposed area content on the base class and the new class.

[0095] Steps 2.2.6 to 2.2.7 are formally expressed as:

[0096]

[0097] Among them, Concat() means concatenating the base class and the new class prediction score vector;

[0098] Step 2.3: Design instance proposal comparison loss function;

[0099] Step 2.3.1: For a certain instance C i , and the contrast vectors of the n proposal regions whose intersection and union ratio is greater than the threshold σ are taken as instances C i Positive sample C' + , forming a positive sample pair (C i ,C' + ), the contrast vectors of the remaining m proposal regions are used as instances C i Negative samples C' - , forming a negative sample pair (C i ,C' - );

[0100] Step 2.3.2: Select the cosine similarity function cos_sim(x,y) as the kernel function for measuring the similarity between positive and negative sample pairs, which is expressed as follows:

[0101]

[0102] ||x|| and ||y|| represent the modulus of vector x and y, i.e., the length of the vector. In the cosine similarity function, their function is to normalize the vector to ensure that the calculated similarity is only related to the direction of the vector, but not to the size of the vector.

[0103] Step 2.3.3: Add filter g(u ij ) controls whether the loss of a positive sample is included in L IPC , which is expressed as follows:

[0104]

[0105] Among them, u ij For example C i With a positive sample C' +j The IoU (Intersection over Union) value, when uij When it is less than the threshold value φ, g(u ij )=0, the loss of this positive sample is not included in L IPC ;

[0106] Therefore, the instance-proposal contrastive loss (IPC Loss) is expressed as:

[0107]

[0108] Where N is the number of instances in the image, C and C′ are the instance target contrast vector and the proposed region contrast vector, respectively, and τ is the temperature coefficient, which determines L IPC The degree of attention paid to negative samples that are easily misclassified as positive samples, i.e., hard-to-classify negative samples;

[0109] Step 2.3.4: The original view feature C and the enhanced view feature C′ calculate the contrast loss according to the instance proposal contrast loss function, further update the unfrozen parameters in Faster RCNN, Projector and instance-level context enhancement modules, and stop the gradient update of the instance proposal contrast branch.

[0110] Step 3: Develop model training strategy and parameter settings;

[0111] Step 3.1: Basic training, train the Faster-RCNN detector on normal part samples;

[0112] Step 3.1.1: Determine the parameter settings for the basic training phase; unify the input image size to 1368×912, set the batch size to 4, and the number of iterations to 30,000. Use the SGD optimizer with an initial learning rate of 0.01 and a momentum coefficient of 0.9 to update the model parameters. The learning rate decays with the number of training iterations, and the decay coefficient is 1×10 -4 ;

[0113] Step 3.1.2: Perform basic training. Use a sufficient amount of base class samples, i.e. normal samples, to train the Faster RCNN detector to provide rich prior knowledge for the fine-tuning stage. All its components participate in gradient descent to update parameters. The loss function of this stage is expressed as follows:

[0114] L b =L rpn +L cls +L reg

[0115] Where L rpn is the binary cross entropy loss of RPN for the candidate box, L clsRepresents the multi-classification cross entropy loss generated by Classifier, L reg The smoothed-L1 loss output by Regressor is used for bounding box regression;

[0116] Step 3.2: Add instance proposal comparison branch and instance-level context enhancement module to the basic training, and fine-tune using a defect category dataset with only K instances per category;

[0117] Step 3.2.1: Determine the parameter settings for the fine-tuning training phase. Based on the parameter values ​​determined in step 3.1.1, the number of iterations is changed to 6000, the initial learning rate is changed to 0.001, the temperature coefficient τ = 0.2, φ = 0.7, σ = 0.4;

[0118] Step 3.2.2: Perform fine-tuning training. In the fine-tuning stage, the instance proposal comparison branch and the instance-level context enhancement module are added to achieve the purpose of instance proposal comparison learning and context enhancement. In order to avoid introducing too many additional parameters and causing overfitting, the backbone network and ROIAlign of the FasterRCNN detector are frozen, and the instance proposal comparison branch stops gradient descent to prevent model collapse. The backbone network, Box Head and other parts contained in it share parameters with the FasterRCNN detector. In addition, K instances of each new class are randomly sampled from the new class samples (defect samples) in the training set to form a small sample defect class data set, and fine-tuning is performed on the basis of the training stage. The loss function of this stage is expressed as follows:

[0119] L c =L rpn +L cls +L reg +λL IPC

[0120] Where L IPC is the contrast loss function described in step 2.3, λ = 0.3;

[0121] Step 3.3: Model reasoning, during model reasoning, the instance proposal comparison branch is removed, and the input of the instance-level context enhancement module is changed from the instance target score vector and the proposal region score vector to only the proposal region score vector;

[0122] Step 4: Extract image features, identify characteristic defects, extract equipment defect-related parameters, and determine the degree of defects;

[0123] Step 5: Analyze the defect detection results of power equipment components and deduce the health status of the equipment; clarify the damaged state of the equipment, and then predict the development trend of future defects, and then determine the health status of the equipment to facilitate timely maintenance and avoid subsequent safety hazards. Among them, the health status is divided into healthy, good, and unhealthy, and defect-free equipment is healthy.

[0124] The performance of this model is evaluated by measuring the average AP value of three types of defects, namely casing cracks, low oil level lines, and missing nuts, on a small sample image dataset of substation defects. It is compared with other mainstream small sample target detection models and visualized. The experimental results are shown in Table 2, where the underlined and bold labels are the best and second best results under K-shot, respectively. The experimental results show that instance proposal contrast learning and context enhancement modules help improve the detection accuracy of the model for defect categories under small sample conditions. The detection effect of the proposed method on 10 shots is 1.4%, 2.7%, and 4.0% higher than that of other mainstream small sample target detection models VFA, FSOD-KI, and DMNet, respectively, showing good defect detection accuracy.

[0125] Table 2 Performance comparison of different detection methods on image datasets

[0126]

[0127]

[0128] Ablation experiments were conducted on a small sample image dataset of substation defects to verify the effectiveness of the contrast branch and context enhancement module, as shown in Table 3. The results show that the contrast branch uses instance features to guide RPN to generate more discriminative proposal region features, which expands the difference between feature vectors between classes in the feature space, so that the detection accuracy of various types of defects after adding the contrast branch is improved by 4.8%, 6.0% and 4.4% respectively compared with the baseline; the addition of ICE context enhancement capability improves the detection accuracy by 4.0%, 2.5% and 3.8% respectively.

[0129] Table 3 Comparison of ablation experiment results on image datasets

[0130]

[0131] In addition, the computational complexity of the proposed method and the baseline model FSCE is compared through three indicators: the number of model parameters, the number of floating-point operations, and the reasoning time for a single image, in order to explore its feasibility in practical applications. As shown in Table 4, thanks to the training strategy of parameter sharing of the comparison branch, the number of parameters of the model of the present invention has only increased by 0.11M compared with the baseline. This increase mainly comes from the comparison branch projector and the linear layer in the ICE module. In addition, the number of floating-point operations FLOPs of the model in the reasoning stage has increased by 0.21G compared with the baseline. Since the comparison branch is completely removed in the reasoning stage, this increase only comes from the context enhancement process of the ICE module. Finally, the reasoning time for a single image increased by 0.004 seconds, indicating that the model of the present invention can maintain the performance of real-time reasoning while improving the detection accuracy.

[0132] Table 4. Comparison of complexity between this method and the baseline model

[0133]

[0134] The contents not described in detail in the specification of the present invention belong to the prior art known to the professional and technical personnel in the field. Although the illustrative specific embodiments of the present invention are described above to facilitate the understanding of the present invention by the technical personnel in the field, it should be clear that the present invention is not limited to the scope of the specific embodiments. For the ordinary technical personnel in the field, as long as various changes are within the spirit and scope of the present invention defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.

Claims

1. A method for predicting and analyzing substation equipment defects based on contrastive learning, characterized in that: The method comprises the following steps: Step 1: Construct a small sample image dataset of substation defects; divide the image dataset into two parts: training set and test set; Step 2: Build a small sample defect detection model for substation equipment that includes instance proposal comparison branch, instance-level context enhancement module, and Faster RCNN detector; Step 3: Develop model training strategy and parameter settings; Step 4: Extract image features, identify characteristic defects, extract equipment defect-related parameters, and determine the degree of defects; Step 5: Analyze the defect detection results of power equipment components and deduce the health status of the equipment.

2. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 1, characterized in that: The specific operation of step 2: constructing a small sample defect detection model for substation equipment including an instance proposal comparison branch, an instance-level context enhancement module, and a Faster RCNN detector is as follows: Step 2.1: Construct instance proposal comparison branch; Step 2.2: Build an instance-level context enhancement module; Step 2.3: Design the instance proposal comparison loss function.

3. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 2, characterized in that: The specific operations of step 3: formulating model training strategy and parameter setting are as follows: Step 3.1: Basic training, train the Faster-RCNN detector on normal part samples; Step 3.2: Add instance proposal comparison branch and instance-level context enhancement module to the basic training, and fine-tune using a defect category dataset with only K instances per category; Step 3.3: Model Reasoning, during model reasoning, the instance proposal comparison branch is removed, and the input of the instance-level context enhancement module is changed from the instance target score vector and the proposal region score vector to only the proposal region score vector.

4. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 3, characterized in that: The specific operations of step 2.1: constructing the instance proposal comparison branch are as follows: Step 2.1.1: Input the training image X into the Faster RCNN detector, extract multi-scale features through the backbone network ResNet101 and FPN, then RPN and ROI Align generate a certain number of proposed regions on feature maps of different scales and unify the sizes to obtain the proposed region features N Roi represents the number of proposed regions; Step 2.1.2: The proposed region feature V′ is transformed into a dimension through two fully connected layers in the Box Head Then the proposed region feature V′ is converted into a comparison vector through the projector Projector as a target enhancement view required for contrastive learning; Steps 2.1.1 and 2.1.2 are formally expressed as: C′=Pro(BH(RA(RPN(F FPN (X)),F FPN (X)))) Among them, F FPN (·) is the backbone network combined with FPN, RPN(·), RA(·), BH(·), and Pro(·) represent RPN, ROI-Align, Box Head, and Projector, respectively; Step 2.1.3: Use the position information in the training image X label to crop all the objects A in the image and reshape them to a size of 224×224, that is, N GT is the number of instance targets in the training image X; Step 2.1.4: Use the backbone network ResNet101 and Box Head in the instance proposal comparison branch to extract and encode the features of all targets A, and obtain the instance target features after Box Head. Then send it to the parameter-sharing projector Projector to convert the instance target features Convert to contrast vector As the target original view required for comparative learning; the backbone network ResNet101 and Box Head have the same structure as the Faster RCNN detector and share network parameters; Steps 2.1.3 and 2.1.4 are formally expressed as: C=Pro(BH((F FPN (Crop(X))))) Among them, Crop(·) means cropping instance targets from the input.

5. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 4, characterized in that: The specific operations of step 2.2: constructing the instance-level context enhancement module are: Step 2.2.1: Extract the score vector matrix for all proposed regions after the linear layer in the classification head Classifier of the FasterRCNN detector Each row corresponds to the representation of the proposed region information; Step 2.2.2: Add a linear layer that shares parameters with the linear layer of the Faster RCNN detector after the backbone network Box Head in the instance proposal comparison branch to generate a score vector matrix of the instance target cropped from the input image. Each row corresponds to the representation of instance target information, where N GT is the number of instance targets in the training image X, that is, the number of real boxes, C b is the number of base class categories, and the instance target score vector matrix S is used as context information to enhance the proposed area; Step 2.2.3: Pass the proposed region score vector matrix Q and the instance target score vector matrix S through the fully connected layers y(·) and q(·) with residual structures respectively, and then perform matrix multiplication to obtain the context relationship matrix The i-th row vector of the context matrix W Represents the relationship weight between the i-th proposed region and the instance target in the image; Step 2.2.4: Obtain the weighted context information matrix by multiplying the context relationship matrix W with the instance target score vector matrix S Step 2.2.5: Add the score vector matrix Q of the proposed region to the context information matrix E, aggregate the context information into the proposed region, and obtain the enhanced score vector matrix of the proposed region Steps 2.2.1 to 2.2.5 are formally expressed as: Step 2.2.6: Add a dimension C between the output of the instance-level context enhancement module and the classification head Classifier n The linear layer N_linear is used to transform the score vector matrix The rich semantic space information in the Among them C n is the number of new categories; Step 2.2.7: Score the new class After being concatenated with the original linear layer output in the classification head Classifier, it is sent to the Softmax function to obtain the prediction results of the proposed area content on the base class and the new class. Steps 2.2.6 to 2.2.7 are formally expressed as: Among them, Concat() means concatenating the base class and the new class prediction score vector.

6. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 5, characterized in that: The specific operation of step 2.3: designing an example to propose a contrast loss function is: Step 2.3.1: For a certain instance C i , and the contrast vectors of the n proposal regions whose intersection and union ratio is greater than the threshold σ are taken as instances C i Positive sample C' + , forming a positive sample pair (C i ,C' + ), the contrast vectors of the remaining m proposal regions are used as instances C i Negative samples C' - , forming a negative sample pair (C i ,C′ - ); Step 2.3.2: Select the cosine similarity function cos_sim(x,y) as the kernel function for measuring the similarity between positive and negative sample pairs, which is expressed as follows: ||x||, ||y|| represent the modulus of vector x and y, i.e. the length of the vector; Step 2.3.3: Add filter g(u ij ) controls whether the loss of a positive sample is included in L IPC , which is expressed as follows: Among them, u ij For example C i With a positive sample C′ +j The IoU value, when u ij When it is less than the threshold value φ, g(u ij )=0, the loss of this positive sample is not included in L IPC ; Therefore, the instance proposal comparison loss function is expressed as: Where N is the number of instances in the image, C and C′ are the instance target contrast vector and the proposed region contrast vector, respectively, and τ is the temperature coefficient, which determines L IPC The degree of attention paid to negative samples that are easily misclassified as positive samples, i.e., hard-to-classify negative samples; Step 2.3.4: The original view feature C and the enhanced view feature C′ calculate the contrast loss according to the instance proposal contrast loss function, further update the unfrozen parameters in Faster RCNN, Projector and instance-level context enhancement modules, and stop the gradient update of the instance proposal contrast branch.

7. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 6, characterized in that: The specific operation of step 3.1 basic training, training the Faster-RCNN detector on normal component samples, is as follows: Step 3.1.1: Determine the parameter settings for the basic training phase; unify the input image size to 1368×912, set the batch size to 4, and the number of iterations to 30,000. Use the SGD optimizer with an initial learning rate of 0.01 and a momentum coefficient of 0.9 to update the model parameters. The learning rate decays with the number of training iterations, and the decay coefficient is 1×10 -4 ; Step 3.1.2: Perform basic training. Use a sufficient amount of base class samples, i.e. normal samples, to train the Faster RCNN detector. All its components participate in gradient descent to update parameters. The loss function at this stage is expressed as follows: L b =L rpn +L cls +L reg Where L rpn is the binary cross entropy loss of RPN for the candidate box, L cls Represents the multi-classification cross entropy loss generated by Classifier, L reg The smoothed-L1 loss output by Regressor is used for bounding box regression.

8. A method for predicting and analyzing substation equipment defects based on contrastive learning according to claim 7, characterized in that: The specific operations of step 3.2 in which the instance proposal comparison branch and the instance-level context enhancement module are added to the basic training and fine-tuning is performed using a defect category dataset consisting of only K instances of each category are as follows: Step 3.2.1: Determine the parameter settings for the fine-tuning training phase. Based on the parameter values ​​determined in step 3.1.1, the number of iterations is changed to 6000, the initial learning rate is changed to 0.001, the temperature coefficient τ = 0.2, φ = 0.7, σ = 0.4; Step 3.2.2: Perform fine-tuning training. In the fine-tuning stage, add the instance proposal comparison branch and the instance-level context enhancement module, freeze the backbone network and ROIAlign of the FasterRCNN detector, and stop the gradient descent of the instance proposal comparison branch; randomly sample K instances of each new class from the new class samples in the training set to form a small sample defect class data set, and perform fine-tuning on the basis of the training stage. The loss function of this stage is expressed as follows: THE c =L rpn +L cls +L reg +λL IPC Where L IPC is the contrast loss function described in step 2.3, λ = 0.3.