Automated X-ray security inspection requires object detectors to accurately and efficiently identify prohibited items under challenging conditions, such as dense occlusion, cluttered backgrounds, and limited computational resources. However, existing detectors often struggle with small, overlapping, or heavily occluded objects, which severely limits their real-world applicability. To address these challenges, we propose YOLOv8-DWConv-CSAF, a lightweight and discriminative multi-scale object detection framework specifically designed for X-ray imagery. Our method integrates architectural compression, attention-guided feature enhancement, and contrastive representation learning into a unified detection pipeline. Specifically, all standard convolutions in the YOLOv8 backbone are replaced with depthwise separable convolutions (DWConv), significantly reducing the number of parameters and computational cost while preserving representational capacity. To further enhance detection accuracy, we introduce a novel Channel-Spatial Attention Fusion (CSAF) module that synergistically combines SE and CBAM mechanisms to enrich both channel-wise and spatial feature representations. Additionally, stacked C2f modules facilitate effective multi-scale feature aggregation. To improve localization and class discriminability, we adopt a hybrid loss function that combines Pixel-wise IoU (PIoU) for precise bounding box regression with a supervised InfoNCE contrastive loss to promote intra-class compactness and inter-class separation in the learned feature space. Comprehensive evaluations on both the CLCXray and HiXray benchmarks validate that our model delivers state-of-the-art performance, combining high accuracy with real-time efficiency and robust generalization–making it well-suited for deployment in practical security screening systems.
Diao et al. (Wed,) studied this question.