Photovoltaic module subfissure detection method, system, equipment and medium
By dynamically adjusting deep convolutional generative adversarial networks and using multi-constraint loss functions, high-quality and diverse electroluminescent images are generated, solving the problems of dataset imbalance and insufficient samples in the detection of microcracks in photovoltaic modules, and improving detection performance and generalization ability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN YUGUANG INTERNET OF THINGS TECH CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-04-17
AI Technical Summary
Existing datasets for detecting microcracks in photovoltaic modules suffer from class imbalance and insufficient samples, leading to unstable training of generative adversarial networks, large fluctuations in the quality of generated images, insufficient diversity, and an inability to effectively improve detection performance.
A deep convolutional generative adversarial network is employed, which combines a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, and a noise scale space strategy. By mixing noise vectors and class-adaptive embedding vectors, the network parameters are dynamically adjusted to generate high-quality and diverse electroluminescent images, thereby alleviating the class imbalance in the dataset.
The generated image samples can cover all defect patterns in real data, improving the detection performance and generalization ability of the hidden crack detection model, and effectively alleviating the problems of class imbalance and insufficient samples in the dataset.
Smart Images

Figure CN121883494A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of photovoltaic module defect detection technology, and more specifically, to a method, system, equipment, and medium for detecting microcracks in photovoltaic modules. Background Technology
[0002] Microcracks refer to tiny cracks that appear on the cells inside a photovoltaic module and are difficult to detect with the naked eye. Although this defect is not easy to detect initially, it can have a variety of negative impacts on the performance, lifespan, and safety of the photovoltaic module.
[0003] The primary method for detecting microcracks in photovoltaic systems is electroluminescence (EL) image detection. In a dark room, a reverse voltage is applied to the module, and an infrared camera captures the emitted light. Microcracks, due to reduced current flow, emit weaker light, appearing as black lines or dark spots, clearly showing the location and morphology of the crack. EL image datasets typically contain images of 12 different defect categories: cracks (linear and star-shaped), broken grids, black cores, misalignment (horizontal and longitudinal), thick lines, scratches, fragments, broken corners, short circuits, and material defects. However, the image dataset suffers from a severe imbalance in the number of defects across different categories. For example, short circuits and star-shaped cracks are too few, while broken grids are too many. This causes the target detection model to fail to fully learn the characteristics of short circuits and star-shaped cracks, focusing excessively on broken grids and neglecting other defects, leading to missed defects. Furthermore, the total sample size of the entire image dataset is relatively small, making deep learning models prone to overfitting and resulting in poor detection performance in practical applications. To improve the accuracy and generalization ability of object detection, it is necessary to construct a dataset of moderate size, high quality, and accurate annotation. Therefore, expanding the electroluminescence (EL) image dataset is key to improving detection performance. Traditional data augmentation methods, which transform and expand existing defect samples through methods such as rotation, scaling, and cropping, can increase the diversity and quantity of the EL image dataset, but they cannot fully simulate the complex and varied defect situations in real-world scenes and cannot solve the problem of poor object detection performance caused by a small number of defect samples.
[0004] Currently, generative adversarial networks (GANs) are often used to augment image datasets. Through adversarial training between the generator and discriminator, GANs can capture complex features from a small number of electroluminescent images and generate defective images that are highly similar to real images. Existing technologies include deep convolutional generative adversarial networks (DCGANs) based on the combination of convolutional attention modules (CBAM) and residual blocks (referred to as CBAM residual blocks) for electroluminescent image generation, but these methods suffer from the following technical drawbacks:
[0005] First, the standard generative adversarial network training mechanism is adopted, and the optimization objectives of the generator and the discriminator conflict with each other, which easily leads to gradient vanishing or gradient explosion problems. At the same time, the CBAM residual block lacks a systematic guarantee for training stability and does not set an effective dynamic balancing strategy, which leads to unstable generator training, inconsistent image quality, and difficulty in converging to a stable high-quality state, which seriously affects the reliability of the downstream hidden crack detection model.
[0006] Second, CBAM residual blocks can only achieve simple adjustment of feature weights and cannot fundamentally solve the problem of the generator generating fixed samples. At the same time, the discriminator's feedback signal is singular and lacks a constraint mechanism to force the generation of diversity, resulting in a large deviation between the generated samples and the real data distribution. In particular, the generation diversity of few sample defects (such as star-shaped cracks and short circuits) is seriously insufficient, which cannot effectively alleviate the problem of class imbalance in the dataset and has limited data augmentation effect.
[0007] Third, the lack of dynamic monitoring and adaptive adjustment mechanisms for the generative adversarial training process leads to premature convergence in scenarios with small sample sizes and class imbalance, where the discriminator tends to memorize training samples. At the same time, the CBAM residual block cannot effectively prevent the discriminator from overfitting or the generator from vanishing gradients, resulting in the generator being unable to learn new defect features and generating a large number of blurry, repetitive, and meaningless images. Summary of the Invention
[0008] The purpose of this invention is to provide a method, system, device, and medium for detecting microcracks in photovoltaic modules. It solves the technical problems of large quality fluctuations, insufficient diversity, easy pattern collapse during training, and the generation of a large number of meaningless images in the sample images generated by existing technologies. It expands the electroluminescent image dataset, effectively alleviates the problems of class imbalance and insufficient samples, provides high-quality data support for the microcrack detection model, and thus improves the detection performance and generalization ability of the microcrack detection model.
[0009] The above-mentioned technical objective of the present invention is achieved through the following technical solution:
[0010] In a first aspect, the present invention provides a method for detecting microcracks in photovoltaic modules, the method comprising:
[0011] Acquire a first image set; wherein the first image set includes electroluminescent images of different defects in photovoltaic modules;
[0012] The deep convolutional generative adversarial network (DGAN), consisting of a generator and a discriminator, is trained based on a first image set and a pre-configured training strategy. During training, the network parameters are dynamically adjusted in conjunction with real-time monitored training metrics until training stops, at which point the trained generator is output. The training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training stopping strategy. The multi-constraint loss function is a joint function of adversarial loss, perceptual loss, and defect feature constraint loss. The training metrics include the quality value of the generated images, the feature similarity of the generated images, and the loss difference between the generator and the discriminator.
[0013] The configured mixed noise vector and class adaptive embedding vector are input into the trained generator to generate the second image set. The first image set and the second image set are merged to obtain the third image set.
[0014] A hidden crack detection model is obtained by training a neural network based on the third image set.
[0015] The microcrack detection model is used to detect defects in the electroluminescent images under test, and outputs microcrack detection results to indicate whether the photovoltaic module has microcracks or not.
[0016] In one implementation, the generator includes a serial input layer, a fully connected layer, an upsampling module layer, a feature random shuffling and recombination module, and an output layer; wherein the upsampling module layer includes multiple serial upsampling modules.
[0017] The discriminator branches include parallel authenticity discrimination branches, scale consistency discrimination branches, and diversity discrimination branches; wherein each discriminator branch includes a serial input layer, a downsampling module layer, a mini-batch discrimination layer, and an output layer, and the downsampling module layer includes multiple serial downsampling modules.
[0018] In one implementation, the upsampling module includes a serial dual-channel adaptive attention residual block, a transposed convolutional layer, a feature alignment normalization layer, and a Slope LeakyReLU activation function layer; wherein the slope of the Slope LeakyReLU activation function layer is greater than 1 on the positive half-axis.
[0019] In one implementation, the generator's input layer concatenates the input mixed noise vector and the class-adaptive embedding vector to obtain a concatenated vector; the fully connected layer maps the concatenated vector to a feature map; the upsampling module enlarges the size of its respective input feature maps; the feature random shuffling and recombination module randomly selects an intermediate feature map output by the upsampling module, performs feature shuffling, recombination, and weighted fusion processing, and adds random features to output a multi-channel feature map; the generator's output layer maps the multi-channel feature map to a single-channel feature map and maps the pixel values of the single-channel feature map to the [-1, 1] interval to output an electroluminescent grayscale image.
[0020] The input layer of the discriminator branch receives a first image set and a category condition vector, the category condition vector corresponding to a category adaptive embedding vector; the downsampling module layer extracts the depth features of the images in the first image set; the mini-batch discriminator layer performs mini-batch discrimination on the depth features, calculates the feature similarity matrix of samples within the same batch, and outputs the discriminator features; the output layer of the discriminator branch integrates the discriminator features and outputs the discriminator score of the discriminator branch.
[0021] In one implementation, the dynamic adversarial balancing strategy includes adaptive learning rate adjustment and dynamic weight allocation; wherein, the adaptive learning rate adjustment includes: calculating the loss difference between the generator and the discriminator in real time, and dynamically adjusting the learning rates of the generator and the discriminator according to the relationship between the loss difference and a threshold; the dynamic weight allocation includes: during training, if the feature similarity of multiple consecutive batches of generated images exceeds a similarity threshold, then adjusting the loss weights of the generator and the discriminator.
[0022] The adaptive discriminator enhancement strategy includes: determining the relationship between the predicted value and the target predicted value of the current batch of images under each training process, and adjusting the intensity of the image enhancement operation according to the training process and the relationship.
[0023] The noise scale space strategy includes: determining the corresponding hierarchical stage under each training process, and adjusting the noise standard deviation of the input generator according to the training process and the hierarchical stage;
[0024] The training stopping strategy includes quality early stopping and mode collapse early stopping; wherein, quality early stopping includes: setting a quality threshold for generated images, and if the quality values of generated images in multiple consecutive batches are all lower than the quality threshold, then the training is invalid and training is stopped; mode collapse early stopping includes: if the feature similarity of generated images in multiple consecutive batches exceeds a similarity threshold, then training is stopped and backtracked to the previous optimal training batch, and the network parameters of the optimal training batch are saved.
[0025] In one implementation, the mixed noise vector includes Gaussian noise, defect feature noise, and random perturbation noise;
[0026] The category-adaptive embedding vector is a multi-dimensional vector composed of different defects; where each dimension vector corresponds to a type of defect of the photovoltaic module with hidden cracks.
[0027] In one implementation, the weights of the category-adaptive embedding vector are adjusted based on the number of defective samples.
[0028] A second aspect of the present invention provides a photovoltaic module microcrack detection system, the system comprising:
[0029] An image acquisition module is used to acquire a first image set; wherein, the first image set includes electroluminescent images of different defects in photovoltaic modules;
[0030] The first training module is used to train a deep convolutional generative adversarial network (DGAN) consisting of a generator and a discriminator based on a first image set and a pre-configured training strategy. During training, the network parameters of the DGAN are dynamically adjusted in conjunction with real-time monitored training metrics until training stops and the trained generator is output. The training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training stopping strategy. The multi-constraint loss function is a joint function of adversarial loss, perceptual loss, and defect feature constraint loss. The training metrics include the quality value of the generated image, the feature similarity of the generated image, and the loss difference between the generator and the discriminator.
[0031] The image processing module is used to input the configured mixed noise vector and class adaptive embedding vector into the trained generator to generate a second image set, and to merge the first image set and the second image set to obtain a third image set.
[0032] The second training module is used to train the neural network based on the third image set to obtain the hidden crack detection model.
[0033] The microcrack detection module is used to perform defect detection on the electroluminescent image under test based on the microcrack detection model, and outputs the microcrack detection result to indicate whether the photovoltaic module has microcracks or not.
[0034] A third aspect of the present invention provides an electronic device, including a memory and a processor;
[0035] A memory for storing computer programs, the computer programs including program instructions;
[0036] A processor is configured to execute the program instructions to cause the electronic device to perform the steps of a photovoltaic module microcrack detection method as provided in the first aspect of the present invention.
[0037] A fourth aspect of the present invention provides a computer-readable storage medium comprising a computer program that, when executed by one or more processors, implements a method for detecting microcracks in photovoltaic modules as provided in the first aspect of the present invention.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] 1. In the technical solution provided by this invention, the fixed feature combination pattern of the generator is broken by the synergistic effect of mixed noise vector, class adaptive embedding vector, feature random shuffling and recombination module (FRM), which focuses on improving the generation priority of defects with few samples; at the same time, the discriminator adopts a three-branch structure, in which the diversity discrimination branch forces the generation of diverse samples from the adversarial level, and combined with the mini-batch discrimination layer, effectively suppresses pattern collapse; thus, the generated image samples can cover all defect patterns of real data, effectively alleviating the problem of class imbalance in the dataset.
[0040] 2. In the technical solution provided by this invention, a multi-constraint joint loss function is designed, which includes adversarial loss, perceptual loss, and defect feature constraint loss. The defect feature constraint loss specifically guides the generator to generate images that conform to the real defect morphology, while the perceptual loss ensures that the overall structure of the generated image is consistent with the real image. By combining a noise scale space training strategy and category-aware conditional generation, the detail quality of the generated image is gradually optimized, thereby significantly improving the quality of the generated image and effectively suppressing the generation of meaningless images. Attached Figure Description
[0041] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:
[0042] Figure 1 This is a flowchart illustrating a method for detecting microcracks in photovoltaic modules according to an embodiment of the present invention.
[0043] Figure 2 This is a schematic diagram of a photovoltaic module microcrack detection system provided in an embodiment of the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0045] It should be noted that the terms "comprising" or "may include" used in the various embodiments of this application indicate the presence of the claimed function, operation, or element, and do not limit the addition of one or more functions, operations, or elements. Furthermore, as used in the various embodiments of this application, the terms "comprising," "having," and their cognates are intended only to indicate a specific feature, number, step, operation, element, component, or combination of the foregoing, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing, or adding one or more combinations of the foregoing.
[0046] It should be understood that terms such as "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0047] As described in the background section, generative adversarial networks (GANs) are currently commonly used to augment image datasets. Through adversarial training between the generator and discriminator, GANs can capture complex features from a small number of electroluminescent images, generating defective images highly similar to real images. Existing technologies include deep convolutional generative adversarial networks (DCGANs) based on the combination of convolutional attention modules (CBAM) and residual blocks (referred to as CBAM residual blocks) for electroluminescent image generation. However, such methods suffer from the following technical drawbacks:
[0048] First, the standard generative adversarial network training mechanism is adopted, and the optimization objectives of the generator and the discriminator conflict with each other, which easily leads to gradient vanishing or gradient explosion problems. At the same time, the CBAM residual block lacks a systematic guarantee for training stability and does not set an effective dynamic balancing strategy, which leads to unstable generator training, inconsistent image quality, and difficulty in converging to a stable high-quality state, which seriously affects the reliability of the downstream hidden crack detection model.
[0049] Second, CBAM residual blocks can only achieve simple adjustment of feature weights and cannot fundamentally solve the problem of the generator generating fixed samples. At the same time, the discriminator's feedback signal is singular and lacks a constraint mechanism to force the generation of diversity, resulting in a large deviation between the generated samples and the real data distribution. In particular, the generation diversity of few sample defects (such as star-shaped cracks and short circuits) is seriously insufficient, which cannot effectively alleviate the problem of class imbalance in the dataset and has limited data augmentation effect.
[0050] Third, the lack of dynamic monitoring and adaptive adjustment mechanisms for the generative adversarial training process leads to premature convergence in scenarios with small sample sizes and class imbalance, where the discriminator tends to memorize training samples. At the same time, the CBAM residual block cannot effectively prevent the discriminator from overfitting or the generator from vanishing gradients, resulting in the generator being unable to learn new defect features and generating a large number of blurry, repetitive, and meaningless images.
[0051] To address these issues, this invention provides a method for detecting microcracks in photovoltaic modules, which solves the technical problems of large fluctuations in generated image quality, insufficient diversity, easy pattern collapse during training, and the generation of a large number of meaningless images in the prior art. This method achieves high-quality and diverse data enhancement of photovoltaic EL images, alleviates the problems of class imbalance and insufficient samples in the dataset, and improves the performance and generalization ability of downstream microcrack detection models.
[0052] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings. Figure 1 The methods include:
[0053] S101, acquire a first image set; wherein, the first image set includes electroluminescent images of different defects in photovoltaic modules.
[0054] Specifically, the first image set comes from a portion of the PVEL-AD dataset and datasets provided by EL electronic inspection instrument manufacturers. This first image set contains 3989 images, covering 5200 defects. Since it was obtained from actual production lines, the richness and distribution characteristics of the defects it contains are representative. The defect samples in the first image set are from the PVEL-ADI631 dataset, which includes images of 12 different categories of defects: cracks (linear and star-shaped), broken grids, black cores, misalignment (horizontal and vertical), thick lines, scratches, fragments, broken corners, short circuits, and material defects. The distribution of these defect labels is extremely uneven, with broken grid defects accounting for 36.4% of the dataset and star-shaped hidden cracks accounting for only 5.5%. When applying deep learning to photovoltaic defect detection, sufficient data is required for network training. For defect categories with limited data, the model struggles to learn feature extraction methods within a limited number of training epochs, ultimately leading to detection results biased towards categories with more sample data.
[0055] The images in the first image set can also be normalized and resized. Specifically, normalization maps the image pixel values to the range of [-1, 1] to eliminate the impact of pixel value differences on network training. Resizing adjusts all images to the same size to meet the input requirements of the subsequent deep convolutional generative adversarial network.
[0056] S102, the deep convolutional generative adversarial network (DGAN) consisting of a generator and a discriminator is trained according to the first image set and a pre-configured training strategy. During training, the network parameters of the DGAN are dynamically adjusted in conjunction with real-time monitored training metrics until training stops, and the trained generator is output. The training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training stopping strategy. The multi-constraint loss function is a function of the adversarial loss, perceptual loss, and defect feature constraint loss. The training metrics include the quality value of the generated image, the feature similarity of the generated image, and the loss difference between the generator and the discriminator.
[0057] In this embodiment, based on the shortcomings of the existing design of combining Convolutional Attention Module (CBAM) with residual blocks (hereinafter referred to as CBAM residual blocks), the generator provided in this embodiment includes a serial input layer, a fully connected layer, an upsampling module layer, a feature random shuffling and recombination module, and an output layer; wherein, the upsampling module layer includes multiple serial upsampling modules.
[0058] Specifically, the input layer receives and concatenates a mixed noise vector and a category-adaptive embedding vector. The mixed noise vector includes Gaussian noise, defect feature noise, and random perturbation noise. By fusing multiple types of noise, the diversity of the input signal is ensured, providing a foundation for generating diverse defect images. The category-adaptive embedding vector is a 12-dimensional vector (corresponding to 12 types of defects). It adopts an adaptive encoding method, dynamically adjusting the category weights according to the number of samples for each type of defect. Higher weights are assigned to defects with fewer samples (such as short circuits and star-shaped cracks), focusing on improving the generation priority and diversity of defects with fewer samples.
[0059] The fully connected layer maps the concatenated vectors from the input layer to an initial feature map, with an output size of 4×4×512, providing basic features for the subsequent upsampling process.
[0060] The upsampling module includes a serial dual-channel adaptive attention residual block, a transposed convolutional layer, a feature alignment normalization layer, and a Slope LeakyReLU activation function layer; wherein the slope of the Slope LeakyReLU activation function layer on the positive half-axis is not 1.
[0061] Specifically, the dual-channel adaptive attention residual block (DCA-ResBlock) is the core module of the generator, replacing the CBAM residual block in the existing technology. It includes channel adaptive branch, spatial adaptive branch and residual connection.
[0062] The channel adaptive branch employs an improved SE-Net channel attention mechanism, combining SE-Net with deformable convolutions. This dynamically adjusts the weights of each channel in the feature map, enhancing the extraction of weak defect features and suppressing interference from redundant background features, thus adapting to the small defects characteristic of EL images. The spatial adaptive branch is an improvement on ECA-Net, dynamically adjusting the size of the convolutional kernel to accurately capture the spatial morphology of defects of different sizes (such as linear cracks and blocky black cores), improving the accuracy of defect feature extraction. The residual connections use a cross-layer residual combined with feature fusion approach, incorporating small feature enhancement factors to effectively reduce the gradient vanishing problem during network training, ensuring stable transfer of defect features and improving training stability.
[0063] The transposed convolutional layer uses a 4×4 kernel, a stride of 2, and padding of 1 to upsample the feature map and gradually increase the size of the feature map.
[0064] The Feature Alignment Normalization (FAN) layer replaces the traditional batch normalization layer, introduces class feature anchors, and can dynamically adjust the normalization coefficients. This effectively solves the feature shift problem that is prone to occur in scenarios with small samples and class imbalance, and improves the quality and stability of the generated images.
[0065] The Slope LeakyReLU activation function layer employs a LeakyReLU activation function with a negative slope of 0.2 and a positive slope greater than 1 to avoid gradient vanishing during network training and enhance the network's non-linear expressive power. By default, the LeakyReLU activation function has a slope of 1 on the positive half-axis, indicating that it directly maps to the input feature values. Since the inscription extraction scenario only involves two objects to be segmented: foreground and background, this embodiment adjusts the slope of the LeakyReLU activation function in the effectively activated portion. This embodiment sets the slope of the LeakyReLU activation function on the positive half-axis to a real number greater than 1, forming the SlopeLeakyReLU activation function. This facilitates the coarse extraction of different information in each branch and improves the subsequent decoder's generation of more discriminative feature planes, achieving effective separation of the foreground and background of the electroluminescent image.
[0066] The Feature Random Shuffle and Recombination (FRM) module is located between the upsampling module group and the output layer. It randomly selects the intermediate layer feature map output by the upsampling module group, performs feature shuffling, recombination and weighted fusion, and adds random feature dropout (dropout probability is positively correlated with defect category diversity). This breaks the generator's fixed feature combination pattern, forces the generator to learn new feature combinations, improves the novelty and diversity of the generated image, and effectively suppresses pattern collapse.
[0067] Specifically, the upsampling module layer contains four sets of serially connected upsampling modules. Each set of upsampling modules outputs one intermediate layer feature map (serially enlarging the size). Therefore, the four sets of output feature maps are defined as follows: ;in, The intermediate layer feature map output by the i-th upsampling module (i=1,2,3,4, corresponding to the 4 outputs of the 4 groups of serial upsampling modules); for The dimensional space belongs to the subsequently defined real number space; To represent the feature map, all pixel values (feature values) are real numbers; The height of the feature map output by the i-th upsampling module (serial upsampling gradually doubles, such as...) ; ; ; ); The width of the feature map output by the i-th upsampling module; The number of channels for the output feature map of the i-th upsampling module (halved progressively during serial upsampling, e.g.) ; ; ; ). This represents the three-dimensional dimension of the feature map, which is height * width * number of channels, describing the spatial size and feature dimension of the feature map.
[0068] The feature random shuffling and recombination module first selects k images from the four intermediate layer feature maps. (Random sampling, avoiding fixed feature combinations), let the selected feature map subset be: ,in, These are k feature maps in the set. These are the index values corresponding to the selected feature maps.
[0069] Since the selected feature maps have different sizes, they need to be aligned to a uniform size first. In this embodiment, a bilinear interpolation function is used to achieve the size adjustment. The aligned feature maps are denoted as: ,in, For the j-th feature map after size alignment (symbol " "Represents "after processing" Here, j is the original index of the feature map, and j is the index of the feature map within the subset. It is a bilinear interpolation function. : Target dimensions for size alignment (target height and target width are in parentheses). Let be the number of channels in the j-th aligned feature map.
[0070] Aligned k feature maps First, concatenate the channel dimensions of all feature maps to obtain the concatenated feature map, i.e.: ; The total feature map is obtained by stitching together k aligned feature maps; This is a function for concatenating channel dimensions, which only concatenates the channel dimensions while keeping the height and width unchanged. The k feature maps are used to complete the size alignment, and the input is used for the stitching function.
[0071] Subsequently, The channel dimensions are randomly shuffled (generating randomized indexes, breaking the fixed channel combination pattern), and the shuffled feature map is denoted as: ,in, The feature map after scrambling the channel dimensions; The index slice symbol for the feature map is: the first two colons indicate that the height and width dimensions of the feature map are kept unchanged, and the third dimension (channel dimension) is shuffled according to the subsequent rules. The index range represents the range from the first channel to the second channel. One channel, This indicates that the indexes of all channels are randomly rearranged. The function is a random permutation function for channel indices. Its core function is to break the fixed feature combination pattern of the generator and improve the diversity of generated images.
[0072] The scrambled feature map An adaptive weighted fusion method is used (the weights are adaptively learned through network training to match the defect features of EL images) to obtain a fused feature map, the expression of which is: ,in, This represents the adaptive weight of the c-th channel. The scrambled feature map The c-th channel.
[0073] Add random features to dropout (dropout probability) p It is positively correlated with the diversity of defect categories, that is, the lower the category diversity, p The larger the value, the more the generator is forced to learn new feature combinations, ultimately resulting in the output feature map of the Feature Random Shuffle and Recombination Module (FRM). Its expression is: ;in, Let M be the random feature discarding function, and M be the dropout mask matrix. This is the feature map after weighted fusion.
[0074] As can be seen, the feature maps, after random shuffling, weighted fusion, and dropout, break the fixed feature combination pattern of the generator, effectively suppress pattern collapse, and provide feature support for the output layer to generate diverse and high-quality EL images.
[0075] The output layer includes a convolutional layer and a Tanh activation function. The convolutional layer uses a 3×3 kernel, a stride of 1, and padding of 1 to adjust the number of channels in the feature map to 1 (EL grayscale image), completing the "channel number adjustment" and outputting a 64×64×1 single-channel feature map. However, at this time, the pixel value (feature value) range of the feature map is arbitrary (unconstrained, may be positive or negative, and the value size is unlimited). Therefore, the Tanh activation function does not change the number of channels and the image size, but only maps each pixel value of the 64×64×1 single-channel feature map, compressing the arbitrary range of pixel values to the [-1, 1] interval, which meets the actual needs of the electroluminescent grayscale image.
[0076] In one embodiment, the discriminator branches include parallel authenticity discrimination branches, scale consistency discrimination branches, and diversity discrimination branches; wherein each discriminator branch includes a serial input layer, a downsampling module layer, a mini-batch discrimination layer, and an output layer, and the downsampling module layer includes multiple serial downsampling modules.
[0077] Specifically, the input layer of the discriminator is used to receive images (real images or generated images) and category condition vectors. The category condition vectors correspond to the category adaptive embedding vectors of the generator, realizing category-aware discrimination, improving the discriminator's recognition accuracy of defects of different categories, and thus guiding the generator to generate defect images that match the category.
[0078] The downsampling module layer also includes four sets of downsampling modules with the same structure. Each set of downsampling modules includes an attention residual block, a spectral normalization convolutional layer, a batch normalization layer, and a LeakyReLU activation function layer. Through the stepwise downsampling of the four sets of downsampling modules, deep features of the image are extracted, providing a basis for subsequent discrimination.
[0079] Attention residual blocks replace the CBAM residual blocks in existing technologies, fusing lightweight channel attention and spatial attention. While maintaining the ability to extract defect features, they simplify the network structure and improve training efficiency. The attention residual block adopts a core structure of backbone feature extraction, lightweight attention fusion, and residual connections. The backbone feature extraction branch sequentially includes two consecutive spectral normalized convolutional layers (kernel size 3×3, stride 1, padding 1), a batch normalization layer, and a LeakyReLU activation function layer. The convolutional layers employ spectral normalization, echoing the spectral normalized convolutional layers in the subsequent downsampling module, further improving training stability and avoiding gradient explosion.
[0080] The lightweight attention fusion branch employs a concatenated structure of channel attention and spatial attention to achieve precise adjustment of feature weights without increasing computational cost. Specifically, lightweight channel attention directly performs global average pooling on the output feature map of the main branch (resulting in a 1×1×C feature vector, where C is the number of input channels), then passes it through a 1×1 convolutional layer (compressing channels to C / 4), LeakyReLU activation, and another 1×1 convolutional layer (restoring channels to C), finally activating it with a sigmoid function to obtain channel attention weights. This achieves precise weighting of defective feature channels, strengthening effective channels and suppressing redundant channels. Lightweight spatial attention uses a simple and efficient spatial attention structure. It concatenates the channel-weighted feature map (merging all channels of the feature map into a single channel), extracts spatial features through a 3×3 convolutional layer (stride 1, padding 1), and then activates it with a sigmoid function to obtain spatial attention weights, focusing on defective regions in the image and suppressing background interference. The residual connection adopts a short-pass residual structure, which directly adds the input feature map to the feature map after attention fusion and adds a small feature enhancement factor (value 0.01~0.05), which effectively alleviates the gradient vanishing problem in network training, ensures the stable transmission of defective features, and further simplifies the structure. It is different from the cross-layer residual design of the generator DCA-ResBlock and adapts to the feature extraction rhythm of the discriminator.
[0081] The output processing takes the feature map after residual fusion, processes it with the LeakyReLU activation function, and outputs it to the spectral normalization convolutional layer of the downsampling module to achieve further feature extraction and transmission.
[0082] The spectral normalized convolutional layer uses a 4×4 kernel, a stride of 2, and padding of 1. By spectrally normalizing the weights of the convolutional layer, the spectral norm of the weights is constrained, which effectively prevents gradient explosion during network training and improves training stability.
[0083] Batch normalization layers are used to accelerate network training convergence and reduce overfitting.
[0084] The LeakyReLU activation function layer uses a LeakyReLU activation function with a negative slope of 0.2 to enhance the nonlinear expressive power of the network.
[0085] The Mini-batch Discrimination layer is used to perform mini-batch discrimination on the deep features output by the downsampling module group, calculate the feature similarity matrix of samples within the same batch, output the discriminative features, and assist the diversity discrimination branch to achieve diversity constraints and further suppress mode collapse.
[0086] The output layer is a fully connected layer that integrates the discrimination features output by the mini-batch discrimination layer and outputs the discrimination scores of the corresponding branches. Among them, the authenticity discrimination branch outputs the authenticity discrimination score of the image (distinguishing between real images and generated images), the scale consistency discrimination branch outputs the defect feature consistency score of the image at different scales (scaling by 0.8, 1.0, and 1.2 times), and the diversity discrimination branch outputs the diversity score of the generated images within the same batch.
[0087] By leveraging the combined effects of mixed noise vectors, class-adaptive embedding vectors, and feature random shuffling and recombination modules, the generation priority of few-sample defects is improved. Meanwhile, the discriminator group adopts a three-branch structure, in which the diversity discrimination branch forces the generation of diverse samples from an adversarial perspective. Combined with the mini-batch discrimination layer, this effectively suppresses pattern collapse. This increases the number of variants generated from few-sample defects, enabling the generated samples to cover all defect patterns in the real data and effectively alleviating the problem of class imbalance in the dataset.
[0088] In terms of training strategy, the configured multi-constraint loss function is a joint function of adversarial loss, perceptual loss and defect feature constraint loss. Compared with the traditional single adversarial loss, the loss function provided in this embodiment constrains the training of the generator from multiple dimensions, avoiding the generation of meaningless images with abnormal defect morphology.
[0089] The adversarial loss uses Hinge Loss, which, compared to the traditional cross-entropy loss, can effectively alleviate the gradient vanishing problem and improve training stability.
[0090] Perceptual loss of the discriminator:
[0091] .
[0092] Perceptual loss of the generator: .in, These are real samples (from the first image set). For mixed noise vectors, Samples generated by the generator Let be the output score of the discriminator, and max() be the maximum value function.
[0093] The perceptual loss uses a pre-trained VGG network to extract high-level features from the generated image and the real image, calculates the Euclidean distance between the two high-level features, and constrains the overall structure of the generated image to be consistent with the real image, thus avoiding the generation of meaningless images with abnormal structures.
[0094] The defect feature constraint loss extracts the core features of 12 types of defects in the first image set (such as the linear features of cracks and the blocky features of black cores), calculates the similarity between the defect features of the generated image and the core features of the corresponding categories. If the similarity is lower than a set threshold, a penalty is applied to guide the generator to generate images that conform to the real defect morphology, ensuring the authenticity of the generated defects. At the same time, for defects with few samples, the weight of their feature constraint loss is appropriately increased to further ensure the generation quality of images with few samples of defects.
[0095] The formula for calculating the defect feature constraint loss is: ,in, Class weights (for defects in a small number of samples) (Higher value) For similarity threshold, The function for calculating feature similarity (preferably cosine similarity) is used. is the core feature extraction function for the i-th type of defect.
[0096] In summary, the expression for the total loss function of the discriminator is: .
[0097] The expression for the generator's total loss function is: ,in, , , These are weighting coefficients, with values of 1.0-10.0, 0.5-2.0, and 2.0-5.0 respectively. These values can be appropriately increased in scenarios with few defective samples. The value of .
[0098] In one embodiment, the dynamic adversarial balancing strategy includes adaptive learning rate adjustment and dynamic weight allocation; wherein, adaptive learning rate adjustment includes: calculating the loss difference between the generator and the discriminator in real time, and dynamically adjusting the learning rates of the generator and the discriminator according to the relationship between the loss difference and the threshold; dynamic weight allocation includes: during training, if the feature similarity of multiple consecutive batches of generated images exceeds the similarity threshold, then adjusting the loss weights of the generator and the discriminator.
[0099] Specifically, adaptive learning rate adjustment involves real-time calculation of the loss difference between the generator and the discriminator. , To determine the total loss of the discriminator, The total loss of the generator is used to dynamically adjust the learning rates of both generators based on the difference in loss; if (This indicates the discriminator is too strong and the generator is underlearned): Multiply the discriminator's learning rate by 0.95 and the generator's learning rate by 1.05, while adjusting the training step ratio to 1:2 (train the generator for every 2 steps, then train the discriminator for every 1 step); if (This indicates the generator is too strong and the discriminator is underlearned): Multiply the discriminator's learning rate by 1.05 and the generator's learning rate by 0.95, while adjusting the training step ratio to 2:1 (train the generator for every 2 steps of discriminator training); if Within the threshold range (indicating that the generator and discriminator are in a balanced state): keep the learning rate constant and set the training step ratio to 1:1.
[0100] During adversarial training, signs of pattern collapse are detected in real time (if the feature similarity of three consecutive batches of generated images exceeds 80%, it is determined that a pattern collapse has occurred). When a pattern collapse is detected, the loss weight of the generator is immediately increased (e.g., the loss weight is multiplied by 1.1), and the loss weight of the discriminator is decreased (e.g., the loss weight is multiplied by 0.9), guiding the generator to break the fixed generation pattern and relearn diverse defect features.
[0101] To address the issues of limited sample size and class imbalance in photovoltaic EL image datasets (e.g., very few defect samples such as short circuits and star-shaped cracks, but a large number of broken grid samples), this embodiment aims to prevent the discriminator from prematurely memorizing features of real samples during training (i.e., premature overfitting). This prevents the discriminator from effectively distinguishing between real and generated EL images, leading to a lack of effective training feedback, training stagnation, or pattern collapse. The adaptive discriminator enhancement strategy provided in this embodiment does not employ fixed-intensity data augmentation. Instead, it uses a "real-time monitoring + dynamic adjustment" approach to adapt the data augmentation intensity to the discriminator's training state. This ensures the discriminator learns common defect features while avoiding overfitting, providing continuous and effective training feedback for the generator.
[0102] Specifically, the adaptive discriminator enhancement strategy includes: determining the relationship between the predicted value and the target predicted value of the current batch of images under each training process, and adjusting the intensity of the image enhancement operation according to the training process and the relationship.
[0103] The enhanced operation pool includes horizontal flip, vertical flip, 90-degree rotation, brightness / contrast adjustment, Gaussian noise, and Gaussian blur.
[0104] Adaptive adjustment rules: ,in, To enhance the probability of the current batch of data, To increase the probability of the next batch of data, To adjust the step size (take 0.01-0.05), This represents the discriminator's prediction of the true samples in the current batch. The target predicted value is 0.6. This is a clamping function to ensure the probability of data augmentation. The value range is between 0 and 1 to avoid invalid enhancement of probability. (⋅) is the sign function, whose core function is to determine the direction of deviation between the current discriminator's predicted score and the target score. The rule is: if > 0. That is If >0.6, the sign function returns 1; if ,Right now 0.6, the sign function returns -1; if ,Right now = 0.6, the sign function returns 0. In the early stages of training, the discriminator has not yet learned the core features of the real samples, and its predictions of the real samples are... Approaching the target score of 0.6, at this point ,therefore In practice, the initial enhancement probability It can be set to 0 or a lower value (such as 0.1). At this time, the enhancement intensity is low, which reduces the interference of the enhancement operation on the real defect features, allowing the discriminator to quickly learn the core defect features of the EL image (such as the linear features of cracks and the blocky features of black cores).
[0105] As training progresses, if the discriminator's predictions for real samples consistently exceed 0.6 (e.g., 0.7, 0.8), it indicates that the discriminator has begun to memorize the features of the real samples, showing signs of overfitting. At this point... ,therefore That is, the probability of enhancement in the next batch will increase compared to the current probability. (For example, increasing from 0.1 to 0.13 increases the enhancement strength, and more samples will perform the operations in the enhancement operation pool, increasing the diversity of real samples, forcing the discriminator to abandon rote memorization and instead learn more general defect features and image structures, thus suppressing overfitting.)
[0106] In the later stages of training, if the discriminator's prediction value drops back to around 0.6 and remains stable, it indicates that the discriminator's generalization ability has met the standard. At this point, the augmentation probability for the next batch can be increased. Keep it unchanged, maintain the current enhancement intensity, and avoid over-enhancing to prevent training convergence; if < 0.6 (rarely occurs, indicating insufficient discriminator learning), then ,therefore This reduces the enhancement intensity, giving the discriminator sufficient opportunity to learn real sample features and avoids excessive interference from enhancement operations with discriminator training.
[0107] The noise scale space strategy includes: determining the corresponding hierarchical stage under each training process, and adjusting the noise standard deviation of the input generator according to the training process and hierarchical stage.
[0108] Specifically, the Noise Scale Space (NSS) training strategy employs a coarse-to-fine layered training approach to progressively optimize the quality of the generated images, adapting to the characteristics of EL images, which have minimal defects and high detail requirements. The training is divided into three stages, with parameter settings for each stage shown in the table below.
[0109]
[0110] The training stopping strategies include quality early stopping and mode collapse early stopping. Quality early stopping includes setting a quality threshold for generated images. If the quality values of generated images in multiple consecutive batches are all lower than the quality threshold, the training is invalid and training is stopped. Mode collapse early stopping includes stopping training and backtracking to the previous optimal training batch if the feature similarity of generated images in multiple consecutive batches exceeds the similarity threshold. The network parameters of the optimal training batch are saved.
[0111] Specifically, the quality early stop function can set a threshold for the quality score of the generated images (the quality score is calculated based on three dimensions: image sharpness, defect authenticity, and defect diversity). If the quality score of the generated images in five consecutive batches is lower than the threshold, the training is deemed invalid and training is stopped immediately.
[0112] Early stopping due to mode collapse means that if the similarity of generated image features in three consecutive batches exceeds 80% (indicating signs of mode collapse), training is immediately stopped, and the model parameters of the previous optimal training batch are saved to avoid model performance degradation.
[0113] Specifically, the training process is as follows: Based on the NSS training strategy configured in step S3, initial parameters for noise level and blur kernel size are set according to the stratified requirements of early, mid, and late stages. Simultaneously, dynamic fine-tuning is performed using real-time monitored training metrics (generated image quality score, generated image feature similarity, and loss difference between the generator and discriminator). If the generated image quality score remains consistently low, the noise standard deviation is appropriately reduced and the blur kernel size is decreased. If the feature similarity approaches the mode collapse threshold, the noise standard deviation is slightly increased to ensure the training adheres to the "coarse-to-fine" optimization logic. Data augmentation intensity is dynamically adjusted based on the adaptive discriminator augmentation strategy, combined with the discriminator's prediction score for real samples, to prevent premature overfitting. At the same time, the above three types of training metrics are calculated and monitored in real-time (where the quality score is calculated based on a weighted average of image sharpness, defect authenticity, and defect diversity; feature similarity is calculated using the cosine similarity of the core features of the generated image; and the loss difference is calculated using...). (Calculated), the monitoring results are used as the basis for adjusting the dynamic adversarial balancing strategy, and the learning rate and loss weights are adjusted in real time: the learning rate and training step ratio of the generator and discriminator are dynamically adjusted according to the loss difference, and the loss weights of the two are adjusted according to the feature similarity to determine whether there are signs of mode collapse. Throughout the training process, it is continuously judged whether any condition of the dual early stopping strategy is triggered. Once the quality early stopping or mode collapse early stopping is triggered, the training is immediately terminated, and the optimal model parameters corresponding to the batch with the highest image quality score and the lowest feature similarity during the training process are saved.
[0114] As can be seen, the dual-channel adaptive attention residual block (DCA-ResBlock) and feature alignment normalization (FAN) layer designed in this embodiment effectively solve the problems of unstable feature propagation and gradient vanishing through the dual-branch attention structure and residual connections. The FAN layer effectively solves the feature shift problem in small sample scenarios. At the same time, by combining the dynamic adversarial balancing strategy, spectral normalization and adversarial loss Hinge Loss, the gradient is further constrained, the training rhythm of the generator and discriminator is balanced, the fluctuation of generated image quality is reduced, and the problem of large batch quality differences is avoided.
[0115] S103, input the configured mixed noise vector and class adaptive embedding vector into the trained generator to generate the second image set, and merge the first image set and the second image set to obtain the third image set.
[0116] In this embodiment, the mixed noise vector and the class adaptive embedding vector are input into the trained generator to generate EL images (second image set) with the same size as the first image set. During the quality screening process, meaningless images, images with abnormal defect morphology, and images with insufficient clarity are removed, while valid images that conform to the actual defect morphology are retained. The screened second image set is merged with the first image set to obtain the expanded EL image dataset, i.e., the third image set, which effectively alleviates the problems of image set class imbalance and insufficient samples.
[0117] S104. Train the neural network based on the third image set to obtain the hidden crack detection model.
[0118] Specifically, this embodiment uses the YOLOv8 neural network, a commonly used detection network in this technical field. It is understood that other neural networks, such as variants of the YOLOv8 network and others, can also be used for defect detection. This embodiment does not specifically limit the type of neural network. The third image set is divided into a training set, a validation set, and a test set for training, validating, and testing the YOLOv8 neural network. Through training, the YOLOv8 neural network can accurately identify 12 types of defects in the electroluminescent images of photovoltaic modules, improving the detection model's ability to identify defects with few samples and its generalization ability.
[0119] It should be noted that the neural network is trained using the commonly used gradient descent method, which is a conventional training method well-known to those skilled in the art. Therefore, this embodiment will not describe it in detail.
[0120] S105, based on the microcrack detection model, performs defect detection on the electroluminescent image to be tested, and outputs the microcrack detection result to indicate whether the photovoltaic module has microcracks or not.
[0121] The above microcrack detection results indicate whether the photovoltaic module has microcracks or not. For example, a microcrack detection result of 1 indicates that the photovoltaic module has microcracks. As another example, a microcrack detection result of 0 indicates that the photovoltaic module does not have microcracks.
[0122] Figure 2 This is a schematic diagram of a photovoltaic module microcrack detection system provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the system includes:
[0123] Image acquisition module 210 is used to acquire a first image set; wherein, the first image set includes electroluminescent images of different defects in photovoltaic modules;
[0124] The first training module 220 is used to train a deep convolutional generative adversarial network (DGAN) consisting of a generator and a discriminator based on a first image set and a pre-configured training strategy. During training, the network parameters of the DGAN are dynamically adjusted in conjunction with real-time monitored training metrics until training stops and the trained generator is output. The training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training stopping strategy. The multi-constraint loss function is a function of the adversarial loss, perceptual loss, and defect feature constraint loss. The training metrics include the quality value of the generated image, the feature similarity of the generated image, and the loss difference between the generator and the discriminator.
[0125] Image processing module 230 is used to input the configured mixed noise vector and class adaptive embedding vector into the trained generator to generate a second image set, and to merge the first image set and the second image set to obtain a third image set;
[0126] The second training module 240 is used to train a neural network based on the third image set to obtain a hidden crack detection model.
[0127] The microcrack detection module 250 is used to perform defect detection on the electroluminescent image to be tested based on the microcrack detection model, and outputs the microcrack detection result to indicate whether the photovoltaic module has microcracks or not.
[0128] Specifically, in the technical solution provided by this invention, the fixed feature combination pattern of the generator is broken through the synergistic effect of mixed noise vector, class adaptive embedding vector, feature random shuffling and recombination module (FRM), which focuses on improving the generation priority of defects with few samples; at the same time, the discriminator adopts a three-branch structure, in which the diversity discrimination branch forces the generation of diverse samples from the adversarial level, and combined with the mini-batch discrimination layer, effectively suppresses pattern collapse; thus, the generated image samples can cover all defect patterns of real data, effectively alleviating the problem of class imbalance in the dataset.
[0129] In the technical solution provided by this invention, a multi-constraint joint loss function is designed, which includes adversarial loss, perceptual loss, and defect feature constraint loss. The defect feature constraint loss specifically guides the generator to generate images that conform to the real defect morphology, while the perceptual loss ensures that the overall structure of the generated image is consistent with the real image. By combining a noise scale space training strategy and category-aware conditional generation, the detail quality of the generated image is gradually optimized, thereby significantly improving the quality of the generated image and effectively suppressing the generation of meaningless images.
[0130] This application provides a photovoltaic module microcrack detection system, which is similar to the one described above. Figure 1 The photovoltaic module microcrack detection method shown is a technical solution based on the same inventive concept. Through the detailed description of the photovoltaic module microcrack detection method provided in the above embodiments, those skilled in the art can clearly understand the implementation process of the photovoltaic module microcrack detection system in this embodiment. Therefore, for the sake of brevity, it will not be described again here.
[0131] This invention also provides an electronic device. The electronic device includes a processor, a memory, a communication interface, and at least one communication bus for connecting the processor, the memory, and the communication interface. The memory includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (PROM), or portable read-only memory (CD-ROM), and is used for related instructions and data.
[0132] The communication interface is used to receive and send data. The processor can be one or more CPUs; if the processor is a single CPU, it can be a single-core CPU or a multi-core CPU. The processor in the electronic device is used to read one or more programs stored in memory and perform the following operations: acquire a first image set; wherein the first image set includes electroluminescent images of different defects in photovoltaic modules; train a deep convolutional generative adversarial network (DGAN) consisting of a generator and a discriminator according to the first image set and a pre-configured training strategy, dynamically adjusting the network parameters of the DGAN during training by incorporating real-time monitored training metrics until training stops, and outputting the trained generator; wherein the training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training... The stopping strategy is as follows: the multi-constraint loss function is a joint function of adversarial loss, perceptual loss, and defect feature constraint loss; training metrics include the quality value of the generated image, the feature similarity of the generated image, and the loss difference between the generator and the discriminator; the configured mixed noise vector and the class adaptive embedding vector are input into the trained generator to generate a second image set, and the first image set and the second image set are merged to obtain a third image set; a neural network is trained based on the third image set to obtain a hidden crack detection model; based on the hidden crack detection model, defect detection is performed on the electroluminescent image to be detected, and the hidden crack detection result is output to indicate whether the photovoltaic module has hidden cracks or not.
[0133] It should be noted that the specific implementation of each operation can be described above. Figure 1 The corresponding description of the method embodiments shown indicates that electronic devices can be used to execute a photovoltaic module microcrack detection method according to the above method embodiments of this application, which will not be described in detail here.
[0134] This invention also provides a computer-readable storage medium, which is a memory device in a computer device for storing programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the operating system of the terminal. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by a processor, which can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the photovoltaic module microcrack detection method in the above embodiments. Those skilled in the art should understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0135] This invention also provides a computer program product containing program instructions. The computer program product can be software or program products containing program instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one electronic device, it causes the at least one electronic device to perform a method for detecting microcracks in photovoltaic modules.
[0136] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting microcracks in photovoltaic modules, characterized in that the method... include: Acquire a first image set; wherein the first image set includes electroluminescent images of different defects in photovoltaic modules; The deep convolutional generative adversarial network (DGAN), consisting of a generator and a discriminator, is trained based on a first image set and a pre-configured training strategy. During training, the network parameters are dynamically adjusted in conjunction with real-time monitored training metrics until training stops, at which point the trained generator is output. The training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training stopping strategy. The multi-constraint loss function is a joint function of adversarial loss, perceptual loss, and defect feature constraint loss. The training metrics include the quality value of the generated images, the feature similarity of the generated images, and the loss difference between the generator and the discriminator. The configured mixed noise vector and class adaptive embedding vector are input into the trained generator to generate the second image set. The first image set and the second image set are merged to obtain the third image set. A hidden crack detection model is obtained by training a neural network based on the third image set. The microcrack detection model is used to detect defects in the electroluminescent images under test, and outputs microcrack detection results to indicate whether the photovoltaic module has microcracks or not.
2. The method for detecting microcracks in photovoltaic modules according to claim 1, characterized in that, The generator includes a serial input layer, a fully connected layer, an upsampling module layer, a feature random shuffling and recombination module, and an output layer; wherein the upsampling module layer includes multiple serial upsampling modules; The discriminator branches include parallel authenticity discrimination branches, scale consistency discrimination branches, and diversity discrimination branches; wherein, each discriminator branch includes a serial input layer, a downsampling module layer, a mini-batch discrimination layer, and an output layer, and the downsampling module layer includes multiple serial downsampling modules.
3. The method for detecting microcracks in photovoltaic modules according to claim 2, characterized in that, The upsampling module includes a serial dual-channel adaptive attention residual block, a transposed convolutional layer, a feature alignment normalization layer, and a Slope LeakyReLU activation function layer; wherein the slope of the Slope LeakyReLU activation function layer is greater than 1 on the positive half-axis.
4. The method for detecting microcracks in photovoltaic modules according to claim 2, characterized in that, The generator's input layer concatenates the input mixed noise vector and the class-adaptive embedding vector to obtain a concatenated vector; the fully connected layer maps the concatenated vector to a feature map; the upsampling module enlarges the size of its respective input feature maps; the feature random shuffling and recombination module randomly selects an intermediate feature map output by the upsampling module, performs feature shuffling, recombination, and weighted fusion processing, and adds random features to output a multi-channel feature map; the generator's output layer maps the multi-channel feature map to a single-channel feature map and maps the pixel values of the single-channel feature map to the [-1, 1] interval to output an electroluminescent grayscale image; The input layer of the discriminator branch receives a first image set and a category condition vector, the category condition vector corresponding to a category adaptive embedding vector; the downsampling module layer extracts the depth features of the images in the first image set; The mini-batch discriminant layer performs mini-batch discrimination on deep features, calculates the feature similarity matrix of samples within the same batch, and outputs discriminant features. The output layer of the discriminator branch integrates the discriminant features and outputs the discriminant score of the discriminator branch.
5. The method for detecting microcracks in photovoltaic modules according to claim 1, characterized in that, The dynamic adversarial balancing strategy includes adaptive learning rate adjustment and dynamic weight allocation; wherein, the adaptive learning rate adjustment includes: calculating the loss difference between the generator and the discriminator in real time, and dynamically adjusting the learning rates of the generator and the discriminator according to the relationship between the loss difference and the threshold; the dynamic weight allocation includes: during the training process, if the feature similarity of multiple consecutive batches of generated images exceeds the similarity threshold, then adjusting the loss weights of the generator and the discriminator. The adaptive discriminator enhancement strategy includes: determining the relationship between the predicted value and the target predicted value of the current batch of images under each training process, and adjusting the intensity of the image enhancement operation according to the training process and the relationship. The noise scale space strategy includes: determining the corresponding hierarchical stage under each training process, and adjusting the noise standard deviation of the input generator according to the training process and the hierarchical stage; The training stopping strategy includes quality early stopping and mode collapse early stopping; wherein, quality early stopping includes: setting a quality threshold for generated images, and if the quality values of generated images in multiple consecutive batches are all lower than the quality threshold, then the training is invalid and training is stopped; mode collapse early stopping includes: if the feature similarity of generated images in multiple consecutive batches exceeds a similarity threshold, then training is stopped and backtracked to the previous optimal training batch, and the network parameters of the optimal training batch are saved.
6. The method for detecting microcracks in photovoltaic modules according to claim 1, characterized in that, The mixed noise vector includes Gaussian noise, defect feature noise, and random perturbation noise; The category-adaptive embedding vector is a multi-dimensional vector composed of different defects; where each dimension vector corresponds to a type of defect of the photovoltaic module with hidden cracks.
7. The method for detecting microcracks in photovoltaic modules according to claim 6, characterized in that, The weights of the category adaptive embedding vector are adjusted based on the number of defective samples.
8. A photovoltaic module microcrack detection system, characterized in that, The system includes: An image acquisition module is used to acquire a first image set; wherein, the first image set includes electroluminescent images of different defects in photovoltaic modules; The first training module is used to train a deep convolutional generative adversarial network (DGAN) consisting of a generator and a discriminator based on a first image set and a pre-configured training strategy. During training, the network parameters of the DGAN are dynamically adjusted in conjunction with real-time monitored training metrics until training stops and the trained generator is output. The training strategy includes a multi-constraint loss function, a dynamic adversarial balancing strategy, an adaptive discriminator enhancement strategy, a noise scale space strategy, and a training stopping strategy. The multi-constraint loss function is a joint function of adversarial loss, perceptual loss, and defect feature constraint loss. The training metrics include the quality value of the generated image, the feature similarity of the generated image, and the loss difference between the generator and the discriminator. The image processing module is used to input the configured mixed noise vector and class adaptive embedding vector into the trained generator to generate a second image set, and to merge the first image set and the second image set to obtain a third image set. The second training module is used to train the neural network based on the third image set to obtain the hidden crack detection model. The microcrack detection module is used to perform defect detection on the electroluminescent image under test based on the microcrack detection model, and outputs the microcrack detection result to indicate whether the photovoltaic module has microcracks or not.
9. An electronic device, characterized in that, Including memory and processor; A memory for storing computer programs, the computer programs including program instructions; A processor is configured to execute the program instructions to cause the electronic device to perform the steps of a photovoltaic module microcrack detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a computer program that, when executed by one or more processors, implements a method for detecting microcracks in photovoltaic modules as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Photovoltaic module fault diagnosis method, system and device based on deep convolutional adversarial network
CN110414601A
Underwater image quality recovery method and device, electronic equipment and storage medium
CN114581317A
Underwater image enhancement method and system based on feature learning and multi-dimensional replacement
CN118333884A
Fan blade surface damage detection method based on lightweight YOLOv8
CN119887756A
Industrial PCB defect identification method based on sample generation model
CN120278974A