Photovoltaic module defect image fusion method and system based on diffusion model

By using a diffusion model to learn and fuse features from infrared and visible light images of photovoltaic panels, the problem of lost visible light details in fused images in existing technologies is solved, thus improving the accuracy of photovoltaic panel defect detection.

CN120318100BActive Publication Date: 2026-08-04UNIV OF JINAN
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
UNIV OF JINAN
Filing Date
2025-03-31
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing methods for detecting defects in photovoltaic panels struggle to effectively fuse infrared and visible light images, resulting in the loss of texture details and color information from the visible light image in the fused image, thus affecting the accuracy of defect detection.

Method used

A diffusion model is used to learn and fuse features from infrared and visible light images of photovoltaic panels. The final fused image is generated by using an improved denoising diffusion probability model, spatial attention mechanism, and channel attention mechanism.

Benefits of technology

It improves the accuracy of photovoltaic panel defect detection, retains more visual information from visible light images, reduces the loss of feature information, and generates fused images with rich details and defect information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318100B_ABST
    Figure CN120318100B_ABST
Patent Text Reader

Abstract

The application discloses a photovoltaic module defect image fusion method and system based on a diffusion model, which comprises the following steps: obtaining corresponding binary images of photovoltaic panel regions according to infrared images and visible light images of the photovoltaic panel; merging the binary images of the photovoltaic panel regions with corresponding infrared images and visible light images, and inputting the merged images into a trained residual network to output feature images and extract the photovoltaic panel regions; performing diffusion training on the connected images through an improved denoising diffusion probability model to obtain a denoising network model; obtaining multi-channel diffusion feature maps by using the denoising network model, and obtaining spatial weighted feature maps and channel weighted feature maps by using a spatial attention mechanism and a channel attention mechanism respectively, and finally obtaining a fused image. The fused image obtained by the application not only has rich details, but also has defect information, and the accuracy of photovoltaic panel defect detection in a downstream task is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image fusion technology, and in particular to a method and system for image fusion of photovoltaic module defects based on a diffusion model. Background Technology

[0002] Solar energy, as a clean energy source, is gaining increasing popularity. With the continuous growth of the photovoltaic market, the value of photovoltaic module defect detection technology is becoming increasingly prominent, especially for photovoltaic panels. More and more researchers are dedicated to researching photovoltaic panel defect detection technology. In traditional photovoltaic panel defect detection methods, infrared images of the photovoltaic panel can capture its thermal radiation, but they are susceptible to noise and struggle to capture detailed defect information. Conversely, visible light images of the photovoltaic panel typically contain rich structural and defect texture information, but are easily affected by shading or reflections. The complementarity between these two methods makes it possible for the fused image to contain both thermal objects and defect texture details. Therefore, fusing infrared and visible light images of photovoltaic panels is one of the problems that needs to be solved in photovoltaic panel defect detection.

[0003] With the rapid development of deep learning technology, artificial intelligence technologies represented by deep learning have brought new possibilities for the fusion of infrared and visible light images of photovoltaic panels. By installing infrared and visible light cameras on drones and using image segmentation techniques, photovoltaic panels can be quickly segmented, and images from different light sources can be adjusted to the same angle through image preprocessing. However, fusion models based on convolutional neural networks or GANs may overemphasize the thermal radiation information of infrared images while neglecting the texture details and color information of visible light images. In downstream applications targeting photovoltaic panel defects, it's not just the thermal radiation information of infrared images that reflects defects; the texture details and color information in visible light images help identify surface features, providing richer information for image analysis. Furthermore, visible light images still contain defects such as reflection and occlusion. Therefore, overemphasizing the thermal radiation information of infrared images in fusion models based on convolutional neural networks or GANs reduces the practicality of the fused image. Moreover, existing photovoltaic image fusion methods struggle to focus on defects in infrared photovoltaic images, rather than balancing global thermal radiation and visible light information during the fusion process. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a method and system for fusing photovoltaic module defect images based on a diffusion model. This invention uses a diffusion model to learn the features of fine-tuned photovoltaic panel images, and then performs a fusion operation to complete the fusion of infrared and visible light images of the photovoltaic panel.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] In a first aspect, the present invention provides a photovoltaic module defect image fusion method based on a diffusion model, comprising:

[0007] Infrared and visible light images of the photovoltaic panel are acquired and preprocessed; based on the preprocessed infrared and visible light images, binary images of the corresponding photovoltaic panel regions are obtained respectively.

[0008] The binary image of the photovoltaic panel region is merged with the corresponding infrared and visible light images and input into the trained residual network to output a feature image. Based on the feature image, candidate regions of the photovoltaic panel are selected, and corresponding masks for the candidate regions are generated to extract the photovoltaic panel region.

[0009] The infrared and visible light images of the extracted photovoltaic panel area are concatenated. After concatenation, the improved denoising diffusion probability model is used for forward diffusion training and backward diffusion training to obtain the denoising network model.

[0010] The denoising network model is used to obtain a multi-channel diffusion feature map. Based on the multi-channel diffusion feature map, spatial attention mechanism and channel attention mechanism are used to obtain spatial weighted feature map and channel weighted feature map respectively. The final fused image is obtained according to the spatial weighted feature map and channel weighted feature map.

[0011] As a further technical solution, the feature image output by the trained residual network contains the texture features of the photovoltaic panel region; the feature image is forward propagated, and photovoltaic panel candidate regions with a probability greater than 0.7 are selected by non-maximum suppression method.

[0012] As a further technical solution, the features of all selected photovoltaic panel candidate regions are aligned to a fixed size, input into a trained masking network, and the corresponding mask of the photovoltaic panel candidate region is output. Then, it is combined with the corresponding infrared and visible light images to extract the photovoltaic panel region.

[0013] As a further technical solution, the forward diffusion training has T steps, in which a subset S{x} is selected from 1 to T. 1t ,x 2t ,...,x st Gradually add Gaussian noise until it approaches pure noise. The specific formula is as follows:

[0014] in, and These represent adding the xth [unit / item]. is The kth and the second is -1st order Gaussian noise, Z represents the standard normal distribution. Represented as control x is The variance of the Gaussian noise added is γ, where γ represents the Gaussian noise.

[0015] As a further technical solution, the reverse diffusion training is a process of denoising the noise added during the forward diffusion training process, and the specific formula is as follows:

[0016] ; ; =1- ;

[0017]

[0018] Where, ε θ Let σ represent a noise prediction network. variance express The mean.

[0019] As a further technical solution, the infrared and visible light images of the photovoltaic panel are used to generate an attention map using a cross-attention mechanism, which is then used as a constraint condition in the backdiffusion training process. The specific formula is as follows: Q = I vis K = I ir V = I ir ;

[0020] As a further technical solution, the specific method for obtaining spatially weighted feature maps using a spatial attention mechanism is as follows: First, perform two parallel convolution operations on the input multi-channel diffusion feature map and add the two feature maps together; then, obtain the spatial attention weights by passing a sigmoid activation function; finally, combine the input multi-channel diffusion feature map with the spatial attention weights M. s Multiplying them yields a spatially weighted feature map;

[0021] The specific method for obtaining the channel-weighted feature map using the channel attention mechanism is as follows: First, the input multi-channel diffusion feature map is subjected to global average pooling and global max pooling to obtain two one-dimensional vectors respectively; then, these two vectors are concatenated, passed through a fully connected layer, then through the ReLU activation function, then through another fully connected layer, and finally through the sigmoid activation function to obtain the channel attention weights; the input multi-channel diffusion feature map is multiplied by the channel attention weights to obtain the channel-weighted feature map.

[0022] Secondly, the present invention provides a photovoltaic module defect image fusion system based on a diffusion model, comprising the following modules:

[0023] The image acquisition module is configured to: acquire infrared and visible light images of the photovoltaic panel and perform preprocessing; and obtain binary images of the corresponding photovoltaic panel regions based on the preprocessed infrared and visible light images.

[0024] The photovoltaic panel region extraction module is configured to: merge the binary image of the photovoltaic panel region with the corresponding infrared image and visible light image, input the merged image into the trained residual network, and output a feature image; filter out candidate photovoltaic panel regions based on the feature image, generate a corresponding mask for the candidate photovoltaic panel regions, and extract the photovoltaic panel region.

[0025] The diffusion training module is configured to: connect the infrared image and the visible light image after extracting the photovoltaic panel area, and then perform forward diffusion training and backward diffusion training through the improved denoising diffusion probability model to obtain the denoising network model.

[0026] The image fusion module is configured to: obtain a multi-channel diffusion feature map using the denoising network model; obtain a spatial weighted feature map and a channel weighted feature map based on the multi-channel diffusion feature map and using spatial attention mechanism and channel attention mechanism respectively; and obtain the final fused image based on the spatial weighted feature map and the channel weighted feature map.

[0027] One or more technical solutions of the present invention have the following beneficial effects:

[0028] 1. This invention performs diffusion training (forward diffusion training and backward diffusion training) on ​​the acquired infrared and visible light images of photovoltaic panels, enabling the model to learn as much visual information as possible from the visible light images, such as color and structural details. This compensates for the loss of too much visual information under visible light in existing technologies, while retaining more visual information from the infrared images.

[0029] 2. In the process of fusing feature maps, this invention is based on spatial attention and channel attention. The advantage of this is that it reduces the loss of feature information when fusing multi-scale feature maps. The final fused image obtained by this method not only has rich details but also contains defect information, which improves the accuracy of photovoltaic panel defect detection in downstream tasks.

[0030] 3. This invention uses a cross-attention mechanism to generate an attention map from the infrared and visible light images of the photovoltaic panel, which serves as a constraint in the backdiffusion training process. This allows attention to defective regions in the infrared image, learning more features from the infrared image in defective regions, and learning more features from the visible light image in non-defective regions. This enables the learned features to more realistically represent the information in the infrared and visible light images. Attached Figure Description

[0031] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0032] Figure 1 This is a flowchart illustrating the photovoltaic module defect image fusion method based on a diffusion model in Embodiment 1 of the present invention.

[0033] Figure 2 This is a schematic diagram of the framework of the photovoltaic module defect image fusion method based on the diffusion model in Embodiment 1 of the present invention;

[0034] Figure 3 This is a schematic diagram of the diffusion model training process in Embodiment 1 of the present invention;

[0035] Figure 4 This is a schematic diagram of the image fusion process using diffusion features in Embodiment 1 of the present invention. Detailed Implementation

[0036] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0037] Example 1

[0038] This embodiment provides a photovoltaic module defect image fusion method based on a diffusion model, such as... Figure 1 As shown, the specific method includes the following steps:

[0039] S1: Acquire infrared and visible light images of the photovoltaic panel and perform preprocessing; based on the preprocessed infrared and visible light images, obtain the corresponding binary images of the photovoltaic panel regions.

[0040] S2: Merge the binary image of the photovoltaic panel region with the corresponding infrared and visible light images, and input it into the trained residual network to output a feature image; filter out the photovoltaic panel candidate regions based on the feature image, generate the corresponding mask of the photovoltaic panel candidate regions, and extract the photovoltaic panel region;

[0041] S3: Connect the infrared image and the visible light image after extracting the photovoltaic panel area. After connecting, perform forward diffusion training and backward diffusion training through the improved denoising diffusion probability model to obtain the denoising network model.

[0042] S4: Use the denoising network model to obtain a multi-channel diffusion feature map. Based on the multi-channel diffusion feature map, use spatial attention mechanism and channel attention mechanism to obtain spatial weighted feature map and channel weighted feature map respectively. Obtain the final fused image based on the spatial weighted feature map and channel weighted feature map.

[0043] In step S1, infrared and visible light images of the photovoltaic panel at the same angle are acquired simultaneously by an infrared camera and a visible light camera, respectively. The preprocessing method involves applying a Gaussian filter to both the infrared and visible light images of the photovoltaic panel to enhance the edges and contours of objects in the images. The preprocessed infrared and visible light images are then input into a trained U-Net image segmentation model, and the output yields a binary image of the corresponding photovoltaic panel region.

[0044] In step S2, the binary image of the photovoltaic panel region is merged with the corresponding infrared and visible light images, and then input into a trained residual network, such as ResNet50, to extract multi-scale features. The conv2x function in ResNet50 is used to extract shallow features, enhance edge detection, and adapt to the rectangular boundary of the photovoltaic panel. The conv5x function in ResNet50 is used to extract deep features and capture the global context. Finally, a feature image containing the texture features of the photovoltaic panel region is output. This feature map is then input into a region proposal network, such as RPN, for forward propagation. RPN outputs candidate boxes and their probabilities of being photovoltaic panels, retaining the top 1000 candidate boxes by probability. Candidate regions of photovoltaic panels with a probability greater than 0.7 are selected by non-maximum suppression. The features of all candidate regions of photovoltaic panels are aligned to a fixed size by ROIAlign and input into a masking network. In this embodiment, the masking network is a fully convolutional neural network, including convolutional layers, batch normalization layers, activation functions, upsampling, and sigmoid activation functions. The masking network outputs the corresponding mask of the candidate regions of photovoltaic panels, which is then combined with the corresponding infrared and visible light images to extract the photovoltaic panel regions.

[0045] In step S3, as Figure 3 As shown, a 1-channel infrared image and a 3-channel visible light image are concatenated to form a 4-channel image, denoted by I. To address the issue of long training times due to the high pixel count of photovoltaic panel images, this embodiment improves the original DDPM algorithm (Denoising Diffusion Probability Model), calling it the Accelerated Denoising Diffusion Probability Model. The original DDPM algorithm has T steps in both the forward and backward processes, but the final result does not actually depend on the forward process. Therefore, to accelerate sampling, this embodiment replaces the T sampling steps in the original DDPM model with selecting a subset S{x} from 1 to T. 1t ,x 2t ,...,x stGradually add Gaussian noise until it approaches pure noise. The specific formula is as follows:

[0046]

[0047] in, and These represent adding the xth [unit / item]. is The xth and the second is -1st order Gaussian noise, Z represents the standard normal distribution. Represented as control x is The variance of the Gaussian noise added is γ, where γ represents the Gaussian noise.

[0048] Back-diffusion training is a process of denoising the noise introduced during forward diffusion training. The specific formula is as follows:

[0049] ; ; =1- ;

[0050]

[0051] Where, ε θ Let σ represent a noise prediction network. variance express The mean.

[0052] In this embodiment, in order to focus on defect areas in the infrared image and learn more infrared image features in the defect areas, and learn more visible light image features in the non-defect areas, the present invention uses the infrared image I of the photovoltaic panel. ir and visible light image I vis An attention map is generated using a cross-attention mechanism, serving as a constraint in the backdiffusion process. The formulas involved in this step are as follows:

[0053] Q = I vis K = I ir V = I ir ;

[0054]

[0055] Where Q, K, V represent Query, Key, and Value in the attention mechanism; CA iv This represents a cross-attention map.

[0056] In step S4, a multi-channel diffusion feature map is obtained using the denoising network model, and a multi-channel fusion module is used to fuse the multi-channel diffusion feature maps from multiple stages of the denoising network. Specifically, in this embodiment, the multi-channel diffusion feature maps from multiple stages of the denoising network are fused using spatial attention and channel attention mechanisms.

[0057] The spatial attention mechanism works as follows: First, two parallel convolution operations are performed on the input multi-channel diffuse feature map, and the two feature maps are summed; then, a sigmoid activation function is applied to obtain the spatial attention weights; finally, the input multi-channel diffuse feature map F and the spatial attention weights M are combined. s Multiplying them yields the spatially weighted feature map. The formula is as follows:

[0058] M s =σ(conv1(F)+conv2(F));

[0059] F′=F×M s ;

[0060] Where F represents the multi-channel diffusion feature map; M s represents spatial attention weights, and conv represents the convolution operation.

[0061] The channel attention mechanism works as follows: First, global average pooling and global max pooling are performed on the input multi-channel diffuse feature map to obtain two one-dimensional vectors respectively. Then, these two vectors are concatenated, passed through a fully connected layer, then through a ReLU activation function, then through another fully connected layer (or two parallel fully connected layers), and finally through a sigmoid activation function to obtain the channel attention weights M. c The input multi-channel diffuse feature map F is multiplied by the channel attention weights to obtain the channel-weighted feature map. The formula is as follows:

[0062]

[0063] M c =σ(FC(ReLU(FC(concat(F)) avg ,F max )))));

[0064] F′=F×M c ;

[0065] Where F represents the multi-channel diffusion feature map; M c H represents the channel attention weight; H represents the height of the feature map; W represents the width of the feature map; σ represents the sigmoid activation function.

[0066] To enhance the focus on key regions by both attention methods, channel-weighted and spatially weighted feature maps are fused by multiplying the attention weights. The fused feature map is then upsampled to restore its original size before being passed through the output layer to produce the final fused image.

[0067] In this embodiment, a multi-channel gradient loss function can be used to directly fuse and generate a 3-channel image, eliminating the need for color space transformation. During the image fusion process, a 3-channel image is directly generated. However, existing gradient losses are designed for single-channel fusion images. To directly generate a 3-channel fusion image while maintaining gradient invariance, this embodiment applies a novel 3-channel gradient loss function. The formula for this loss function is as follows:

[0068]

[0069] Among them, L MCG L represents the multi-channel gradient loss. MCI Indicates multi-channel intensity loss. Represents the channels (red, green, blue) of the merged image. Represents the gradient operator, This represents the channels of the input visible light image. When calculating the multi-channel intensity loss and multi-channel gradient loss, they are added together to obtain the final loss, which fully utilizes the diffusion characteristics to directly generate a 3-channel fused image.

[0070] Example 2

[0071] This embodiment provides a photovoltaic module defect image fusion system based on a diffusion model, including the following modules:

[0072] The image acquisition module is configured to: acquire infrared and visible light images of the photovoltaic panel and perform preprocessing; and obtain binary images of the corresponding photovoltaic panel regions based on the preprocessed infrared and visible light images.

[0073] The photovoltaic panel region extraction module is configured to: merge the binary image of the photovoltaic panel region with the corresponding infrared image and visible light image, and input it into the trained first convolutional neural network model to output a feature image; filter out candidate photovoltaic panel regions based on the feature image, generate corresponding masks for the candidate photovoltaic panel regions, and extract the photovoltaic panel region;

[0074] The diffusion training module is configured to: register the infrared image and the visible light image after extracting the photovoltaic panel area, and then perform forward diffusion training and backward diffusion training through the improved denoising diffusion probability model to obtain the denoising network model.

[0075] The image fusion module is configured to: obtain a multi-channel diffusion feature map using the denoising network model; obtain a spatial weighted feature map and a channel weighted feature map based on the multi-channel diffusion feature map and using spatial attention mechanism and channel attention mechanism respectively; and obtain the final fused image based on the spatial weighted feature map and the channel weighted feature map.

[0076] Example 3

[0077] The purpose of this embodiment is to provide a computer-readable storage medium for storing computer programs to perform the method described in Embodiment 1.

[0078] The method in Embodiment 1 can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor. The software modules can reside in readily available storage media in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not provided here.

[0079] Example 4

[0080] The purpose of this embodiment is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, used to perform the method described in Embodiment 1. For the sake of brevity, further details are omitted here.

[0081] It should be understood that in this embodiment, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0082] Memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of memory may also include non-volatile random access memory. For example, memory may also store information about the device type.

[0083] Various modifications and variations of this invention will be apparent to those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A photovoltaic module defect image fusion method based on a diffusion model, characterized in that, include: Acquire infrared and visible light images of the photovoltaic panel and perform preprocessing; Based on the preprocessed infrared and visible light images, binary images of the corresponding photovoltaic panel regions are obtained respectively; The binary image of the photovoltaic panel area is merged with the corresponding infrared and visible light images and input into the trained residual network to output the feature image; Based on the feature image, candidate regions for photovoltaic panels are selected, and corresponding masks for the candidate regions are generated to extract the photovoltaic panel regions. The infrared and visible light images of the extracted photovoltaic panel area are concatenated. After concatenation, the improved denoising diffusion probability model is used for forward diffusion training and backward diffusion training to obtain the denoising network model. The forward diffusion training has T steps, and a subset S{ is selected from 1 to T} Gradually add Gaussian noise until it approaches pure noise. The specific formula is as follows: ;in, and They respectively represent joining the first Second and third -1st order Gaussian noise, Z represents the standard normal distribution. Represented as control The variance of the Gaussian noise added in Indicates Gaussian noise; The reverse diffusion training is a process of denoising the noise introduced during the forward diffusion training process. The specific formula is as follows: ; ; =1- ; = ; in, Represents a noise prediction network. express The mean; The denoising network model is used to obtain a multi-channel diffusion feature map. Based on the multi-channel diffusion feature map, spatial attention mechanism and channel attention mechanism are used to obtain spatial weighted feature map and channel weighted feature map respectively. The final fused image is obtained according to the spatial weighted feature map and channel weighted feature map.

2. The photovoltaic module defect image fusion method based on diffusion model as described in claim 1, characterized in that, The feature image output by the trained residual network contains texture features of the photovoltaic panel region. The feature image is forward propagated, and photovoltaic panel candidate regions with a probability greater than 0.7 are selected by non-maximum suppression method.

3. The photovoltaic module defect image fusion method based on diffusion model as described in claim 1, characterized in that, The features of all selected photovoltaic panel candidate regions are aligned to a fixed size and input into a trained masking network. The network outputs the corresponding mask of the photovoltaic panel candidate region and combines it with the corresponding infrared and visible light images to extract the photovoltaic panel region.

4. The photovoltaic module defect image fusion method based on diffusion model as described in claim 1, characterized in that, Infrared image of the photovoltaic panel and visible light images An attention map is generated using a cross-attention mechanism and used as a constraint in the back-diffusion training process. The specific formula is as follows: , , ; ; Where Q, K, and V represent Query, Key, and Value in the attention mechanism; This represents a cross-attention map.

5. The photovoltaic module defect image fusion method based on diffusion model as described in claim 1, characterized in that, The specific method for obtaining spatially weighted feature maps using the spatial attention mechanism is as follows: First, perform two parallel convolution operations on the input multi-channel diffusion feature map and add the two feature maps together; then, pass a sigmoid activation function to obtain the spatial attention weights; finally, combine the input multi-channel diffusion feature map with the spatial attention weights. Multiplying them yields a spatially weighted feature map; The specific method for obtaining the channel-weighted feature map using the channel attention mechanism is as follows: First, the input multi-channel diffusion feature map is subjected to global average pooling and global max pooling to obtain two one-dimensional vectors respectively; then, these two vectors are concatenated, passed through a fully connected layer, then through the ReLU activation function, then through another fully connected layer, and finally through the sigmoid activation function to obtain the channel attention weights; the input multi-channel diffusion feature map is multiplied by the channel attention weights to obtain the channel-weighted feature map.

6. A photovoltaic module defect image fusion system based on a diffusion model, characterized in that, Includes the following modules: The image acquisition module is configured to: acquire infrared and visible light images of the photovoltaic panel and perform preprocessing; and obtain binary images of the corresponding photovoltaic panel regions based on the preprocessed infrared and visible light images. The photovoltaic panel region extraction module is configured to: merge the binary image of the photovoltaic panel region with the corresponding infrared and visible light images, input them into the trained residual network, and output a feature image; Based on the feature image, candidate regions for photovoltaic panels are selected, and corresponding masks for the candidate regions are generated to extract the photovoltaic panel regions. The diffusion training module is configured to: connect the infrared image and the visible light image after extracting the photovoltaic panel area, and then perform forward diffusion training and backward diffusion training through the improved denoising diffusion probability model to obtain the denoising network model. The forward diffusion training has T steps, and a subset S{ is selected from 1 to T} Gradually add Gaussian noise until it approaches pure noise. The specific formula is as follows: ;in, and They respectively represent joining the first Second and third -1st order Gaussian noise, Z represents the standard normal distribution. Represented as control The variance of the Gaussian noise added in Indicates Gaussian noise; The reverse diffusion training is a process of denoising the noise introduced during the forward diffusion training process. The specific formula is as follows: ; ; =1- ; = ; in, Represents a noise prediction network. express The mean; The image fusion module is configured to: obtain a multi-channel diffusion feature map using the denoising network model; obtain a spatial weighted feature map and a channel weighted feature map based on the multi-channel diffusion feature map and using spatial attention mechanism and channel attention mechanism respectively; and obtain the final fused image based on the spatial weighted feature map and the channel weighted feature map.

7. A computer-readable storage medium having a program stored thereon, characterized in that, When executed by a processor, the program implements the steps in the photovoltaic module defect image fusion method based on a diffusion model as described in any one of claims 1-5.

8. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the photovoltaic module defect image fusion method based on the diffusion model as described in any one of claims 1-5.