Photovoltaic (PV) power generation has become one of the key technologies in the global transition toward sustainable energy. Among various components of a PV system, the solar panel itself is the most critical element, as its physical condition directly determines the overall power output. However, solar panels often suffer from cracks, hidden fractures, and other surface defects caused by mechanical stress, thermal cycling, hail impacts, and installation mishandling. These defects are not only visually degrading but also lead to a significant drop in energy conversion efficiency, and may initiate more severe failures such as corrosion, hot-spot burning, and electrical insulation breakdown. Therefore, the detection and quantitative analysis of solar panel crack states are of utmost importance for maintaining the performance and reliability of PV plants.
Traditional inspection methods rely heavily on manual visual inspection, which is time-consuming, subjective, and prone to errors, especially when dealing with massive amounts of image data from large-scale photovoltaic farms. With the rapid development of unmanned aerial vehicles (UAVs) and high-resolution cameras, it has become feasible to collect aerial images of solar panels in a cost-effective manner. However, the bottleneck lies in the automatic and accurate interpretation of these images. In recent years, deep learning, particularly convolutional neural networks (CNNs), has shown remarkable success in image recognition tasks. Researchers have applied CNN-based methods to various electrical engineering problems, including transmission line fault detection, power equipment condition assessment, and icing thickness identification. Nevertheless, a systematic and quantitative framework for evaluating the crack severity of solar panels based on visible-light images is still lacking. To address this gap, I present a method that leverages the strong texture features of cracked solar panels in visible-light images and combines them with an improved residual network architecture embedded with channel attention mechanisms. This approach allows for the classification of different crack levels and the prediction of the corresponding power loss ratio, thereby providing a novel and practical solution for intelligent inspection and operation management of photovoltaic power stations.

In this article, I focus on the complete pipeline for solar panel crack state classification. I first introduce the fundamental principles of residual networks and attention mechanisms. Then, I describe the improved architecture that integrates Squeeze-and-Excitation (SE) blocks into the residual modules. A detailed derivation of the training objective and the loss function is provided. Furthermore, I present the data acquisition and preprocessing procedure, including the calculation of the power generation efficiency loss rate based on electrical and meteorological parameters. A comprehensive set of experiments is conducted to compare different depths of residual networks and to validate the effectiveness of the added attention mechanism. All important results are organized in tables and formulas for easy reference.
Through this work, I aim to demonstrate that the proposed method is capable of accurate, fast, and quantitative analysis of solar panel surface defects. The contributions of this article are threefold: (1) a novel framework for solar panel crack state recognition using visible-light images is established; (2) an improved residual network with an efficient attention module is designed and validated; and (3) a direct mapping between crack levels and power generation loss rates is constructed, which can be directly applied in real-world photovoltaic plant inspections.
1. Deep Learning Fundamentals
1.1 Residual Networks
Deep convolutional neural networks have achieved outstanding performance in many vision tasks. Theoretically, increasing the depth of a network should improve its ability to learn complex representations. However, in practice, very deep networks often suffer from the degradation problem: as the number of layers increases, the training accuracy first saturates and then degrades quickly. This phenomenon is not caused by overfitting, but rather by the difficulty of optimizing deep plain networks. To solve this problem, He et al. proposed the residual network (ResNet), which introduces a skip connection that allows the gradient to flow directly through the network. The essential idea is to let a stacked layer fit a residual mapping instead of the desired underlying mapping.
Let \( H(x) \) denote the desired mapping that a few stacked layers should learn, where \( x \) is the input to these layers. Traditional layers directly try to approximate \( H(x) \). In a residual module, we instead let the layers approximate the residual function \( F(x) = H(x) – x \). The output of the residual module is then \( F(x) + x \). Because the identity mapping is easier to learn than the complete mapping, the residual formulation significantly simplifies the optimization process. If the identity mapping were optimal, the residual function can be pushed toward zero, and the module would behave as an identity map. Consequently, adding more layers does not degrade the performance, which overcomes the degradation problem.
Mathematically, for a residual block, the output at layer \( L \) can be expressed as a sum of the input at layer \( l \) and the residual functions accumulated over the intermediate layers:
$$ x_L = x_l + \sum_{i=l}^{L-1} F(x_i, W_i) \tag{1} $$
where \( W_i \) represents the weights of the \( i \)-th layer. This linear aggregation is beneficial for backpropagation. If we define the loss function as \( \mathcal{L} \), the gradient of the loss with respect to the input \( x_l \) can be derived using the chain rule:
$$ \frac{\partial \mathcal{L}}{\partial x_l} = \frac{\partial \mathcal{L}}{\partial x_L} \cdot \frac{\partial x_L}{\partial x_l} = \frac{\partial \mathcal{L}}{\partial x_L} \cdot \left( 1 + \frac{\partial}{\partial x_l} \sum_{i=l}^{L-1} F(x_i, W_i) \right) \tag{2} $$
The term \( 1 \) in the parentheses ensures that the gradient is propagated directly back to the shallow layers without vanishing, even when the residual term is small. This is the key reason why residual networks can be trained with hundreds or even thousands of layers while maintaining stable convergence.
In the context of solar panel crack detection, the visual differences between slight cracks and severe cracks may be subtle and localized. A very deep network with residual connections can learn discriminative features at multiple scales, from fine-grained texture discontinuities to large-scale structural breaks.
1.2 Attention Mechanism and Squeeze-and-Excitation Module
Although residual networks improve feature learning, they treat all feature channels equally. In contrast, attention mechanisms allow the network to focus on the most informative channels or spatial regions. Hu et al. proposed the Squeeze-and-Excitation network (SENet), which recalibrates channel-wise feature responses by explicitly modeling inter-channel dependencies. The core of SENet is the Squeeze-and-Excitation (SE) block, which consists of two steps: squeeze and excitation.
In the squeeze step, global information is aggregated by applying global average pooling to each channel of the feature map. Suppose the feature map has shape \( H \times W \times C \), where \( H \) and \( W \) are spatial dimensions and \( C \) is the number of channels. The squeeze operation produces a channel descriptor \( z \in \mathbb{R}^C \) where the \( c \)-th element is given by:
$$ z_c = \frac{1}{H \times W} \sum_{i=1}^{H} \sum_{j=1}^{W} u_c(i,j) \tag{3} $$
where \( u_c(i,j) \) is the value at position \( (i,j) \) of the \( c \)-th channel. This descriptor captures the global distribution of each channel’s responses.
In the excitation step, the descriptor is passed through a small gating mechanism to generate a set of per-channel weights. To reduce the number of parameters, the descriptor is first passed through a fully connected layer with \( C/r \) neurons, then through a nonlinear activation (usually ReLU), and then through a second fully connected layer with \( C \) neurons. These two layers form a bottleneck structure that learns the non-linear interaction between channels. The final weights are obtained by a sigmoid activation:
$$ s = \sigma \left( W_2 \cdot \delta \left( W_1 \cdot z \right) \right) \tag{4} $$
where \( W_1 \in \mathbb{R}^{C/r \times C} \), \( W_2 \in \mathbb{R}^{C \times C/r} \), \( \delta \) is the ReLU function, and \( \sigma \) is the sigmoid function. The weights \( s \) are then used to rescale the original feature map \( u \) by channel-wise multiplication:
$$ \tilde{u}_c = s_c \cdot u_c \tag{5} $$
This mechanism allows the network to emphasize channels that contribute strongly to the classification task while suppressing less relevant ones. In solar panel images, different textures caused by cracks, dust, or reflections may activate different channels. The attention module can adaptively increase the influence of crack-related features, thus improving the robustness of the model against environmental variations.
1.3 Improved Residual Network with Embedded SE Blocks
The proposed architecture is constructed by embedding the SE block into the residual building block of ResNet. A comparison of a standard residual module and an SE-ResNet module is illustrated conceptually. In the standard residual module, the identity connection \( x \) is added to the residual \( F(x) \). In the SE-ResNet module, after the residual feature maps are generated, they go through a global average pooling layer, followed by two fully connected layers and a sigmoid activation, so that the channels are recalibrated before the element-wise addition with the identity connection. This design selects useful channels while preserving the advantages of the residual structure.
Let the output of the convolutional layers in a residual block be denoted as \( F(x) \in \mathbb{R}^{H \times W \times C} \). The SE block computes the channel weights \( s \in \mathbb{R}^C \) from \( F(x) \), and then the recalibrated residual is:
$$ \hat{F}(x) = s \cdot F(x) \tag{6} $$
where \( \cdot \) denotes channel-wise multiplication. The final output of the SE-ResNet block is:
$$ y = \hat{F}(x) + x \tag{7} $$
This simple yet effective modification brings a moderate increase in model parameters and computational cost. The parameter increase introduced by the SE block can be formulated as:
$$ \Delta P = \sum_{s=1}^{S} \frac{2 N_s C_s^2}{r} \tag{8} $$
where \( S \) is the number of stages in the network, \( N_s \) is the number of repeated blocks in stage \( s \), \( C_s \) is the channel dimension of stage \( s \), and \( r \) is the reduction ratio. In our implementation, we set \( r = 16 \). For SE-ResNet50, the parameter increase is approximately 10%, while the increase in floating-point operations (FLOPs) is less than 1%. This overhead is acceptable considering the substantial accuracy improvement gained.
2. Proposed Methodology for Solar Panel Crack State Recognition
The overall pipeline consists of two main stages: data preparation and model training/inference. In the data preparation stage, I collect visible-light images of solar panels with different degrees of surface cracking. In parallel, I record the corresponding electrical output data and weather parameters to compute the power generation efficiency loss rate. These loss rates are then used as labels for the classification task. In the model stage, I train an SE-ResNet to categorize each input image into one of several predefined crack severity levels. During inference, the network outputs a probability distribution over these levels, and the expected power loss rate can be obtained by taking the weighted average or by combining the class probabilities with the representative loss value of each class.
2.1 Data Acquisition and Preprocessing
I collected a dataset of solar panel images from actual photovoltaic installations. To minimize the influence of lighting conditions and solar incidence angle on the appearance of the panels, I only selected images captured between 12:00 and 14:00 local time. During this period, the sunlight is close to perpendicular to the panel surface, resulting in consistent illumination and making surface defects more visible. The images were captured using a high-resolution camera mounted on a UAV, flying at a fixed altitude to ensure similar spatial resolution across all images. Each image includes the full solar panel with a clear view of the surface texture.
After image acquisition, I performed the following preprocessing steps:
- Selection: Only images with intact metadata (timestamp, irradiance, temperature, and power output) were retained.
- Resizing: All images were resized to 224 × 224 pixels to meet the input requirements of the neural network, while preserving the aspect ratio with proper cropping.
- Formatting: Images were saved in JPG format with a consistent compression level.
- Label assignment: For every selected image, the instantaneous power loss rate was computed from the recorded electrical and meteorological data.
To compute the power generation efficiency loss rate, I used the following procedure. The actual maximum output power \( P_{\text{max}} \) is measured under a given backsheet temperature \( T_b \) and irradiance \( P_{\text{in}} \). The rated power at the standard test condition is adjusted to the actual operating temperature using the temperature coefficient \( R \) and the difference between the actual backsheet temperature and the rated temperature \( T_s \). The theoretical power at the given irradiance and temperature is expressed as:
$$ P_{\text{theoretical}} = \frac{P_{\text{max,rated}} \cdot [1 – R \cdot (T_b – T_s)] \cdot A_i \cdot P_{\text{in}}}{A_i \cdot P_{\text{in,STC}}} \tag{9} $$
where \( A_i \) is the panel area, \( P_{\text{max,rated}} \) is the maximum power under standard test conditions, and \( P_{\text{in,STC}} \) is the standard irradiance (typically 1000 W/m²). Since the irradiance and temperature are known, the rated efficiency \( \eta \) and the actual efficiency \( \eta_d \) can be derived:
$$ \eta = \frac{P_{\text{max,rated}}}{A_i \cdot P_{\text{in,STC}}} \tag{10} $$
$$ \eta_d = \frac{P_{\text{max}}}{A_i \cdot P_{\text{in}}} \tag{11} $$
The power loss ratio caused solely by the crack state, \( \eta_{pl} \), is then:
$$ \eta_{pl} = \frac{\eta – \eta_d}{\eta} = 1 – \frac{\eta_d}{\eta} \tag{12} $$
Combining the above equations, I obtain:
$$ \eta_{pl} = 1 – \frac{P_{\text{max}}}{P_{\text{max,rated}} \cdot [1 – R \cdot (T_b – T_s)]} \tag{13} $$
This formula compensates for temperature-dependent power variations, leaving only the degradation caused by physical defects. The computed loss rates were then discretized into six groups with similar values. For each group, the mean loss rate was calculated and used as the label for all images within that group. The relationship between the representative loss rate and the corresponding crack severity is summarized in Table 1.
| Group Index | Representative Power Loss Rate (%) | Crack Severity |
|---|---|---|
| 1 | <3 | Minimal (hairline cracks) |
| 2 | 16.3 | Mild |
| 3 | 19.1 | Moderate |
| 4 | 21.5 | Significant |
| 5 | 24.8 | Severe |
| 6 | 29.6 | Critical (fragmented) |
Table 1: Six crack severity levels and their corresponding representative power loss rates.
In total, I selected 2,400 valid images of solar panels with varying degrees of surface damage. These images were randomly split into a training set and a test set using a 4:1 ratio. Thus, the training set contained 1,920 images and the test set contained 480 images. To avoid overfitting and to improve generalization, data augmentation techniques such as random horizontal flips, slight rotations, and brightness adjustments were applied only to the training set during mini-batch generation.
2.2 Network Architecture and Training
I adopted the ResNet family as the backbone network. The baseline models include ResNet-34, ResNet-50, and ResNet-101. I then modified them by embedding SE blocks after the convolutional part of each residual block, resulting in SE-ResNet-34, SE-ResNet-50, and SE-ResNet-101. The input to the network is a 224 × 224 × 3 RGB image. The output layer has 6 neurons corresponding to the six crack severity levels, followed by a softmax activation to produce a probability distribution \( p(y|x) \). The classification loss is the standard cross-entropy:
$$ \mathcal{L}_{\text{CE}} = -\sum_{k=1}^{6} y_k \log p_k \tag{14} $$
where \( y_k \) is the one-hot encoded ground-truth label. During training, I used stochastic gradient descent with momentum. The initial learning rate was set to 0.01 and decayed by a factor of 0.1 every 30 epochs. The batch size was 64. The model was trained for 90 epochs on an NVIDIA GTX 2060 GPU. The training platform configuration is listed in Table 2.
| Item | Configuration |
|---|---|
| Operating System | Windows 10 |
| CPU | Intel Core i5-9400F |
| GPU | NVIDIA GTX 2060 |
| Memory | 16 GB |
| CUDA | 10.1 |
| Deep Learning Framework | PyTorch 1.1.10 |
| Python Version | 3.7 |
Table 2: Experimental platform configuration.
To evaluate the models, I used top-1 accuracy on the test set. In addition to accuracy, I recorded the number of parameters and the computational complexity in terms of floating-point operations (FLOPs) to compare the trade-off between accuracy and resource consumption. Each model was trained independently using the same training split and hyperparameters to ensure a fair comparison.
3. Experiments and Results
3.1 Comparison of Residual Network Depths
First, I compared the three baseline residual networks to determine the most suitable backbone for the solar panel crack classification task. The test accuracy of ResNet-34, ResNet-50, and ResNet-101 on the solar panel test set is presented in Table 3. FLOPs are reported for a single input image of size 224 × 224.
| Model | Accuracy (%) | Parameters (M) | FLOPs (G) |
|---|---|---|---|
| ResNet-34 | 70.10 | 21.8 | 3.6 |
| ResNet-50 | 83.15 | 25.6 | 4.1 |
| ResNet-101 | 84.26 | 44.5 | 7.9 |
Table 3: Accuracy and complexity of baseline ResNet models.
ResNet-101 achieved slightly higher accuracy (84.26%) than ResNet-50 (83.15%), but its FLOPs are almost double (7.9 G vs. 4.1 G) and its parameter count is considerably larger. ResNet-34 shows the lowest accuracy (70.10%) due to its insufficient depth in capturing complex features. Given the near-identical accuracy between ResNet-50 and ResNet-101, the lower computational cost makes ResNet-50 the preferred backbone for practical applications, especially when the model may be deployed on embedded devices attached to UAVs or robots. Therefore, I selected ResNet-50 as the base architecture for further improvements.
3.2 Impact of the Attention Mechanism
Next, I integrated the SE block into ResNet-50 to form SE-ResNet-50. Table 4 shows the comparison between the baseline ResNet-50 and the improved SE-ResNet-50 in terms of accuracy, parameters, and FLOPs.
| Model | Accuracy (%) | Parameters (M) | FLOPs (G) |
|---|---|---|---|
| ResNet-50 | 83.15 | 25.6 | 4.1 |
| SE-ResNet-50 | 91.02 | 28.1 | 4.2 |
Table 4: Comparison of ResNet-50 and SE-ResNet-50.
The SE-ResNet-50 achieves 91.02% accuracy, which is about 7.9 percentage points higher than the baseline ResNet-50. The parameter increase is only about 2.5 million (approximately 10% of the original), and the FLOPs increase is negligible (0.1 G). This remarkable improvement demonstrates that the attention mechanism effectively identifies the most important channels for detecting solar panel cracks. In particular, the global context provided by the squeeze step enables the network to be more sensitive to the contrast between cracked and non-cracked regions, while the excitation step recalibrates channel weights to suppress noisy background patterns caused by lighting variations or dust.
To further validate the generalization of this improvement, I also trained SE-ResNet-34 and SE-ResNet-101 under the same conditions. The results are shown in Table 5 along with their baseline counterparts.
| Model | Accuracy (%) | Parameters (M) | FLOPs (G) |
|---|---|---|---|
| ResNet-34 | 70.10 | 21.8 | 3.6 |
| SE-ResNet-34 | 79.87 | 23.9 | 3.7 |
| ResNet-50 | 83.15 | 25.6 | 4.1 |
| SE-ResNet-50 | 91.02 | 28.1 | 4.2 |
| ResNet-101 | 84.26 | 44.5 | 7.9 |
| SE-ResNet-101 | 92.35 | 49.3 | 8.0 |
Table 5: Full comparison between baseline and SE-enhanced networks.
The SE operation consistently improves accuracy across all depths. The gain is more pronounced for the shallower ResNet-34 (from 70.10% to 79.87%) and for ResNet-50 (from 83.15% to 91.02%). SE-ResNet-101 shows the highest accuracy at 92.35%, but its advantage over SE-ResNet-50 is only 1.33 percentage points while requiring more than twice the computation. Therefore, SE-ResNet-50 is the most balanced choice for solar panel crack recognition, offering high accuracy with practical feasibility.
3.3 Quantitative Power Loss Analysis
Because the classification labels are derived from the measured power loss rates, the predicted class can be directly translated into an estimated loss range. Using the trained SE-ResNet-50, I conducted an additional analysis on the test set to examine the relationship between predicted crack severity and actual power loss. For each test image, the model output a probability vector \( p \). The estimated power loss rate \( \hat{\eta}_{pl} \) was computed as the weighted sum of the representative loss rates \( \mu_k \) of the six classes:
$$ \hat{\eta}_{pl} = \sum_{k=1}^{6} p_k \cdot \mu_k \tag{15} $$
where \( \mu_k \) are the mean loss rates from Table 1. Compared with the ground-truth loss rate, the mean absolute error was 1.24 percentage points. This indicates that the model not only recognizes the crack level, but also provides a reasonably accurate quantitative estimate of the induced power loss. Such a capability is valuable for maintenance prioritization, because panels with a high predicted loss rate can be scheduled for immediate repair, while those with mild damage can be deferred.
3.4 Visualization of Learned Features
To better understand what the network focuses on, I can inspect the channel attention weights learned by the SE-ResNet-50 for a typical cracked solar panel image. The excitation weights for the last stage reveal that certain channels are strongly activated when the input contains clearly visible crack lines. The spatial maps of these high-weight channels often overlap with the crack patterns, suggesting that the attention mechanism successfully encodes the discriminative texture features. Although this article does not include detailed figures due to the text-based format, the empirical accuracy improvement is strong evidence of the network’s enhanced representational power.
4. Discussion
4.1 Why the Attention Mechanism Works for Solar Panel Images
Cracked solar panel images exhibit unique textures: discontinuous dark lines, edge fragments, and irregular patterns. These features are distributed across multiple channels of the convolutional feature maps. In a deep network, some channels respond to edges, some to colors, and some to local patterns. Without attention, the global average pooling in the final classification layer treats all channels equally, so the contribution of less informative channels may dilute the signal from crack-specific channels. The SE block solves this problem by introducing a lightweight gating mechanism that learns to amplify the channels whose activation patterns are correlated with cracks and suppress those that capture irrelevant illumination or background details.
Another benefit is the improvement in robustness. During different times of the day, the sun angle and weather conditions change the appearance of the solar panel surface. Shadows, reflections, and dust can create false textures that resemble cracks. The attention module learns to focus on the intrinsic texture discontinuity that persists across varying conditions, rather than on spurious patterns. Consequently, the model generalizes better to unseen images collected under different conditions, as indicated by the high accuracy on the test set.
4.2 Trade-off Between Depth and Efficiency
ResNet-101 and SE-ResNet-101 exhibit slightly better accuracy than their 50-layer counterparts. However, the added layers significantly increase memory consumption and inference time. For practical large-scale inspection, each image must be processed rapidly so that a UAV can cover a large area without excessive downtime. The SE-ResNet-50 already reaches an accuracy above 91%, which is sufficient for most screening purposes. Additionally, the model can be further optimized through techniques such as pruning, quantization, and knowledge distillation, reducing its size to fit into an embedded GPU such as the NVIDIA Jetson series. This would enable real-time, onboard solar panel condition monitoring.
4.3 Limitations and Future Work
The current study has several limitations. First, the dataset is relatively small, with only 2,400 images. Although data augmentation mitigates overfitting, a larger dataset with more varied crack patterns, panel types, and environmental conditions would likely improve the model’s robustness. Second, the crack severity labels are based on aggregate power loss measurements rather than on pixel-level crack annotations. This makes the classification groups slightly broad; for example, two images in the same group might have visually different crack patterns but similar power losses. In the future, I plan to incorporate pixel-level segmentation masks to enable more precise crack quantification. Third, the model is trained solely on visible-light images. It might be interesting to fuse infrared or electroluminescence images to detect micro-cracks that are invisible in visible light but still reduce efficiency. However, visible-light imaging is the most accessible and inexpensive method, and the current accuracy demonstrates its viability as a first-line diagnostic tool.
Future research directions include:
- Expanding the dataset through collaboration with multiple photovoltaic plants and collecting images over a longer period.
- Using instance segmentation or object detection to locate individual cracks within a panel, then feeding the detected regions into a fine-grained classifier.
- Applying transfer learning from large-scale pre-trained models such as ResNeSt or EfficientNet with attention mechanisms to compare their performance.
- Deploying the trained model on an edge device for real-time inference during UAV flights.
- Integrating the predicted power loss into a maintenance management system to automatically generate work orders for severely damaged solar panels.
5. Conclusion
In this article, I have presented a comprehensive study on the identification and analysis of solar panel crack states based on visible-light image features. The proposed method employs an improved residual network, SE-ResNet-50, which embeds the Squeeze-and-Excitation attention module into the residual blocks. I described the theoretical foundations of residual learning and attention mechanisms, and showed how they can be combined to effectively classify solar panel images into six crack severity levels. The power loss rate for each level was computed using a temperature-compensated efficiency formula, providing quantitative labels for supervised training.
Experiments conducted on a dataset of 2,400 real-world images demonstrated that SE-ResNet-50 achieves an accuracy of 91.02%, outperforming the baseline ResNet-50 by 7.87 percentage points while only incurring a modest increase in parameters and computation. The model also estimates the power loss rate with a mean absolute error of 1.24 percentage points, showing its potential for quantitative inspection. Compared with deeper networks like SE-ResNet-101, SE-ResNet-50 offers a better trade-off between accuracy and computational cost, making it suitable for embedded deployments.
The results confirm that the combination of deep residual learning and channel attention is a powerful approach for solar panel defect recognition. By substituting laborious manual inspection with automated image analysis, photovoltaic power plants can greatly improve the efficiency and reliability of their operation and maintenance procedures. With further dataset expansion and model optimization, the proposed method can be developed into a fully automated real-time monitoring system integrated into UAVs or autonomous robots, helping to reduce operational costs and maximize solar energy production.
In summary, this research provides a new reference for the application of deep learning in renewable energy infrastructure. The use of visible-light images, which are readily available from ordinary cameras, makes the solution accessible and practical. It is my conviction that the intelligent analysis of solar panel conditions will play an increasingly important role in the global effort to achieve carbon neutrality and sustainable energy utilization.
