Next Article in Journal
Resilience Evaluation and Renovation Strategies of Public Spaces in Old Communities from a Disaster-Adaptive Perspective
Next Article in Special Issue
In-Depth Analysis of Fatal Motorcycle Accidents—Case Study in Slovenia
Previous Article in Journal
Towards Mitigating Climate Change Negative Impact: The Role of Regulations and Governance in the Construction Industry
Previous Article in Special Issue
A Sustainable Approach to How Roadway Recognition Affects Drivers’ Speed Choice
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Novel Accident Duration Prediction Method Based on a Conditional Table Generative Adversarial Network and Transformer

The School of Building Environmental Engineering, Zhengzhou University of Light Industry, Zhengzhou 450001, China
*
Author to whom correspondence should be addressed.
Sustainability 2024, 16(16), 6821; https://doi.org/10.3390/su16166821
Submission received: 14 July 2024 / Revised: 28 July 2024 / Accepted: 5 August 2024 / Published: 9 August 2024

Abstract

:
The accurate duration prediction of road traffic accident is crucial for ensuring the safe and efficiency of transportation within social road networks. Such predictive capabilities provide significant support for informed decision-making by transportation administrators while also offering new technological support for the sustainable development of modern road networks. This study introduced a novel predictive model for road traffic accident duration, integrating a Conditional Table Generative Adversarial Network (CTGAN) with a transformer architecture. We initially utilized CTGAN to augment and refine the historical accident dataset. Subsequently, we implemented a wavelet denoising technique to cleanse the expanded dataset. The core of our model lies in the application of the transformer mechanism, which was trained to forecast the accident duration with high precision. To prove the effectiveness of our proposed model, a series of comparative experiments were designed and executed. The experimental results show that the prediction error of CTGAN-Tr for accident duration in the accident area could reach below 0.8. Compared with other models, the MAE of CTGAN-Tr was reduced by 0.31 compared with GRU, and the correlation coefficient was increased by 0.2 compared with TCN. At the same time, the model can show excellent performance in the other two accident areas. The results of these experiments not only substantiate the performance of our model but also demonstrate its robustness and generalizability when applied to traffic accident data from other regions.

1. Introduction

With the continuous development of society, the urban road transportation infrastructure is experiencing rapid expansion. Concurrently, the prevalence of traffic accidents and vehicular congestion has markedly increased, which has become an important factor affecting the quality of life and safety of residents. Traffic accidents refer to incidents of personal injury or property damage caused by vehicles on the road due to accidents or mistakes. Vehicle congestion refers to a phenomenon where there are many vehicles crowded and the speed is slow [1]. In both cases, the duration of accidents is a critical objective factor that should be considered. It plays an integral role in assessing the severity and categorization of the traffic accident, as well as gauging the breadth of its impact on the surrounding environment. However, an extension in duration is positively correlated with an escalation in the likelihood of subsequent accidents, which, in turn, exerts a deleterious impact on the overall environmental integrity of the road network [2,3,4,5].
The duration of road traffic accidents has the characteristics of randomness and variability, which increases the difficulty of accident management for traffic management departments [6,7]. The duration process of road traffic accidents can be divided into four distinct phases. The initial phase, termed the judgment time, encompasses the interval from the accident occurrence to the initiation of accident response. The second phase, known as the response time, denotes the time from the acknowledgment of the accident until the arrival of the emergency response team at the site; the third phase, namely the clearance time, represents the duration from the emergency team’s arrival to the completion of accident clearance. Lastly, the recovery time is the time interval extending from the completion of the accident clearance to the normalization of traffic restoration. An accurate and scientific prediction of the accident duration is conducive to managing the total time frame of the accident, thereby effectively reducing the time interval from the arrival of the emergency response team to the restoration of traffic normalcy [8,9,10]. Drivers can also choose to avoid or detour based on the predicted duration of road accidents ahead. Meanwhile, it has a great impact on the efficiency of emergency medical services and rescue operations [11]. In addition, by deploying the model on vehicles and roads, the traffic management department can timely adjust the traffic flow, timely adjust the traffic signals, reasonably allocate resources, coordinate with the emergency department to deal with accidents, take measures to prevent vehicle congestion and accidents from happening again, improve the safety and traffic ability of road traffic, and formulate effective safety publicity to reduce the incidence of accidents [12,13]. For each traffic accident, a reduction in accident duration by a single minute translates to an estimated economic benefit of USD 57 [14]. In essence, the accurate prediction of road traffic accident duration has an important role in enhancing traffic safety, accessibility, and traffic sustainability development [15,16,17].
Traditional methodologies for accident duration prediction have predominantly relied on analyzing the interrelationships among various influencing factors within historical accident data [18,19,20]. However, the disparities in road traffic accident data across different regions, coupled with variations in data collection machinery on distinct roadways, have led to challenges such as limited dataset sizes and anomalies in certain areas [21,22,23], which causes problems such as missing or anomalous incident data. Meanwhile, some traditional data prediction methods require a high degree of data integrity, which restricts their applicability and widespread adoption [24,25,26,27]. Long time series data are difficult to predict due to their time-space dependence and instability. The traffic accident duration series data have the characteristics of long series and a large amount of data. Deep learning methods have been widely used in the field of transport due to their powerful data processing and model-building capabilities for addressing complex problems. In this study, a Conditional Table Generative Adversarial Network (CTGAN) and transformer are combined to accurately predict the duration of road traffic accidents and solve the challenge of accident duration prediction. On the one hand, it can effectively solve the shortage of data in traditional methods at this stage. On the other hand, it can better learn time series data. Compared with other deep learning methods, it solves the problem of gradient disappearance or explosion of long time series data. At the same time, the effective combination of the two opens a new idea for the research field of accident duration prediction.
CTGAN, renowned for its effectiveness in generating high-fidelity adversarial samples, harnesses the dynamic interplay between the generator and discriminator to emulate the feature distribution of authentic data, thereby enabling the creation of novel datasets, which solves the problem of inaccurate predictions caused by insufficient accident data. The generator is responsible for receiving random noise and condition information, as well as generating data samples that simulate real data as much as possible. The discriminator is responsible for receiving the data generated by the generator and making discrimination feedback to the generator according to the real data. Compared to the recursive neural network model, the transformer model can effectively address the lack of vanishing or exploding gradients through its global calibration and parallel processing capabilities, leading to faster training progress and enhanced model training efficiency [28]. This study provides a basis for drivers and traffic managers to accurately avoid and adjust management measures. The research contributions are as follows:
(1) To verify its effectiveness, we conducted comparative experiments on different models, which showed the effectiveness and superiority of this model compared to other models.
(2) To validate the universality, we tested the proposed method on the datasets sourced from various geographical regions, which demonstrated that the model possesses the capability to predict the duration of incidents accurately and efficaciously across these different locales.
(3) The remaining paper is structured as follows: Section 3 provides a coordinated explanation of the experimental methods, followed by the experimental process and analysis in Section 4. Section 5 briefly concludes the overall findings and further research directions.

2. Related Work

Most of the existing researches on road traffic accident duration prediction are based on the analysis of historical accident data to explore the interactions and coupling relationships among various potential influencing factors [29,30,31]. In previous studies, some machine learning algorithms have been used to predict traffic accident duration, such as Naive Bayes models, Support Vector Machine models (SVM), and K-nearest neighbor models. Some machine learning methods are also applied in the field of data dimension reduction processing, so as to improve the storage cost of data. Recently, some scholars use the method of spatio-temporal pattern to learn and mine the spatio-temporal characteristics of traffic accidents so as to better predict traffic accidents. Deep learning methods have received increasing attention from scholars, such as Long Short-Term Memory (LSTM), Bi-directional Long Short-Term Memory (BiLSTM), Gated Recurrent Unit (GRU), and so on. Due to powerful data processing and modeling capabilities, these methods were widely used in various fields including traffic accident research [32,33,34].
In the areas of statistics, Hojatid et al. examined the impact of various factors associated with different events on duration and used a parameterized accelerated failure time survival model to predict accident duration [35]. Li et al. employed a competitive risk mixed model to analyze the impact of different accident clearance methods and various covariates on accident duration, and further predicted accident duration [36]. In the field of machine learning, Ma et al. predicted the duration based on different types of explanatory variables, which utilized gradient-boosting decision trees to identify complex nonlinear relationships. The results show this method has certain advantages in dealing with short-term traffic accidents [37]. Yu et al. used both ANN and SVM to predict the accident duration on highways. By comparing the error indicators, it was found the ANN achieved good results for accident cases with longer durations [38]. Rashid et al. used a variety of machine learning methods to reduce the dimension of different IOT datasets, and found that the dimension reduction can help reduce the storage and communication costs of IOT data. Even if the performance of some classification algorithms is reduced, the performance can be ignored compared with the optimization of storage and communication costs [39]. In the field of statistics and machine learning, Smith et al. used random models, non-parametric regression models, and decision trees to predict the accident duration of highways, but the performance of the models was not ideal, with an average error exceeding 20 min [40]. Kim et al. combined the rule-based tree model with the polynomial logit model and Naive Bayes classifier to predict the duration of traffic events in Maryland, and determined the different impacts of different influencing factors on accident duration [41]. Thapa et al. adopted a duration prediction framework to predict speeding events in the work zone, and the results show the model has high prediction accuracy for speeding events with shorter durations between consecutive events. Meanwhile, the model was more effective for road sections and work areas with a higher frequency of speeding [42]. Li et al. classified the accident’s duration and used Extreme Gradient Boosting to transform the multivariate multi-class problem into a binary classification problem to improve prediction accuracy [43]. Lei et al. improved the original Model Tree with a Piecewise Linear Regression algorithm (M5P) by constructing a Model Tree with Piecewise Linear Regression and Hybrid Decision Making (HBDM). The advantage of the model was to minimize data heterogeneity through dataset classification, and the M5P-HBDM can identify more significant and meaningful variables than M5P or HBDM to accurately predict the duration of the accident [44]. The lack of road traffic accident data and the capture of the coupling relationship between long time series have become the limitations and challenges in the field of traffic accidents. Therefore, this paper will study these aspects.

3. Methodology

3.1. The Framework

In this study, CTGAN was applied to expand the historical traffic accident dataset to solve the problem of fewer or abnormal data. Then, a wavelet noise reduction trick was applied to remove the noise from the enhanced data. Finally, by utilizing the transformer’s ability to efficiently deal with time-series data, along with parallel processing to speed up the model training process, accurate duration prediction of traffic accidents could be achieved. The framework of the proposed method is shown in Figure 1.

3.2. Conditional Table Generative Adversarial Network (CTGAN)

Compared to basic Generative Adversarial Networks (GANs), CTGAN adds a conditional classifier, which can effectively encode both continuous and discrete variables. CTGAN is a GAN architecture specially designed for tabular data generation, which aims to deal with heterogeneous data containing digital and classification features. Meanwhile, it can model long-tail variables to generate new variables, which can be effectively applied to table-type data. GAN is widely used in image, video, text, and other types of data generation. CTGAN focuses on the generation of tabular data, especially heterogeneous data containing digital and classification features [45,46]. In this study, the generator of CTGAN learned the distribution of various features in historical accident datasets to generate new accident data that closely resemble real data. The discriminator assessed the newly generated accident data based on the distribution of real data and continuously compared them during this process, ultimately achieving Nash equilibrium. At this stage, the newly generated accident data were utilized as enhanced accident data. The structure of CTGAN is shown in Figure 2.
CTGAN mainly includes the condition classifier, generator, and discriminator. The real traffic accident data were input into the generator through the conditional classifier for data expansion and then input into the discriminator for real data discrimination. The two learned against each other and eventually generated the accident data required by the research. The loss function expression of generating adversarial networks is shown in the following equation:
min G max D V ( D , G ) = E x ~ p data x logD ( x ) + E z ~ p ( z ) [ log ( 1 D ( G ( z ) ) ) ]
where G, D, x, and z represent the generator, the discriminator, the random noise, and the true distribution of traffic accident data features, respectively. V ( D , G ) represents a binary function, D ( x ) represents the probability that the discriminator D determines that the real sample x is true, G ( z ) represents the false sample generated by the generator G according to the noise vector z, D ( G ( z ) ) represents the probability that the discriminator D determines that the generated sample G ( z ) is true, and ( 1 D ( G ( z ) ) ) is to amplify the loss.
To encode accident data, it was necessary to distinguish the variable patterns of different types of accident data and define three types of variable patterns: categorical variables, continuous variables, and mixed variables. If the accident data contained both categorical and continuous values or continuous values with missing values, they were defined as a mixed variable. The Variational Gaussian Mixture model (VGM) was simultaneously used to deal with the continuous parts to estimate the number of modes k. Then, the Gaussian mixture expression is shown as follows:
P = k = 1 n ω k N ( μ k , σ k )
where n represents a normal distribution. ω k , μ k , and σ k represent the weight, mean, and standard deviation for each mode, respectively. And n k = 1 ω k is equal to one.
To encode the distribution values of the accident data variables in the continuous region, each feature value was associated with the pattern with the highest probability and normalized. The probability density τ from different modes corresponding to the variable value was encoded, and the mode k with the highest probability was selected to normalize τ. The normalized value α was calculated as follows:
α =     τ   μ k 4 σ k
where α, τ, μ k , and σ k represent the normalized value, probability density, mean, and standard deviation under different modes, respectively.

3.3. Transformer Model

In this part, data enhancement of the original incident data was performed by CTGAN. Data enhancement will produce random noise, which will cause inaccurate results. Wavelet denoising has the advantages of flexible selection of threshold, wide applicability, and good denoising effect. Wavelet denoising was used to denoise the extended accident data. It can decompose the data signal containing noise into wavelet coefficients with different frequencies, set the threshold value, set the noise coefficient to zero, or reduce its value to achieve noise reduction. Meanwhile, the transformer model offers a new solution for parallel computing and long-sequence input problems. The core of transformer model is the multi-head attention mechanism. The transformer utilizes the attention mechanism in the encoder and decoder to identify various feature positions of traffic accident data and establish the relationships among different locations, which use accident characteristic data as input sequence and calculate the similarity among different accident feature positions in the input sequence. Additionally, the transformer model incorporates residual connectivity and normalization layers to accelerate model training and optimization. The model framework diagram is presented in Figure 3.
As shown in the above Figure 3, the transformer was composed of an encoder and decoder, including multiple groups of multi-head attention mechanism, Add & Norm layer, Feed Forward layer, Encoder Block, Decoder Block, and activation function softmax. The expression of self-attention mechanism is shown in the following formula. The coding matrix of accident data was obtained by calculating the Q, K and V values of the input features of the accident data and activating the function.
Attention Q , K , V = softmax ( QK T d k ) V
where d k is the number of columns in the Q, K matrix, which is the vector dimension of the accident features. Softmax is an activation function. The function is to normalize the attention weight and convert it into a probability distribution, so that the sum of each weight is equal to 1, which can more intuitively express the importance of each position.
The input part consisted of feature information and positional information, and a positional encoder was used to capture the positional information of each word in the sequence, which was calculated as follows:
PE ( pos , 2 i )   = sin ( pos / 10 , 000 2 i / d )
PE ( pos , 2 i + 1 )   = cos ( pos / 10 , 000 2 i / d )
where PE, pos, and d represent the position embedding, position of the feature, and dimension of the PE, respectively.
To enrich what is learned in the attention layer, the hyper-parameter W O was introduced with another linear transformation. The expressions are shown as follows:
MultiHead Q , K , V   = Concat ( Head 1 , , Head H ) W O
Head h   = Attention ( Q h , K h , V h ) , for h = 1 , H .
where W O is the weight matrix, and H is the number of layers of individual heads. Concat was used to splice different heads calculated by multiple heads’ attention mechanism according to specific dimensions in order to enhance the representation ability of the model. The function of attention is to calculate the similarity between the representation vectors of each position in the input sequence and generate a weight distribution, which reflects the importance of different positions to the current position, so as to better capture the dependencies in the long sequence. In addition, attention can consider the global information at the same time, which enhances the expression ability of the model.
Feed Forward is a two-layer fully connected layer, with the first layer having an activation function of Relu and the second layer without an activation function. The expression is max 0 ,   XW 1 + b 1 W 2 + b 2 , where X is the input matrix of the accident duration. W 1 and W 2 are the weights of the two layers, respectively. b 1 and b 2 are the deviations of the two layers, respectively.
The Add & Norm layer consists of two parts: Add and Norm; the expressions are LayerNorm ( X + MultiHeadAttention ( X ) ) and LayerNorm ( X + FeedForward ( X ) ) , where X represents the input of accident duration for multiple attention mechanisms. Add represents X + MultiHeadAttention ( X ) , which represents a residual connection. Norm represents Layer Normalization, which is the normalization layer that is ultimately masked by the decoder and output to the fully connected layer.

3.4. Evaluation Indicators

The duration prediction results were evaluated and analyzed using four evaluation indicators: MAE (Mean Absolute Error), RMSE (Root Mean Square Error), MAPE (Mean Absolute Percentage Error), and R 2 (correlation coefficient). The expressions of these four evaluation indicators are shown in the following equation:
  MAE = 1 n i = 1 n y i y ^ i
where n is the number of predicted samples; y i represents the true duration of the accident; y ^ i is the predicted duration of the accident.
  RMSE = 1 n i = 1 n y i y ^ i 2
where n is the number of predicted samples; y i represents the true duration of the accident; y ^ i is the predicted duration of the accident.
MAPE = 100 % n i = 1 n y ^ i   y i y i
where n is the number of predicted samples; y i represents the true duration of the accident; y ^ i is the predicted duration of the accident.
R 2 = 1 n i = 1 y ^ i   y i 2 n i = 1 y ¯   y i 2
where y i represents the true duration of the accident; y ^ i is the predicted duration of the accident; y ¯ represent sample mean.

4. Case Studies

4.1. Data Description

This study selected the US road traffic accident dataset, which covers 49 states in the United States from 2016 to 2022. The data come from Accurate Position Indicators (APIs) that provide streaming traffic accident data, as well as various state and national transportation departments, law enforcement agencies, and traffic sensors and cameras located within the road network.
The dataset for US road traffic accidents includes crash data from various regions. This study selected accident data from Los Angeles, California (CA LA) in the United States). The original dataset comprised 20,322 accident records, and the damage to the road sensors would have resulted in missing values for some of these factors. The inclusion of these missing values would have had a detrimental effect on the results, and thus the entire row of accident data where the missing value existed was removed. Concurrently, the ambient temperature of 196 degrees Fahrenheit is implausible. These implausible data values are defined as outliers and have no practical reference value for the results. Therefore, deleting the implausible outliers will provide a practical and effective data basis for the model. Finally, 19,287 valid accident data were obtained, with a missing data rate of 5.09 percent. According to the characteristic variables related to the duration of the accident, a total of 7 characteristic factors were obtained, including the date, duration, temperature, humidity, pressure, visibility, and wind speed at the time of the accident. These characteristics are closely related to the duration of the accident, which can better characterize the characteristics between the duration of the accident. Please refer to Table 1 for specific details on these variables.

4.2. Data Selection and Processing

A total of 19,287 valid accident data were selected for data expansion. We input these accident data into the generator of CTGAN, compared the generated data with the discriminator, and finally generated new 19,287 accident data through continuous confrontation. The original and new data were arranged in time series. After removing outliers and missing values, a total of 38,559 valid data were synthesized in the new dataset. The wavelet denoising technology was used to denoise the new accident data. Compared with the data before denoising, the denoising data eliminates the redundant noise, and the data performance is more smooth. In order to improve the stability and generalization ability of the model, the data were normalized.
The accident data deal with the normalization process, which is shown as follows:
  X i = X     X min X max   X min
where X i , X , X max , and X min represent the normalized accident-related data, the original data value related to the accident, the maximum value in the original data, and the minimum value in the original data, respectively.

4.3. Experiments Process

The method proposed in this study needs to be implemented on a computer, and the calculation needs to be configured as follows: CPU: Intel(R) Core (TM) i5-8250U CPU @1.60GHz (The manufacturer of the equipment is HP, from Shanghai, China), memory: 16GB; GPU: NVIDIA GeForce MX150 (The manufacturer of the graphics card is MSI, from Shenzhen, China); Operating system: Windows 10., Python version 3.9, the base framework is Pytorch 1.9.0. When CTGAN was used to enhance the original accident data, 80% of the data were set as the training set, 20% were set as the test set, and epoch was set to 1. When using transformer to predict the accident duration, the feature_size was set to 128, num_layers was set to 1, dropout was set to 0.5, sequence_length was set to 10, batch_size was set to 64, and learning rate was set to 0.001. Meanwhile, 70% of the data were used for training, while the remaining for testing.

4.3.1. Experiment and Analysis

The experimental model includes CTGAN and the transformer deep learning model. The research dataset was selected as the CA La accident data. The experimental epoch was set to 500. The different evaluation indicators of the model are shown in Figure 4 and Table 2.
From the above Figure 4 and Table 2, the evaluation indicators of the model’s prediction results gradually tended to be stable with the increase of epoch. When the epoch was 250, the model had the smallest error indexes and the highest correlation coefficients, which indicates that the optimal epoch of the model is 250, revealing the effectiveness of the proposed model.

4.3.2. Ablation Experiment

In order to explore the impact of a single variable on the overall performance of the model, and to enhance the robustness of the model, an ablation experiment was conducted. The four models were as follows: transformer model; CTGAN was combined with transformer without introducing wavelet denoising; transformer after wavelet denoising was introduced; CTGAN was combined with transformer to introduce wavelet denoising. The result of ablation experiment is shown in Figure 5.
From Figure 5, we can see that the values of MAE, RMSE, and MAPE decreased with the increase of epoch. R 2 increased with the number of iterations. CTGAN-Tr (no wavelet denoising) had three large error metrics, indicating that it performs poorly and does not accurately predict accident durations. Moreover, the values of MAE, RMSE, MAPE, and R 2 of CTGAN-Tr were smaller than other models, which verifies the effectiveness of the proposed model.
The statistical results of the ablation experiment are shown in Table 3. The large error coefficient of CTGAN Tr (no wavelet denoising) indicates poor performance. The values of MAE, RMSE, and MAPE of CTGAN-Tr were much smaller than the other three methods, and the correlation coefficients were higher than other models, which indicates the model has better performance and can accurately predict the duration of accidents.

4.3.3. Comparative Experiment

In order to better verify the effectiveness of our proposed model compared with other deep learning models, we compared the proposed method to other models, such as LSTM, BiLSTM, GRU, TCN, and CNN-LSTM. At the same time, in order to verify the applicability of the model on the accident datasets in other regions, the proposed model was applied to the other regions, i.e., Houston, Texas (TX HOU) and Miami, Florida (FL MIA).
Four evaluation indicators were used to verify our proposed model. The comparison results of the six models are shown in Figure 6. The evaluation values of the six models with an epoch of 250 are shown in Table 4.
As shown in Figure 6 and Table 4, the evaluation indicators result of the six models were gradually stable with the increase of years. The error index of CTGAN-Tr was the smallest, and the correlation coefficient was the largest. Among them, the error curves represented by CTGAN-Tr were lower than those of the other five models, indicating that this model has better prediction performance than other models. At the same time, it can be seen that the correlation coefficient of CTGAN-Tr was the highest, followed by GRU and BiLSTM.
The evaluation results of the proposed model for other regions are shown in Figure 7, and the results of evaluation indicators are shown in Table 5.
Based on Figure 7 and Table 5, it can be seen that different models showed differences in different accident datasets. The error indexes of CA LA and TX HOU were low, and the error of FL MIA was high. At the same time, we can find that the error indexes represented by the CTGAN-Tr model proposed in this paper were lower than those of other models, even on FL MIA. The correlation coefficients of the three regions were not significantly different, and CTGAN-Tr was higher than other models. It shows that the model proposed in this study can effectively predict the accident duration in other regions. The error index and correlation coefficient of TCN were worse than other models, indicating that it is not suitable for accurate prediction of accident duration.

5. Conclusions

This study proposed a deep learning method combining CTGAN and transformer to predict traffic accident duration. Based on the experiments and analysis, the following conclusions can be obtained:
(1) By analyzing the evaluation results, it was found that the model proposed in this study had better performance. The three error evaluation indicators of the model could reach below 0.8. This can provide drivers and traffic managers with a basis for the length of accidents and reduce the incidence of secondary collisions and traffic congestion.
(2) Through comparative experiments, it was found that the values of MAE, RMSE, and MAPE for CTGAN-Tr were smaller than other models. Compared with GRU, the MAE of CTGAN-Tr decreased by 0.31. The correlation coefficient increased by 0.2 compared with TCN. This shows the effectiveness and superiority of CTGAN-Tr model.
(3) Upon application of CTGAN-Tr to accident datasets in other regions, it was observed that the error index of the prediction results of this method in other two regions was small, and the correlation coefficient was high. This shows that the method can effectively predict the accident duration in these two regions.
This study provides drivers, traffic managers, map software developers, medical and fire departments, and the insurance industry with a reference for the duration of road traffic accidents. By deploying these models, drivers can choose to avoid or bypass according to the duration of road traffic accidents ahead. The traffic management department can timely regulate and control the traffic flow, adjust the traffic signals, and timely notify the emergency department. Map software developers can deploy the real-time broadcast function on mobile devices. The emergency department can arrive at the scene of the accident in time to handle the accident. The insurance department can accurately formulate the claim settlement plan. All of these help to improve road safety, traffic ability, and industry development.
However, this study still has limitations and challenges. The coupling relationship between accident data will be better learned by introducing more levels of eigenvectors into the research. Future studies could include influential factors such as those related to driver and vehicle characteristics to comprehensively measure the factors affecting the duration of road traffic accidents. At the same time, exploring other data processing methods will improve the performance of the model or reduce the cost of data storage and operation. The method proposed in this study can be applied to other fields, such as air conditioning load forecasting, wind power generation forecasting, etc. The efficient application of these fields can contribute to the sustainable development of the environment. Additionally, it would be beneficial to explore more efficient processing methods for existing models should be considered. For example, exploring the transformer’s variant model will be an important research direction in the future. And fine-tuning the instructions of the existing model to improve the performance of the model will also be an important direction to improve the model. Meanwhile, it is imperative to examine the more straightforward and lightweight methodologies for accurately forecasting accident duration in the future.

Author Contributions

Conceptualization, Y.W.; methodology, Y.W. and H.Z.; validation, X.C. and X.G.; investigation, H.Z.; writing and editing, Y.W. and H.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This paper was supported in part by the Doctoral Program of Zhengzhou University of Light Industry [No. 2021BSJJ047], and in part by the Henan Provincial Science and Technology Research Project [No. 242102220099, No. 242102211022].

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The datasets we used are all open public data benchmarks, and the relevant addresses are: https://www.kaggle.com/datasets/sobhanmoosavi/us-accidents (accessed on 20 November 2023).

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Li, R.; Pereira, F.C.; Ben-Akiva, M.E. Overview of traffic incident duration analysis and prediction. Eur. Transp. Res. Rev. 2018, 10, 22. [Google Scholar] [CrossRef]
  2. Lin, Y.; Li, R. Real-time traffic accidents post-impact prediction: Based on crowdsourcing data. Accid. Anal. Prev. 2020, 145, 105696. [Google Scholar] [CrossRef]
  3. Saracoglu, A.; Ozen, H. Estimation of traffic incident duration: A comparative study of decision tree models. Arab. J. Sci. Eng. 2020, 45, 8099–8110. [Google Scholar] [CrossRef]
  4. Zhang, Z.; Liu, J.; Li, X.; Khattak, A.J. Do larger sample sizes increase the reliability of traffic incident duration models? A case study of east Tennessee incidents. Transp. Res. Rec. 2021, 2675, 265–280. [Google Scholar] [CrossRef]
  5. Wang, Y.; Zhai, H.; Cao, X.; Geng, X. Cause Analysis and Accident Classification of Road Traffic Accidents Based on Complex Networks. Appl. Sci. 2023, 13, 12963. [Google Scholar] [CrossRef]
  6. Zhu, W.; Wu, J.; Fu, T.; Wang, J.; Zhang, J.; Shangguan, Q. Dynamic prediction of traffic incident duration on urban expressways: A deep learning approach based on LSTM and MLP. J. Intell. Connect. Veh. 2021, 4, 80–91. [Google Scholar] [CrossRef]
  7. Oralhan, B.; Göktolga, Z.G. Determination of the risk factors that influence occurrence time of traffic accidents with survival analysis. Iran. J. Public Health 2018, 47, 1181. [Google Scholar]
  8. Wali, B.; Khattak, A.J.; Liu, J. Heterogeneity assessment in incident duration modelling: Implications for development of practical strategies for small & large scale incidents. J. Intell. Transp. Syst. 2022, 26, 586–601. [Google Scholar]
  9. Zeng, Q.; Wang, F.; Chen, T.; Sze, N.N. Incorporating real-time weather conditions into analyzing clearance time of freeway accidents: A grouped random parameters hazard-based duration model with time-varying covariates. Anal. Methods Accid. Res. 2023, 38, 100267. [Google Scholar] [CrossRef]
  10. Islam, N.; Adanu, E.K.; Hainen, A.M.; Burdette, S.; Smith, R.; Jones, S. A comparative analysis of freeway crash incident clearance time using random parameter and latent class hazard-based duration model. Accid. Anal. Prev. 2021, 160, 106303. [Google Scholar] [CrossRef]
  11. Suzuki, T.; Kataoka, H.; Aoki, Y.; Satoh, Y. Anticipating traffic accidents with adaptive loss and large-scale incident db. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 3521–3529. [Google Scholar]
  12. Li, X.; Liu, J.; Khattak, A.; Nambisan, S. Sequential prediction for large-scale traffic incident duration: Application and comparison of survival models. Transp. Res. Rec. 2020, 2674, 79–93. [Google Scholar] [CrossRef]
  13. Tirtha, S.D.; Yasmin, S.; Eluru, N. Modeling of incident type and incident duration using data from multiple years. Anal. Methods Accid. Res. 2020, 28, 100132. [Google Scholar] [CrossRef]
  14. Jiaona CH, E.N.; Yinli JI, N.; Weijun TA, O.; Daofeng, L.I. Research on mediating effect of express way accident duration based on text information. China Saf. Sci. J. 2023, 33, 155. [Google Scholar]
  15. Grigorev, A.; Mihaita, A.S.; Lee, S.; Chen, F. Incident duration prediction using a bi-level machine learning framework with outlier removal and intra–extra joint optimisation. Transp. Res. Part C Emerg. Technol. 2022, 141, 103721. [Google Scholar] [CrossRef]
  16. Hamad, K.; Al-Ruzouq, R.; Zeiada, W.; Abu Dabous, S.; Khalil, M.A. Predicting incident duration using random forests. Transp. A: Transp. Sci. 2020, 16, 1269–1293. [Google Scholar] [CrossRef]
  17. Chen, J.; Tao, W. Traffic accident duration prediction using text mining and ensemble learning on expressways. Sci. Rep. 2022, 12, 21478. [Google Scholar] [CrossRef] [PubMed]
  18. Chen, J.; Tao, W.; Jing, Z.; Wang, P.; Jin, Y. Traffic accident duration prediction using multi-mode data and ensemble deep learning. Heliyon 2024, 10, e25957. [Google Scholar] [CrossRef]
  19. Can, V.X.; Rui-Fang, M.; Van Hung, T.; Thuat, V.T. An analysis of urban traffic incident under mixed traffic conditions based on SUMO: A case study of Hanoi. Int. J. Adv. Res. Eng. Technol. 2020, 11, 573–581. [Google Scholar]
  20. Tang, J.; Zheng, L.; Han, C.; Yin, W.; Zhang, Y.; Zou, Y.; Huang, H. Statistical and machine-learning methods for clearance time prediction of road incidents: A methodology review. Anal. Methods Accid. Res. 2020, 27, 100123. [Google Scholar] [CrossRef]
  21. Ji, K.; Li, Z.; Chen, J.; Liu, K.L.; Wang, G.Y. Freeway accident duration prediction based on social network information. Neural Netw. World 2022, 32, 93. [Google Scholar] [CrossRef]
  22. Hamad, K.; Obaid, L.; Nassif, A.B.; Abu Dabous, S.; Al-Ruzouq, R.; Zeiada, W. Comprehensive evaluation of multiple machine learning classifiers for predicting freeway incident duration. Innov. Infrastruct. Solut. 2023, 8, 177. [Google Scholar] [CrossRef]
  23. Shan, L.; Yang, Z.; Zhang, H.; Shi, R.; Kuang, L. Predicting duration of traffic accidents based on ensemble learning. In Collaborative Computing: Networking, Applications and Worksharing, Proceedings of the 14th EAI International Conference, CollaborateCom 2018, Shanghai, China, 1–3 December 2018; Proceedings 14; Springer International Publishing: Cham, Switzerland, 2019; pp. 252–266. [Google Scholar]
  24. Kalair, K.; Connaughton, C. Dynamic and interpretable hazard-based models of traffic incident durations. Front. Future Transp. 2021, 2, 669015. [Google Scholar] [CrossRef]
  25. Shang, Q.; Xie, T.; Yu, Y. Prediction of duration of traffic incidents by hybrid deep learning based on multi-source incomplete data. Int. J. Environ. Res. Public Health 2022, 19, 10903. [Google Scholar] [CrossRef]
  26. De Souza, V.N.; de Oliveira Neto, F.M. Modelling traffic accident duration on urban roads with high traffic variability using survival models: A case study on Fortaleza arterial roads. TRANSPORTES 2023, 31, e2837. [Google Scholar] [CrossRef]
  27. Sun, C.; Hao, J.; Pei, X.; Zhang, Z.; Zhang, Y. A data-driven approach for duration evaluation of accident impacts on urban intersection traffic flow. In Proceedings of the 2016 IEEE 19th International Conference on Intelligent Transportation Systems (ITSC), Rio de Janeiro, Brazil, 1–4 November 2016; IEEE: Toulouse, France; pp. 1354–1359. [Google Scholar]
  28. Yun, G.R.; Bae, S.H. Analysis of incident impact factors and development of SMOGN-DNN model for prediction of incident clearance time. J. Korea Inst. Intell. Transp. Syst. 2021, 20, 46–56. [Google Scholar] [CrossRef]
  29. Zhao, W.; Ye, Y.; Ding, J.; Wang, T.; Wei, T.; Chen, M. Ipdalight: Intensity-and phase duration-aware traffic signal control based on reinforcement learning. J. Syst. Archit. 2022, 123, 102374. [Google Scholar] [CrossRef]
  30. He, Y.; Zhang, S.; Zhong, P.; Li, Z. Prediction of traffic accident duration based on N-BEATS. In Proceedings of the Second International Conference on Algorithms, Microchips, and Network Applications (AMNA 2023), Zhengzhou, China, 15 January 2023; SPIE: New York, NY, USA; Volume 12635, pp. 128–132. [Google Scholar]
  31. Zhao, Y.; Deng, W. Prediction in traffic accident duration based on heterogeneous ensemble learning. Appl. Artif. Intell. 2022, 36, 2018643. [Google Scholar] [CrossRef]
  32. Ghosh, B.; Dauwels, J. Comparison of different Bayesian methods for estimating error bars with incident duration prediction. J. Intell. Transp. Syst. 2022, 26, 420–431. [Google Scholar] [CrossRef]
  33. Lyu, D.; Lin, Y. Impact Estimation of Traffic Accident Duration Based on Survival Analysis by Using Field Urban Traffic Condition. In Proceedings of the International Conference on Green Building, Civil Engineering and Smart City, Guilin, China, 8–10 April 2022; Springer Nature: Singapore, 2022; pp. 1247–1254. [Google Scholar]
  34. Srivastava, M.; Anderson, C.L.; Freed, J.H. A new wavelet denoising method for selecting decomposition levels and noise thresholds. IEEE Access 2016, 4, 3862–3877. [Google Scholar] [CrossRef]
  35. Hojati, A.T.; Ferreira, L.; Washington, S.; Charles, P. Hazard based models for freeway traffic incident duration. Accid. Anal. Prev. 2013, 52, 171–181. [Google Scholar] [CrossRef]
  36. Li, R.; Pereira, F.C.; Ben-Akiva, M.E. Competing risk mixture model and text analysis for sequential incident duration prediction. Transp. Res. Part C Emerg. Technol. 2015, 54, 74–85. [Google Scholar] [CrossRef]
  37. Ma, X.; Ding, C.; Luan, S.; Wang, Y.; Wang, Y. Prioritizing influential factors for freeway incident clearance time prediction using the gradient boosting decision trees method. IEEE Trans. Intell. Transp. Syst. 2017, 18, 2303–2310. [Google Scholar] [CrossRef]
  38. Yu, B.; Wangy, Y.T.; Yaoz, J.B.; Wang, J.Y. A Comparison of the Performance of ANN and SVM for the Prediction of Traffic Accident Duration. Neural Netw. World 2016, 26, 271–287. [Google Scholar] [CrossRef]
  39. Rashid, L.; Rubab, S.; Alhaisoni, M.; Alqahtani, A.; Alsubai, S.; Binbusayyis, A.; Bukhari SA, C. Analysis of dimensionality reduction techniques on Internet of Things data using machine learning. Sustain. Energy Technol. Assess. 2022, 52, 102304. [Google Scholar] [CrossRef]
  40. Smith, K.; Smith, B.L. Forecasting the Clearance Time of Freeway Accidents; Center for Transportation Studies, University of Virginia: Charlottesville, VA, USA, 2002. [Google Scholar]
  41. Kim, W.; Chang, G.L. Development of a hybrid prediction model for freeway incident duration: A case study in Maryland. Int. J. Intell. Transp. Syst. Res. 2012, 10, 22–33. [Google Scholar] [CrossRef]
  42. Thapa, D.; Mishra, S.; Velaga, N.R.; Patil, G.R. Advancing proactive crash prediction: A discretized duration approach for predicting crashes and severity. Accid. Anal. Prev. 2024, 195, 107407. [Google Scholar] [CrossRef] [PubMed]
  43. Kuang, L.; Yan, H.; Zhu, Y.; Tu, S.; Fan, X. Predicting duration of traffic accidents based on cost-sensitive Bayesian network and weighted K-nearest neighbor. J. Intell. Transp. Syst. 2019, 23, 161–174. [Google Scholar] [CrossRef]
  44. Lin, L.; Wang, Q.; Sadek, A.W. A combined M5P tree and hazard-based duration model for predicting urban freeway traffic accident durations. Accid. Anal. Prev. 2016, 91, 114–126. [Google Scholar] [CrossRef] [PubMed]
  45. Ieracitano, C.; Mammone, N.; Paviglianiti, A.; Morabito, F.C. A conditional generative adversarial network and transfer learning-oriented anomaly classification system for electrospun nanofibers. Int. J. Neural Syst. 2022, 32, 2250054. [Google Scholar] [CrossRef]
  46. Shim, S. Self-training approach for crack detection using synthesized crack images based on conditional generative adversarial network. Comput.-Aided Civ. Infrastruct. Eng. 2024, 39, 1019–1041. [Google Scholar] [CrossRef]
Figure 1. The framework of the proposed method.
Figure 1. The framework of the proposed method.
Sustainability 16 06821 g001
Figure 2. CTGAN structural framework diagram.
Figure 2. CTGAN structural framework diagram.
Sustainability 16 06821 g002
Figure 3. Transformer structural framework diagram.
Figure 3. Transformer structural framework diagram.
Sustainability 16 06821 g003
Figure 4. Comparison of evaluation indicators.
Figure 4. Comparison of evaluation indicators.
Sustainability 16 06821 g004
Figure 5. Comparison of different evaluation indicators in the ablation experiments.
Figure 5. Comparison of different evaluation indicators in the ablation experiments.
Sustainability 16 06821 g005
Figure 6. The comparison of different methods for evaluation indicators.
Figure 6. The comparison of different methods for evaluation indicators.
Sustainability 16 06821 g006
Figure 7. The comparison of various models under different regions (CA LA: Los Angeles, California; FL MIA: Miami, Florida; TX HOU: Houston, Texas).
Figure 7. The comparison of various models under different regions (CA LA: Los Angeles, California; FL MIA: Miami, Florida; TX HOU: Houston, Texas).
Sustainability 16 06821 g007
Table 1. Characteristic variable description of road traffic accident data.
Table 1. Characteristic variable description of road traffic accident data.
IdInfluence FactorVariable Composition and Description
1DateShows the time of the accident in a local time zone
2DurationThe period between the start and end of the accident
3TemperatureShows the temperature (in centigrade)
4HumidityShows the humidity (in percentage)
5PressureShows the air pressure (in inches)
6VisibilityShows visibility (in miles)
7Wind SpeedShows wind speed (in miles per hour)
Table 2. Comparison of results of evaluation indicators under different epochs.
Table 2. Comparison of results of evaluation indicators under different epochs.
EpochMAERMSEMAPE R 2
5013.581813.773116.5454−0.0551
1005.92656.07487.14360.7947
1501.80372.01192.17560.9575
2001.10281.31951.37310.9703
2500.53310.71950.75600.9771
3000.55910.75830.79300.9768
3500.73420.94900.99230.9750
4000.68880.87970.93930.9757
4500.58280.79700.82810.9765
5000.59490.78710.82710.9766
Table 3. Comparison of different evaluation indicators in the ablation experiment.
Table 3. Comparison of different evaluation indicators in the ablation experiment.
ModelsMAERMSEMAPE R 2
Transformer43.547560.1998122.18500.0831
CTGAN-Tr
(no wavelet denoising)
58.768074.4591149.3692−0.0254
Wd-Tr2.85394.72116.70890.7267
CTGAN-Tr0.53310.71950.75600.9771
Table 4. Comparison experiment evaluation indicators’ results of deep learning models.
Table 4. Comparison experiment evaluation indicators’ results of deep learning models.
ModelsMAERMSEMAPE R 2
LSTM0.97361.28451.02370.8994
BiLSTM0.92130.98671.05890.9113
GRU0.84560.96510.99310.9651
TCN1.43291.52371.50260.7802
CNN-LSTM1.21361.15971.02640.9036
CTGAN-Tr0.53310.71950.75600.9771
Table 5. The comparison of evaluation indicators of various models in three regions.
Table 5. The comparison of evaluation indicators of various models in three regions.
DatasetModelsMAERMSEMAPE R 2
TX HOULSTM1.58782.06703.21950.9568
BiLSTM2.04162.61284.11970.9310
GRU1.39011.81112.81920.9669
TCN2.47903.27084.96990.8919
CNN-LSTM1.47651.91562.96390.9629
CTGAN-Tr0.42720.55120.88600.9769
FL MIALSTM9.067612.05746.62640.8795
BiLSTM9.216911.89466.70800.8828
GRU6.51868.64964.73750.9380
TCN14.821021.37909.43540.6213
CNN-LSTM8.178210.65285.92210.9060
CTGAN-Tr1.08481.50470.88020.9774
CA LALSTM0.87411.03490.98530.8961
BiLSTM0.84310.92170.95470.9312
GRU0.80470.88760.90230.9553
TCN1.12391.39741.28530.7521
CNN-LSTM0.98731.26740.98780.8967
CTGAN-Tr0.53310.71950.75600.9771
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, Y.; Zhai, H.; Cao, X.; Geng, X. A Novel Accident Duration Prediction Method Based on a Conditional Table Generative Adversarial Network and Transformer. Sustainability 2024, 16, 6821. https://doi.org/10.3390/su16166821

AMA Style

Wang Y, Zhai H, Cao X, Geng X. A Novel Accident Duration Prediction Method Based on a Conditional Table Generative Adversarial Network and Transformer. Sustainability. 2024; 16(16):6821. https://doi.org/10.3390/su16166821

Chicago/Turabian Style

Wang, Yongdong, Haonan Zhai, Xianghong Cao, and Xin Geng. 2024. "A Novel Accident Duration Prediction Method Based on a Conditional Table Generative Adversarial Network and Transformer" Sustainability 16, no. 16: 6821. https://doi.org/10.3390/su16166821

APA Style

Wang, Y., Zhai, H., Cao, X., & Geng, X. (2024). A Novel Accident Duration Prediction Method Based on a Conditional Table Generative Adversarial Network and Transformer. Sustainability, 16(16), 6821. https://doi.org/10.3390/su16166821

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