A method for automatically generating urban major traffic accident data samples based on GAN
Through the method based on genetic variation-adversarial generation network, high-quality traffic accident data samples are generated, which solves the problem of insufficient number of positive samples in the deep learning model and improves the accuracy of traffic accident prediction and model training accuracy.
Patent Information
- Application Number
- CN202010595276.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-23
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2040-06-23
AI Technical Summary
In the existing technology, when deep learning models predict traffic accidents, the number of positive samples is insufficient, which affects the model training accuracy. How to increase the number of major traffic accident samples to improve the prediction accuracy has become an important issue.
Using a method based on genetic variation-adversarial generative network (GAN), by defining the characteristics of urban traffic accidents as four dimensions, fake major traffic accident samples are generated, and the game process of the identification network and the generation network is used to gradually improve the quality of the generated samples. , combined with the genetic mutation algorithm to generate an initial fake data set to improve the diversity and accuracy of data samples.
By generating a large number of high-quality traffic accident data samples, the accuracy of the deep learning model in predicting traffic accidents is improved, effectively improving the model's training accuracy and prediction capabilities.
Smart Images

Figure CN111723997B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for generating urban major traffic accident data samples based on a genetic variation-adversarial generation network, and belongs to the technical field of intelligent transportation applications. Background Art
[0002] Major traffic accidents, especially car accidents, are a huge problem all over the world. Every year, about 1.3 million people die in vehicle traffic accidents and about 50 million people are injured in vehicle traffic accidents. At present, there are machine learning technologies based on big data to predict traffic accidents in advance to minimize losses. As we all know, deep learning technology requires a large number of traffic accident samples. The more traffic accident data there are, the higher the accuracy of the model. However, since the number of major traffic accidents that have occurred and recorded is not large, and it involves certain privacy, and the number of positive samples (major traffic accidents that have occurred) is too small compared to negative samples (i.e., no major traffic accidents have occurred), they are unbalanced samples, which have a great impact on the training accuracy of the model. How to increase the number of major traffic accident samples to provide for model learning, thereby improving the accuracy of major traffic accident prediction, has become a very important issue. Therefore, it is of great value and significance to automatically generate urban major traffic accident data samples through artificial intelligence algorithms. Summary of the invention
[0003] The purpose of this invention is to automatically generate data samples of major urban traffic accidents, thereby providing a large amount of data for deep learning models to learn and train, improving the accuracy of the model in predicting traffic accidents, and thus recovering a large amount of losses caused by traffic accidents.
[0004] In order to achieve the above object, the technical solution of the present invention is to provide a method for automatically generating urban major traffic accident data samples based on GAN, which is characterized by comprising the following steps:
[0005] Step 1: Define the characteristics of urban traffic accidents in four dimensions: weather characteristics, time characteristics, road characteristics, and vehicle type characteristics. Perform unique hot encoding on the characteristics of each accident sample in the real major traffic accident sample set to obtain a feature vector as the real data sample library X = {x 1 ,x 2 ,…,x i ,…,x m}, x i represents the i-th eigenvector;
[0006] Step 2: Generate an initial fake data set Z = {z 1 ,z 2 ,…,z i ,…,z m}, z iThe feature vector representing the i-th false major traffic accident sample;
[0007] Step 3: Establish a generative network and a discriminative network. The generative network and the discriminative network are neural networks, where: the number of neurons in the output layer of the generative network is the same as the number of neurons in the input layer; the input layer of the discriminative network has real data and data generated by the generative network, the output layer of the discriminative network has one neuron, and the output result is a value; then initialize the parameters of the generative network and the discriminative network, and the parameter of the generative network is θ d and the parameters of the discriminator network are θg;
[0008] Step 4: From the fake dataset Z generated in step 2, we can find 1 ,z 2 ,…,z i ,…,z m}, sample n samples, input them into the generative network, and calculate the result generated by the generative network at this time:
[0009] Step 5. The objective function V of the discriminator network is expressed as:
[0010]
[0011] In the formula, D(x i ) is the output value of the real data; It is the output value of the false data generated by the generating network in the discriminating network;
[0012] The goal is to maximize the objective function V and update the weight parameters by the gradient ascent method: In the formula, η represents the learning rate, which represents the length of each parameter update step. Denotes the parameter θ g The derivative of
[0013] Step 6: From the fake dataset Z generated in step 2, we can see that 1 ,z 2 ,…,z i ,…,z m}, and calculate the result generated by the generative network at this time According to the objective function of the generated network Update the weight parameters by gradient ascent: In the formula, Denotes the parameter θ g The derivative of
[0014] Step 7: Repeat steps 4 to 6 until the generative network and the discriminative network converge to obtain the trained generative adversarial network. After the generative adversarial network is trained, it can be used to generate major traffic accident data.
[0015] Preferably, in step 1: the time characteristics include whether it is rush hour in the morning or evening, whether it is a commuting day, whether it is a holiday, and which month of the year; the road characteristics include the distance to the nearest intersection, road width, and road tortuosity.
[0016] Preferably, in step 2, when generating the fake data set Z, the exploration rate A% is set, then A% of the data in the initial fake data set Z is generated according to the mutation algorithm in the genetic algorithm, and (100-A)% of the data is generated completely randomly.
[0017] Preferably, the mutation algorithm in the genetic algorithm comprises the following steps:
[0018] Step 2.1, respectively count the mean, minimum and maximum values of the four dimensional features in the real data sample library X, and obtain the mean μ1, minimum min1 and maximum max1 of the weather characteristic feature; the mean μ2, minimum min2 and maximum max2 of the time characteristic feature; the mean μ3, minimum min3 and maximum max3 of the road characteristic feature; the mean μ4, minimum min4 and maximum max4 of the vehicle type characteristic feature;
[0019] Step 2.2, mutation algorithm in genetic algorithm: According to the Gaussian distribution law and the 3σ theorem, based on the mean, minimum and maximum values of the four dimensional features obtained in step 2.1, the mean of 60% of the data in the generated fake data set Z is μ, and the variance is (max-min) / 3.
[0020] Preferably, in step 3, the generation network and the identification network are neural networks with 5 hidden layers and each hidden layer containing 4 neurons.
[0021] The present invention is a method for generating data samples of urban major traffic accidents based on a genetic variation-adversarial generative network (GAN), the purpose of which is to automatically generate data samples of urban major traffic accidents, thereby providing a large amount of data for deep learning models to learn and train, improving the accuracy of the model in predicting traffic accidents, and thus recovering a large amount of losses caused by traffic accidents. The method defines the characteristics of urban traffic accidents as four dimensions: weather characteristics, time characteristics, road characteristics and vehicle type characteristics, and obtains a feature vector (vector) as a real data sample library after performing one-hot encoding (one-hot) on the characteristics of each accident sample. The genetic variation-adversarial generative network mainly consists of two parts, one is a generating network, and the other is a discriminating network. A genetic variation-generating network (Generator) is used to generate fake major traffic accident samples, and then a discriminating network (Discriminator) is used to score the real data and the generated data, and the results are fed back to the generating network (Generator). After the generating network (Generator) improves the generated data, the discriminating network is used to score, so that after continuous game updates, a good generated sample can be obtained. Its characteristic is that the genetic mutation algorithm is used for the first time in combination with the generative network to generate fake data samples. At the same time, the adversarial generative network is also used for the first time to generate major traffic accident samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart of the present invention;
[0023] Figure 2 A schematic diagram of the identification network. DETAILED DESCRIPTION
[0024] The present invention will be further described below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent forms fall within the scope limited by the appended claims of the application equally.
[0025] The present invention provides a method for intelligently and automatically generating urban accident data samples. The method defines the characteristics of urban traffic accidents into four dimensions: weather characteristics, time characteristics (whether it is morning or evening peak hours, whether it is a commuting day, whether it is a holiday, which month of the year), road characteristics (distance to the nearest intersection, road width, road tortuosity), and vehicle type characteristics. After one-hot encoding the characteristics of each accident sample, a feature vector is obtained as a real data sample library.
[0026] The genetic variation-adversarial generative network mainly consists of two parts, one is the generative network and the other is the adversarial network. The genetic variation-generative network (Generator) is used to generate fake major traffic accident samples, and then the discriminator network (Discriminator) is used to score the real data and the generated data, and the results are fed back to the generative network (Generator). After the generative network (Generator) improves the generated data, the discriminator network is used to score it. After continuous game updates, a good generated sample will be obtained.
[0027] The present invention is the first to use a genetic mutation algorithm combined with a generative network to generate fake data samples. At the same time, the adversarial generative network is also the first to be used to automatically generate major traffic accident samples. Specifically, the following steps are included:
[0028] Step 1. Define the characteristics of urban traffic accidents in four dimensions: weather characteristics, time characteristics (whether it is rush hour, whether it is a commuting day, whether it is a holiday, which month of the year), road characteristics (distance to the nearest intersection, road width, road tortuosity), and vehicle type characteristics. Perform one-hot encoding on the characteristics of each accident sample in the real major traffic accident sample set to obtain a feature vector as the real data sample library X = {x 1 ,x 2 ,…,x i ,…,x m}, x i represents the i-th eigenvector.
[0029] Step 2. Generate an initial fake dataset Z = {z 1 ,z 2 ,…,z i ,…,z m}, z i The feature vector representing the i-th false major traffic accident sample: Set the exploration rate, for example, equal to 60%, then the generation algorithm of 60% of the data in the initial false data set Z is generated according to the mutation algorithm in the genetic algorithm, and 40% of the data is generated completely randomly.
[0030] The mutation algorithm in the genetic algorithm is implemented as follows:
[0031] Step 2.1 respectively counts the mean, minimum and maximum values of the four dimensional features in the real data sample library X, and obtains the mean μ1, minimum min1 and maximum max1 of the weather characteristic feature; the mean μ2, minimum min2 and maximum max2 of the time characteristic feature; the mean μ3, minimum min3 and maximum max3 of the road characteristic feature; the mean μ4, minimum min4 and maximum max4 of the vehicle type characteristic feature;
[0032] Step 2.2 Mutation algorithm in genetic algorithm: According to the Gaussian distribution law and the 3σ theorem, based on the mean, minimum and maximum values of the four dimensional features obtained in step 2.1, the mean of 60% of the data in the generated fake data set Z is μ, and the variance is (max-min) / 3.
[0033] Step 3. The generator network and the discriminator network are neural networks with 5 hidden layers and 4 neurons in each hidden layer. The generator network has the same number of neurons in the output layer as the input layer. The discriminator network has real data and data generated by the generator network in the input layer. The discriminator network has one neuron in the output layer, and the output result is a value, see Figure 2 Training the network means updating the weight parameters of the generating network and the discriminating network. Initialize the parameters of the generating network and the discriminating network. The parameters of the generating network are θ d and the parameters of the discriminator network are θg.
[0034] Step 4. From the fake dataset Z generated in step 2, 1 ,z 2 ,…,z i ,…,z m}, sample n samples, input them into the generative network, and calculate the generative network (θ g0 ) generates the following result:
[0035] Step 5. The objective function V of the discriminator network is expressed as:
[0036]
[0037] In the formula, D(x i ) is the output value of the real data. For the identification network, the larger the value, the better; It is the output value of the fake data generated by the generator network in the discriminator network. For the discriminator network, the lower the value, the better;
[0038] So the goal is to maximize the objective function V and update the weight parameters by the gradient ascent method: In the formula, η represents the learning rate, which represents the length of each parameter update step. Denotes the parameter θ g The derivative of .
[0039] Step 6. From the fake dataset Z generated in step 2, 1 ,z 2 ,…,z i ,…,z m}, and calculate the generated network (θ g ) generates the result According to the objective function of the generated network Update the weight parameters by gradient ascent: In the formula, Denotes the parameter θ g The derivative of .
[0040] Step 7. Repeat steps 4 to 6 until the generative network and the discriminative network converge to obtain the trained generative adversarial network. After the generative adversarial network is trained, it can be used to generate major traffic accident data.
Claims
1. A method for automatically generating urban major traffic accident data samples based on GAN, characterized in that: The following steps are involved: Step 1: Define the characteristics of urban traffic accidents in four dimensions: weather characteristics, time characteristics, road characteristics, and vehicle type characteristics. Perform unique hot encoding on the characteristics of each accident sample in the real major traffic accident sample set to obtain a feature vector as the real data sample library X = {x 1 ,x 2 ,…,x i ,…,x m }, x i represents the i-th eigenvector; Step 2: Generate an initial fake data set Z = {z 1 ,z 2 ,…,z i ,…,z m }, z i The feature vector representing the i-th false major traffic accident sample; Step 3: Establish a generative network and a discriminative network. The generative network and the discriminative network are neural networks, where: the number of neurons in the output layer of the generative network is the same as the number of neurons in the input layer; the input layer of the discriminative network has real data and data generated by the generative network, the output layer of the discriminative network has one neuron, and the output result is a value; then initialize the parameters of the generative network and the discriminative network, and the parameter of the generative network is θ d and the parameters of the discriminator network are θg; Step 4: From the fake dataset Z generated in step 2, we can find 1 ,z 2 ,…,z i ,…,z m }, sample n samples, input them into the generative network, and calculate the result generated by the generative network at this time: Step 5. The objective function V of the discriminator network is expressed as: In the formula, D(x i ) is the output value of the real data; It is the output value of the false data generated by the generating network in the discriminating network; The goal is to maximize the objective function V and update the weight parameters by the gradient ascent method: In the formula, η represents the learning rate, which represents the length of each parameter update step. Denotes the parameter θ d The derivative of Step 6: From the fake dataset Z generated in step 2, we can see that 1 ,z 2 ,…,z i ,…,z m }, and calculate the result generated by the generative network at this time According to the objective function of the generated network Update the weight parameters by gradient ascent: In the formula, Denotes the parameter θ g The derivative of Step 7: Repeat steps 4 to 6 until the generative network and the discriminative network converge to obtain the trained generative adversarial network. After the generative adversarial network is trained, it can be used to generate major traffic accident data.
2. The method for automatically generating urban major traffic accident data samples based on GAN as claimed in claim 1, characterized in that: In step 1: the time characteristics include whether it is rush hour in the morning or evening, whether it is a commuting day, whether it is a holiday, and which month of the year; the road characteristics include the distance to the nearest intersection, road width, and road tortuosity.
3. The method for automatically generating urban major traffic accident data samples based on GAN as claimed in claim 1, characterized in that: In step 2, when generating a fake data set Z, the exploration rate is set to A%, then A% of the data in the initial fake data set Z is generated according to the mutation algorithm in the genetic algorithm, and (100-A)% of the data is generated completely randomly.
4. The method for automatically generating urban major traffic accident data samples based on GAN as claimed in claim 3, characterized in that: The mutation algorithm in the genetic algorithm comprises the following steps: Step 2.1, respectively count the mean, minimum and maximum values of the four dimensional features in the real data sample library X, and obtain the mean μ1, minimum min1 and maximum max1 of the weather characteristic feature; the mean μ2, minimum min2 and maximum max2 of the time characteristic feature; the mean μ3, minimum min3 and maximum max3 of the road characteristic feature; the mean μ4, minimum min4 and maximum max4 of the vehicle type characteristic feature; Step 2.2, mutation algorithm in genetic algorithm: According to the Gaussian distribution law and the 3σ theorem, based on the mean, minimum and maximum values of the four dimensional features obtained in step 2.1, the mean of 60% of the data in the generated fake data set Z is μ, and the variance is (max-min) / 3.
5. The method for automatically generating urban major traffic accident data samples based on GAN as claimed in claim 1, characterized in that: In step 3, the generation network and the identification network are neural networks with 5 hidden layers and each hidden layer containing 4 neurons.
