Photovoltaic defect detection method based on improved YOLOv8n

By improving the YOLOv8n network, constructing a dual-backbone parallel architecture, and introducing various modules and loss functions, the problem of low efficiency in photovoltaic defect detection was solved, achieving efficient and accurate defect identification and location, reducing operation and maintenance costs, and meeting the real-time monitoring needs of photovoltaic power plants.

CN121280352APending Publication Date: 2026-01-06CHANGZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511380848.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

Existing photovoltaic defect detection methods are inefficient and cannot meet the real-time monitoring needs of large-scale photovoltaic power plants. They are also prone to missing hidden electrical defects, increasing operation and maintenance costs.

Method used

An improved YOLOv8n network is adopted, which constructs a dual-backbone parallel network architecture and introduces the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detection head and Focal-Inner-MPDIoU loss function. Combined with GELAN architecture and PGI architecture, feature extraction and loss function are optimized to improve detection accuracy and efficiency.

Benefits of technology

It enables efficient identification and location of photovoltaic defects, improves detection accuracy and recall rate, reduces operation and maintenance costs, and meets the real-time monitoring needs of photovoltaic power plants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121280352A_ABST
    Figure CN121280352A_ABST
Patent Text Reader

Abstract

The invention provides a photovoltaic defect detection method based on improved YOLOv8n, and the method comprises the steps: collecting a photovoltaic defect image, carrying out the image marking and preprocessing, and obtaining a photovoltaic defect image data set; dividing the photovoltaic defect image data set into a training set and a verification set according to a preset proportion; the construction of the photovoltaic defect detection network based on the improved YOLOv8n comprises the following steps: replacing a single-backbone network architecture of the original YOLOv8n with a double-backbone parallel network architecture; the method comprises the following steps: introducing a Silence module, a CBLinear module, a CBFuse module, an SCConv module, a Triplet Attention mechanism, a DynamicHead detection head and a Focal-Inner-MPDIOU loss function, and carrying out the following steps: carrying out the detection of the depth of the CBLinear module; training the photovoltaic defect detection network based on the improved YOLOv8n by adopting the training set and the verification set to obtain a photovoltaic defect detection model; and performing defect detection on the obtained photovoltaic image to be detected by using the photovoltaic defect detection model. According to the method, the detection precision of the photovoltaic defects is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a photovoltaic defect detection method based on an improved YOLOv8n. Background Technology

[0002] In large-scale photovoltaic (PV) power generation systems, defect detection strategies directly impact the power generation efficiency, lifespan, and revenue of PV modules. Delayed defect detection not only leads to a continuous decline in power generation and reduced return on investment, but also allows electrical performance defects to gradually expand and worsen. Problems such as internal open circuits, crack propagation, and grid wire breakage can obstruct current transmission and reduce collection efficiency, thereby threatening the stable operation of the entire PV system. Excessively frequent manual inspections increase operation and maintenance costs and manpower investment. Traditional inspection methods are inefficient and prone to overlooking hidden electrical defects, failing to meet the real-time monitoring needs of large-scale PV power plants. Summary of the Invention

[0003] In view of this, the present invention provides a photovoltaic defect detection method based on an improved YOLOv8n to solve the above problems.

[0004] This invention provides a photovoltaic defect detection method based on an improved YOLOv8n, comprising: acquiring photovoltaic defect images, performing image annotation and preprocessing to obtain a photovoltaic defect image dataset; dividing the photovoltaic defect image dataset into a training set and a validation set according to a preset ratio; constructing a photovoltaic defect detection network based on an improved YOLOv8n, comprising: replacing the original YOLOv8n single-backbone network architecture with a dual-backbone parallel network architecture; introducing the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detection head, and Focal-Inner-MPDIoU loss function; training the photovoltaic defect detection network based on the improved YOLOv8n using the training set and validation set to obtain a photovoltaic defect detection model; and using the photovoltaic defect detection model to perform defect detection on the acquired photovoltaic images to be detected.

[0005] In another implementation of the present invention, the step of acquiring photovoltaic defect images, performing image annotation and preprocessing to obtain a photovoltaic defect image dataset includes: acquiring photovoltaic defect images; annotating the photovoltaic defect images with photovoltaic defect type and location information; and performing image size adjustment and data enhancement processing on the annotated images to obtain a photovoltaic defect image dataset.

[0006] In another implementation of the present invention, replacing the original YOLOv8n single backbone network architecture with a dual-backbone parallel network architecture includes: constructing two parallel feature extraction paths to replace the original YOLOv8n single backbone network architecture; the first backbone path extracts features layer by layer starting from the input, and the second backbone path starts feature extraction again from the original input.

[0007] In another implementation of the present invention, the introduction of the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detection head, and Focal-Inner-MPDIoU loss function includes: replacing the direct image input method of the original YOLOv8n with the input of the Silence module, which serves as the network input layer for noise suppression and preliminary feature extraction of the photovoltaic image to be detected; adding the CBLinear module to the original YOLOv8n linear hierarchical pass, which receives feature inputs from different levels and performs linear transformations; and adding the CBFuse intelligent fusion module to the backbone part of the dual backbone network to fuse features from the CBLinear routing. Multi-level feature information; the SCConv module is introduced into the backbone of the original YOLOv8n to replace the traditional C2f module. The SCConv module is used to realize feature reconstruction in spatial and channel dimensions through the synergistic effect of spatial reconstruction units and channel reconstruction units; a TripletAttention mechanism is introduced at key positions in the network to perform attention calculation on the three dimensions of the input features respectively; the static detection head of the original YOLOv8n is replaced with a DynamicHead dynamic detection head. DynamicHead is used to achieve adaptive feature modulation through deformable convolution and dynamic ReLU activation function, dynamically adjusting the convolution kernel parameters and activation threshold according to the input features; the traditional IoU loss function is replaced with the Focal-Inner-MPDIoU loss function to construct a photovoltaic defect detection network based on the improved YOLOv8n.

[0008] In another implementation of the present invention, the formula for calculating the Focal-Inner-MPDIoU loss function is as follows:

[0009] L_Focal_Inner_MPDIoU=focal_weight×(1-Inner_MPDIoU)

[0010] focal_weight=(inter / (union+ε))^y

[0011] Where inter represents the intersection area, union represents the union area, γ is the focusing parameter, and ε is the numerical stability term.

[0012] Inner_MPDIoU=Inner_IoU-(d1+d2) / (w 2 +h 2 )

[0013] d1 = (b2_x1 - b1_x1) 2 +(b2_y1-b1_y1) 2

[0014] d2 = (b2_x2 - b1_x2) 2 +(b2_y2-b1_y2) 2

[0015] Where w = b2_x2 - b2_x1 and h = b2_y2 - b2_y1 represent the width and height of the actual bounding box, respectively.

[0016] In another implementation of the present invention, the construction of the photovoltaic defect detection network based on the improved YOLOv8n further includes: replacing the original YOLOv8n CSP-Darknet backbone network with the GELAN architecture. GELAN combines the gradient splitting mechanism of CSPNet and the efficient layer aggregation characteristics of ELAN, supporting the flexible configuration of any computational block.

[0017] In another implementation of the present invention, the construction of a photovoltaic defect detection network based on the improved YOLOv8n further includes: adding a PGI architecture to the original YOLOv8n architecture. The PGI architecture includes three components: a main branch, an auxiliary reversible branch, and multi-level auxiliary information. The auxiliary reversible branch is used to generate reliable gradient information during the training phase. The multi-level auxiliary information controls the main branch to learn multi-layer semantic features, thereby solving the information bottleneck problem in the YOLOv8n deep network and making up for the unreliability of gradient information in the original architecture.

[0018] In another aspect, this invention provides a photovoltaic defect detection system based on an improved YOLOv8n, comprising: a dataset acquisition module for acquiring photovoltaic defect images, performing image annotation and preprocessing to obtain a photovoltaic defect image dataset; a dataset setting module for dividing the photovoltaic defect image dataset into a training set and a validation set according to a preset ratio; a network construction module for constructing a photovoltaic defect detection network based on an improved YOLOv8n, including: replacing the original YOLOv8n single-backbone network architecture with a dual-backbone parallel network architecture; introducing a Silence module, a CBLinear module, a CBFuse module, an SCConv module, a TripletAttention attention mechanism, a DynamicHead detection head, and a Focal-Inner-MPDIoU loss function; a model building module for training the photovoltaic defect detection network based on the improved YOLOv8n using the training set and validation set to obtain a photovoltaic defect detection model; and a target detection module for using the photovoltaic defect detection model to perform defect detection on the acquired photovoltaic images to be detected.

[0019] In another aspect, the present invention provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a photovoltaic defect detection method based on an improved YOLOv8n as described in any of the preceding claims.

[0020] In another aspect, the present invention provides a computer storage medium, characterized in that the computer storage medium stores a computer program, which, when executed by a processor, implements the steps in a photovoltaic defect detection method based on an improved YOLOv8n as described in any of the preceding claims.

[0021] The present invention relates to a photovoltaic defect detection method based on an improved YOLOv8n network. This method identifies photovoltaic defects based on the improved YOLOv8n network, accurately detects the defect type and location, and provides a basis for photovoltaic quality inspection and maintenance. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. By reading the detailed description of the embodiments below, the advantages and benefits of the solutions will become clear to those skilled in the art. The accompanying drawings are only for illustrating preferred embodiments and are not intended to limit the present invention. In the accompanying drawings:

[0023] Figure 1 This is a schematic diagram of a photovoltaic defect detection method based on an improved YOLOv8n according to an embodiment of the present invention.

[0024] Figure 2 This is a schematic diagram of a network structure based on an improved YOLOv8n according to an embodiment of the present invention.

[0025] Figure 3 This is a schematic diagram of the SSConv module according to an embodiment of the present invention.

[0026] Figure 4 This is a schematic diagram of the TripletAttention module according to an embodiment of the present invention.

[0027] Figure 5 This is a comparison chart of the accuracy of the improved YOLOv8n model and the original model according to an embodiment of the present invention.

[0028] Figure 6 This is a comparison chart of the recall rates of the improved YOLOv8n model and the original model according to an embodiment of the present invention.

[0029] Figure 7 This is a comparison chart of the improved YOLOv8n model and the original model's mAP@0.5 according to an embodiment of the present invention.

[0030] Figure 8 This is a comparison chart of mAP@0.5-0.95 between the improved YOLOv8n model and the original model according to an embodiment of the present invention.

[0031] Figure 9 This is a diagram illustrating the effect of black core photovoltaic defect detection according to an embodiment of the present invention.

[0032] Figure 10 This is an illustration of the effect of cracking photovoltaic defect detection according to an embodiment of the present invention.

[0033] Figure 11 This is a diagram illustrating the effect of finger photovoltaic defect detection according to an embodiment of the present invention.

[0034] Figure 12 This is a block diagram of a photovoltaic defect detection system based on an improved YOLOv8n, according to an embodiment of the present invention. Detailed Implementation

[0035] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and thoroughly 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 should fall within the protection scope of the present invention.

[0036] Figure 1 This is a schematic diagram of a photovoltaic defect detection method based on an improved YOLOv8n provided in an embodiment of the present invention, as shown below. Figure 1 As shown, this embodiment mainly includes:

[0037] S101. Collect photovoltaic defect images, perform image annotation and preprocessing to obtain a photovoltaic defect image dataset.

[0038] S102. Divide the photovoltaic defect image dataset into a training set and a validation set according to a preset ratio.

[0039] S103. Construct a photovoltaic defect detection network based on the improved YOLOv8n, including:

[0040] S1031. Replace the original YOLOv8n single backbone network architecture with a dual backbone parallel network architecture.

[0041] S1032 introduces the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detection head, and Focal-Inner-MPDIoU loss function.

[0042] S104. The photovoltaic defect detection network based on the improved YOLOv8n is trained using the training set and validation set to obtain the photovoltaic defect detection model.

[0043] S105. Use the photovoltaic defect detection model to perform defect detection on the acquired photovoltaic image to be detected.

[0044] The present invention relates to a photovoltaic defect detection method based on an improved YOLOv8n network. This method identifies photovoltaic defects based on the improved YOLOv8n network, accurately detects the defect type and location, and provides a basis for photovoltaic quality inspection and maintenance.

[0045] In another implementation of the present invention, the step of acquiring photovoltaic defect images, performing image annotation and preprocessing to obtain a photovoltaic defect image dataset includes: acquiring photovoltaic defect images; annotating the photovoltaic defect images with photovoltaic defect type and location information; and performing image size adjustment and data enhancement processing on the annotated images to obtain a photovoltaic defect image dataset.

[0046] For example, photovoltaic defect images are collected and classified according to defect type into black core, crack, and finger defect types, with at least 500 images collected for each type.

[0047] The collected photovoltaic defect image set was labeled and preprocessed. The specific steps of labeling are as follows: the photovoltaic defect types are labeled using labeling methods, such as the labelimg dataset labeling method, to assign defect type information such as blackcore, crack, and finger. The labeled data is directly exported as a YOLO format txt file, which records the defect type, location information, etc.; the preprocessing includes: image size adjustment and data augmentation.

[0048] The photovoltaic defect detection dataset was divided into training, validation, and test sets in an 8:1:1 ratio. Python scripts were used to create summary files, train.txt and val.txt, which store the absolute paths of images, label positions, and categories line by line. Finally, the labeled images from the training and test sets were placed in the same directory along with the JPG images.

[0049] In another implementation of the present invention, replacing the original YOLOv8n single backbone network architecture with a dual-backbone parallel network architecture includes: constructing two parallel feature extraction paths to replace the original YOLOv8n single backbone network architecture; the first backbone path extracts features layer by layer starting from the input, and the second backbone path starts feature extraction again from the original input.

[0050] For example, a dual-backbone network extracts features through two parallel paths during the training phase:

[0051] a) The first main path extracts features layer by layer according to the standard process:

[0052] F_1 (l) =Conv_3×3(F_1 (l-1) )

[0053] b) The second main path restarts feature extraction from the original input:

[0054] F_2 (l) =Conv_3×3(Input)

[0055] c) During the inference phase, the features of the two paths are fused:

[0056] F_fused=α×F_1 (l) +β×F_2 (l)

[0057] Here, α and β are learnable fusion weights.

[0058] By constructing two parallel feature extraction paths, the ability to extract photovoltaic defect features is improved, resulting in rich features during training and high computational efficiency during inference.

[0059] In another implementation of the present invention, the introduction of the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detector, and Focal-Inner-MPDIoU loss function includes:

[0060] The original direct image input method of YOLOv8n is replaced with the input of the Silence module. The Silence module serves as the network input layer and is used to perform noise suppression and preliminary feature extraction on the photovoltaic image to be detected.

[0061] For example, such as Figure 2 As shown, the original direct image input method of YOLOv8n is replaced with the input of the Silence module. The Silence module serves as the network input layer, which performs noise suppression and preliminary feature extraction on the photovoltaic image, providing a more stable and pure initial feature representation for the subsequent dual backbone network, thus solving the problem of instability of direct input.

[0062] The Silence module preprocesses the input image through an adaptive filtering mechanism. Its working principle includes: first, multi-scale noise detection is performed on the input image to identify noise components of different frequencies; then, noise is suppressed through a learnable filter while retaining key defect feature information; finally, a preliminary feature extraction operation is performed to generate a feature representation suitable for subsequent network processing.

[0063] The CBLinear module is added to the original YOLOv8n linear hierarchical transfer. The CBLinear module is used to receive feature inputs from different levels and perform linear transformations.

[0064] For example, a CBLinear module is added to the original linear hierarchical transmission of YOLOv8n. The CBLinear module receives feature inputs from different levels and performs linear transformations, which improves the ability of YOLOv8n to transmit information between levels, establishes information interaction channels between multiple levels, enhances the information flow capability of the network, and makes up for the limitations of the original linear transmission.

[0065] The CBLinear module's workflow includes: multi-level feature collection, linear transformation processing, cross-layer connection establishment, and information flow optimization. Through this cross-layer feature routing mechanism, the network can better utilize feature information from different depth layers, improving its ability to detect complex defects.

[0066] A CBFuse intelligent fusion module is added to the backbone of the dual backbone network to fuse multi-level feature information from CBLinear routing.

[0067] For example, a CBFuse intelligent fusion module is added to the backbone of the dual-backbone network, specifically for fusing multi-level feature information from CBLinear routes. The CBFuse module implements adaptive weighted fusion of multi-source features, integrating feature information from different backbone paths and different depth levels, and achieving intelligent feature interaction between the dual-backbone networks through learnable fusion weights.

[0068] The CBFuse module operates as follows: First, the multi-source feature inputs undergo feature alignment to ensure that features from different sources have the same spatial size; then, the adaptive weight generation network calculates the fusion weights of each feature; next, a weighted fusion operation is performed to generate the fused feature representation; finally, the feature optimization module further processes the fusion result.

[0069] The SCConv module is introduced into the Backbone of the original YOLOv8n to replace the traditional C2f module. The SCConv module is used to realize feature reconstruction in spatial and channel dimensions through the synergistic effect of spatial reconstruction unit and channel reconstruction unit.

[0070] For example, such as Figure 3 As shown, the SCConv (Spatial and Channel-wise Convolution) module is introduced into the Backbone part of YOLOv8n to replace some of the traditional C2f modules. The SCConv module achieves feature reconstruction in spatial and channel dimensions through the synergistic effect of the Spatial Reconstruction Unit (SRU) and the Channel Reconstruction Unit (CRU), thereby improving the ability to extract and characterize photovoltaic defect features.

[0071] The SCConv module operates as follows: The Spatial Reconstruction Unit (SRU) reconstructs spatial features through a gating mechanism. Let the gating threshold be τ. The input feature x is normalized to obtain weight γ, which is then calculated using the Sigmoid activation function.

[0072] R(x) = Sigmoid(GN(x) × y)

[0073] Feature splitting is performed based on a gating threshold:

[0074]

[0075] Spatial reconstruction is achieved through feature cross-fusion:

[0076] X1 = W1 × X, X2 = W2 × X

[0077] X 11 ,X 12 =Split(X1),X21 ,X 22 =Split(X2)

[0078] The Channel Reconstruction Unit (CRU) enhances channel features through grouped convolution and point convolution:

[0079] xup,xlow=Split(x,α)

[0080] xup_squeezed = Squeeze1(xup)

[0081] xlow_squeezed=Squeeze2(xlow)

[0082] Y1=GWC(xup_squeezed)+PWC1(xup_squeezed)

[0083] Y2=Concat([PWC2(xlow_squeezed),xlow_squeezed])

[0084] Output=Softmax(AdaptiveAvgPool(Concat([Y1,Y2])))×Concat([Y1,Y2])

[0085] Where α is the channel segmentation ratio, GWC is group convolution, and PWC is point convolution.

[0086] TripletAttention is introduced at key locations in the network to perform attention calculations on the three dimensions of the input features respectively.

[0087] For example, such as Figure 4 As shown, a TripletAttention mechanism is introduced at key locations in the network. By performing attention calculations on the three dimensions (H×W×C, C×H×W, H×C×W) of the input features respectively, multi-dimensional attention and enhancement of photovoltaic defect features are achieved. Compared with the traditional single-dimensional attention mechanism, it has a stronger feature representation capability.

[0088] The TripletAttention mechanism calculates attention weights in the spatial dimension (H×W), the channel dimension (C), and the height-channel dimension (H×C), and then fuses the attention information from the three dimensions to generate the final feature representation.

[0089] The original static YOLOv8n detector head is replaced with the DynamicHead dynamic detector head. DynamicHead is used to achieve adaptive feature modulation through deformable convolution and dynamic ReLU activation function, and dynamically adjusts the convolution kernel parameters and activation threshold according to the input features.

[0090] For example, the original static detection head of YOLOv8n is replaced with the DynamicHead dynamic detection head. The DynamicHead achieves adaptive feature modulation through deformable convolution (ModulatedDeformConv2d) and dynamic ReLU activation function, and dynamically adjusts the convolution kernel parameters and activation threshold according to the input features to improve the detection accuracy of photovoltaic defects of different scales and shapes.

[0091] The execution flow of DynamicHead is as follows:

[0092] a) Feature Adaptive Modulation: Adaptive spatial transformation of input features through deformable convolution;

[0093] b) Dynamic activation: The activation threshold is dynamically adjusted based on the feature content using a dynamic ReLU activation function;

[0094] c) Multi-scale fusion: Integrating detection features from different scales to improve the detection capability for defects of various sizes.

[0095] The traditional IoU loss function is replaced with the Focal-Inner-MPDIoU loss function to construct a photovoltaic defect detection network based on the improved YOLOv8n.

[0096] For example, the training process is optimized using the Focal-Inner-MPDIoU loss function, which replaces the traditional IoU loss function with the Focal-Inner-MPDIoU loss function. This loss function combines the hard sample mining mechanism of Focal Loss, the internal region focus capability of Inner-IoU, and the accurate boundary regression capability of MPDIoU, effectively solving the problems of class imbalance and small target detection in photovoltaic defect detection.

[0097] In another implementation of the present invention, the formula for calculating the Focal-Inner-MPDIoU loss function is as follows:

[0098] L_Focal_Inner_MPDIoU=focal_weight×(1-Inner_MPDIoU)

[0099] First, calculate the Inner-IoU and then perform Inner scaling on the predicted bounding box and the ground truth bounding box:

[0100] Inner_MPDIoU=Inner_IoU-(d1+d2) / (w 2 +h 2 )

[0101] Where B and B^gt represent the predicted bounding box and the ground truth bounding box regions after scaling by ratio, respectively.

[0102] Calculate the distance penalty term for MPDIoU:

[0103] d1 = (b2_x1 - b1_x1) 2 +(b2_y1-b1_y1) 2

[0104] d2 = (b2_x2 - b1_x2) 2 +(b2_y2-b1_y2) 2

[0105] Inner_MPDIoU=Inner_IoU-(d1+d2) / (w 2 +h 2 )

[0106] Where w = b2_x2 - b2_x1 and h = b2_y2 - b2_y1 represent the width and height of the actual bounding box, respectively.

[0107] Focal weight calculation:

[0108] focal_weight=(inter / (union+ε))^y

[0109] Where inter represents the intersection area, union represents the union area, γ is the focusing parameter, and ε is the numerical stability term. This loss function focuses on the alignment quality of the target's internal region through the Inner mechanism, optimizes the geometric matching accuracy of the bounding box through MPDIoU, and enhances the learning ability for difficult samples through the Focal mechanism.

[0110] In another implementation of the present invention, the construction of the photovoltaic defect detection network based on the improved YOLOv8n further includes: replacing the original YOLOv8n CSP-Darknet backbone network with the GELAN architecture. GELAN combines the gradient splitting mechanism of CSPNet and the efficient layer aggregation characteristics of ELAN, supporting the flexible configuration of any computational block.

[0111] For example, the original CSP-Darknet backbone network of YOLOv8n is replaced with the GELAN (Generalized High-Efficiency Layer Aggregation Network) architecture. GELAN combines the gradient splitting mechanism of CSPNet and the high-efficiency layer aggregation characteristics of ELAN, supporting flexible configuration of arbitrary computational blocks. Compared with the fixed backbone network structure of YOLOv8n, it improves the ability to extract photovoltaic defect features. The GELAN architecture's operation flow is as follows:

[0112] a) Gradient splitting stage: The gradient splitting mechanism of CSPNet is used to segment the input features and adjust the distribution range of the features;

[0113] b) High-efficiency layer aggregation: The input features are processed by the ELAN high-efficiency layer aggregation module to obtain the output features. The core of the ELAN module is multi-scale feature aggregation, which is used to capture defect features at different scales.

[0114] c) Cross-stage connection: Before the aggregation process, a cross-stage connection mechanism is added. Residual connections help alleviate the gradient vanishing problem and enhance the feature preservation ability.

[0115] d) Feature mapping: The output features are further mapped through a multilayer perceptron;

[0116] e) Residual fusion: Through a second residual fusion, a final feature representation suitable for photovoltaic defect detection tasks is generated.

[0117] The GELAN architecture offers significant advantages in handling photovoltaic defect features. First, its flexible computational block configuration adapts to the feature patterns of different defect types, enabling effective detection of various defect types such as hot spots, cracks, and stains. Second, the gradient splitting mechanism ensures the training stability of deep networks, avoiding the vanishing gradient problem. Finally, its efficient layer aggregation feature allows the network to simultaneously capture local detail features and global contextual information, improving the accuracy and robustness of defect detection.

[0118] In another implementation of the present invention, the construction of a photovoltaic defect detection network based on the improved YOLOv8n further includes: adding a PGI architecture to the original YOLOv8n architecture. The PGI architecture includes three components: a main branch, an auxiliary reversible branch, and multi-level auxiliary information. The auxiliary reversible branch is used to generate reliable gradient information during the training phase. The multi-level auxiliary information controls the main branch to learn multi-layer semantic features, thereby solving the information bottleneck problem in the YOLOv8n deep network and making up for the unreliability of gradient information in the original architecture.

[0119] For example, a PGI architecture is added to the original YOLOv8n architecture. The PGI architecture includes three components: the main branch, the auxiliary invertible branch, and multi-level auxiliary information. The auxiliary invertible branch generates reliable gradient information during the training phase, and the multi-level auxiliary information controls the main branch to learn multi-layer semantic features. This solves the information bottleneck problem in the YOLOv8n deep network and makes up for the unreliability of gradient information in the original architecture.

[0120] The three components of the PGI architecture work together: the main branch is responsible for the main feature extraction and prediction tasks; the auxiliary reversible branch retains complete gradient information through reversible operations, ensuring the stability of the training process; and multi-level auxiliary information provides additional supervision signals at different levels to guide the network to learn richer semantic features.

[0121] In another implementation of this invention, the YOLOv8n algorithm, which uses the same feature fusion method at all levels, is replaced with a progressive feature fusion strategy. Appropriate fusion strategies are set according to different resolution levels. Shallow networks perform dense multi-source feature fusion to preserve texture details, while deep networks perform sparse key feature fusion to highlight defect type identification, thus achieving progressive feature integration from fine-grained to coarse-grained. Specific implementation of progressive feature fusion:

[0122] a) Shallow fusion (P2-P3 layers): Employs a dense connection method to fuse multiple fine-grained features, preserving the texture details and minute defect information of photovoltaics;

[0123] b) Mid-layer fusion (P4 layer): A selective fusion method is adopted, focusing on defect features at medium scale;

[0124] c) Deep fusion (P5 layer): Employs a sparse fusion method to highlight key defect type characteristics and improve classification accuracy.

[0125] In another implementation of this invention, to evaluate the performance of the improved model, accuracy, recall, average precision, frames per second, and weight file size are used as evaluation metrics. The calculation formulas for these metrics are as follows:

[0126] Precision = TP / (TP + FP)

[0127] Recall = TP / (TP + FN)

[0128]

[0129]

[0130] Wherein, Precision is the ratio of correctly detected positive samples to all samples detected as positive; Recall is the ratio of correctly detected positive samples to all actual positive samples; mAP is the average of AP across multiple classes, used to evaluate the performance of a multi-class object detection model; and FPS is the detection frame rate, representing the model's processing speed.

[0131] Example 1

[0132] A photovoltaic defect detection model is used to detect photovoltaic defects on the test set. After training, only the main branch is retained for prediction during the inference stage, achieving the design goal of rich features during training and efficient computation during inference.

[0133] like Figure 5 , Figure 6 , Figure 7 , Figure 8 Compared to the original YOLOv8n network, the model of this invention improves P by 6.8% to 90.4%, R by 5.2% to 87.5%, and mAP@0.5 by 3.6% to 91.8%, meeting the requirements for detection accuracy and feasibility for deployment on industrial equipment.

[0134] like Figure 9 , Figure 10 , Figure 11 As shown, real-time intelligent detection of internal electrical defects in photovoltaic modules, and the use of this information for early warning and maintenance, helps to solve problems in existing technologies. Automatic identification of electrical performance defects in photovoltaics can obtain key information such as defect type, severity, and distribution location, providing a theoretical basis and data support for optimizing operation and maintenance strategies.

[0135] Another aspect of the present invention, such as Figure 12 As shown, a photovoltaic defect detection system 100 based on an improved YOLOv8n is provided, comprising:

[0136] Dataset acquisition module 101: Collects photovoltaic defect images, performs image annotation and preprocessing, and obtains a photovoltaic defect image dataset.

[0137] Dataset setting module 102: Divides the photovoltaic defect image dataset into a training set and a validation set according to a preset ratio.

[0138] Network Construction Module 103: Constructs a photovoltaic defect detection network based on the improved YOLOv8n, including: replacing the original YOLOv8n single backbone network architecture with a dual backbone parallel network architecture; introducing the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detection head and Focal-Inner-MPDIoU loss function.

[0139] Model building module 104: The photovoltaic defect detection network based on the improved YOLOv8n is trained using the training set and validation set to obtain the photovoltaic defect detection model.

[0140] Target detection module 105: Uses a photovoltaic defect detection model to perform defect detection on the acquired photovoltaic image to be detected.

[0141] The photovoltaic defect detection system based on the improved YOLOv8n of this invention identifies photovoltaic defects based on the improved YOLOv8n network, accurately detects the type and location of defects, and provides a basis for photovoltaic quality inspection and maintenance.

[0142] In another aspect of the present invention, the electronic device includes: a processor, a memory, and a communication bus and a communication interface.

[0143] in:

[0144] The processor, memory, and communication interface communicate with each other via a communication bus.

[0145] A communication interface is used to communicate with other electronic devices or servers.

[0146] The processor is used to execute programs, specifically, to perform any of the steps of the photovoltaic defect detection method based on the improved YOLOv8n in the above embodiments.

[0147] Specifically, the program may include program code, which includes computer operation instructions.

[0148] The processor may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.

[0149] Memory is used to store programs. Memory may include high-speed RAM, and may also include non-volatile memory, such as at least one disk drive.

[0150] Specifically, the program can be used to cause the processor to execute the steps of any of the photovoltaic defect detection methods based on the improved YOLOv8n described in the embodiments. The specific implementation of each step in the program can be found in the corresponding descriptions of the steps and units executed in any of the photovoltaic defect detection methods based on the improved YOLOv8n described above, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments.

[0151] An exemplary embodiment of this application also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the methods of various embodiments of this application.

[0152] The methods described above according to embodiments of the present invention can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code originally stored on a remote recording medium or a non-transitory machine-readable medium and subsequently stored on a local recording medium, downloaded via a network. Thus, the methods described herein can be processed by software stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., RAM, ROM, flash memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.

[0153] Specific embodiments of the present invention have now been described. Other embodiments are within the scope of the appended claims. In some cases, the actions described in the claims can be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result.

[0154] It should be noted that all directional indications (such as up, down, left, right, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship between the components in a certain specific order (as shown in the figure). If the specific order changes, the directional indication will also change accordingly.

[0155] In the description of this invention, the terms "first" and "second" are used only for convenience in describing different components or names, and should not be construed as indicating or implying a sequential relationship, relative importance, or implicitly specifying the number of technical features indicated. Thus, a feature defined with "first" and "second" may explicitly or implicitly include at least one of that feature.

[0156] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.

[0157] It should be noted that although specific embodiments of the present invention have been described in detail with reference to the accompanying drawings, this should not be construed as limiting the scope of protection of the present invention. Various modifications and variations that can be made by those skilled in the art without inventive effort within the scope described in the claims still fall within the scope of protection of the present invention.

[0158] The examples of the embodiments of the present invention are intended to concisely illustrate the technical features of the embodiments of the present invention, so that those skilled in the art can intuitively understand the technical features of the embodiments of the present invention, and are not intended to be an improper limitation of the embodiments of the present invention.

[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A photovoltaic defect detection method based on improved YOLOv8n, characterized in that, include: Photovoltaic defect images were collected, and image annotation and preprocessing were performed to obtain a photovoltaic defect image dataset. The photovoltaic defect image dataset is divided into a training set and a validation set according to a preset ratio; Construct a photovoltaic defect detection network based on an improved YOLOv8n, including: The original YOLOv8n single-backbone network architecture was replaced with a dual-backbone parallel network architecture. We introduce the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detection head, and Focal-Inner-MPDIoU loss function; The photovoltaic defect detection network based on the improved YOLOv8n is trained using the training set and validation set to obtain the photovoltaic defect detection model; A photovoltaic defect detection model is used to detect defects in the acquired photovoltaic images.

2. The method of claim 1, wherein, The process involves acquiring photovoltaic defect images, performing image annotation and preprocessing to obtain a photovoltaic defect image dataset, including: Acquire images of photovoltaic defects; The photovoltaic defect images are labeled with photovoltaic defect type and location information; The labeled images were resized and augmented to obtain a photovoltaic defect image dataset.

3. The method of claim 1, wherein, The replacement of the original YOLOv8n single-backbone network architecture with a dual-backbone parallel network architecture includes: Two parallel feature extraction paths are constructed to replace the original YOLOv8n single backbone network architecture; The first main path extracts features layer by layer from the input, while the second main path starts feature extraction again from the original input.

4. The method of claim 3, wherein, The introduction of the Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention mechanism, DynamicHead detector, and Focal-Inner-MPDIoU loss function includes: The original direct image input method of YOLOv8n is replaced with the input of the Silence module. The Silence module serves as the network input layer and is used to perform noise suppression and preliminary feature extraction on the photovoltaic image to be detected. The CBLinear module is added to the original YOLOv8n linear hierarchical pass. The CBLinear module is used to receive feature inputs from different levels and perform linear transformations. A CBFuse intelligent fusion module is added to the backbone part of the dual backbone network to fuse multi-level feature information from CBLinear routing; The SCConv module is introduced into the Backbone part of the original YOLOv8n to replace the traditional C2f module. The SCConv module is used to realize feature reconstruction in spatial and channel dimensions through the synergistic effect of spatial reconstruction unit and channel reconstruction unit. TripletAttention is introduced at key locations in the network to perform attention calculations on the three dimensions of the input features respectively. Replace the static detection head of the original YOLOv8n with a DynamicHead dynamic detection head, which is used to realize adaptive feature modulation through deformable convolution and dynamic ReLU activation function, and dynamically adjust the convolution kernel parameters and activation threshold according to the input features; Replace the traditional IoU loss function with a Focal-Inner-MPDIoU loss function to build a photovoltaic defect detection network based on the improved YOLOv8n.

5. The method of claim 4, wherein, The calculation formula of the Focal-Inner-MPDIoU loss function is: L_Focal_Inner_MPDIoU = focal_weight × (1-Inner_MPDIoU) focal_weight = (inter / (union+ε))^y Where inter represents the intersection area, union represents the union area, γ is the focus parameter, and ε is the numerical stability term. Inner_MPDIoU = Inner_IoU - (d1 + d2) / (w 2 +h 2 ) d1 = (b2_x1 - b1_x1) 2 + (b2_y1 - b1_y1) 2 d2 = (b2_x2 - b1_x2) 2 + (b2_y2 - b1_y2) 2 Where w = b2_x2-b2_x1, h = b2_y2-b2_y1 represent the width and height of the real box respectively.

6. The method of claim 1, wherein, The photovoltaic defect detection network based on the improved YOLOv8n also includes: Replace the original YOLOv8n CSP-Darknet backbone network with a GELAN architecture, which combines the gradient shunting mechanism of CSPNet and the efficient layer aggregation characteristics of ELAN, and supports flexible configuration of arbitrary calculation blocks.

7. The method of claim 1, wherein, The photovoltaic defect detection network based on the improved YOLOv8n also includes: Add a PGI architecture to the original YOLOv8n architecture, which includes a main branch, an auxiliary reversible branch, and a multi-level auxiliary information component; The auxiliary reversible branch is used to generate reliable gradient information during the training phase. The multi-level auxiliary information control main branch is used to learn multi-layer semantic features, solve the information bottleneck problem in the YOLOv8n deep network, and make up for the defects of the original architecture gradient information being unreliable.

8. A photovoltaic defect detection system based on improved YOLOv8n, characterized in that, It includes: A data set acquisition module: collect photovoltaic defect images, perform image labeling and preprocessing, and obtain a photovoltaic defect image dataset; A dataset setting module: divide the photovoltaic defect image dataset into a training set and a validation set according to a preset ratio; A network construction module: construct a photovoltaic defect detection network based on the improved YOLOv8n, including: replace the single main network architecture of the original YOLOv8n with a dual main parallel network architecture; introduce Silence module, CBLinear module, CBFuse module, SCConv module, TripletAttention attention mechanism, DynamicHead detection head and Focal-Inner-MPDIoU loss function; A model establishment module: train the photovoltaic defect detection network based on the improved YOLOv8n using the training set and the validation set to obtain a photovoltaic defect detection model; A target detection module: uses the photovoltaic defect detection model to detect defects in the acquired photovoltaic images to be detected.

9. An electronic device, comprising: It includes: The memory, the processor and the computer program stored on the memory and capable of running on the processor, the processor executes the computer program to realize the steps of the improved YOLOv8n-based photovoltaic defect detection method in any one of claims 1 to 7.

10. A computer storage medium, characterized in that, The computer storage medium stores a computer program, and the computer program is executed by a processor to realize the steps of the improved YOLOv8n-based photovoltaic defect detection method in any one of claims 1 to 7.