Solar panel defect detection method and system, computer device and storage medium
A solar panel defect detection method combining a lightweight model and a generative adversarial network solves the problems of insufficient detection accuracy and difficulty in handling weak defects, achieving efficient and low-cost real-time detection, adapting to remote power plant scenarios, and supporting operation and maintenance decisions.
Patent Information
- Application Number
- CN202511700743.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-11-19
AI Technical Summary
Existing solar panel inspection technologies suffer from insufficient defect detection accuracy, difficulty in handling minor defects, and poor adaptability to edge computing, which hinders the intelligent operation and maintenance process of solar power plants.
We employ a method that combines lightweight defect screening with adaptive imaging, multi-scale attention nested network (MSAN-Net) segmentation, generative adversarial network (GAN) enhancement, and multi-dimensional performance evaluation, along with UAV edge computing and cloud collaboration, to achieve real-time high-precision defect detection.
It significantly improves defect detection accuracy, reduces the rate of missed and false detections of minor defects, lowers equipment costs, adapts to remote power plant scenarios, supports operation and maintenance decisions, and reduces operation and maintenance costs.
Smart Images

Figure CN121169915B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent detection technology for new energy equipment, and particularly relates to a method, system, computer equipment and storage medium for detecting defects in solar panels. Background Technology
[0002] With the rapid development of the global new energy industry, the scale of solar power plants is constantly expanding. As the core component of a solar power plant, the operating status of solar panels directly affects the power generation efficiency and operational safety of the plant.
[0003] Therefore, regular inspections of solar panels are particularly important. Traditional inspection methods mainly include manual inspection and traditional machine vision inspection. However, current mainstream inspection technologies have the following drawbacks: insufficient defect detection accuracy, difficulty in handling minor defects, and poor adaptability to edge computing, which seriously restricts the progress of intelligent operation and maintenance of power plants.
[0004] Therefore, there is an urgent need to develop a new detection technology that integrates efficient data acquisition, accurate defect identification, and weak defect enhancement functions to break through the existing technological bottlenecks. Summary of the Invention
[0005] This invention discloses a method, system, computer equipment, and storage medium for detecting defects in solar panels, which mainly solves the problems of insufficient detection accuracy, difficulty in handling weak defects, and poor adaptability of edge computing in current solar panel defect detection.
[0006] To achieve the aforementioned objective, the present invention provides a method for detecting defects in solar panels, comprising the following steps:
[0007] Lightweight defect screening and adaptive shooting steps: The solar panel array is identified and images are acquired using a lightweight model at the edge of the drone;
[0008] Defect segmentation and type identification steps: The solar panel and defects are accurately segmented using a neural network model, and the defect type and level are determined by combining feature extraction and classification models;
[0009] Defect enhancement and optimization steps: Enhance defects using adversarial networks;
[0010] Detection performance evaluation steps: Quantitatively evaluate the overall performance of the system through multi-dimensional indicators.
[0011] The lightweight defect screening and adaptive imaging steps include the following steps:
[0012] Defect screening and shooting steps: By mounting a lightweight target detection model on the edge of the drone, the edge is detected in real time. The bounding box and class probability of the solar panel array in the image are predicted by a single neural network to identify the array in real time. Finally, the drone automatically locates the four corner points of the array and calculates the actual length and width of the array by combining the camera intrinsic parameters and flight altitude.
[0013] Optimal shooting distance and altitude calculation steps: Calculate the optimal shooting distance based on the array position, and dynamically adjust the waypoint altitude and horizontal offset based on the UAV's flight parameters to plan the UAV's path;
[0014] Real-time image analysis steps: AI correction is used to analyze the offset of the solar panel edge in the image in real time, and the offset signal is fed back to the gimbal control module. Then, the PID closed-loop adjustment algorithm is used to adjust the gimbal angle so that the solar panel is always in the center area of the image.
[0015] Defect detection threshold setting steps: When the model detects a suspected defect area or a target-sized part, the lens zoom is automatically triggered to enhance the details of the target area.
[0016] Furthermore, the defect segmentation and type identification steps include the following steps:
[0017] Inspection image segmentation steps: A multi-scale attention nested network is used to segment the inspection image;
[0018] Feature vector construction steps: Based on the segmented defect region, extract multi-dimensional features and construct feature vectors;
[0019] Feature vector input steps: Input the defect feature vector into the lightweight CNN classification model;
[0020] The multi-scale attention nested network adopts the MSAN-Net structure, and the multi-dimensional features include defect area, defect perimeter, average temperature of defect region, and maximum temperature.
[0021] The multi-scale attention nested network adopts the MSAN-Net structure, and the multi-dimensional features include defect area, defect perimeter, average temperature of defect region, and maximum temperature.
[0022] The MSAN-Net structure includes:
[0023] Encoder optimization module: adopts ResNet-18 architecture;
[0024] The decoder optimization module includes an upsampling module, an attention mechanism module, a multi-scale feature fusion module, and a feature focus supervision module. The upsampling module restores the spatial resolution of the feature map through bilinear interpolation and makes skip connections with the corresponding layer features of the encoder. The attention mechanism module introduces the correlation between channels and space in the decoder to guide the fine-scale features with coarse-scale features. The multi-scale feature fusion module is used to selectively fuse the output features of the first, second, and third sub-modules of the decoder. The feature focus supervision module performs deep supervision on the first, second, and third sub-modules of the decoder through multi-level lateral outputs.
[0025] Furthermore, the loss function used in the MSAN-Net structure for:
[0026] ;
[0027] in, This is a global supervision loss function used to monitor the difference between the predictions of the final output layer of the network and the true labels. The feature-focusing loss function is used to supervise the feature learning of different intermediate layers in the decoder, thereby enhancing the defect feature extraction capability; among them,
[0028] ;
[0029] in, This is represented as a weighted mapping based on the distance transformation of the defect boundary, assigning higher weights to boundary pixels; This is represented as a weighted mapping based on the defect area, assigning higher weights to smaller defect areas; Indicates control parameters, The pixel category representing the actual label. This represents the pixel category probability value predicted by the model; This represents an improved weighting map used to balance class frequencies and enhance defect boundary and small defect learning.
[0030] Feature-focusing loss function The calculation method is the same as that of the global supervision loss function, which is a weighted cross-entropy loss. The input data of the feature focusing loss function is the lateral output of the intermediate layer of the decoder. The feature focusing loss function shares the weight mapping of the global supervision loss function.
[0031] Furthermore, the defect enhancement and optimization step includes the following steps:
[0032] Generative Adversarial Network (GAN) Construction Steps: Construct a photovoltaic defect-enhancing GAN and design a dedicated GAN;
[0033] Loss function design steps: Use a composite loss function that combines adversarial loss and perceptual loss;
[0034] Enhancement steps: Enhancement effect verification and secondary testing, enhancement effect evaluation;
[0035] The generative adversarial network includes a generator and a discriminator. The generator adopts a U-Net structure, takes a defect region map as input, and outputs an enhanced defect image through multi-layer downsampling and multi-layer upsampling combined with residual connections. The discriminator adopts a PatchGAN structure, takes the enhanced image and the defect image as input, judges the authenticity of the image through multi-layer convolution, and outputs a patch-level probability map to improve the ability to distinguish local details.
[0036] Furthermore, in the adversarial loss, the generator's loss is: The loss of the discriminator is: ;
[0037] in, The image is a low-quality defect image. To provide true, high-quality defect images. For generator output, For discriminator output;
[0038] The perceptual loss, based on the fifth convolutional feature of the pre-trained VGG-16 network, is used to calculate the feature difference between the generated image and the real image. The formula is as follows:
[0039] ;
[0040] in, For VGG-16 feature extraction function, These represent the number of channels, height, and width of the feature map, respectively.
[0041] The composite loss function is as follows: ;
[0042] The enhancement effect evaluation uses peak signal-to-noise ratio and structural similarity as quantitative indicators;
[0043] In the enhancement step, the enhanced defect image is re-input into the MSAN-Net network for secondary segmentation, and the optimized defect features are extracted; a voting mechanism is used to fuse the initial and secondary segmentation results.
[0044] Furthermore, the detection performance evaluation step includes the following steps:
[0045] The data statistics and benchmark determination steps include: system detection data statistics, actual defect benchmark determination, and determination of actual defect conditions. The system detection data statistics involve calculating the total number of defects output by the system, the number of each type of defect, and the defect area and characteristic parameters before and after enhancement. The actual defect benchmark determination is a confirmation method combining manual review and high-precision equipment inspection. Determining the actual defect conditions involves manually inspecting each solar panel using a high-definition camera, marking the defect location and type; simultaneously, an infrared thermal imager scans the hot spot area, and an industrial camera is used for verification to determine the actual defect conditions.
[0046] The core metrics calculation steps include: defect detection accuracy, defect detection recall, F1 score, and enhancement effect metrics.
[0047] Performance evaluation and alarm steps include performance level classification, parameter optimization alarms, and establishment of a results database.
[0048] In another aspect, the present invention provides a solar panel defect detection system, which, based on the above-described solar panel defect detection method, comprises:
[0049] Solar panel identification and adaptive shooting module: Deployed at the edge of the drone, it integrates a visible light camera and an infrared thermal imager, runs a lightweight model, identifies and locates the solar panel array in real time and calculates its size, dynamically generates 3D waypoints to plan the inspection path; it keeps the solar panel in the center of the image, triggers adaptive zoom to enhance the details of suspected defective areas, and outputs inspection images.
[0050] Multi-scale defect segmentation module: Partly deployed at the edge of the drone and partly deployed on the local server, it performs pixel-level segmentation on the inspection image by running the MSAN-Net network, extracts the solar panel and defect areas; extracts multi-dimensional features of defects and constructs multi-dimensional feature vectors; runs a lightweight CNN classification model to determine the defect type; outputs preliminary defect detection results and transmits them to the generative adversarial network defect enhancement module.
[0051] Generative Adversarial Network (GAN) Defect Enhancement Module: Deployed on a local server, it communicates with the multi-scale defect segmentation module. By loading a pre-trained photovoltaic defect enhancement GAN model, it receives defect region images, generates enhanced defect images, and transmits the enhanced defect images to the MSAN-Net network for secondary segmentation.
[0052] Extract optimized features, fuse the initial and secondary segmentation results, and output the final defect detection results;
[0053] Detection performance evaluation module: Deployed on a local server, connected to the defect result database, it calculates accuracy, recall, F1-score, and enhancement effect indicators by statistically analyzing the system's detection data and actual defect benchmark data; evaluates the system's performance level and generates a performance evaluation report; triggers parameter optimization alarms when indicators fall below thresholds; and manages the defect detection result database.
[0054] In another aspect, the present invention provides an electronic device, comprising:
[0055] Processor: Used to configure the above-mentioned solar panel defect detection method when executing instructions;
[0056] Memory: Used to store processor-executable instructions. The stored content includes lightweight YOLO model weights, MSAN-Net network parameters, GAN model parameters, defect detection result database, and benchmark dataset.
[0057] In another aspect, the present invention provides a computer-readable storage medium storing a program that instructs a device to perform the above-described solar panel defect detection method.
[0058] The technical solution provided by this invention has at least the following technical effects:
[0059] Real-time detection is achieved through edge deployment, eliminating reliance on the cloud and making it particularly suitable for remote power plant scenarios. An improved MSAN-Net network is used for segmentation, significantly enhancing defect detection accuracy. Combined with GAN defect enhancement technology, the false negative and false positive rates of subtle defects are effectively reduced, meeting the needs of refined solar panel operation and maintenance. Through feature enhancement and detail restoration using generative adversarial networks, the identification of low-contrast and small-sized defects is greatly improved, successfully solving the problem of traditional algorithms struggling to identify minute defects.
[0060] By employing lightweight models and small-to-medium-sized drones, equipment costs are significantly reduced compared to manual inspections. Simultaneously, edge deployment ensures seamless real-time detection without cloud reliance, further adapting to remote power plant scenarios. Operational and maintenance decision support capabilities are significantly enhanced. Through the establishment of a defect detection result database and performance evaluation mechanism, full lifecycle tracking of defects and system self-optimization are achieved. This provides data-driven decision-making support for solar panel replacement and power plant efficiency improvement, effectively reducing power plant operation and maintenance costs. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1 This is a schematic diagram of the solar panel defect detection method according to an embodiment of the present invention;
[0063] Figure 2 This is a schematic diagram illustrating the automatic measurement of solar panel array dimensions and waypoint planning in an embodiment of the present invention.
[0064] Figure 3 This is a structural diagram of the MSAN-Net multi-scale attention nested network according to an embodiment of the present invention;
[0065] Figure 4 This is a schematic diagram of the photovoltaic defect enhancement generative adversarial network structure according to an embodiment of the present invention;
[0066] Figure 5 This is a schematic diagram of a solar panel defect detection system module according to an embodiment of the present invention.
[0067] Figure 6 This is a schematic diagram of the electronic device according to an embodiment of the present invention. Detailed Implementation
[0068] The embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the embodiments of the present invention, and should not be construed as limiting the present invention.
[0069] Example 1: This example discloses a method for detecting defects in solar panels, such as... Figure 1 As shown, it includes the following steps:
[0070] Lightweight defect screening and adaptive imaging steps: The lightweight model at the edge of the drone enables rapid identification and high-quality image acquisition of the solar panel array, laying a data foundation for subsequent defect detection.
[0071] Defect segmentation and type identification steps: The solar panel and defects are accurately segmented using a neural network model (improved MSAN-Net network), and the defect type and level are determined by combining feature extraction and classification models.
[0072] Defect enhancement and optimization steps: Defects are enhanced through adversarial networks; specifically, for difficult-to-detect defects such as low contrast and small size, defect enhancement is performed through generative adversarial networks (GANs) to improve defect recognition and reduce the false negative rate.
[0073] Detection performance evaluation steps: The overall system performance is quantitatively evaluated using multi-dimensional indicators. This ensures the reliability of the detection results and provides a basis for model iterative optimization.
[0074] Specifically, in this embodiment, the lightweight defect screening and adaptive imaging steps include the following steps:
[0075] Defect screening and shooting steps: By mounting a lightweight target detection model (lightweight YOLO model) on the edge of the drone, and predicting the bounding box and class probability of the solar panel array in the image through a single neural network, the array is identified in real time. Finally, the drone automatically locates the four corner points of the array, and calculates the actual length and width of the array by combining camera intrinsic parameters and flight altitude.
[0076] YOLO (You Only Look Once) is a high-efficiency real-time object detection algorithm. Its core principle is to transform object detection into a regression problem, completing object localization and classification in a single forward propagation. To meet the low computing power requirements of edge computing devices like drones, YOLO models often employ techniques such as pruning, quantization, and knowledge distillation for optimization. For example, YOLOv5 can run at up to 30 frames per second on the Jetson TX2 platform, while YOLOv8 achieves 80 FPS in pole detection tasks. YOLOv11 further improves detection accuracy and speed through a more efficient backbone network and dynamic feature fusion.
[0077] like Figure 2 As shown, after the UAV identifies the solar array using the YOLO model, it automatically locates key points and adjusts its flight attitude to calculate the solar panel array. This process relies on the YOLO model to identify and locate the array position. It determines the target by regressing the bounding box coordinates and, combined with the geometric relationships in the image, calculates the actual distribution position of the array.
[0078] Optimal shooting distance and altitude calculation steps: Calculate the optimal shooting distance based on the array position, and dynamically adjust the waypoint altitude and horizontal offset based on the UAV's flight parameters to plan the UAV's path;
[0079] Specifically, 3D waypoints for the UAV are dynamically generated based on the array positioning to plan the inspection path. 3D waypoint generation needs to consider array height, distribution location, UAV flight parameters (such as flight altitude, speed, and turn angle), and environmental factors (such as wind speed and obstacle distribution). The array position information output by the YOLO model is used as input for waypoint generation. Combined with the UAV's 3D modeling capabilities, the optimal waypoint path is generated, ensuring that the overlap rate between adjacent images is no less than half the array size.
[0080] Real-time image analysis steps: AI-based edge correction technology is used to analyze the offset of the solar panel edges in the image in real time, and the offset signal is fed back to the gimbal control module. Then, a PID closed-loop adjustment algorithm is used to adjust the gimbal angle, ensuring the solar panel remains centered in the image. This reduces edge distortion and minimizes attitude fluctuations during drone flight. The bounding box coordinates output by the YOLO model can be used to calculate the array's positional offset in the image. Combined with the PID algorithm, automatic gimbal adjustment is achieved. For example, in tower and positioning detection tasks, the bounding box coordinates output by YOLOv11 can support edge correction control.
[0081] Defect detection threshold setting steps: When the model detects a suspected defect area or a target size (small size) part, the lens zoom is automatically triggered to enhance the details of the target area and ensure that the subsequent segmentation algorithm can accurately extract defect features.
[0082] Specifically, when a suspected defective region or encapsulated border component is detected, the lens automatically zooms to enhance image details. When detecting small targets, the YOLO model employs multi-scale detection strategies or introduces attention mechanisms (such as CBAM) to improve detection accuracy. For example, YOLOv5 enhances the feature transfer of small targets through an improved PANet feature fusion structure, YOLOv8 leverages an anchor-free detection mechanism and an optimized loss function, and YOLOv11 relies on a more efficient backbone network and dynamic feature fusion mechanism, all of which enhance small target detection performance. In practical applications, a threshold can be set based on the proportion of the array distribution size; when the target region's proportion is less than the threshold, a zoom operation is triggered.
[0083] Specifically, in this embodiment, the defect segmentation and type identification steps include the following steps:
[0084] Inspection image segmentation steps: A multi-scale attention nested network is used to segment the inspection image; specifically, in this embodiment, the MSAN-Net multi-scale attention nested network structure is used, which is often used for accurate segmentation in complex backgrounds. A deep learning image segmentation algorithm is used to perform pixel-level segmentation of the solar panels and suspected defect areas in the inspection image, distinguishing between the panel body, the border, and the defect area.
[0085] Feature vector construction steps: Based on the segmented defect region, extract multi-dimensional features and construct feature vectors; among which, multi-dimensional features include defect area, defect perimeter, average temperature of defect region and maximum temperature, etc.
[0086] Feature vector input steps: Input the defect feature vector into the lightweight CNN classification model; determine the defect type and output the defect level. The classification model adopts a lightweight CNN structure and is pre-trained on the photovoltaic defect dataset through transfer learning. The defect level judgment criteria are: Level 1: Slight, no significant performance impact; Level 2: Moderate, local performance degradation; Level 3: Severe, affecting overall power generation efficiency.
[0087] like Figure 3 As shown, in this embodiment, the MSAN-Net structure includes:
[0088] Encoder optimization module: adopts ResNet-18 structure; ResNet-18 structure replaces the original ResNet-50, while retaining four residual blocks to ensure multi-scale feature extraction capability.
[0089] The decoder optimization module includes an upsampling module, an attention mechanism module, a multi-scale feature fusion module, and a feature focusing supervision module. The upsampling module restores the spatial resolution of the feature map through bilinear interpolation and makes skip connections with the corresponding layer features of the encoder. The attention mechanism module introduces the correlation between channels and space in the decoder to guide the fine-scale features with coarse-scale features. It compresses the channel dimension through 1×1 convolution to generate attention-weighted feature maps for each level. The multi-scale feature fusion module selectively fuses the output features of the first, second, and third sub-modules of the decoder to construct a multi-scale feature pyramid. The feature pyramid structure is used to fuse the mid-layer features of the decoder to enhance the multi-scale representation capability. The feature focusing supervision module performs deep supervision on the first, second, and third sub-modules of the decoder through multi-level lateral outputs. After unifying the scale of the multi-scale fused features with the final output through 1×1 convolution, it calculates the auxiliary loss with the real label.
[0090] In this embodiment, the loss function used in the MSAN-Net structure for:
[0091] ;
[0092] in, This is a global supervision loss function used to monitor the difference between the predictions of the final output layer of the network and the true labels. The feature-focusing loss function is used to supervise the feature learning of different intermediate layers in the decoder, thereby enhancing the defect feature extraction capability; among them,
[0093] ;
[0094] in, This is represented as a weighted mapping based on the distance transformation of the defect boundary, assigning higher weights to boundary pixels; This is represented as a weighted mapping based on the defect area, assigning higher weights to smaller defect areas; Indicates control parameters, The pixel category representing the actual label. This represents the pixel category probability value predicted by the model; This represents an improved weighting map used to balance class frequencies and enhance defect boundary and small defect learning.
[0095] Feature-focusing loss function The calculation method is the same as that of the global supervision loss function, which is a weighted cross-entropy loss. The input data of the feature focusing loss function is the lateral output of the intermediate layer of the decoder. The feature focusing loss function shares the weight mapping of the global supervision loss function.
[0096] Specifically, in this embodiment, the defect enhancement and optimization steps include the following steps:
[0097] Generative Adversarial Network (GAN) Construction Steps: Construct a photovoltaic defect-enhancing GAN and design a dedicated GAN;
[0098] Loss function design steps: Use a composite loss function that combines adversarial loss and perceptual loss;
[0099] The enhancement process includes: enhancement effect verification and secondary detection, and enhancement effect evaluation. Specifically, the enhanced defect image is re-input into the MSAN-Net network for secondary segmentation, and the optimized defect features are extracted. A voting mechanism is used to fuse the initial and secondary segmentation results. The peak signal-to-noise ratio and structural similarity are used as quantitative indicators to evaluate the enhancement effect.
[0100] The Generative Adversarial Network (GAN) consists of a generator and a discriminator. The generator adopts a U-Net structure, taking a low-quality defect region image as input. It outputs an enhanced defect image by performing 6 layers of downsampling and 6 layers of upsampling, combined with residual connections. The discriminator adopts a PatchGAN structure, taking the enhanced image and a real high-quality defect image as input. It judges the authenticity of the image by performing 4 layers of convolution, and outputs a 32×32 patch-level probability map to improve the ability to distinguish local details.
[0101] like Figure 4 As shown, Generative Adversarial Networks (GANs) employ a dual-network architecture. The generator in the U-Net structure, through the symmetrical design of the encoder and decoder, can capture global features while preserving local details, making it suitable for repairing subtle features such as photovoltaic defects. The discriminator in the PatchGAN structure, by judging the realism of local regions (patches) in the image, can more finely constrain the detail quality of the generated image, ensuring the realistic restoration of defect features.
[0102] The segmented low-quality defect region image is input into the generator. The generator performs detail restoration and contrast enhancement on the defect region through multi-scale feature extraction and residual connections. The multi-scale feature extraction mechanism enables the generator to adapt to photovoltaic defects of different sizes, and captures multi-dimensional information of defects through hierarchical feature fusion. The residual connections effectively alleviate the gradient vanishing problem in deep network training, ensuring that subtle defect features are not lost during network propagation, thereby achieving the restoration of blurred edges and the enhancement of low-contrast regions.
[0103] The discriminator distinguishes between the generated enhanced image and the real high-quality defect image. Adversarial training optimizes the generator parameters, making the enhanced image approximate the features of the real defect. The adversarial training process achieves iterative parameter optimization through a game between the generator and the discriminator: the generator strives to generate highly realistic defect images sufficient to "deceive" the discriminator, while the discriminator continuously improves its ability to distinguish between real and fake images. This dynamic balance mechanism prompts the generator to learn the essential features of the real defect, and the final output enhanced image retains the location information of the original defect while visually approaching the high-quality samples captured by professional equipment.
[0104] The enhanced defect image is re-input into the MSAN-Net network for secondary segmentation and feature extraction, optimizing the defect detection results. The secondary segmentation process utilizes the clearer defect features after enhancement, compensating for potential missed or false detections in the initial segmentation of the original low-quality image. Through its multi-scale attention mechanism, the MSAN-Net network can focus on key enhanced defect regions, further improving the accuracy of segmentation boundaries and the robustness of feature extraction, ultimately outputting more reliable defect detection results.
[0105] The composite loss function includes adversarial loss, where adversarial loss is based on minimax game theory.
[0106] In adversarial loss, the generator's loss is: The loss of the discriminator is: ;
[0107] in, The image is a low-quality defect image. To provide true, high-quality defect images. For generator output, For discriminator output;
[0108] The composite loss function also includes perceptual loss, which is based on the fifth layer convolutional features of the pre-trained VGG-16 network and is used to calculate the feature differences between the generated image and the real image. The formula is as follows:
[0109] ;
[0110] in, For VGG-16 feature extraction function, These represent the number of channels, height, and width of the feature map, respectively.
[0111] The composite loss function is: ;
[0112] In this embodiment, the detection performance evaluation step includes the following steps:
[0113] The data statistics and benchmark determination steps include: system detection data statistics, actual defect benchmark determination, and determination of actual defect conditions. System detection data statistics refer to the statistical analysis of the total number of defects output by the system, the number of various types of defects, and the defect area and characteristic parameters before and after enhancement, which serve as the basis for subsequent experiments. Actual defect benchmark determination refers to a confirmation method combining manual verification and high-precision equipment inspection. Determining actual defect conditions involves manually inspecting each solar panel using a high-definition camera, marking the defect location and type; simultaneously, a professional infrared thermal imager is used to scan the hot spot area, and a high-resolution industrial camera is used for verification, which serves as the benchmark dataset.
[0114] The system uses the detection results output by the defect detection model to perform total statistics and classification, covering various types of photovoltaic defects. This provides basic data for subsequent performance index calculations and intuitively reflects the system's detection coverage capability for different types of defects. The actual total number of defects is determined by a combination of comprehensive manual inspection and high-precision scanning with an infrared thermal imager. Manual inspection relies on professional experience to identify subtle defects, while the infrared thermal imager captures latent thermal defects through temperature field distribution. The two complement each other to form a baseline true value, ensuring the completeness and accuracy of the statistical results.
[0115] The core metric calculation steps include: defect detection accuracy, defect detection recall, F1 score, and enhancement effect metrics; among them, the formula for calculating defect detection accuracy is as follows: The recall rate is used to measure the proportion of true defects in the system's detection results. The number of correctly detected defects is determined through manual verification combined with comparison to a benchmark defect dataset. The number of correctly detected defects refers to the number of defects whose detection results match the benchmark dataset, reflecting the system's ability to avoid false detections. The formula for calculating the defect detection recall rate is: This reflects the system's ability to detect actual defects. The higher the value, the fewer defects are missed, reflecting the system's ability to avoid missing defects.
[0116] The F1-score is a combined metric of precision and recall, calculated using the following formula: As the harmonic mean of accuracy and recall, F1 score comprehensively balances the effects of both and can more fully evaluate the system's defect detection capability. In photovoltaic defect detection, a higher F1 score indicates that the system has achieved a better balance between reducing false positives and false negatives.
[0117] Enhancement effectiveness metrics are calculated by evaluating the average PSNR and SSIM of all enhanced images to assess the defect enhancement effect. Specifically, the average PSNR (Peak Signal-to-Noise Ratio) and average SSIM (Structural Similarity) of all enhanced images are calculated. PSNR quantifies the pixel error of the images before and after enhancement, while SSIM assesses the structural consistency of the images. Both reflect the enhancement effect of the generative adversarial network on defective regions from different perspectives. The higher the average PSNR and SSIM, the more significant the improvement in detail and sharpness of the enhanced image while preserving the original defect information.
[0118] Performance evaluation and alarm steps: This refers to the system automatically triggering an alarm when the accuracy or recall rate falls below the set standard, prompting the need to optimize model parameters; Performance level classification: This refers to classifying system performance into three levels based on the indicator results, namely minor, moderate, and severe, according to F1 score and PSNR; Result database establishment: This refers to storing defect detection results and evaluation indicator data in the database, supporting historical data queries and trend analysis, and providing data support for the entire life cycle operation and maintenance of solar panels.
[0119] During the evaluation process, the system performance was comprehensively assessed based on the overall accuracy, recall, PSNR, and SSIM metrics. Accuracy and recall reflect detection precision, while PSNR and SSIM reflect the enhancement effect. By setting threshold standards for accuracy and recall, the system automatically triggers a model parameter optimization process when the metrics fall below the threshold, ensuring the stability of detection performance. Simultaneously, a defect detection result database was established, recording defect location, type, level, and images before and after enhancement. This data is used for subsequent maintenance tracking and model iteration optimization, providing data support for defect trend analysis and equipment lifespan prediction. Through the expansion of labeled data, the generalization ability and robustness of the detection model can be continuously improved.
[0120] Example 2: Figure 5 As shown, this embodiment discloses a solar panel defect detection system. Based on the above-described solar panel defect detection method, the system includes:
[0121] Solar panel identification and adaptive shooting module: Deployed at the edge of the drone, it integrates a visible light camera and an infrared thermal imager, runs a lightweight model (YOLO model), identifies and locates the solar panel array in real time and calculates its size, dynamically generates 3D waypoints to plan the inspection path to ensure image overlap; based on AI gimbal correction technology, it keeps the solar panel in the center of the image, triggers adaptive zoom to enhance the details of suspected defective areas, and outputs high-quality inspection images.
[0122] Multi-scale defect segmentation module: Partly deployed at the edge of the drone and partly deployed on the local server, it performs pixel-level segmentation on the inspection image by running an improved MSAN-Net network to extract solar panels and defect regions. This network integrates a ResNet encoder, a cross-scale attention mechanism, and a multi-level feature pyramid module, and achieves accurate extraction of defect regions in complex backgrounds through optimized training using a composite loss function; it extracts multi-dimensional features of defects and constructs multi-dimensional feature vectors; it runs a lightweight CNN classification model to determine the defect type; and it outputs preliminary defect detection results, which are then transmitted to the generative adversarial network defect enhancement module.
[0123] The Generative Adversarial Network (GAN) defect enhancement module is deployed on a local server and communicates with the multi-scale defect segmentation module via Ethernet. It receives low-quality defect region images by loading a pre-trained photovoltaic defect enhancement GAN model; it generates enhanced defect images (for difficult-to-detect defects such as low-contrast and small-sized defects, a GAN network composed of a U-Net structure generator and a PatchGAN structure discriminator is used to enhance features and repair details in the defect region, improving the recognition of subtle defects), ensuring that PSNR and SSIM meet standard metrics; the enhanced images are then transmitted to the MSAN-Net network for secondary segmentation to extract optimized features; a voting mechanism is used to fuse the initial and secondary segmentation results, outputting the final defect detection result.
[0124] Detection performance evaluation module: Deployed on a local server, connected to the defect result database, it calculates accuracy, recall, F1-score, and enhancement effect indicators by statistically analyzing the system's detection data and actual defect benchmark data; it evaluates the system's performance level and generates a performance evaluation report; when indicators fall below the threshold, it triggers parameter optimization alarms; it manages the defect detection result database, supports data querying, exporting, and trend analysis, and provides decision support for operation and maintenance.
[0125] Example 3: Figure 6 As shown, this embodiment discloses an electronic device that includes at least the following components:
[0126] Processor: Used to configure and execute instructions to implement the aforementioned solar panel defect detection method. This processor may employ a multi-core design to ensure efficiency in model inference and data processing.
[0127] Memory: Used to store processor-executable instructions, including lightweight YOLO model weights, MSAN-Net network parameters, GAN model parameters, defect detection result database, and benchmark datasets. In addition, the device is equipped with a communication interface and bus.
[0128] In this embodiment, the program running on the electronic device can control the central processing unit (CPU) and other components to achieve the functions of the above-described embodiments of the present invention (i.e., the program that drives the computer to run). The information processed by these devices is temporarily stored in random access memory (RAM) during processing, and subsequently stored in various types of ROMs such as read-only memory (Flash ROM) and hard disk drives (HDDs), and is read, modified, and written by the CPU as needed.
[0129] Furthermore, the electronic device in this embodiment can also be a collection (device group) composed of multiple devices. Each device constituting the device group can possess some or all of the functions or functional modules of the electronic device in the above embodiments. As a device group, it is sufficient to possess all the functions or functional modules of the electronic device.
[0130] Example 4: This example discloses a computer-readable storage medium containing a program that instructs a device to execute the aforementioned solar panel defect detection method. The storage medium can be an SSD, HDD, or cloud storage to support rapid program reading and updating, meeting the deployment requirements of edge and server ends. In this example, the program implementing this control function is recorded on a computer-readable recording medium, and the function is achieved by reading the program recorded on this medium into a computer and executing it.
[0131] It should be noted that the term "computer" as used here refers to a computer built into an electronic device, including hardware configurations such as the operating system (OS) and peripheral devices. Furthermore, "computer-readable recording media" encompasses removable media such as floppy disks, magneto-optical disks, ROMs, and CD-ROMs, as well as storage devices such as hard drives built into the computer.
[0132] Furthermore, "computer-readable recording media" also includes: media that dynamically saves programs for a short period of time when the program is transmitted via a network such as the Internet or a communication line such as a telephone line; and media that serve as volatile memory within a server or client computer and saves programs for a fixed period of time. In addition, the aforementioned program can be a part of a program used to achieve the above functions, or it can be a program that can be combined with programs already recorded in the computer to achieve the above functions.
[0133] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of protection claimed by the present invention. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for detecting defects in solar panels, characterized in that, Includes the following steps: Lightweight defect screening and adaptive shooting steps: The solar panel array is identified and images are acquired using a lightweight model at the edge of the drone; Defect segmentation and type identification steps: The solar panel and defects are accurately segmented using a neural network model, and the defect type and level are determined by combining feature extraction and classification models; Defect enhancement and optimization steps: Enhance defects using adversarial networks; Detection performance evaluation steps: Quantitatively evaluate the overall system performance using multi-dimensional indicators; The lightweight defect screening and adaptive imaging steps include the following steps: Defect screening and shooting steps: By mounting a lightweight target detection model on the edge of the drone, the edge is detected in real time. The bounding box and class probability of the solar panel array in the image are predicted by a single neural network to identify the array in real time. Finally, the drone automatically locates the four corner points of the array and calculates the actual length and width of the array by combining the camera intrinsic parameters and flight altitude. Optimal shooting distance and altitude calculation steps: Calculate the optimal shooting distance based on the array position, and dynamically adjust the waypoint altitude and horizontal offset based on the UAV's flight parameters to plan the UAV's path; Real-time image analysis steps: AI correction is used to analyze the offset of the solar panel edge in the image in real time, and the offset signal is fed back to the gimbal control module. Then, the PID closed-loop adjustment algorithm is used to adjust the gimbal angle so that the solar panel is always in the center area of the image. Defect detection threshold setting steps: When the model detects a suspected defect area or a target-sized part, the lens zoom is automatically triggered to enhance the details of the target area.
2. The solar panel defect detection method according to claim 1, characterized in that, The defect segmentation and type identification steps include the following steps: Inspection image segmentation steps: A multi-scale attention nested network is used to segment the inspection image; Feature vector construction steps: Based on the segmented defect region, extract multi-dimensional features and construct feature vectors; Feature vector input steps: Input the defect feature vector into the lightweight CNN classification model; The multi-scale attention nested network adopts the MSAN-Net structure, and the multi-dimensional features include defect area, defect perimeter, average temperature of defect region, and maximum temperature. The MSAN-Net structure includes: Encoder optimization module: adopts ResNet-18 architecture; The decoder optimization module includes an upsampling module, an attention mechanism module, a multi-scale feature fusion module, and a feature focus supervision module. The upsampling module restores the spatial resolution of the feature map through bilinear interpolation and makes skip connections with the corresponding layer features of the encoder. The attention mechanism module introduces the correlation between channels and space in the decoder to guide the fine-scale features with coarse-scale features. The multi-scale feature fusion module is used to selectively fuse the output features of the first, second, and third sub-modules of the decoder. The feature focus supervision module performs deep supervision on the first, second, and third sub-modules of the decoder through multi-level lateral outputs.
3. The solar panel defect detection method according to claim 2, characterized in that, The loss function used in the MSAN-Net structure for: ; in, This is a global supervision loss function used to monitor the difference between the predictions of the final output layer of the network and the true labels. The feature-focusing loss function is used to supervise the feature learning of different intermediate layers in the decoder, thereby enhancing the defect feature extraction capability; among them, ; in, This is represented as a weighted mapping based on the distance transformation of the defect boundary, with higher weights assigned to boundary pixels; This is represented as a weighted mapping based on the defect area, assigning higher weights to smaller defect areas; Indicates control parameters, The pixel category representing the actual label. This represents the pixel category probability value predicted by the model; This represents an improved weight mapping used to balance class frequencies and reinforce defect boundaries and small defect learning. Feature-focusing loss function The calculation method is the same as that of the global supervision loss function, which is a weighted cross-entropy loss. The input data of the feature focusing loss function is the lateral output of the intermediate layer of the decoder. The feature focusing loss function shares the weight mapping of the global supervision loss function.
4. The solar panel defect detection method according to claim 1, characterized in that, The defect enhancement and optimization steps include the following steps: Generative Adversarial Network (GAN) Construction Steps: Construct a photovoltaic defect-enhancing GAN and design a dedicated GAN; Loss function design steps: Use a composite loss function that combines adversarial loss and perceptual loss; Enhancement steps: Enhancement effect verification and secondary testing, enhancement effect evaluation; The generative adversarial network includes a generator and a discriminator. The generator adopts a U-Net structure, takes a defect region map as input, and outputs an enhanced defect image through multi-layer downsampling and multi-layer upsampling combined with residual connections. The discriminator adopts a PatchGAN structure, takes the enhanced image and the defect image as input, judges the authenticity of the image through multi-layer convolution, and outputs a patch-level probability map to improve the ability to distinguish local details.
5. The solar panel defect detection method according to claim 4, characterized in that, In the adversarial loss, the generator loss is: The loss of the discriminator is: ; in, The image is a low-quality defect image. To provide true, high-quality defect images. For generator output, For discriminator output; The perceptual loss, based on the fifth convolutional feature of the pre-trained VGG-16 network, is used to calculate the feature difference between the generated image and the real image. The formula is as follows: ; in, For VGG-16 feature extraction function, These represent the number of channels, height, and width of the feature map, respectively. The composite loss function is as follows: ; The enhancement effect evaluation uses peak signal-to-noise ratio and structural similarity as quantitative indicators; In the enhancement step, the enhanced defect image is re-input into the MSAN-Net network for secondary segmentation, and the optimized defect features are extracted; a voting mechanism is used to fuse the initial and secondary segmentation results.
6. The solar panel defect detection method according to claim 1, characterized in that, The detection performance evaluation steps include the following steps: Data statistics and benchmark determination steps: including system detection data statistics, actual defect benchmark determination, and determination of actual defect situation. The system detection data statistics are to count the total number of defects output by the system, the number of various types of defects, and the defect area and characteristic parameters before and after enhancement. The determination of the actual defect benchmark is achieved through a confirmation method that combines manual verification with high-precision equipment inspection. The determination of the actual defect situation involves manually inspecting each solar panel with a high-definition camera, marking the location and type of defects, and simultaneously scanning the hot spot area with an infrared thermal imager and verifying it with an industrial camera to determine the actual defect situation. The core metrics calculation steps include: defect detection accuracy, defect detection recall, F1 score, and enhancement effect metrics. Performance evaluation and alarm steps include performance level classification, parameter optimization alarms, and results database establishment.
7. A solar panel defect detection system, characterized in that, Based on the solar panel defect detection method according to any one of claims 1-6, the system comprises: Solar panel identification and adaptive shooting module: Deployed at the edge of the drone, it integrates a visible light camera and an infrared thermal imager, runs a lightweight model, identifies and locates the solar panel array in real time and calculates its size, dynamically generates 3D waypoints to plan the inspection path; it keeps the solar panel in the center of the image, triggers adaptive zoom to enhance the details of suspected defective areas, and outputs inspection images. Multi-scale defect segmentation module: Partly deployed at the edge of the drone and partly deployed on the local server, it performs pixel-level segmentation on the inspection image by running the MSAN-Net network, extracts the solar panel and defect areas; extracts multi-dimensional features of defects and constructs multi-dimensional feature vectors; runs a lightweight CNN classification model to determine the defect type; outputs preliminary defect detection results and transmits them to the generative adversarial network defect enhancement module. Generative Adversarial Network (GAN) Defect Enhancement Module: Deployed on a local server, it communicates with the multi-scale defect segmentation module. By loading a pre-trained photovoltaic defect enhancement GAN model, it receives defect region images, generates enhanced defect images, and transmits the enhanced defect images to the MSAN-Net network for secondary segmentation. Extract optimized features, fuse the initial and secondary segmentation results, and output the final defect detection results; Detection performance evaluation module: Deployed on a local server, connected to the defect result database, it calculates accuracy, recall, F1-score, and enhancement effect indicators by statistically analyzing the system's detection data and actual defect benchmark data; evaluates the system's performance level and generates a performance evaluation report; triggers parameter optimization alarms when indicators fall below thresholds; and manages the defect detection result database.
8. An electronic device, characterized in that, include: Processor: configured to implement the solar panel defect detection method according to any one of claims 1-6 when executing instructions; Memory: Used to store processor-executable instructions. The stored content includes lightweight YOLO model weights, MSAN-Net network parameters, GAN model parameters, defect detection result database, and benchmark dataset.
9. A computer-readable storage medium, characterized in that, The storage medium stores a program that instructs the device to execute the solar panel defect detection method according to any one of claims 1-6.
Citation Information
Patent Citations
YOLO-based method for detecting surface defects of a rail in a tunnel
CN111598846A
Ship positioning method and system based on AIS and camera
CN116337087A