Photovoltaic cell panel defect detection method and system based on improved YOLOv9s model
By improving the YOLOv9s model, replacing the RepNCSPELAN4 module with CD-LSK module, introducing Shape-IoU loss function and BiFPN, the problem of insufficient small object detection accuracy in the complex background of traditional photovoltaic panel detection methods is solved, and higher detection accuracy is achieved and efficiency.
Patent Information
- Application Number
- CN202411056038.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-08
AI Technical Summary
Traditional photovoltaic panel defect detection methods have shortcomings in speed, accuracy and model size, especially in small object detection in complex contexts, which are difficult to meet the demand for high-quality products of intelligent manufacturing.
Using the improved YOLOv9s model, by replacing the RepNCSPELAN4 module as a CD-LSK module, the Shape-IoU loss function and the weighted bidirectional feature pyramid network module BiFPN are introduced to improve detection accuracy and efficiency.
It significantly improves the detection accuracy of small objects in complex backgrounds, enhances the expression ability of feature maps, improves the performance of detectors, and achieves higher detection effects without increasing the amount of calculation.
Smart Images

Figure CN118918089A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a photovoltaic panel defect detection method based on an improved YOLOv9s model. Background Art
[0002] With the advancement of science and technology, energy and environmental protection issues have become more prominent, and traditional energy can no longer meet current needs. As the most accessible renewable resource, solar energy has been widely used, and photovoltaic panel power generation technology has also made significant progress. With the proposal of the "carbon neutrality" goal, photovoltaics have gradually occupied a dominant position in the field of clean energy due to their advantages such as easy access, easy collection, and easy use.
[0003] Photovoltaic solar panels are key conversion devices in the process of converting solar energy into electrical energy. However, defects are inevitable during the production of photovoltaic panels, which can significantly reduce the photoelectric conversion efficiency and service life, leading to economic losses. This problem can be avoided by inspecting solar photovoltaic panels during intelligent manufacturing. However, the traditional manual inspection method of electroluminescent images (EL images) is cumbersome and requires the inspectors to have professional knowledge and rich experience. In order to reduce production costs, automatic inspection based on machine vision is more attractive.
[0004] Although traditional machine learning methods have reduced the cost of manual inspection to some extent, they have not achieved ideal results in terms of speed, accuracy, and model size. In addition, the defects generated during the production process have similar characteristics and are small in size, making automatic inspection of photovoltaic cells through electroluminescence images (EL images) a challenge.
[0005] In order to meet the growing demand for high-quality photovoltaic panel products in intelligent manufacturing and use, and ensure efficient operation in the power generation process, it is necessary to propose a high-precision and model-moderate photovoltaic panel defect detection method.
[0006] The above problems need to be solved urgently. Summary of the invention
[0007] The purpose of the present invention is to provide a photovoltaic panel defect detection method and system based on an improved YOLOv9s model, which is used to improve the detection accuracy of small targets in complex backgrounds.
[0008] In order to overcome at least one of the above-mentioned shortcomings of the prior art, on the one hand, the present invention provides a photovoltaic panel defect detection method based on an improved YOLOv9s model, the method comprising: S110: collecting solar panel defect images; S120: constructing a solar panel defect dataset by pre-processing the solar panel defect images by distortion, correction, removal of irrelevant background and / or normalization; S130: dividing the images contained in the dataset into a training set, a validation set and a test set in proportion, and using software to annotate the defect category and location information of each defective cell image; S140: constructing an improved YOLOv9s neural network model, including replacing part of the original The RepNCSPELAN4 module is replaced with the CD-LSK module, the original loss function is replaced with Shape-IoU, the network structure is modified, and the weighted bidirectional feature pyramid network module BiFPN is introduced; S150: the images contained in the training set are input into the improved YOLOv9s neural network model constructed in step S140 for training to obtain the trained network model; S160: the images contained in the test set are input into the trained network model in step S150, and after obtaining the test results, the errors are compared with the information of the real standard; S170: the network model trained in step S150 is used for solar panel defect detection under real working conditions to obtain the detection results.
[0009] Furthermore, the improved YOLOv9s neural network model includes a backbone network, a neck network and a head network; the backbone network includes a Conv module, an ELAN1 module, an Aconv module, and a RepNCSPELAN4 module, which are used to generate feature maps; the neck network includes an SPPELAN module, a Conv module, an Upsample module, a Concat module, a RepNCSPELAN4 module, an AConv module, a Bifpn module, and an Adown module, which are used to perform feature fusion on the feature maps; the head network includes three detection heads, which are used to generate feature vectors P3, P4, and P5 of different sizes, which are respectively used to detect small-scale targets, medium-scale targets, and large-scale targets.
[0010] Furthermore, the replacing of part of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network includes: replacing the RepNCSPELAN4 modules of the seventh and ninth layers in the backbone network of the original YOLOv9s neural network model with the CD-LSK modules; the CD-LSK module includes an LSKblock module and two convolution blocks Conv, and the two convolution blocks Conv are respectively located at the input and output ends of the LSKblock module.
[0011] Furthermore, the LSKblock module is composed of two residual sub-blocks, including a large kernel selection sub-block LKSelection and a feed-forward network sub-block FFN; the large kernel selection sub-block LK Selection achieves local or global attention to the input features by dynamically adjusting the receptive field of the network, including: deep convolution sequence: using a series of deep convolutions to process the input feature map, and the kernel size and expansion rate of each convolution layer gradually increase to expand the receptive field; spatial selection mechanism: weighting the feature map after convolution, and the weighted weight is dynamically calculated based on the input feature map, allowing the network to dynamically adjust the receptive field according to the spatial position of the target object; the feed-forward network sub-block FFN is used to achieve channel mixing and feature information refinement through a combination of a fully connected layer, a deep convolution, a GELU activation and a second fully connected layer.
[0012] Furthermore, replacing the original loss function with Shape-IoU includes:
[0013] The calculation formula of Shape-IoU is as follows:
[0014] L Shape-IoU =1-IOU+distance shape +0.5*Ω shape ;
[0015]
[0016]
[0017] Ω shape =Σ t=w,h (1-e ω t) θ ;
[0018]
[0019] In the formula, scale is the scale factor, which is related to the scale of the target in the dataset, ww and hh are the weight coefficients in the horizontal and vertical directions respectively, and their values are related to the size and shape of the GT box, B represents the anchor box, and B gt represents the GT box, w gt is the width of the GT frame, h gt is the height of the GT frame, (x c gt ,y c gt ) represents the coordinates of the center point in the GT box, (x c ,y c ) represents the coordinates of the center point in the anchor box, w represents the width of the anchor box, h represents the height of the anchor box, and c is a constant related to the dataset.
[0020] Furthermore, the modification of the network structure and the introduction of the weighted bidirectional feature pyramid network module BiFPN include: introducing the weighted bidirectional feature pyramid network module BiFPN in the neck network and then introducing learnable weights to learn the importance of different input features, and repeatedly applying multi-scale feature fusion from top to bottom and from bottom to top; the weighted bidirectional feature pyramid network module BiFPN is formed based on bidirectional cross-scale connection and fast normalized feature fusion, wherein the fast normalized feature fusion formula is:
[0021]
[0022] In the formula, w i is the learnable weight of the i-th feature map, whose value is greater than or equal to 0, ∈ is 0.0001, O represents the fused feature map, I i is the i-th feature map, w j For j w i Add.
[0023] Furthermore, the weighted bidirectional feature pyramid network module BiFPN adds two lateral connection paths based on the original feature pyramid network FPN and path aggregation network PANet structure, which is used to integrate the features extracted by the backbone network into the feature map to be detected.
[0024] Furthermore, the step of inputting the images contained in the training set into the improved YOLOv9s neural network model constructed in step S140 for training to obtain the trained network model includes: inputting the images contained in the training set into the improved YOLOv9s model for training to obtain optimal weights; using the optimal weights for testing and verification, and adjusting the parameters in the improved YOLOv9s model.
[0025] Furthermore, the S160: inputting the images contained in the test set into the trained network model in step S150, and performing error comparison with the true standard information after obtaining the detection results includes: inputting the test set images into the trained network model to obtain prediction information of the defect images in the test set, including defect location information, category information and confidence information; comparing with the true labeled information, and outputting the precision, recall and average precision mean of the model test set.
[0026] In a second aspect, the present invention provides a photovoltaic panel defect detection system based on an improved YOLOv9s model, the system comprising: an image acquisition unit, adapted to acquire defective images of solar panels; a data set construction unit, adapted to construct a solar panel defect data set by preprocessing the defective images of the solar panels by distortion, correction, removal of irrelevant background and / or normalization; a data set division unit, adapted to divide the images contained in the data set into a training set, a validation set and a test set in proportion, and annotate the defect category and location information of each defective cell image using software; an improved YOLOv9s model construction unit, adapted to construct an improved YOLOv9s neural network model, including replacing part of the original RepN in the backbone network; The CSPELAN4 module is replaced with the CD-LSK module, the original loss function is replaced with Shape-IoU, the network structure is modified, and the weighted bidirectional feature pyramid network module BiFPN is introduced; the model training unit is suitable for inputting the images contained in the training set into the improved YOLOv9s neural network model constructed by the improved YOLOv9s model unit for training to obtain the trained network model; the model testing unit is suitable for inputting the images contained in the test set into the trained network model in the model training unit, and after obtaining the test results, the error is compared with the information of the real standard; the detection unit is suitable for using the trained network model in the model training unit for solar panel defect detection under real working conditions to obtain the detection results.
[0027] On the other hand, the present invention also provides a computer-readable storage medium, wherein one or more instructions are stored in the computer-readable storage medium, and the computer instructions are used to enable the computer to execute the above-mentioned photovoltaic panel defect detection method based on the improved YOLOv9s model.
[0028] On the other hand, the present invention provides an electronic device, comprising: a memory and a processor; the memory stores at least one program instruction; the processor implements the above-mentioned photovoltaic panel defect detection method based on the improved YOLOv9s model by loading and executing the at least one program instruction.
[0029] The beneficial effects of the present invention are as follows: the present invention provides a photovoltaic panel defect detection method based on the improved YOLOv9s model. On the one hand, the RepNCSPELAN4 module is replaced, and the large selective kernel mechanism of LSK is used in the detection of small targets under complex backgrounds, which significantly improves the detection accuracy of small targets under complex backgrounds. On the other hand, by adopting the Shape-IoU loss function, which is a target detection method based on the border regression loss function, the regression features of the bounding box are analyzed, and the detection effect can be effectively improved by considering the shape and scale of the border itself. On the other hand, the neck network weighted bidirectional feature pyramid network (BiFPN) is added, and the network introduces learnable weights to learn the importance of different input features. At the same time, multi-scale feature fusion from top to bottom and from bottom to top is repeatedly applied. After a series of operations, the feature image to be detected can obtain more feature information without increasing too much calculation, enhance the expression ability of the feature map, and improve the performance of the detector. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0031] Figure 1 This is a flow chart of a photovoltaic panel defect detection method based on an improved YOLOv9s model provided in Example 1 of the present invention.
[0032] Figure 2 It is a schematic diagram of the structure of an improved YOLOv9s model provided in Example 1 of the present invention.
[0033] Figure 3 It is a schematic diagram of the structure of a CD-LSK module provided in Example 1 of the present invention.
[0034] Figure 4 It is a schematic diagram of a GT frame and an Anchor frame provided in Example 1 of the present invention.
[0035] Figure 5 It is a schematic diagram of the BiFPN module structure provided in Example 1 of the present invention.
[0036] Figure 6 It is a schematic diagram of the structure of a photovoltaic panel defect detection system based on an improved YOLOv9s model provided in Example 2 of the present invention.
[0037] Figure 7 This is a partial block diagram of an electronic device provided in Example 4 of the present invention. DETAILED DESCRIPTION
[0038] It should be mentioned before discussing the exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the operations as sequential processes, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0039] It should be understood that, although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another unit. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.
[0040] The present invention will now be described in detail with reference to the accompanying drawings. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.
[0041] Example 1
[0042] like Figure 1 As shown, it is a flow chart of a photovoltaic panel defect detection method based on an improved YOLOv9s model provided by the present invention.
[0043] As an example, the method includes:
[0044] S110: Collect defect images of solar panels.
[0045] Preferably, an industrial camera is used to capture an image of a solar panel under electroluminescence conditions of a photovoltaic power station, and an electroluminescence image (hereinafter referred to as EL image) of the solar panel is collected.
[0046] S120: Constructing a solar panel defect dataset by preprocessing the solar panel defect image by distortion, correction, irrelevant background removal and / or normalization.
[0047] S130: Divide the images contained in the data set into a training set, a validation set, and a test set in proportion, and use software to annotate the defect category and location information of each defective battery cell image.
[0048] Preferably, the collected EL image is subjected to distortion correction to remove irrelevant background, so that the solar panel image occupies the entire image in a regular rectangle; the solar panel image is cropped to obtain a solar cell image, from which defective images are screened out, and a normalization operation is performed to obtain defective images that are consistent with the size of the EL public data set image, and an original solar cell defect image library is established; the original solar cell image size used in this embodiment is 300×300; the original solar cell defect image library is randomly divided into a training set, a validation set, and a test set in a ratio of 7:2:1. The training set is subjected to horizontal flipping, vertical flipping, contrast enhancement, and brightness enhancement operations to expand the training set image. The defect category and location information of each defective cell image are annotated using software; the defect type of the defective area is manually annotated using Labelimg software, including one or a combination of cracks, fractures, black spots, scratches, wear, edge collapse, and missing corners.
[0049] S140: Build an improved YOLOv9s neural network model, including replacing some of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network, replacing the original loss function with Shape-IoU, modifying the network structure, and introducing the weighted bidirectional feature pyramid network module BiFPN.
[0050] Preferably, combined Figure 2 As shown, the improved YOLOv9s neural network model includes a backbone network, a neck network and a head network; the backbone network includes a Conv module, an ELAN1 module, an Aconv module, and a RepNCSPELAN4 module for generating feature maps; the neck network includes a SPPELAN module, a Conv module, an Upsample module, a Concat module, a RepNCSPELAN4 module, an AConv module, a Bifpn module, and an Adown module for performing feature fusion on the feature maps; the head network includes three detection heads for generating feature vectors P3, P4, and P5 of different sizes, which are respectively used to detect small-scale targets, medium-scale targets, and large-scale targets. Specifically, the neck network accepts the feature map from the backbone network as input, and uses the RepNCSPELAN4 module, the AConv module, the Bifpn module, and the upsampling operation to perform feature fusion, and finally outputs the feature map. The detection head contains detection branches of three target scales: large, medium, and small. Each branch is responsible for detecting targets of different scale ranges, and also has an auxiliary reversible branch. Due to the information bottleneck that causes the main branch to lose important information in deep features, the main detection branch is able to receive reliable gradient information from the auxiliary reversible branch, thereby improving the accuracy of the model.
[0051] Preferably, combined Figure 3As shown, the method of replacing part of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network includes: replacing the RepNCSPELAN4 modules of the seventh and ninth layers in the backbone network of the original YOLOv9s neural network model with CD-LSK modules; the CD-LSK module includes an LSKblock module and two convolution blocks Conv, and the two convolution blocks Conv are respectively located at the input and output ends of the LSKblock module. Specifically, in traditional small target detection, the importance of prior knowledge in complex backgrounds for accurately detecting tiny targets is usually ignored. However, these tiny targets usually require larger contextual feature information to be correctly identified. The LSKblock attention mechanism can dynamically adjust the receptive field of feature extraction and effectively process the context of small target objects in complex backgrounds, thereby improving the accuracy and robustness of the model in small target detection tasks. LSKblockAttention (Large Separable Kernelblock, LSKblock attention mechanism) weights and spatially merges the features processed by large deep kernels through a spatial selection mechanism. The core of this mechanism is to determine the weight of the kernel according to the features of the dynamic input, so that the model can adaptively use kernels of different sizes and adjust the receptive field to adapt to targets of various sizes and shapes in the image. This flexibility and adaptability can significantly improve the model's feature extraction and target detection capabilities in complex scenarios.
[0052] Preferably, the LSKblock module consists of two residual sub-blocks, including a large core selection sub-block LKSelection and a feedforward network sub-block FFN (Feed for Ward Network); the large core selection sub-block LK Selection achieves local or global attention to the input features by dynamically adjusting the receptive field of the network, including: deep convolution sequence: using a series of deep convolutions to process the input feature map, the kernel size and expansion rate of each convolution layer gradually increase to expand the receptive field; spatial selection mechanism: weighting the convolved feature map, the weighted weight is dynamically calculated based on the input feature map, allowing the network to dynamically adjust the receptive field according to the spatial position of the target object; the feedforward network sub-block FFN is used to achieve channel mixing and feature information refinement through a combination of a fully connected layer, deep convolution, GELU activation and a second fully connected layer. Specifically, LSKblockAttention, as an improved CD-LSK of the attention mechanism, can dynamically adjust the receptive field size through a spatial selectivity mechanism, and can more effectively process a wide range of contexts of different types of targets. This mechanism allows the model to adaptively determine the weights of large kernels based on the input, allowing the network to focus more on the detailed information of small targets. CD-LSK with the LSKblockAttention mechanism significantly improves the ability to locate and recognize small targets, thereby significantly improving the effect of small target detection.
[0053] Preferably, combined Figure 4 As shown, replacing the original loss function with Shape-IoU includes:
[0054] The calculation formula of Shape-IoU is as follows:
[0055] L Shape-IoU =1-IOU+distance shape +0.5*Ω shape ;
[0056]
[0057] Ω shape =Σ t=w,h (1-e ω t) θ ;
[0058]
[0059] In the formula, scale is the scale factor, which is related to the scale of the target in the dataset, ww and hh are the weight coefficients in the horizontal and vertical directions respectively, and their values are related to the size and shape of the GT box, B represents the anchor box, and B gt represents the GT box, w gt is the width of the GT frame, hgt is the height of the GT frame, (x c gt ,y c gt ) represents the coordinates of the center point in the GT box, (x c ,y c ) represents the coordinates of the center point in the anchor box, w represents the width of the anchor box, h represents the height of the anchor box, and c is a constant related to the dataset.
[0060] Since the original CIoU loss function requires more time and data to train the model, it may face challenges especially on small-scale data sets. At the same time, although CIoU considers the influence of factors such as the distance and shape between the GT box (ground truth box) and the Anchor box (anchor box) on the bounding box regression, it ignores the influence of the shape and size of the bounding box itself. Therefore, this embodiment uses Shape-IoU to replace the CIoU loss function. In the new Shape-IoU loss function, by considering the change in the angle between the center point of the Anchor box and the GT box as a new loss metric, their matching degree can be more accurately evaluated, thereby improving the accuracy of the bounding box regression, especially in the small target detection task, which can significantly improve the performance of the model.
[0061] Preferably, the modification of the network structure and the introduction of a weighted bidirectional feature pyramid network module BiFPN (bi-directional feature pyramid network, BiFPN) include: introducing a weighted bidirectional feature pyramid network module BiFPN in the neck network and then introducing learnable weights to learn the importance of different input features, while repeatedly applying multi-scale feature fusion from top to bottom and from bottom to top; the weighted bidirectional feature pyramid network module BiFPN is formed based on bidirectional cross-scale connection and fast normalized feature fusion. Regarding weighting, in the feature fusion process, weighting is required because of different resolutions, but because different feature inputs have different resolutions, their contributions to the output of the final feature network should also be different, so the network needs to learn this weight, that is, weighting is performed using a fast normalized feature fusion method, and the formula is:
[0062]
[0063] In the formula, w i is the learnable weight of the i-th feature map, whose value is greater than or equal to 0, ∈ is 0.0001, O represents the fused feature map, I i is the i-th feature map, w j For j w i Add.
[0064] Specifically, in small target detection, a series of convolutions will lead to feature information loss and insufficient feature extraction capabilities during feature extraction. The BiFPN module allows for simple and fast multi-scale feature fusion, and can uniformly scale the resolution, depth, and width of all backbone networks, feature networks, and bounding box prediction networks. The network introduces learnable weights to learn the importance of different input features, and repeatedly applies multi-scale feature fusion from top to bottom and bottom to top. Compared with traditional FPN, there is an additional bottom-up transfer, so that the underlying information of the image can also be fully utilized, and the deep features are fused with the shallow features through upsampling. After the upsampling is completed, the shallow features are downsampled and combined with the deep features.
[0065] Preferably, combined Figure 5 As shown, the weighted bidirectional feature pyramid network module BiFPN adds two lateral connection paths based on the original feature pyramid network FPN (Feature Pyramid Networks) and path aggregation network PANet (Path Aggregation Network) structures, which are used to integrate the features extracted by the backbone network into the feature map to be detected. This method allows the feature image to be detected to obtain more feature information without increasing too much computational effort, enhances the expressiveness of the feature map, and improves the performance of the detector. This forms a bidirectional cross-scale connection structure, which fuses deep features with shallow features across scales through top-down feature fusion pathways and bottom-up feature fusion pathways. This method can enhance the transmission of feature map information between different network levels and improve the problem of image feature information loss caused by resolution changes in feature maps under a series of convolutions. The improved network can fuse more location and detail information, allowing the network to better focus on the area where small targets are located.
[0066] S150: Input the images included in the training set into the improved YOLOv9s neural network model constructed in step S140 for training to obtain a trained network model.
[0067] Preferably, step S150 includes: inputting the images included in the training set into the improved YOLOv9s model for training to obtain the optimal weights; using the optimal weights for testing and verification, and adjusting the parameters in the improved YOLOv9s model. The specific training process includes: inputting the training set into the improved model for training to obtain a new network, including:
[0068] Build the experimental environment: The deep learning training environment is implemented using the Pytorch-GPU training framework and Python language, using CUDA version 11.7 and the GPU version NVIDIA GeForce GTX 3080Ti.
[0069] Set network parameters: set the image training size to 1024×1024; use the Adam optimizer to optimize the network to speed up the training process; and adjust the learning rate through the cosine function;
[0070] The epoch is set to 200 and the batch-size is set to 8.
[0071] S160: Input the images included in the test set into the trained network model in step S150, and compare the error with the true standard information after obtaining the test results.
[0072] Preferably, S160 includes: inputting the test set images into the trained network model to obtain the prediction information of the test set defect images, including defect location information, category information and confidence information; comparing with the real annotation information, and outputting the precision, recall rate and average precision mean of the model test set. The comparison of model parameters before and after improvement is shown in Table 1 below:
[0073] Table 1:
[0074]
[0075] From the data in the table, it can be seen that the various parameters of the improved YOLOv9s neural network model have been significantly improved, reflecting that the improved model has better generalization ability than the original model.
[0076] In the above embodiment, on the one hand, the RepNCSPELAN4 module is replaced, and the large selective kernel mechanism of LSK is used in the detection of small targets under complex backgrounds, which significantly improves the detection accuracy of small targets under complex backgrounds. On the other hand, by adopting the Shape-IoU loss function, which is a target detection method based on the border regression loss function, the regression features of the bounding box are analyzed, and the detection effect can be effectively improved by considering the shape and scale of the border itself. On the other hand, the neck network weighted bidirectional feature pyramid network (BiFPN) is added, and the network introduces learnable weights to learn the importance of different input features. At the same time, multi-scale feature fusion from top to bottom and from bottom to top is repeatedly applied. After a series of operations, the feature image to be detected can obtain more feature information without increasing too much calculation, enhance the expression ability of the feature map, and improve the performance of the detector.
[0077] Example 2
[0078] See also Figure 6 , this embodiment provides a schematic diagram of the structure of a photovoltaic panel defect detection system based on an improved YOLOv9s model.
[0079] As an example, the system includes:
[0080] The image acquisition unit 610 is adapted to acquire defect images of solar panel.
[0081] The data set construction unit 620 is adapted to construct a solar panel defect data set by preprocessing the solar panel defect image by distortion, correction, irrelevant background removal and / or normalization.
[0082] The data set division unit 630 is adapted to divide the images contained in the data set into a training set, a validation set and a test set in proportion, and to use software to annotate the defect category and location information of each defective battery cell image.
[0083] The improved YOLOv9s model building unit 640 is suitable for building an improved YOLOv9s neural network model, including replacing part of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network, replacing the original loss function with Shape-IoU, modifying the network structure, and introducing a weighted bidirectional feature pyramid network module BiFPN.
[0084] The model training unit 650 is adapted to input the images contained in the training set into the improved YOLOv9s neural network model constructed by the improved YOLOv9s model construction unit for training, thereby obtaining a trained network model.
[0085] The model testing unit 660 is adapted to input the images contained in the test set into the trained network model in the model training unit, and compare the error with the true standard information after obtaining the test result.
[0086] The detection unit 670 is adapted to use the network model trained in the model training unit to detect defects in solar panels under real working conditions to obtain detection results.
[0087] It is not difficult to find that this embodiment is a system embodiment corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.
[0088] It is worth mentioning that all units involved in this embodiment are logical units. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.
[0089] Example 3
[0090] The embodiment of the present invention further proposes a storage medium, on which a photovoltaic panel defect detection method based on an improved YOLOv9s model is stored, and when the photovoltaic panel defect detection program based on the improved YOLOv9s model is executed by a processor, the steps of the photovoltaic panel defect detection method based on the improved YOLOv9s model as described above are implemented. Since this storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be repeated here one by one.
[0091] Example 4
[0092] See also Figure 7 An embodiment of the present invention also provides an electronic device, comprising: a memory and a processor; the memory stores at least one program instruction; the processor loads and executes the at least one program instruction to implement the photovoltaic panel defect detection method based on the improved YOLOv9s model provided in Example 1.
[0093] The memory 602 and the processor 601 are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors 601 and the memory 602 together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor 601 is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor 601.
[0094] The processor 601 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 602 can be used to store data used by the processor 601 when performing operations.
[0095] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can know all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the scope of protection of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
Claims
1. A photovoltaic panel defect detection method based on an improved YOLOv9s model, characterized in that: The method comprises: S110: collecting defect images of solar panels; S120: constructing a solar panel defect dataset by preprocessing the solar panel defect image by distortion, correction, irrelevant background removal and / or normalization; S130: dividing the images contained in the data set into a training set, a validation set, and a test set in proportion, and using software to annotate the defect category and location information of each defective battery cell image; S140: Build an improved YOLOv9s neural network model, including replacing some of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network, replacing the original loss function with Shape-IoU, modifying the network structure, and introducing the weighted bidirectional feature pyramid network module BiFPN; S150: Input the images included in the training set into the improved YOLOv9s neural network model constructed in step S140 for training, to obtain a trained network model; S160: Input the images included in the test set into the trained network model in step S150, and compare the error with the true standard information after obtaining the test results; S170: Using the network model trained in step S150 to detect solar panel defects under real working conditions to obtain detection results.
2. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 1 is characterized in that: The improved YOLOv9s neural network model includes a backbone network, a neck network and a head network; The backbone network includes a Conv module, an ELAN1 module, an Aconv module, and a RepNCSPELAN4 module, which are used to generate feature maps; The neck network includes a SPPELAN module, a Conv module, an Upsample module, a Concat module, a RepNCSPELAN4 module, an AConv module, a Bifpn module and an Adown module, which are used to perform feature fusion on the feature map; The head network includes three detection heads for generating feature vectors P3, P4, and P5 of different sizes, which are used to detect small-scale targets, medium-scale targets, and large-scale targets, respectively.
3. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 1 is characterized in that: The method of replacing part of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network includes: Use CD-LSK module to replace the RepNCSPELAN4 modules of the seventh and ninth layers in the backbone network of the original YOLOv9s neural network model; The CD-LSK module includes an LSKblock module and two convolution blocks Conv, and the two convolution blocks Conv are respectively located at the input end and the output end of the LSKblock module.
4. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 3 is characterized in that: The LSKblock module consists of two residual sub-blocks, including a large kernel selection sub-block LK Selection and a feed-forward network sub-block FFN; The large kernel selection subblock LK Selection achieves local or global attention to the input features by dynamically adjusting the receptive field of the network, including: deep convolution sequence: using a series of deep convolutions to process the input feature map, the kernel size and expansion rate of each convolution layer gradually increase to expand the receptive field; spatial selection mechanism: weighting the feature map after convolution, the weighted weight is dynamically calculated based on the input feature map, allowing the network to dynamically adjust the receptive field according to the spatial position of the target object; The feed-forward network sub-block FFN is used to achieve channel mixing and feature information refinement through a combination of a fully connected layer, a deep convolution, a GELU activation, and a second fully connected layer.
5. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 1 is characterized in that: The replacement of the original loss function with Shape-IoU includes: The calculation formula of Shape-IoU is as follows: L shape-IoU =1-IOU+distance shape +0.5*Ω shape ; In the formula, scale is the scale factor, which is related to the scale of the target in the dataset, ww and hh are the weight coefficients in the horizontal and vertical directions respectively, and their values are related to the size and shape of the GT box, B represents the anchor box, and B gt represents the GT box, w gt is the width of the GT frame, h gt is the height of the GT frame, (x c gt ,y c gt ) represents the coordinates of the center point in the GT box, (x c ,y c ) represents the coordinates of the center point in the anchor box, w represents the width of the anchor box, h represents the height of the anchor box, and c is a constant related to the dataset.
6. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 1 is characterized in that: The modified network structure and the introduction of the weighted bidirectional feature pyramid network module BiFPN include: By introducing a weighted bidirectional feature pyramid network module BiFPN into the neck network, learnable weights are introduced to learn the importance of different input features, and multi-scale feature fusion from top to bottom and bottom to top is repeatedly applied; The weighted bidirectional feature pyramid network module BiFPN is formed based on bidirectional cross-scale connection and fast normalized feature fusion, wherein the fast normalized feature fusion formula is: In the formula, w i is the learnable weight of the i-th feature map, whose value is greater than or equal to 0, ∈ is 0.0001, O represents the fused feature map, I i is the i-th feature map, w j For j w i Add.
7. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 6 is characterized in that: The weighted bidirectional feature pyramid network module BiFPN adds two lateral connection paths based on the original feature pyramid network FPN and path aggregation network PANet structure, which is used to integrate the features extracted by the backbone network into the feature map to be detected.
8. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 1, characterized in that: The images contained in the training set are input into the improved YOLOv9s neural network model constructed in step S140 for training, and the trained network model obtained includes: Input the images contained in the training set into the improved YOLOv9s model for training to obtain the optimal weights; The optimal weights are used for testing and verification, and the parameters in the improved YOLOv9s model are adjusted.
9. The photovoltaic panel defect detection method based on the improved YOLOv9s model according to claim 1, characterized in that: The step S160: inputting the images included in the test set into the trained network model in step S150, and performing error comparison with the true standard information after obtaining the detection results, comprises: Input the test set images into the trained network model to obtain the prediction information of the test set defect images, including defect location information, category information and confidence information; Compare with the actual labeled information and output the precision, recall and average precision of the model test set.
10. A photovoltaic panel defect detection system based on an improved YOLOv9s model, characterized in that: The system comprises: An image acquisition unit, suitable for acquiring defect images of solar panels; A data set construction unit, adapted to construct a solar panel defect data set by preprocessing the solar panel defect image by distortion, correction, irrelevant background removal and / or normalization; A data set division unit, adapted to divide the images contained in the data set into a training set, a validation set and a test set in proportion, and to annotate the defect category and location information of each defective cell image using software; Build an improved YOLOv9s model unit, which is suitable for building an improved YOLOv9s neural network model, including replacing some of the original RepNCSPELAN4 modules with CD-LSK modules in the backbone network, replacing the original loss function with Shape-IoU, modifying the network structure, and introducing the weighted bidirectional feature pyramid network module BiFPN; The model training unit is adapted to input the images included in the training set into the improved YOLOv9s neural network model constructed by the building improved YOLOv9s model unit for training, thereby obtaining a trained network model; The model testing unit is adapted to input the images contained in the test set into the trained network model in the model training unit, and compare the error with the true standard information after obtaining the test result; The detection unit is suitable for using the network model trained in the model training unit to detect defects in solar panels under real working conditions to obtain detection results.
Citation Information
Patent Citations
Solar cell surface defect detection method and system based on improved YOLOv8
CN117994210A
High-reflection cylinder workpiece surface defect detection method based on improved YOLOv8 model
CN118351054A
Improved pavement disease detection method and device based on YOLOv9 model
CN118379714A
Cited By
PCB defect detection method, system and equipment and storage medium
CN119048497A
Paper quality detection method and system
CN119625409A
Lightweight target detection method and system for abnormal rice detection
CN120047678A
Shaving board surface defect detection method based on deep learning
CN120147248A
A Deep Learning-Based Method for Detecting Surface Defects in Particleboard
CN120147248B
