Attention-augmented YOLOv8 for enhancing automated X-ray cargo inspection

Weng Yan Tham, Mahmud Iwan Solihin, Wei Kang Lai, Kim Soon Chong, Sew Sun Tiang, Jun Hao Tee, Y.J. Lee, C.L. Goh, Wei Hong Lim · Results in Engineering · 2026

• Improved YOLOv8 design integrates CBAM, triplet attention, and WIoUv2 loss function to enhance X-ray cargo detection. • The modified YOLOv8 is compared with YOLOv5 to YOLOv10, Faster-RCNN and DETR for performance evaluation using an X-ray cargo image dataset and OPIXray dataset. • The model demonstrates superior performance compared to the benchmark models on both Cargo and OPIXRay datasets. • The results show that attention mechanisms improve YOLO’s accuracy and efficiency for cargo threat detection. The global volume of container shipments has grown dramatically, reaching 183 million TEUs in 2023, which increases pressure on cargo transportation services and exposes systemic security vulnerabilities. Traditional manual inspections are time-consuming, prompting growing interest in deep learning–based automated inspection methods to detect concealed or illicit items more efficiently. This paper proposes a modified YOLOv8 object detector with CBAM in the backbone, triplet attention in the detection head, and WIoUv2 loss, evaluated against YOLOv5–YOLOv11, Faster R-CNN, and DETR. On our cargo X-ray dataset, the proposed model achieved precision, recall, mAP@50, mAP@50–95, and F1-score of 97.3%, 96.6%, 97.6%, 93.72%, and 96.93%, respectively, significantly surpassing the original YOLOv8n architecture, while maintaining a low computational cost (GFLOPs) comparable to baseline YOLO models. To assess generalization, the model is further tested on the OPIXRay baggage dataset which is selected due to the scarcity of publicly available annotated cargo X-ray datasets. The results show that incorporating attention mechanisms into the YOLO architecture enhances the detection accuracy without significant additional computational cost, highlighting its potential for automated cargo inspection systems.This work also contributes to the advancement of safer and more resilient logistics infrastructure, supporting the UN’s SDG on sustainable cities and communities.

Read the paper · More papers on PaperTik