# Prototype Network for Few-Shot Hazard Assessment of Vehicle Lane Changes in Risk Field
## 2 Analysis of Lane-Change Behavior and Data Extraction
### Extracting Data on Lane Changes  
The Next Generation Simulation (NGSIM) data set comprises vehicle traffic data collected through the NGSIM project that were acquired from the US Federal Highway Administration in 2002. It was used for training and testing in this study. Image processing technology was used to automatically identify and track most of the vehicles in the images to obtain the vehicles' accurate location and corresponding driving data. Then, the motion information of the vehicles was output in 0.1-second steps. The role of high-definition cameras installed in high places was to record traffic videos in the study area.  
The research of microscopic driving behavior relies heavily on the availability and high quality of traffic flow data. In order to collect vehicle data from different time periods, NGSIM detects a total of six segments of vehicle related data at US_101 and I80. Most previous articles have only analyzed the data for a certain time period of I80 or US_101 [29]. This paper integrates the states of vehicles and surrounding vehicles at different time periods, and it focuses on the free lane-change behavior in a highway environment during all six time periods of US-101 and I80. Based on the analysis of lane-change behavior, the driving data of the vehicles in the lane and the target lane were extracted.  
The NGSIM dataset contains more complex vehicle types and vehicle behaviors. According to the results of a statistical analysis, cars accounted for more than 90% of the detection time. Therefore, this paper focuses on the risk assessment of single lane-change behavior of car drivers. Data on motorcycles and large trucks were excluded. Next, the collected data were converted into units, through which feet are converted to m. The ramp data, i.e., the data of lanes 6, 7, and 8, were deleted. The data in the first period of US-101 were selected for data preprocessing to obtain 307 vehicles for left lane changes and 164 vehicles for right lane changes, including single-lane changes, continuous lane changes, and multiple-lane changes. Due to the focus of this study on single-lane-change data, a total of 188 left single-lane-change instances and 78 right single-lane-change instances were extracted, excluding continuous lane changes and multiple-lane changes.  
Vehicle location data derived from the video analysis resulted in the NGSIM dataset containing a large number of random errors. To address this issue, data filtering becomes necessary. Moving average filtering with low pass characteristics can effectively eliminate  
Figure 2: Mutual position relationship between lane-changing vehicles and surrounding vehicles.  
random interference signals that are mixed with measurement signals. Therefore, the moving average filtering approach was adopted in this study to smooth the data. The sliding window of the filter was set to 20 data points, for which \"20\" denotes the length of the moving sliding window. The relevant principle is shown in Equation (3).  
\[y(n)=\frac{1}{WS}(x(n)+x(n-1)+...+x(n-(WS-1)) \tag{3}\]  
where \(y(n)\) represents the output data processed at time point \(n\), \(x(n)\) represents the input data at time point \(n\), \(WS\) denotes the length of the sliding window, which is the number of data points used to compute the average, and \(x(n-1)\) to \(x(n-(WS-1))\) represent the input data points preceding time point \(n\) that were used to compute the moving average.  
Figure 3 depicts a smooth graph of vehicle speed and time headway after a moving average filter was applied. This filtering process enhances the preservation of driving behavior characteristics while reducing large fluctuations caused by minor lateral movements. A comparison between the filtered and pre-filtered data is illustrated in Figure 3a,b.