# Spatiotemporal Road Traffic Anomaly Detection: A Tensor-Based Approach
###### Abstract  
The increased development of urban areas results in a larger number of vehicles on the road network, leading to traffic congestion, which often leads to potentially dangerous situations that can be described as anomalies. The tensor-based methods emerged only recently in applications related to traffic anomaly detection. They outperform other models regarding simultaneously capturing spatial and temporal components, which are of immense importance in traffic dataset analysis. This paper presents a tensor-based method for extracting the spatiotemporal road traffic patterns represented with the speed transition matrices, with the goal of anomaly detection. A novel anomaly detection approach is presented, which relies on computing the center of mass of the observed traffic patterns. The method was evaluated on a large road traffic dataset and was able to detect the most anomalous parts of the urban road network. By analyzing spatial and temporal components of the most anomalous traffic patterns, sources of anomalies can be identified. Results were validated using the extracted domain knowledge from the Highway Capacity Manual. The anomaly detection model achieved a precision score of 92.88%. Therefore, this method finds its usages for safety experts in detecting potentially dangerous road segments, urban traffic planners, and routing applications.  
a 2021 11 12017 11 12017 11 12017 11 12017 11 12017  
computation of the observed traffic pattern represented by the Speed Transition Matrix (STM). Compared to the traffic flow-based approaches, the main advantage of such an approach is its property that congestion cannot be wrongly detected as an anomaly.  
In the context of mentioned disadvantages, the contributions of this paper are as follows:  
* proposed method for the spatiotemporal road traffic patterns extraction which includes STM computation,
* the usage of the tensor composed of STMs to model the traffic patterns to address the spatiotemporal nature of the traffic data,
* proposed anomaly detection paradigm for the road networks based on the center of mass computation which addresses the problem of averaging many speed records into one value,
* the results of the anomaly detection are evaluated on the urban road network segments in a medium-sized European city.  
The proposed method consists of the three main steps: (i) Data preprocessing, (ii) grid-based map segmentation with STMs computation, and (iii) anomaly detection. The anomaly detection results are validated using the domain knowledge, extracted from the Highway capacity Manual (HCM) level of service values, with the achieved precision score of 92.88%.  
In this context, we revise and extend our previous work [2] by (i) more detailed problem and methodology description, (ii) introducing the STMs computing the harmonic vehicle speed, defined as relative values to be comparable with any road segment, (iii) improved tensor construction, introducing the grid-based map segmentation of the city area, and (iv) novel paradigm for the traffic anomaly definition on the road networks based on the computation of the STM.  
This paper is organized as follows. Section 2 presents related work on road traffic anomaly detection methods, emerging tensor-based traffic data modeling techniques, and general tensor-based models for anomaly detection. In Section 3, the background, definitions, and preliminary concepts are presented. Section 4 presents the proposed methodology used for the anomaly detection. Section 5 presents the method's results, including data processing, validation, analysis of the anomalous spatiotemporal patterns, and comparison to other approaches. Finally, Section 6 concludes the paper with a summary and future work directions.