Next Article in Journal
Dielectric Spectroscopy Studies and Modelling of Piezoelectric Properties of Multiferroic Ceramics
Previous Article in Journal
Data-Driven and Knowledge-Guided Heterogeneous Graphs and Temporal Convolution Networks for Flood Forecasting
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Microscopic Traffic Flow Data Generation Method Based on an Improved DCGAN

1
College of Automotive Engineering, Jilin University, Changchun 130012, China
2
State Key Laboratory of Automotive Simulation and Control, Jilin University, Changchun 130012, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2023, 13(12), 7192; https://doi.org/10.3390/app13127192
Submission received: 24 May 2023 / Revised: 7 June 2023 / Accepted: 14 June 2023 / Published: 15 June 2023
(This article belongs to the Section Transportation and Future Mobility)

Abstract

:
Microscopic traffic flow data, an important input to virtual test scenarios for autonomous driving, are often difficult to obtain in large quantities to allow for batch testing. In this paper, a neural network for generating microscopic traffic flow scene fragments is proposed, which is improved by adding Gate Recurrent Units (GRU) to the discriminator of the Deep Convolutional Generative Adversarial Network (DCGAN) to enable it to better discriminate continuous data. Subsequently, this paper compares individual sample motion trajectories of the generated data using Grey Relational Analysis (GRA) and Dynamic Time Warping algorithm (DTW) at the microscopic scale, and evaluates the overall scenes generated using averaged statistics at the macroscopic scale. The results show that the method proposed in this paper can generate realistic microscopic traffic flow data very well and that the neural network proposed in this paper can generate better near-realistic microscopic traffic flow data than the original DCGAN under the evaluation metrics used in this paper.

1. Introduction

1.1. Motivation

The concept of autopilot technology was first proposed one hundred years ago, but recent improvements in sensors and computing power have opened more opportunities for autopilot cars. Due to their sensing capabilities and overall controllability, autopilot cars can adapt and respond to a variety of transportation situations and events [1]. Studies show that the application of autopilot technology can greatly reduce the occurrence of traffic accidents [2] and traffic congestion [3] caused by human errors, and reduce environmental pollution [4]. Moreover, its application in transportation also greatly improves the productivity of the logistics system, which is an important direction of vehicle research and development at present.
With the development of automatic driving, the technology of automatic driving is becoming increasingly complex, and the testing and verification of auto-drive system functions has become one of the most important challenges in the process of research on automatic driving vehicles [5,6]. For virtual simulations of automatic driving cars, the lack of publicly available data sources makes it difficult to collect such traffic flow data, especially extremely dangerous driving data [7]. On the other hand, the acquired data may be polluted with incompleteness at specific locations or time periods, making certain data-driven decision cases or model learning tasks impossible to complete [8]. Therefore, the importance of having complete and available microscopic traffic flow data for the virtual testing of automatic driving cannot be overstated.

1.2. Literature Review

In recent years, scholars from various countries have conducted extensive and in-depth research on the field of traffic flow generation. In the early stages of the development of computer science, traffic researchers could only use empirical and mathematical methods for traffic modeling [9]. The data and information required by the TRANSYT system traffic model include the geometric characteristics of the road network, traffic volume data, economic indicators, etc. Cao et al. [10] proposed a new data-driven approach to populate virtual road networks with real traffic flows in 2018. By considering the temporal information of traffic flow as a two-dimensional texture, the generation of new traffic flow can be expressed as a texture synthesis process, which can be solved by minimizing the energy of the newly developed traffic texture. The synthetic output captures the temporal dynamics of the input traffic flow, where vehicle interactions strictly follow traffic rules.
However, traffic systems are usually complex systems, especially because the characteristics of traffic participants in traffic flow are different [11,12]. This leads to a high degree of uncertainty and unpredictability of traffic flow data, and it is difficult to accurately describe micro-traffic flow scenes with empirical models or mathematical analysis models. To address this issue, the learning-based approach has brought us to a new way of generating scenarios. Instead of making rules by hand, these models learn actor distributions directly from large datasets, and for any given map, they use regression methods to predict the layout of the actor [13]. Compared with rule-based systems, learning-based systems capture more complex and diverse real-world traffic scenarios. Some scholars [14] utilized a network to generate road macro traffic flow data by using a generative neural network and could well predict the flow distribution of traffic sections. However, macro traffic flow data cannot reflect the movement of surrounding vehicles in vehicle virtual simulation tests, and cannot be directly used in road scene tests [15], and there are few precedents for the implementation of micro traffic flow generation methods that can be used in virtual scene tests.
With the popularity of AI technology, there are now great advances in the technology of generating data. There are many types of generative neural networks available, and the main types that are often used to generate data are Variational Auto Encoder (VAE) and Generative Adversary Network (GAN) [16]. VAE consists of two parts: the encoder, which converts the training data from high-dimensional features to low-dimensional features based on the statistical distribution; and the decoder, which converts the data into data of the same dimension as the original data based on its low-dimensional features. The VAE learns the distribution features in the original samples and uses them to generate new samples [17]. GAN is composed of a pair of generators and discriminator networks. However, the training of GAN is unstable [18], which may lead to divergent results in the training process. In 2016, RadFord et al. put forward the Deep Convolutional Generative Adversarial Network (DCGAN) in their paper [19]. DCGAN uses a Convolutional Neural Network (CNN) to complete the feature extraction of the original data [20,21] so that the GAN model training process can be more easily divergent.
The development of generative neural networks has made it feasible to use AI techniques to generate microscopic traffic flow data.

1.3. Contribution

Manually designed scenarios do not necessarily meet the characteristics of naturalistic driving scenarios, and because naturalistic driving datasets are limited, they cannot be adequately tested. In addition, there is rarely an automated method that can output microscopic traffic flow scenarios in bulk.
To address the above issues, the main contributions of this study are: (i) A data generation method based on an improved DCGAN network for vehicle simulation of natural traffic flow is proposed. (ii) Experiments are designed to compare with the original DCGAN to verify that the proposed neural network can generate more realistic microscopic traffic flow data.

1.4. Article Structure

The organization of the sections of this paper is shown below:
In Section 2, we construct the neural network model that is used in this study and complete the pre-processing of the input data; in Section 3, we select the evaluation metrics for the generated data and complete the comparison of the results of the neural network designed in this study with the original DCGAN neural network generated data under these metrics; in Section 4, we summarize the full text and show an example of applications of the method, and finally describe the future work of this study.

2. Materials and Methods

As each training data contains more vehicles and the state of each vehicle is not the same, when trained with VAE, its posterior distribution is too simple and its objective function is KL scatter, which is relatively fixed and cannot learn the features of each vehicle well. DCGAN, on the other hand, solves the problem of difficult convergence of GAN, but also has the characteristics of CNN, with powerful feature extraction ability, and can extract the features of each vehicle. Moreover, compared to VAE, the input of DCGAN is a random vector and the output of DCGAN is more random and richer. Therefore, this study rotates DCGAN as the basic framework to further improve this research.

2.1. Improved DCGAN Model

The overall structure of DCGAN is shown in Figure 1. In order to enable the network to learn the distribution P x of the real sample x , we define the random input of the generator as n , and then map it to the data space P G according to G n ; we also define discriminator D , whose corresponding output D x is a scalar representing the probability that x comes from the real dataset rather than from the data space P g . In the process of confrontation training, we classify the probability of correctly classifying real samples and generating samples by maximizing D , and then we can complete the training of G by minimizing log ( 1 D G n ) , where they play a minimum and maximum game.
DCGAN reflects this theory in the actual training steps to carry out partial training for the two networks. The first step is to train the discriminator with the mixed samples from the generator and training set to complete the training of one step and improve its ability to distinguish between true and false data. In the next step, the generator and discriminator are combined into a network, which is fixed to the D that completed the training in the previous step, and then the generator completes the training of G under the current step according to minimum log ( 1 D G n ) , and then it turns into the next cycle of training. In the end, the two will fight against each other in the cycle of circuit training and improve their abilities to reach Nash equilibrium [22].
The core of DCGAN is the training of the generator and discriminator against each other to make the generated data conform to the distribution of real data. In order to make the basic DCGAN adapt to the scene data tensor, we modified the basic DCGAN in this paper. First, the input and output dimensions of the tensor were modified so that it could output traffic scene data that met our requirements. Second, because the training set data have a certain time dependence and the longitudinal position of the vehicle increases monotonically with time, this paper combines the Gate Recurrent Unit (GRU) with the DCGAN to change the discriminator model of DCGAN to a model composed of the GRU network.

2.1.1. Generator Model

The vehicle’s natural traffic flow data includes the running state of each vehicle on a long, straight structured road. Due to the number of participants in traffic, which is very large, a large amount of data must be generated. Therefore, it is necessary to improve the output size of DCGAN to generate the required traffic flow data volume.
The generator structure of the native DCGAN is shown in Figure 1, which includes a four-layer deconvolutional network to raise the input one-dimensional noise dimension to a size of 64 × 64 × 3 output to generate sample images. The size generated by the DCGAN generator is small. In this paper, a layer of the convolutional network is added because of the original network to make the size of the data output by its generator reach a size of 100 × 100 to meet the needs of the number of traffic participants and the total number of frames. Meanwhile, since the traffic flow data to be generated in this study records the transformation of vehicle coordinates in each frame, the structure of the generated data only needs to generate the x and y that correspond to the ID and frame. Therefore, the final output size is changed to a size of 100 × 100 × 2. The modified generator network is shown in Figure 2.

2.1.2. Discriminator Model

The parameters of vehicle trajectories not only have the characteristics of spatial distribution but also have a strong correlation with time, and the DCGAN network structure is not designed to process sequential data [23]. GRU is a variant of a recurrent neural network [24,25]. Similarly to Long Short-Term Memory (LSTM), it is used to solve the problem in which the gradient of the RNN network disappears during training. GRU is simpler and more efficient than LSTM [26,27,28]. So, we added the GRU network to the discriminator to try to improve its ability to discriminate continuous data.
The self-generated trajectory coordinate data of traffic participant vehicles in natural traffic flow are highly correlated with time; in particular, the x-coordinate of traffic participants has a certain increasing relationship in the time scale. Therefore, it is necessary that the generated data should also have a certain correlation in the time scale, and it is necessary to improve the discriminator of DCGAN to enable it to identify the feature changes among sequences. So, we introduced a gated neural network into the discriminator D network. The GRU has two gates: the update gate and the reset gate, which are used to determine the amount of past information used and the amount of past information forgotten.
Its network structure is shown in Figure 3, and the formula for the update gate is shown below:
z t = σ W z x t + U z h t 1
where σ represents the sigmoid activation function, W z and U z represent the weight matrix, x t is the input vector, and h t 1 indicates the implied state of the previous moment. The calculation formula for the reset gate is:
r t = σ W r x t + U r h t 1
Similar to the update gate, σ represents the sigmoid activation function, W z and U z represent the weight matrix, x t is the input vector, and h t 1 indicates the implied state of the previous moment. Candidate memory content is related to past information retained by the reset gate, and its calculation formula is as follows:
h t = tan h W x t + r t U h t 1
where h t represents the new memory content, represents the Hadamard product, and the input x t and the previous time step's information h t 1 first undergo a linear transformation, i.e., left multiplication of the matrices W and U , respectively.
The retained memory content is controlled by the update gate and reset gate and its calculation formula is as follows:
h t = z t h t 1 + 1 z t h t
where z t is the result of the activation of the update gate, which also controls the inflow of information in the form of gating; the Hadamard product of z t and h t 1 represents the information retained in the previous time step related to the final memory, and this information, plus the information retained in the current memory related to the final memory is equal to the output of the final gated loop unit.
The improved discriminator based on the GRU network has a similar basic structure, using GRU units after the convolutional layer to replace the original fully connected layer. The final discriminator structure is shown in Figure 4.

2.1.3. Loss Function

As shown in Figure 1, in the adversarial training of the model, the generator and discriminator in the network are trained separately at every moment and have their own loss functions. The confrontation between the two is a minimum and maximum game between the generator and discriminator loss.
For the discriminator, the calculation formula is
m a x   D V G , D = E x ~ p data   log D z + E z ~ p z log ( 1 D G z
The discriminator loss function is divided into two parts because the data sources in the training process are from the real dataset and the fake data generated by the generator.
x in E x ~ p data   log D x represents the real sample distribution. This part represents the discriminator’s ability to distinguish real sample data. The closer D x is to 1, the stronger the discriminator is to the real sample. The G z in E z ~ p z log ( 1 D G z represents the distribution of fake samples generated by the generator, and this part represents the discriminator’s ability to distinguish the fake sample data generated by the generator; the closer it is to 0, the stronger the identification ability of the generated fake samples. Therefore, by synthesizing the representational meanings of the two parts, it is required to maximize V G , D in training, so we obtain the m a x D .
For generators, the calculation formula is
m i n D V G , D = E z ~ p z log ( 1 D G z
The purpose of the generator is to trick the discriminator into recognizing its data as real data. Therefore, the closer D G z is to 1, the better the quality of the data generated by the generator, and the smaller the corresponding.
E z ~ p z log ( 1 D G z
So, we obtain the m i n G .
Therefore, the loss function of the network shown in this paper can be expressed as follows:
m i n G m a x   D V G , D = E x ~ p data   log D z + E z ~ p z log ( 1 D G z

2.2. Data Processing

The overall data-processing process of this study is shown in Figure 5. The dataset processing stage includes the production and generation content of the training set, including scene extraction from the original dataset, data slice segmentation, and design of the neural network input tensor. In the analysis stage, the generator completed by training is used to generate false data. Finally, the generation quality is evaluated by combining the samples in the original dataset.
This study processed the road vehicle running tracks recorded in the highD dataset and carried out follow-up research. The highD dataset used a bird’s-eye view to record the track data of about 110,000 vehicles at six separate locations on flat and straight highways. No. 1 location in the highD dataset has the largest number of records and its speed limit is 120 km/h, which is the same as the speed limit of China’s highways. Therefore, this study selects the recorded data of No. 1 location to make the real sample set. The location is configured with six lanes in both directions, and the total recorded length of the road is 420 m.

2.2.1. Scene Processing Extraction

In the raw dataset, many vehicles running in reverse are also recorded, and their motion patterns have similar characteristics to those of the forward vehicles. In this study, the recorded data of vehicles in the opposite direction are obtained by the relative coordinate transformation according to their increment, and the recorded data of vehicles driving in the positive direction is expanded.
Considering that there may be congestion in the dataset within the recorded time, which has a great impact on the motion performance of vehicles, this paper divides the dataset according to the time interval of 240 s and calculates the average speed of the samples at each time point.
The formula for calculating the average speed is as follows:
v = n L i = 1 n t i
where n represents the number of vehicles in the time interval, L represents the total length of the road, and   t represents the time for vehicles to pass through the road section. In actual processing, the total frame number is divided by the frame rate to obtain the total time.
The motion pattern of vehicles in the same traffic flow scenario can be analogized to a uniform flow of water; in order to make all vehicle samples’ input to the neural network the same length as possible, this paper classifies the scenarios based on the average vehicle speed. In this paper, scenes in the dataset are classified according to the classification criteria of the China Road Traffic Congestion Evaluation Method (GA/T115-2020) in Table 1.
Traffic congestion is evaluated at intervals of 180 s to 300 s, which is set at 240 s. The data processed above are split into units of 240 s, and those less than 240 s are split into units of 180 s, and the average travel speed is calculated for the split data. Traffic congestion is determined according to the average travel speed corresponding to the speed limit of 120 km/h in the table. The number of scenes with different traffic congestion degrees is shown in Figure 6.

2.2.2. Sample Segmentation and Filling

The average time for a vehicle to pass through the area in this record is 14.3 s. Therefore, we chose to segment all records within a time window of 20 s to ensure that the vehicle trajectory is relatively complete in each segment of the scene. The classified scene data were sliced at a sliding time interval of one second, and a total of 64,240 scene segments were extracted from the above sample.
However, not all vehicles’ running tracks are from the starting point of the road to the ending point of the road in the time window, so in the 20 s scene, some vehicles may have a situation of missing positions. In this paper, the X-coordinate is interpolated by a one-time function, whereas the y-coordinate is processed by a consistent invariant path, as shown in Figure 7.
It is assumed that the vehicle enters the monitoring area at time t m and drives out at time t n , and the blue area is the filling value, where
X 0 = X m , X n + t = X n + V n t , X 20 = X n + V n t , Y 0 = Y m , Y n + t = Y 20 = Y n  

2.2.3. Training Set Production

The input size of the neural network in the training process is fixed and matches the data of the training set. In this paper, the X and Y coordinates of the vehicle running track are divided into two channels, and the X and Y coordinates of each vehicle at different times are represented by a matrix, which is normalized and filled into the matrix.
The data tensor input by the network is shown in Figure 8, where each channel contains a matrix with n rows and m columns, where n represents the vehicle ID, m represents the frame bits in the dataset, and the data in the corresponding cell represents the data value normalized by the following formula under X or Y channel of a vehicle with a certain ID in a certain frame.
x n o r m = x x m i n x m a x x m i n  
where x n o r m is the value that fills the tensor, and x m a x and x m i n are the maximum and minimum values of the parameter in the training set.
Considering that the original dataset recorded the vehicle operation data at a frame rate of 25 fps, the data displacement difference between frames is very small. In this study, the coordinate data within the original scene is sampled every 5 frames, and the total number of data frames is compressed to 100 frames to obtain m = 100 .
According to statistics, the maximum number of vehicles appearing in scenes in the highD dataset is about 80. The maximum number of vehicle IDs that can be accommodated in the training set designed in this paper is n = 100 , which is sufficient to meet the requirements of all scenes. For incomplete records, 0 is assigned to the coordinate data.

3. Results and Discussion

The final microscopic traffic flow data in this study is generated by a generative network trained at 2800 epochs in different traffic congestion level scenarios. The neural network learns the traffic flow data of three traffic congestion level scenarios (because there is no data on severe congestion scenarios in the classification results, so this type of scenario is not considered for the time being) to generate virtual samples of different traffic congestion level scenarios. We provided a set of random noise input-generating networks conforming to a normal distribution, and the generated network output tensor converts the data into the horizontal and vertical coordinate values of each vehicle at different times using the de-normalization formula as shown below:
x = x n o r m ( x m a x x m i n ) + x m i n  
where x is the actual horizontal and vertical coordinate value, x n o r m is the actual value output by the neural network (between 0 and 1), and x m a x and x m i n are the maximum and minimum values of the same parameters in the scene training set.
Due to certain jitter of the x and y coordinate data output by the neural network, this study used a quintic polynomial to fit the X and Y coordinates in the post-processing stage, and finally combined the sample information and saved it into csv files to complete the generation of virtual data. Part of the generated data samples in a clear road scene and visualization is shown in Figure 9.
In the above figure, sample represents the number of scenes generated by the generator; frame represents the data in the number of frames; id represents the ID of a vehicle under the sample; X and Y represent the detailed location data of the vehicle. The speed information required for subsequent statistics is calculated by the mean value method of vehicles under a frame time (0.2 s) according to the position changes between the frames.

3.1. Result of Improved DCGAN

The trained network is then used to generate microscopic traffic flow scenes, extract the samples generated therein, and derive the variation in velocity and acceleration of the traffic participant using the transformation of position, which is shown in Figure 10.
Since the number of vehicles contained in the original data is relatively large and the motion states of some vehicles vary greatly, it is not necessary to study the proximity of all vehicles in the original data. Therefore, to evaluate the proximity of the generated vehicles to the original ones, this study uses both the ocular and statistical approaches. The eye-viewing method is mainly used to find the original vehicles that are similar to the generated vehicles by observing the motion state diagram of the vehicles, followed by the statistical point of view, and the metrics of the vehicles are selected for evaluation.
As vehicles are sparse in the smooth scene and there are more motion states of the vehicles, this study mainly evaluates the smooth scene and selects vehicles with similar running states to the generated vehicles from the smooth scene of the original data and plots the motion states of some vehicles, as shown in Figure 11.

3.2. Result of Conventional DCGAN

In this paper, the evaluation metrics described above are chosen to judge the similarity between the microscopic traffic flow generated by the neural network and the real vehicle movement conditions and to compare it with the data generated by the conventional DCGAN. The conventional DCGAN and the neural network designed in this paper share the same generator, with only a few changes in the discriminator side, where the setup of the discriminator of the conventional DCGAN is shown in the following Figure 12.
The results generated by DCGAN are processed in the same way as shown above, and the final generated results are shown in Figure 13 and Figure 14.
Because the data generated by the neural network designed in this study are all vehicle movement positional data in a scene, the generated traffic flow data have been evaluated from both macro and micro perspectives. This study compares the individual vehicle motion samples generated by the neural network with similar samples in the original dataset and uses multiple metrics to judge their similarity. In addition, statistical metrics were used to analyze the entire generated scenario data to determine the degree of fidelity of the generated data.

3.3. Evaluation for Individual Samples

After selecting vehicles from the original data with motion states similar to those of the generated vehicles, the vehicle metrics were evaluated using statistics. The vehicle metrics used in this study, such as in the original data, were lateral velocity V y , longitudinal velocity V x , lateral acceleration a y , longitudinal acceleration a x , the standard deviation of vehicle speed S v , and the square root of the acceleration A a . For V y , V x , a y , and a x , which are four metrics that can be expressed in a sequence, the evaluation is performed using a statistic that can calculate the degree of sequence similarity, and for S v and A a , the values of the indicators of the selected vehicles are averaged and compared with the values of the indicators of the generated vehicles.

3.3.1. Statistical Results of V y , V x , a y , and a x

The Grey Relational Analysis (GRA) is used to describe the development and change of a system by quantitative and comparative methods, evaluating whether two sequences are close based on the similarities between the reference sequence and the comparison sequence. Therefore, grey relational analysis was used in this study to evaluate the closeness between the generated data and the original data. The formula is as follows:
ζ i k = min i   min k y k x i k + ρ   max i   max k y k x i k y k x i k + ρ   max i   max k y k x i k
where y is the reference sequence data, x i is the comparison sequence data, and ρ is the discrimination coefficient, 0 < ρ < 1 . If ρ is smaller, the greater the difference between the correlation coefficients, the stronger the discrimination ability. Usually, ρ = 0.5 .
The Dynamic Time Warping algorithm (DTW) carries out nonlinear time domain alignment adjustment processing on two time series based on dynamic programming, and then searches and estimates the minimum possible distance between them to represent the similarities between them. Considering that there may be some problems, such as misalignment of the time step and different lengths of sequence between the running parameter sequences of vehicle operation, the similarity of the two time series cannot be effectively evaluated by relying only on the grey relational degree. Therefore, this study also used DTW statistics to evaluate the similarities between different vehicle operating parameters.
The grey relational analysis and DTW statistics were used to calculate the proximity between the generated vehicle and the selected original vehicle to the four indicators, and the average value was taken at the end. The statistical results are shown in Table 2.

3.3.2. Statistical Results of S v and A a

The standard deviation of the speed can describe the distribution and dispersion of individual vehicles relative to the average speed of the traffic flow. In general, the larger the standard deviation of the speed, the more chaotic the traffic flow operation, and the lower the safety [29]. The velocity standard deviation formula is as follows:
S v = j = 1 t V j V 2 t
where t represents the monitoring time of the vehicle, V j represents the speed of the vehicle at the moment j , and V ¯ represents the average speed of the vehicle.
As the main factor of vehicle speed variation, acceleration is one of the main parameters reflecting vehicle the driving state, and the core index reflects vehicle driving stability, comfort, safety, and driving behavior analysis [30]. In this study, the root mean square of acceleration is considered as the index to consider vehicle driving variation, and the formula is
A a = j = 1 t a j 2 t
where a j represents the acceleration of the vehicle at time j , and t represents the running time of the vehicle.
The vehicle data are processed to obtain the standard deviation of the vehicle speed and the square mean root of acceleration. The index values of the vehicles generated via the network and some selected vehicles are shown in Table 3.
The average value of the selected vehicle index is compared with the generated vehicle index value, and the statistical results are shown in Table 4.

3.4. Evaluation of Statistical Indicators for the Entire Scene

To verify that the traffic flow scene generated by the network satisfies the natural driving scene, some indicators were selected to verify the generated scene from a macro perspective. Since the general movement trend of vehicles is more stable in the motorway scenario, this paper counts the average traffic flow and the average speed to represent the basic characteristics of the microscopic traffic flow. Finally, the minimum longitudinal spacing is used to verify whether the spacing between vehicles within the traffic flow is reasonable.

3.4.1. Average Traffic Flow of Road Sections

The average traffic volume of a road section represents the total number of vehicles passing a certain road section per unit of time and is an important parameter reflecting the characteristics of traffic flow [31]. The calculation formula is shown below:
Q = 1 n i = 1 n N i t
where n represents the number of lanes, t represents the monitoring time, and N i represents the total number of vehicles in the i -th lane during the monitoring time.
In this paper, statistics are generated on the average traffic flow of the original data and the generated data. The maximum and minimum values of the average traffic flow of the road under different scenarios are shown in Table 5.

3.4.2. Average Speed of Road Sections

The average speed of a road section represents the distance travelled by a vehicle through a road section per unit of time, expressed as V. The formula is shown below:
V = 1 n i = 1 n 1 N j = 1 N L j t j
where n denotes the total number of lanes on a road section, t j denotes the monitoring time of the jth vehicle, L j denotes the distance passed by the j -th vehicle during the monitoring time, and N denotes the total number of vehicles on the i -th lane per unit of time.
In this paper, the average speed of the road section is counted, and the maximum and minimum values of the average speed of the road section under different scenarios are shown in Table 6.

3.4.3. Minimum Longitudinal Spacing When Following

Rear-end collision often leads to serious accidents and traffic congestion [32]. If the longitudinal spacing is too small, rear-end collisions are likely to occur, as shown in Figure 15.
In this paper, the minimum longitudinal separation from the vehicle in front of the same lane is used as an indicator of whether a vehicle is involved in a collision with another vehicle following a moving vehicle. The statistical results are shown in Table 7.

3.5. Discussion

The DTW values of the longitudinal speed and longitudinal acceleration indicators in the DCGAN results are relatively large, indicating that the longitudinal speed and longitudinal acceleration indicators of the generated vehicles are close to those of the original vehicles, but the difference between the values is relatively large. In the data generated by the improved DCGAN network proposed in this paper, the distance values of DTW and GRA are significantly lower than those of the data generated by the conventional DCGAN network. It can be considered that the neural network proposed in this paper has a better improvement in the two indicators of longitudinal speed and longitudinal acceleration in the generated data.
As can be seen from Table 3 and Table 4, the standard deviation of the vehicle speed and the root mean of acceleration in the vehicle data generated by either the proposed neural network or the DCGAN are less different from those of the original vehicle, indicating that the generated vehicle speed fluctuations and acceleration variations are closer to the original distribution of the data. In the average statistical results, the S v and A a of the data generated by the neural network proposed in this paper have less data deviation compared to DCGAN. Combining the above results, we believe that the improved DCGAN has an advantage over the conventional DCGAN in generating microscopic motion trajectories of the data.
The differences between the two neural networks in terms of macro metrics were then analyzed, and from the statistics in Table 5, the difference between the two in the item of overall traffic data was not very large and tended to be similar to the original data. The deviation of the generated data from the original data can be seen in Table 6 and Table 7, which show that the proposed neural network in this paper is closer to the distribution of the original dataset in terms of the two indicators of average vehicle speed and minimum longitudinal spacing.
In summary, it can be concluded that the neural network proposed has a greater advantage over the original DCGAN in generating traffic flow scene data in terms of the statistical metrics used in this paper, and the generated data are closer to the distribution of the original dataset on both macro and micro scales.

4. Conclusions

4.1. Main Research Contents and Innovation

This paper presents a method for generating microscopic traffic flow data using neural networks. A neural network using a DCGAN with a GRU-modified discriminator is constructed in this paper. We examined the effectiveness of the data generated by this neural network using a highD dataset. By analyzing the motion parameters of a single volume sample within the generated scenario, as well as the statistical metrics of all vehicles in the whole scenario, the results show that the neural network proposed can generate virtual microscopic traffic flow samples well, and the generated data are more closely matched compared to the original DCGAN under the microscopic and macroscopic metrics used in this paper the original traffic flow dataset.

4.2. Applications

The proposed microscopic traffic flow data generation method can be applied to virtual tests of automatic driving cars to generate random motion trajectories of the surrounding interfering vehicles. By generating microscopic traffic flow scenarios in batches to test the response of the target vehicle in unfamiliar scenarios that have never been encountered before, the safety boundary of vehicle testing is broadened.
To better explain the usefulness of the generated microscopic traffic flow in this study, we have designed a microscopic traffic flow use case where we use the program’s Application Programming Interface (API) to read our generated microscopic traffic flow data and place the individual vehicle locations within the data in the simulation scenario, the effect of which is shown in Figure 16.
Finally, the data were used to complete the validation of the ACC algorithm for the vehicle under test. Due to the random nature of the data generated by the neural network, we were able to use this method to generate more test scenarios and improve the refinement of the functional testing of autonomous vehicles. Similarly, we can use the massive amount of data generated by this neural network to test different functional modules of the self-driving vehicle, helping researchers to better identify the limitations of the vehicle algorithm and the potential risk of errors. Finally, for the testing of other functional modules of self-driving cars, as well as the ACC test mentioned above, we think that it should be made easier.

4.3. Future Work

This paper has constructed a neural network that can generate microscopic traffic flow scenarios, which can generate scenario segments similar to real scenario data for virtual testing, but there are still some areas that can be further improved:
Not many scenes were studied in this study; only highway traffic flow scenes were generated, and no urban and rural road traffic flow scenes were considered; therefore, subsequent research can further expand the coverage of scenes.
The traffic flow scenes generated in this study are relatively short in duration, and given the hardware conditions and time constraints, samples with larger sampling times take up a large amount of memory, resulting in an inability to train.
The metrics for evaluating neural network-generated data are not sufficient, and only some of the metrics are selected for evaluation in this study; subsequent scholars can evaluate the generated data from more perspectives.

Author Contributions

Conceptualization, P.W. and Q.C.; methodology, P.W.; software, Q.C.; validation, L.M., J.L. and M.F.; formal analysis, J.L., Q.C. and L.M.; investigation, Z.Z.; writing—original draft preparation, P.W. and Q.C.; writing—review and editing, P.W. and Q.C.; visualization, Q.C.; supervision, Y.H., J.L. and M.F.; project administration, P.W.; funding acquisition, J.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Key Research and Development Program of China, grant number 2021YFB2500703.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Data Availability Statement

The data are available from the corresponding author upon reasonable request.

Acknowledgments

Many thanks to all the authors who took the time out of their busy schedules to revise and review the paper and provide references.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Yu, J.J.Q. Two-Stage Request Scheduling for Autonomous Vehicle Logistic System. IEEE Trans. Intell. Transp. Syst. 2019, 20, 1917–1929. [Google Scholar] [CrossRef]
  2. Kyriakidis, M.; Happee, R.; de Winter, J.C.F. Public opinion on automated driving: Results of an international questionnaire among 5000 respondents. Transp. Res. Part F Traffic Psychol. Behav. 2015, 32, 127–140. [Google Scholar] [CrossRef]
  3. Schlossberg, M.; Riggs, W.; Millard-Ball, A.; Shay, E. Rethinking the Street in an Era of Driverless Cars; University of Oregon: Eugene, OR, USA, 2018. [Google Scholar] [CrossRef]
  4. Brown, K.E.; Dodder, R. Energy and emissions implications of automated vehicles in the US energy system. Transp. Res. Part D Transp. Environ. 2019, 77, 132–147. [Google Scholar] [CrossRef] [PubMed]
  5. Koopman, P.; Wagner, M. Autonomous Vehicle Safety: An Interdisciplinary Challenge. IEEE Intell. Transp. Syst. Mag. 2017, 9, 90–96. [Google Scholar] [CrossRef]
  6. Tao, J.; Li, Y.; Wotawa, F.; Felbinger, H.; Nica, M. On the Industrial Application of Combinatorial Testing for Autonomous Driving Functions. In Proceedings of the IEEE International Conference on Software Testing, Verification and Validation Workshops (ICSTW), Xi’an, China, 22–23 April 2019; pp. 234–240. [Google Scholar]
  7. Anjaneyulu, M.; Kubendiran, M. Short Term Traffic Flow Prediction Using Hybrid Deep Learning. CMC Comput. Mater. Contin. 2023, 75, 1641–1656. [Google Scholar] [CrossRef]
  8. Li, S.; Fan, Y.; Ma, Y.; Pan, Y. Evaluation of Dataset Distribution and Label Quality for Autonomous Driving System. In Proceedings of the IEEE 21st International Conference on Software Quality, Reliability and Security Companion (QRS-C), Hainan, China, 6–10 December 2021; pp. 196–200. [Google Scholar]
  9. Chen, Y.; Chen, X.Q. A novel reinforced dynamic graph convolutional network model with data imputation for network-wide traffic flow prediction. Transp. Res. Part C Emerg. Technol. 2022, 143, 103820. [Google Scholar] [CrossRef]
  10. Chao, Q.W.; Deng, Z.G.; Ren, J.P.; Ye, Q.Q.; Jin, X.G. Realistic Data-Driven Traffic Flow Animation Using Texture Synthesis. IEEE Trans. Vis. Comput. Graph. 2018, 24, 1167–1178. [Google Scholar] [CrossRef] [PubMed]
  11. Medina-Salgado, B.; Sanchez-DelaCruz, E.; Pozos-Parra, P.; Sierra, J.E. Urban traffic flow prediction techniques: A review. Sustain. Comput. Inform. Syst. 2022, 35, 100739. [Google Scholar] [CrossRef]
  12. Althoff, M.; Stursberg, O.; Buss, M. Stochastic Reachable Sets of Interacting Traffic Participants. In Proceedings of the IEEE Intelligent Vehicles Symposium, Eindhoven, The Netherlands, 4–6 June 2008; Volumes 1–3; pp. 37–43. [Google Scholar]
  13. Mecheva, T.A.; Kakanakov, N.R. Traffic flow model based on real data. In Proceedings of XXX International Scientific Conference Electronics (ET), Sozopol, Bulgaria, 15–17 September 2021; pp. 1–5. [Google Scholar]
  14. Wu, C.; Chen, L.; Wang, G.; Chai, S.; Jiang, H.; Peng, J.; Hong, Z. Spatiotemporal Scenario Generation of Traffic Flow Based on LSTM-GAN. IEEE Access 2020, 8, 186191–186198. [Google Scholar] [CrossRef]
  15. Liu, Y.; Song, Y.L.; Zhang, Y.; Liao, Z.F. WT-2DCNN: A convolutional neural network traffic flow prediction model based on wavelet reconstruction. Phys. A Stat. Mech. Its Appl. 2022, 603, 127817. [Google Scholar] [CrossRef]
  16. Goodfellow, I.J.; Pouget-Abadie, J.; Mirza, M.; Xu, B.; Warde-Farley, D.; Ozair, S.; Courville, A.; Bengio, Y. Generative adversarial nets. In Proceedings of 27th International Conference on Neural Information Processing Systems—Volume 2, Montreal, QC, Canada, 8–13 December 2014; MIT Press: Cambridge, MA, USA; pp. 2672–2680. [Google Scholar]
  17. Akrami, H.; Joshi, A.; Aydore, S.; Leahy, R. Quantile Regression for Uncertainty Estimation in VAEs with Applications to Brain Lesion Detection. In Information Processing in Medical Imaging: Proceedings of the 27th International Conference on Information Processing in Medical Imaging (IPMI 2021), Virtual Event, 28–30 June 2021; Springer: Cham, Switzerland, 2021; Volume 12729, pp. 689–700. [Google Scholar] [CrossRef]
  18. Tang, J.; Tao, B.; Gong, Z.; Yin, Z. Adaptive adversarial training method for improving multi-scale GAN based on generalization bound theory. arXiv 2022, arXiv:2211.16791. [Google Scholar]
  19. Mehralian, M.; Karasfi, B. RDCGAN: Unsupervised Representation Learning With Regularized Deep Convolutional Generative Adversarial Networks. In Proceedings of the 9th Conference on Artificial Intelligence and Robotics and 2nd Asia-Pacific International Symposium, Kish Island, Iran, 10 December 2018; pp. 31–38. [Google Scholar]
  20. Sun, K.L.; Wen, Q.F.; Zhou, H.P. Ganster R-CNN: Occluded Object Detection Network Based on Generative Adversarial Nets and Faster R-CNN. IEEE Access 2022, 10, 105022–105030. [Google Scholar] [CrossRef]
  21. Ren, J.S.J.; Xu, L.; Yan, Q.; Sun, W.X. Shepard Convolutional Neural Networks. In Advances in Neural Information Processing Systems 28 (Nips 2015); MIT Press: Cambridge, MA, USA, 2015; Volume 28. [Google Scholar]
  22. Liu, S.Q.; Yu, M.J.; Li, M.; Xu, Q.Z. The research of virtual face based on Deep Convolutional Generative Adversarial Networks using TensorFlow. Phys. A-Stat. Mech. Its Appl. 2019, 521, 667–680. [Google Scholar] [CrossRef]
  23. Kang, Y.; Li, J.; Lee, S.-J.; Li, H. Generative Adversarial Network-Based Regional Epitaxial Traffic Flow Prediction; Springer International Publishing: Cham, Switzerland, 2020; pp. 804–814. [Google Scholar]
  24. Albesano, D.; Andres-Ferrer, J.; Ferri, N.; Zhan, P.M. On the Prediction Network Architecture in RNN-T for ASR. In Proceedings of the Interspeech Conference, Incheon, Republic of Korea, 18–22 September 2022; pp. 2093–2097. [Google Scholar]
  25. Cho, K.; van Merriënboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; Bengio, Y. Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar, 25–29 October 2014; pp. 1724–1734. [Google Scholar]
  26. Zafar, N.; Ul Haq, I.; Chughtai, J.U.R.; Shafiq, O. Applying Hybrid Lstm-Gru Model Based on Heterogeneous Data Sources for Traffic Speed Prediction in Urban Areas. Sensors 2022, 22, 3348. [Google Scholar] [CrossRef] [PubMed]
  27. Elsayed, N.; Maida, A.S.; Bayoumi, M. Gated Recurrent Neural Networks Empirical Utilization for Time Series Classification. In Proceedings of the International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), Atlanta, GA, USA, 14–17 July 2019; pp. 1207–1210. [Google Scholar]
  28. Jozefowicz, R.; Zaremba, W.; Sutskever, I. An empirical exploration of recurrent network architectures. In Proceedings of the 32nd International Conference on International Conference on Machine Learning—Volume 37, Lille, France, 6–11 July 2015; pp. 2342–2350. [Google Scholar]
  29. Li, Y.; Liu, Y.; Zhu, H. Analysis of the chaotic characteristics of traffic flow under congested traffic condition. In Proceedings of the 29th Chinese Control And Decision Conference (CCDC), Chongqing, China, 28–30 May 2017. [Google Scholar]
  30. Lyu, N.C.; Cao, Y.; Wu, C.Z.; Thomas, A.F.; Wang, X. Driving behavior and safety analysis at OSMS section for merged, one-way freeway based on simulated driving safety analysis of driving behaviour. PLoS ONE 2020, 15, e0228238. [Google Scholar] [CrossRef] [PubMed]
  31. Liang, Y.; Liu, Y.; Li, J.; Yu, H.; An, X.; Ma, K.; Xu, H.; Hu, X.; Zhang, H. Development and application of multi-scale urban traffic flow models based on different spatial and temporal characteristics. In Proceedings of the 2nd International Conference on Electronic Information Engineering, Big Data and Computer Technology (EIBDCT 2023), Xishuangbanna, China, 6–8 January 2023; Volume 12642. [Google Scholar]
  32. Hu, M.; Li, J.; Bian, Y.; Wang, J.; Xu, B.; Zhu, Y. Distributed Coordinated Brake Control for Longitudinal Collision Avoidance of Multiple Connected Automated Vehicles. IEEE Trans. Intell. Veh. 2023, 8, 745–755. [Google Scholar] [CrossRef]
Figure 1. DCGAN network diagram.
Figure 1. DCGAN network diagram.
Applsci 13 07192 g001
Figure 2. Generator structure diagram.
Figure 2. Generator structure diagram.
Applsci 13 07192 g002
Figure 3. Structure of GRU cell.
Figure 3. Structure of GRU cell.
Applsci 13 07192 g003
Figure 4. Discriminator structure diagram.
Figure 4. Discriminator structure diagram.
Applsci 13 07192 g004
Figure 5. Data processing workflow.
Figure 5. Data processing workflow.
Applsci 13 07192 g005
Figure 6. Results of congestion scenario level classification of the dataset.
Figure 6. Results of congestion scenario level classification of the dataset.
Applsci 13 07192 g006
Figure 7. Data Filling.
Figure 7. Data Filling.
Applsci 13 07192 g007
Figure 8. Schematic diagram of the training set data matrix.
Figure 8. Schematic diagram of the training set data matrix.
Applsci 13 07192 g008
Figure 9. Data sample generated by improved DCGAN.
Figure 9. Data sample generated by improved DCGAN.
Applsci 13 07192 g009
Figure 10. Generate indicator series data for vehicles (generated by our improved DCGAN). (a) Po-sition profile of the vehicle, (b) velocity profile of the vehicle, and (c) acceleration profile of the vehicle.
Figure 10. Generate indicator series data for vehicles (generated by our improved DCGAN). (a) Po-sition profile of the vehicle, (b) velocity profile of the vehicle, and (c) acceleration profile of the vehicle.
Applsci 13 07192 g010
Figure 11. Partially similar samples: (ad) shows the trajectory parameters of the four vehicles, respectively, in the real dataset.
Figure 11. Partially similar samples: (ad) shows the trajectory parameters of the four vehicles, respectively, in the real dataset.
Applsci 13 07192 g011aApplsci 13 07192 g011b
Figure 12. Discriminator setup of conventional DCGAN.
Figure 12. Discriminator setup of conventional DCGAN.
Applsci 13 07192 g012
Figure 13. Generate indicator series data for vehicles (Generated by DCGAN). (a) Position profile of the vehicle, (b) velocity profile of the vehicle, and (c) acceleration profile of the vehicle.
Figure 13. Generate indicator series data for vehicles (Generated by DCGAN). (a) Position profile of the vehicle, (b) velocity profile of the vehicle, and (c) acceleration profile of the vehicle.
Applsci 13 07192 g013
Figure 14. Partially similar samples: (ad) shows the trajectory parameters of the four vehicles in the real dataset, respectively.
Figure 14. Partially similar samples: (ad) shows the trajectory parameters of the four vehicles in the real dataset, respectively.
Applsci 13 07192 g014
Figure 15. Rear-end collision.
Figure 15. Rear-end collision.
Applsci 13 07192 g015
Figure 16. Microscopic traffic flow scenario generated by the neural network proposed in this paper.
Figure 16. Microscopic traffic flow scenario generated by the neural network proposed in this paper.
Applsci 13 07192 g016
Table 1. Correspondence between average driving speed and traffic congestion degree.
Table 1. Correspondence between average driving speed and traffic congestion degree.
Speed Limit (km/h)Average Travel Speed
120≥70[50, 70)[30, 50)[0, 30)
110≥65[45, 65)[25, 45)[0, 25)
100≥60[40, 60)[20, 40)[0, 20)
90≥55[35, 55)[20, 35)[0, 20)
80≥50[35, 50)[20, 35)[0, 20)
70≥45[30, 45)[20, 30)[0, 20)
60≥40[30, 40)[20, 30)[0, 20)
Traffic CongestionClear RoadMild CongestionModerate CongestionSevere Congestion
Table 2. Experimental results of results of V y , V x , a y ,   and   a x .
Table 2. Experimental results of results of V y , V x , a y ,   and   a x .
IndexLateral VelocityLongitudinal VelocityLateral AccelerationLongitudinal Acceleration
StatisticsGRADTWGRADTWGRADTWGRADTW
Ours0.74750.0950.753840.2320.82450.80.981117.27
DCGAN0.89060.2460.71601157.250.85391.840.954844.64
Table 3. Experimental results of S v and A a .
Table 3. Experimental results of S v and A a .
IndexSpeed Standard DeviationRoot Mean Square Acceleration
DataGenOrgOrgOrgOrgGenOrgOrgOrgOrg
Ours0.780.982.260.81.154.574.432.472.634.52
DCGAN0.721.972.412.711.179.734.499.156.729.02
Table 4. Averaging post-processing results of S v and A a .
Table 4. Averaging post-processing results of S v and A a .
IndexSpeed Standard DeviationRoot Mean Square Acceleration
DataGenOrgGenOrg
Ours0.781.294.574.36
DCGAN0.721.979.737.04
Table 5. Average traffic flow of road sections under different scenarios.
Table 5. Average traffic flow of road sections under different scenarios.
Traffic Congestion LevelOriginal DataGenerated Data (Ours)Generated Data (DCGAN)
Clear RoadMild CongestionModerate CongestionClear RoadMild CongestionModerate CongestionClear RoadMild CongestionModerate Congestion
Q Max192022182123182122
Q Min367467866
Table 6. Average speed of road sections under different scenarios.
Table 6. Average speed of road sections under different scenarios.
Traffic Congestion LevelOriginal DataGenerated Data (Ours)Generated Data (DCGAN)
Clear RoadMild CongestionModerate CongestionClear RoadMild CongestionModerate CongestionClear RoadMild CongestionModerate Congestion
V Max3727.917.83926.816.939.626.215.9
V Min18.110.84.917.910.64.514.510.94.2
Table 7. Minimum longitudinal spacing to the vehicle in front.
Table 7. Minimum longitudinal spacing to the vehicle in front.
Traffic Congestion LevelOriginal DataGenerated Data (Ours)Generated Data (DCGAN)
Clear RoadMild CongestionModerate CongestionClear RoadMild CongestionModerate CongestionClear RoadMild CongestionModerate Congestion
Minimum longitudinal spacing26.524.821.226.325.221.529.227.124.5
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, P.; Chen, Q.; Li, J.; Ma, L.; Feng, M.; Han, Y.; Zhang, Z. A Microscopic Traffic Flow Data Generation Method Based on an Improved DCGAN. Appl. Sci. 2023, 13, 7192. https://doi.org/10.3390/app13127192

AMA Style

Wang P, Chen Q, Li J, Ma L, Feng M, Han Y, Zhang Z. A Microscopic Traffic Flow Data Generation Method Based on an Improved DCGAN. Applied Sciences. 2023; 13(12):7192. https://doi.org/10.3390/app13127192

Chicago/Turabian Style

Wang, Pengyu, Qiyao Chen, Jianhua Li, Lang Ma, Maoquan Feng, Yuanliang Han, and Zhiyang Zhang. 2023. "A Microscopic Traffic Flow Data Generation Method Based on an Improved DCGAN" Applied Sciences 13, no. 12: 7192. https://doi.org/10.3390/app13127192

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop