# Multi-Adjacent Camera-Based Dangerous Driving Trajectory Recognition for Ultra-Long Highways
## 3 Methodology
### Anomaly Trajectory Recognition Based on Trajectory Rules
#### 3.3.5 Definition of Abnormal Trajectory Rule  
In this paper, we mainly define four types of abnormal vehicle trajectory behaviours, which include abnormal driving behaviour, abnormal vehicle speed, abnormal vehicle parking, and dangerous vehicle lane change. Figure 6: LSTM structure diagram. Three input quantities: \(x_{t}\) is the hidden state at the current moment, \(h_{t-1}\) is the hidden state at the previous moment, and \(c_{t-1}\) is the unit state at the previous moment. Two output quantities: \(h_{t}\) is the hidden state at the current moment, and \(c_{t}\) is the unit state at the current moment. Figure 7: Bidirectional LSTM structure diagram. Identification Wrong-way driving behavior: It refers to the abnormal behavior of a vehicle where its actual direction of travel is opposite to the prescribed road direction. Determining wrong-way behavior can primarily involve assessing both the position and angle of vehicle movement. To determine whether a vehicle is engaged in wrong-way driving at frame \(i\), it is first necessary to ascertain whether the set of vehicle movement paths is non-empty. Additionally, it is important to determine whether the monitoring camera is in an upstream or downstream state. Subsequently, the determination of wrong-way behavior is based on the collection of vehicle movement angles. In the downstream state, for normal driving vehicles, as they move away from the camera, the directions of the road regulations, vehicle movement, and the positive y-axis direction of the coordinate calibration are consistent. The range of vehicle movement angles is \((0,\pi)\). A wrong-way frame rate counter \(Num\) is set up, where a count is increased by 1 upon detecting a wrong-way frame. When \(Num/f\geq 0.2\), the vehicle can be classified as performing wrong-way driving. Considering the limited availability of wrong-way datasets, this study employs the opposite upstream/downstream configuration and uses the normal dataset for detecting wrong-way behavior in the reverse direction. Identification Abnormal vehicle speed behavior: It refers to instances where a vehicle does not adhere to the prescribed speed limit, encompassing both speeding and slow driving. Both of these behaviors pose significant traffic risks in real-world traffic scenarios. In the experiment for detecting abnormal vehicle speed behavior, given the diversity of vehicle types, distinct permissible speed thresholds are applicable. Thus, it is necessary to first determine the current vehicle category and travel lane, and then establish the minimum speed \"m\" and maximum speed \"n\" allowed by the road. Subsequently, based on the calculation method for vehicle speed determined during the mathematical description of vehicle trajectories, the vehicle speed is computed to ascertain if abnormal speed behavior is present. Considering the driving characteristics of vehicles in the research scenario, abrupt changes in vehicle speed are unlikely to occur within a brief period. Consequently, simultaneous occurrence of speeding and slow driving anomalies is unlikely. For the calculation, the set of vehicle average speeds \"\(V_{k}\)\" is computed with k = 10, using the average speed calculation over the most recent 10 frames. A count is incremented by 1 for each instance of speed anomaly. If consecutive 5 frames exhibit speed anomalies, it is concluded that the vehicle is engaged in abnormal speed behavior. Identification vehicle parking anomalies: In the context of highway scenarios, normal vehicle speeds are extremely high, making parking behavior highly perilous. Although vehicle parking is a continuous process involving gradual speed reduction and slow trajectory changes, we focus solely on identifying the eventual parking outcome. Recognition of parking behavior is achieved by considering the condition where the vehicle's position no longer changes. We establish a condition of no position change for a consecutive frame sequence of 5 frames. When this time threshold is exceeded, the vehicle is deemed to have parked.