Over the past decade, the global energy landscape has experienced a significant transformation. The urgency to reduce carbon emissions and mitigate climate change has accelerated the adoption of renewable energy sources. Among the available renewable sources, photovoltaic (PV) systems have become one of the fastest-growing clean energy technologies. Their modular nature, decreasing manufacturing costs, and wide applicability have made them a central component of the global energy transition. As solar energy penetration rises, maintaining the reliability and efficiency of PV modules becomes increasingly critical. The PV panel, also known as the solar panel, is the fundamental building block of a PV power generation system. It consists of multiple photovoltaic cells, commonly made of crystalline silicon, which convert sunlight directly into electricity through the photovoltaic effect. However, these cells are mechanically fragile and sensitive to environmental stressors. During manufacturing, handling, transportation, installation, and long-term outdoor exposure, numerous types of defects may appear, such as finger interruptions, micro-cracks, black cores, fragments, or thick lines. These imperfections can greatly degrade the power output of the panel and, in severe cases, lead to safety hazards such as hot spots or even electrical fires. Therefore, developing accurate and efficient defect detection algorithms is essential for ensuring the long-term reliability of solar panels.

Traditionally, defect detection of solar panels has been performed by human inspectors, who visually examine electroluminescence (EL) images for abnormal patterns. However, this manual approach is time-consuming, subjective, and prone to errors, especially when the defects are small and the background texture is complex. Physical inspection methods, such as infrared thermography, resonance ultrasonic vibration, and X-ray imaging, can partially detect certain types of defects, but they often require specialized and expensive equipment. Moreover, these methods are not always suitable for real-time, in-line quality control in a production environment. In recent years, machine vision approaches have gained remarkable attention. These methods leverage image processing techniques and deep learning models to automatically identify and localize defects in solar panel images. Among the various deep learning models, convolutional neural networks (CNNs) have achieved outstanding performance in object detection tasks. In particular, the YOLO (You Only Look Once) family has become exceedingly popular for industrial defect detection because of its excellent balance between speed and accuracy. In this research, I focus on the YOLOv8 architecture and propose two optimized variants that address different practical needs: one aims at high detection accuracy, and the other targets lightweight deployment on resource-constrained devices. Through both algorithmic improvements and systematic experiments, the goal is to construct robust defect detection systems that are applicable in real-world photovoltaic manufacturing lines.
1. Background and Related Work
1.1 Importance of Solar Panel Defect Detection
Solar panels are an indispensable component of modern renewable energy infrastructure. In a PV system, any localized defect can severely compromise the performance of the entire module. For instance, a finger interruption is a break in the thin metallic fingers that collect current from the surface of the cell. When the collection grid is disrupted, the affected region cannot deliver its generated current, causing a reduction in the total effective area of the cell. Similarly, cracks in crystalline silicon may not initially manifest as a significant output drop, but they tend to expand over time due to thermal stress and mechanical load. In the long run, cracks can lead to severe degradation or complete cell failure. Black-core defects usually originate from impurities or thermal anomalies during the crystal growth process, resulting in regions with poor minority-carrier lifetime. These defects act as recombination centers and reduce the local conversion efficiency. Thick-line defects are caused by uneven silver paste printing, and they create localized regions of lower series resistance, which may produce hot-spot heating. All these defects must be detected at an early stage to ensure that only reliable solar panels reach the market. Therefore, a dependable defect detection algorithm is of great economic and safety significance to the PV industry.
1.2 Machine Vision in Defect Detection
Machine vision has revolutionized the way defects are identified in manufactured products. In the past, most defect detection algorithms were based on hand-crafted features. Traditional image processing methods, such as thresholding, edge detection, Fourier transforms, and morphological analysis, were often used to isolate defective regions. For example, Fourier-based reconstruction can effectively detect line-like defects because periodic patterns in the frequency domain can be suppressed. However, these approaches are highly sensitive to noise and often fail when the defect shape varies significantly. With the advent of deep learning, especially CNNs, the feature extraction process has become automatic and hierarchical, allowing models to learn rich representations directly from raw images. Object detection frameworks such as R-CNN, Fast R-CNN, Faster R-CNN, and the YOLO series have been widely adopted for defect detection tasks in various industries, including electronics, textiles, steel manufacturing, and solar energy.
In solar panel defect detection, several studies have employed deep learning to classify or localize defects. Some have applied transfer learning with DenseNet or ResNet to classify defect types, while others have adapted Faster R-CNN for detecting bird droppings and dust accumulation on panels. More recently, the YOLOv5 and YOLOv7 models have been used for real-time detection of solar cell defects. These studies demonstrate that deep learning-based detectors can achieve high detection accuracy and fast processing speed. Nevertheless, the specific challenges of solar panel EL images, such as highly imbalanced defect classes, subtle and small targets, non-uniform illumination, and complex background interference, require further algorithmic refinement. The YOLOv8 architecture, as the latest evolution in the YOLO series, incorporates several cutting-edge improvements, including the C2f module, anchor-free detection head, and task-aligned sample assignment. However, even with this strong baseline, there remains room to enhance both performance and efficiency. Therefore, this thesis proposes targeted modifications to YOLOv8 to better address the characteristics of solar panel EL datasets.
2. Convolutional Neural Networks and Object Detection Basics
2.1 Convolutional Neural Networks
Convolutional neural networks are the backbone of modern visual recognition systems. A typical CNN consists of multiple convolutional layers, pooling layers, and fully connected layers. The convolutional layer performs a mathematical operation called convolution, where a set of learnable kernels slides over the input feature map to extract local patterns. Given an input image denoted as a matrix \( \mathbf{X} \in \mathbb{R}^{M \times N} \) and a kernel \( \mathbf{W} \in \mathbb{R}^{U \times V} \), the two-dimensional convolution can be defined as
\[
y_{ij} = \sum_{u=1}^{U} \sum_{v=1}^{V} w_{uv} x_{i+u-1, j+v-1},
\tag{1}
\]
where \( i \) and \( j \) are the coordinates of the output feature map. The main characteristics of CNNs are sparse interactions and parameter sharing. Sparse interactions mean that each neuron only connects to a local region of the input, which sharply reduces the number of parameters compared to fully connected networks. Parameter sharing means that the same kernel is applied to all locations of the input, allowing the network to detect a particular feature anywhere in the image. Pooling layers, such as average pooling and max pooling, reduce the spatial dimensions while preserving important information. These layers also enhance translation invariance and reduce computational complexity.
2.2 YOLO Series and the YOLOv8 Architecture
The YOLO family has transformed object detection by treating it as a single regression problem. The first YOLO model divided an image into a grid and predicted bounding boxes and class probabilities directly from the full image. This end-to-end approach was extremely fast and became the foundation for many subsequent improvements. YOLOv2 introduced batch normalization, anchor boxes, and a new backbone called Darknet-19. YOLOv3 brought multi-scale predictions through a feature pyramid network (FPN) and a stronger backbone Darknet-53. YOLOv4 added CSPDarknet53, Mosaic data augmentation, and CIoU loss. YOLOv5 optimized the architecture with the C3 module and SPPF block. YOLOv7 employed model reparameterization and introduced E-ELAN. YOLOv8, released by Ultralytics, is the most recent major iteration. It adopts an anchor-free detection head, a decoupled head, and a dynamic task-aligned sampler. The network is composed of three parts: the backbone, the neck, and the head. The backbone extracts hierarchical features from the input image. The neck, which uses the FPN and PAN structures, fuses semantic and positional information across multiple scales. The head then predicts classification and regression outputs for objects at different scales.
One notable component of YOLOv8 is the C2f module. It replaces the C3 module from YOLOv5 and was inspired by the ELAN design. The C2f module reduces the number of convolutional layers, lowers computational cost, and preserves gradient flow through cross-stage connections. In addition, YOLOv8 uses the SPPF module for rapid multi-scale pooling of the final feature map. The loss function consists of a classification loss based on binary cross-entropy and a regression loss based on CIoU and Distribution Focal Loss. While YOLOv8 performs excellently on generic object detection benchmarks, its performance on solar panel EL images can still be improved by incorporating attention mechanisms, fault-aware convolutional blocks, and a more robust regression loss.
3. Construction of the Photovoltaic Panel Defect Dataset
3.1 Dataset Description
In this work, I use a publicly available industrial EL anomaly detection dataset named PVEL-AD. The dataset contains electroluminescence images of monocrystalline and multicrystalline PV cells. The EL imaging technique is widely used because it reveals internal defects through the radiative recombination of charge carriers in the semiconductor. When a forward bias is applied to the cell, areas with defects emit less light, and the resulting intensity variation is captured by an InGaAs or silicon CCD camera. The images display bright regions that correspond to healthy silicon and dark regions that usually correspond to defects or contamination. The dataset includes many types of defects, but I concentrate on four common categories: finger interruption (“finger” or “disconnection”), line-like crack (“crack”), star-shaped crack (“star_crack”), and thick line (“thick_line”). The original dataset contains 2718 images. However, the number of instances per class is extremely unbalanced. For example, the number of finger interruptions exceeds 2000, while star cracks have only a few hundred samples. This imbalance can bias the training process toward the majority class, causing poor detection performance on rare classes. Therefore, a series of preprocessing steps were applied to balance and enhance the dataset.
3.2 Data Augmentation
To alleviate the class imbalance, I performed data augmentation on the minority class (star cracks). Data augmentation is a regularization technique that artificially expands the training set by applying various transformations to existing samples. I used the Python library Albumentations, which provides a wide range of efficient and organized augmentation functions. Specifically, I applied four transformations: random brightness and contrast adjustment, rotation, vertical flip, and horizontal flip. These operations introduce diversity in the images, making the model less sensitive to the orientation and illumination of the defects. Random brightness and contrast changes simulate the varying lighting conditions that may occur during image acquisition. Rotations and flips enable the network to learn defect patterns in a rotation-invariant manner. The augmented images help the model generalize better to unseen data and reduce overfitting.
3.3 Manual Annotation
In addition to augmentation, I increased the number of star-crack instances by selecting unannotated images from the original dataset that contained star cracks and manually annotating them. I used the Make Sense web-based annotation tool, which allows users to draw bounding boxes around objects and assign class labels. The annotation process produced XML files containing the class name and bounding box coordinates in the format of the PASCAL VOC dataset. To use these annotations with YOLOv8, the XML files were converted to plain-text files with one line per object. Each line contains the class index and four normalized coordinates: the center \( x \), center \( y \), width, and height of the bounding box. The normalization step maps all coordinates to the \([0,1]\) range, which is required by YOLO models.
After the augmentation and manual annotation steps, the final dataset contains 3230 images. The class instance counts are listed in the following table:
| Defect Type | Number of Instances |
|---|---|
| Finger interruption | 3102 |
| Line crack | 1508 |
| Star crack | 846 |
| Thick line | 993 |
To verify the effectiveness of the preprocessing, I trained a baseline YOLOv8n model on both the original and the processed datasets. The experimental results are summarized below:
| Method | Precision | Recall | mAP@50 (%) | mAP@50:95 (%) |
|---|---|---|---|---|
| Before preprocessing | 0.833 | 0.788 | 87.2 | 53.2 |
| After preprocessing | 0.894 | 0.809 | 88.2 | 56.2 |
| Improvement | +6.1% | +2.1% | +1.0% | +3.0% |
These improvements demonstrate that the preprocessing strategy effectively balances the class distribution and increases the overall detection accuracy.
4. High-Precision YOLOv8 Optimization for Solar Panel Defect Detection
4.1 Challenges in EL Image Defect Detection
Despite the availability of a preprocessed dataset, solar panel EL images still pose several algorithmic challenges. First, the background intensity is not uniform because the crystal growth process produces a random texture. This background varies locally and can create edges that look similar to actual cracks or finger interruptions. Second, the defects themselves are small, often occupying only a few pixels; thus, the model must preserve low-level spatial details while also extracting high-level semantic features. Third, some defect types are visually similar. For instance, a thin line crack may be mistaken for a thick line or a grain boundary. Finally, the dataset contains low-quality samples where the defect is partially out of focus or overshadowed by strong background radiation. To overcome these challenges, I propose a model named YOLOv8-SPW, which incorporates three major improvements: a Spatial Group-wise Enhance (SGE) attention mechanism, a variant of the partial convolution (PConv) module, and the Wise-IoU (WIoU) regression loss.
4.2 SGE Attention Mechanism
Attention mechanisms have become indispensable in modern detection networks. They allow the model to dynamically weigh the importance of different features and spatial locations. The Spatial Group-wise Enhance (SGE) module is a lightweight attention block that operates by dividing the input feature map into groups along the channel dimension. For each group, it computes a global semantic vector by averaging the spatial features. This vector is then used to calculate the relevance of each spatial position through a dot product operation. After a normalization step and a Sigmoid function, the original features are re-scaled by the obtained attention coefficients. The process can be described mathematically as follows.
Let the input feature map be \( \mathbf{x} = \{ \mathbf{x}_1, \mathbf{x}_2, \ldots, \mathbf{x}_m \} \), where each \( \mathbf{x}_i \in \mathbb{R}^{C/G} \) is a spatial feature vector, and \( m = H \times W \) is the number of spatial positions. The global feature for the group is
\[
\mathbf{g} = \frac{1}{m} \sum_{i=1}^{m} \mathbf{x}_i.
\tag{2}
\]
Then the importance coefficient for the \( i \)-th position is
\[
c_i = \mathbf{g} \cdot \mathbf{x}_i.
\tag{3}
\]
These coefficients are subsequently normalized across the spatial dimension:
\[
\hat{c}_i = \frac{c_i – \mu_c}{\sigma_c + \epsilon},
\tag{4}
\]
where \( \mu_c \) and \( \sigma_c \) are the mean and standard deviation of the coefficients, and \( \epsilon \) is a small constant for numerical stability. The normalized coefficients are scaled and shifted by learnable parameters \( \gamma \) and \( \beta \), and then passed through a Sigmoid function:
\[
a_i = \sigma(\gamma \hat{c}_i + \beta).
\tag{5}
\]
Finally, the enhanced feature vector is
\[
\tilde{\mathbf{x}}_i = a_i \cdot \mathbf{x}_i.
\tag{6}
\]
The SGE module requires only a minimal number of additional parameters, yet it significantly enhances the representation of important semantic information. In my proposed high-precision model, I integrated SGE into the neck network after the feature fusion module. The experiments showed that adding SGE at the neck is more effective than adding it at the backbone. The neck features contain both semantic and positional information, and SGE can better guide the model to focus on defect-relevant regions.
4.3 Variant PConv Module
FasterNet introduced the concept of partial convolution (PConv), which applies convolution only to a fraction of the input channels. The motivation is to reduce redundant computation while preserving spatial feature extraction capability. In a standard PConv operation, the input feature map is split into two parts along the channel dimension. One part is processed by a regular convolution, while the other part remains unchanged. After the convolution, the two parts are concatenated together. This operation can be expressed as
\[
\mathbf{Y} = \text{Concat}(\text{Conv}(\mathbf{X}_1), \mathbf{X}_2),
\tag{7}
\]
where \( \mathbf{X}_1 \) contains the first \( c_p \) channels and \( \mathbf{X}_2 \) contains the remaining channels. The FLOPs for a PConv layer are:
\[
\text{FLOPs}_{\mathrm{PConv}} = H \times W \times K^2 \times c_p^2,
\tag{8}
\]
where \( H, W \) are the spatial dimensions, \( K \) is the kernel size, and \( c_p \) is the number of channels used in the convolution. If the partial ratio \( c_p / c = 1/4 \), then the FLOPs are reduced to 1/16 of a full standard convolution. In my work, I propose a variant PConv structure that adds a standard Conv module after the concatenation operation. The structure is illustrated conceptually as:
\[
\mathbf{Y} = \text{Conv}(\text{Concat}(\text{Conv}(\mathbf{X}_1), \mathbf{X}_2)).
\tag{9}
\]
This additional Conv module consists of a convolution followed by batch normalization and an activation function. It enriches the feature representation and helps the network learn more complex and discriminative patterns. I placed this variant PConv module at two positions in the network: after the last C2f module in the backbone, and after the C2f module before the detection heads in the neck. Experimental results show that the neck placement yields a larger improvement, because it enables the critical fused features to be further refined before classification and regression.
4.4 Wise-IoU Regression Loss
The regression loss determines how accurately the model predicts the position and size of the bounding box. The original YOLOv8 uses the CIoU loss, which considers the overlap area, center point distance, and aspect ratio. However, CIoU tends to heavily penalize low-quality samples, which can destabilize training when many such samples exist in the dataset. The Wise-IoU (WIoU) loss introduces a dynamic focusing mechanism that assigns a proper weight to each sample based on its quality. I evaluated three versions of WIoU.
The first version, WIoU-v1, uses a distance-aware attention factor \( R_{WIoU} \) and an IoU-based term \( \mathcal{L}_{IoU} \) to control the effect of geometric penalties. The loss is defined as:
\[
\mathcal{L}_{WIoUv1} = R_{WIoU} \cdot \mathcal{L}_{IoU},
\tag{10}
\]
where
\[
R_{WIoU} = \exp\left( \frac{(x – x_{gt})^2 + (y – y_{gt})^2}{(W_g)^2 + (H_g)^2} \right),
\quad
\mathcal{L}_{IoU} = 1 – IoU.
\tag{11}
\]
Here, \( (x, y) \) and \( (x_{gt}, y_{gt}) \) are the center coordinates of the predicted and ground-truth boxes, and \( W_g, H_g \) denote the width and height of the minimum enclosing box. WIoU-v2 incorporates a monotonic focusing coefficient with a normalized mean IoU to regulate gradient gain:
\[
\mathcal{L}_{WIoUv2} = \left( \frac{\mathcal{L}_{IoU}^*}{\overline{\mathcal{L}_{IoU}}} \right)^\gamma \mathcal{L}_{WIoUv1},
\tag{12}
\]
where \( \gamma > 0 \) controls the focusing strength. WIoU-v3 introduces a non-monotonic focusing coefficient based on the outlier degree \( \beta \) of the predicted box, defined as
\[
\beta = \frac{\mathcal{L}_{IoU}^*}{\overline{\mathcal{L}_{IoU}}} \in [0, +\infty),
\tag{13}
\]
and the final loss is:
\[
\mathcal{L}_{WIoUv3} = r \cdot \mathcal{L}_{WIoUv1}, \qquad
r = \frac{\beta}{\delta \alpha^{\beta-\delta}},
\tag{14}
\]
where \( \alpha \) is a sensitivity parameter and \( \delta \) is a threshold. In the experiments, WIoU-v1 provided the most stable and robust improvement on the tested dataset, increasing mAP@50 by 1.6 percentage points while preserving fast convergence. Therefore, I adopted WIoU-v1 as the final regression loss in the high-precision configuration.
4.5 Experiments and Results for the High-Precision Model
The experiments were conducted on a Windows 11 machine with an Intel Xeon Gold 6330 CPU, an RTX 3090 GPU with 24GB memory, and PyTorch 2.0.0. The training setup is summarized below:
| Hyperparameter | Value |
|---|---|
| Input resolution | 640 × 640 |
| Epochs | 150 |
| Batch size | 32 |
| Optimizer | SGD |
| Initial learning rate | 0.01 |
| Momentum | 0.937 |
| Workers | 8 |
I first compared the placement of the SGE module. The results are shown in the following table:
| Model | Finger AP | Crack AP | Star crack AP | Thick line AP | mAP@50 (%) | mAP@50:95 (%) | Params (M) |
|---|---|---|---|---|---|---|---|
| YOLOv8n baseline | 0.951 | 0.774 | 0.914 | 0.889 | 88.2 | 56.2 | 6.3 |
| +SGE (backbone) | 0.937 | 0.784 | 0.940 | 0.901 | 89.1 | 56.5 | 6.3 |
| +SGE (neck) | 0.939 | 0.824 | 0.932 | 0.912 | 90.2 | 56.7 | 6.3 |
The SGE module in the neck outperforms the backbone version by 1.1 percentage points in mAP@50, confirming that the semantic and positional fusion at the neck benefits greatly from spatial group-wise enhancement.
Next, I evaluated the variant PConv module. The table below demonstrates the effect of placing PConv in different parts of the network.
| Model | Finger AP | Crack AP | Star crack AP | Thick line AP | mAP@50 (%) | mAP@50:95 (%) | Params (M) |
|---|---|---|---|---|---|---|---|
| YOLOv8n baseline | 0.951 | 0.774 | 0.914 | 0.889 | 88.2 | 56.2 | 6.3 |
| +PConv (backbone) | 0.945 | 0.802 | 0.912 | 0.900 | 89.0 | 56.8 | 6.5 |
| +PConv (neck) | 0.944 | 0.822 | 0.946 | 0.900 | 90.3 | 56.9 | 6.5 |
Although the parameter count increases slightly by 0.2M, the neck-PConv configuration provides a 2.1 percentage point improvement in mAP@50. This indicates that the enriched features generated by the variant PConv are particularly beneficial for detecting defects with diverse shapes and scales.
I then tested the three WIoU loss variants. The results are as follows:
| Model | Finger AP | Crack AP | Star crack AP | Thick line AP | mAP@50 (%) | mAP@50:95 (%) | Params (M) |
|---|---|---|---|---|---|---|---|
| YOLOv8n (CIoU) | 0.951 | 0.774 | 0.914 | 0.889 | 88.2 | 56.2 | 6.3 |
| +WIoU-v1 | 0.941 | 0.834 | 0.920 | 0.896 | 89.8 | 56.6 | 6.3 |
| +WIoU-v2 | 0.940 | 0.794 | 0.898 | 0.896 | 88.2 | 56.5 | 6.3 |
| +WIoU-v3 | 0.947 | 0.805 | 0.902 | 0.905 | 89.0 | 57.6 | 6.3 |
WIoU-v1 achieved the highest mAP@50 score, while WIoU-v3 delivered the best multi-threshold mAP@50:95 score. Since mAP@50 is the primary metric for the solar panel inspection requirement, I selected WIoU-v1 in the final combined model.
Finally, an ablation study was conducted to evaluate the combined contribution of all three enhancements. The results are shown below:
| SGE | PConv | WIoU | mAP@50 (%) | mAP@50:95 (%) |
|---|---|---|---|---|
| No | No | No | 88.2 | 56.2 |
| Yes | No | No | 90.2 | 56.7 |
| No | Yes | No | 90.3 | 56.9 |
| No | No | Yes | 89.8 | 56.6 |
| Yes | Yes | No | 90.7 | 57.6 |
| Yes | Yes | Yes | 91.0 | 57.8 |
The complete YOLOv8-SPW model achieves a final mAP@50 of 91.0%, which is an improvement of 2.8 percentage points over the baseline YOLOv8n. The multi-threshold mAP@50:95 also improves by 1.6 percentage points, reaching 57.8%. These results demonstrate that the three proposed modifications work synergistically to significantly enhance the detection capability on solar panel defect data.
I further compared the high-precision model with several other YOLO models of the same scale:
| Model | mAP@50 (%) | mAP@50:95 (%) | Params (M) |
|---|---|---|---|
| YOLOv3 | 87.7 | 59.2 | 207.8 |
| YOLOv5n-p6 | 87.7 | 55.1 | 8.6 |
| YOLOv6n | 87.3 | 54.1 | 8.7 |
| YOLOv7 | 82.9 | 44.5 | 12.3 |
| YOLOv8n | 88.2 | 56.2 | 6.3 |
| YOLOv8-SPW (Ours) | 91.0 | 57.8 | 6.3 |
The proposed high-precision model surpasses all compared baselines in terms of mAP@50 while maintaining the same parameter count as YOLOv8n. This makes it an excellent choice for scenarios where detection accuracy is the highest priority and computational resources are modest.
5. Lightweight Defect Detection Model Based on YOLOv8n
5.1 Motivation for Lightweight Design
In real-world industrial environments, the defect detection system is often deployed on embedded devices or edge computers with limited processing power, memory, and storage capacity. Large models such as YOLOv3 or YOLOv7 are difficult to run in real time on such hardware. Therefore, designing a lightweight network that maintains high detection accuracy while reducing parameter count and latency is essential. The goal is to enable continuous, on-site inspection of solar panels without relying on powerful cloud servers. In this section, I propose a lightweight model named YOLOv8n-ES, which combines an EfficientNet-based backbone with the SGE attention mechanism in the neck.
5.2 EfficientNet Backbone
EfficientNet is a family of CNN architectures that achieve excellent accuracy with relatively few parameters. The key idea behind EfficientNet is compound scaling, which uniformly scales the network depth, width, and input resolution according to a set of coefficients. For a baseline network, the three scaling dimensions are governed by:
\[
d = \alpha^{\phi}, \quad w = \beta^{\phi}, \quad r = \gamma^{\phi}
\tag{15}
\]
with the constraint \( \alpha \cdot \beta^2 \cdot \gamma^2 \approx 2 \) and \( \alpha, \beta, \gamma \ge 1 \). Here, \( \phi \) is a user-specified coefficient that controls the total resource consumption. The baseline EfficientNet-B0 is composed of several stages, each consisting of MBConv blocks. The main building block MBConv combines a 1×1 expansion convolution, a depthwise separable convolution, and a squeeze-and-excitation (SE) block. The depthwise separable convolution reduces computation by separating spatial and channel-wise operations. A standard convolution is decomposed into a depthwise convolution followed by a 1×1 pointwise convolution. If the standard convolution has an input with \( C_{in} \) channels and an output with \( C_{out} \) channels, the computational cost is
\[
C_{std} = H \times W \times K^2 \times C_{in} \times C_{out}.
\tag{16}
\]
The depthwise separable convolution has a cost of
\[
C_{ds} = H \times W \times K^2 \times C_{in} + H \times W \times C_{in} \times C_{out},
\tag{17}
\]
which is significantly lower when \( K > 1 \). The SE block in MBConv computes channel-wise attention by using global average pooling, two fully connected layers, and a Sigmoid activation, allowing the network to emphasize informative channels and suppress less important ones.
In my lightweight model, I replaced the entire backbone of YOLOv8n with the feature-extraction layers of EfficientNet-B0. The original Conv, C2f, and SPPF modules are exchanged for a sequence of MBConv modules with an initial 3×3 convolutional stem. This substitution dramatically reduces the number of parameters and the model size. The parameter count of the backbone drops from roughly 6.3M to 4.1M, representing a 35% reduction. However, the compressed feature representation may lose some critical information. Therefore, I added the SGE attention module in the neck network to compensate for this information loss and to further accelerate inference.
5.3 SGE in the Neck for the Lightweight Model
The SGE module, as described in the previous section, is extremely lightweight because it only introduces scale and shift parameters for each channel group. In this lightweight architecture, the SGE module is inserted before the small-object detection head in the FPN/PAN fusion path. The integration of SGE helps the model re-calibrate the fused features, strengthening the important spatial cues and suppressing noise. Since the EfficientNet backbone already contains many channel-attention mechanisms, the additional spatial group enhancement at the neck provides complementary benefits. The final model retains the same parameter count as the EfficientNet-based YOLOv8n backbone, which is 4.1M, while achieving a higher FPS and better accuracy.
5.4 Experimental Results for the Lightweight Model
I first compared the baseline YOLOv8n with the EfficientNet-backbone-only variant. The results are presented below.
| Model | Finger AP | Crack AP | Star crack AP | Thick line AP | mAP@50 (%) | Params (M) | FPS |
|---|---|---|---|---|---|---|---|
| YOLOv8n | 0.951 | 0.774 | 0.914 | 0.889 | 88.2 | 6.3 | 72.9 |
| YOLOv8n+EfficientNet | 0.941 | 0.789 | 0.891 | 0.876 | 87.4 | 4.1 | 70.6 |
The EfficientNet backbone reduces the parameter count considerably, but mAP@50 drops from 88.2% to 87.4%, and the FPS decreases slightly. The drop in accuracy occurs because the condensed feature map omits some subtle cues that are needed to identify small defects. The FPS reduction is likely caused by the particular design of the MBConv blocks, which involve multiple small operations and attention calculations. Nevertheless, the model is much smaller and more portable.
Next, I added the SGE module to the neck. The results are as follows.
| Model | Finger AP | Crack AP | Star crack AP | Thick line AP | mAP@50 (%) | Params (M) | FPS |
|---|---|---|---|---|---|---|---|
| YOLOv8n | 0.951 | 0.774 | 0.914 | 0.889 | 88.2 | 6.3 | 72.9 |
| YOLOv8n-ES (EfficientNet+SGE) | 0.952 | 0.808 | 0.931 | 0.880 | 89.3 | 4.1 | 79.9 |
With the SGE module, the mAP@50 improves to 89.3%, which is 1.1 percentage points higher than the baseline YOLOv8n, while the parameter count remains at 4.1M and the FPS rises to 79.9 frames per second. The FPS improvement is interesting: even though the model is more accurate, the SGE operation is so efficient that it reduces redundant computations, effectively accelerating the network by allowing more focused features to propagate faster through the detection head.
I also performed an ablation study for the lightweight configuration.
| EfficientNet | SGE | mAP@50 (%) | Params (M) | FPS |
|---|---|---|---|---|
| No | No | 88.2 | 6.3 | 72.9 |
| Yes | No | 87.4 | 4.1 | 70.6 |
| No | Yes | 90.2 | 6.3 | 78.5 |
| Yes | Yes | 89.3 | 4.1 | 79.9 |
The ablation clearly shows that the SGE module not only restores the accuracy loss caused by the compressed backbone but also enhances the original performance. The final lightweight model offers an excellent trade-off among accuracy, model size, and inference speed.
Finally, I compared the lightweight model with other YOLO-based lightweight models:
| Model | mAP@50 (%) | Params (M) | FPS |
|---|---|---|---|
| YOLOv3-tiny | 85.0 | 24.4 | 76.3 |
| YOLOv5n | 88.4 | 5.3 | 77.9 |
| YOLOv7-tiny | 85.8 | 12.3 | 104.4 |
| YOLOv8n | 88.2 | 6.3 | 72.9 |
| YOLOv8n-ES (Ours) | 89.3 | 4.1 | 79.9 |
The proposed lightweight model achieves the highest mAP@50 among all compared lightweight detectors. It has a smaller parameter count than YOLOv5n and YOLOv8n, and its FPS is higher than YOLOv8n, YOLOv5n, and YOLOv3-tiny. The YOLOv7-tiny has a higher FPS but much worse accuracy and significantly more parameters. Therefore, YOLOv8n-ES emerges as a superior choice for embedded defect detection systems.
6. Conclusion and Future Work
In this thesis, I have presented a comprehensive study on defect detection for solar panels using machine vision and the YOLOv8 framework. The primary contributions are the construction of a balanced and annotated PVEL dataset, a high-precision detection model, and a lightweight detection model. The dataset preprocessing using augmentation and manual annotation successfully solved the class imbalance problem and improved all evaluation metrics.
For the high-precision model, the introduction of the SGE attention mechanism, the variant PConv module, and the WIoU loss function led to a substantial improvement in detection accuracy. The final model achieved a mAP@50 of 91.0%, an increase of 2.8 percentage points over the baseline YOLOv8n, while maintaining the same parameter count. This demonstrates that careful architectural modifications targeted at feature selection, feature enrichment, and loss design can effectively handle the complex EL image characteristics. The high-precision model is suitable for production lines where detection accuracy is critical and the hardware can accommodate a model with around 6M parameters.
For the lightweight model, the use of the EfficientNet backbone achieved a 35% reduction in parameters, making the model more suitable for edge devices. Adding the SGE module compensated for the information loss and simultaneously improved both accuracy and FPS. The final lightweight model YOLOv8n-ES achieved a mAP@50 of 89.3%, which is higher than the original YOLOv8n, while using only 4.1M parameters and running at 79.9 FPS. This model provides an excellent trade-off for real-time solar panel inspection in resource-constrained environments.
There are several possible directions for future research. First, the dataset used in this study only contains four defect types. In practice, solar panels may exhibit many other defects such as black cores, fragments, fingerprints, scratches, and soldering defects. Extending the dataset to include more defect categories would help train more comprehensive models. Second, manual annotation of small and tiny defects is laborious and error-prone. Future work could explore semi-automatic annotation tools that leverage segmentation models or generative adversarial networks to generate synthetic defect images, reducing the human effort required. Third, the proposed models still suffer from occasional misclassifications and false detections. Stronger attention mechanisms, better feature fusion strategies, or transformer-based backbones might further improve the robustness. Fourth, to deploy the lightweight model on actual hardware such as an NVIDIA Jetson or mobile device, further optimizations such as quantization, pruning, or TensorRT acceleration could be investigated. Finally, the detection results may be extended to a semantic segmentation framework, which would provide pixel-level defect boundaries rather than bounding boxes, enabling a more detailed quality evaluation of solar panels.
In summary, this research has shown that targeted modifications to YOLOv8 can significantly enhance solar panel defect detection. Both the high-precision and lightweight models achieved strong results and provide practical solutions for different deployment scenarios. As the global demand for clean energy continues to rise, robust defect detection algorithms will contribute to the reliable operation of solar power systems and help accelerate the transition to a sustainable energy future.
