Prediction - Single-Vehicle Trajectory Prediction

This project uses a Seq2Seq model for vehicle Trajectory Prediction, with LSTM networks for both the encoder and decoder. The input is a vehicle’s historical trajectory coordinates, and the output is its predicted future trajectory coordinates.

The download link for the complete project is:https://github.com/TOPSlearningcenter/Trajectory_prediction_single

Given belowModel Overview, click on the rightRun Code Online

Model Overview

1. Model overview:

LSTM Encoder-Decoder is the most common sequence-to-sequence (seq2seq) model, first published by the classic paper in 2014《Sequence to Sequence Learning with Neural Networks》proposed, the number of citations has exceeded 10,000. The basic idea of ​​this model is to use an RNN network (encoder) to encode the input sequence into a fixed-length vector (context vector), which can be regarded as an abstract representation of the entire input sequence, and then use this vector as the initial input of another RNN network (decoder) and output a target sequence of arbitrary length.

2. Model Architecture:

  • The encoder uses one fully connected layer, four LSTM layers, and dropout to reduce overfitting.
  • The decoder has a structure similar to the encoder. The difference is that it receives an input sequence of Seq_len = 1 at each step, and each decoder output becomes the input for the next step.
  • The final Seq2Seq model combines the Encoder and the Decoder: the Encoder encodes the trajectory of all historical time steps of the input into a context vector, that is, hidden state, and the Encoder's final hidden state and cell state are used as the Decoder's initial hidden state and cell state. The first input of the Decoder is the last frame of the historical trajectory, and subsequent inputs are the prediction results of the Decoder.

3. Implementation:

  • Data Preprocessing: It mainly extracts and organizes trajectory information from data in csv format. In order to achieve better training results, the displacement vectors at the front and back moments are used as model input instead of absolute coordinates.
  • train: The commonly used teacher-forcing technique is adopted, that is, the input of the Decoder during training is the last output or the real current time point data with a certain probability, so that the network can avoid the defects of time series prediction to a certain extent: the initial prediction deviates, causing subsequent results to be affected.
  • Test/Evaluate: Use the trained model to predict all test data and calculate the required evaluation indicators. In order to ensure the objectivity of the evaluation results, teacher-forcing is not used.
  • Visualization: Use the trained model to predict part of the test data and draw historical trajectories, real trajectories and predicted trajectories.