Next Article in Journal
A Structure-Aware Multi-Modal Learning Framework for Robust Indoor Point-Cloud Registration
Previous Article in Journal
Blockchain-Enabled Trust and Compliance for Clinical AI: Decentralized Governance Without Decentralized Data Storage
Previous Article in Special Issue
Benchmarking Next-Generation YOLO Architectures for Multi-Platform Forest Fire Recognition
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

WCA-Det: Weak-Class-Aware Dual-Attention Enhancement for Fine-Grained Commodity Detection

1
School of Electronic Information and Electrical Engineering, Yangtze University, Jingzhou 434023, China
2
School of Computer Science, Central South University, Changsha 410083, China
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Electronics 2026, 15(14), 3047; https://doi.org/10.3390/electronics15143047
Submission received: 16 June 2026 / Revised: 7 July 2026 / Accepted: 8 July 2026 / Published: 11 July 2026

Abstract

Fine-grained commodity detection is a key visual task in intelligent retail, automatic checkout, and warehouse management. Compared with general object detection, commodity detection is more sensitive to subtle packaging differences, similar colors, local text patterns, and class-dependent appearance variations. These factors lead to unstable recognition for weak classes when a conventional detector is trained directly on a limited product dataset. To address this problem, this study proposes WCA-Det, a weak-class-aware dual-attention enhancement method for fine-grained commodity detection. The detector is built on a YOLO11-based framework and combines efficient multi-scale spatial attention with lightweight channel attention to strengthen discriminative product features. In addition, a weak-class augmentation strategy is introduced during training to improve the robustness of categories with lower mAP50-95, without increasing inference parameters or GFLOPs. Experiments on a self-built 12-class commodity dataset show that the proposed method achieves 0.98640 mAP50 and 0.85535 mAP50-95 at an input size of 640. Compared with YOLO11_EMA, mAP50-95 is improved from 0.84334 to 0.85535, corresponding to a 1.20 percentage-point gain. On the self-built dataset, the final model also outperforms representative YOLO-series detectors, including YOLOv5su, YOLOv8s, YOLOv8m, YOLOv9s, YOLOv10s, and YOLOv10m, while maintaining a compact computational cost. These results indicate that weak-class-aware feature enhancement is effective for fine-grained commodity recognition under practical intelligent retail conditions.

1. Introduction

Commodity detection has become an important enabling technology for intelligent retail, unmanned cabinets, automatic checkout, and inventory management. Unlike general object detection tasks, fine-grained commodity recognition often requires the detector to distinguish products with similar packaging layouts, colors, sizes, and local textual patterns. Small visual differences can determine the final category, and these differences may be weakened by illumination changes, partial occlusion, pose variation, and imaging noise.
YOLO-series detectors have been widely used in real-time visual perception because they provide a favorable balance between accuracy and inference speed [1,2,3,4,5]. Recent studies in Electronics have also shown that YOLO-based models remain active in industrial defect detection, medical image detection, UAV small-object detection, and retail-related visual applications [6,7,8,9,10,11,12,13]. However, these studies mainly emphasize general small-object detection, multi-scale fusion, or specific industrial defects. Fine-grained commodity detection still suffers from weak-class instability, where several categories obtain relatively low mAP50-95 even when the overall mAP50 is high.
Existing commodity-related studies from Yangtze University further indicate that intelligent retail scenes involve multi-size product recognition, dense goods, and dynamic visual cabinets [14,15,16]. These studies provide important references for commodity perception, but they do not specifically investigate the combination of weak-class-aware training and lightweight dual attention under a unified YOLO11-based detection framework. Therefore, the central question of this paper is not simply whether an attention module can improve a detector, but whether weak commodity classes can be improved through a coordinated structure-and-training design while preserving lightweight inference.
To this end, we propose WCA-Det, a weak-class-aware dual-attention enhancement method for fine-grained commodity detection. The method introduces multi-scale spatial feature enhancement and efficient channel recalibration into a YOLO11-based detector. A weak-class augmentation strategy is further used during training to improve categories with unstable detection performance. The main contributions are summarized as follows:
(1)
A dual-attention feature enhancement framework is constructed for fine-grained commodity detection, where multi-scale spatial attention and lightweight channel attention are combined to strengthen product-discriminative features.
(2)
A weak-class augmentation strategy is designed for hard commodity categories, including bsk1_wt, bss_large, hs_can, and nfsq. This strategy is used only during training and does not increase inference parameters or GFLOPs.
(3)
Comprehensive ablation and comparative experiments are conducted on a self-built 12-class commodity dataset. The final model achieves 0.85535 mAP50-95 at an input size of 640, improving YOLO11_EMA by 1.20 percentage points and outperforming representative YOLO-series detectors under the same training and evaluation protocol.

2. Related Work

2.1. YOLO-Series Object Detection

The YOLO family has evolved from anchor-based one-stage detection toward more efficient and flexible architectures. YOLOv8 is widely used in practical detection pipelines, YOLOv10 further explores end-to-end real-time detection, and YOLO11 provides an updated Ultralytics detection framework with improved feature extraction and training workflows [1,2,3,4,5]. Recent Electronics papers have extended YOLO models to defect detection, medical imaging, UAV sensing, and complex industrial monitoring [6,7,8,9,10,11,12,13]. These works demonstrate the adaptability of YOLO-style detectors but also show that task-specific feature enhancement is often required for difficult visual scenes.
Beyond CNN-based YOLO detectors, recent real-time detection transformers have attempted to improve the accuracy–speed trade-off by redesigning multi-scale feature interaction, query selection, dense positive supervision, and fine-grained localization refinement [17,18,19,20]. These methods provide important state-of-the-art context for efficient object detection. However, their strong performance is usually achieved through transformer decoders, query matching, or distribution-refinement mechanisms. In contrast, this study focuses on a compact YOLO11-based commodity detector and improves weak categories through lightweight feature enhancement and training-only augmentation, which is more suitable for small-scale commodity deployment scenarios with limited training data.

2.2. Attention Mechanisms for Visual Detection

Attention mechanisms improve convolutional features by emphasizing informative spatial regions or discriminative channels. SE and CBAM are representative attention modules that recalibrate channel and spatial responses [21,22]. ECA-Net further removes dimensionality reduction and uses local cross-channel interaction to achieve efficient channel attention [23]. EMA focuses on efficient multi-scale spatial representation and cross-spatial learning [24]. In commodity detection, local packaging details and subtle textures are critical, making attention-based feature enhancement a suitable mechanism for improving weak categories.
Recent work has also emphasized that visual enhancement should be connected to task-specific feature flows rather than treated as an isolated plug-in. For example, Tang et al. proposed a divide-and-conquer triple-flow network for RGB-T salient object detection, showing that complementary feature streams can improve discriminative localization when appearance cues are ambiguous [25]. Although the present study focuses on single-modality commodity detection rather than RGB-T saliency, this observation supports our motivation to combine multi-scale spatial enhancement and channel recalibration for products with subtle packaging differences.

2.3. Commodity Detection and Weak-Class Recognition

Retail product datasets such as SKU-110K and RPC reveal that commodity detection is affected by dense placement, fine-grained category boundaries, and limited real-world annotations [26,27]. Recent work related to Yangtze University has investigated commodity recognition with multi-size lifting and lowering sampling, dense goods recognition with cross-layer feature fusion, and commodity video deblurring in dynamic visual cabinets [14,15,16]. Compared with these studies, the present work focuses on weak-class-aware improvement in a compact detection pipeline, aiming to enhance difficult commodity categories without increasing the inference burden.
In addition, recent studies on open-vocabulary detection, lightweight small-object detection, UAV-based detection, thermal anomaly detection, class-imbalance diagnosis, and YOLO training evaluation provide useful methodological context for designing compact detectors and improving underrepresented categories [28,29,30,31,32,33,34,35].

3. Materials and Methods

3.1. Overall Framework

The proposed WCA-Det framework is shown in Figure 1. The model follows a YOLO11-based detection pipeline and consists of image input, backbone feature extraction, FPN/PAN feature fusion, dual-attention enhancement, and multi-scale detection heads. Weak-class augmentation is treated as a training-only branch rather than an inference module. Therefore, the final deployed detector retains the same inference path as the enhanced network.

3.2. Architectural Replacement and Complexity Clarification

It should be noted that the proposed attention design is not implemented by simply appending additional attention blocks to an unchanged YOLO11 baseline. In the original YOLO11 baseline used in this study, the high-level feature enhancement stage contains a C2PSA block at layer 10. In the YOLO11_EMA variant, this C2PSA block is replaced by an EMA-based multi-scale spatial attention block. Therefore, the parameter count can decrease from the baseline to the EMA variant, because the heavier C2PSA block is removed while a lighter spatial attention operation is introduced. The ECA module is then used as a lightweight channel recalibration component in the high-level feature path. This design should therefore be interpreted as a compact attention-oriented replacement of the high-level feature enhancement stage rather than as a parameter-increasing plug-in attached to the original YOLO11 backbone. Figure 1 presents the overall workflow of WCA-Det, including training-only weak-class augmentation, feature enhancement, multi-scale detection, and the summarized experimental outcome.
As summarized in Table 1, the reduction in model parameters mainly comes from replacing the layer-10 C2PSA block with the lighter EMA block. This makes the modified detector transparent and reproducible, and also explains why the final model maintains lower parameters and GFLOPs while improving the fine-grained commodity detection accuracy. The ECA operation itself is implemented by a one-dimensional convolution with kernel size k = 3 and therefore adds only three trainable weights when it is attached after the EMA replacement. Accordingly, the YOLO11_EMA_ECA row contains 82 , 432 + 3 = 82 , 435 parameters in the counted high-level enhancement stage. Although this parameter increase is very small, ECA is not a plain scalar plug-in. It still performs global channel descriptor extraction, local cross-channel interaction, sigmoid activation, and feature re-weighting. Therefore, its contribution comes from response recalibration rather than parameter expansion, which is consistent with the lightweight design goal of the final detector. By contrast, the YOLO11_ECA row reports the whole layer-22 C3k2 + ECA stage because the original C2PSA block is retained and ECA is attached to a different high-level feature block. Thus, the larger number in YOLO11_ECA does not represent the standalone ECA kernel, but the parameter count of the counted block where ECA is inserted.

3.3. Observation Model and Detection Formulation

For a commodity image sequence, the observed visual signal can be modeled as the combination of valid product appearance, imaging disturbance, and random noise:
x [ n ] = s [ n ] + v [ n ] + η [ n ] , n { 0 , 1 , , L 1 } .
where x [ n ] denotes the observed value at the n-th image or feature position, s [ n ] represents valid commodity appearance information, v [ n ] denotes illumination, pose, or background disturbance, and η [ n ] denotes random noise. The detector predicts bounding boxes, categories, and confidence scores as follows:
Y ^ = f θ ( X ) , Y ^ = { b ^ i , c ^ i , p ^ i } i = 1 N .
Equations (1) and (2) are used to define the feature enhancement objective of the proposed detector. In the subsequent modules, the multi-scale spatial attention branch is designed to preserve discriminative product appearance s [ n ] from local package textures and edge regions, the channel recalibration branch suppresses category-irrelevant responses caused by v [ n ] and η [ n ] , and the weak-class augmentation strategy expands the training distribution of hard categories so that f θ ( · ) becomes less sensitive to illumination and appearance perturbations.

3.4. Multi-Scale Spatial Feature Enhancement

Fine-grained commodity categories often differ in local textures, edge structures, and small packaging regions. Multi-scale spatial attention is introduced to enhance the interaction between local and global product features before detection.
The enhanced feature can be written as
F MS = F + M s ( F ) F ,
where F is the input feature map, M s ( · ) denotes the learned multi-scale spatial attention response, and ⊙ represents element-wise multiplication. This design improves spatial feature aggregation for visually similar commodity categories. The corresponding EMA module structure is illustrated in Figure 2.

3.5. Efficient Channel Recalibration

After high-level semantic features are obtained, an efficient channel attention operation is used to recalibrate category-related feature channels. The global channel descriptor of the c-th channel is computed as
z c = 1 H W i = 1 H j = 1 W F c ( i , j ) .
The local cross-channel response is then obtained by a one-dimensional convolution and a sigmoid activation:
s = σ Conv 1 D k ( z ) .
Finally, the recalibrated feature of the c-th channel is expressed as
F c = s c · F c .
Figure 2 also shows the cross-spatial interaction route and the re-weighting operation used by the multi-scale spatial enhancement branch.

3.6. Weak-Class Augmentation Strategy

Preliminary experiments showed that several commodity categories had lower AP under strict IoU thresholds, although their mAP50 values were already high. Let AP c , 0.5 : 0.95 ref denote the per-class mAP50-95 of the reference detector trained on the original training set. The weak-class set is defined as
W = { c AP c , 0.5 : 0.95 ref < τ } , τ = 0.80 .
According to this criterion, bsk1_wt, bss_large, hs_can, and nfsq were selected as weak categories. To avoid changing the geometric meaning of bounding boxes, only label-preserving photometric perturbations were used. The first variant enhances contrast and color saturation:
u = 1.14 x 6 , x bc = HSV 1 H ( u ) , clip ( 1.08 S ( u ) ) , clip ( 1.04 V ( u ) ) ,
where S ( · ) and V ( · ) denote the saturation and value channels after conversion to HSV space. The second variant simulates dim imaging and local sharpening:
v = 0.92 x + 10 , x ds = clip 1.45 v 0.45 G σ = 1.0 ( v ) + ϵ , ϵ N ( 0 , 3 2 ) ,
where G σ = 1.0 ( · ) is Gaussian blurring and ϵ is a small random noise term. The random generator seed was fixed to 20260604 when generating the offline augmented images. The bounding-box annotations were copied unchanged because no rotation, scaling, cropping, or translation was applied.
The augmentation was performed offline before training. For each original training image of bsk1_wt and nfsq, both variants in Equations (8) and (9) were added; therefore, their exposure multiplier was three. For bss_large and hs_can, only the contrast-enhanced variant was added, giving an exposure multiplier of two. The original training set contained 4800 images, and the weak-class-augmented training list contained 7200 entries. The validation set remained unchanged with 1020 images. This strategy modifies only the training distribution and does not change the inference network, parameters, or GFLOPs. The category-specific augmentation settings are summarized in Table 2.
The detector is trained with a standard detection loss composed of localization, classification, and distribution focal loss terms:
L = λ box L box + λ cls L cls + λ dfl L dfl .
The main evaluation metric is mAP50-95, which averages AP values across IoU thresholds from 0.50 to 0.95:
mAP 0.5 : 0.95 = 1 10 t { 0.50 , 0.55 , , 0.95 } AP t .

4. Experimental Results and Analysis

4.1. Dataset and Experimental Settings

Experiments were conducted on a self-built commodity detection dataset containing 12 product categories. The validation set contains 1020 images and 1020 object instances, with 85 validation images for each category. All main experiments used an input size of 640 to avoid unfair gains caused by resolution changes. Precision, Recall, mAP50, and mAP50-95 were used as evaluation metrics, and mAP50-95 was treated as the main metric.
Public retail datasets such as SKU-110K and RPC provide valuable benchmarks for dense shelf detection and product checkout recognition [26,27]. However, their label spaces, acquisition viewpoints, and object-layout protocols are different from the weak-class fine-grained commodity scenario considered in this work. Therefore, the main evaluation was conducted on the self-built commodity dataset with a consistent label space and fixed train–validation split. To improve reproducibility, the dataset splits, training code, model configuration, and evaluation scripts used in this study are publicly released in the repository specified in the Data Availability Statement. All ablation and comparison experiments were conducted under the same input size, dataset split, and evaluation protocol.
The experiments were implemented with Ultralytics 8.4.51, Python 3.10.20, PyTorch 2.12.0 with CUDA support, and an NVIDIA GeForce RTX 5060 Ti GPU (NVIDIA Corporation, Santa Clara, CA, USA). Unless otherwise specified, the models were trained for 200 epochs with a batch size of 8 and an input size of 640. The SGD optimizer implemented in PyTorch (Meta Platforms, Inc., Menlo Park, CA, USA) was used with cosine learning-rate scheduling, an initial learning rate of 0.01, and a weight decay of 0.0005. The main data augmentation settings were mosaic = 1.0, mixup = 0.15, copy-paste = 0.15, HSV value variation = 0.4, RandAugment auto-augmentation, and close-mosaic = 15. The final weak-class-aware fine-tuning stage was initialized from the trained YOLO11_EMA_ECA weights and optimized for 5 epochs with head-only updating, SGD, an initial learning rate of 5 × 10 6 , and mosaic, mixup, and copy-paste disabled. All comparison models used the same training and evaluation protocol to ensure fairness. Figure 3 summarizes the instance balance and bounding-box distribution of the self-built dataset, and Figure 4 shows the training dynamics of the final fine-tuning stage.

4.2. Ablation Study

As shown in Table 3, YOLO11 obtains 0.78350 mAP50-95. Introducing multi-scale spatial attention increases mAP50-95 to 0.84334, which is the largest single improvement in the ablation chain. Using channel attention alone also improves the baseline to 0.81833, indicating that channel recalibration is useful but insufficient by itself. Combining spatial and channel enhancement increases mAP50-95 to 0.85152. After weak-class augmentation, the final model reaches 0.85535 mAP50-95, improving YOLO11_EMA by 1.20 percentage points and the original YOLO11 by 7.19 percentage points.
To reduce the influence of random initialization and data-ordering effects, the final weak-class-aware fine-tuning stage was repeated with three random seeds under the same training settings. As shown in Table 4, the standard deviation of mAP50-95 is only 0.00035, indicating that the reported improvement is stable across repeated runs rather than being caused by a single favorable seed. The ablation trend is visualized in Figure 5.

4.3. Comparative Experiments

To address the need for broader comparison, we retrained representative YOLO-series detectors under the same self-built dataset split, input size, optimizer, batch size, training schedule, and evaluation protocol. As shown in Table 5, WCA-Det obtains the highest mAP50-95 among the compared models. Compared with YOLOv8m, the final model improves mAP50-95 by 10.72 percentage points while using 57.3% fewer parameters and 65.6% lower GFLOPs. Compared with YOLOv10m, it uses 33.2% fewer parameters and 57.7% lower GFLOPs while improving mAP50-95 by 28.14 percentage points. These results suggest that the gain is not obtained by simply enlarging model scale. Figure 6 and Figure 7 visualize the accuracy comparison and the accuracy–complexity trade-off among the compared detectors.

4.4. Cross-Source Overlap Validation

To further examine whether the proposed detector is only fitted to the main validation split, we conducted an additional cross-source overlap validation using commodity images collected from the independent data_6 source. Because this source does not contain all 12 classes of the main dataset, only the three shared categories were used: xb_can, xb_wt, and xb. The corresponding labels were remapped to the same category indices as the main 12-class detector, and the final model was directly evaluated without any additional fine-tuning on this overlap validation set.
As shown in Table 6, the final model achieves 0.993 mAP50 and 0.94156 mAP50-95 on 510 cross-source images. This additional validation does not replace large-scale public benchmark evaluation, but it provides an external consistency check on shared commodity categories and supports the robustness of the learned feature representations under a different data source.

4.5. PR Curve, F1 Curve, and Confusion Matrix

To further examine detection stability, the Precision–Recall curve, F1–Confidence curve, and normalized confusion matrix were analyzed. The final model achieves an overall mAP50 of 0.986, and most class-specific PR curves are concentrated near the upper-right region. The F1 curve reaches approximately 0.96 at a confidence threshold near 0.702, indicating a favorable balance between Precision and Recall. Figure 8, Figure 9 and Figure 10 show the PR curve, F1–Confidence curve, and class-only normalized confusion matrix, respectively.

4.6. Per-Class Results and Weak-Class Analysis

The final model performs well on most commodity categories. However, nfsq, bsk1_wt, bss_large, and hs_can remain weaker under mAP50-95, suggesting that strict localization accuracy and fine-grained category separation are still challenging for these products. This observation supports the need for weak-class-aware training rather than only reporting the overall mAP. Table 7 reports the detailed per-class detection metrics, and Figure 11 visualizes the corresponding mAP50-95 distribution.

5. Discussion

The ablation results indicate that multi-scale spatial feature enhancement is the dominant contributor to the final improvement. This is consistent with the visual characteristics of commodity detection, where category differences may appear at different scales and local regions. Channel recalibration provides an additional improvement by emphasizing discriminative semantic channels. The combination of both mechanisms is therefore more effective than either component alone.
Weak-class augmentation provides a smaller numerical gain than the attention modules, but it is important for practical deployment because it targets difficult classes without changing the inference structure. This means that the final model can improve weak categories while keeping the same deployment complexity. The seed-repeat experiment further shows that the final model maintains stable performance, with a mean mAP50-95 of 0.85501 and a standard deviation of 0.00035 across three repeated runs. Nevertheless, the current dataset is still limited in scale, and each validation class contains 85 images. To reduce this limitation, an additional cross-source overlap validation was performed on the independent data_6 subset, where the final model achieved 0.94156 mAP50-95 on three shared commodity categories without fine-tuning. The side-by-side Grad-CAM visualizations in Figure 12 and the CAM-in-box scores in Table 8 provide additional evidence for feature localization. On the four representative weak-class samples, the average CAM-in-box score increases from 0.106 for YOLO11_EMA to 0.149 for WCA-Det. This suggests that the proposed dual-attention design tends to concentrate activation more strongly on commodity regions. However, the bsk1_wt case also shows that attention localization is not uniformly improved for every individual image, so the visualization should be regarded as auxiliary interpretability evidence rather than a replacement for quantitative detection metrics. Future work should further evaluate the method on larger multi-scene commodity datasets and conduct more fine-grained visualization analysis under occlusion, reflection, and complex background conditions. Figure 12 presents side-by-side Grad-CAM examples for representative weak-class samples, and Figure 13 provides qualitative detection examples on commodity images.

6. Conclusions

This paper proposes WCA-Det, a weak-class-aware dual-attention enhancement method for fine-grained commodity detection. The method combines multi-scale spatial feature enhancement, efficient channel recalibration, and weak-class augmentation within a YOLO11-based detection framework. On a self-built 12-class commodity dataset, the final model achieves 0.98640 mAP50 and 0.85535 mAP50-95 at an input size of 640. Compared with YOLO11_EMA, mAP50-95 is improved by 1.20 percentage points, and compared with YOLO11, the improvement is 7.19 percentage points. Three seed-repeat runs obtain 0.85501 ± 0.00035 mAP50-95, confirming the stability of the final fine-tuning stage. Comparative experiments on the self-built dataset also show that the proposed method outperforms representative YOLO-series detectors, including YOLOv5su, YOLOv8s, YOLOv8m, YOLOv9s, YOLOv10s, and YOLOv10m, under the same evaluation protocol. In addition, cross-source overlap validation on 510 independent images from three shared commodity categories obtains 0.94156 mAP50-95 without further fine-tuning. These results demonstrate that weak-class-aware feature enhancement is a feasible strategy for improving fine-grained commodity recognition in intelligent retail scenarios.

Author Contributions

Conceptualization, Y.L., J.Z. and K.X.; methodology, J.Z. and K.X.; software, J.Z.; validation, Y.L., J.Z., Y.Z. and M.Y.; formal analysis, J.Z.; investigation, Y.L., Y.Z. and M.Y.; resources, K.X. and J.-B.H.; data curation, Y.L., J.Z., Y.Z. and M.Y.; writing—original draft preparation, J.Z.; writing—review and editing, Y.L., J.Z., Y.Z., M.Y., K.X. and J.-B.H.; visualization, J.Z.; supervision, K.X. and J.-B.H.; project administration, K.X.; funding acquisition, K.X. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by the National Natural Science Foundation of China (Grant No. 62272485).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The code, configuration files, released commodity detection dataset, and reproducibility materials supporting the findings of this study are publicly available in the GitHub repository WCA-Det v1.0.0, https://github.com/WCA-Commodity-Det/WCA-Det (accessed on 1 July 2026).

Acknowledgments

The authors would like to thank the School of Electronic Information and Electrical Engineering, Yangtze University, for providing research support and experimental conditions. Special thanks are hereby expressed to the students who assisted in commodity image collection, annotation, and experimental discussion. All acknowledged individuals have consented to this acknowledgement.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

AIArtificial Intelligence
YOLOYou Only Look Once
WCA-DetWeak-Class-Aware Detector
EMAEfficient Multi-Scale Attention
ECAEfficient Channel Attention
mAPMean Average Precision
IoUIntersection over Union
GFLOPsGiga Floating-Point Operations
FPNFeature Pyramid Network
PANPath Aggregation Network
NMSNon-Maximum Suppression
PRPrecision–Recall

References

  1. Wang, C.-Y.; Yeh, I.-H.; Liao, H.-Y.M. YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information. arXiv 2024, arXiv:2402.13616. [Google Scholar]
  2. Wang, A.; Chen, H.; Liu, L.; Chen, K.; Lin, Z.; Han, J.; Ding, G. YOLOv10: Real-Time End-to-End Object Detection. arXiv 2024, arXiv:2405.14458. [Google Scholar]
  3. Khanam, R.; Hussain, M. YOLOv11: An Overview of the Key Architectural Enhancements. arXiv 2024, arXiv:2410.17725. [Google Scholar]
  4. Tian, Y.; Ye, Q.; Doermann, D. YOLOv12: Attention-Centric Real-Time Object Detectors. arXiv 2025, arXiv:2502.12524. [Google Scholar]
  5. Ultralytics. Ultralytics YOLO11 Documentation. Available online: https://docs.ultralytics.com/models/yolo11/ (accessed on 12 June 2026).
  6. Xu, Z.; Wang, N. RAC-RTDETR: A Lightweight, Efficient Real-Time Small-Object Detection Algorithm for Steel Surface Defect Detection. Electronics 2025, 14, 4968. [Google Scholar] [CrossRef]
  7. Jung, D.-Y.; Oh, Y.-J.; Kim, N.-H. A Study on GAN-Based Car Body Part Defect Detection Process and Comparative Analysis of YOLO v7 and YOLO v8 Object Detection Performance. Electronics 2024, 13, 2598. [Google Scholar] [CrossRef]
  8. Yang, Z.; Xu, W.; Chen, N.; Chen, Y.; Wu, K.; Xie, M.; Xu, H.; Zheng, E. SDA-YOLO: Multi-Scale Dynamic Branching and Attention Fusion for Self-Explosion Defect Detection in Insulators. Electronics 2025, 14, 3070. [Google Scholar] [CrossRef]
  9. Zhou, W.; Gong, G. MD-YOLO: A Multi-Scale Adaptive and Dual-Attention Enhanced YOLOv11 for Small Object Detection. Electronics 2026, 15, 2099. [Google Scholar] [CrossRef]
  10. Fredj, H.B.; Garrab, H.; Souani, C. YOLO11-MSCA: A Multi-Scale Channel Attention Model for Lumbar Vertebra Detection in X-Ray Images. Electronics 2026, 15, 1341. [Google Scholar] [CrossRef]
  11. Wang, Y.; Guo, B.; Sun, L.; Yu, R. Toward Real-Time Industrial Small Object Inspection: Decoupled Attention and Multi-Scale Aggregation for PCB Defect Detection. Electronics 2026, 15, 1191. [Google Scholar] [CrossRef]
  12. Li, Z.; Fan, H. MFA-YOLO: Multi-Scale Fusion and Attention-Based Object Detection for Autonomous Driving in Extreme Weather. Electronics 2025, 14, 1014. [Google Scholar] [CrossRef]
  13. Shili, M.; Jayasingh, S.; Hammedi, S. Advanced Customer Behavior Tracking and Heatmap Analysis with YOLOv5 and DeepSORT in Retail Environment. Electronics 2024, 13, 4730. [Google Scholar] [CrossRef]
  14. Chen, M.; Chen, S.; Xie, K.; Wu, B.; Qiu, Z. A Commodity Recognition Model Under Multi-Size Lifting and Lowering Sampling. Electronics 2025, 14, 2274. [Google Scholar] [CrossRef]
  15. Wu, Z.; Wu, B.; Xie, K.; Yu, J.; Xu, B. Recognition of Dense Goods with Cross-Layer Feature Fusion Based on Multi-Scale Dynamic Interaction. Electronics 2025, 14, 2303. [Google Scholar] [CrossRef]
  16. Huang, S.; Liang, Q.; Xie, K.; He, Z.; Wen, C. Improved Transformer-Based Deblurring of Commodity Videos in Dynamic Visual Cabinets. Electronics 2024, 13, 1440. [Google Scholar] [CrossRef]
  17. Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. DETRs Beat YOLOs on Real-Time Object Detection. arXiv 2023, arXiv:2304.08069. [Google Scholar]
  18. Lv, W.; Zhao, Y.; Chang, Q.; Huang, K.; Wang, G.; Liu, Y. RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection Transformer. arXiv 2024, arXiv:2407.17140. [Google Scholar]
  19. Wang, S.; Xia, C.; Lv, F.; Shi, Y. RT-DETRv3: Real-Time End-to-End Object Detection with Hierarchical Dense Positive Supervision. arXiv 2024, arXiv:2409.08475. [Google Scholar]
  20. Peng, Y.; Li, H.; Wu, P.; Zhang, Y.; Sun, X.; Wu, F. D-FINE: Redefine Regression Task in DETRs as Fine-Grained Distribution Refinement. arXiv 2024, arXiv:2410.13842. [Google Scholar]
  21. Hu, J.; Shen, L.; Sun, G. Squeeze-and-Excitation Networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 7132–7141. [Google Scholar]
  22. Woo, S.; Park, J.; Lee, J.-Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision, Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar]
  23. Wang, Q.; Wu, B.; Zhu, P.; Li, P.; Zuo, W.; Hu, Q. ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 11534–11542. [Google Scholar]
  24. Ouyang, D.; He, S.; Zhang, G.; Luo, M.; Guo, H.; Zhan, J.; Huang, Z. Efficient Multi-Scale Attention Module with Cross-Spatial Learning. arXiv 2023, arXiv:2305.13563. [Google Scholar]
  25. Tang, H.; Li, Z.; Zhang, D.; He, S.; Tang, J. Divide-and-Conquer: Confluent Triple-Flow Network for RGB-T Salient Object Detection. IEEE Trans. Pattern Anal. Mach. Intell. 2025, 47, 1958–1974. [Google Scholar] [CrossRef] [PubMed]
  26. Goldman, E.; Herzig, R.; Eisenschtat, A.; Ratzon, O.; Levi, I.; Goldberger, J.; Hassner, T. Precise Detection in Densely Packed Scenes. arXiv 2019, arXiv:1904.00853. [Google Scholar]
  27. Wei, X.-S.; Cui, Q.; Yang, L.; Wang, P.; Liu, L. RPC: A Large-Scale Retail Product Checkout Dataset. arXiv 2019, arXiv:1901.07249. [Google Scholar]
  28. Cheng, T.; Song, L.; Ge, Y.; Liu, W.; Wang, X.; Shan, Y. YOLO-World: Real-Time Open-Vocabulary Object Detection. arXiv 2024, arXiv:2401.17270. [Google Scholar]
  29. Ji, C.-L.; Yu, T.; Gao, P.; Wang, F.; Yuan, R.-Y. YOLO-TLA: An Efficient and Lightweight Small Object Detection Model Based on YOLOv5. arXiv 2024, arXiv:2402.14309. [Google Scholar]
  30. Zheng, Y.; Jing, Y.; Zhao, J.; Cui, G. LAM-YOLO: Drones-Based Small Object Detection on Lighting-Occlusion Attention Mechanism YOLO. arXiv 2024, arXiv:2411.00485. [Google Scholar]
  31. Zhang, X. A Lightweight Model FDM-YOLO for Small Target Improvement Based on YOLOv8. arXiv 2025, arXiv:2503.04452. [Google Scholar]
  32. Chen, D.; Hu, Y.; Zhang, L. HierLight-YOLO: A Hierarchical and Lightweight Object Detection Network for UAV Photography. arXiv 2025, arXiv:2509.22365. [Google Scholar]
  33. Dhimish, M. HOTSPOT-YOLO: A Lightweight Deep Learning Attention-Driven Model for Detecting Thermal Anomalies in Drone-Based Solar Photovoltaic Inspections. arXiv 2025, arXiv:2508.18912. [Google Scholar]
  34. Crasto, N. Class Imbalance in Object Detection: An Experimental Diagnosis and Study of Mitigation Strategies. arXiv 2024, arXiv:2403.07113. [Google Scholar]
  35. Poureskandar, R.; Razzagzadeh, S. Improving Object Detection Performance through YOLOv8: A Comprehensive Training and Evaluation Study. arXiv 2025, arXiv:2505.11424. [Google Scholar]
Figure 1. Overall architecture of the proposed WCA-Det framework. Weak-class augmentation is used only during training, whereas the EMA and ECA components enhance feature representation inside the detector. Arrows indicate data flow, and dashed boxes separate data preparation, feature enhancement, detection, and result-summary stages.
Figure 1. Overall architecture of the proposed WCA-Det framework. Weak-class augmentation is used only during training, whereas the EMA and ECA components enhance feature representation inside the detector. Arrows indicate data flow, and dashed boxes separate data preparation, feature enhancement, detection, and result-summary stages.
Electronics 15 03047 g001
Figure 2. Structure of the EMA multi-scale feature enhancement module, showing feature grouping, cross-spatial interaction, and re-weighting. The asterisk (*) denotes element-wise multiplication.
Figure 2. Structure of the EMA multi-scale feature enhancement module, showing feature grouping, cross-spatial interaction, and re-weighting. The asterisk (*) denotes element-wise multiplication.
Electronics 15 03047 g002
Figure 3. Class-instance distribution and bounding-box spatial distribution of the commodity dataset. The colored bars denote class-wise instance counts, the blue rectangular outlines show normalized bounding-box coverage, and the density maps visualize box center and size distributions; darker blue indicates higher density.
Figure 3. Class-instance distribution and bounding-box spatial distribution of the commodity dataset. The colored bars denote class-wise instance counts, the blue rectangular outlines show normalized bounding-box coverage, and the density maps visualize box center and size distributions; darker blue indicates higher density.
Electronics 15 03047 g003
Figure 4. Training losses and validation metrics of the final weak-class-aware fine-tuning stage. Blue solid lines are epoch-wise results, and orange dotted lines are smoothed trends; the legend does not obscure the interpretation of the metric trajectories.
Figure 4. Training losses and validation metrics of the final weak-class-aware fine-tuning stage. Blue solid lines are epoch-wise results, and orange dotted lines are smoothed trends; the legend does not obscure the interpretation of the metric trajectories.
Electronics 15 03047 g004
Figure 5. Ablation comparison of mAP50-95 for YOLO11-series models at an input size of 640.
Figure 5. Ablation comparison of mAP50-95 for YOLO11-series models at an input size of 640.
Electronics 15 03047 g005
Figure 6. mAP50-95 comparison among representative YOLO-series detectors and the proposed method.
Figure 6. mAP50-95 comparison among representative YOLO-series detectors and the proposed method.
Electronics 15 03047 g006
Figure 7. Accuracy–complexity comparison in terms of mAP50-95 and GFLOPs.
Figure 7. Accuracy–complexity comparison in terms of mAP50-95 and GFLOPs.
Electronics 15 03047 g007
Figure 8. Precision–Recall curve of the final model on the validation set.
Figure 8. Precision–Recall curve of the final model on the validation set.
Electronics 15 03047 g008
Figure 9. F1–Confidence curve of the final model on the validation set.
Figure 9. F1–Confidence curve of the final model on the validation set.
Electronics 15 03047 g009
Figure 10. Row-normalized class-only confusion matrix of the final model. Each row is normalized to make the class-wise prediction distribution directly comparable; therefore, the displayed values remain within a valid normalized range. The background row and column are omitted for visual clarity.
Figure 10. Row-normalized class-only confusion matrix of the final model. Each row is normalized to make the class-wise prediction distribution directly comparable; therefore, the displayed values remain within a valid normalized range. The background row and column are omitted for visual clarity.
Electronics 15 03047 g010
Figure 11. Per-class mAP50-95 of the final model on the 12 commodity categories.
Figure 11. Per-class mAP50-95 of the final model on the 12 commodity categories.
Electronics 15 03047 g011
Figure 12. Side-by-side Grad-CAM comparison on representative weak-class samples. For each sample, the prediction and activation map of YOLO11_EMA are compared with those of WCA-Det. The comparison shows that WCA-Det generally produces more compact responses on product bodies, labels, and local package textures, while individual cases may still exhibit dispersed attention. The heat-map colors follow the standard Grad-CAM convention, where warmer colors indicate stronger activation. Dataset class identifiers such as bsk1_wt and nfsq are kept as category codes and do not affect reading.
Figure 12. Side-by-side Grad-CAM comparison on representative weak-class samples. For each sample, the prediction and activation map of YOLO11_EMA are compared with those of WCA-Det. The comparison shows that WCA-Det generally produces more compact responses on product bodies, labels, and local package textures, while individual cases may still exhibit dispersed attention. The heat-map colors follow the standard Grad-CAM convention, where warmer colors indicate stronger activation. Dataset class identifiers such as bsk1_wt and nfsq are kept as category codes and do not affect reading.
Electronics 15 03047 g012
Figure 13. Detection examples of the final model on commodity samples. The class identifiers shown in the predicted boxes are dataset category codes.
Figure 13. Detection examples of the final model on commodity samples. The class identifiers shown in the predicted boxes are dataset category codes.
Electronics 15 03047 g013
Table 1. Structural clarification of the modified high-level attention stage.
Table 1. Structural clarification of the modified high-level attention stage.
Model VariantLayer-10 ReplacementECA PositionCounted Block/StageParams
YOLO11C2PSAOriginal high-level C2PSA block at layer 101,455,616
YOLO11_EMAEMAC2PSA replaced by the lightweight EMA block82,432
YOLO11_ECAC2PSALayer 22Original layer-22 C3k2 block plus the attached ECA kernel2,365,443
YOLO11_EMA_ECAEMAAfter EMALayer-10 EMA block plus a lightweight ECA kernel82,435
Table 2. Weak-class augmentation configuration used in the final training stage.
Table 2. Weak-class augmentation configuration used in the final training stage.
IDClassOriginalAddedMultiplierOffline Variants
2bsk1_wt400800brightness–contrast–saturation enhancement; dim sharpening with Gaussian noise
3bss_large400400brightness–contrast–saturation enhancement
5hs_can400400brightness–contrast–saturation enhancement
8nfsq400800brightness–contrast–saturation enhancement; dim sharpening with Gaussian noise
Table 3. Ablation results of YOLO11-series models at an input size of 640.
Table 3. Ablation results of YOLO11-series models at an input size of 640.
MethodSizeParams (M)GFLOPsPRmAP50mAP50–95Gain vs. EMA
YOLO1164012.4427.9∼0.923∼0.904∼0.9750.78350−0.05984
YOLO11_EMA64011.0727.30.9700.9510.9870.84334
YOLO11_ECA64012.4427.90.9230.9040.9750.81833−0.02501
YOLO11_EMA_ECA64011.0727.30.9710.9480.9860.85152+0.00818
Ours64011.0727.30.9750.9490.9860.85535+0.01201
Note: Bold values denote the final proposed WCA-Det model.
Table 4. Seed-repeat stability of the final weak-class-aware fine-tuning stage.
Table 4. Seed-repeat stability of the final weak-class-aware fine-tuning stage.
RunBest EpochPRmAP50mAP50–95
S030.975120.948800.986400.85535
S110.975120.949760.985570.85503
S210.975110.949220.986610.85466
Mean0.975120.949260.986190.85501
Std.0.000010.000480.000550.00035
Table 5. Comparison with representative YOLO-series detectors at an input size of 640.
Table 5. Comparison with representative YOLO-series detectors at an input size of 640.
ModelSizeParams (M)GFLOPsPRmAP50mAP50–95
YOLOv5su6409.1524.210.6510.7270.7530.65888
YOLOv8s64011.1728.820.7070.8390.8350.72889
YOLOv8m64025.9079.320.7150.8010.8410.74814
YOLOv9s6407.3227.560.6780.7660.7640.67398
YOLOv10s6408.1325.110.5870.6940.6890.56950
YOLOv10m64016.5864.480.5410.7060.6740.57393
Ours64011.0727.300.9750.9490.9860.85535
Note: Bold values denote the proposed WCA-Det model.
Table 6. Cross-source overlap validation results on the independent data_6 commodity subset.
Table 6. Cross-source overlap validation results on the independent data_6 commodity subset.
ClassImagesInstancesPRmAP50mAP50–95
all5105100.9880.9790.9930.94156
xb_can1701700.9831.0000.9950.945
xb_wt1701700.9860.9940.9910.917
xb1701700.9940.9420.9940.963
Table 7. Per-class detection results of the final model.
Table 7. Per-class detection results of the final model.
ClassImagesInstancesPRmAP50mAP50–95
all102010200.9750.9490.9860.855
bsk185851.0000.9950.9950.872
bsk1_con85851.0000.9550.9950.937
bsk1_wt85850.9740.8750.9670.752
bss_large85850.9770.9880.9880.773
fd_can85850.9590.9880.9940.925
hs_can85850.9880.9330.9770.793
kkkl_can85850.8480.9650.9710.858
mnd_can85850.9870.9030.9880.864
nfsq85851.0000.8980.9800.727
xb_can85850.9701.0000.9940.942
xb_wt85850.9970.9880.9950.884
xb85851.0000.9000.9920.935
Table 8. Quantitative localization comparison of Grad-CAM responses on representative weak-class samples. The CAM-in-box score denotes the proportion of normalized Grad-CAM activation falling inside the ground truth product box.
Table 8. Quantitative localization comparison of Grad-CAM responses on representative weak-class samples. The CAM-in-box score denotes the proportion of normalized Grad-CAM activation falling inside the ground truth product box.
ClassYOLO11_EMAWCA-DetGain
bsk1_wt0.2290.138−0.092
bss_large0.0170.158+0.141
hs_can0.1130.176+0.063
nfsq0.0650.124+0.060
Average 0.1060.149+0.043
Note: Bold values denote the average CAM-in-box score over the four representative weak-class samples.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ling, Y.; Zhang, J.; Zhang, Y.; Yang, M.; Xie, K.; He, J.-B. WCA-Det: Weak-Class-Aware Dual-Attention Enhancement for Fine-Grained Commodity Detection. Electronics 2026, 15, 3047. https://doi.org/10.3390/electronics15143047

AMA Style

Ling Y, Zhang J, Zhang Y, Yang M, Xie K, He J-B. WCA-Det: Weak-Class-Aware Dual-Attention Enhancement for Fine-Grained Commodity Detection. Electronics. 2026; 15(14):3047. https://doi.org/10.3390/electronics15143047

Chicago/Turabian Style

Ling, Yixuan, Jinliang Zhang, Yongming Zhang, Mengzi Yang, Kai Xie, and Jian-Biao He. 2026. "WCA-Det: Weak-Class-Aware Dual-Attention Enhancement for Fine-Grained Commodity Detection" Electronics 15, no. 14: 3047. https://doi.org/10.3390/electronics15143047

APA Style

Ling, Y., Zhang, J., Zhang, Y., Yang, M., Xie, K., & He, J.-B. (2026). WCA-Det: Weak-Class-Aware Dual-Attention Enhancement for Fine-Grained Commodity Detection. Electronics, 15(14), 3047. https://doi.org/10.3390/electronics15143047

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop