Method for detecting defects of photovoltaic solar cell panel based on improved YOLOv5
By improving the YOLOv5 detection method and utilizing distributed shift convolution blocks and attention mechanisms, a photovoltaic solar panel damage image dataset was constructed. This solved the time-consuming and costly problems of existing detection technologies and achieved efficient and accurate solar panel defect detection.
Patent Information
- Application Number
- CN202510858616.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-03
AI Technical Summary
Existing photovoltaic solar panel defect detection methods are not suitable for installed solar panels, and are costly, time-consuming, and incomplete, making it difficult to meet the needs of efficient inspection of large numbers of solar panels.
An improved YOLOv5 detection method is adopted. By building a YOLOv5 network structure, using distributed shift convolution blocks and attention mechanism, and combining feature extraction and fusion technology, a photovoltaic solar panel damage image dataset is constructed for efficient detection.
It significantly improves the accuracy and efficiency of photovoltaic solar panel defect detection, can detect various damages in a timely manner, extend the service life of solar panels, and reduce detection costs.
Smart Images

Figure CN120747710A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic power generation, and in particular to a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5. Background Art
[0002] With the rapid development of photovoltaic power generation technology, photovoltaic solar panels, as core components of photovoltaic power generation, play a vital role in the reliable operation of the system. Their structural integrity and performance stability are key to ensuring reliable operation. However, over long-term operation, solar panels are affected by the natural environment and mechanical stress, and various defects such as cracks, scratches, and corrosion may occur. These defects may affect the performance of the solar panels and even endanger the safe operation of the entire photovoltaic power generation system. Defects or damage to photovoltaic solar panels not only reduce power generation efficiency but also increase monitoring errors, safety risks, and maintenance costs.
[0003] Existing defect detection methods for photovoltaic solar panels include crystalline silicon cell inspection and hotspot detection. Additionally, there are solutions for cell defect detection and color classification based on machine vision. However, these methods are only suitable for large-scale factories and are not suitable for defect detection of installed and operational solar panels.
[0004] Existing technologies for inspecting installed solar panels use a system consisting of a black box, an infrared thermal imager, a simulated light source, and an image processing computer. However, this approach is not suitable for inspecting large numbers of solar panels, and these methods are costly, time-consuming, and incomplete.
[0005] In short, this technology has great potential for detecting defects in photovoltaic solar panels, but its current defect detection capabilities need to be significantly improved. Conventional methods are time-consuming, while complex methods require a lot of capital.
[0006] Based on this, the present invention proposes a method for detecting defects in photovoltaic solar panels based on the improved YOLOv5, which comprehensively inspects cracks, black spots and other damage on photovoltaic solar panels through the environment constructed by YOLOv5. Summary of the Invention
[0007] The present invention provides a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5, comprising:
[0008] Build the YOLOv5 network structure;
[0009] Collect a large number of damaged solar panel images to form a solar panel damage image dataset;
[0010] Input the solar panel damage image dataset into the YOLOv5 network structure;
[0011] The distributed shift convolution block is used to extract features from the solar panel damage image dataset and the extracted features are added to the original input image set.
[0012] Introducing the attention mechanism to focus on the key information of the input image set, extracting deeper features, and performing feature fusion on the extracted features;
[0013] Perform accuracy testing on the fused features to obtain the fused solar panel damage features;
[0014] The solar panel damage characteristics are input into the photovoltaic solar panel defect detection model, and the photovoltaic solar panel defect detection results are output.
[0015] As described above, a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5 is provided, wherein the YOLOv5 network structure includes an input module, a trunk module, a neck module, and a head module; the input module is used for input image preprocessing; the trunk module is used for image feature extraction; the neck module is used for image feature fusion; and the head module is used for detection information output.
[0016] As described above, a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5 is described, in which a solar panel observer composed of an EL detector is used to collect an image dataset. The dataset is divided into a training set, a validation set, and a test set, and contains two defect detection labels: cracks and black spots.
[0017] As described above, a method for detecting photovoltaic solar panel defects based on an improved YOLOv5 is described, wherein features are extracted from a solar panel damage image dataset using a distributed shift convolution block. Specifically, the method includes replacing the second convolution block in the original network structure with DSConv, simulating the behavior of the convolution layer by using quantization and distribution shift, and eliminating redundant feature maps.
[0018] As described above, a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5 is described, wherein DSConv is divided into two different parts: a variable quantization kernel and a distribution shift; the variable quantization kernel tensor only stores integer values with variable bit lengths, which is the same size as the original convolution tensor, and the parameter values are quantized from the original floating-point model; the distribution shift component is used to change the variable quantization kernel to simulate the distribution of the original convolution kernel.
[0019] As described above, a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5 is described, wherein the initialization of the values of the components of DSConv is specifically to: minimize the KL divergence, aiming to find the minimum information loss between the original weight distribution and the kernel distribution transformer; or minimize the L2 norm, so that the parameters should be as close as possible to the optimal value of the original network.
[0020] A method for detecting defects in photovoltaic solar panels based on a modified YOLOv5 is described above, wherein a scaling factor is used to evaluate the integer value of VQK, the input tensor is multiplied by VQK, and a channel distribution shift is subsequently applied after all convolution operations in a given convolution kernel are completed.
[0021] As described above, a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5 is introduced, in which an attention mechanism is introduced to focus on key information of an input image set. Specifically, a weight is assigned to each part of the input data, that is, a weight is assigned to each pixel or region of the input image. This weight represents the importance of the part to the current task.
[0022] As described above, a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5 is described, wherein the average precision, mean average precision, precision, and recall of the model are calculated to determine the improvement effect of YOLOv5s.
[0023] The present invention also provides a computer storage medium, comprising: at least one memory and at least one processor;
[0024] The memory is used to store one or more program instructions;
[0025] A processor is configured to run one or more program instructions to execute any one of the above methods for detecting defects in photovoltaic solar panels based on the improved YOLOv5.
[0026] The beneficial effects achieved by the present invention are as follows:
[0027] (1) When faced with a large number of solar panels with multiple types of damage, this application uses yolov5-CAA-DSConv to build an environment and adopts the convolution method to reduce the amount of calculation and eliminate the influence of redundant features. For the case where two defects overlap, the detection method is improved.
[0028] (2) Multiple attention mechanisms work together to achieve synergy and achieve scale, space, and task perception between feature layers, significantly enhancing the representation capability of the object detection module.
[0029] (3) Through the modification of models, modules and functions, the yolov5 model has achieved significant improvements in photovoltaic solar panel detection.
[0030] (4) In terms of photovoltaic solar panel detection, the mAP50 and recall rate of the improved yolov5-CAA-DSConv are higher than those of the basic version yolov5s, which can meet the requirements of efficient and accurate detection in the field of photovoltaic solar panels.
[0031] (5) Through experiments, the improved yolov5-CAA-DSConv improves the monitoring efficiency and can detect solar panel defects in time, thereby extending the service life of the solar panels. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments described in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0033] Figure 1 This is a flow chart of a method for detecting defects in photovoltaic solar panels based on improved YOLOv5 provided in Example 1 of the present application. DETAILED DESCRIPTION
[0034] The following is a clear and complete description of the technical solutions in the embodiments of the present invention, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0035] Example 1
[0036] like Figure 1 As shown, the first embodiment of the present application provides a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5, including:
[0037] Step 110: Build a YOLOv5 network structure.
[0038] The YOLOv5 network structure mainly consists of four modules: input, backbone, neck and head, which are responsible for input image preprocessing, feature extraction, feature fusion and detection information output respectively.
[0039] The input module is used to preprocess the input image. The input image size of the YOLOv5 network structure is 608×608. Preprocessing mainly involves scaling the input image to the network input size and performing normalization and other operations. During the network training phase, YOLOv5 uses mosaic data augmentation to improve model training speed and network accuracy. It also integrates adaptive anchor box calculation and adaptive image scaling methods to implement random affine transformation and hybrid augmentation.
[0040] The backbone module adopts the BottleNeckCSP structure to extract rich feature information from the input image.
[0041] The neck module adopts a bottleneck CSP architecture, consisting of a Focus structure and three sets of CBL + CSP1_x and CBL2_x + SPP in series. CBL consists of convolution (Conv) followed by batch normalization (BN) and the activation function Leaky Relu, slicing the image and then merging it. CSP1_x consists of a CBL module, a Res unit module, and a convolutional layer (Concat), where x represents the number of CSP1 modules. CSP2_x consists of a convolutional layer followed by a CBL module. SPP uses 1×1, 5×1, 9×9, and 13×13 max pooling for multi-scale fusion.
[0042] The head module includes a residual unit. After the input passes through two CBLs, it is added to the original input, allowing the network to extract deeper features while avoiding gradient vanishing or gradient explosion. The upsampling unit expands the size of the feature map by using element-by-element replication expansion methods such as linear interpolation. The head module also includes a Concat unit for splicing tensors, expanding the dimensions of two tensors to achieve multi-scale feature fusion.
[0043] The improved YOLOv5 network structure proposed in this application can randomly scale images within a certain range during training, and optimizes the previous anchor boxes to match the statistical characteristics of the real boxes in the custom data. In addition, warm-up and cosine learning rate schedulers and hyperparameter evolution are introduced to adjust the learning rate and hyperparameters to enhance performance. By integrating a variety of new features, enhancements and training strategies, it surpasses the earlier versions of the YOLO series in performance and efficiency. The main enhancements of YOLOv5 include the use of dynamic architecture, extensive data augmentation techniques, innovative training strategies, and key adjustments in calculating losses and constructing targets, which significantly improve the accuracy and efficiency of target detection while retaining the iconic high speed characteristics of the YOLO model.
[0044] Step 120: Collect a large number of damaged solar panel images to form a solar panel damage image dataset;
[0045] Because photovoltaic solar panels are so important, even minor defects can affect power generation. However, these defects are relatively difficult to observe and require specialized tools for detection and troubleshooting. Therefore, this application used a solar panel observation instrument consisting of an EL detector to collect a dataset. A total of 1,500 photos of solar panels were collected to form the dataset. The dataset was divided into training, validation, and test sets, and contained two defect detection labels: cracks and black spots.
[0046] Step 130: Input the solar panel damage image dataset into the YOLOv5 network structure;
[0047] Step 140: extract features from the solar panel damage image dataset using a distributed shift convolution block, and add the extracted features to the original input image set;
[0048] This paper replaces the second convolutional block with DSConv to eliminate redundant feature maps. This design reduces computational effort by eliminating the need for convolution operations on redundant features. The lack of redundant features also reduces model size. DSConv offers decisive visual advantages across the board, enabling adaptive perception of key system features while significantly improving accuracy.
[0049] The overall goal of the DSConv layer is to emulate the behavior of a convolutional layer by using quantization and distribution offset. Assume that the size of the original convolution tensor is (cho, chi, k, k), where cho is the number of channels of the next layer, chi is the number of channels of the current layer, and k is the width and height of the kernel.
[0050] DSConv is divided into two distinct parts:
[0051] Variable Quantized Kernel (VQK): This tensor stores only integer values with variable bit lengths. Its size is the same as the original convolution tensor (cho, chi, k, k). The parameter values are quantized from the original floating-point model and cannot be changed once determined. This is the quantization part of DSConv, which can achieve faster multiplication operations and improve the storage efficiency of multiplication operations. The shifter is used to adjust the BLK depth value of VQK (variable quantized kernel). The size of this tensor is 2 (cho, CEIL(chi), k, k), where CEIL(x) is a rounding operator and stores single-precision values.
[0052] Distribution Shift: The purpose of this component is to change the distribution of VQK to mimic the distribution of the original convolution kernel.
[0053] This is achieved by using two tensors to shift (scale and bias) between the two domains. The tensor is the channel distribution shifter (CDS), which is used to adjust the distribution in each channel, that is, to change the distribution of each (1, x, k, k) slice.
[0054] The initialization of the values of each component of DSConv and the establishment of an optimized and easy-to-implement reasoning process specifically include:
[0055] The quantization function takes as input the number of bits of the network to be quantized and stores it using a signed integer representation with 2's complement. In general, for a number of bits \(b\), wq∈Zj—2b—1≤wq≤2b—1—1, where wq represents the decimal value of each parameter. This is achieved by first adjusting the weights of each convolutional layer so that the maximum absolute value of the original weight w matches the maximum value of the above quantization constraints. After this step is completed, all weights are quantized to the nearest integer. The new weights wq are then stored in memory as integer values for subsequent training and inference.
[0056] The purpose of the distribution shift is to adjust the value of VQK so that the output matches the value of the original weight tensor. This is achieved by the distribution shift in the kernel (KDS) and the distribution shift in the channel (CDS). The distribution shift in the kernel is represented by the scaling factors letters ξ and bias ξ, and the distribution shift in the channel is represented by and Both require a good initialization so that the network is close to the optimum and only needs fine-tuning before reaching maximum accuracy.
[0057] There are two ways to calculate the initial value of the tensor: (i) minimize the KL divergence, which aims to find the minimum information loss between the original weight distribution and the kernel distribution transformer; (ii) minimize the L2 norm (Euclidean distance), which is interpreted as the parameters should be as close as possible to the optimal value of the original network. By minimizing the KL divergence, the VQK transformed by the kernel distribution transformer should have a distribution similar to the original weights.
[0058] (i) The quantization process uses only the scaling factor to evaluate the integer value of VQK, assuming that ξsis is initially zero, and operates by taking the softmax of the transformed VQK and the original distribution:
[0059]
[0060] Then, we minimize the KL divergence loss and use gradient descent to minimize the loss function, which generates the value of each parameter in decimal ξ.
[0061] (ii) The method for determining the value of ξis to minimize the L2 norm is that after element-wise multiplication, the value of the core shifter tensorξ is as close as possible to the original value. Mathematically expressed as:
[0062]
[0063] The value of ξhat that produces the smallest deviation from the original local minimum is the value that minimizes the L2 norm (Euclidean distance). Therefore, to calculate the initial value of ξ, perform:
[0064]
[0065] Empirically, most of the ξ values returned by the two methods (KL divergence and norm) are identical to the third decimal place, indicating that the two interpretations of finding ξ are consistent.
[0066] This application first multiplies the input tensor by VQK instead of shifting VQK first. This means that most operations are calculated with integer values instead of floating-point values, which can achieve a 2 to 10 times speedup when using 8-bit operations, depending on the hardware used [13,7]. Using this sequence allows the hardware to take advantage of integer operations without using floating-point multiplications. Given a block size BLK, when chi is a multiple of BLK, this method will perform BLK fewer floating-point multiplications than the original convolution part. For example, for a block size of 128, simply changing the convolution layer to DSConv can significantly reduce the number of floating-point multiplications by two orders of magnitude. After all convolution operations in a given convolution kernel are completed, the channel distribution offset is subsequently applied.
[0067] To further improve memory and computational capacity, if the model includes a batch normalization layer after the convolution operator, the channel offset can be incorporated into the layer. If not included, the size of the batch offset is typically hundreds of times smaller than the convolution operator, and its memory and computational overhead is negligible relative to the structure size.
[0068] During training, the distribution shifter ξis is expanded to a tensor of the same size as the weight tensor ξ, resulting in the tensor R. Then, a Hadamard product is performed to obtain the effective resulting weights Wr. This also shows how the derivatives of each parameter are calculated during backpropagation. Derivatives in backpropagation can be calculated using the existing derivative operation:
[0069]
[0070] In the above equation, j is a single-entry sensor (1 at (I, j, k, l) and 0 elsewhere), and operator θ is the Hadamard product operator. As can be seen, with some modifications, DSConv can be easily implemented in any existing neural network framework.
[0071] Step 150: Introduce an attention mechanism to focus on key information of the input image set, extract deeper features, and perform feature fusion on the extracted features;
[0072] The basic idea of the attention mechanism is to assign a weight to each part of the input data, which represents its importance to the current task. In natural language processing tasks, this usually means assigning a weight to each word in the input sentence; in computer vision tasks, it may mean assigning a weight to each pixel or region of the input image.
[0073] To improve accuracy while also accelerating detection speed and enhancing performance, a new attention mechanism, called CAA (Contextual Anchor Attention), was introduced. This mechanism is primarily used in natural language processing (NLP) tasks, particularly in areas such as machine translation, text summarization, and question-answering systems, where understanding the deeper meaning of sentences is crucial. The core idea behind this mechanism is to better capture the contextual relationships between words by assigning an "anchor" to each word in a sentence. Anchors can be set at specific words or phrases within a sentence and play a key role in understanding the semantics of the entire sentence. Using anchors, the model learns the contextual relationships between each word and its anchor, which helps it more accurately capture the meaning of the word. When processing a sentence, the model assigns different attention weights to each word based on the anchor, allowing the model to focus more on important words during prediction. The contextual anchor attention mechanism is an extension and deepening of the traditional attention mechanism. By introducing the concept of anchors, it enhances the model's ability to understand contextual information. In its implementation, it can be adjusted and optimized to meet different task requirements.
[0074] Step 160: Perform accuracy testing on the fused features to obtain fused solar panel damage features, input the solar panel damage features into a photovoltaic solar panel defect detection model, and output photovoltaic solar panel defect detection results.
[0075] In the embodiment of this application, in order to evaluate the improvement effect of YOLOv5s, the model is evaluated based on four indicators: average precision (AP), mean average precision (mAP), precision (P), and recall (R). The confusion matrix is a summary of the prediction results of the classification problem. It uses count values to summarize the number of correct and incorrect predictions and is broken down according to each category to show the parts that the classification model may be confused about when predicting. Through this matrix, it is easy to see whether the machine confuses two different categories or mistakes one category for another.
[0076] In order to demonstrate the effectiveness of the proposed improved model, an ablation experiment was conducted on each module based on YOLOv5. First, the second convolution in the residual module was replaced with an efficient multi-scale convolution module. Then, scale-aware attention, spatial-aware attention, and task-aware attention were introduced to the detection head in the dynamic head. yolov5s-CAA-DSConv was compared with YOLOv5s and evaluated using evaluation metrics. From the experimental results, it can be seen that the detection accuracy of yolov5s-CAA-DSConv is significantly improved compared to YOLOv5s. In short, the yolov5s-CAA-DSConv network not only reduces the amount of computation, but also has more accurate detection capabilities, which can meet the requirements of photovoltaic solar panel defect detection tasks.
[0077] Corresponding to the above embodiment, an embodiment of the present invention provides a computer storage medium, comprising: at least one memory and at least one processor;
[0078] The memory is used to store one or more program instructions;
[0079] A processor is configured to run one or more program instructions to execute a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5.
[0080] Corresponding to the above embodiment, an embodiment of the present invention provides a computer-readable storage medium, which contains one or more program instructions, and the one or more program instructions are used by a processor to execute a method for detecting defects in photovoltaic solar panels based on an improved YOLOv5.
[0081] The embodiments disclosed in the present invention provide a computer-readable storage medium having computer program instructions stored therein. When the computer program instructions are executed on a computer, the computer is caused to execute the above-mentioned method for detecting defects in photovoltaic solar panels based on the improved YOLOv5.
[0082] In the embodiments of the present invention, the processor may be an integrated circuit chip having signal processing capabilities. The processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0083] The methods, steps, and logic diagrams disclosed in the embodiments of the present invention can be implemented or executed. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software modules can be located in a storage medium well-established in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. The processor reads the information from the storage medium and, in conjunction with its hardware, completes the steps of the aforementioned methods.
[0084] The storage medium may be a memory and may be, for example, a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memory.
[0085] Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
[0086] Volatile memory may be random access memory (RAM), which is used as an external cache memory. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM).
[0087] The storage media described in the embodiments of the present invention are intended to include, but are not limited to, these and any other suitable types of memory.
[0088] Those skilled in the art will appreciate that in one or more of the above examples, the functions described herein can be implemented using a combination of hardware and software. When software is used, the corresponding functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media includes any medium that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0089] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for detecting defects in photovoltaic solar panels based on improved YOLOv5, characterized in that: include: Build the YOLOv5 network structure; Collect a large number of damaged solar panel images to form a solar panel damage image dataset; Input the solar panel damage image dataset into the YOLOv5 network structure; The distributed shift convolution block is used to extract features from the solar panel damage image dataset and the extracted features are added to the original input image set. Introducing the attention mechanism to focus on the key information of the input image set, extracting deeper features, and performing feature fusion on the extracted features; Perform accuracy testing on the fused features to obtain the fused solar panel damage features; The solar panel damage characteristics are input into the photovoltaic solar panel defect detection model, and the photovoltaic solar panel defect detection results are output.
2. The method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to claim 1, wherein: The YOLOv5 network structure includes an input module, a backbone module, a neck module, and a head module; the input module is used for input image preprocessing; the backbone module is used for image feature extraction; and the neck module is used for image feature fusion. The header module is used to detect information output.
3. The method for detecting defects of photovoltaic solar panels based on improved YOLOv5 according to claim 1, characterized in that: A solar panel observation device consisting of an EL detector is used to collect image datasets. The dataset is divided into training set, validation set, and test set, and contains two defect detection labels: cracks and black spots.
4. The method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to claim 3, characterized in that: Feature extraction of solar panel damage image dataset is performed through distributed shift convolution blocks, specifically including: using DSConv to replace the second convolution block in the original network structure, and simulating the behavior of the convolution layer by using quantization and distribution shift to eliminate redundant feature maps.
5. The method for detecting defects of photovoltaic solar panels based on improved YOLOv5 according to claim 4, characterized in that: DSConv is divided into two different parts: variable quantized kernel and distribution shift; the variable quantized kernel tensor only stores integer values with variable bit length, which is the same size as the original convolution tensor, and the parameter values are quantized from the original floating-point model; the distribution shift component is used to change the variable quantized kernel to simulate the distribution of the original convolution kernel.
6. The method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to claim 5, characterized in that: The initialization of the values of each component of DSConv is specifically to minimize the KL divergence, which aims to find the minimum information loss between the original weight distribution and the kernel distribution transformer; or to minimize the L2 norm, so that the parameters should be as close as possible to the optimal value of the original network.
7. The method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to claim 6, characterized in that: The scaling factor is used to evaluate the integer value of VQK, the input tensor is multiplied by VQK, and the channel distribution offset is applied after all convolution operations in a given convolution kernel are completed.
8. The method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to claim 1, wherein: The attention mechanism is introduced to focus on the key information of the input image set. Specifically, a weight is assigned to each part of the input data, that is, a weight is assigned to each pixel or area of the input image. This weight represents the importance of the part to the current task.
9. The method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to claim 1, wherein: Calculate the average precision, mean average precision, precision, and recall of the model to determine the improvement effect of YOLOv5s.
10. A computer storage medium, characterized in that include: at least one memory and at least one processor; The memory is used to store one or more program instructions; A processor, configured to run one or more program instructions to execute the method for detecting defects in photovoltaic solar panels based on improved YOLOv5 according to any one of claims 1 to 9.