A small sample photovoltaic circuit board fault component detection method

By introducing the Swin Transformer module and the correlation matching module, combined with the meta-target detection head, the problem of sample imbalance in photovoltaic circuit board fault detection is solved, achieving high-precision fault detection with a small number of samples, and improving the accuracy and stability of detection.

CN122368818APending Publication Date: 2026-07-10XIAN UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAN UNIV OF TECH
Filing Date
2026-03-16
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing machine learning methods suffer from low accuracy in detecting a small number of categories in photovoltaic circuit board fault detection due to imbalanced samples.

Method used

The meta-learning approach combines the Swing Transformer module, the association matching module, and the meta-object detection head. It is trained with a small number of samples, uses the rich feature distribution of the base class to guide the learning of new class features, and enhances the isolation between classes through the interval loss function.

Benefits of technology

It significantly improves the accuracy and stability of fault detection for small-sample photovoltaic circuit boards, and can effectively identify complex faults with a very small number of samples, thereby improving the accuracy and robustness of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122368818A_ABST
    Figure CN122368818A_ABST
Patent Text Reader

Abstract

A meta-detection method for small-sample photovoltaic circuit board faults includes the following steps: creation of base class and new class datasets, network construction, model training, evaluation, and testing. Addressing the issue of imbalanced sample numbers and scarcity of some fault samples in photovoltaic circuit board fault detection, this method proposes a meta-small-sample photovoltaic circuit board fault detection approach. It introduces the concept of meta-learning, extracting the feature distribution of new classes through an association matching module and a meta-probe, and performing association matching with the base class to improve detection accuracy. Simultaneously, an interval loss function is used to prevent confusion between the matched new class and the base class. Compared to traditional object detection, this method improves the detection accuracy of new classes in small samples and solves the problem of limited sample numbers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of photovoltaic circuit board fault detection technology, specifically relating to a method for detecting fault elements in a small sample of photovoltaic circuit boards. Background Technology

[0002] During the operation of photovoltaic (PV) circuit boards, factors such as insulation degradation and overvoltage / overcurrent can cause malfunctions, severely impacting the overall performance of the PV system and potentially leading to safety issues. Therefore, it is crucial to promptly identify and repair PV circuit board malfunctions.

[0003] Currently, the main detection methods include: 1) Electrical parameter analysis: This method analyzes the output voltage and current parameters of the photovoltaic circuit board to identify abnormal indicators. The monitoring system records voltage and current data in real time, compares these values ​​with normal values, and uses accurate numerical data to analyze the faults of the photovoltaic circuit board. However, it is not accurate enough for identifying complex fault types. 2) Acoustic detection: This method mainly targets abnormal sounds accompanying photovoltaic circuit board faults. Sensors record and analyze the sounds around the photovoltaic board. Although it can detect early potential faults, it is relatively sensitive to environmental noise and has high environmental requirements. 3) Optical detection: This method uses optical imaging to identify physical defects such as surface damage and discoloration of the photovoltaic circuit board. While it is helpful for detecting external physical damage, it is difficult to detect internal faults. 4) Machine learning detection: This method uses computer vision and machine learning algorithms to analyze images of the photovoltaic circuit board. It trains a deep learning model by collecting a large number of sample datasets, resulting in high detection accuracy and the ability to identify complex faults.

[0004] While machine learning-based object detection offers advantages in robustness and accuracy compared to the aforementioned methods, it requires a large number of samples for training. However, in photovoltaic circuit board fault detection, the number of samples for different fault classes is often imbalanced. This imbalanced sample size limits the effectiveness of training models with fewer samples from certain classes, resulting in a significant drop in detection accuracy compared to models trained with a large number of samples. Therefore, this application introduces a meta-learning approach combined with object detection methods, enabling the model to achieve good detection results with a limited number of samples. Summary of the Invention

[0005] To overcome the shortcomings of the prior art, the purpose of this invention is to provide a small-sample photovoltaic circuit board fault element detection method, which solves the small-sample problem of existing machine learning methods in photovoltaic circuit board fault detection, namely, the problem that the uneven number of samples of different categories leads to low accuracy when detecting a small number of categories. This method significantly improves the detection accuracy of a small number of new categories and effectively solves the problem of a small number of new categories.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is: a method for detecting fault elements in a small sample photovoltaic circuit board, comprising the following steps: Step 1, Data Preparation 1-a. Design a scheme for capturing dataset images using drones; 1-b. Take images of the photovoltaic circuit board fault dataset; 1-c. Perform thermal imaging processing on the photovoltaic circuit board fault dataset images to obtain thermal images of the circuit boards; 1-d. Manually annotate the thermal images of the circuit board to obtain a photovoltaic circuit board fault annotation dataset; 1-e. Preprocess the photovoltaic circuit board fault labeling dataset, including noise reduction and data standardization; Step 2, Design the network structure 2-a. Design the network structure, including convolutional layers, pooling layers, a Swing Transformer module, and a meta-detection head; 2-b. The network structure incorporates an association matching module and a feature alignment module for training of small sample meta-object detection; 2-c. Introduce a meta-target detection head module to distinguish different categories of targets; Step 3, train the network 3-a. After preprocessing the new class dataset in step 1-e, divide it into training set, validation set and test set; 3-b. After preprocessing the base class dataset in step 1-e, divide it into a support set, a query set, and a test set; 3-c. In the base class training phase, the network model is trained iteratively on the training set, and the network parameters are updated through forward propagation and back propagation to train the base class model; 3-d. In the new class training phase, based on the base class model, the new class support set is matched and associated with the base class training set, and the network model is trained iteratively. The network parameters are updated through forward propagation and back propagation to obtain the new class model. Step 4, Evaluation and Testing 4-a. Validate the new class model obtained in 3-d using the query set of the new class dataset, and adjust the model hyperparameters; 4-b. Use the test set to evaluate the performance of the new class model obtained in 3-d, including precision and recall metrics, and obtain the performance evaluation results; 4-c. Optimize and adjust the new class model obtained in 3-d based on the performance evaluation results to improve model performance.

[0007] In step 1-a, the design of the drone-captured dataset image scheme includes: planning the drone path and capturing images of the photovoltaic circuit board dataset, treating each string of the power station as a path point, and after image processing, abstracting each string of the power station into a point mass; using the K-means clustering algorithm to cluster the path points, dividing the photovoltaic power station into several blocks, and using a turn-based path planning method to connect all path points together for capture.

[0008] In step 1-d, the thermal images of the circuit board are manually labeled and divided into a base class dataset and a new class dataset. The base class dataset contains fault categories with a large number of defects, while the new class dataset contains fault categories with a small number of defects. The manually labeled dataset is denoised using bilateral filtering and data standardization is performed to obtain a dataset image of a set size.

[0009] The spot and abnormal classes are selected as the base class datasets, and the strip class is selected as the new class dataset.

[0010] Bilateral filtering was used to denoise the manually labeled dataset, and data standardization was performed to obtain a dataset image of size 1920×1080.

[0011] In step 2, Faster R-CNN is selected as the detection framework, and Swin Transformer is selected as the backbone detection network.

[0012] The association matching module is used to calculate the similarity of semantic information between the new class and the base class datasets, and to establish an association between the image features of the new class and the most similar base class features; the formula for calculating the similarity is: (1) In formula (1), Indicates the first in the new class One sample, Represents the first in the base class One sample, This indicates the amount of information contained in the new class of samples. This indicates the amount of information contained in the base class sample. This represents the minimum amount of public information.

[0013] The aforementioned meta-target detection head module optimizes the model using an interval loss function to increase the separation between categories; the interval loss function is: (2) In formula (2), The preset interval threshold is used, and the other parameters are the same as those in formula (1).

[0014] In step 3-c, the total loss function during the base class training phase is: (6) in These are weighting coefficients used to balance classification loss and regression loss. For sample weights, A vector represents the predicted values ​​during the RPN training phase. These are the actual values ​​during the RPN training phase. It is the number of samples that the classification head participates in the calculation. This is the number of samples involved in the regression head calculation.

[0015] In step 3-d, the total loss function for the new class training phase is: (7) in , , , , is the interval loss function of formula (2), and the other parameters are the same as those of formula (6).

[0016] In step 3-d, the Adam optimizer is selected to optimize the parameters of the network model.

[0017] The beneficial effects of this invention are: Compared with the prior art, the present invention has the following advantages: By introducing the Swing Transformer module, the association matching module, and the meta-target detection head, the network can more effectively filter out background regions in the image. Furthermore, by combining local and global features, it is more effective in detecting different targets. This method can significantly improve the network's stability and detection accuracy. Finally, the small-sample photovoltaic circuit board fault detection method, through constructing a network model and training and optimizing it, ensures the model's effectiveness and accuracy in practical applications through detailed data preparation, model building, training, and evaluation steps. The embodiments described in this application can be combined with other embodiments. The significant effects of this invention are specifically reflected in the following aspects: 1) Effectively solves the problem of imbalanced sample size and significantly improves the detection accuracy of small-sample fault categories: Addressing the common problem of imbalanced sample size across different categories in photovoltaic circuit board fault data, this invention innovatively introduces a meta-learning approach. Through an association matching module, scarce new-category fault samples can be associated with base-category samples exhibiting similar features, and the rich feature distribution of the base classes is used to guide and adjust the feature learning of the new category. This method enables the model to learn effective feature representations even with only a very small number of new-category samples (e.g., 1-shot, 3-shot, 10-shot), thus overcoming the limitation of traditional object detection methods with low accuracy for small-sample categories. Experimental data shows that the average precision (AP) for the new category (strip class) reaches 31.4 in the 10-shot setting, a significant improvement compared to traditional methods using only a small number of samples.

[0018] 2) Enhancing Model Discriminability and Preventing Class Confusion: While introducing an association matching mechanism, this invention adds a meta-target detection head and employs a margin loss function. This loss function actively increases the margin between the new class and the base class in the feature space, effectively preventing the model from confusing the associated classes during the learning process and enhancing the discriminability between different fault categories. This design ensures that while utilizing base class knowledge to assist in learning the new class, a clear decision boundary is maintained, thereby guaranteeing the final classification accuracy.

[0019] 3) Strong feature extraction capability, integrating local and global information: This invention uses the Swing Transformer as the backbone network. Its unique hierarchical design and sliding window attention mechanism can effectively model the long-range dependencies of targets at different scales in the image, while retaining sufficient local detail information. This powerful feature extraction capability enables the network to more accurately focus on the fault area in the thermal image of the circuit board, filtering out complex background interference, and providing a high-quality feature foundation for subsequent association matching and classification regression tasks, thus improving the overall stability and robustness of the detection.

[0020] 4) High optimization efficiency and good model convergence: During network training, this invention employs the Adam optimizer for parameter optimization. The Adam optimizer combines the advantages of momentum and adaptive learning rate, accelerating the convergence of the training process and effectively handling the sparse gradient problem. Combined with the phased training strategy designed in this invention (pre-training the base class first, then fine-tuning the new class) and a specific loss function, the entire model training process is highly efficient and stable, such as... Figure 6 and Figure 7 The loss function curve shown is smooth, indicating that the model has good convergence characteristics.

[0021] 5) Highly practical, providing reliable technical support for photovoltaic operation and maintenance: This invention provides a complete technical solution from data acquisition (UAV path planning, thermal imaging), preprocessing, network construction, training to evaluation. This method not only performs excellently with small sample settings, but the final model also has good generalization ability, accurately identifying various photovoltaic circuit board fault types such as spot, abnormal, and strip (e.g., Figure 8 As shown in Figures 9 and 10, this provides an efficient and reliable automated solution for intelligent inspection and fault early warning of actual photovoltaic power plants, which helps to detect safety hazards in a timely manner and ensure the stable operation of photovoltaic systems. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the process of the present invention.

[0023] Figure 2 This is a flowchart illustrating the meta-fault detection network algorithm.

[0024] Figure 3 To detect the confusion matrix.

[0025] Figure 4 Line graph showing different shot accuracy levels.

[0026] Figure 5 The loss graph is used for training the base class.

[0027] Figure 6 Train the loss graph for the new class.

[0028] Figure 7 This is the detection diagram of the abnormal class, the base class of this invention.

[0029] Figure 8 To detect graphs for the base class spot class.

[0030] Figure 9 This is a detection image for the novel strip class of this invention. Detailed Implementation

[0032] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. The technical solutions in the embodiments of this application are clearly and completely described. The described embodiments are only some embodiments of this application, not all embodiments.

[0033] The small-sample photovoltaic circuit board fault detection method in this embodiment is implemented according to the following steps: The small-sample photovoltaic circuit board fault detection method includes four steps: data preparation, network structure design, network training, model evaluation and testing. Each step will now be explained in detail: Step 1: Dataset Preparation 1-a. Design a scheme for capturing dataset images using drones; Drone path planning involves planning the drone's path and capturing images of a photovoltaic circuit board dataset. Each string of photovoltaic circuit boards is treated as a path point, and after image processing, each string is abstracted into a single point mass. K-means clustering is then used to cluster these path points. The specific steps are as follows: 1-a-1, randomly initialize K cluster centers; 1-a-2, assign the drone to the cluster center that is closest to it; 1-a-3, update the center of each cluster to the mean of all data points in that cluster; 1-a-4, repeat the assignment and update process until the cluster center no longer changes or the maximum number of iterations is reached.

[0034] Using the K-means clustering algorithm, the photovoltaic power station is divided into several blocks. By using a turn-based path planning method, all path points are connected together, so that there will not be a large amount of empty space in the blocks when the drone flies. 1-b. Take images of the photovoltaic circuit board fault dataset; Drone image capture: The drone flies along a planned route and captures images of the photovoltaic power station, obtaining images of the photovoltaic circuit boards in the power station. 1-c. Perform thermal imaging processing on the photovoltaic circuit board fault dataset images to obtain thermal images of the circuit boards; Mapping the captured images of photovoltaic circuit boards to thermal images for processing and analysis helps identify abnormal temperature areas and detect circuit board faults. 1-d. Manually annotate the thermal images of the circuit boards to obtain a photovoltaic circuit board fault annotation dataset; The thermal image of the circuit board obtained in step 1-c is labeled using labelMe, a dataset labeling tool. The steps for using labelMe are as follows: 1) Download and install via GitHub; 2) Load the image to be labeled into the tool using labelMe; 3) Use the annotation tools in the toolbar to draw annotation areas on the image; 4) Assign category labels to the marked areas; 5) Save the labeled dataset as a VOC dataset.

[0035] The thermal images of the circuit boards were manually labeled and divided into a base class dataset and a new class dataset. The base class dataset contained classes with a large number of defects, while the new class dataset contained classes with a small number of samples. Since the spot and abnormal labels were numerous in the actual captured images, the base class dataset and the new class dataset were selected as the base class for small-sample photovoltaic circuit board fault detection. The strip class was scarce in the dataset, so it was selected as the new class. The images were further divided into different support sets, query sets, and validation sets based on different experimental shots. The labeled data consists of three classes: spot, abnormal, and strip. Based on the scarcity of each class, it is divided into a base class dataset and a new class dataset. The base class dataset contains the class with the most defects and includes both spot and abnormal categories. The new class dataset contains the strip class, which has fewer defects. The base class dataset is divided into training, validation, and test sets in a ratio of 8:1:1 according to step 3-a. The new class dataset is divided into support, query, and validation sets according to different experimental shots according to step 3-b.

[0036] 1-e. Preprocess the dataset images obtained in step 1-d, including noise reduction and data standardization; The labeled circuit board fault annotation dataset is subjected to bilateral filtering to remove noise interference that may be induced in the thermal image, and normalization is performed to map the image pixels to the same scale, resulting in a final dataset image of size 1920×1080.

[0037] Step 2, Design the network structure See Figure 2 , Figure 2 This document presents a flowchart of a meta-fault detection network algorithm, outlining a suitable network structure including convolutional layers, pooling layers, a Swing Transformer module, and a PRN detection head. This design aims to improve feature fusion and enhance detection accuracy.

[0038] 2-a. Design the network structure, including convolutional layers, pooling layers, a Swing Transformer module, and a meta-detection head; The Swin Transformer module, specifically its hierarchical feature map submodule, generates multi-scale feature maps through a hierarchical structure. It then merges features using Patch Merging to generate new feature representations, preserving more contextual information. Furthermore, it gradually obtains global features of the image through downsampling, making it more suitable for object detection. Faster R-CNN was chosen as the main detection framework for small-sample photovoltaic circuit board fault detection, with SwinTransformer as the backbone detection network. An association matching module was introduced on the basis of the network to perform small-sample target detection on photovoltaic circuit boards. The photovoltaic circuit board fault dataset obtained in step 1 is processed through the Swin Transformer module to obtain the feature vectors of each circuit board fault dataset, which are then entered into the association matching module.

[0039] 2-b. The network structure incorporates an association matching module and a feature alignment module for training in few-sample meta-object detection; The aforementioned association matching module, after obtaining the feature vector of the new class image, associates the feature vector of the new class image with the most similar base class feature vector through the association matching module. Then, it adjusts the distribution of the new class based on the features of the base class, resulting in a more compact distribution of the new class features. The formula for calculating the similarity between the semantic information of the new class features and the base class samples is as follows: (1) In formula (1), Indicates the first in the new class One sample, Represents the first in the base class One sample, This indicates the amount of information contained in the new class of samples. This indicates the amount of information contained in the base class sample. Indicates the minimum amount of public information; After calculating the similarity of images according to formula (1) and matching them, the network uses the labels of the base class as pseudo-labels of the new class samples for training, so that the new class model obtained by 3-d can learn the features of the new class while maintaining the knowledge of the base class.

[0040] 2-c. Introduce a meta-target detection head module to distinguish different categories of targets; The new class image is associated with the most similar base class through an association matching module. After the association is established, the distribution of the new class is adjusted through feature alignment to obtain a more compact distribution of the new class features. The new class model is trained using 3-D to learn the features of the new class while retaining some base class knowledge. To prevent the introduced association matching module from confusing the associated new class and base class, a meta-object detection head is introduced for optimization. The meta-object detection head is optimized by adding a margin loss to increase the separation between categories and enhance the distinguishability of the two categories. The margin loss function formula of the meta-detection head module is as follows: (2) In formula (2), The preset interval threshold is used, and the other parameters are the same as in formula (1). This module increases the separation between categories by continuously updating the interval loss function, so that the detection head can better distinguish between different categories.

[0041] Step 3, train the network The network training in this application is divided into two stages: the base class training stage and the new class fine-tuning stage. The base class training stage is conducted using a large number of base class samples to obtain the feature distribution of the base class categories and their corresponding detection head models. The new class training stage is conducted using a small number of base class samples and a small number of new class samples. Based on the base class training stage, fine-tuning is performed so that the new class samples can be better classified and regressed, resulting in better detection results.

[0042] 3-a. After preprocessing the base class dataset in step 1-e, divide it into a training set, a validation set, and a test set; 3-b. After preprocessing the new class dataset in step 1-e, divide it into a support set, a query set, and a test set; 3-c. In the base class training phase, the network model is trained iteratively on the training set, and the network parameters are updated through forward and back propagation to train the base class model; the specific steps are as follows: The two large defect datasets, spot and abnormal, obtained in step 1, are used as base class datasets for the base class training phase. All training, test, and validation sets in this phase are base class datasets, with a split ratio of 8:1:1. A large number of images of size 1920×1080 from the two base class datasets are input into the Swin Transformer network for feature extraction. The network processes the images through multiple convolutional and pooling layers, outputting a high-dimensional feature vector. At the same time, the network optimizes through backpropagation, continuously learning to extract effective features from the input images. The loss function is also used to continuously optimize the classification head and regression head, enabling the model to perform better detection.

[0043] In this stage, the base class model obtained in step 3-c is trained to perform high-precision classification and regression on these base class datasets. Through learning from a large number of samples, useful features for class differentiation are extracted, enabling it to accurately locate the target, while preparing for the training of new classes in the next stage.

[0044] 3-d. In the new class training phase, based on the base class model, the new class support set is matched and associated with the base class training set through association matching. The network model is trained iteratively, and the network parameters are updated through forward and back propagation to train the new class model. The specific steps in this phase are as follows: In the new class training stage, the small amount of strip new class data and the small amount of spot and abnormal base class data obtained in step 1 are divided into different shots according to different sample sizes. In this application, the support set of the three types of image data is divided into one image sample, three image samples, and ten image samples, corresponding to 1-shot, 3-shot, and 10-shot, respectively. All remaining samples are used as query sets to evaluate the performance of the new class model obtained in step 3-d. In this training stage, based on the base class training stage, the datasets of different shots obtained in step 3-d are fed into the new class model for training. After the data images are processed by the backbone network to extract the corresponding feature vectors, the new class images are similar to the most similar base class through the association matching module, and are matched with the most similar base class. The feature distribution of the new class is aligned to the associated base class according to the feature distribution of the base class. The similarity calculation formula is shown in formula (1): (1) In formula (1), Indicates the first in the new class One sample, Represents the first in the base class One sample, This indicates the amount of information contained in the new class of samples. This indicates the amount of information contained in the base class sample. Indicates the minimum amount of public information; After establishing the association between the new class and the base class, the new class model obtained in step 3-d aligns the features of the new class to the base class. The labels of the base class are used as pseudo-labels for training the new class. Through training, the model can learn the features of the new class while retaining some knowledge of the base class. This allows for achieving good detection results with a small number of samples.

[0045] To prevent confusion between the new class and the matching base class, a margin loss is introduced into the meta-detector head. The margin loss function is used to continuously optimize the meta-detector head and increase the class margin, so that the model can distinguish between the new class and the base class that are related to each other in the feature space. The formula for the margin loss function is shown in formula (2): (2) In formula (2), The preset interval threshold is used, and the other parameters are the same as those in formula (1).

[0046] The loss function during the base class training phase consists of two parts, and the total loss function is: (3) in The classification loss of the classifier, The regression loss of the box regressor; The classification loss function is: (4) in , , These are the weighting coefficients. Let a vector represent the predicted values ​​during the RPN training phase. These are the actual values ​​during the RPN training phase. This represents the number of samples.

[0047] The regression loss function is: (5) in , , These are the weighting coefficients. Let be a vector representing the bias predicted during the RPN training phase. This represents the actual offset during the RPN training phase. This represents the number of samples.

[0048] The total loss function for base class training is: (6) in These are weighting coefficients used to balance classification loss and regression loss. For sample weights, Let a vector represent the predicted values ​​during the RPN training phase. These are the actual values ​​during the RPN training phase. It is the number of samples that the classification head participates in the calculation. This is the number of samples involved in the regression head calculation.

[0049] The loss function for the new class training phase includes optimization of the meta-detector head, introducing margin loss, compared to the base class training phase. Therefore, the total loss function for the new class training is: (7) in , , , , Let be the interval loss function in formula (2). Let a vector represent the predicted values ​​during the RPN training phase. These are the actual values ​​during the RPN training phase. For the sample size, This represents the number of samples.

[0050] The optimizer used in this application is the Adam optimizer, and its algorithm flow is as follows: 1) Initialization parameters: Set the initial learning rate, first-order momentum coefficient, second-order momentum coefficient, first-order momentum vector, second-order momentum vector, and smoothing term; 2) Calculate the gradient: Make predictions using the input circuit board fault labeling dataset and calculate the gradient of the loss function using the set loss function; 3) Update momentum: Update the first-order momentum using a weighted moving average and the second-order momentum using a squared gradient weighted average, and update the parameters as well; 4) Repeat the steps to reach the predetermined number of iterations or to bring the loss function to converge.

[0051] The network optimizes the loss function using the Adam optimizer, enabling the model to converge faster.

[0052] Step 4, Model Evaluation and Testing: 4-a. Use the query set to validate the new class model obtained in step 3-d and adjust the model hyperparameters; Query set optimization: Use the query set to evaluate the trained model for new categories, and select network optimization methods to adjust the parameters. Compare the model performance under different parameters and select the optimal parameters. 4-b. Use the test set to evaluate the performance of the new class model obtained in 3-d, including precision and recall metrics, and obtain the performance evaluation results; Test set evaluation: The model is evaluated in the final stage to ensure its generalization ability and effectiveness in real-world applications; to quantitatively evaluate the small-sample target detection performance of the proposed method, the average accuracy index is used. To conduct an evaluation; It is used to measure the performance of the detection results when both localization and classification are correct. IoU represents the degree of overlap between the predicted box and the ground truth box. When the IoU between the predicted box and the ground truth box is not less than 0.50 and the categories are the same, it is judged as a correct detection. Based on the statistics of correct and incorrect detections under different confidence thresholds, the relationship curve between precision and recall can be obtained. AP50 is defined as the area of ​​this precision-recall curve. The higher the value, the better the detection performance. 4-c. Optimize and adjust the new class model obtained in step 3-d based on the performance evaluation results to improve model performance. Specifically: The obtained AP values ​​are shown in Table 3. After training, the AP of the new class is 12.4 in 1-shot, 21.8 in 3-shot, and 31.4 in 10-shot. The AP of the base class is 48.7 in 1-shot, 50.2 in 3-shot, and 51.7 in 10-shot. The loss curves for training the base class and the new class are shown in Table 3. Figure 6 and Figure 7 As shown, the visualization results for different categories are as follows: Figure 7 , Figure 8 and Figure 9 As shown.

[0053] Table 1 shows the experimental results of the new class model obtained in 3-d under different shots.

[0054] As shown in Table 1, the AP of the new defect strip increases with the increase of the number of samples, indicating that the method can learn the features of the new class gradually with a small number of samples; the AP of the base class spot and abnormal remains at a high level and does not decrease significantly due to the introduction of the new class, which shows that the detection of the base class is stable and the ability to quickly adapt to the new class.

[0055] Figure 3 The figure shows the confusion matrix of the classification head for the new class model obtained in 3-d under 3-shot conditions. As can be seen from the figure, the method of this invention has a certain ability to distinguish all three types of faults, with relatively good recognition of the abnormal class in the base class. However, there is significant confusion between the spot class in the base class and the strip class in the new class, mainly manifested in the fact that strip is easily classified as spot, while spot can also be classified as both abnormal and strip. This result indicates that different faults have similar local features, which can easily lead to misclassification.

[0056] Figure 4 This indicates that, due to the larger number of base class samples, the AP of the base class is significantly higher than that of the new class. However, as the number of new class samples increases, the AP of the new class also steadily improves, demonstrating that the model has the ability to quickly adapt to new classes.

[0057] Figure 5 and Figure 6 This indicates that as the number of training rounds increases, the losses in both the base class training phase and the new class training phase converge and eventually reach the optimal solution, demonstrating that the base class model and the new class model obtained from steps 3-c and 3-d have good stability.

[0058] Figure 7 , Figure 8 and Figure 9 The specific visualization of the detection results of the model, where Figure 7 and Figure 8 The images show the visual detection results for the base classes abnormal and spot, respectively. Figure 9 The image shows the visualization detection results for the new strip class. As can be seen from the figure, the final new class model obtained by step 3-d is relatively accurate and stable in locating abnormal class targets; at the same time, it can also provide effective candidate box localization for spot and strip classes, further demonstrating that this application has good practicality.

Claims

1. A method for detecting fault elements in a small sample photovoltaic circuit board, characterized in that, Includes the following steps: Step 1, Data Preparation 1-a. Design a scheme for capturing dataset images using drones; 1-b. Take images of the photovoltaic circuit board fault dataset; 1-c. Perform thermal imaging processing on the photovoltaic circuit board fault dataset images to obtain thermal images of the circuit boards; 1-d. Manually annotate the thermal images of the circuit board to obtain a photovoltaic circuit board fault annotation dataset; 1-e. Preprocess the photovoltaic circuit board fault annotation dataset, including noise reduction and data standardization; Step 2, Design the network structure 2-a. Design a network structure, which includes convolutional layers, pooling layers, a Swing Transformer module, and a meta-detection head; 2-b. The network structure incorporates an association matching module and a feature alignment module; 2-c. Introduce a meta-target detection head module to distinguish different categories of targets; Step 3, train the network 3-a. After preprocessing the new class dataset in step 1-e, divide it into training set, validation set and test set; 3-b. After preprocessing the base class dataset in step 1-e, divide it into a support set, a query set, and a test set; 3-c. During the base class training phase, the network model is iteratively trained using the training set of the base class dataset, and the network parameters are updated through forward propagation and back propagation to obtain the base class model; 3-d. In the new class training phase, based on the base class model, the new class support set is matched and associated with the base class training set, and the network model is trained iteratively. The network parameters are updated through forward propagation and back propagation to obtain the new class model. Step 4, Evaluation and Testing 4-a. Validate the new class model obtained in 3-d using the query set of the new class dataset, and adjust the model hyperparameters; 4-b. Use the test set to evaluate the performance of the new class model obtained in 3-d, including precision and recall metrics, and obtain the performance evaluation results; 4-c. Optimize and adjust the new class model obtained in 3-d based on the performance evaluation results to improve model performance.

2. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, In step 1-a, the design of the drone-captured dataset image scheme includes: planning the drone path and capturing images of the photovoltaic circuit board dataset, treating each string of the power station as a path point, and after image processing, abstracting each string of the power station into a point mass; using the K-means clustering algorithm to cluster the path points, dividing the photovoltaic power station into several blocks, and using a turn-based path planning method to connect all path points together for capture.

3. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, In step 1-d, the thermal images of the circuit board are manually labeled and divided into a base class dataset and a new class dataset. The base class dataset contains fault categories with a large number of defects, while the new class dataset contains fault categories with a small number of defects. The manually labeled dataset is denoised using bilateral filtering and data standardization is performed to obtain a dataset image of a set size.

4. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 3, characterized in that, The spot and abnormal classes are selected as the base class datasets, and the strip class is selected as the new class dataset.

5. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, In step 2, Faster R-CNN is selected as the detection framework, and Swin Transformer is selected as the backbone detection network.

6. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, The association matching module is used to calculate the similarity of semantic information between the new class and the base class datasets, and to establish an association between the image features of the new class and the most similar base class features; The formula for calculating similarity is: (1) In formula (1), Indicates the first in the new class One sample, Represents the first in the base class One sample, This indicates the amount of information contained in the new class of samples. This indicates the amount of information contained in the base class sample. This represents the minimum amount of public information.

7. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, The aforementioned meta-target detection head module optimizes the model using an interval loss function to increase the separation between categories; the interval loss function is: (2) In formula (2), The preset interval threshold is used, and the other parameters are the same as those in formula (1).

8. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, In step 3-c, the total loss function during the base class training phase is: (6) in These are weighting coefficients used to balance classification loss and regression loss. For sample weights, Let a vector represent the predicted values ​​during the RPN training phase. These are the actual values ​​during the RPN training phase. It is the number of samples that the classification head participates in the calculation. This is the number of samples involved in the regression head calculation.

9. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, In step 3-d, the total loss function for the new class training phase is: (7) in , , , , Let be the interval loss function in formula (2).

10. The method for detecting fault elements in a small sample photovoltaic circuit board according to claim 1, characterized in that, In step 3-d, the Adam optimizer is selected to optimize the parameters of the network model.