Traffic-Prior-Guided State-Aware Framework for Robust Urban Traffic Anomaly Detection
Urban traffic systems are increasingly vulnerable to non-recurrent congestion and abnormal traffic fluctuations, posing significant challenges to intelligent traffic management and resilient transportation operations. Existing traffic anomaly detection methods often struggle to simultaneously characterize heterogeneous anomaly patterns under dynamically evolving traffic states, while severe class imbalance and limited data plausibility further constrain detection reliability. To address these challenges, this study proposes a traffic-prior-guided state-aware framework for robust urban traffic anomaly detection. A Multi-Scale Natural Neighborhood (MS-NaN) module transforms one-dimensional traffic flow sequences into a nine-dimensional representation integrating sequence dynamics, multiscale statistical deviations, and spatiotemporal phase characteristics, thereby embedding traffic state priors into the detection process. Building upon these representations, the Dual-Branch Context-Gated Network (DB-CGNet) separately captures instantaneous traffic disruptions and trend-evolving congestion patterns. An adaptive context-aware gated fusion mechanism then combines the branch features to enhance robustness under complex and non-stationary traffic conditions. To improve evaluation realism, high-fidelity baseline traffic data are generated through B-spline smoothing and first-order autoregressive residual modeling, and anomaly patterns are constructed under Highway Capacity Manual (HCM)-constrained capacity reduction mechanisms. Experiments conducted on a 91-day urban expressway dataset demonstrate that the proposed method achieves the best overall performance among eight benchmark models under a 72 min observation window, attaining an F1-score of 0.7757 and an area under the receiver operating characteristic curve (AUC) of 0.9112. Ablation studies further reveal the critical role of traffic prior features in detecting short-duration evolving anomalies. The proposed framework provides a robust and interpretable solution for intelligent urban traffic monitoring, anomaly warning, and resilient traffic operation management.