Lightweight photovoltaic panel defect detection method based on improved YOLOv8
By improving the YOLOv8 network and combining it with the FasterNet backbone network and the GMSSPPCSPC module, the problems of insufficient multi-scale accuracy and high computational complexity in photovoltaic panel defect detection were solved, achieving efficient and accurate defect detection.
Patent Information
- Application Number
- CN202411858852.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-12-17
AI Technical Summary
Existing photovoltaic panel defect detection methods lack accuracy when dealing with multi-scale defects, have high computational complexity, are difficult to meet real-time requirements, and lack the ability to detect complex and diverse defect types.
An improved YOLOv8 network is adopted, using the FasterNet backbone network and the GMSSPPCSPC module for feature fusion. Combined with the target detection module and the output module, multi-scale feature extraction and lightweight design are used to improve detection accuracy and reduce computational complexity.
It significantly improves the accuracy and real-time performance of photovoltaic panel defect detection, reduces computing resource consumption, and is suitable for deployment in real-time monitoring systems on embedded devices.
Smart Images

Figure CN119693712B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of computer vision and deep learning, and particularly relates to a lightweight photovoltaic cell panel defect detection method based on improved YOLOv8. BACKGROUND
[0002] As an important part of green energy field, the production quality of photovoltaic cell panels has a direct impact on power generation efficiency and equipment service life. At present, photovoltaic cell panel defect detection methods mainly include traditional image processing technology and deep learning-based detection technology. Traditional methods (such as edge detection, morphological operation and image segmentation) usually rely on artificial design rules, which are not only inefficient, but also susceptible to light changes and noise interference.
[0003] Existing photovoltaic cell panel defect detection methods mainly rely on traditional image processing technology and some deep learning methods. Common image processing techniques include edge detection, image segmentation, morphological processing, etc. These methods usually require manual feature extraction and are sensitive to light changes and noise interference. Although these methods can work under certain conditions, they cannot well cope with the complexity and diversity of photovoltaic cell panel surface defects, and are inefficient and inaccurate in practical applications.
[0004] Deep learning, especially target detection technology, has made significant breakthroughs in industrial defect detection. The YOLO (You Only Look Once) series algorithm is widely used in the industrial field due to its efficient target detection capability and real-time performance. However, although the latest YOLOv8 has improved detection accuracy and speed, it still faces the following main problems when dealing with complex photovoltaic cell panel defect scenarios: 1. Limited multi-scale feature fusion capability, resulting in insufficient detection accuracy. The existing SPPF module has limitations in processing defects of different scales, and is difficult to capture detailed information in complex scenarios, especially for small area and low contrast defects, which are prone to missed detection and false detection; 2. High computational complexity: the calculation amount is too large when running on embedded devices, making it difficult to meet real-time requirements; existing technologies usually detect a limited number of defect categories (such as cracks, scratches, etc.), but lack a unified detection framework and sufficient accuracy support for complex and diverse defect types (such as bubbles, stains, peeling, etc.). SUMMARY
[0005] To solve the problems in the prior art, the application provides a light photovoltaic cell panel defect detection method based on an improved YOLOv8, which comprises the following steps: acquiring a photovoltaic cell panel defect image to be detected, and pre-processing the image; inputting the pre-processed image into a light photovoltaic cell panel defect detection model to obtain a defect detection result; the light photovoltaic cell panel defect detection model is an improved YOLOv8 network, and the improved YOLOv8 network comprises a FasterNet backbone network, a feature fusion module, a target detection module and an output module.
[0006] The training of the light photovoltaic cell panel defect detection model comprises the following steps: acquiring an original image data set, pre-processing the images in the data set, and taking the pre-processed images as a training set; inputting the data in the training set into the FasterNet backbone network for multi-scale feature extraction; inputting the multi-scale features into the feature fusion module for fusion to obtain a fused feature map; inputting the fused feature map into the target detection module to obtain a detection result; the output module is used for outputting the detection result; a loss function of the model is calculated according to the detection result, the parameters of the model are adjusted, and the training of the model is completed when the loss function converges.
[0007] The application has the following beneficial effects:
[0008] The application has the following beneficial effects: BRIEF DESCRIPTION OF DRAWINGS
[0009] Figure 1 It is a whole network architecture diagram of the application;
[0010] Figure 2 It is a structure diagram of the FasterNet module of the application;
[0011] Figure 3 It is a structure diagram of the feature fusion module of the application;
[0012] Figure 4 It is a whole flowchart of the application. DETAILED DESCRIPTION
[0013] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of the present application.
[0014] A light photovoltaic cell panel defect detection method based on an improved YOLOv8, as shown in Figure 4 The method comprises the following steps: acquiring a photovoltaic cell panel defect image to be detected, preprocessing the image, inputting the preprocessed image into a light photovoltaic cell panel defect detection model to obtain a defect detection result, wherein the light photovoltaic cell panel defect detection model is an improved YOLOv8 network, the improved YOLOv8 network comprises a FasterNet backbone network, a feature fusion module, a target detection module and an output module, and the training of the light photovoltaic cell panel defect detection model comprises the following steps: acquiring an original image dataset, preprocessing the images in the dataset, and taking the preprocessed images as a training set, inputting the data in the training set into the FasterNet backbone network for multi-scale feature extraction, inputting the multi-scale features into the feature fusion module for fusion to obtain a fused feature map, inputting the fused feature map into the target detection module to obtain a detection result, the output module is used for outputting the detection result, calculating a loss function of the model according to the detection result, adjusting the parameters of the model, and completing the training of the model when the loss function converges.
[0015] In the present embodiment, the preparation of the dataset comprises the following steps: acquiring image data of photovoltaic cell surface defects, preprocessing and augmenting the acquired dataset, and labeling the dataset; and then dividing the preprocessed image data into a training set, a validation set and a test set. The specific operation steps comprise the following steps:
[0016] Step 1.1: acquiring a photovoltaic cell surface defect image dataset PVEL-AD, and performing data augmentation (cropping, horizontal flipping, adjusting saturation, etc.) on the categories with less quantity.
[0017] Step 1.2: dividing the dataset according to the ratio of training set: validation set: test set = 7:1.5:1.5. The data in the training set is used for training the model, the data in the validation set is used for verifying the trained model, and the data in the test set is used for testing the trained model.
[0018] Step 1.3: initializing a running environment on a windows system.
[0019] In the present embodiment, as shown in Figure 1As shown, the improved YOLOv8 network is composed of Backbone (FasterNet), feature fusion module (GMSSPPCSPC module), Head (target detection module), and output module.
[0020] Backbone (FasterNet) is responsible for extracting the features of the input image and is the core of the entire detection system. FasterNet is used to replace the original backbone network of YOLOv8 to achieve more efficient feature extraction and reduce computational complexity. The feature fusion module (GMSSPPCSPC module) is used to process the multi-scale features extracted from FasterNet. Through the improved SPPCSPC structure, the ability of multi-scale feature fusion is effectively enhanced, and the detection accuracy of small area and low contrast defects is improved. Head (target detection module) is responsible for performing the final defect detection task. Based on the detection framework of YOLOv8, this module can perform real-time target recognition and locate the defect area of the photovoltaic panel. The output module is responsible for converting the detection results into a format readable by users, usually including the type, location, and corresponding confidence of the defect.
[0021] Specifically, the image data of the photovoltaic panel is transmitted to the backbone network (FasterNet) for processing after data enhancement. The backbone network is responsible for extracting low-level and high-level features from the input image. FasterNet uses a lightweight convolutional structure to reduce computational complexity while extracting useful visual information, which will be passed to the subsequent feature fusion module for further processing.
[0022] For the device and method of the present application, the specific implementation scheme of the backbone network (FasterNet) and the feature fusion module (GMSSPPCSPC) cannot be replaced. The specific reasons are as follows:
[0023] Backbone network (FasterNet): FasterNet is selected as the backbone network for feature extraction, and its lightweight structure can significantly reduce computational complexity and meet the needs of real-time detection. Although other lightweight neural networks (such as MobileNet, EfficientNet, etc.) can also be used for feature extraction, FasterNet performs better in this task and has better compatibility with other components. Therefore, the replacement scheme of the backbone network is limited.
[0024] The GMSSPPCSPC module improves the effect of multi-scale feature fusion by combining spatial pyramid pooling (SPP) and CSPC (CrossStage Partial Convolution), and can effectively extract features at different scales. Although SPPF and other pooling methods also have similar functions, the GMSSPPCSPC module has higher precision and flexibility.
[0025] As shown in Figure 2 The FasterNet backbone network is composed of a PConv module, a FasterNetBlock module, and a multi-stage feature extraction network. The FasterNet backbone network is used for multi-scale feature extraction of images, including: inputting the input image into the PConv module for feature extraction; inputting the extracted feature map into the FasterNetBlock module for deep feature extraction; and inputting the deep feature map into the multi-stage feature extraction network for multi-scale feature extraction.
[0026] Specifically, the FasterNetBlock processes data, including: input stage: inputting the input feature map into the PConv layer; convolution layer: adding a standard convolution layer Conv to further extract features. Normalization and activation: adding Batch Normalization (BN) and ReLU activation function after the convolution layer. Residual connection: realizing the skip connection of input and output, forming a residual structure.
[0027] The multi-stage feature extraction network is constructed, including:
[0028] Step 1: Design a multi-stage structure: divide the network into multiple Stages, each Stage containing several FasterNetBlocks. Use Merging operation to fuse features between each Stage. As the number of Stages increases, gradually increase the number of channels to capture more feature information.
[0029] Step 2: Build a global feature extraction module: after the last Stage, apply Global Pool to perform global average pooling on the feature map. Use a Conv1x1 convolution layer to compress the pooled features. Add a fully connected layer (FC) for final classification output.
[0030] As shown in Figure 3 The GMSSPPCSPC network model is built, and the operation steps include:
[0031] Step 1, network input and initial convolution operation: the input feature map is first passed through a group convolution layer GConv1x1 to achieve feature channel grouping and compression. A depthwise separable convolution is used for spatial-level convolution operation on the feature map to reduce computational complexity. After DWConv, Channel_Shuffle operation is performed to rearrange the feature channels to improve information interaction between channels.
[0032] Step 2, residual connection module: add the output after Channel_Shuffle to the initial input feature to form a residual connection.
[0033] Step 3, convolution feature extraction: group convolution is performed on the feature map after residual connection to extract deeper spatial and channel features.
[0034] Step 4, multi-scale pooling module: MaxPool2D is used, with kernel sizes k=5, k=9 and k=13 respectively, to extract multi-scale context features. The outputs of the three pooling operations are concatenated with the original feature map in the channel dimension through Concat operation to form multi-scale features.
[0035] Step 5, further feature processing: a combination of GConv1x1 and GConv3x3 is used to extract features.
[0036] Step 6, attention mechanism introduction: SimAM attention mechanism is introduced on the concatenated feature map to improve the weight of key features.
[0037] Step 7, output module: the last group convolution processes the feature map into the final output feature.
[0038] Replace FasterNet network with yolov8n's backbone, and replace GMSSPPCSPC with SPPF, and the head part still follows the structure of yolov8. As shown in the attached Figure 1 figure. The dataset prepared in step one is input into the improved YOLOv8 model for training to obtain a model for detecting defects on the surface of a photovoltaic cell; the specific operation steps include:
[0039] Step 4.1: create a file named guangfu.yaml in the cfg / datasets folder, configure the path path, train training set path, and val validation set path; then configure the names category, a total of 11 categories, corresponding to 11 types of abnormalities: cracks (linear and star-shaped), broken grid, black core, vertical misalignment, horizontal misalignment, thick line, scratch, fragment, short circuit, printing error, and material anomaly.
[0040] Step 4.2: Create a new file called FasterNet.py in nn / modules and write the improved code into it. Import the FasterNetBlock module built in step 2 into ultralytics / nn / task.py.
[0041] Step 4.3: Create the GMSSPPCSPC.py file in the ultralytics / nn / module directory and put the improved code in it; and register the GMSSPPCSPC network model in step 3 in ultralytics / nn / tasks.py.
[0042] Step 4.4: Create a folder named ultralytics / cfg / models / v8
[0043] yolov8-FasterNet-GMSSPPCSPC.yaml configuration file completes the configuration of the improved yolov8 network model and obtains the yolov8-FasterNet-GMSSPPCSPC network model.
[0044] Step 4.5: Download the pre-trained weights yolov8.pt from the YOLOv8 open source website, write the train.py file, write the weight address and file address, set epochs = 200, batch = 16; and use the default parameters for other parameters.
[0045] The object detection module consists of three parallel detection branches, each of which is divided into a classification sub-branch and a regression sub-branch. The three detection branches are used to process features corresponding to different scales. The classification sub-branch consists of a ConvModule convolution module and a Conv2d convolution layer. The regression sub-branch has the same structure as the classification sub-branch. The object detection module processes the fused feature maps by: receiving the three feature maps of different scales output by the feature fusion module; inputting each scale feature map into two sub-branches of the three corresponding detection branches; each sub-branch extracts features through its own ConvModule and transforms them using Conv2d to obtain bounding box predictions and category predictions; calculating the loss function of the classification sub-branch and the loss function of the regression sub-branch; integrating the bounding box predictions and category predictions of the three main detection branches; using the non-maximum suppression algorithm to remove overlapping detection boxes; and filtering according to the confidence threshold to obtain the final detection result.
[0046] The improved model is evaluated and compared according to the visualization chart in the runs file after running. According to the set and parameters, the ShuffleNetV2, the original YOLOv8n and YOLOV10n and the improved model yolov8-FasterNet-GMSSPPCSPC are compared respectively, and the comparison results are shown in Table 1.
[0047] Table 1 Algorithm comparison
[0048] Model mAP % Params / M FLOPs / G YOLOV8n 0.852 3.00 8.1 ShuffleNetV2 0.857 7.30 14.2 YOLOV10n 0.810 2.51 6.5 The present invention 0.862 2.04 5.4
[0049] The comparison experiment shows the performance difference of the model of the present application and YOLOV8n and ShuffleNetV2 in photovoltaic cell panel defect detection.
[0050] The results show that the model of the present application performs best in mAP (mean average precision), reaching 0.862, which is better than YOLOV8n, YOLOV10n and ShuffleNetV2, indicating that it has higher accuracy in defect detection. At the same time, the parameter amount of the model of the present application is only 2.04M, which is significantly less than 3.00M of YOLOV8n, 2.51M of YOLOV10n and 7.30M of ShuffleNetV2, significantly reducing the calculation resource consumption of the model and improving the deployment efficiency. In addition, the FLOPs / G of the model of the present application is also lower, only 5.4, which is significantly lower than 8.1, 14.2 and 6.5 of the other three models, meaning that it has higher calculation efficiency and real-time performance. These advantages make the model of the present application more suitable for deployment in embedded devices or real-time monitoring systems with limited computing resources in practical applications.
[0051] The above examples further illustrate the purpose, technical solutions and advantages of the present application. It should be understood that the above examples are only preferred embodiments of the present application and do not limit the present application. Any modification, equivalent replacement, improvement, etc. made to the present application within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A lightweight photovoltaic panel defect detection method based on improved YOLOv8, characterized by, The method comprises the following steps: acquiring a photovoltaic panel defect image to be detected, and preprocessing the image; inputting the preprocessed image into a lightweight photovoltaic panel defect detection model to obtain a defect detection result; the lightweight photovoltaic panel defect detection model is an improved YOLOv8 network, and the improved YOLOv8 network comprises a FasterNet backbone network, a feature fusion module, a target detection module and an output module; training the lightweight photovoltaic panel defect detection model comprises the following steps: acquiring an original image dataset, preprocessing the images in the dataset, and taking the preprocessed images as a training set; inputting the data in the training set into the FasterNet backbone network for multi-scale feature extraction; inputting the multi-scale features into the feature fusion module for fusion to obtain a fused feature map; inputting the fused feature map into the target detection module to obtain a detection result; the output module is used for outputting the detection result; a loss function of the model is calculated according to the detection result, the parameters of the model are adjusted, and when the loss function converges, the training of the model is completed; the feature fusion module performs fusion processing on the multi-scale features, and comprises the following steps: step 1, inputting the multi-scale feature map into a grouped convolution layer GConv1x1 to obtain a feature map 1; step 2, inputting the feature map 1 into a depth separable convolution layer for spatial level convolution operation to obtain a feature map 2; step 3, performing Channel_Shuffle operation on the feature map 2 to obtain a feature map 3; step 4, performing residual connection on the feature map 3 and the input multi-scale feature map to obtain a feature map 4; step 5, performing grouped convolution on the feature map 4 to obtain a feature map 5 with more specific deep spatial information and channel information; step 6, performing multi-scale pooling on the feature map 5, splicing the multi-scale pooled feature map and the input feature map in the channel dimension to obtain a multi-scale feature map 1; the multi-scale pooling comprises three scale pooling operations, and the kernel layer sizes of the three scale pooling operations are k=5, k=9 and k=13 respectively; step 7, extracting features through a GConv1x1 and a GConv3x3 combination to obtain a feature map 6, and splicing the feature map 6 and the multi-scale feature map 1; step 8, introducing a SimAM attention mechanism on the spliced feature map to obtain a feature map 7; step 9, performing grouped convolution processing on the feature map 7 to obtain a fused feature map; the target detection module comprises three parallel detection branches, each detection branch is divided into a classification sub-branch and a regression sub-branch; the three detection branches are used for processing features corresponding to different scales; the classification sub-branch comprises a ConvModule convolution module and a Conv2d convolution layer; the structure of the regression sub-branch is the same as that of the classification sub-branch; The target detection module processes the fused feature map, including: receiving three feature maps of different scales output by the feature fusion module; inputting each scale feature map into two sub-branches in the corresponding three detection branches; each sub-branch extracts features through a respective ConvModule and transforms features using Conv2d to obtain a bounding box prediction result and a class prediction result; calculating a loss function of the classification sub-branch and a loss function of the regression sub-branch; integrating the bounding box prediction and class prediction results of the three main detection branches; using a non-maximum suppression algorithm to remove overlapping detection boxes; according to a confidence threshold screening, obtaining the final detection result.
2. The light-weight photovoltaic panel defect detection method based on improved YOLOv8 according to claim 1, characterized in that, The pre-processing of the image includes cropping, horizontal flipping and adjusting the saturation of the data.
3. The light-weight photovoltaic panel defect detection method based on improved YOLOv8 according to claim 1, characterized in that, The FasterNet backbone network comprises a PConv module, a FasterNetBlock module and a multi-stage feature extraction network; the multi-scale feature extraction of the image using the FasterNet backbone network comprises: inputting the input image into the PConv module for feature extraction; inputting the extracted feature map into the FasterNetBlock module for deep feature extraction; inputting the deep feature map into the multi-stage feature extraction network for multi-scale feature extraction.
4. The light-weight photovoltaic panel defect detection method based on improved YOLOv8 according to claim 3, characterized in that, The FasterNetBlock module processes the data, including: inputting the feature map into the PConv layer partial feature convolution; performing deep feature extraction on the feature map after the partial convolution to obtain a deep feature map; performing normalization and activation processing on the deep feature map, and performing residual connection on the processed feature map and the input feature map to output a feature map with local information.
5. The method for detecting defects in lightweight photovoltaic panels based on improved YOLOv8 according to claim 3, characterized in that: The multi-stage feature extraction network is composed of a Merging operation module and a plurality of Stage modules, and the Merging operation module is arranged between two Stage modules; each Stage module comprises a plurality of FasterNetBlock modules.
Citation Information
Patent Citations
Lightweight insulator defect detection method based on improved YOLOv8
CN118314436A
Multi-scale feature fusion photovoltaic panel defect detection method
CN119006438A
Cited By
Lightweight defect detection method and system for photovoltaic panel in Saggoke environment
CN121937522A