Research Article

UB-LSTM: A Trajectory Prediction Method Combined with Vehicle Behavior Recognition

Algorithm 1

Trajectory prediction model.
(1)Input: x
(2)Output: out
(3)(batch_size, seq_length, n_feature-1) ⟵ x.shape;
(4)behavior ⟵ bemodel(x);
(5)x_tra ⟵ torch.cat(x, behavior);
(6)(batch_size, seq_length, n_feature) ⟵ x_tra.shape;
(7)Linear(n_feature, input_size) ⟵ FC1;
(8)LSTM(input_size, hidden_size, n_layers, bidirectional = False, dropout) ⟵ LSTM;
(9)Linear(n_feature, input_size) ⟵ FC2;
(10)LSTM(input_size, hidden_size//2, n_layers, bidirectional = True, dropout) ⟵ BILSTM;
(11)LSTM_OUT, hidden ⟵ LSTM(FC1(x_tra));
(12)BILSTM_OUT, hidden ⟵ BILSTM(FC2(x_tra));
(13)Linear(hidden_size, hidden_size ∗ 2) ⟵ FC3;
(14)Linear(hidden_size ∗ 2, hidden_size//2) ⟵ FC4;
(15)LSTM_FC_OUT ⟵Tanh(FC3(LSTM_OUT + BILSTM_OUT));
(16)fc_out1 ⟵ Tanh(FC4(LSTM_FC_OUT));
(17)Linear(n_feature, hidden_size//2) ⟵ FC5;
(18)fc_out2 ⟵ FC5(x_tra);
(19)Linear(hidden_size//2, output_size) ⟵FC6;
(20)out ⟵FC6(fc_out1 + fc_out2);
(21)end;
(22)Return out;