Lightweight Vehicle Detection in Dense Traffic Scenarios Based on YOLOv8n with ContextECA2.0 and Adaptive Window Attention

Abstract

To address the challenges of large vehicle scale variation, severe occlusion, and frequent target overlap in dense traffic scenarios, this paper proposes a lightweight vehicle detection method based on YOLOv8n. First, a novel ContextECA2.0 module is introduced at the detection head input, synergistically fusing local convolution features with global attention mechanisms to adaptively balance feature contributions across scales. Second, an Adaptive Window Attention (AWA) module dynamically adjusts the attention window size according to local target density, effectively balancing fine-grained small-object modeling and global contextual dependencies. Third, an attention-weighted SiOU loss function is introduced to dynamically weight regression gradients, improving the localization precision of overlapping targets. Extensive experiments were conducted on the large-scale VisDrone dataset (comprising 10,209 images) under an NVIDIA RTX 3090 GPU environment. Compared to the standard YOLOv8n baseline, the proposed method achieves significant improvements of 2.2% in mAP@0.5 and 1.5% in mAP@0.5:0.95, while maintaining a highly lightweight architecture (3.7M parameters) and real-time inference speed (120 FPS). The results validate the effectiveness, robustness, and practical deployability of the proposed method for dense vehicle detection in complex edge-computing traffic scenarios.

References

[1] Zhang L, Wang J, An Z. Vehicle recognition algorithm based on Haar-like features and improved Adaboost classifier[J]. Journal of Ambient Intelligence and Humanized Computing, 2023, 14(2): 807-815. Doi: 10.1007/s12652-021-03332-4.

[2] Tomikj N, Kulakov A. Vehicle detection with HOG and linear SVM[J]. Journal of Emerging Computer Technologies, 2021, 1(1): 6-9. https://repository.ukim.mk/entities/publication/48c3abfe-e4c7-470c-93ad-2d08ffaf802a.

[3] Wright J, Ma Y, Mairal J, et al. Sparse representation for computer vision and pattern recognition[J]. Proceedings of the IEEE, 2010, 98(6): 1031-1044. Doi: 10.1109/JPROC.2010.2044470.

[4] Zou, Z.; Shi, Z.; Guo, Y.; Ye, J. Object Detection in 20 Years: A Survey. Proc. IEEE 2019, 111, 257–276. Doi: 10.1109/JPROC.2023.3238524.

[5] Chughtai B R, Alhasson H F, Alnusayri M, et al. R-CNN Based Vehicle Object Detection via Segmentation Capabilities in Road Scenes[J]. Ieee Access, 2024. Doi: 10.1109/ACCESS.2024.3524453.

[6] Mittal U, Chawla P, Tiwari R. EnsembleNet: A hybrid approach for vehicle detection and estimation of traffic density based on faster R-CNN and YOLO models[J]. Neural Computing and Applications, 2023, 35(6): 4755-4774. Doi: 10.1007/s00521-022-07940-9.

[7] Alahdal N M, Abukhodair F, Meftah L H, et al. Real-time object detection in autonomous vehicles with YOLO[J]. Procedia Computer Science, 2024, 246: 2792-2801. Doi: 10.1016/j.procs.2024.09.392.

[8] Li Y, Huang Y, Tao Q. Improving real-time object detection in Internet-of-Things smart city traffic with YOLOv8-DSAF method[J]. Scientific reports, 2024, 14(1): 17235. Doi: 10.1038/s41598-024-68115-1.

[9] Bakirci M. Enhancing vehicle detection in intelligent transportation systems via autonomous UAV platform and YOLOv8 integration[J]. Applied Soft Computing, 2024, 164: 112015. Doi: 10.1016/j.asoc.2024.112015.

[10] Liu X, Wang Y, Yu D, et al. YOLOv8-FDD: A real-time vehicle detection method based on improved YOLOv8[J]. IEEE Access, 2024. Doi: 10.1109/ACCESS.2024.3453298.

[11] Mittal P. A comprehensive survey of deep learning-based lightweight object detection models for edge devices[J]. Artificial Intelligence Review, 2024, 57(9): 242. Doi: 10.1007/s10462-024-10877-1.

[12] Zhong J, Qian H, Wang H, et al. Improved real-time object detection method based on YOLOv8: a refined approach[J]. Journal of Real-Time Image Processing, 2025, 22(1): 4. Doi: 10.1007/s11554-024-01585-8.

[13] Jamali M, Davidsson P, Khoshkangini R, et al. Context in object detection: a systematic literature review[J]. Artificial Intelligence Review, 2025, 58(6): 1-89. Doi: 10.1007/s10462-025-11186-x.

[14] Wang Q, Wu B, Zhu P, et al. ECA-Net: Efficient channel attention for deep convolutional neural networks[C]//Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 2020: 11534-11542. Doi: 10.1109/CVPR42600.2020.01155.

[15] Yang J, Li C, Zhang P, et al. Focal attention for long-range interactions in vision transformers[J]. Advances in Neural Information Processing Systems, 2021, 34: 30008-30022. Doi: 10.5555/3540261.3542558.

[16] Wen Y, Xu P, Li Z, et al. An illumination-guided dual attention vision transformer for low-light image enhancement[J]. Pattern Recognition, 2025, 158: 111033. Doi:10.1016/j.patcog.2024.111033.

[17] Liu Z, Lin Y, Cao Y, et al. Swin transformer: Hierarchical vision transformer using shifted windows[C]//Proceedings of the IEEE/CVF international conference on computer vision. 2021: 10012-10022. Doi: 10.1109/ICCV48922.2021.00986.

[18] Cao, X.; Zhang, Y.; Lang, S.; Gong, Y. Swin-Transformer-Based YOLOv5 for Small-Object Detection in Remote Sensing Images. Sensors 2023, 23, 3634. Doi: 10.3390/s23073634.

[19] Dong C, Wang C, Zhai Y, et al. Gmtnet: dense object detection via global dynamically matching transformer network[J]. IEEE Transactions on Circuits and Systems for Video Technology, 2024, 35(5): 4923-4936. Doi: 10.1109/TCSVT.2024.3522661.

[20] Bodla N, Singh B, Chellappa R, et al. Soft-NMS--improving object detection with one line of code[C]//Proceedings of the IEEE international conference on computer vision. 2017: 5561-5569. Doi: 10.1109/ICCV.2017.593.

[21] Gevorgyan Z. SIoU loss: More powerful learning for bounding box regression[J]. arXiv preprint arXiv:2205.12740,2022. Doi:10.48550/arXiv.2205.12740.

[22] Liu C, Wang K, Li Q, et al. Powerful-IoU: More straightforward and faster bounding box regression loss with a nonmonotonic focusing mechanism[J]. Neural Networks,2024,170:276-284. Doi: 10.1016/j.neunet.2023.11.041.

[23] Sun G, Liu J, Zhang G, et al. Efficient RGB-D Scene Understanding via Multi-task Adaptive Learning and Cross-dimensional Feature Guidance[J]. Knowledge-Based Systems, 2025: 114107. Doi: 10.1016/j.knosys.2025.114107.

[24] Xiao B, Hu Y. Transform domain tensor-based deep unrolling network for single-frame infrared small target detection[J]. Pattern Recognition, 2026, 169: 111956. Doi: 10.1016/j.patcog.2025.111956.

[25] Husain S S, Bober M. Improving large-scale image retrieval through robust aggregation of local descriptors[J]. IEEE transactions on pattern analysis and machine intelligence, 2016, 39(9): 1783-1796. Doi: 10.1109/TPAMI.2016.2613873.

[26] Zhu Y, Li C, Tang J, et al. Quality-aware feature aggregation network for robust RGBT tracking[J]. IEEE Transactions on Intelligent Vehicles, 2020, 6(1): 121-130. Doi: 10.1109/TIV.2020.2980735.

[27] Du D, Zhu P, Wen L, et al. VisDrone-DET2019: The vision meets drone object detection in image challenge results[C]//Proceedings of the IEEE/CVF international conference on computer vision workshops. 2019: 0-0. Doi: 10.1109/ICCVW.2019.00030

[28] Howard A G, Zhu M, Chen B, et al. Mobilenets: Efficient convolutional neural networks for mobile vision applications[J]. arXiv preprint arXiv:1704.04861, 2017. Doi:10.48550/arXiv.1704.04861.

Authors

DOI:

https://doi.org/10.31449/inf.v50i12.14272

Keywords:

Array

Downloads

Published

06/29/2026

How to Cite

Lightweight Vehicle Detection in Dense Traffic Scenarios Based on YOLOv8n with ContextECA2.0 and Adaptive Window Attention. (2026). Informatica, 50(12). https://doi.org/10.31449/inf.v50i12.14272