A YOLOv8-Based Real-Time Road Congestion Decision-Making Approach Fused with Channel–Spatial Attention and Dynamic Weighted Loss
Abstract
Conventional object detection models suffer from significant performance degradation in dense urban traffic scenarios. To address these critical limitations and enable accurate real-time road congestion decision making, this study proposes an optimized YOLOv8-based detection paradigm that decouples multi-scale feature enhancement from dynamic focused bounding box regression. Specifically, a multi-scale feature enhancement (MFE) module is designed to extract high-resolution shallow features directly from the P2 layer of the YOLOv8 backbone. Then, a convolutional block attention module (CBAM) is embedded into the feature fusion neck to adaptively filter complex urban background noise and recalibrate channel–spatial feature responses for vehicle target saliency. Furthermore, the standard CIoU loss is replaced with the Wise-IoU (WIoU) dynamic focusing loss function, which suppresses gradient interference from low-quality, occluded samples and stabilizes bounding box regression for dense vehicle targets. The high-precision vehicle detection outputs are fed into a quantitative congestion index (CI) model, which fuses vehicle density and average speed to realize real-time congestion-level classification. Extensive experiments on the public UAVDT benchmark dataset demonstrate that the proposed model achieves an mAP@0.5 of 83.1% (3.8 percentage points higher than the YOLOv8 baseline), an mAP_S (small target) of 23.2% (a 4.3 percentage point improvement), and a real-time congestion decision accuracy of 83.8%. Ablation studies verify the independent and synergistic effectiveness of the MFE, CBAM, and WIoU modules, with the MFE module making the greatest contribution to small-target detection performance (+1.7% mAP@0.5). The proposed model maintains a real-time inference speed of 86 FPS (frames per second) on an NVIDIA RTX 3090 GPU, far exceeding the 30 FPS threshold for real-time traffic monitoring.