## 3 Dataset Description and Processing
### Trajectory Extraction  
Through cleaning and filtering, it is ensured that the foundational data for analysis is reliable and accurate. Specifically, this paper employs the following heuristic rules to filter out abnormal trajectories in the dataset:  
1. Filtering out the data if the longitudinal velocity of a vehicle is always negative (opposite to the direction of travel), e.g., recordingId = 74, trackId = 785. 2. Selecting the vehicle driving data at the moment of 'laneChange' = 1, 'latLaneCenterOffset' \(\approx\) laneWidth/2. The trajectory metadata, overview data, and time-related information are integrated to generate a comprehensive and diverse merged trajectory dataset, thereby capturing key moments of the entire merging behavior through annotation. The recording and tracks data are thoroughly examined to identify potential issues, including checking for consistency in data format and addressing any possible outliers or abnormal trajectories. By mapping traffic participants to lanes in HD maps, semantic connections between these participants can be deduced. These semantic relationships may involve scenarios where vehicles are traveling in adjacent lanes or at intersections. The advantages of extracting merging trajectory and acquiring semantic relationships among traffic participants based on HD maps can be summarized as follows:  
1. Finer-grained trajectory recognition: High-precision maps enable the precise identification of the spatiotemporal positions of vehicles in each frame, including areas like Merging Section I, Merging Section II, and Merging Section III, as illustrated in Figure 2. This finer-grained recognition enhances our ability to understand the movements of vehicles within the traffic context. 2. Enhanced vehicle identification and scene classification: In-depth analysis of each frame's trajectories allows for accurate vehicle relationship matching and scene classification. For instance, it facilitates the identification of parallel vehicles on the main lane, improving our comprehension of complex traffic scenarios. 3. Objective metric definitions: The segmentation of each trajectory, as exemplified in Figure 2, supports the establishment of standardized criteria, leading to more objective metric definitions. This standardization contributes to greater consistency and objectivity in metric assessments. 4. Support for reproducible research: HD maps provide robust support for reproducible research endeavors. Researchers can conduct experiments and comparisons in a consistent environment using the same map data, bolstering the validation and replicability of their research. The methodology and framework for trajectory extraction based on HD maps is depicted in Figure 2, focusing on location2 as a case study. This approach is applied consistently across different collection locations, despite variations in laneletId and laneletLength. Firstly, the stereo images of location sites are displayed as background images in the editor. Secondly, the 'Linserting' and the 'Lanelet number' in Lanelet2 are used as the basis for manual annotation to establish a relational sequence of merging road segments. Finally, the membership information of the lanes upstream of the lanelet are matched with the 'odrRoadId' in the tracks files to manually label the vehicles with the typical pattern in which they are classified. These semantic relationships include driving in adjacent lanes or intersecting roadways, as detailed in Table 3.  
The main loop of the code reads tracks, recordingMeta, and trackMeta files at locations 2, 3, 5, and 6. The sub-loop includes the following:  
1. [label=()]
2. Iterating through each vehicle and determining whether it is a mainline vehicle, an on-ramp vehicle, or an off-ramp vehicle based on its laneletID list. 3. Extracting frames with laneChange = 1, filtering out frames with smaller consecutive IDs, and determining if they represent off-ramp lane change actions. 4. Matching the longitudinal and lateral velocity, acceleration, and position of the preceding and following vehicles.