Photovoltaic cell defect detection system and method based on deep learning
By employing multimodal image fusion and layer-by-layer comparison, the lack of interpretability in deep learning photovoltaic cell detection is addressed, enabling physical consistency verification of model decisions and early anomaly detection, thereby improving the reliability and interpretability of the detection.
Patent Information
- Application Number
- CN202611306166.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-27
AI Technical Summary
Existing deep learning-based photovoltaic cell defect detection methods cannot explain whether the model's high-confidence predictions are based on real defect physical characteristics or spurious statistical correlations, thus lacking interpretability.
By constructing a multimodal image fusion system, the attention distribution map of the deep learning model and the physical saliency map of the photovoltaic cell are compared layer by layer to calculate the comprehensive physical credibility index. The physical consistency of the model's decision is verified by sliding window trend analysis and gradual perturbation.
It enables the interpretability verification of model defect judgment results, allowing for early detection and location of abnormal root causes in the early stages of model decision reliability degradation, reducing the risk of batch quality accidents, and improving the reliability and interpretability of detection.
Smart Images

Figure CN123181331A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of photovoltaic cell defect detection technology, specifically a photovoltaic cell defect detection system and method based on deep learning. Background Technology
[0002] With the rapid development of the photovoltaic industry, the quality inspection of photovoltaic cells has become a key link in ensuring the power generation efficiency and service life of photovoltaic modules. Electroluminescence imaging, infrared thermal imaging and visible light imaging are the three mainstream defect detection imaging methods in the photovoltaic industry. In recent years, deep learning-based defect detection methods have been widely used in the photovoltaic field, and the detection accuracy has been improved. However, the inherent black-box characteristics of deep learning models pose a deep challenge in photovoltaic defect diagnosis. Although the model can classify defects with high accuracy, users cannot determine whether the model's high-confidence prediction is based on the real physical characteristics of the defects or merely on spurious statistical associations with the defects. Summary of the Invention
[0003] The purpose of this invention is to provide a photovoltaic cell defect detection system and method based on deep learning to solve the problems raised in the prior art.
[0004] To achieve the above objectives, the present invention provides the following technical solution: a photovoltaic cell defect detection method based on deep learning, the method comprising the following steps: Multimodal images of photovoltaic cells are acquired, scaled images are input into a deep learning defect detection model, defect detection results are output, and attention weight matrices of each layer of the model encoder are extracted in real time. After transformation processing, attention distribution maps of each layer are obtained, forming a set of attention distribution maps. Based on the physical model of photovoltaic cells under various imaging modes, the distribution maps of theoretical physical parameters for each mode are calculated, and after normalization, they are stitched together to construct a multi-channel physical saliency map. The attention distribution map set and the physical saliency map are compared layer by layer to achieve structural similarity. The physical consistency score of each layer is calculated, and the weighted fusion is used to generate a comprehensive physical credibility index. This index is then compared with the first threshold to achieve credibility classification of the detection results. A monitoring curve is constructed with the batch of tests as the horizontal axis and the comprehensive physical reliability index as the vertical axis. A sliding window is used for trend analysis. When the index drops beyond the preset condition, the traceability mechanism is triggered to locate the network layer with the lowest physical consistency score and extract the high response area as the candidate traceability area. The candidate traceability region is gradually perturbed, the confidence level changes are observed, the maximum decrease is calculated, and when it exceeds the third threshold, it is determined to be a key evidence region. All key evidence regions constitute the key evidence region set. Extract the set of abnormal regions from the physical saliency map, calculate the spatial overlap between the set of key evidence regions and the set of abnormal regions, and output an alarm when the overlap is lower than the fourth threshold; otherwise, output the basis for the explanation of the defect.
[0005] Multimodal images of photovoltaic cells are acquired, scaled images are input into a deep learning defect detection model, defect detection results are output, and the attention weight matrices of each layer of the model encoder are extracted in real time. After transformation processing, the attention distribution maps of each layer are obtained, forming an attention distribution map set. The specific steps include: Electroluminescence images, infrared thermal images, and visible light images of photovoltaic cells are acquired and then uniformly scaled to the same spatial resolution. The scaled images are then input into a deep learning defect detection model, which is based on Vision... The deep learning model based on the Transformer architecture includes an encoder and a decoder. The encoder consists of L stacked Transformer encoding layers, each including an M-head self-attention mechanism. The decoder outputs the defect type and its corresponding defect detection confidence. During the forward inference process, the M-head self-attention weight matrix of each encoding layer in the encoder is extracted in real time. The weight matrices of the M attention heads are averaged element-wise along the attention head dimension to obtain the single-channel spatial attention weight matrix corresponding to each encoding layer. This single-channel spatial attention weight matrix is upsampled to the same spatial resolution as the input image using bilinear interpolation, serving as the attention distribution map of that encoding layer. The attention distribution maps of each encoding layer constitute an attention distribution map set A, which includes L attention distribution maps. The spatial resolution of each attention distribution map is consistent with the input image, where L represents the number of Transformer encoding layers, and M represents the number of self-attention heads per layer. The attention distribution map of the l-th layer in the attention distribution map set A is denoted as h. l , l=1,2,…,L.
[0006] In a preferred embodiment of the present invention, an electroluminescence (EL) image, an infrared (IR) thermal image, and a visible light (RGB) image of a photovoltaic cell are acquired, and the three images are uniformly scaled to the same spatial resolution through bilinear interpolation, denoted as H_img×W_img pixels, where H_img represents the image height and W_img represents the image width, preferably H_img=W_img=1024 pixels; The scaled image is input into a deep learning defect detection model. The model is a deep learning model based on the VisionTransformer architecture, which includes an encoder and a decoder. For an input image, it is first divided into P×P pixel image blocks, preferably P=16. Each image block is linearly projected to form a feature vector. The feature vectors of all image blocks are arranged in spatial order to form an input sequence with a sequence length of S=(H_img / P)×(W_img / P), preferably S=4096. The encoder is composed of L layers of Transformer encoding layers stacked together, preferably L=12, each layer includes M-head self-attention mechanism, preferably M=12, and the decoder is used to output the defect type and the corresponding defect detection confidence. During the forward inference process of the model, the multi-head self-attention weight matrix of each coding layer is extracted in real time. For the l-th coding layer, the attention weight matrix generated by its M-head self-attention mechanism has a shape of [M,S,S]. The weight matrices of the M heads are averaged element-wise in the dimension of attention heads to obtain a single-channel average weight matrix with a shape of [S,S]. The average weight matrix is reshaped into a two-dimensional weight matrix of [H1,W1] according to the spatial arrangement of image patches, where H1=H_img / P and W1=W_img / P. Preferably, H1=W1=64. The two-dimensional weight matrix is upsampled to [H_img, W_img] using bilinear interpolation, preferably 1024×1024, as the attention distribution map h of the l-th coding layer. l .
[0007] The first step involves acquiring images in EL, IR, and RGB modalities and scaling them uniformly to provide consistent input data for subsequent multi-channel fusion. The second step involves inputting the images into the ViT architecture model for defect detection. The model divides the images into image blocks and encodes them into sequences, which are then processed by an encoder and decoder to output the defect type and confidence level. Finally, interpretability criteria are extracted. During forward inference, a multi-head attention weight matrix is extracted from each layer of the encoder. After averaging, reshaping, and upsampling, an attention distribution map with the same resolution as the input image is obtained and summarized into set A. This set is used for subsequent layer-by-layer comparison with the physical model to verify whether the model's decisions conform to physical principles. The three modalities have different sensitivities to electrical defects, thermal defects, and appearance defects, respectively. Multimodal fusion can improve the comprehensiveness of detection. Unified scaling ensures the spatiotemporal consistency of the construction of multi-channel physical saliency maps. The extraction of attention maps provides a data foundation for subsequent layer-by-layer physical consistency verification. By comparing the model's attention region with the expected region of physical theory, it can be determined whether the model's decision is based on reasonable physical characteristics, rather than relying solely on statistical correlation of data.
[0008] Based on the carrier transport physical model of photovoltaic cells in electroluminescence imaging mode, the heat conduction physical model in infrared thermal imaging mode, and the surface geometric optical reflection model in visible light imaging mode, the theoretical physical parameter distribution of each pixel on the surface of the cell is calculated in each imaging mode, and the theoretical parameter distribution maps T_EL (electroluminescence mode), T_IR (infrared mode), and T_IR (visible light mode) are obtained. After normalizing the three theoretical parameter distribution maps, they are stitched together according to the channel dimension to construct a multi-channel physical saliency map T.
[0009] This step is based on the physical principles of photovoltaic cells in various imaging modalities to construct a multi-channel physical saliency map T, which serves as a reference benchmark for subsequent layer-by-layer comparison with the model's attention distribution map. The spatial resolution of the physical saliency map T is consistent with the input image, which is H_img×W_img pixels, and it contains three channels, corresponding to the three imaging modalities of electroluminescence (EL), infrared (IR), and visible light (RGB), respectively. The specific steps for calculating the distribution spectrum T_EL of the physical parameters of the EL modal theory are as follows: Electroluminescence intensity is positively correlated with minority carrier diffusion length. Based on this, using the statistical mean μ_EL of EL images of defect-free solar cells in the same batch as a benchmark, for the surface position (x,y) of the solar cell, if it is in a defect-free region, the theoretical normalized luminescence intensity value T_EL(x,y)=1; if it is in a defect region, T_EL(x,y) is determined according to the theoretical attenuation coefficient corresponding to the defect type, and the value is between 0 and 1. The theoretical luminescence intensity values of each pixel in the entire image constitute the T_EL spectrum. The specific steps for calculating the distribution spectrum T_IR of the theoretical physical parameters of the IR modes are as follows: The increased local series resistance in defective areas leads to enhanced Joule heating and abnormally high temperatures. Based on this, using the statistical mean μ_IR of IR images of defect-free solar cells in the same batch as a benchmark, for positions (x,y), if they are in defect-free areas, the theoretical normalized temperature value T_IR(x,y)=1; if they are in defective areas, T_IR(x,y) is determined according to the theoretical temperature rise coefficient corresponding to the defect type, and takes a value greater than 1. The theoretical temperature values of each pixel in the entire image constitute the T_IR spectrum. The specific steps for calculating the RGB modal theoretical physical parameter distribution spectrum T_RGB are as follows: The surface geometry of the solar cell determines the visible light reflectance distribution. The surface geometry includes a textured surface and a metallized grid layout. Based on the optical reflection model of the surface geometry, the theoretical reflectance value of each pixel in a defect-free state is calculated and normalized using this theoretical value as a benchmark: T_RGB(x,y)=1 in defect-free regions; in defective regions, the reflectance deviates from the theoretical value due to changes in the surface geometry, so T_RGB(x,y)≠1. The theoretical reflectance values of all pixels in the entire image constitute the T_RGB spectrum. The defective regions include fragments, scratches, broken grids, and color differences. After normalizing T_EL, T_IR, and T_RGB to the [0,1] interval, they are spliced by channel to form a three-channel physical saliency map T=[T_EL,T_IR,T_RGB], with the spatial resolution consistent with the input image. Here, 1 indicates that the position is in a completely defect-free ideal state in the corresponding modality, and 0 indicates a completely defective state.
[0010] The attention distribution of a deep learning model reflects where the model is looking, but it lacks an objective standard to judge whether it is looking correctly. By quantifying physical principles into a saliency map, a physical reference benchmark is provided for the model's attention. This allows for subsequent quantification of the degree of agreement between the model's attention area and the expectations of physical theory, thereby verifying whether the model's decisions conform to physical principles and elevating interpretability from qualitative description to quantitative calculation.
[0011] Each layer of attention map h in the attention distribution map set A l A layer-by-layer spatial structure similarity comparison is performed with the physical saliency map T, and the physical consistency score s of each layer is calculated. l ; For the l-th coding layer, the Structural Similarity Index (SSIM) is used to calculate the attention distribution map h of this layer. l Spatial structural similarity between the physical saliency map T and the attention distribution map is calculated by assigning the SSIM values of the three channels of the physical saliency map T to the attention distribution map. The average of the three channel SSIM values is then used as the physical consistency score s of the l-th coding layer. l The specific definition is as follows: s l =[SSIM(h l ,T_EL)+SSIM(h l ,T_IR)+SSIM(h l [,T_RGB)] / 3; Where T_EL, T_IR, and T_RGB are the three channels of the physical saliency map T, and the SSIM calculation window size is set to 11×11 pixels. lThe value range is [-1, 1]. The closer the value is to 1, the more consistent the attention distribution of this layer is with the physical theory. The physical consistency scores of each layer are weighted and fused to generate a comprehensive physical credibility index S, defined as follows: S=Σ l=1 L w l ×s l Among them, w l This represents the weights corresponding to the l-th coding layer, and the sum of the weights of all layers satisfies Σw l =1, s l This represents the physical consistency score of the l-th coding layer; In a preferred embodiment, for a 12-layer coding layer, the weights w of each layer are... l The weights are allocated as follows: 0.03 for layers 1 to 2, 0.05 for layers 3 to 4, 0.08 for layers 5 to 6, 0.10 for layers 7 to 8, and 0.12 for layers 9 to 12. The sum of these weights is 1. The comprehensive physical credibility index S is compared with the first threshold α. When S is greater than the first threshold α, the current detection result is marked as a credible detection result. When S is less than or equal to the first threshold α, it is marked as a low credibility detection result and proceeds to the next step. The first threshold α is determined based on the statistical distribution of historical correct detection samples.
[0012] The first threshold α is determined based on the statistical distribution of historical correct detection samples. Specifically, no less than 1,000 historical detection batches that have been manually verified as correct detections are collected. The correct detection means that the detection result is consistent with the manual judgment. The comprehensive physical credibility index S value corresponding to each batch is calculated to obtain the empirical distribution of the S value. The S values in the empirical distribution are arranged in ascending order, and the value at the 5th position after sorting is used as the first threshold α. The threshold α is dynamically updated as historical testing batches accumulate. Whenever 100 batches are added and confirmed as correctly tested by manual review, the 5th percentile is recalculated based on the S value of all historical correctly tested batches. The latest calculated value is used as the updated α, thus achieving dynamic adaptation of the threshold.
[0013] Different coding layers have different receptive fields and semantic abstraction levels. Layer-by-layer comparison can locate the specific level at which physical deviations occur, enabling fine-grained diagnostic capabilities in traceability. Deep coding layers capture global semantic information and contribute more to defect determination, thus being given higher weights. SSIM can effectively measure the similarity between attention distribution and physical map in spatial structure, making it suitable for verifying whether the model's focus area is consistent with the defect area expected by physical theory. The introduction of dynamic thresholds allows the judgment criteria to adaptively adjust with changes in production line conditions, avoiding the failure of fixed thresholds on different production lines or at different time periods.
[0014] A physical credibility monitoring curve is constructed using the detection batch serial number as the abscissa and the comprehensive physical credibility index S as the ordinate, and a fixed-width sliding window is used to perform local trend analysis on the physical credibility monitoring curve. If the decrease of the S value of the current batch relative to the mean of the S values of at least one historical batch in the sliding window exceeds a preset condition, a model decision traceability mechanism is triggered to locate at least one network layer with the lowest physical consistency score in the current detection batch, and extract, from the attention distribution map of the at least one network layer, a region where the response value is higher than the sum of the mean value of the attention distribution map of the layer and a set multiple of the standard deviation as a candidate traceability region. The preset condition is that the S value of the current batch is lower than the difference between the mean of the S values of at least one historical batch in the sliding window and a multiple of the standard deviation of the S values in the window.
[0015] In a preferred embodiment, the sliding window width W=20, covering the most recent 20 consecutive detection batches. The preset condition is S_current < S_reference - Δ, where S_current is the S value of the current batch, S_reference is the mean of the S values of the first 10 batches in the window, that is, the mean of the S values of the 10 batches before the current batch in the window, Δ=1.5×σ_W, σ_W is the standard deviation of the 20 S values in the window. S_reference does not include the current batch, and its value is the mean of the first 10 batches in the window to avoid statistical deviation caused by comparing the current batch with itself. When the above condition is satisfied, the traceability mechanism is triggered to locate the 3 network layers with the lowest physical consistency scores, and extract, from the attention distribution map of each layer, a pixel connected region where the response value exceeds the sum of the mean value of the layer and twice the standard deviation as a candidate traceability region.
[0016] The continuous decrease of the S value indicates that the model's attention gradually deviates from the physical theoretical expectation, which is an early signal of decision reliability degradation. Through sliding window trend analysis, the degradation trend can be perceived in advance before the model's detection accuracy drops significantly, and traceability is automatically triggered, realizing the transformation from post-emergency remedial measures to pre-warning intervention, reducing the risk of batch quality accidents, and locating specific network layers and regions, so that traceability has fine-grained diagnostic capabilities.
[0017] For each candidate traceability region, Gaussian blur is used to perform progressive disturbance to generate an image sequence with increasing disturbance intensity. The image sequence is sequentially input into the deep learning defect detection model, the defect detection confidence sequence output by the model is recorded, and the maximum decrease ΔC of the confidence after each region is disturbed is calculated. The image sequence with increasing disturbance intensity is generated in the order of increasing standard deviation of Gaussian blur. The maximum decrease ΔC of the confidence is defined as follows: ΔC=max(C0-Ci ), where C0 is the defect detection confidence level corresponding to the original image, C i Let be the defect detection confidence level corresponding to the i-th perturbation image; The calculated ΔC is compared with the third threshold γ. When ΔC is greater than the third threshold γ, the candidate region is determined to be a key evidence region that plays a decisive role in the model decision. When ΔC is less than or equal to the third threshold γ, the candidate region is not determined to be a key evidence region. The set of all candidate regions that are determined to be key evidence regions constitutes the key evidence region set E.
[0018] The definition of the third threshold γ is as follows: In the model validation stage, a validation set including known defective samples and non-defective samples is selected. Counterfactual reasoning is performed on each sample and the ΔC value of each sample is recorded. ROC curve is plotted with ΔC as the classification index and whether the region is a defective region as the true label. The ΔC value corresponding to the maximum Youden index is selected as the third threshold γ.
[0019] In a preferred embodiment, the standard deviation σ of the Gaussian blur takes values in the following sequence: σ=0,2,5,10,15,22,30, generating a sequence of 7 images with increasing perturbation intensity {I0,I1,…,I6}, where I0 is the original image without perturbation, σ=0 indicates no perturbation, I1 to I5 are images with intermediate perturbation intensity, and I6 is the highly blurred state image with maximum perturbation intensity. The above image sequence is then input into the deep learning defect detection model, and the corresponding defect detection confidence sequence is recorded.
[0020] Counterfactual reasoning verifies the causal relationship between a region and a decision by checking whether the model's conclusion changes if the region is removed, rather than simply showing correlation. Asymptotic perturbation can capture the peak of confidence decline. If a region is partially destroyed, the model's conclusion wavers, proving that the region plays a decisive role in the decision. Using the maximum decline amount instead of the final decline amount can avoid the model introducing random guesses and underestimating the actual contribution of the region in extreme ambiguity. The ROC curve Youden index method achieves the optimal balance between recall and precision, ensuring the statistical rationality of γ.
[0021] The set of anomalous regions U from which physical parameters deviate from theoretical values is extracted from the physical saliency map T. The specific steps are as follows: Calculate the global mean and standard deviation of the electroluminescence modal channel in the physical saliency map T, and extract the pixel connected regions in the channel whose values are lower than the mean minus twice the standard deviation; calculate the global mean and standard deviation of the infrared thermal imaging modal channel, and extract the pixel connected regions in the channel whose values are higher than the mean plus twice the standard deviation; take the union of the pixel connected regions extracted from the above two modalities as the abnormal region set U; The spatial overlap O between the key evidence region set E and the abnormal region set U is calculated using the following steps: The formula for calculating the spatial overlap O is: O=|E∩U| / |E∪U|, where |E∩U| is the spatial intersection area of E and U, in pixels, and |E∪U| is the spatial union area of E and U, in pixels. When O is less than the fourth threshold δ, the model decision is determined to deviate from the physical principle and an alarm is issued. When O is greater than or equal to the fourth threshold δ, the model decision is determined to conform to the physical principle and the key evidence region set E is output as the basis for defect interpretation. Finally, the interpretability triple (S,E,O) is output as the basis for the interpretability of the defect detection result.
[0022] The definition of the fourth threshold δ is as follows: Collect no less than 1,000 historical test batches that have been manually verified as correct, calculate the O value of each batch, and use the mean of the empirical distribution of O values minus twice the standard deviation as δ, that is, δ=μ_O-2σ_O, where μ_O is the mean of O values and σ_O is the standard deviation of O values; The interpretability triple (S, E, O) is presented on the original electroluminescent image in the form of an overlay annotation layer. The key evidence region set E is marked with a red dashed box, the abnormal region set U is marked with a blue solid box, and the spatially overlapping parts are highlighted in yellow. The image displays the comprehensive physical credibility index S value, the spatial overlap O value, and the alarm signal type.
[0023] By quantitatively calculating the spatial overlap O, the model's subjective concerns are spatially matched and verified with objective physical facts, so that the judgment of whether it deviates from the physical principle has an objective quantitative basis. This verification mechanism enables engineers to clearly determine whether each high-confidence judgment is based on reasonable physical characteristics or false associations, thus providing a criterion for manual review.
[0024] A deep learning-based photovoltaic cell defect detection system, comprising: Image processing module, feature extraction module, consistency analysis module, and verification output module; The output of the image processing module is connected to the input of the feature extraction module; The output of the feature extraction module is connected to the input of the consistency analysis module; The output of the consistency analysis module is connected to the input of the verification output module.
[0025] The image processing module is used to acquire EL, IR, and RGB images and scale them uniformly; the feature extraction module is used to extract the attention distribution map of each layer of the encoder and construct a physical saliency map based on the physical principles of each modality; the consistency analysis module calculates the physical consistency score of each layer by comparing the attention map and the physical saliency map layer by layer, and generates a comprehensive credibility index by weighted fusion to achieve hierarchical classification; at the same time, a monitoring curve is constructed for trend analysis, and when the index drops below a preset condition, tracing is triggered to locate the abnormal layer and extract the high response area; the verification output module is used to identify the key evidence area that plays a decisive role in decision-making by observing the model response changes through progressive perturbation; it extracts the abnormal area and performs spatial matching with the key evidence area, and outputs alarms or defect explanations based on the degree of matching.
[0026] Compared with the prior art, the beneficial effects of the present invention are: 1. By introducing a physical saliency map as a layer-by-layer reference benchmark for the model's attention distribution, the decision-making process of the deep learning model is transformed from an unexplainable statistical correlation into a layer-by-layer verifiable physical consistency assessment. This allows each defect determination of the model to be traced back to the correspondence with the expected physical theory. Unlike the existing technology where deep learning models directly output defect types without explaining the decision-making basis, this invention can clearly determine whether the model's high-confidence prediction is based on real defect physical characteristics or only on false statistical correlations. 2. By constructing a comprehensive physical credibility index monitoring curve and combining it with a sliding window for trend analysis, the traceability mechanism is automatically triggered when the index decline exceeds the preset conditions. This locates the network layer with the lowest physical consistency score and the high-response region, and then verifies the key evidence region through progressive perturbation. Unlike the passive investigation method in existing technologies where detection accuracy declines significantly, this invention can detect and automatically locate the root cause of anomalies in the early stage of model decision reliability degradation. Attached Figure Description
[0027] Figure 1 This is a flowchart illustrating the photovoltaic cell defect detection method based on deep learning according to the present invention. Detailed Implementation
[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] In the embodiment: such as Figure 1As shown, the object to be inspected is a 156mm×156mm monocrystalline PERC photovoltaic cell with the following parameters: EL camera resolution of 2048×2048 pixels, IR camera resolution of 1024×1024 pixels, and RGB camera resolution of 600×600 pixels; the target uniform resolution H_img×W_img is 1024×1024 pixels; all three modal images are scaled to 1024×1024 pixels using bilinear interpolation. The cell actually has a hidden crack defect, located in a banded area between image coordinates (420,380) and (580,520), which appears as a dark linear texture. The grayscale value of the defect-free area is 180 to 220, and the grayscale value of the defective area is 60 to 90. The 1024×1024 input image is divided into 16×16 pixel image blocks, and the number of image blocks is calculated as: S = (1024 / 16) × (1024 / 16) = 64 × 64 = 4096 image blocks. Each image block is linearly projected to form a feature vector. All 4096 feature vectors are arranged in spatial order to form an input sequence of length 4096, which is fed into an L=12-layer encoder. Each layer includes an M=12-head self-attention mechanism. Taking the 6th layer (l=6) as an example, this layer is located in the middle of the encoder. It captures local texture features and initially integrates region-level semantic information. The attention weight matrix generated by its 12-head self-attention mechanism has the shape [M,S,S]=[12,4096,4096]. The physical meaning of this matrix is that for each image block in the sequence... The model calculates its attention weights, i.e., the degree of attention, between itself and all 4096 other image patches. Twelve attention heads learn different attention patterns from different subspaces. The weight matrices of the 12 attention heads are averaged element-wise along the attention head dimension to obtain a single-channel average weight matrix of shape [4096, 4096]. This average weight matrix is then reshaped into a two-dimensional matrix according to the spatial arrangement of the image patches (64×64): H1=1024 / 16=64, W1=1024 / 16=64, resulting in a 64×64 two-dimensional weight matrix. This 64×64 two-dimensional weight matrix is then upsampled to 1024×1024 using bilinear interpolation to obtain the attention distribution map h6 of the 6th coding layer. The above operation is performed on all 12 coding layers to obtain the attention distribution map set A={h1,h2,…,h…}. 12}; As the network depth increases, the attention focus of the model's encoding layer gradually expands from local to global, and the content of attention evolves from microscopic texture to macroscopic semantics. The attention of layers 1 to 4 is scattered on local structures such as defect edges and grid line edges, and has not yet formed a concentrated focus on defect regions. The attention of layers 5 to 8 begins to converge into regional-level attention, and high-response regions gradually converge towards hidden crack and dark texture regions. Among them, the response peak of layer 6 basically coincides with the defect location. The attention of layers 9 to 12 covers the complete shape of the defect, but the boundaries gradually become blurred. While integrating global semantics, the deeper layers show a diffusion phenomenon in attention, focusing not only on defect regions, but also on the intersection region of main grid lines and fine grid lines. This intersection region may have a statistical co-occurrence relationship with defect labels in the training data, which belongs to the false association features learned by the model. A multi-channel physical saliency map T was constructed, based on the statistical parameters of defect-free solar cells in the same batch: the statistical mean of EL image μ_EL=195, and the statistical mean of IR image μ_IR=38℃. Based on the physical principle of EL imaging, the decrease in minority carrier diffusion length leads to a decrease in luminescence intensity. For this microcrack defect region, the theoretical normalized luminescence intensity value T_EL is between 0.25 and 0.38, with a value of approximately 0.25 at the dark ripples at the defect center, gradually increasing to 0.38 towards the defect edge; the theoretical normalized luminescence intensity value in the defect-free region is 1. Based on the physical principle of IR imaging, the Joule heating effect is enhanced in the defective region due to the increase in local series resistance. The theoretical normalized temperature value T_IR of the microcrack region is between 1.30 and 1.50, while the theoretical normalized temperature value of the defect-free region is 1. Based on the physical principle of RGB imaging, the battery cell has no appearance defects, the visible light reflectance has not deviated, and the T_RGB value of the entire image is 1; After normalizing T_EL, T_IR, and T_RGB to the [0,1] interval, they are spliced together by channel to form a three-channel physical saliency map T=[T_EL,T_IR,T_RGB] with a spatial resolution of 1024×1024 pixels. The attention distribution map set A is compared with the physical saliency map T layer by layer using SSIM. Taking the 6th layer as an example, SSIM(h6,T_EL)=0.82, SSIM(h6,T_IR)=0.79, SSIM(h6,T_RGB)=0.85, and the average value is s6=0.82. The physical consistency scores s1 to s6 are calculated for all 12 layers. 12The scores for each layer are: 0.31, 0.28, 0.35, 0.42, 0.61, 0.82, 0.79, 0.73, 0.58, 0.52, 0.41, and 0.36. The physical consistency scores of each layer are weighted and merged, with the weights allocated as follows: layers 1-2: 0.03, layers 3-4: 0.05, layers 5-6: 0.08, layers 7-8: 0.10, and layers 9-12: 0.12. The comprehensive physical credibility index S = Σ(w_l × s_l) = 0.547 is calculated. The S value of this batch is greater than the first threshold α = 0.38, so it is marked as a credible detection result. Assume the S-value of this production line shows a continuous downward trend for 90 consecutive batches: the S-value of batches 61-75 decreases from 0.54 to 0.43, and further decreases to the range of 0.35 to 0.40 for batches 76-90. Using a sliding window W=20 for trend analysis, at batch 90, S_current=0.36, the mean S-value of the first 10 batches within the window is S_reference=0.52, the standard deviation of the 20 S-values within the window is σ_W=0.09, Δ=1.5×0.09=0.135, and S_reference-Δ=0.385. Since S_current=0.36<0.385, the traceability mechanism is triggered, locating the three network layers with the lowest physical consistency scores: layer 12... 12 =0.21, 11th layer s 11 =0.28, 10th layer s 10 =0.33, extract the pixel connected regions in the 12th layer attention distribution map whose response value exceeds the mean of the layer plus twice the standard deviation as candidate trace regions. This region is located at coordinates (200,300) to (350,450), corresponding to the intersection of the main grid line and the fine grid line, which is not the location of the hidden crack defect. Counterfactual reasoning was used to verify the candidate traceability region. Gaussian fuzzy progressive perturbation was employed, with the standard deviation σ taking values from 0, 2, 5, 10, 15, 22, 30. Seven perturbation images, I0 to I6, were generated and sequentially input into the model. The confidence scores were recorded as C0=0.92, C1=0.91, C2=0.90, C3=0.88, C4=0.85, C5=0.79, and C6=0.71. The maximum decrease in confidence score, ΔC=max(C0-C...), was calculated. i )=0.21, ΔC is greater than the third threshold γ=0.12, the candidate region is determined to be the key evidence region that plays a decisive role in the model decision, and the set of this region constitutes the key evidence region set E; Anomaly region set U is extracted from the physical saliency map T. The global mean μ_EL and standard deviation σ_EL of T_EL are calculated. Pixel connected regions with values lower than μ_EL-2σ_EL are extracted, i.e., the region from coordinates (420,380) to (580,520), with an area of approximately 8200 pixels. Simultaneously, the global mean μ_IR and standard deviation σ_IR of T_IR are calculated. Pixel connected regions with values higher than μ_IR+2σ_IR are extracted. The union of these regions, U, represents the hidden crack defect region. The spatial overlap O between the key evidence region set E and the anomaly region set U is calculated as O=|E∩U| / |E∪U|. The area of E is 22500 pixels, and the area of U is 8200 pixels. The intersection is approximately 120 pixels, and the union is approximately 30580 pixels. O=120 / 30580≈0.004. Since O is less than the fourth threshold δ=0.28, the model decision is determined to deviate from the physical principle, and an alarm signal is output.
[0030] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A photovoltaic cell defect detection method based on deep learning, characterized in that: The method includes the following steps: Multimodal images of photovoltaic cells are acquired, scaled images are input into a deep learning defect detection model, defect detection results are output, and attention weight matrices of each layer of the model encoder are extracted in real time. After transformation processing, attention distribution maps of each layer are obtained, forming a set of attention distribution maps. Based on the physical model of photovoltaic cells under various imaging modes, the distribution maps of theoretical physical parameters for each mode are calculated, and after normalization, they are stitched together to construct a multi-channel physical saliency map. The attention distribution map set and the physical saliency map are compared layer by layer to achieve structural similarity. The physical consistency score of each layer is calculated and weighted to generate a comprehensive physical credibility index. This index is then compared with the first threshold to achieve credibility classification of the detection results. A monitoring curve is constructed with the batch of tests as the horizontal axis and the comprehensive physical reliability index as the vertical axis. A sliding window is used for trend analysis. When the index drops beyond the preset condition, the traceability mechanism is triggered to locate the network layer with the lowest physical consistency score and extract the high response area as the candidate traceability area. The candidate traceability region is gradually perturbed, the change in confidence level is observed, the maximum decrease is calculated, and when it exceeds the third threshold, it is determined to be a key evidence region. All key evidence regions constitute the key evidence region set. Extract the set of abnormal regions from the physical saliency map, calculate the spatial overlap between the set of key evidence regions and the set of abnormal regions, and output an alarm when the overlap is lower than the fourth threshold; otherwise, output the basis for the explanation of the defect.
2. The photovoltaic cell defect detection method based on deep learning according to claim 1, characterized in that: Multimodal images of photovoltaic cells are acquired, scaled images are input into a deep learning defect detection model, defect detection results are output, and the attention weight matrices of each layer of the model encoder are extracted in real time. After transformation processing, the attention distribution maps of each layer are obtained, forming an attention distribution map set. The specific steps include: Electroluminescence, infrared thermal, and visible light images of photovoltaic cells are acquired and uniformly scaled to the same spatial resolution. The scaled images are then input into a deep learning defect detection model. This model is based on the VisionTransformer architecture and includes an encoder and a decoder. The encoder consists of L stacked Transformer coding layers, each including an M-head self-attention mechanism. The decoder outputs the defect type and its corresponding defect detection confidence. During the model's forward inference process, the M-head self-attention weight matrix of each coding layer in the encoder is extracted in real time. The weight matrices of the M attention heads are element-wise averaged to obtain the single-channel spatial attention weight matrix for each coding layer. This single-channel spatial attention weight matrix is then upsampled to the same spatial resolution as the input image using bilinear interpolation, serving as the attention distribution map for that coding layer. The attention distribution maps of each coding layer constitute an attention distribution map set A, which includes L attention distribution maps, each with the same spatial resolution as the input image. Here, L represents the number of Transformer coding layers, and M represents the number of self-attention heads per layer. The attention distribution map of the l-th layer in the attention distribution map set A is denoted as h. l , l=1,2,…,L.
3. The photovoltaic cell defect detection method based on deep learning according to claim 2, characterized in that: Based on the physical models of photovoltaic cells under various imaging modes, the distribution maps of theoretical physical parameters for each mode are calculated, normalized, and then stitched together to construct a multi-channel physical saliency map. Specific steps include: Based on the carrier transport physical model of photovoltaic cells in electroluminescence imaging mode, the heat conduction physical model in infrared thermal imaging mode, and the surface geometric optical reflection model in visible light imaging mode, the theoretical physical parameter distribution of each pixel on the surface of the cell is calculated in each imaging mode, and the theoretical parameter distribution maps T_EL (electroluminescence mode), T_IR (infrared mode), and T_IR (visible light mode) are obtained. After normalizing the three theoretical parameter distribution maps, they are stitched together according to the channel dimension to construct a multi-channel physical saliency map T.
4. The photovoltaic cell defect detection method based on deep learning according to claim 3, characterized in that: The attention distribution map set and the physical saliency map are compared layer by layer for structural similarity. The physical consistency score of each layer is calculated, and the scores are weighted and fused to generate a comprehensive physical credibility index. This index is then compared with a first threshold to achieve credibility classification of the detection results. The specific steps include: Each layer of attention map h in the attention distribution map set A l A layer-by-layer spatial structure similarity comparison is performed with the physical saliency map T, and the physical consistency score s of each layer is calculated. l ; For the l-th coding layer, the Structural Similarity Index (SSIM) is used to calculate the attention distribution map h of this layer. l Spatial structural similarity between the physical saliency map T and the attention distribution map is calculated by assigning the SSIM values of the three channels of the physical saliency map T to the attention distribution map. The average of the three channel SSIM values is then used as the physical consistency score s of the l-th coding layer. l The specific definition is as follows: s l =[SSIM(h l ,T_EL)+SSIM(h l ,T_IR)+SSIM(h l ,T_RGB)] / 3; The physical consistency scores of each layer are weighted and fused to generate a comprehensive physical credibility index S, defined as follows: S=Σ l=1 L w l ×s l Among them, w l This represents the weights corresponding to the l-th coding layer, and the sum of the weights of all layers satisfies Σw l =1, s l This represents the physical consistency score of the l-th coding layer; The comprehensive physical credibility index S is compared with the first threshold α. When S is greater than the first threshold α, the current detection result is marked as a credible detection result. When S is less than or equal to the first threshold α, it is marked as a low credibility detection result and proceeds to the next step. The first threshold α is determined based on the statistical distribution of historical correct detection samples.
5. The photovoltaic cell defect detection method based on deep learning according to claim 4, characterized in that: A monitoring curve is constructed with the batch of tests as the x-axis and the comprehensive physical reliability index as the y-axis. A sliding window is used for trend analysis. When the index decreases beyond a preset condition, a traceability mechanism is triggered to locate the network layer with the lowest physical consistency score and extract high-response regions as candidate traceability regions. The specific steps include: A physical reliability monitoring curve is constructed with the batch number as the x-axis and the comprehensive physical reliability index S as the y-axis. A fixed-width sliding window is used to perform local trend analysis on the physical reliability monitoring curve. If the decrease in the S value of the current batch relative to the average S value of at least one historical batch within the sliding window exceeds a preset condition, a model decision tracing mechanism is triggered. At least one network layer with the lowest physical consistency score in the current batch is located, and the region in the attention distribution map of the at least one network layer whose response value is higher than the sum of the average of the attention distribution map of that layer and the standard deviation of a set multiple is extracted as a candidate tracing region. The preset condition is that the S value of the current batch is lower than the difference between the average S value of at least one historical batch within the sliding window and the multiple of the standard deviation of the S value within the window.
6. The photovoltaic cell defect detection method based on deep learning according to claim 5, characterized in that: The candidate traceability region is progressively perturbed, the change in confidence level is observed, and the maximum decrease is calculated. When it exceeds the third threshold, it is determined to be a critical evidence region. All critical evidence regions constitute the critical evidence region set. The specific steps include: For each region in the candidate traceability region, Gaussian blur is used to perform progressive perturbation, generating an image sequence with increasing perturbation intensity. The image sequence is then input into the deep learning defect detection model, the defect detection confidence sequence output by the model is recorded, and the maximum decrease in confidence ΔC after the perturbation of each region is calculated. The image sequence with increasing perturbation intensity is generated in order of increasing standard deviation of Gaussian blur; the maximum decrease in confidence ΔC is defined as follows: ΔC = max(C0 - C i ), where C0 is the defect detection confidence level corresponding to the original image, C i Let be the defect detection confidence level corresponding to the i-th perturbation image; The calculated ΔC is compared with the third threshold γ. When ΔC is greater than the third threshold γ, the candidate region is determined to be a key evidence region that plays a decisive role in the model decision. When ΔC is less than or equal to the third threshold γ, the candidate region is not determined to be a key evidence region. The set of all candidate regions that are determined to be key evidence regions constitutes the key evidence region set E.
7. The photovoltaic cell defect detection method based on deep learning according to claim 6, characterized in that: Extract the set of anomalous regions from the physical saliency map, calculate the spatial overlap between the set of key evidence regions and the set of anomalous regions, and output an alarm when the overlap is below a fourth threshold; otherwise, output the explanation of the defect. The specific steps include: The set of anomalous regions U from which physical parameters deviate from theoretical values is extracted from the physical saliency map T. The specific steps are as follows: Calculate the global mean and standard deviation of the electroluminescence modal channel in the physical saliency map T, and extract the pixel connected regions in the channel whose values are lower than the mean minus twice the standard deviation; calculate the global mean and standard deviation of the infrared thermal imaging modal channel, and extract the pixel connected regions in the channel whose values are higher than the mean plus twice the standard deviation; take the union of the pixel connected regions extracted from the above two modalities as the abnormal region set U; The spatial overlap O between the key evidence region set E and the abnormal region set U is calculated using the following steps: The formula for calculating the spatial overlap O is: O=|E∩U| / |E∪U|, where |E∩U| is the spatial intersection area of E and U, in pixels, and |E∪U| is the spatial union area of E and U, in pixels. When O is less than the fourth threshold δ, the model decision is determined to deviate from the physical principle and an alarm is issued. When O is greater than or equal to the fourth threshold δ, the model decision is determined to conform to the physical principle and the key evidence region set E is output as the basis for defect interpretation. Finally, the interpretability triple (S,E,O) is output as the basis for the interpretability of the defect detection result.
8. A photovoltaic cell defect detection system based on deep learning, applied to the photovoltaic cell defect detection method based on deep learning as described in any one of claims 1-7, characterized in that: The system includes: Image processing module, feature extraction module, consistency analysis module, and verification output module; The output of the image processing module is connected to the input of the feature extraction module; The output of the feature extraction module is connected to the input of the consistency analysis module; The output of the consistency analysis module is connected to the input of the verification output module.
9. The photovoltaic cell defect detection system based on deep learning according to claim 8, characterized in that: The image processing module is used to acquire EL, IR, and RGB images and scale them uniformly; the feature extraction module is used to extract the attention distribution map of each layer of the encoder and construct a physical saliency map based on the physical principles of each modality; the consistency analysis module calculates the physical consistency score of each layer by comparing the attention map and the physical saliency map layer by layer, and generates a comprehensive credibility index by weighted fusion to achieve hierarchical classification; at the same time, a monitoring curve is constructed for trend analysis, and when the index drops below a preset condition, tracing is triggered to locate the abnormal layer and extract the high response area; the verification output module is used to identify the key evidence area that plays a decisive role in decision-making by observing the model response changes through progressive perturbation; it extracts the abnormal area and performs spatial matching with the key evidence area, and outputs alarms or defect explanations based on the degree of matching.
