$$\rightleftharpoonup{xx}$$
$$\longleftharp{xx}$$,
$$\longrightharp{xx}$$,
The image data for this study were collected from power operation environments with necessary permissions. All images were anonymized with no personally identifiable information retained. This study focuses on detecting personal protective equipment rather than identifying individuals. As the research involves only algorithm development using anonymized data, ethical approval was not required.
The following protocol details a comprehensive procedure for designing, training, and evaluating a lightweight, high-performance, and inherently interpretable object detection model, named WTLS-YOLOv11n, for Personal Protective Equipment (PPE) detection. The software used in this study is listed in the Table of Materials.
Overall architectural framework
The proposed WTLS-YOLOv11n model is built upon the YOLOv11n baseline. The core methodology involves systematically replacing or enhancing key modules in the backbone and head to improve performance, efficiency, and interpretability.
The proposed WTLS-YOLOv11n model is built upon the YOLOv11n baseline. The core methodology involves systematically replacing or enhancing key modules in the backbone and head to improve performance, efficiency, and interpretability. The overall architectural paradigm of YOLOv11n, which consists of a backbone, neck, and head, was retained in the proposed model. In the backbone, specific C3K2 modules were replaced with the proposed C3K2-WTConv modules to enhance feature extraction. In the head, the original detection head was replaced with the proposed Lightweight Shared Composite Detection Head (LSCD) to reduce model complexity. The complete architecture of the proposed WTLS-YOLOv11n model, contrasted with the baseline, is illustrated in Figure 1.
C3K2-WTConv module design
This module is designed to replace the standard convolutional modules within the YOLOv11n backbone. Its design is guided by two primary objectives: (a) to efficiently expand the model's receptive field for capturing multi-scale contextual information without significantly increasing the parameter count or computational complexity, and (b) to learn more robust and inherently interpretable feature representations by explicitly decomposing feature maps into the frequency domain.
Design of the Core WTConv layer
The foundational WTConv (Wavelet Transform Convolution) layer is designed to implement the 2D Discrete Haar Wavelet Transform. This process is accomplished through a set of specific wavelet kernels:
Wavelet Kernels: The transform is implemented via four fixed, non-trainable depthwise convolution kernels (F_LL, F_LH, F_HL, F_HH), which correspond to the Haar wavelet basis functions. These kernels are responsible for decomposing the input feature map into its low- and high-frequency components.
Decomposition and Downsampling: These kernels are applied to the input feature map (X) with a stride of 2. This single operation efficiently performs both feature decomposition and spatial downsampling, separating the input into four distinct sub-bands.
Physical interpretation of output components
The four feature sub-bands generated by the wavelet decomposition possess a clear physical interpretation. As illustrated in Figure 2, the WTConv layer recursively decomposes the input into the following components:
Low-Frequency Component (LL): This component preserves the overall structure, contour, and other global information of the target at half the spatial resolution. It serves as the foundation for the model to understand the target's "shape."
High-Frequency Components (LH, HL, HH): These three components capture fine-grained details such as horizontal, vertical, and diagonal edges and textures, respectively. They enable the model to focus on the target's "details."
Integration into the C3K2 module structure
The designed WTConv layer is seamlessly integrated into the C3K2 bottleneck structure of YOLOv11n.
Replacement Strategy: Within the original C3K2 module, the standard 3x3 convolutional layer is replaced with the WTConv layer. This approach preserves the efficient feature reuse mechanism of the C3K2 architecture while introducing the advantages of the wavelet transform, resulting in the final C3K2-WTConv module (detailed structure shown in Figure 3).
Cascaded Receptive Field Expansion: The WTConv process can be recursively applied to the low-frequency (LL) output of the preceding stage. This cascaded decomposition mechanism allows the model to analyze features over an exponentially increasing receptive field with minimal computational overhead, thereby creating an efficient multi-scale frequency decomposition pathway.
Lightweight Shared Composite Detection Head (LSCD) Design
This module is engineered to replace the original YOLOv11n detection head, with the primary goal of drastically reducing model complexity and computational overhead for efficient deployment on resource-constrained edge devices. The design addresses the significant parameter redundancy found in standard multi-scale detection heads (detailed structure shown in Figure 4.
Rationale and design goals
The independent prediction branches for each feature scale (P3-P5) in the original YOLOv11 head lead to a high parameter count. The LSCD introduces a hybrid parameter-sharing strategy to achieve superior parameter efficiency while preserving critical multi-scale feature fusion capabilities.
Parameter sharing and feature fusion mechanism
The core of the LSCD lies in its two-stage feature processing pipeline:
Scale-specific preprocessing: For each input feature map from the neck (P3, P4, P5), a non-shared 1x1 Convolution followed by a Group Normalization (GN) layer is applied. This initial step allows the network to learn scale-specific channel transformations, ensuring that unique characteristics of each feature level are preserved before fusion.
Efficient cross-scale fusion: Following the preprocessing, a series of shared 3x3 Convolution-GN modules are employed to perform the core feature fusion across different scales. By sharing weights, these modules learn a generalized feature fusion pattern, which is the primary source of parameter reduction. This design forces the model to learn more robust and universal fusion representations.
Dynamic scale adaptation and branch optimization
To compensate for any potential information loss from weight sharing and to refine prediction accuracy, two additional mechanisms are introduced:
Learnable Scale Layer: A learnable Scale layer is added for each detection scale. This layer introduces a per-scale learnable scalar that dynamically re-weights the fused features, allowing the model to adaptively emphasize or suppress features based on the target object sizes prevalent at that scale.
Optimized classification branch: The classification branch is enhanced by using the Softmax activation function for probability distribution and incorporating a Group Normalization (GN) layer. This stabilizes the training of the classification task and improves the robustness of confidence predictions, a technique proven effective in architectures like FCOS.
Improved Loss Function Design (MPDIoU)
The loss function is re-engineered to specifically address the challenges of accurate bounding box regression for small, cluttered, and irregularly shaped targets, which are common in PPE detection scenarios.
Motivation and limitations of traditional IoU loss
Standard IoU-based losses suffer from several critical drawbacks in this context:
Vanishing Gradients: When the predicted and ground-truth boxes have no overlap, the IoU is zero, and the loss gradient vanishes, stalling the learning process.
Insensitivity to alignment: Multiple bounding box configurations can yield the same IoU score, making the loss function insensitive to the quality of alignment (e.g., center point deviation vs. shape mismatch).
Poor performance on small objects: For small targets, even minor pixel deviations can be significant, but they often result in negligible changes to the IoU value, leading to imprecise localization.
Adopting the Minimum Point Distance IoU (MPDIoU) Loss
To overcome the aforementioned limitations, the protocol replaces the standard loss with the Minimum Point Distance IoU (MPDIoU) loss. MPDIoU enhances the standard IoU metric by incorporating a penalty term that directly penalizes the distance between the predicted and ground-truth boxes, even when they do not overlap.
Core Mechanism: The penalty term is derived from the Euclidean distance between the corresponding corner points of the predicted box (pred) and the ground-truth box (gt). Specifically, the squared distances for the top-left corners
) and the bottom-right corners (
) are calculated:
(1)
(2)
To ensure the penalty is scale-invariant, this distance is normalized by the dimensions of the smallest enclosing box that covers both the predicted and ground-truth boxes. Let w and h be the width and height of this enclosing box, respectively. The MPDIoU metric is then formulated as:
(3)
Finally, the MPDIoU loss function (LMPDIoU) is defined as:
LMPDIoU = 1 - MPDIoU (4)
Key advantages: This geometric penalty term directly addresses the aforementioned issues by: i) providing a meaningful, non-zero gradient even when boxes do not overlap, thus preventing gradient vanishing and ensuring continuous model optimization, ii) offering heightened sensitivity to positional, size, and aspect ratio deviations, which is critical for the precise localization of small and diverse PPE items, iii) delivering more stable and consistent gradient signals throughout training, which promotes faster convergence and results in superior localization accuracy.
Datasets and experimental setup
Self-built PPE detection dataset
We established a PPE detection dataset containing 5,000 high-resolution images from power transmission line operations, annotated with LabelImg and converted to YOLO TXT format. The dataset includes five categories: safety helmets (1,245 instances), safety harnesses (1,128 instances), armbands (892 instances), working-at-height status (1,056 instances), and ground-level status (1,124 instances). Data is split into training (4,000 images), validation (500 images), and test (500 images) sets. Images feature challenging conditions, including extreme lighting, heavy occlusion (23% with >50% coverage), and complex industrial backgrounds. Standard augmentation techniques (random flipping, rotation, color jitter, mosaic) were applied during training.
PASCAL VOC dataset for generalization testing
To evaluate the model's generalization capability beyond power operation scenarios, we used the PASCAL VOC dataset, which combines VOC2007 and VOC2012 for a total of 21,503 images. Following standard practice, we used 11,540 images from VOC2012 for training and validation, and 9,963 images from VOC2007 for testing. The VOC dataset contains 20 object categories in varied real-world scenarios. While the specific objects differ from our PPE categories, the detection challenges (scale variation, occlusion, complex backgrounds) are similar, making it suitable for assessing the model's general detection capabilities and transferability.
Implementation details
This protocol outlines the procedure for training and evaluating the model. It is assumed that the user has access to the source code, a suitable Python environment, and the prepared datasets.
System and environment preparation
A workstation equipped with an NVIDIA GPU possessing at least 24 GB of VRAM was used to ensure sufficient memory for training (e.g., NVIDIA GeForce RTX 4090). The PyTorch deep learning framework (version 1.12.0 or higher) along with its corresponding CUDA toolkit was installed on the workstation. The installation was verified by opening a terminal and executing the command "python -c 'import torch; print(torch.cuda.is_available())'", which was expected to return "True". Required Python packages were installed by navigating to the project root directory and executing the command "pip install -r requirements.txt". This command automatically installed dependencies including numpy, opencv-python, pyyaml, tensorboard, and torchvision. Dataset preparation was verified to ensure that training images were located in /data/train/images/ and annotation files were in /data/train/labels/ in YOLO format (class x_center y_center width height). The same verification process was applied to the validation (/data/val/) and test (/data/test/) datasets.
Training configuration
The configuration file config/wtls_yolov11n.yaml was opened using a text editor to set up the training parameters. Data paths were configured by locating the 'path' parameter and setting it to the dataset root directory, while the 'train', 'val', and 'test' parameters were verified to point to the correct subdirectories. The 'nc' parameter (number of classes) was confirmed to match the dataset, which was set to 5 for PPE detection. Training hyperparameters were configured with the number of epochs set to 300 for full training and the batch size set to 16, with the understanding that this value could be adjusted based on GPU memory availability and reduced to 8 if out-of-memory errors occurred. The input image size (imgsz) was set to 640, and the optimizer was confirmed to be SGD with an initial learning rate (lr0) of 0.01. The weight decay was verified to be 0.0005 and momentum was set to 0.937. Data augmentation techniques were enabled using the default configured settings, which included mosaic augmentation (mosaic: 1.0), random horizontal flip with 50% probability, and color jitter with parameters hsvh: 0.015, hsvs: 0.7, and hsvv : 0.4. Hardware utilization parameters were configured with the number of workers set to 8 for CPU threads used in data loading, and the device parameter set to 0 to use the first GPU, with the option to set it to "0,1" for multi-GPU training if needed.
Model training execution
Model training was initialized from the command line by executing the command "python train.py --cfg config/wtls_yolov11n.yaml --weights ''--data data.yaml", where the --cfg parameter specified the model configuration file, the --weights parameter was set to an empty string to train from scratch (alternatively, yolov11n.pt could be used for transfer learning), and the --data parameter specified the dataset configuration. During training, convergence indicators were observed to track model performance. In the first 50 epochs, a rapid loss decrease was observed with box_loss declining from approximately 1.5 to 0.8. Between epochs 50 and 150, steady improvement was noted as box_loss decreased from approximately 0.8 to 0.5. During epochs 150 to 300, the fine-tuning phase occurred with box_loss stabilizing around 0.4 to 0.5. The validation mAP@0.5 metric was expected to reach greater than 85% by epoch 200. Checkpoint saving was verified to ensure that training automatically saved checkpoints every 10 epochs to the directory runs/train/exp/weights/. The presence of last.pt (most recent checkpoint) and best.pt (highest mAP checkpoint) was confirmed, with each checkpoint file expected to be approximately 5 to 6 MB in size. Training progress could optionally be monitored using TensorBoard by opening a new terminal and executing the command "tensorboard --logdir runs/train", then navigating a browser to http://localhost:6006 to view real-time plots of loss curves, learning rate schedule, and mAP trends. Common issues were addressed through troubleshooting procedures, where CUDA out of memory errors were resolved by reducing the batch size to 8 or 4, NaN loss values were addressed by reducing the learning rate to 0.005, and mAP plateaus below 80% were investigated by verifying annotation correctness and increasing training epochs to 400.
Model evaluation protocol
A multi-faceted evaluation procedure was performed to comprehensively validate the effectiveness, efficiency, and interpretability of the proposed model.
Quantitative performance evaluation
Performance metrics
Evaluate model accuracy using mean Average Precision (mAP) at an IoU threshold of 0.5 (mAP@0.5), Precision, and Recall. Assess model efficiency by measuring the total number of Parameters (M) and Floating-point Operations (FLOPs, G). Measure inference speed in Frames Per Second (FPS) on both a server-grade GPU and an edge device. For edge device testing, set the power mode to maximum performance and warm up the model with 100 dummy inferences before recording FPS over 500 test images.
Comparison with state-of-the-art models: Benchmark the proposed WTLS-YOLOv11n model against its direct baseline (YOLOv11n) and a diverse range of detectors, including mainstream CNN-based YOLO models (YOLOv5n, YOLOv8n, YOLOv9s), a two-stage detector (Faster R-CNN), and a Transformer-based detector (RT-DETR). Train all models for 300 epochs using their recommended default hyperparameters. Record all metrics defined in the Performance metrics section for each model on both the self-built PPE dataset and the PASCAL VOC dataset. For VOC evaluation, train on the combined VOC2012 trainval and VOC2007 trainval sets, then test on VOC2007 test set following the standard protocol.
Ablation studies: Perform a systematic ablation study to dissect the individual contributions of the proposed components.
Component Effectiveness Analysis: Starting from the baseline YOLOv11n model, incrementally integrate the C3K2-WTConv module, the LSCD head, and the MPDIoU loss. For each configuration, retrain the model for 300 epochs using identical hyperparameters (batch size 16, learning rate 0.01, SGD optimizer). Record the changes in mAP, Precision, Recall, Parameters, FLOPs, and FPS to verify the efficacy of each component. Calculate percentage improvements relative to baseline for each metric.
Placement Analysis: To determine the optimal placement of the C3K2-WTConv module, integrate it into different parts of the network architecture. Test three configurations: (i) backbone-only integration, (ii) neck-only integration, and (iii) full integration in both backbone and neck. Train each configuration for 300 epochs and compare the resulting mAP@0.5 scores to identify the most effective integration strategy. Select the optimal configuration for all subsequent experiments.
Qualitative performance evaluation
Detection result visualization: Select 12-15 representative images from the test set that feature challenging real-world scenarios, including strong backlighting, heavy object occlusion, complex backgrounds, and unconventional camera angles. For each comparison model (baseline, YOLOv5n, YOLOv8n, YOLOv9s, and WTLS-YOLOv11n), run inference on these images using a confidence threshold of 0.25 and an IoU threshold of 0.45. Generate and render the detection outputs (bounding boxes with class labels and confidence scores) onto these images. Arrange visualizations in a grid format where rows represent different scenarios and columns represent different models.
Robustness analysis: Visually compare the rendered detection outputs from different models. Assess the robustness and superiority of the proposed model by counting and marking instances of false negatives (missed objects), false positives (incorrect detections), and duplicate detections (multiple boxes for a single object with IoU > 0.7 between predictions). Use red circles to highlight problematic detections in the visualization figure. Calculate per-model false negative rates and false positive counts across the selected test images. Extract and compare the mean confidence scores for true positive detections across models.
Interpretability analysis
To validate the inherent interpretability endowed by the C3K2-WTConv module, a visualization procedure was performed on selected input images. The trained WTLS-YOLOv11n model was loaded and a forward hook was registered on the C3K2-WTConv module at the 4th layer of the backbone. Forward propagation was performed on the input image, and the output feature tensor was captured. From the captured feature tensor of shape [batch, channels, height, width], channels corresponding to different frequency components were separated. The first 25% of channels were designated as the low-frequency (LL) component and the remaining 75% were designated as high-frequency (LH, HL, HH) components. For each frequency component type, the average across all channels within that component was computed to create single-channel activation maps. L2-norm was applied across spatial dimensions when needed to emphasize strong activations. The activation maps were normalized to range [0, 1] and a color map (e.g., 'jet' colormap) was applied. The heatmaps were resized to match the original input image resolution using bilinear interpolation. The low-frequency heatmap and high-frequency heatmap were overlaid onto the original image with 40% transparency to create interpretable visualizations showing where the model focuses on structural versus textural features.
To rigorously validate that detection decisions rely on frequency-domain features, a quantitative analysis was performed. A subset of 200 to 300 images was selected from the test set that contained successful detections (confidence score greater than 0.5). This subset was ensured to represent diverse scenarios to avoid sampling bias. For each image in the subset, forward propagation was performed, and the output of the C3K2-WTConv module at the 4th backbone layer was extracted. The feature tensor was separated into low-frequency (LL, first 25% of channels) and high-frequency (HF, remaining 75% of channels) components. For each image, the mean absolute activation strength was computed across spatial dimensions (height and width) for both frequency components. The LL strength was calculated as the mean of the absolute value of LL features across all spatial positions, and the HF strength was calculated as the mean of the absolute value of HF features across all spatial positions. These values were recorded along with the maximum detection confidence score for that image. Using the collected data (LL_strength, HF_strength, confidence_score) across all images, Pearson correlation coefficients were computed. The correlation between LL strength and confidence score was calculated, as was the correlation between HF strength and confidence score. Statistical software or Python's scipy.stats.pearsonr function was used to obtain both correlation coefficients (r) and p-values. Statistical significance was assessed using a p-value threshold of 0.05, where a p-value less than 0.05 indicated that the correlation was statistically significant. The magnitude of correlation coefficients was compared to determine which frequency component had stronger association with detection confidence. The following metrics were recorded in a structured format: LL correlation coefficient (rLL) and p-value (pLL), HF correlation coefficient (rHF) and p-value (pHF), mean activation strengths (meanLL, meanHF), and sample size (number of images analyzed). The expected outcomes were that low-frequency features would demonstrate stronger positive correlation with confidence scores (rLL greater than 0.60, p less than 0.001) compared to high-frequency features (rHF approximately 0.40 to 0.50, p less than 0.01), indicating that detection decisions were predominantly driven by structural information captured in the LL component.
This quantitative analysis established interpretability beyond the limitations of qualitative visualization. The combination of correlation analysis (demonstrating statistical association) and frequency-domain visualization (showing spatial attention) provided rigorous empirical evidence that the model's decision-making genuinely relied on low-frequency structural features as intended by design.
Expected outcomes: Low-frequency features should demonstrate stronger positive correlation with confidence scores (rLL > 0.60, p < 0.001) compared to high-frequency features (rHF≈ 0.40-0.50, p < 0.01), indicating that detection decisions are predominantly driven by structural information captured in the LL component.
This quantitative analysis establishes interpretability beyond qualitative visualization. The combination of correlation analysis (demonstrating statistical association) and frequency-domain visualization (showing spatial attention) provides rigorous empirical evidence that the model's decision-making genuinely relies on low-frequency structural features as intended by design.