A method for photovoltaic panel defect diagnosis based on improved YOLOv12n
By improving the backbone network and neck feature pyramid structure of the YOLOv12n model, the feature extraction and fusion capabilities for photovoltaic panel defect detection are enhanced, solving the problem of insufficient accuracy of existing detection algorithms in complex environments, and realizing efficient and accurate diagnosis of photovoltaic panel defects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHANGZHOU UNIV
- Filing Date
- 2025-12-23
- Publication Date
- 2026-05-29
AI Technical Summary
Existing photovoltaic panel defect detection algorithms have limited accuracy in complex outdoor environments, especially in identifying defects in small targets, making it difficult to meet practical engineering needs.
An improved YOLOv12n object detection model was constructed by replacing the original Conv module with the DBAC module in the backbone network and building a multi-branch auxiliary feature pyramid network using the RepHMS module in the neck part to enhance feature extraction and fusion capabilities.
It improves the feature extraction and fusion capabilities of infrared thermal images of photovoltaic panels, enabling more accurate diagnosis of hot spots, hot spots, diode bypass damage, and abnormal low-temperature defects, reducing the false negative rate and improving detection accuracy.
Smart Images

Figure CN122115920A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention generally relate to the field of photovoltaic panel defect detection technology, and more particularly to a method for photovoltaic panel defect diagnosis based on an improved YOLOv12n. Background Technology
[0002] Against the backdrop of accelerated global energy structure transformation and the continuous advancement of carbon neutrality goals, the development and utilization of clean energy has become a core direction of national energy strategies. Renewable energy sources, represented by solar energy, are experiencing explosive growth. Among them, photovoltaic power generation, with its outstanding advantages such as inexhaustible resources, pollution-free energy conversion process, flexible and diverse installation scenarios, and low long-term operating costs, is being rapidly deployed on a large scale globally, becoming a key component of the energy supply system.
[0003] However, photovoltaic (PV) systems are exposed to a complex and ever-changing outdoor environment, making them highly susceptible to the combined effects of multiple factors, including wind and sand erosion, humidity fluctuations, diurnal temperature variations, surface dust accumulation, and bird droppings. This inevitably leads to various defects and performance degradation in PV modules during operation, typical problems including hot spot effects, solder joint detachment, surface shading contamination, and bypass diode failure. These defects directly disrupt the current balance within the PV panel, causing localized heat concentration, which not only accelerates module aging and significantly reduces photoelectric conversion efficiency but also severely impacts the power generation performance and lifespan of the entire PV system. If these defects are not detected and repaired in a timely manner, they can cause significant economic losses and may even lead to safety accidents such as partial module burnout, posing serious operational risks.
[0004] To address these issues, accurate defect detection has become a crucial step in ensuring the stable operation of photovoltaic systems. In recent years, deep learning-based target detection technology, with its powerful feature extraction capabilities, has been widely applied in photovoltaic defect identification, enabling automatic location and classification of defect areas. However, existing detection algorithms still face significant bottlenecks in complex outdoor environments: limited detection accuracy, high false negative rates, and insufficient ability to identify small target defects such as hot spots and abnormally low temperatures, making it difficult to meet practical engineering needs. Summary of the Invention
[0005] To address the above issues, this invention constructs a photovoltaic panel defect identification and detection model improved from the YOLOv12n target detection model, further enhancing the feature extraction and fusion capabilities of photovoltaic panel infrared thermal images. This enables more accurate diagnosis of four types of photovoltaic defects—hot spots, hot spots, diode bypass damage, and abnormally low temperatures—based on the input photovoltaic panel infrared thermal images.
[0006] According to an embodiment of the present invention, a method for diagnosing photovoltaic panel defects based on an improved YOLOv12n is provided.
[0007] In a first aspect of the invention, a method for defect diagnosis of photovoltaic panels based on an improved YOLOv12n is provided. The method includes: Step S01: Collect infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; Step S02: Construct a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: In the backbone network, replace the original Conv modules of P1, P3, P5 and P7 with DBAC modules, and replace the original A2C2f modules of P6 and P8 with A2C2f_MCA; in the neck part, adopt a multi-branch auxiliary feature pyramid network formed by RepHMS modules. Step S03: Train and test the photovoltaic panel defect diagnosis model, and input the images to be detected into the photovoltaic panel defect detection model in sequence for detection.
[0008] Furthermore, the DBAC module consists of parallel branches, namely DBCA_1x1 branch, DBCA_avg branch, DBCA_1x1_kxk branch, and DBCA_origin branch, during the training phase. Finally, the outputs of the four branches are added pixel by pixel, and then SiLU activation, global average pooling, one-dimensional convolution, and Sigmoid activation function are applied to obtain the final feature map.
[0009] Furthermore, the DBCA_1x1 branch first determines whether the number of groups is less than the number of output channels. If it is less, it performs a 1×1 convolution on the input features and then follows a batch normalization layer to supplement cross-channel information. Otherwise, this branch does not process the input features.
[0010] Furthermore, the DBCA_avg branch first determines whether the number of groups is less than the number of output channels. When the number of groups is less than the number of output channels, it first goes through a 1×1 convolution, then through a batch normalization layer and a padding layer, then through average pooling, and finally through another batch normalization layer to provide a mesoscale receptive field. Otherwise, this branch will skip the 1×1 convolution and the normalization and padding layers, and perform average pooling and batch normalization operations in sequence.
[0011] Furthermore, the DBCA_1x1_kxk branch first uses a 1×1 convolution, followed by a batch normalization layer and a padding layer, then a K×K convolution, and finally another batch normalization layer, to expand the receptive field and preserve detailed features.
[0012] Furthermore, the DBCA_origin main convolutional branch consists of K×K convolution followed by batch normalization layers, used to extract original local details.
[0013] Furthermore, the A2C2f_MCA feature enhancement module uses a 1×1 convolution as the input transformation layer, connects several multi-scale cross-axis attention sub-modules to complete feature extraction, aggregates through channel splicing and fusion convolution, and outputs after Gamma scaling and residual summation.
[0014] Furthermore, the multi-scale cross-axis attention module first extracts multi-scale convolutional features from the input features in both the horizontal and vertical directions, then achieves spatial information interaction through a bidirectional cross-axis attention mechanism, and finally fuses the attention features from both directions and outputs the original feature map after channel-wise weighting through 1×1 convolution.
[0015] Furthermore, the neck section processes the output feature of P6 through AVG and then merges the compressed branch with the output feature of P8. The merged feature is input to the RepHMS module, where it is upsampled through P12 and then merged with the output feature of P4 (processed by P13 AVG) and the output feature of P6 through a three-branch fusion. The merged feature is then input to the P15 RepHMS module, where it is upsampled through P16 and merged with the output feature of P4 and the output feature of P2 (processed by P17 AVG) through a three-branch fusion through P18. The merged feature is then enhanced by the P19 RepHMS module and merged with the output feature of P16 through P20. Finally, it is sent to the detection head after passing through the P21 RepHMS module. The output features of P19 are convolved by P22. The output features of P21 are processed by P23 AVG and then fused with the output features of P12, P15 and P19 by P24. The fused features are then fed into the detection head after passing through the P25 RepHMS module. The output features of P25 are processed by P27AVG and then combined with the output features of P11 and P15 after convolution operation by P26. The combined features are then sent to the detection head through the RepHMS module.
[0016] In a second aspect of the invention, an apparatus for diagnosing photovoltaic panel defects based on an improved YOLOv12n is provided. The apparatus includes: Image acquisition module: used to acquire infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; Model building module: used to build a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: in the backbone network, the DBAC module replaces the original Conv modules of P1, P3, P5 and P7, and the A2C2f module of P6 and P8 is replaced by A2C2f_MCA; in the neck part, a multi-branch auxiliary feature pyramid network built by the RepHMS module is used. Defect detection module: Used to train and test the photovoltaic panel defect diagnosis model. The images to be detected are sequentially input into the photovoltaic panel defect detection model for detection.
[0017] This invention improves the feature extraction and fusion capabilities of photovoltaic panel infrared thermal images by constructing a photovoltaic panel defect identification and detection model improved from the YOLOv12n target detection model. This enables more accurate diagnosis of four types of photovoltaic defects—hot spots, hot spots, diode bypass damage, and abnormal low temperatures—based on the input photovoltaic panel infrared thermal images.
[0018] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of the present invention, nor is it intended to restrict the scope of the invention. Other features of the invention will become readily apparent from the following description.
[0019] Beneficial effects: 1. Construct a fusion classification and detection model that includes feature extraction, feature enhancement and feature interaction. Extract image features of different complexities through multiple image processing branches of the feature extraction module, and capture the correlation between horizontal and vertical axis attention using a multi-scale cross-axis attention mechanism module. 2. The multi-branch auxiliary feature pyramid network built by adopting bidirectional auxiliary fusion and heterogeneous convolution mechanism enhances the preservation of shallow information and the interaction of cross-layer features in the fusion classification and detection model, enabling the fusion classification and detection model to be trained efficiently and converge quickly, thereby improving detection accuracy and reducing false negative rate. Attached Figure Description
[0020] The above and other features, advantages, and aspects of the various embodiments of the present invention will become more apparent from the accompanying drawings and the following detailed description. Wherein: Figure 1 A flowchart of a method for photovoltaic panel defect diagnosis based on an improved YOLOv12n according to an embodiment of the present invention is shown; Figure 2 A schematic diagram of annotated images according to an embodiment of the present invention is shown; Figure 3 A schematic diagram of the improved YOLOv12n model structure according to an embodiment of the present invention is shown; Figure 4 A structural diagram of a feature extraction module according to an embodiment of the present invention is shown; Figure 5 A structural diagram of a feature enhancement module according to an embodiment of the present invention is shown; Figure 6 A structural diagram of the MCA module according to an embodiment of the present invention is shown; Figure 7 The training and verification process curves according to an embodiment of the present invention are shown; Figure 8 A visualization of the detection results according to an embodiment of the present invention is shown; Figure 9 (a) shows a confusion matrix diagram of the detection results of the YOLOv12n detection model according to an embodiment of the present invention; Figure 9 (b) shows a confusion matrix diagram of the detection results of a photovoltaic panel defect diagnosis model based on the improved YOLOv12n according to an embodiment of the present invention; Figure 10 The diagram shows a comparison of the YOLOv12n model, the photovoltaic panel defect diagnosis model based on the improved YOLOv12n, and the detection models YOLOv11n, DETR, and Faster R-CNN according to embodiments of the present invention. Figure 11 A block diagram of an apparatus for photovoltaic panel defect diagnosis based on an improved YOLOv12n according to an embodiment of the present invention is shown. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] According to an embodiment of the present invention, a method for photovoltaic panel defect diagnosis based on an improved YOLOv12n is proposed. By constructing a photovoltaic panel defect identification and detection model improved by the YOLOv12n target detection model, the feature extraction and fusion capabilities of the photovoltaic panel infrared thermal image are further improved, thereby enabling more accurate diagnosis of four types of photovoltaic defects, namely hot spots, hot spots, diode bypass damage, and abnormal low temperature, based on the input photovoltaic panel infrared thermal image.
[0023] The principles and spirit of the present invention will be explained in detail below with reference to several representative embodiments.
[0024] Figure 1 This is a schematic flowchart of a photovoltaic panel defect diagnosis method based on an improved YOLOv12n according to an embodiment of the present invention. The method includes: Step S01: Collect infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; Step S02: Construct a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: In the backbone network, replace the original Conv modules of P1, P3, P5 and P7 with DBAC modules, and replace the original A2C2f modules of P6 and P8 with A2C2f_MCA; in the neck part, adopt a multi-branch auxiliary feature pyramid network formed by RepHMS modules. Step S03: Train and test the photovoltaic panel defect diagnosis model, and input the images to be detected into the photovoltaic panel defect detection model in sequence for detection.
[0025] It should be noted that although the operation of the method of the present invention has been described in a specific order in the above embodiments and figures, this does not require or imply that the operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0026] To provide a clearer explanation of the above-described method for photovoltaic panel defect diagnosis based on the improved YOLOv12n, a specific embodiment is described below. However, it is worth noting that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation of the present invention.
[0027] The following specific example will further illustrate the method for defect diagnosis of photovoltaic panels based on the improved YOLOv12n: Step S01: Collect infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; In this embodiment, a DJI M300 drone equipped with a Zenmuse H20T camera is used to acquire images of photovoltaic panels. Infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions are collected, specifically including infrared thermal imaging image data of daytime, nighttime, and different types of defects, to construct a photovoltaic panel defect category dataset.
[0028] Due to the limited number of hot spot and diode failure samples obtained from actual photovoltaic power plants, this invention performs targeted data augmentation for these two types of defects. Specifically, this includes: rotational augmentation from -360° to 360° while maintaining the aspect ratio, random cropping with a 0.2 corrosion rate, and random horizontal and vertical flipping. The probability of rotation is 0.5, the probability of random cropping is 0.3, and the probabilities of horizontal and vertical flipping are each 0.1, and the process is iterated three times. The dataset is manually labeled using Labelimg to generate corresponding labels for training. This dataset contains 4171 images across four defect types: hot spots, hot spots, diode bypass damage, and abnormally low temperatures. The dataset annotation information is as follows: Figure 2As shown. Considering the correspondence between labels and data, and to ensure a uniform distribution of the dataset, the dataset is divided into training, testing, and validation sets in an 8:1:1 ratio.
[0029] Step S02: Construct a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: In the backbone network, replace the original Conv modules of P1, P3, P5 and P7 with DBAC modules, and replace the original A2C2f modules of P6 and P8 with A2C2f_MCA; in the neck part, adopt a multi-branch auxiliary feature pyramid network formed by RepHMS modules. The Conv modules use Conv2d, BN, and SiLU activation functions for connection. In the C3k2 module, the input signal is first transformed by a 1×1 convolutional layer, and then split into two paths by a Split unit. The branch switches according to the Boolean state of C3k. When C3k=True, one path is connected to n C3k modules (n is the number of sub-modules), and the other path is a direct connection. The two signals are merged and output after a 1×1 convolution. When C3k=False, one path is connected to n Bottleneck modules, and the other path is a direct connection. The two signals are merged and output after a 1×1 convolution.
[0030] like Figure 4 As shown, the DBCA module is a cascaded multi-branch topology structure with densely connected layers and a first activation layer for adaptive channel attention. Specifically, during the training phase, the DBCA module consists of parallel branches: DBCA_1x1, DBCA_avg, DBCA_1x1_kxk, and DBCA_origin. Finally, the outputs of the four branches are summed pixel by pixel, followed by SiLU activation, global average pooling (GAP), one-dimensional convolution (Conv1d), and a Sigmoid activation function to obtain the final feature map.
[0031] The DBCA_1x1 branch first checks if the number of groups is less than the number of output channels. If it is less, it performs a 1×1 convolution on the input features and then adds a batch normalization layer to supplement cross-channel information. Otherwise, this branch does not process the input features.
[0032] The DBCA_avg branch first checks if the number of groups is less than the number of output channels. If the number of groups is less than the number of output channels, it first performs a 1×1 convolution (Conv2d), then a batch normalization layer and a padding layer (BNAndPadLayer), then average pooling (AvgPool2d), and finally another batch normalization layer to provide a mesoscale receptive field. Otherwise, this branch skips the 1×1 convolution and the normalization and padding layers, and performs average pooling and batch normalization operations in sequence.
[0033] The DBCA_1x1_kxk branch first uses a 1×1 convolution, followed by a batch normalization layer and a padding layer, then a K×K (default K=3) convolution, and finally a batch normalization layer to expand the receptive field and preserve detailed features.
[0034] The DBCA_origin main convolutional branch consists of a K×K (default K=3) convolution followed by a batch normalization layer (BatchNorm2d), which is responsible for extracting the original local details.
[0035] like Figure 5 As shown, the A2C2f_MCA feature enhancement module consists of stacked multi-scale cross-axis attention mechanism modules, a feature concatenation layer, and a learnable feature scaling layer. It mainly includes: a feature transformation layer, a multi-scale cross-axis attention mechanism (MCA) module group, a feature aggregation layer, and adaptive scaling and residual connection units. Specifically, the A2C2f-MCA module uses a 1×1 convolution as the input transformation layer, concatenates n multi-scale cross-axis attention (MCA) sub-modules to complete feature extraction, aggregates features through channel concatenation and fusion convolution, and outputs the feature after Gamma scaling and residual summation, achieving efficient multi-scale feature fusion and bidirectional attention enhancement.
[0036] like Figure 6 As shown, the MCA module first performs multi-scale convolutional feature extraction on the input features in both the horizontal and vertical directions. Then, it achieves spatial information interaction through a bidirectional cross-axis attention mechanism. Finally, it fuses the attention features from both directions and outputs the original feature map after channel-wise weighting by 1×1 convolution, thereby enhancing the model's ability to capture spatial dependencies in the horizontal and vertical directions.
[0037] The neck region performs feature alignment, cross-scale fusion, and heterogeneous convolution enhancement on the output features from P2, P4, P6, and P8 of the backbone network.
[0038] The output features of P6 are processed by AVG (Adaptive Average Pooling) to obtain its cross-scale compressed branch. This compressed branch is then concatenated and fused with the output features of P8. The fused features are input into the RepHMS (Heterogeneous Convolutional Enhancement) module to improve the expressive power of high-semantic layer features and the receptive field of context. After feature enhancement, it undergoes upsampling (P12) and is then concatenated and fused with the output features of P4 (processed by AVG, P13) and P6 in a three-branch concatenation, achieving dynamic supplementation from high-level semantics and mid-level texture information. The fused features are then input into the RepHMS module (P15), upsampled (P16), and then concatenated and fused with the output features of P4 and P2 (processed by AVG, P17) in a three-branch concatenation. The fused features (P18) are enhanced by the RepHMS module (P19) and concatenated and fused with the output features of P16 (P20), then passed through the RepHMS module (P21) before being fed into the detection head.
[0039] The output features of P19 are convolved (P22). The output features of P21 are then processed by AVG (P23) and concatenated with the output features of P12, P15, and P19 (P24). The fused features are then fed into the detection head after passing through the RepHMS module (P25).
[0040] The output features of P25 are processed by AVG (P27) and then concatenated and fused with the output features of P11 and P15 after convolution (P26) (P29). The fused features are then sent to the detection head through the RepHMS module.
[0041] Step S03: Train and test the photovoltaic panel defect diagnosis model, and input the images to be detected into the photovoltaic panel defect detection model in sequence for detection.
[0042] The preprocessed image data was used to train and test the improved YOLOv12n fusion classification and detection model for practical detection. In this invention, 4171 images were divided into training and testing sets in an approximately 8:1:1 ratio, with 3337 images used as the training set, 417 as the testing set, and 417 as the validation set. The model was trained for 300 epochs, and evaluation metrics were calculated for the training dataset (box_loss, cls_loss, dfl_loss, precision, recall) and the validation dataset (box_loss, cls_loss, dfl_loss, mAP50, mAP50 95). Notably, a pre-trained YOLOv12 model was explored for use in training. The training and validation curves are shown below. Figure 7 As shown, from Figure 7It can be seen that the training process of the improved YOLOv12n fusion classification detection model is effective. They have higher accuracy, faster convergence speed, and are more suitable for photovoltaic panel defect detection scenarios.
[0043] Parameter settings: This embodiment trains the improved YOLOv12n model on a self-built photovoltaic panel infrared image dataset. During training, the input image size is set to 640×640, the training epoch is set to 300, and the batch size is 16. The optimizer uses stochastic gradient descent (SGD) with an initial learning rate of 0.01, a momentum parameter of 0.937, and a weight decay coefficient of 0.0005. To improve the model's convergence stability, a warm-up phase of 3 epochs is set, with a warm-up momentum of 0.8 and a warm-up bias learning rate of 0.1. Eight worker threads are used during training to accelerate data loading and training efficiency.
[0044] Evaluation indicators: The following measurements were used as performance metrics for detection results on different images. The main metrics used included: precision, recall, mean precision (mAP50) with an IoU threshold of 0.5, and mean precision (mAP50 95) with IoU thresholds ranging from 0.5 to 0.95.
[0045] Precision measures the proportion of true positive samples among those predicted as positive by the model; recall measures the proportion of true positive samples that the model successfully detects. Their formulas are as follows: , , In the formula, This represents the number of samples that were correctly predicted as positive. This represents the number of negative samples that were incorrectly predicted as positive. This indicates the number of positive samples that were incorrectly predicted as negative.
[0046] The mean average precision (mAP) evaluates the overall detection performance of a model by calculating the mean average precision (AP) for each class. Its value ranges from 0 to 1; a higher value indicates better overall performance in multi-class detection tasks. The calculation method is as follows: , in, Indicates the first The precision-recall curve for a target class reflects the detection accuracy of the model at different recall levels; To determine the number of detection categories, this embodiment sets... =4.
[0047] The images to be detected are sequentially input into the photovoltaic panel defect detection model to determine whether photovoltaic defects exist in the images and their locations. Figure 8 As shown.
[0048] The model training and testing of this invention were both completed on a 64-bit Windows 11 operating system platform. The deep learning framework used was PyTorch 2.6.0, and the relevant programs were executed through a Python 3.11 interpreter. The hardware platform configuration was as follows: 14th generation processor. (2.2GHz clock speed), the graphics processing unit (GPU) is an NVIDIA GeForce RTX4060 with 8GB of video memory, and the system memory (RAM) is 16GB. The training and testing of the model are both completed in the PyCharm Professional integrated development environment (IDE) to ensure the stability and efficiency of code debugging and visualization.
[0049] A confusion matrix is a tabular layout that supports the visualization of model classification performance, providing an intuitive representation of the target and predicted values. This embodiment evaluates and analyzes photovoltaic panel defect diagnosis; the confusion matrix is shown below. Figure 9 Figure (a) shows the confusion matrix of the detection results of the YOLOv12n detection model without any improvements, and Figure (b) shows the confusion matrix of the detection results of the improved YOLOv12n fusion classification detection model.
[0050] The improved YOLOv12n detection model can accurately identify hot spot defects in photovoltaic panels with a diagnostic accuracy of 97%, and the false diagnosis rates for hot spots and abnormally low temperatures are 2% and 1%, respectively. The correct diagnosis rate for hot spot defects is 68%, and the false diagnosis rates for hot spots, diode bypass damage, abnormally low temperature defects, and background are 3%, 1%, 2%, and 27%, respectively. For diode bypass damage defects, the diagnostic accuracy is 71%, and the false diagnosis rates for abnormally low temperatures and background are 17% and 12%, respectively. The correct diagnosis rate for abnormally low temperature defects is 85%, and the false diagnosis rates for hot spots, hot spot defects, and background are 1%, 1%, and 14%, respectively.
[0051] The improved YOLOv12n fusion classification and detection model can more accurately identify hot spots, hot spots, and diode bypass damage defects in photovoltaic panel scenarios, and can more effectively distinguish the background. The diagnostic accuracy for hot spot defects is 98%, with a false positive rate of 2% for hot spot defects; the correct diagnostic accuracy for hot spot defects is 92%, with false positive rates of 1%, 1%, and 6% for hot spots, abnormal low temperature defects, and background defects, respectively; the diagnostic accuracy for diode bypass damage defects is 94%, with a false positive rate of 6% for background defects; and the correct diagnostic accuracy for abnormal low temperature defects is 75%, with false positive rates of 1% and 24% for hot spots and abnormal low temperatures, respectively.
[0052] Combination Figure 10 Therefore, comparing the YOLOv12n fusion classification and detection model before and after the improvement of this invention with the YOLOv11n, DETR, and Faster R-CNN detection models, it can be seen that, considering the overall accuracy and model size, the fusion classification and detection model of this invention has the best performance.
[0053] Based on the same inventive concept, this invention also proposes a device for photovoltaic panel defect diagnosis based on an improved YOLOv12n. The implementation of this device can be found in the implementation of the method described above; repeated details will not be elaborated further. Figure 11 As shown, the device 100 includes: Image acquisition module 101: used to acquire infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; Model building module 102: used to build a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: in the backbone network, the DBAC module is used to replace the original Conv modules of P1, P3, P5 and P7, and the A2C2f module of P6 and P8 is used to replace the original A2C2f module; in the neck part, a multi-branch auxiliary feature pyramid network formed by the RepHMS module is used. Defect detection module 103: Used to train and test the photovoltaic panel defect diagnosis model, and input the images to be detected into the photovoltaic panel defect detection model in sequence for detection.
[0054] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0055] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for defect diagnosis of photovoltaic panels based on an improved YOLOv12n, characterized in that, The method includes: Step S01: Collect infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; Step S02: Construct a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: In the backbone network, replace the original Conv modules of P1, P3, P5 and P7 with DBAC modules, and replace the original A2C2f modules of P6 and P8 with A2C2f_MCA; in the neck part, adopt a multi-branch auxiliary feature pyramid network formed by RepHMS modules. Step S03: Train and test the photovoltaic panel defect diagnosis model, and input the images to be detected into the photovoltaic panel defect detection model in sequence for detection.
2. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 1, characterized in that, The DBAC module consists of parallel branches, namely DBCA_1x1, DBCA_avg, DBCA_1x1_kxk, and DBCA_origin, during the training phase. Finally, the outputs of the four branches are added pixel by pixel, and then SiLU activation, global average pooling, one-dimensional convolution, and Sigmoid activation function are applied to obtain the final feature map.
3. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 2, characterized in that, The DBCA_1x1 branch first determines whether the number of groups is less than the number of output channels. If it is less, it performs a 1×1 convolution on the input features and then a batch normalization layer to supplement cross-channel information. Otherwise, this branch does not process the input features.
4. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 2, characterized in that, The DBCA_avg branch first determines whether the number of groups is less than the number of output channels. When the number of groups is less than the number of output channels, it first goes through a 1×1 convolution, then connects to a batch normalization layer and a padding layer, then performs average pooling, and finally connects to a batch normalization layer again to provide a mesoscale receptive field. Otherwise, this branch will skip the 1×1 convolution, as well as the normalization and padding layers, and perform average pooling and batch normalization operations in sequence.
5. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 2, characterized in that, The DBCA_1x1_kxk branch first uses a 1×1 convolution, followed by a batch normalization layer and a padding layer, then a K×K convolution, and finally another batch normalization layer to expand the receptive field and preserve detailed features.
6. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 2, characterized in that, The DBCA_origin main convolutional branch consists of K×K convolutions followed by batch normalization layers, used to extract original local details.
7. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 1, characterized in that, The A2C2f_MCA feature enhancement module uses a 1×1 convolution as the input transformation layer, and connects several multi-scale cross-axis attention sub-modules to complete feature extraction. It aggregates features through channel concatenation and fusion convolution, and outputs them after Gamma scaling and residual summation.
8. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 7, characterized in that, The multi-scale cross-axis attention module first extracts multi-scale convolutional features from the input features in both the horizontal and vertical directions. Then, it achieves spatial information interaction through a bidirectional cross-axis attention mechanism. Finally, it fuses the attention features from both directions and outputs the original feature map after channel-wise weighting using a 1×1 convolution.
9. The method for photovoltaic panel defect diagnosis based on the improved YOLOv12n according to claim 1, characterized in that, The neck section processes the output features of P6 through AVG, then merges the compressed branch with the output features of P8. The merged features are input to the RepHMS module, where they are upsampled through P12 and then merged with the output features of P4 (processed by P13 AVG) and P6 through a three-branch fusion. The merged features are then input to the P15 RepHMS module, upsampled through P16, and merged with the output features of P4 and P2 (processed by P17 AVG) through a three-branch fusion (P18). The merged features are then enhanced by the P19 RepHMS module and merged with the output features of P16 through P20. Finally, the merged features are sent to the detection head after passing through the P21 RepHMS module. The output features of P19 are convolved by P22. The output features of P21 are processed by P23 AVG and then fused with the output features of P12, P15 and P19 by P24. The fused features are then fed into the detection head after passing through the P25 RepHMS module. The output features of P25 are processed by P27AVG and then combined with the output features of P11 and P15 after convolution operation by P26. The combined features are then sent to the detection head through the RepHMS module.
10. A device for photovoltaic panel defect diagnosis based on an improved YOLOv12n, characterized in that, The apparatus implements the method as described in any one of claims 1 to 9, comprising: Image acquisition module: used to acquire infrared thermal imaging image data of photovoltaic panel defects under different environmental conditions and perform preprocessing; Model building module: used to build a photovoltaic panel defect diagnosis model based on the improved YOLOv12n: in the backbone network, the DBAC module replaces the original Conv modules of P1, P3, P5 and P7, and the A2C2f module of P6 and P8 is replaced by A2C2f_MCA; in the neck part, a multi-branch auxiliary feature pyramid network built by the RepHMS module is used. Defect detection module: Used to train and test the photovoltaic panel defect diagnosis model. The images to be detected are sequentially input into the photovoltaic panel defect detection model for detection.