YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion
By introducing a feature map cross-calculation model in the YOLOv5 model, the problem of insufficient detection capabilities of small targets in hot spot detection in photovoltaic modules is solved, and higher detection accuracy and applicability are achieved, while controlling the computational complexity.
Patent Information
- Application Number
- CN202411826018.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-12-12
AI Technical Summary
The existing deep learning-based hot spot detection methods for photovoltaic modules have problems such as insufficient small object detection capabilities, limited feature integration effect, and high computational complexity.
The hot spot detection method of YOLOv5 photovoltaic module based on feature map cross-fusion is adopted. By acquiring the infrared image of the drone and building a data set, a feature map cross-calculation model is constructed, and the feature map cross-calculation model is introduced into the YOLOv5 model to realize the guiding learning of shallow features to deep features.
The accuracy and applicability of hot spot detection of photovoltaic modules is improved, especially in detecting small target hot spot defects, which reduces the leakage detection rate and improves the detection accuracy, while controlling the calculation complexity.
Smart Images

Figure CN119991549A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic module hot spot detection, and in particular to a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion. Background Art
[0002] Photovoltaic power generation converts solar energy into electricity, reduces dependence on traditional fossil energy, provides sustainable energy supply for human beings, helps alleviate energy crisis and ensure national energy security. However, in the process of receiving solar energy and converting it into electricity, photovoltaic modules are easily blocked by objects such as leaves, dust, bird droppings, or produce hot spot effects due to defects in the cell and poor connection. This will cause the local temperature of the photovoltaic module to rise, affecting the overall power generation efficiency. Therefore, inspection of photovoltaic modules is very important.
[0003] At present, infrared thermal imaging technology combined with deep learning algorithms is widely used in hot spot detection of photovoltaic modules. The following are several photovoltaic module hot spot detection methods based on deep learning: Invention patent CN 114037918B introduces a photovoltaic hot spot detection method based on drone inspection and image processing, which directly calls the YOLOv5 target detection algorithm for hot spot detection, but does not improve the model for hot spot characteristics. Invention patent CN 114973032 B provides a photovoltaic panel hot spot detection method and device based on a deep convolutional neural network. By replacing the YOLOv4 feature extraction network, it can quickly identify photovoltaic panels in aerial infrared images, and introduce the MobileNetV2 network into the DeeplabV3+ model for hot spot segmentation. Invention patent CN 117315350 B proposes a photovoltaic solar panel hot spot detection method and device based on drones. By segmenting the drone photovoltaic module image, performing distance transformation based on the segmentation result, the pixel mean of the battery area corresponding to the center of each battery cell is determined, and the abnormal battery area is determined from it. Invention patent CN 118644447 A proposes a photovoltaic panel hot spot detection method based on an improved YOLOv8 model. The Visual RetNet architecture is used to replace the C2f module feature extraction backbone network of the backbone network in YOLOv8, and the Retention self-attention mechanism ReSA based on distance-related spatial prior knowledge is introduced into the Visual RetNet network to reduce computational complexity.
[0004] Most of the existing methods for detecting hot spots in photovoltaic modules improve the model in the direction of enhancing feature extraction. However, in actual applications, the area of early hot spots is small and accounts for a small proportion of the images collected by drones. The existing deep learning model has insufficient feature representation information extraction due to multiple downsampling operations, and the detection ability of small targets is weak, which is prone to missed detection. Therefore, the existing problem is how to use the rich shallow features extracted by the neural network at the shallow level to guide the learning of deep features, so that the deep features also have the shallow information of small targets. Summary of the invention
[0005] In view of the above-mentioned problems, the present invention is proposed.
[0006] Therefore, the technical problem solved by the present invention is that the existing photovoltaic module hot spot detection method based on deep learning has insufficient small target detection capability, limited feature integration effect, and how to reduce the high computational complexity.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion, comprising acquiring a drone infrared image of a photovoltaic module and constructing a data set. Constructing a feature map cross calculation model. Introducing the feature map cross calculation model into the YOLOv5 model.
[0008] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in the present invention, wherein: the acquisition of drone infrared images of photovoltaic modules and the construction of data sets include using a drone equipped with a dual-light camera to patrol the photovoltaic modules and acquire drone infrared images of the photovoltaic modules.
[0009] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in the present invention, wherein: the acquisition of drone infrared images of photovoltaic modules and the construction of data sets also include data annotation of the acquired infrared images of photovoltaic modules, and the images containing hot spot defects are divided into training set and verification set in a ratio of 8:2, and normal samples accounting for about 10% of the total data set are added to the training set as background images.
[0010] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in the present invention, wherein: the construction of the feature map cross calculation model includes obtaining the cross attention tensors x1' and x2' between the feature maps by Cross-Computation cross calculation of the feature maps x1 and x2.
[0011] Concatenate tensors x1' and x2' in the channel dimension to obtain tensor x' with dimension (W×H,B,2C).
[0012] Among them, B represents the number of input images, C represents the number of channels of the feature map extracted from each image, and W and H represent the width and height of the feature map respectively.
[0013] Perform Layer Norm normalization on tensor x' to obtain tensor x LN1 .
[0014] The tensors x' and x LN1 Perform Addition residual connection to obtain tensor x Add1 .
[0015] Tensor x Add1 Get the tensor x through the FFN feedforward neural network FFN .
[0016] For the tensor x FFN Perform Layer Norm layer normalization operation to obtain tensor x LN2 .
[0017] The tensor x LN2 and x Add1 Perform Addition residual connection to obtain tensor x Add2 .
[0018] For the tensor x Add2 Perform dimension transformation to obtain the feature map x, the dimension is (B, 2C, W, H).
[0019] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in the present invention, wherein: the feature maps x1 and x2 are cross-computed to obtain the cross-attention tensors x1' and x2' between the feature maps, including flattening the dimensions (B, C, W, H) of the feature map tensors x1 and x2 to (B, C, W×H) in the channel dimension, and swapping the dimensions to generate tensors T1 and T2 of dimensions (W×H, B, C).
[0020] The corresponding position codes PE(·) are embedded into the tensors T1 and T2 respectively, and the corresponding tensors T1' and T2' are generated as follows:
[0021] T1'=T1+PE(T1)=T1+(W1 Pos T1+b1 Pos )
[0022] T2'=T2+PE(T2)=T2+(W2 Pos T2+b2 Pos )
[0023] Among them, W1Pos and W2 Pos represents the weight term, b1 Pos and b1 Pos Represents bias terms, which are all learnable parameters.
[0024] Calculate the qkv tensors corresponding to tensors T1' and T2' respectively, expressed as:
[0025] q1=W1 Q T1'
[0026] k1=W1 K T1'
[0027] v1=W1 V T1'
[0028] q2=W2 Q T2'
[0029] k2=W2 K T2'
[0030] v2=W2 V T2'
[0031] Among them, W i Q ,W i K ,W i V ,i=1,2 represents the weight item.
[0032] The cosine similarity between tensor q1 and tensor k2 and the cosine similarity between tensor q2 and tensor k1 are calculated respectively, expressed as:
[0033]
[0034] Among them, τ1 and τ2 are both learnable scalars, b 1,2 and b 2,1 is the learnable bias parameter.
[0035] Calculate the cross attention score of tensor q1 and tensor k2, v2 to get tensor x1'. Calculate the cross attention score of tensor q2 and tensor k1, v1 to get tensor x2', expressed as:
[0036] x1'=Attention(q1,k2,v2)=SoftMax(Sim(q1,k2))v2
[0037] x2'=Attention(q2,k1,v1)=SoftMax(Sim(q2,k1))v1.
[0038] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in the present invention, wherein: the construction of the feature map cross calculation model also includes for the tensor x' with a dimension of (W×H, B, 2C), there are a total of B samples, there are 2C channels, for each sample j, calculate the mean μj on each channel c c and variance σj c , expressed as:
[0039]
[0040] Normalize each channel of each sample:
[0041]
[0042] Among them, δ represents a small positive number, γ c and β c They represent the weight term and bias term of each sample j in channel c among B samples respectively.
[0043] For tensors x' and x of the same dimension LN1 , add the values in the corresponding dimensions, expressed as:
[0044] x Add1 =x'+x LN1
[0045] The feedforward neural network consists of two consecutive linear layers, that is, after two consecutive linear transformations, expressed as:
[0046]
[0047] Among them, W1 FFN and represents the weight term, and Represents the bias term.
[0048] The tensor x Add2 The dimensional representation (W×H, B, 2C) is converted to the dimensional representation (B, C, W, H) of the input feature map, and the tensor x Add2 The dimension of is exchanged to (B, 2C, W×H), and the third dimension W×H is folded to (W, H), finally forming a feature map x with the dimension of (B, 2C, W, H).
[0049] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in the present invention, the feature map cross calculation model is introduced into the YOLOv5 model and included in the Neck feature fusion network, all Concate modules are replaced with feature map cross calculation modules Cross Computation Module, and the shallow feature map output by the backbone network is cross-calculated with the current deep feature map to obtain shallow feature semantic information.
[0050] An improved YOLOv5 hot spot detection model is obtained, and the improved YOLOv5 hot spot detection model is trained and output using the divided training set and validation set. The trained hot spot detection model is called to perform hot spot detection on the image to be detected, and the hot spot detection result is output.
[0051] Another object of the present invention is to provide a YOLOv5 photovoltaic module hot spot detection system based on cross-fusion of feature maps, which can realize feature fusion between feature maps by cross-calculating shallow features and deep features extracted at different stages of the backbone network, thereby obtaining richer feature semantic information, and solving the problem that the current photovoltaic module hot spot detection method based on deep learning has insufficient small target detection capability.
[0052] As a preferred solution of the YOLOv5 photovoltaic module hot spot detection system based on feature map cross fusion described in the present invention, it includes: a data acquisition module, a model construction module, and a model fusion module. The data acquisition module is used to obtain the drone infrared image of the photovoltaic module and construct a data set. The model construction module is used to construct a feature map cross calculation model. The model fusion module is used to introduce the feature map cross calculation model into the YOLOv5 model.
[0053] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a step of a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion.
[0054] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion.
[0055] Beneficial effects of the present invention: The YOLOv5 photovoltaic module hot spot detection method based on cross-fusion of feature maps provided by the present invention can effectively identify hot spot defects of photovoltaic modules. In order to make up for the lost rich shallow features when extracting deep features of the location of small target hot spot defects, the present invention cross-calculates the shallow features extracted at different stages of the backbone network with the deep features to achieve feature fusion between feature maps, thereby obtaining richer feature semantic information. This enables the location of hot spot defects to be detected more accurately and comprehensively, and is particularly suitable for detecting many small target hot spot defects in photovoltaic modules. The present invention achieves better results in terms of accuracy and applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0057] Figure 1 An overall flow chart of a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion provided in the first embodiment of the present invention.
[0058] Figure 2 A calculation flow chart of a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion provided in the first embodiment of the present invention.
[0059] Figure 3 An updated YOLOv5 model framework diagram of a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion provided in the first embodiment of the present invention.
[0060] Figure 4 An original YOLOv5 model framework diagram of a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion provided in the first embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0062] Example 1, reference Figure 1-Figure 4, is an embodiment of the present invention, and provides a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion, including:
[0063] S1: Acquire UAV infrared images of photovoltaic modules and construct datasets.
[0064] Furthermore, drones equipped with dual-light cameras are used to inspect photovoltaic modules from high altitudes at different viewing angles and shooting distances to obtain drone infrared images of photovoltaic modules.
[0065] It should be noted that the acquired infrared images of photovoltaic modules were screened and data annotated, and the images containing hot spot defects were divided into training set and verification set in a ratio of 8:2. At the same time, normal samples accounting for about 10% of the total data set were added to the training set as background images.
[0066] S2: Construct a feature graph cross-calculation model.
[0067] Furthermore, Figure 2 The figure shows the feature map cross-computation process. Constructing the feature map cross-computation model includes obtaining the cross-attention tensors x1' and x2' between the feature maps through Cross-Computation cross-computation of the feature maps x1 and x2.
[0068] Concatenate tensors x1' and x2' in the channel dimension to obtain tensor x' with dimension (W×H,B,2C).
[0069] Among them, B represents the number of input images, C represents the number of channels of the feature map extracted from each image, and W and H represent the width and height of the feature map respectively.
[0070] Perform Layer Norm normalization on tensor x' to obtain tensor x LN1 .
[0071] The tensors x' and x LN1 Perform Addition residual connection to obtain tensor x Add1 .
[0072] Tensor x Add1 Get the tensor x through the FFN feedforward neural network FFN .
[0073] For the tensor x FFN Perform Layer Norm layer normalization operation to obtain tensor x LN2 .
[0074] The tensor x LN2 and x Add1 Perform Addition residual connection to obtain tensor xAdd2 .
[0075] For the tensor x Add2 Perform dimension transformation to obtain the feature map x, the dimension is (B, 2C, W, H).
[0076] It should be noted that the feature maps x1 and x2 are obtained by Cross-Computation to obtain the cross-attention tensors x1' and x2' between the feature maps, including flattening the dimensions (B, C, W, H) of the feature map tensors x1 and x2 to (B, C, W×H) in the channel dimension, and swapping the dimensions to generate tensors T1 and T2 of dimensions (W×H, B, C).
[0077] The corresponding position codes PE(·) are embedded into the tensors T1 and T2 respectively, and the corresponding tensors T1' and T2' are generated as follows:
[0078] T1'=T1+PE(T1)=T1+(W1 Pos T1+b1 Pos )
[0079] T2'=T2+PE(T2)=T2+(W2 Pos T2+b2 Pos )
[0080] Among them, W1 Pos and W2 Pos represents the weight term, b1 Pos and b1 Pos Represents bias terms, which are all learnable parameters.
[0081] Calculate the qkv tensors corresponding to tensors T1' and T2' respectively, expressed as:
[0082] q1=W1 Q T1'
[0083] k1=W1 K T1'
[0084] v1=W1 V T1'
[0085] q2=W2 Q T2'
[0086] k2=W2 K T2'
[0087] v2=W2 V T2'
[0088] Among them, W i Q ,W i K ,Wi V ,i=1,2 represents the weight item.
[0089] The cosine similarity between tensor q1 and tensor k2 and the cosine similarity between tensor q2 and tensor k1 are calculated respectively, expressed as:
[0090]
[0091] Among them, τ1 and τ2 are both learnable scalars, b 1,2 and b 2,1 is the learnable bias parameter.
[0092] Calculate the cross attention score of tensor q1 and tensor k2, v2 to get tensor x1'. Calculate the cross attention score of tensor q2 and tensor k1, v1 to get tensor x2', expressed as:
[0093] x1'=Attention(q1,k2,v2)=SoftMax(Sim(q1,k2))v2
[0094] x2'=Attention(q2,k1,v1)=SoftMax(Sim(q2,k1))v1.
[0095] It should also be noted that constructing the feature map cross-calculation model also includes calculating the mean μj on each channel c for a tensor x' of dimension (W×H,B,2C), with a total of B samples and 2C channels for each sample j c and variance σj c , expressed as:
[0096]
[0097] Normalize each channel of each sample:
[0098]
[0099] Among them, δ represents a small positive number, γ c and β c They represent the weight term and bias term of each sample j in channel c among B samples respectively.
[0100] For tensors x' and x of the same dimension LN1 , add the values in the corresponding dimensions, expressed as:
[0101] x Add1 =x'+x LN1
[0102] The feedforward neural network consists of two consecutive linear layers, that is, after two consecutive linear transformations, expressed as:
[0103]
[0104] Among them, W1 FFN and represents the weight term, and Represents the bias term.
[0105] The tensor x Add2 The dimensional representation (W×H, B, 2C) is converted to the dimensional representation (B, C, W, H) of the input feature map, and the tensor x Add2 The dimension of is exchanged to (B, 2C, W×H), and the third dimension W×H is folded to (W, H), finally forming a feature map x with the dimension of (B, 2C, W, H).
[0106] S3: Introduce the feature map cross-calculation model into the YOLOv5 model.
[0107] Furthermore, the feature map cross-computation model is introduced into the YOLOv5 model and wrapped in the Neck feature fusion network. All Concate modules are replaced with feature map cross-computation modules. The shallow feature map output by the backbone network is cross-calculated with the current deep feature map to obtain shallow feature semantic information.
[0108] Obtain an improved YOLOv5 hot spot detection model, use the divided training set and validation set to train and output the improved YOLOv5 hot spot detection model, call the trained hot spot detection model to perform hot spot detection on the image to be detected, and output the hot spot detection result. Figure 3 Shown is the updated YOLOv5 model framework diagram.
[0109] It should be noted that, compared Figure 4 In the original YOLOv5 model framework, in the Neck feature fusion network, all Concate modules are replaced with feature map cross computation modules (CCM), and the shallow feature map output by the backbone network is cross-calculated with the current deep feature map to obtain richer shallow feature semantic information of small targets.
[0110] Example 2, an embodiment of the present invention, provides a YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0111] First, a drone equipped with a dual-light camera was used to patrol the photovoltaic modules at multiple angles and heights in the photovoltaic power station scene to collect infrared images. After the image acquisition was completed, the data was filtered based on the scene information, the noise data and blurred images were removed, and the hot spot defect locations were manually marked. Finally, the data set was constructed, with a ratio of 8:2 between hot spot defect images and normal images. At the same time, about 10% of normal samples were added to the training set as background images to improve the model's ability to distinguish small targets.
[0112] A feature map cross-computation model (CCM) is constructed to fuse shallow and deep features through a cross-attention mechanism. Different channel features of the feature map are expanded and re-encoded, and the cross-attention score is calculated through cosine similarity to achieve information complementarity between features. Layer normalization and residual connection techniques are used to further optimize feature expression.
[0113] The CCM module is embedded in the Neck feature fusion network of YOLOv5, and the Concate module is replaced by the CCM module, so that the small target information in the shallow features can be more effectively transferred to the deep features. On this basis, the model is trained using the above-constructed dataset. The model training parameters include learning rate 0.01, batch size 16, and training iteration rounds 100 times.
[0114] The hotspot detection performance of the improved model is evaluated using the test set and compared with the original YOLOv5 model. The evaluation metrics include mean average precision (mAP), missed detection rate, and computational efficiency.
[0115] Table 1 Experimental data comparison table
[0116]
[0117] The improved YOLOv5 model achieved 93.2% mean average precision (mAP), which is 7.8 percentage points higher than the 85.4% of the original YOLOv5 model. This shows that by introducing the feature map cross-calculation module, the model can more efficiently integrate shallow and deep feature information, especially in complex scenes.
[0118] In terms of missed detection rate, the improved YOLOv5 model dropped from 12.8% of the original model to 5.1%. This improvement is attributed to the fact that the feature map cross-calculation module effectively enhances the model's ability to detect small target hot spots, thereby reducing the risk of missed detection.
[0119] In terms of small target detection accuracy, the improved model reached 90.5%, which is a significant improvement over the 78.6% of the original model. This shows that the full utilization of shallow features and the cross-calculation mechanism effectively solve the problem of insufficient small target recognition ability of existing methods.
[0120] The detection speed of the improved YOLOv5 model is maintained at 42 frames per second, which is slightly lower than the 45 frames per second of the original model, but still meets the real-time requirements of practical applications. At the same time, although the number of model parameters and computing resources occupied have increased, the increase is within a reasonable range and does not constitute a bottleneck for actual use.
[0121] Embodiment 3, an embodiment of the present invention provides a YOLOv5 photovoltaic module hot spot detection system based on feature map cross fusion, including a data acquisition module, a model building module, and a model fusion module.
[0122] The data acquisition module is used to obtain the UAV infrared images of photovoltaic modules and construct the data set. The model construction module is used to build the feature map cross calculation model. The model fusion module is used to introduce the feature map cross calculation model into the YOLOv5 model.
[0123] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0124] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0125] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0126] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc. It should be noted that the above embodiments are only used to illustrate the technical solution of the present invention and are not limited. Although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
[0127] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion, characterized in that: include: Acquire UAV infrared images of photovoltaic modules and construct datasets; Construct a feature graph cross-calculation model; The feature map cross-calculation model is introduced into the YOLOv5 model.
2. The YOLOv5 photovoltaic module hot spot detection method based on feature graph cross fusion as claimed in claim 1, characterized in that: The method of obtaining the UAV infrared image of the photovoltaic module and constructing the data set includes using a UAV equipped with a dual-light camera to patrol the photovoltaic module and obtain the UAV infrared image of the photovoltaic module.
3. The YOLOv5 photovoltaic module hot spot detection method based on feature graph cross fusion as claimed in claim 2, characterized in that: The method of acquiring drone infrared images of photovoltaic modules and constructing a data set also includes data annotation of the acquired infrared images of photovoltaic modules, and dividing the images containing hot spot defects into a training set and a validation set in a ratio of 8:2, and adding normal samples accounting for approximately 10% of the total data set as background images to the training set.
4. The YOLOv5 photovoltaic module hot spot detection method based on feature graph cross fusion as claimed in claim 3 is characterized in that: The constructing of the feature graph cross-computation model includes obtaining cross-attention tensors x1' and x2' between the feature graphs by cross-computation of the feature graphs x1 and x2; Concatenate tensors x1' and x2' in the channel dimension to obtain tensor x' with dimension (W×H,B,2C); Where B represents the number of input images, C represents the number of channels of the feature map extracted from each image, and W and H represent the width and height of the feature map respectively; Perform Layer Norm normalization on tensor x' to obtain tensor x LN1 ; The tensors x' and x LN1 Perform Addition residual connection to obtain tensor x Add1 ; Tensor x Add1 Get the tensor x through the FFN feedforward neural network FFN ; For the tensor x FFN Perform Layer Norm layer normalization operation to obtain tensor x LN2 ; The tensor x LN2 and x Add1 Perform Addition residual connection to obtain tensor x Add2 ; For the tensor x Add2 Perform dimension transformation to obtain the feature map x, the dimension is (B, 2C, W, H).
5. The YOLOv5 photovoltaic module hot spot detection method based on feature graph cross fusion as claimed in claim 4, characterized in that: The feature maps x1 and x2 are cross-computed to obtain cross-attention tensors x1' and x2' between the feature maps, including flattening the dimensions (B, C, W, H) of the feature map tensors x1 and x2 to (B, C, W×H) in the channel dimension, and swapping the dimensions to generate tensors T1 and T2 of dimensions (W×H, B, C); The corresponding position codes PE(·) are embedded into the tensors T1 and T2 respectively, and the corresponding tensors T1' and T2' are generated as follows: T1'=T1+PE(T1)=T1+(W1 Pos T1+b1 Pos ) <h2 style=";text-align:left;direction:ltr">T2' = T2 + PE (T2) = T2 + (W2<h2 style=";text-align:left;direction:ltr"> Pos <h2 style=";text-align:left;direction:ltr"> T2+b2<h2 style=";text-align:left;direction:ltr"> Pos <h2 style=";text-align:left;direction:ltr"> ) Among them, W1 Pos and W2 Pos represents the weight term, b1 Pos and b1 Pos Represents bias terms, which are all learnable parameters; Calculate the qkv tensors corresponding to tensors T1' and T2' respectively, expressed as: q1=W1 Q T1' k1=W1 K T1' v1=W1 V T1' <h2 style=";text-align:left;direction:ltr">q2=W2<h2 style=";text-align:left;direction:ltr"> Q <h2 style=";text-align:left;direction:ltr"> T2' k2=W2 K T2' <h2 style=";text-align:left;direction:ltr">v2=W2<h2 style=";text-align:left;direction:ltr"> V <h2 style=";text-align:left;direction:ltr"> T2' Among them, W i Q ,W i K ,W i V ,i=1,2 represents the weight item; The cosine similarity between tensor q1 and tensor k2 and the cosine similarity between tensor q2 and tensor k1 are calculated respectively, expressed as: Among them, τ1 and τ2 are both learnable scalars, b 1,2 and b 2,1 is a learnable bias parameter; Calculate the cross attention score of tensor q1 and tensor k2, v2 to get tensor x1'; calculate the cross attention score of tensor q2 and tensor k1, v1 to get tensor x2', expressed as: x1'=Attention(q1,k2,v2)=SoftMax(Sim(q1,k2))v2 x2'=Attention(q2,k1,v1)=SoftMax(Sim(q2,k1))v1.
6. The YOLOv5 photovoltaic module hot spot detection method based on feature graph cross fusion as claimed in claim 5, characterized in that: The constructing feature graph cross calculation model also includes calculating the mean μ on each channel c for a tensor x' with a dimension of (W×H, B, 2C), a total of B samples, and 2C channels for each sample j. jc and variance σ jc , expressed as: Normalize each channel of each sample: Among them, δ represents a small positive number, γ c and β c Represent the weight term and bias term of each sample j in B samples on channel c respectively; For tensors x' and x of the same dimension LN1 , add the values in the corresponding dimensions, expressed as: x Add1 =x'+x LN1 The feedforward neural network consists of two consecutive linear layers, that is, after two consecutive linear transformations, expressed as: x FFN =W2 FFN (W1 FFN x Add1 +b1 FFN )+b2 FFN Among them, W1 FFN and W2 FFN represents the weight term, b1 FFN and b2 FFN represents the bias term; The tensor x Add2 The dimensional representation (W×H, B, 2C) is converted to the dimensional representation (B, C, W, H) of the input feature map, and the tensor x Add2 The dimension of is exchanged to (B, 2C, W×H), and the third dimension W×H is folded to (W, H), finally forming a feature map x with the dimension of (B, 2C, W, H).
7. The YOLOv5 photovoltaic module hot spot detection method based on feature graph cross fusion as claimed in claim 6, characterized in that: The feature map cross calculation model is introduced into the YOLOv5 model and included in the Neck feature fusion network, all Concate modules are replaced with feature map cross calculation modules, and the shallow feature map output by the backbone network is cross-calculated with the current deep feature map to obtain shallow feature semantic information; An improved YOLOv5 hot spot detection model is obtained, and the improved YOLOv5 hot spot detection model is trained and output using the divided training set and validation set. The trained hot spot detection model is called to perform hot spot detection on the image to be detected, and the hot spot detection result is output.
8. A system using the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion as described in any one of claims 1 to 7, characterized in that: Including data acquisition module, model building module, model fusion module; The data acquisition module is used to obtain UAV infrared images of photovoltaic modules and construct a data set; The model building module is used to build a feature graph cross-calculation model; The model fusion module is used to introduce the feature map cross-calculation model into the YOLOv5 model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the YOLOv5 photovoltaic module hot spot detection method based on feature map cross fusion described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
A photovoltaic hot spot detection method based on drone inspection and image processing
CN114037918B
A method and device for detecting hot spots of photovoltaic panels based on deep convolutional neural network
CN114973032B
Hot spot detection method and device for photovoltaic solar panels based on drones
CN117315350B
Photovoltaic panel hot spot detection method based on improved YOLOv8 model
CN118644447A
Photovoltaic module hot spot defect detection method based on multi-scale feature map inference network
CN114283137A