# Prototype Network for Few-Shot Hazard Assessment of Vehicle Lane Changes in Risk Field
## 2 Analysis of Lane-Change Behavior and Data Extraction  
### Analysis of Lane-Change Behavior  
#### 2.1.1 The Start Point of the Lane Change  
As lane-changing behavior is continuous, identifying the lane-changing status requires selecting driving trajectory data from specific time periods as samples. To locate lane-change data, this study initially identified a vehicle's lane change points by observing changes in the vehicle's lane ID or the moment of the vehicle's center crossed a lane line. Using a dynamic time window, this study specified the phase of lane change execution when both the vehicle's lane ID and the vehicle's lateral position changed continuously. Equation (1) demonstrates that vehicles with continuous changes in lateral displacement and a number of continuously changing data points greater than 100 are positioned as lane-change vehicles. Further data extraction was performed in accordance with the three phases of the lane-change perception phase, lane-change execution phase, and lane-change adjustment phase  
\[local_{x_{i}}-local_{x_{i-1}}>local_{x_{i-1}}-local_{x_{i-2}} \tag{1}\]  
where \(local_{x_{i}}\) represents the lateral displacement or position of the vehicle at time \(i\), \(local_{x_{i-1}}\) denotes the lateral displacement of the vehicle at the previous time step, and \(local_{x_{i-2}}\) represents the lateral displacement of the vehicle two time steps ago. In order to eliminate the influence of continuous lane changes, lateral-motion constraints were added, and the expression is illustrated in Equation (2).  
\[\left\{\begin{array}{rl}(local_{x_{1}}+local_{x_{2}}+w)/2&<x_{target}\\ (local_{x_{1}}+local_{x_{2}}-w)/2+V_{w}&>x_{target}\\ (local_{x_{1}}+local_{x_{2}}+w)/2-V_{w}&<x_{ego}\\ (local_{x_{1}}+local_{x_{2}}-w)/2&>x_{ego}\\ \end{array}\right. \tag{2}\]  
where \(local_{x_{1}},local_{x_{2}}\) is the lateral position of the vehicle at the moments before and after the vehicle's lane ID has changed. \(V_{w}\) is the vehicle width, \(x_{ego}\) is the lateral position of the start of the vehicle lane change, \(x_{target}\) is the lateral position of the end of the vehicle lane change, and \(w\) is the lane width.  
The lane-change perception phase is the process from the driver's lane-change intention to their lane-change decision. The driver has the subjective intention to change lanes, but the surrounding traffic environment does not meet the lane-change conditions. For example, when the speed of the vehicle is lower than the speed of the vehicle behind the target lane, and the distance between the vehicle and the target lane is lower than the minimum safety distance, the vehicle data at this stage cannot be extracted.  
In this study, the complete lane-change data consisted of the instantaneous data from 5 s before and after the lane-change decision point. Therefore, the instantaneous data from 5 s before and after the lane-change decision point were selected as the total lane-change data [20; 21; 22]. The right lane-change process, single-vehicle lane-change process and lateral displacement trend are depicted in Figure 1. Figure 1a depicts the trajectory of the vehicle changing lanes to the right, which clearly shows the starting and ending points of the lane change. In addition, the points at which the lateral displacement changed continuously were taken as the data of the lane-change execution phase. Figure 1b shows the lateral displacement trend of a vehicle. It can be found that the lateral displacement varies continuously with the vehicle's position. The data with a continuous change in lateral displacement and more than 100 data points were selected as valid data for lane changes.