## 3 Methodology
### Prediction of Obstacles
In a two-dimensional space, the state of each obstacle can be represented as \(\mathbf{x}=[x,y,v_{x},v_{y}]^{T}\), where \(v_{x}\) and \(v_{y}\) are the velocities in the \(x\) and \(y\) directions, respectively. Utilizing the random walk model as the underlying motion model and assuming no control input, the system matrix \(A\) is defined as follows:  
\[A= \begin{bmatrix}1&0&\Delta t&0\\ 0&1&0&\Delta t\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix}  \tag{6}\]  
Here, \(\Delta t\) denotes the time step. The new position includes a random perturbation added to the previous position, modeled by the process noise covariance \(Q_{t}\). The state transition is given by \(x_{t+1}=Ax_{t-1}+w_{t}\), where \(w_{t}\sim\mathcal{N}(0,Q_{t})\) represents zero-mean Gaussian process noise. Since all four state variables are directly observable, the observation matrix \(H\) is defined as a \(4\times 4\) identity matrix. Accordingly, at each time step \(t+1\), the Kalman filter generates a prediction based on the previous estimate \(x_{j,t}\). \[x_{j,t+1}=Ax_{j,t}+B\mu+w_{t} \tag{7}\]  
Here, the parameter \(\mu\) represents the control input, and \(B\) is the control input coefficient. Subsequently, the predicted value is corrected based on actual observations:  
\[x_{j,t+1}=x_{j,t+1}y+K(y-Hx) \tag{8}\]  
where \(K\) is the Kalman gain, \(P\) represents error covariance, and \(R\) represents observation noise covariance. **(3) GRU Neural Network:** Following the aforementioned steps, a sequence predicted by the Kalman filter is obtained, providing position and velocity information of obstacles at each time step. These data are organized into a four-dimensional vector \(\mathbf{x}_{t}=[x_{pos},y_{pos},v_{x},v_{y}]\), which is then fed into the GRU network. Firstly, the hidden state \(h_{0}\) is initialized, serving as the memory unit that stores past information within the model. Then, for each frame, the following operations are performed:  
The update gate and reset gate are computed as shown in Equations (9) and (10), respectively:  
\[z_{t}=\sigma(W_{z}[h_{t-1},x_{t}]+b_{z}) \tag{9}\]  
\[r_{t}=\sigma(W_{r}[h_{t-1},x_{t}]+b_{r}) \tag{10}\]The candidate hidden state is generated by combining the current input with the adjusted previous hidden state through the reset gate:  
\[\tilde{h}_{t}=\tanh\left(W_{h}[r_{t}\odot h_{t-1},\ x_{t}]+b_{h}\right) \tag{11}\]  
The final hidden state at time step \(t\) is then computed by interpolating between the previous hidden state and the candidate state, weighted by the update gate:  
\[h_{t}=(1-z_{t})\odot h_{t-1}+z_{t}\odot\tilde{h}_{t} \tag{12}\]  
After processing all time steps, the final hidden state \(h_{T}\)--which encodes information from the entire input sequence--is obtained. This vector serves as a high-level abstract representation of the overall dynamic trajectory features. Typically, \(h_{T}\) is passed through one or more fully connected layers to generate the final prediction. For predicting the position and velocity of obstacles at the next time step, the following formula is employed:  
\[\hat{x}_{t+1}=W_{0}h_{t}+b_{0} \tag{13}\]  
where \(\hat{x}_{t+1}\) represents the model's estimate of the future state, and \(W_{0}\) and \(b_{0}\) are parameters of the output layer. The GRU network is composed of two layers: (1) GRU Layer: This is a variant of a recurrent neural network (RNN) comprising 50 hidden units, accepting input with a shape of (1, 4), i.e., processing one sequence at a time, with each sequence having four features. Unlike standard RNNs, GRU employs update and reset gates to control information flow. (2) Dense Fully Connected Layer: This layer concatenates all outputs generated by the preceding layer and is used to generate the final prediction results. The model is configured with four output nodes corresponding to the predicted positions \(x,y\) and their velocities \(\frac{dx}{dt},\frac{dy}{dt}\). After obtaining enhanced predictions for the low-speed group, the high-speed group's data undergoes similar prediction processing.