# A Traffic Information Detection Method at Single Intersection Based on Wi-Fi Data
## 3 Methodology
### Traffic Data Prediction Model of the Intersection Entrance Section  
#### 3.4.1 Training Data Preprocessing  
The preprocessing of data has a significant impact on the prediction performance of the LSTM neural network model. Therefore, it is necessary to perform operations such as cleaning, normalization, and data reconstruction on the time series of traffic data obtained through Wi-Fi data processing. The flowchart of traffic data preprocessing is shown in Figure 6.  
For the convenience of the following description, we will uniformly denote different types of traffic data as \"x\". The specific steps for preprocessing traffic data are as follows. Cleaning of traffic data:  
1. When the traffic data represents the spatial average speed, the maximum value should be the highest speed limit of the road section. Speed data exceeding this maximum value and zero-value data should be marked as missing data.
2. When the traffic data are the vehicle steering ratio, the zero value data of the steering ratio should be marked as missing data. Finally, missing data in the time series are uniformly filled using the average of the adjacent data. Normalization of traffic data: 1. When the traffic data are the spatial average speed, their values and fluctuation amplitudes are relatively large. The min-max method is adopted to normalize the speed data, which can reduce the size differences of the speed time series and accelerate the convergence process of LSTM neural network training, thereby improving the prediction effect.
2. When the traffic data are the vehicle steering ratio, no such operation is required. Reconstruction of traffic data: The time series of the traffic data is reconstructed to obtain the training samples to reflect the temporal and spatial correlation of the samples. The time series data obtained from the Wi-Fi data processing has a period of 15 min, and the samples used for prediction are consistent with it. The sample format of traffic data obtained from time series reconstruction is shown in (16): 1. When the traffic data \(x\) are the space mean speed, \(i\) is the number of the entrance section of the intersection that needs to be predicted in (16). \(i\)1, \(i\)2, and \(i\)3 are the numbers of the downstream left turn, straight, and right turn in intersection exit sections corresponding to the entrance section. The speed data of the entrance section and the three downstream exit sections, which include the current \(t-1\) time period and the first n time period, are taken to predict the space mean speed \(x_{i}^{t}\) of the entrance section \(i\) in the future \(t\) time period.
2. When the traffic data \(x\) are the vehicle steering ratio, i is the number of the entrance section of the intersection that needs to be predicted in (16). \(i\)1, \(i\)2, and \(i\)3 are the  
Figure 6: Flowchart of training data preprocessing process.  
corresponding numbers of the other three road entrance sections, except the current road entrance section. The vehicle steering ratio data of the entrance itself and the other three entrance sections, including the input data of the current \(t-1\) time period and the previous \(n\) time period, are taken to predict the vehicle steering ratio \(x_{i}^{t}\) of the entrance section \(i\) in the future \(t\) time period.  
\[x_{i}^{t}=\begin{bmatrix}x_{i1}^{t-n-1}&.&.&x_{i1}^{t-1}\\ x_{i2}^{t-n-1}&.&.&x_{i2}^{t-1}\\ x_{i3}^{t-n-1}&.&.&x_{i1}^{t-1}\\ x_{i}^{t-n-1}&.&.&x_{i}^{t-1}\\ \end{bmatrix} \tag{16}\]