# A Long Short-Term Memory-Based Approach for Detecting Turns and Generating Road Intersections from Vehicle Trajectories

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Methods

- (1)
- TTS detection: this component identifies the TTSs contained in each trajectory using an LSTM-based model that integrates the various motion attributes implied in the tracking points.
- (2)
- Intersection generation: this component calculates the TTS clusters based on the similarity of the position and direction measures and then determines the coverage of the intersections by aggregating the TTS clusters and extracting the internal paths of each intersection.

#### 2.1. Data Pre-Processing

#### 2.2. Detecting TTSs Using an LSTM-Based Model

#### 2.2.1. Input Layer

_{1}, g

_{2}, …, g

_{N}

_{−1}}, where g

_{i}$\left(i=1,\text{}2,\cdots ,N-1\right)$ stores the attributes that describe the motion characteristics of the vehicle at line segment ${e}_{i}$. We traverse a sliding window with constant size $s$, defined by the number of line segments inside the window, along each trajectory to obtain its motion attribute sequence. When the sliding window is centered at line segment ${e}_{i}$, four motion attributes, including tortuosity, turning angle, speed and acceleration, are computed according to the tracking points inside the window.

#### 2.2.2. Encoder and Decoder Layers

_{1}, g

_{2}, …, g

_{N}

_{−1}}. Once a new vector g

_{i}$\left(i=1,2,\cdots ,N-1\right)$ is added to the encoder, the hidden state ${h}_{i}$ and the cell state ${c}_{i}$ of the current LSTM unit are calculated based on the input g

_{i}, hidden states ${h}_{i-1}$, and the cell state ${c}_{i-1}$ of the previous LSTM unit. After the last vector, g

_{N}

_{−1}, is processed, the encoder summarizes the entire input sequence into the final states ${h}_{N-1}$ and ${c}_{N-1}$. Then, using ${h}_{N-1}$ and ${c}_{N-1}$ as the initial states, the decoder recursively generates the output sequence $\left\{{h\prime}_{1},{h\prime}_{2},\cdots ,{h\prime}_{N-1}\right\}$. The output vector ${h\prime}_{i}\text{}\left(i=1,2,\cdots ,N-1\right)$ for the ith decoder LSTM unit is derived by combing vector g

_{i}and the states ${h\prime}_{i-1}$ and ${c\prime}_{i-1}$ that were obtained from the previous decoder LSTM unit.

#### 2.2.3. Output Layer and Training Process

#### 2.3. Generating Intersection Structures from TTSs

#### 2.3.1. Clustering TTSs Based on Position and Direction Similarity

#### 2.3.2. Determining the Coverages of Intersections by Aggregating TTS Clusters

#### 2.3.3. Generating the Structural Model for Each Intersection

## 3. Experiments, Results and Discussion

#### 3.1. Experimental Dataset and Pre-Processing Settings

#### 3.2. Training and Evaluation of the LSTM-Based Model

#### 3.3. Results of TTS Detection and Intersection Generation

#### 3.3.1. Comparison of TTS Detection

#### 3.3.2. Comparison of Intersection Generation

## 4. Discussion

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Davies, J.J.; Beresford, A.R.; Hopper, A. Scalable, Distributed, Real-Time Map Generation. IEEE Pervasive Comput.
**2006**, 5, 47–54. [Google Scholar] [CrossRef] - Kuntzsch, C.; Sester, M.; Brenner, C. Generative models for road network reconstruction. Int. J. Geog. Inf. Sci.
**2016**, 30, 1012–1039. [Google Scholar] [CrossRef] - Biagioni, J.; Eriksson, J. Inferring Road Maps from Global Positioning System Traces: Survey and comparative evaluation. Transp. Res. Rec.
**2012**, 2291, 61–71. [Google Scholar] [CrossRef] - Fu, Z.; Fan, L.; Sun, Y.; Tian, Z. Density Adaptive Approach for Generating Road Network from GPS Trajectories. IEEE Access
**2020**, 8, 51388–51399. [Google Scholar] [CrossRef] - Ahmed, M.; Wenk, C. Constructing street networks from GPS trajectories. In European Symposium on Algorithms; Springer: Berlin/Heidelberg, Germany, 2012; pp. 60–71. [Google Scholar] [CrossRef]
- Cao, L.; Krumm, J. From GPS traces to a routable road map. In Proceedings of the 17th ACM International Symposium on Advances in Geographic Information Systems, Seattle, WA, USA, 4 November 2009; pp. 3–12. [Google Scholar] [CrossRef]
- Fathi, A.; Krumm, J. Detecting road intersections from GPS traces. In International Conference on Geographic Information Science; Springer: Berlin/Heidelberg, Germany, 2010; pp. 56–69. [Google Scholar] [CrossRef]
- Karagiorgou, S.; Pfoser, D. On vehicle tracking data-based road network generation. In Proceedings of the 20th International Conference on Advances in Geographic Information Systems, New York, NY, USA, 6 November 2012; pp. 89–98. [Google Scholar] [CrossRef]
- Xie, X.; Wong, K.; Aghajan, H.; Veelaert, P.; Philips, W. Inferring directed road networks from GPS traces by track alignment. ISPRS Int. J. Geo-Inf.
**2015**, 4, 2446–2471. [Google Scholar] [CrossRef] - Guo, Y.; Li, B.; Lu, Z.; Zhou, J. A novel method for road network mining from floating car data. Geo-Spat. Inf. Sci.
**2022**, 25, 197–211. [Google Scholar] [CrossRef] - Jiang, B.; Zhao, S.; Yin, J. Self-organized natural roads for predicting traffic flow: A sensitivity study. J. Stat. Mech: Theory Exp.
**2008**, 2008, P07008. [Google Scholar] [CrossRef] - Lee, K.; Lee, U.; Gerla, M. Survey of routing protocols in vehicular ad hoc networks. In Advances in Vehicular Ad-Hoc Networks: Developments and Challenges; IGI Global: Hershey, PA, USA, 2010; pp. 149–170. [Google Scholar]
- Murcio, R.; Masucci, A.P.; Arcaute, E.; Batty, M. Multifractal to monofractal evolution of the London street network. Phys. Rev. E
**2015**, 92, 062130. [Google Scholar] [CrossRef] - Wang, J.; Rui, X.; Song, X.; Tan, X.; Wang, C.; Raghavan, V. A novel approach for generating routable road maps from vehicle GPS traces. Int. J. Geog. Inf. Sci.
**2015**, 29, 69–91. [Google Scholar] [CrossRef] - Wang, J.; Wang, C.; Song, X.; Raghavan, V. Automatic intersection and traffic rule detection by mining motor-vehicle GPS trajectories. Comput. Environ. Urban Syst.
**2017**, 64, 19–29. [Google Scholar] [CrossRef] - Ezzat, M.; Sakr, M.; Elgohary, R.; Khalifa, M.E. Building road segments and detecting turns from GPS tracks. J. Comput. Sci.
**2018**, 29, 81–93. [Google Scholar] [CrossRef] - Yang, X.; Tang, L.; Niu, L.; Zhang, X.; Li, Q. Generating lane-based intersection maps from crowdsourcing big trace data. Transp. Res. Part C
**2018**, 89, 168–187. [Google Scholar] [CrossRef] - Deng, M.; Huang, J.; Zhang, Y.; Liu, H.; Tang, L.; Tang, J.; Yang, X. Generating urban road intersection models from low-frequency GPS trajectory data. Int. J. Geog. Inf. Sci.
**2018**, 32, 2337–2361. [Google Scholar] [CrossRef] - Arman, M.; Tampère, C. Lane-level routable digital map reconstruction for motorway networks using low-precision GPS data. Transp. Res. Part C
**2021**, 129, 103234. [Google Scholar] [CrossRef] - Garyfallidis, E.; Brett, M.; Correia, M.M.; Williams, G.B.; Nimmo-Smith, I. Quickbundles, a method for tractography simplification. Front. Neurosci.
**2012**, 6, 175. [Google Scholar] [CrossRef] - Yang, X.; Hou, L.; Guo, M.; Cao, Y.; Yang, M.; Tang, L. Road intersection identification from crowdsourced big trace data using Mask-RCNN. Trans. GIS
**2022**, 26, 278–296. [Google Scholar] [CrossRef] - Xie, X.; Liao, W.; Aghajan, H.; Veelaert, P.; Philips, W. Detecting road intersections from GPS traces using longest common subsequence algorithm. ISPRS Int. J. Geo-Inf.
**2016**, 6, 1. [Google Scholar] [CrossRef] - Zourlidou, S.; Sester, M. Intersection detection based on qualitative spatial reasoning on stopping point clusters. Int. Arch. Photogramm. Remote Sens. Spat. Inf. Sci.-ISPRS Arch.
**2016**, 41, 269–276. [Google Scholar] [CrossRef] - Lecun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature
**2015**, 521, 436–444. [Google Scholar] [CrossRef] - Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory. Neural Comput.
**1997**, 9, 1735–1780. [Google Scholar] [CrossRef] - Goodfellow, I.; Bengio, Y.; Courville, A. Deep Learning; MIT Press: Cambridge, MA, USA, 2016. [Google Scholar]
- Azari, E.; Vrudhula, S. An Energy-Efficient Reconfigurable LSTM Accelerator for Natural Language Processing. In Proceedings of the IEEE International Conference on Big Data, Los Angeles, CA, USA, 9 December 2019; pp. 4450–4459. [Google Scholar] [CrossRef]
- Khan, A.; Sarfaraz, A. RNN-LSTM-GRU based language transformation. Soft Comput.
**2019**, 23, 13007–13024. [Google Scholar] [CrossRef] - Chorowski, J.; Bahdanau, D.; Serdyuk, D.; Cho, K.; Bengio, Y. Attention-based models for speech recognition. In Advances in Neural Information Processing Systems 28; MIT Press: Cambridge, MA, USA, 2015. [Google Scholar]
- Yao, D.; Zhang, C.; Zhu, Z.; Hu, Q.; Wang, Z.; Huang, J.; Bi, J. Learning deep representation for trajectory clustering. Expert Syst.
**2018**, 35, e12252. [Google Scholar] [CrossRef] - Nawaz, A.; Zhiqiu, H.; Senzhang, W.; Hussain, Y.; Khan, I.; Khan, Z. Convolutional LSTM based transportation mode learning from raw GPS trajectories. IET Intel. Transp. Syst.
**2020**, 14, 570–577. [Google Scholar] [CrossRef] - Bao, Y.; Huang, Z.; Li, L.; Wang, Y.; Liu, Y. A BiLSTM-CNN model for predicting users’ next locations based on geotagged social media. Int. J. Geog. Inf. Sci.
**2021**, 35, 639–660. [Google Scholar] [CrossRef] - Lu, H.; Zhang, J.; Xu, Z.; Shi, R.; Wang, J.; Xu, S. Prediction of tourist flow based on multi-source traffic data in scenic spot. Trans. GIS
**2021**, 25, 1082–1103. [Google Scholar] [CrossRef] - Savitzky, A.; Golay, M. Smoothing and Differentiation of Data by Simplified Least Squares Procedures. Anal. Chem.
**1964**, 36, 1627–1639. [Google Scholar] [CrossRef] - Pander, T. EEG signal improvement with cascaded filter based on OWA operator. Signal Image Video Processing
**2019**, 13, 1165–1171. [Google Scholar] [CrossRef] - Etienne, L.; Devogele, T.; Buchin, M.; McArdle, G. Trajectory Box Plot: A new pattern to summarize movements. Int. J. Geog. Inf. Sci.
**2016**, 30, 835–853. [Google Scholar] [CrossRef] - Petitjean, F.; Ketterlin, A.; Gançarski, P. A global averaging method for dynamic time warping, with applications to clustering. Pattern Recognit.
**2011**, 44, 678–693. [Google Scholar] [CrossRef] - Cohen, J. A coefficient of agreement for nominal scales. Educ. Psychol. Meas.
**1960**, 20, 37–46. [Google Scholar] [CrossRef] - Kumari, L.V.; Sai, Y.P. Classification of ECG beats using optimized decision tree and adaptive boosted optimized decision tree. Signal Image Video Processing
**2022**, 16, 695–703. [Google Scholar] [CrossRef] - Quinlan, J. Induction of Decision Trees. Mach. Learn.
**1986**, 1, 81–106. [Google Scholar] [CrossRef] - Cortes, C.; Vapnik, V. Support-Vector Networks. Mach. Learn.
**1995**, 20, 273–297. [Google Scholar] [CrossRef] - Dilrukshi, I.; De Zoysa, K.; Caldera, A. Twitter news classification using SVM. In Proceedings of the 8th International Conference on Computer Science and Education, Colombo, Sri Lanka, 26 April 2013; pp. 287–291. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems 30; Curran Associates Inc.: Red Hook, NY, USA, 2017. [Google Scholar]

**Figure 4.**Schematic diagram of an LSTM cell, as proposed in the literature [25].

**Figure 5.**Example of TTS clustering results. Adjacent TTSs marked with the same color belong to one cluster.

**Figure 6.**Determining intersection coverages and obtaining clusters of non-turning trajectory segments (non-TTSs): (

**a**) applying Delaunay triangulation; (

**b**) creating the boundary circle for an intersection; (

**c**) obtaining clusters of non-TTSs within an intersection.

**Figure 7.**Extracting the internal paths of an intersection: (

**a**) TTS and non-TTS clusters (adjacent trajectory segments marked with the same color belong to one cluster); (

**b**) road path generation using K-means clustering; (

**c**) generated road paths.

**Figure 9.**Kappa coefficients achieved by the LSTM-based models with different hidden state dimensions and window sizes on the validation set.

**Figure 10.**Experimental results: (

**a**) overview of the detected TTSs (in red); (

**b**–

**e**) clustering results for the detected TTSs at intersections with different patterns (adjacent TTSs marked with the same color belong to one cluster); (

**f**–

**i**) coverages and internal paths generated based on the TTS clusters (circles indicate the boundaries of the detected intersections).

**Figure 11.**Results of intersection detection in the central urban region: (

**a**) using the local G* statistic-based approach and (

**b**) using the proposed approach. The points and segments in color are the detected turning points and TTSs, and turning points (TTSs) detected for the same intersection are marked in the same color.

**Figure 12.**Results of intersection detection in the semi-urban region: (

**a**) using the local G* statistic-based approach and (

**b**) using the proposed approach. The points and segments in color are the detected turning points and TTSs. Turning points (TTSs) detected for the same intersection are marked in the same color.

**Figure 13.**Comparison of the detected intersections using the two approaches. The points and segments in color are the detected turning points and TTSs, and the circles represent the boundaries of the detected intersections.

**Figure 14.**Detection results for TTSs (in red) at three typical complex intersections (

**a**–

**c**) using the proposed approach.

Tortuosity | Turning Angle | Speed | Acceleration | Kappa Coefficient |
---|---|---|---|---|

√ | √ | √ | √ | 0.774 |

√ | √ | √ | 0.766 | |

√ | √ | √ | 0.614 | |

√ | √ | √ | 0.746 | |

√ | √ | √ | 0.758 |

Method | Kappa Coefficient |
---|---|

DT-based model | 0.634 |

SVM-based model | 0.644 |

FNN-based model | 0.632 |

Transformer-based model | 0.693 |

LSTM-based model | 0.774 |

Study Area | Method | CR (%) |
---|---|---|

Central urban region | TCPP-based model | 81.6 |

LSTM-based model | 92.9 | |

Semi-urban region | TCPP-based model | 72.3 |

LSTM-based model | 88.7 |

**Table 4.**Statistical summary of the intersection detection results for the central urban and semi-urban regions using the two approaches.

Study Area | Approach | ${\mathit{n}}_{\mathit{T}\mathit{P}}$ | ${\mathit{n}}_{\mathit{F}\mathit{P}}$ | ${\mathit{n}}_{\mathit{F}\mathit{N}}$ | Precision (%) | Recall (%) |
---|---|---|---|---|---|---|

Central urban region | Local G* statistic-based approach | 72 | 18 | 7 | 80.0 | 91.1 |

Proposed approach | 79 | 5 | 7 | 94.0 | 91.9 | |

Semi-urban region | Local G* statistic-based approach | 95 | 34 | 18 | 73.6 | 84.1 |

Proposed approach | 111 | 7 | 17 | 94.1 | 86.7 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Wan, Z.; Li, L.; Yu, H.; Yang, M. A Long Short-Term Memory-Based Approach for Detecting Turns and Generating Road Intersections from Vehicle Trajectories. *Sensors* **2022**, *22*, 6997.
https://doi.org/10.3390/s22186997

**AMA Style**

Wan Z, Li L, Yu H, Yang M. A Long Short-Term Memory-Based Approach for Detecting Turns and Generating Road Intersections from Vehicle Trajectories. *Sensors*. 2022; 22(18):6997.
https://doi.org/10.3390/s22186997

**Chicago/Turabian Style**

Wan, Zijian, Lianying Li, Huafei Yu, and Min Yang. 2022. "A Long Short-Term Memory-Based Approach for Detecting Turns and Generating Road Intersections from Vehicle Trajectories" *Sensors* 22, no. 18: 6997.
https://doi.org/10.3390/s22186997