Traffic accident prediction method and device, storage medium and electronic equipment
By acquiring and processing vehicle trajectory data and using a gated neural network model to train a traffic accident prediction model, the problem of low accuracy in traffic accident identification and prediction in existing technologies has been solved, achieving higher accuracy in identification and prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZHONGJIAOXING ROAD INTERNET OF VEHICLES TECH CO LTD
- Filing Date
- 2022-11-28
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies have low accuracy in traffic accident identification and prediction, and are unable to cope with complex and uncertain road traffic conditions.
By acquiring vehicle trajectory data, preprocessing it, extracting feature data, and training it using a gated neural network model, a traffic accident prediction model is established to identify and predict whether a traffic accident will occur.
It improves the accuracy of traffic accident identification and prediction, and can more accurately determine whether a vehicle has been involved in a traffic accident.
Smart Images

Figure CN115797403B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of traffic information processing, in particular to a traffic accident prediction method and device, a storage medium and an electronic device. BACKGROUND
[0002] In today's society, the amount of travel is rising sharply, and traffic accidents often occur, causing long traffic jams and affecting users' travel plans. For the current and future intelligent transportation era, how to quickly discover and report accidents is a major problem. The existing accident determination method can identify and predict fewer scenes, and the actual road traffic situation often has strong complexity and uncertainty, therefore, the related technology still has the problem of low accuracy when identifying and predicting traffic accidents. SUMMARY
[0003] The embodiments of the present application provide a traffic accident prediction method and device, a storage medium and an electronic device to at least solve the technical problem of low accuracy of related technology in identifying and predicting traffic accidents.
[0004] According to an aspect of the embodiments of the present application, a traffic accident prediction method is provided, comprising: obtaining vehicle trajectory data corresponding to a target vehicle set in a preset time period, and preprocessing the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set; obtaining feature data corresponding to a target theme based on the original parking samples; training a preset gated neural network model according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model; and inputting the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident.
[0005] According to another aspect of the embodiments of the present application, a traffic accident prediction device is also provided, comprising: a first obtaining unit that obtains vehicle trajectory data corresponding to a target vehicle set in a preset time period, and preprocesses the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set; a second obtaining unit that obtains feature data corresponding to a target theme based on the original parking samples; a training unit that trains a preset gated neural network model according to the feature data to obtain a trained traffic accident prediction model; and a determination unit that inputs to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident.
[0006] According to still another aspect of the embodiments of the present application, an electronic device is also provided, comprising a memory and a processor, the memory has a computer program stored therein, and the processor is configured to execute the traffic accident prediction method described above by using the computer program.
[0007] According to a further aspect of the embodiments of the present application, a computer readable storage medium is also provided, in which a computer program is stored, and the computer program is configured to execute the traffic accident prediction method described above when running.
[0008] In the embodiments of the present application, the vehicle trajectory data corresponding to the target vehicle set in a preset time period is acquired, and the vehicle trajectory data is preprocessed to obtain the original parking sample corresponding to the target vehicle set; the feature data corresponding to the target theme is acquired based on the original parking sample; the preset gated neural network model is trained according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model; and the to-be-predicted data corresponding to the current vehicle is input into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident. In the above method, since the feature data of different theme types is acquired according to the target vehicle trajectory, the gated neural network model can be trained according to the scene-compliant and refined features to obtain the trained traffic accident prediction model, and whether the current vehicle has a traffic accident can be determined through the trained traffic accident prediction model, which can improve the identification and prediction accuracy of traffic accidents, thereby solving the technical problem of low identification and prediction accuracy of traffic accidents in related technologies. BRIEF DESCRIPTION OF DRAWINGS
[0009] The accompanying drawings, which are included to provide a further understanding of the present application and constitute a part of this application, illustrate embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0010] Figure 1 is a schematic diagram of an application environment of an optional traffic accident prediction method according to an embodiment of the present application;
[0011] Figure 2 is a schematic diagram of an application environment of another optional traffic accident prediction method according to an embodiment of the present application;
[0012] Figure 3 is a flowchart of an optional traffic accident prediction method according to an embodiment of the present application;
[0013] Figure 4 is a schematic diagram of an optional traffic accident prediction model according to an embodiment of the present application;
[0014] Figure 5 is a flowchart of another optional traffic accident prediction method according to an embodiment of the present application;
[0015] Figure 6is a flowchart of another optional traffic accident prediction method according to an embodiment of the present application;
[0016] Figure 7 is a structural diagram of an optional traffic accident prediction device according to an embodiment of the present application;
[0017] Figure 8 is a structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to make the personnel in the technical field better understand the present application scheme, the technical scheme in the embodiment of the present application will be described clearly and completely below in combination with the drawings in the embodiment of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should belong to the scope of protection of the present application.
[0019] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0020] According to an aspect of an embodiment of the present application, a traffic accident prediction method is provided. Optionally, as an optional implementation, the above-mentioned traffic accident prediction method can be applied in an application environment as shown in Figure 1 The application environment includes a terminal device 102 for human-computer interaction with a user, a network 104, and a server 106. The user 108 can perform human-computer interaction with the terminal device 102, and the terminal device 102 runs a traffic accident prediction application program. The terminal device 102 includes a human-computer interaction screen 1022, a processor 1024, and a memory 1026. The human-computer interaction screen 1022 is used to display vehicle trajectory data corresponding to a target vehicle set in a preset time period; the processor 1024 is used to acquire vehicle trajectory data corresponding to the target vehicle set in the preset time period; and the memory 1026 is used to store the vehicle trajectory data corresponding to the target vehicle set in the preset time period.
[0021] Further, the server 106 comprises a database 1062 and a processing engine 1064, the database 1062 is configured to store the planning path determined according to the start point and the end point input by the user, and the processing engine 1064 is configured to obtain vehicle trajectory data corresponding to a target vehicle set in a preset time period, and pre-process the vehicle trajectory data to obtain original stop samples corresponding to the target vehicle set; obtain feature data corresponding to a target topic based on the original stop samples; train a preset gated neural network model according to the feature data corresponding to the target topic to obtain a trained gated neural network model; input the to-be-predicted data corresponding to the current vehicle into the trained gated neural network model to determine whether the current vehicle has a traffic accident; and send the prediction result of whether the traffic accident occurs to the client of the terminal device 102 for display.
[0022] In one or more embodiments, the traffic accident prediction method described above can be applied to the application environment as shown. Figure 2 As shown in Figure 2 The user 202 and the user device 204 can interact with each other. The user device 204 comprises a memory 206 and a processor 208. In this embodiment, the user device 204 can, but is not limited to, refer to the operations performed by the terminal device 102 described above to obtain and display the prediction result of the traffic accident.
[0023] Optionally, the terminal device 102 and the user device 204 include, but are not limited to, a mobile phone, a tablet computer, a notebook computer, a PC, a vehicle-mounted electronic device, a wearable device, and the like. The network 104 can include, but is not limited to, a wireless network or a wired network. The wireless network includes WIFI and other wireless communication networks. The wired network can include, but is not limited to, a wide area network, a metropolitan area network, and a local area network. The server 106 can include, but is not limited to, any hardware device capable of computing. The server can be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and the present embodiment is not limited in this regard.
[0024] As an optional implementation, as shown in Figure 3 The embodiment of the present application provides a traffic accident prediction method, comprising the following steps:
[0025] S302, obtaining vehicle trajectory data corresponding to a target vehicle set in a preset time period, and pre-processing the vehicle trajectory data to obtain original stop samples corresponding to the target vehicle set.
[0026] Specifically, in the embodiments of the present application, the vehicle trajectory data includes but is not limited to vehicle unique mark (license plate number and vehicle color), timestamp of different trajectory points, longitude of trajectory points, latitude of trajectory points, alarm information reported by the vehicle, vehicle speed, acceleration of the vehicle, angle between the vehicle head and the north, information whether the vehicle turns on the turn signal, road type (highway, national road, provincial road, county road, etc.) where the vehicle is located, intersection information, etc.
[0027] S304, obtaining feature data corresponding to the target theme based on the original parking sample.
[0028] Specifically, the target theme here includes but is not limited to target vehicle, surrounding vehicle, and road. The original parking sample is classified according to the above target theme, and the relevant feature information corresponding to each target theme is calculated.
[0029] S306, training a preset gating neural network model according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model.
[0030] Specifically, the data set of the above feature data includes three parts: training set, validation set and test set. The positive sample is the parking trajectory data verified as traffic accident by artificial verification. The negative sample is the accident data excluded from the original parking data. The training set: the positive sample maintains a certain proportion by resampling with replacement. The negative sample extracts vehicle parking trajectory data for several days. The validation set: the positive and negative samples maintain a data set with a preset proportion, and the data amount of the positive sample is less than that of the negative sample.
[0031] S308, inputting the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident.
[0032] Specifically, the to-be-predicted data corresponding to the current vehicle is input into the trained traffic accident prediction model to obtain the prediction probability of whether the current vehicle has a traffic accident. For example, the prediction probability of the current vehicle having a traffic accident is 0.8, which is greater than the preset threshold 0.6, and the output prediction label is that a traffic accident occurs. For another example, the prediction probability of the current vehicle having a traffic accident is 0.5, which is less than the preset threshold 0.6, and the output prediction label is that a traffic accident does not occur.
[0033] In the embodiment of the present application, the vehicle trajectory data corresponding to the target vehicle set in a preset time period is acquired, and the vehicle trajectory data is preprocessed to obtain the original parking sample corresponding to the target vehicle set; the feature data corresponding to the target theme is acquired based on the original parking sample; the preset gated neural network model is trained according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model; and the to-be-predicted data corresponding to the current vehicle is input into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident. In the above method, since the feature data of different theme types is acquired according to the target vehicle trajectory, the trained traffic accident prediction model can be obtained by training the gated neural network model according to the scene-compliant and refined features, and whether the current vehicle has a traffic accident can be determined through the trained traffic accident prediction model, which can improve the identification and prediction accuracy of traffic accidents, thereby solving the technical problem of low identification and prediction accuracy of traffic accidents in related technologies.
[0034] In one or more embodiments, the preprocessing of the vehicle trajectory data to obtain the original parking sample corresponding to the target vehicle set comprises:
[0035] The vehicle trajectory data is sorted by time;
[0036] For each vehicle in the target vehicle set, if the speeds of two adjacent trajectory points are all zero, and the time difference between the two adjacent trajectory points is within a preset time range, the former trajectory point in the two adjacent trajectory points is taken as a starting parking point;
[0037] If the subsequent parking points of the current vehicle are all within a first preset distance from the starting parking point, and the duration within the first preset distance exceeds a first preset time length, it is determined whether the vehicle is parked at a point of interest or the distance between the vehicle and the point of interest is within a second preset distance;
[0038] If the current vehicle is not parked at a point of interest or the distance between the vehicle and the point of interest is greater than the second preset distance, the vehicle trajectory data corresponding to the current vehicle is determined as the original parking sample corresponding to the vehicle.
[0039] In one or more embodiments, the feature data corresponding to the target theme is acquired based on the original parking sample, comprising:
[0040] From the original parking sample, a trajectory data sequence to be calculated for features within a second preset time length is screened out;
[0041] The trajectory data sequence is classified according to the target vehicle, the vehicle around the target vehicle, and the road where the target vehicle is located, to obtain a trajectory data sequence corresponding to each topic category; wherein the target topic includes the target vehicle, the vehicle around the target vehicle, and the road where the target vehicle is located.
[0042] The feature data of the trajectory data sequence corresponding to each topic category is determined.
[0043] As shown in Figure 4 , the different time trajectory data sequences corresponding to a plurality of continuous and interval time same vehicles are input into the traffic accident prediction model, so as to predict whether the vehicle has a traffic accident.
[0044] In one or more embodiments, the feature data of the trajectory data sequence corresponding to the target vehicle topic category is determined, comprising:
[0045] The current vehicle collision alarm, the current vehicle driving state or parking state, the current vehicle double flash opening, and the current target vehicle single flash opening are converted into binary type first preprocessing data by the vehicle terminal of the target vehicle.
[0046] Specifically, the current vehicle collision alarm is converted into 1, and the non-collision alarm is converted into 0; the current vehicle double flash is converted into 1; the vehicle is in the driving state, and the feature value is configured as 1; the vehicle is in the parking state, and the feature value is configured as 0; the non-double flash of the vehicle is converted into 0; the current target vehicle is converted into 1; the non-single flash of the vehicle is converted into 0, so the first preprocessing data includes each feature type and the corresponding 0 or 1 value.
[0047] The current speed, acceleration, time difference between different trajectories, and the angle between the vehicle head and the north direction of the target vehicle are processed by abnormal value, box sealing, and normalization to obtain second preprocessing data.
[0048] Specifically, the current speed feature value of the target vehicle is determined by the formula , wherein Vmax is the analysis prediction value feature value, and V is the original speed feature value; the acceleration feature value of the target vehicle is determined by the formula , wherein a min and a max are analysis prediction feature values; the time difference feature value between different trajectories of the current vehicle is determined by the formula , wherein t c is the current trajectory point timestamp feature value, and t b is the previous trajectory point timestamp feature value of the current trajectory point; the angle between the vehicle head and the north direction is determined by the formula Determine the angle characteristic value of the target vehicle's vehicle head with the north direction, wherein g1 is the north direction angle characteristic value of the current trajectory point of the vehicle, g0 is the north direction angle characteristic value of the previous trajectory point, and g is the angle characteristic value of the target vehicle's vehicle head with the north direction. min And g max are all analysis prediction characteristic values.
[0049] The first preprocessed data and the second preprocessed data are taken as the feature data of the trajectory data sequence corresponding to the vehicle theme category in the target vehicle's surroundings.
[0050] In one or more embodiments, determining the feature data of the trajectory data sequence corresponding to the vehicle theme category in the target vehicle's surroundings further comprises:
[0051] Determine the current timestamp of the target vehicle, and take the union of the preset time period before the time corresponding to the timestamp and the preset time period after the time corresponding to the timestamp as the screening time period;
[0052] Based on the screening time period, determine the search area with the geographical location of the target vehicle as the center and the preset distance as the radius;
[0053] Determine the trajectory points of the surrounding vehicles within the search area, and determine the average speed of each trajectory point as the average speed value of the surrounding vehicles;
[0054] The average speed value is taken as the feature data of the trajectory data sequence corresponding to the vehicle theme category in the target vehicle's surroundings.
[0055] Specifically, the speed of the surrounding vehicles is determined by the formula , and then the average value of each vehicle speed is taken as the feature data of the trajectory data sequence corresponding to the vehicle theme category in the target vehicle's surroundings.
[0056] In one or more embodiments, determining the feature data of the trajectory data sequence corresponding to the road theme category where the target vehicle is located further comprises:
[0057] The road type where the target vehicle is located and whether there is an intersection in the current point of the target vehicle's surroundings are binarized to obtain the feature data of the trajectory data sequence corresponding to the road theme category where the target vehicle is located.
[0058] Specifically, the road types here include national roads, provincial roads, county roads, expressways, etc., and the road types are binarized by one-hot encoding.
[0059] In one or more embodiments, the training of the preset gating neural network model according to the feature data corresponding to the target theme to obtain the trained traffic accident prediction model comprises:
[0060] obtain a sample trajectory data set, wherein the sample trajectory data set comprises training samples and verification samples;
[0061] configure a verification class label of whether a traffic accident occurs for each sample trajectory data in the verification samples according to a traffic accident rule;
[0062] input the training trajectory data in the training samples and the corresponding accident determination class label into an initialized gated neural network model for training to obtain a training output result, wherein in each training process of the gated neural network model, the accident determination class label corresponding to the trajectory data is determined according to the number of trajectory point sequences and the number of features of the trajectory data;
[0063] in a case where the training output result indicates that a convergence condition is reached, the gated neural network model is determined, wherein the convergence condition is used to indicate that the difference between the determined accident determination class label of the training trajectory data and a verification class label is less than or equal to a preset threshold, and the verification class label is a class label in the verification samples having the same number of trajectory point sequences and the same number of features as the training trajectory data.
[0064] In one or more embodiments, the input of the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident comprises:
[0065] convert the to-be-predicted data corresponding to the current vehicle into a feature matrix comprising the number of trajectory point sequences and the number of features;
[0066] and input the feature matrix as input features into a first layer gated network module of the trained gated neural network model to obtain a first output tensor;
[0067] input the first output result into a second layer gated network module of the trained gated neural network model to obtain a first splicing tensor at a starting time and a second splicing tensor at an ending time;
[0068] input the first splicing tensor and the second splicing tensor into a fully connected layer of the trained gated neural network model to obtain a probability of whether the current vehicle has a traffic accident;
[0069] determine whether a traffic accident occurs according to the probability.
[0070] Specifically, as shown in Figure 5 the input data is arranged into a feature matrix of M=[L (number of trajectory point sequences), H (number of features)] as input features, and the label y is binarized as the output label.
[0071] The traffic accident prediction model in the embodiment of the application adopts a two-layer bidirectional GRU recurrent neural network structure of a Gate Recurrent Unit (GRU) classifier network, inputs the above input features into the first layer GRU, realizes the formula O1, H n1 = GRU (M), wherein O is output of all states, H is output of the last state, and M is a batch input feature matrix; then inputs the result of the first layer into the second layer, realizes the formula O2, H n2 = GRU (O1), the output layer is a two-class full connection layer, the input is a tensor spliced using the initial and final time output of the last layer of the GRU network, realizes the formula y = Softmax (O 21 , O 2n ).
[0072] In one or more embodiments, the traffic accident prediction method further comprises: learning the hyperparameters of the gated neural network model through a Bayesian hyperparameter tuning algorithm, and obtaining the trained traffic accident prediction model when the target hyperparameters are determined.
[0073] In an application embodiment, as shown in Figure 6 , the above traffic accident prediction method comprises the following steps:
[0074] Step 1, data acquisition
[0075] Acquire trajectory data of vehicles in a certain time range, each record contains: unique vehicle marker (license plate number and vehicle color), timestamp of different trajectory points, longitude of trajectory points, latitude of trajectory points, alarm information reported by the vehicle, vehicle speed, acceleration of the vehicle, angle between the vehicle head and the north, information whether the vehicle turns on the turn signal, road type (highway, national road, provincial road, county road, etc.) of the vehicle, intersection information, etc.
[0076] Step 2, parking judgment
[0077] Analyze the vehicle trajectory data, sort each vehicle by time, then judge whether the speeds of the adjacent two trajectory points are less than a certain threshold value, and the time difference between the adjacent two trajectory points is within a certain time range, if the above conditions are met, define the previous parking point as the starting parking point, the distance between the subsequent trajectory points and the starting parking point is within a certain distance range, and the total time of this state lasts more than a certain time, then define it as a possible accident parking, then judge the distance between the vehicle and the point of interest POI such as service area, highway parking area, inspection station, toll station, and the starting parking point, if it meets the condition of being less than a certain distance threshold, filter the possible accident parking information, and the remaining data is the original parking sample.
[0078] Step 3, Feature Engineering
[0079] First, according to the parking time t minus a certain time t1 and the parking time plus a certain time t2 as the time boundary to filter out the trajectory sequence that needs to be calculated, then according to three themes: target vehicle, surrounding vehicle, road, calculate the related features of each theme.
[0080] Target vehicle features:
[0081] Specifically, the current speed feature value of the target vehicle is determined by the formula , wherein Vmax is the analysis prediction feature value, and V is the original speed feature value; the acceleration feature value of the target vehicle is determined by the formula , wherein a min and a max are analysis prediction feature values; the time difference feature value between different trajectories of the current vehicle is determined by the formula , wherein t c is the current trajectory point timestamp feature value, and t b is the previous trajectory point timestamp feature value of the current trajectory point; the angle feature value between the vehicle head and the north direction is determined by the formula , wherein g1 is the north direction angle feature value of the current trajectory point of the vehicle, g0 is the north direction angle feature value of the previous trajectory point, and g min and g max are analysis prediction feature values.
[0082] Surrounding vehicle features:
[0083] Specifically, the speed of the surrounding vehicle is determined by the formula , and then the average value of each vehicle speed is taken as the feature data of the trajectory data sequence corresponding to the vehicle theme category in the surrounding of the target vehicle.
[0084] Road features:
[0085] The road type where the current point is located and whether there is an intersection around the current point are binarized. Specifically, the road types here include national roads, provincial roads, county roads, highways, etc., and the road types are binarized by one-hot encoding.
[0086] Step 4, Sample Dataset Construction
[0087] Positive samples: the parking stops verified by manual as traffic accidents as positive samples; negative samples: the original vehicle parking data, and try to exclude accident data as negative samples. The data set contains three parts of training set, validation set and test set. The construction process includes: training set: positive samples keep a certain proportion by resampling with replacement. Negative samples extract parking data for several days; validation set: positive and negative samples keep the proportion of the preset proportion Np:Nn data set.
[0088] Step 5, model selection
[0089] GRU classifier model training:
[0090] Specifically, as shown in Figure 5 , the input data is arranged into a feature matrix of M=[L (number of track point sequences), H (number of features)], as input features, and the label y is binarized, as the output label.
[0091] The traffic accident prediction model in the embodiment of the application adopts a classifier network structure of a gate recurrent unit neural network (GRU) as a two-layer bidirectional GRU recurrent neural network, inputs the above input features into the first layer GRU, realizes the formula O1, H n1 = GRU (M), wherein O is the output of all states, H is the output of the last state, and M is the batch input feature matrix; then the result of the first layer is input into the second layer, realizes the formula O2, H n2 = GRU (O1), the output layer is a binary classification fully connected layer, the input is a tensor spliced using the initial and final time output of the last layer of GRU network, realizes the formula y = Softmax (O 21 , O 2n ).
[0092] Through the Bayesian parameter adjustment method, the model hyperparameters are learned, and after learning the optimal parameters, the model is exported to obtain the trained traffic accident prediction model.
[0093] Step 6, identify type
[0094] Load the pre-trained GRU classifier model parameters, arrange the prediction data to meet the input format of the GRU classifier, and the probability of unknown data accident can be predicted. Greater than a certain threshold can be identified as sending a traffic accident.
[0095] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily necessary for the present application.
[0096] According to another aspect of the embodiments of the present application, a traffic accident prediction device for implementing the above traffic accident prediction method is also provided. As shown in the figure, the device comprises: Figure 7
[0097] The first acquisition unit 702 acquires vehicle trajectory data corresponding to a target vehicle set in a preset time period, and pre-processes the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set.
[0098] The second acquisition unit 704 is configured to acquire feature data corresponding to a target theme based on the original parking samples.
[0099] The training unit 706 is configured to train a preset gated neural network model according to the feature data to obtain a trained traffic accident prediction model.
[0100] The determination unit 708 is configured to input the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident.
[0101] In the embodiments of the present application, the vehicle trajectory data corresponding to the target vehicle set in the preset time period is acquired, and the vehicle trajectory data is pre-processed to obtain the original parking samples corresponding to the target vehicle set. The feature data corresponding to the target theme is acquired based on the original parking samples. The preset gated neural network model is trained according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model. The to-be-predicted data corresponding to the current vehicle is input into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident. In the above method, since the feature data of different theme types is acquired according to the target vehicle trajectory, the gated neural network model can be trained according to the scene-compliant and refined features to obtain a trained traffic accident prediction model. The trained traffic accident prediction model is used to determine whether the current vehicle has a traffic accident, which can improve the identification and prediction accuracy of traffic accidents, thereby solving the technical problem of low identification and prediction accuracy of traffic accidents in related technologies.
[0102] In one or more embodiments, the first obtaining unit 702 comprises:
[0103] The sorting module is configured to sort the vehicle trajectory data by time;
[0104] The first determining module is configured to, for each vehicle in the target vehicle set, if the speeds of two adjacent trajectory points are both zero and the time difference between the two adjacent trajectory points is within a preset time range, take the former one of the two adjacent trajectory points as a starting stop point;
[0105] The second determining module is configured to, if the subsequent stop point of the current vehicle is within a first preset distance from the starting stop point and the duration within the first preset distance exceeds a first preset time length, determine whether the vehicle is parked at a point of interest or the distance between the vehicle and the point of interest is within a second preset distance;
[0106] The first determining module is configured to, if the current vehicle is not parked at a point of interest or the distance between the vehicle and the point of interest is greater than the second preset distance, determine the vehicle trajectory data corresponding to the current vehicle as an original parking sample corresponding to the vehicle.
[0107] In one or more embodiments, the second obtaining unit 704 comprises:
[0108] The screening module is configured to screen a trajectory data sequence to be calculated for features from the original parking sample for a second preset time length;
[0109] The second determining module is configured to classify the trajectory data sequence by target vehicles, vehicles around the target vehicles, and roads where the target vehicles are located, to obtain a trajectory data sequence corresponding to each theme category; wherein the target theme includes target vehicles, vehicles around the target vehicles, and roads where the target vehicles are located.
[0110] The third determining module is configured to determine feature data of the trajectory data sequence corresponding to each theme category.
[0111] In one or more embodiments, the third determining module comprises:
[0112] The first processing sub-unit is configured to convert, by a vehicle terminal of a target vehicle, whether a current vehicle has a collision alarm, whether the current vehicle is in a driving state or a parking state, whether the current vehicle has a double flash turned on, and whether the current target vehicle has a single flash turned on, into first pre-processing data of a binary type;
[0113] The second processing sub-unit is configured to obtain second pre-processing data by performing outlier processing, binning processing, and normalization processing on the current speed of the target vehicle, the acceleration, the time difference between different trajectories, and the angle between the vehicle head and the north direction.
[0114] The first determining sub-unit is configured to take the first preprocessed data and the second preprocessed data as feature data of the trajectory data sequence corresponding to the subject category of the target vehicle.
[0115] In one or more embodiments, the third determining module further includes:
[0116] The second determining sub-unit is configured to determine a current timestamp of the target vehicle, and take a union of a preset time period before a moment corresponding to the timestamp and a preset time period after the moment as a screening time period.
[0117] The third determining sub-unit is configured to determine a search area based on the screening time period, with a geographical location of the target vehicle as a center and a preset distance as a radius.
[0118] The fourth determining sub-unit is configured to determine a trajectory point of a surrounding vehicle within the search area, and determine an average speed of each trajectory point as an average speed value of the surrounding vehicle.
[0119] The fifth determining sub-unit is configured to take the average speed value as feature data of the trajectory data sequence corresponding to the subject category of the vehicle surrounding the target vehicle.
[0120] In one or more embodiments, the third determining module further includes:
[0121] The third processing sub-unit is configured to perform binary processing on a road type where the target vehicle is located and whether there is an intersection around the target vehicle at a current point, to obtain feature data of the trajectory data sequence corresponding to the road subject category where the target vehicle is located.
[0122] In one or more embodiments, the training unit 706 includes:
[0123] The first obtaining module is configured to obtain a sample trajectory data set; wherein the sample trajectory data set includes training samples and verification samples.
[0124] The configuration module is configured to configure a verification category label of whether a traffic accident occurs for each sample trajectory data in the verification samples according to a traffic accident rule.
[0125] The training module is configured to input training trajectory data in the training samples and a corresponding accident determination category label into an initialized gated neural network model for training, to obtain a training output result; wherein in each training process of the gated neural network model, a category label of accident determination corresponding to the trajectory data is determined according to a number of trajectory point sequences and a number of features of the trajectory data.
[0126] The fourth determining module is configured to determine the gating neural network model when the training output result indicates that a convergence condition is reached, where the convergence condition is used to indicate that a difference between a category label of the accident determination of the training trajectory data and a verification category label is less than or equal to a preset threshold, and the verification category label is a category label in the verification sample that has the same number of trajectory point sequences and the same number of features as the training trajectory data.
[0127] In one or more embodiments, the determining unit 708 includes:
[0128] The conversion module is configured to convert the to-be-predicted data corresponding to the current vehicle into a feature matrix including the number of trajectory point sequences and the number of features.
[0129] The first processing module is configured to input the feature matrix as input features into a first layer gating network module of the trained gating neural network model to obtain a first output tensor.
[0130] The second processing module is configured to input the first output result into a second layer gating network module of the trained gating neural network model to obtain a first splicing tensor at a starting time and a second splicing tensor at an ending time.
[0131] The full connection module is configured to input the first splicing tensor and the second splicing tensor into a full connection layer of the trained gating neural network model to obtain a probability of whether the current vehicle has a traffic accident.
[0132] The fifth determining module is configured to determine whether the traffic accident occurs according to the probability.
[0133] In one or more embodiments, the traffic accident prediction apparatus further includes:
[0134] The learning unit is configured to learn gating neural network model hyperparameters through a Bayesian hyperparameter tuning algorithm, and obtain the trained gating neural network model when the target hyperparameters are determined.
[0135] According to still another aspect of the embodiments of the present application, an electronic device for implementing the above traffic accident prediction method is also provided, which can be a terminal device or a server as shown in the drawings. Figure 8 As shown in the drawings, the electronic device includes a memory 802 and a processor 804, the memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program. Figure 8
[0136] Optionally, in the embodiment, the electronic device can be located in at least one of the plurality of network devices of the computer network.
[0137] Optionally, in the embodiment, the processor can be configured to perform the following steps by means of a computer program:
[0138] S1, obtaining vehicle trajectory data corresponding to a target vehicle set in a preset time period, and preprocessing the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set;
[0139] S2, obtaining feature data corresponding to a target theme based on the original parking samples;
[0140] S3, training a preset gating neural network model according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model;
[0141] S4, inputting the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident.
[0142] Optionally, those skilled in the art can understand that, Figure 8 The structure shown is only schematic, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, or the like. Figure 8 It does not limit the structure of the electronic device. For example, the electronic device can further include more or fewer components (such as a network interface, etc.) than Figure 8 or have a different configuration from Figure 8 .
[0143] The memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the traffic accident prediction method and device in this embodiment of the invention. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, thereby realizing the aforementioned traffic accident prediction method. The memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include memory remotely located relative to the processor 804, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 802 may be used, but is not limited to, to store the prediction results of traffic accidents. As an example, such as... Figure 8 As shown, the memory 802 may include, but is not limited to, the first acquisition unit 702, the second acquisition unit 704, the training unit 706, and the determination unit 708 in the traffic accident prediction device. Furthermore, it may include, but is not limited to, other module units in the traffic accident prediction device, which will not be elaborated upon in this example.
[0144] Optionally, the transmission device 808 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 808 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 808 is a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0145] In addition, the aforementioned electronic device also includes: a display 808 for displaying the predicted results of traffic accidents; and a connection bus 810 for connecting the various module components in the aforementioned electronic device.
[0146] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.
[0147] According to an aspect of the present application, a computer program product or computer program is provided, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the traffic accident prediction method described above, wherein the computer program is configured to perform the steps in any of the method embodiments described above when executed.
[0148] Optionally, in the present embodiment, the computer readable storage medium described above can be configured to store a computer program for performing the following steps:
[0149] S1, obtaining vehicle trajectory data corresponding to a target vehicle set in a preset time period, and preprocessing the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set;
[0150] S2, obtaining feature data corresponding to a target topic based on the original parking samples;
[0151] S3, training a preset gated neural network model according to the feature data corresponding to the target topic to obtain a trained traffic accident prediction model;
[0152] S4, inputting to-be-predicted data corresponding to a current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident.
[0153] Optionally, in the present embodiment, a person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer readable storage medium, and the storage medium can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0154] The serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0155] The integrated units in the above embodiments, if implemented in the form of software function units and sold or used as independent products, can be stored in the above computer-readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions to make one or more computer devices (which can be personal computers, servers or network devices, etc.) execute all or part of the steps of the embodiments of the present application.
[0156] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0157] In several embodiments provided in the present application, it should be understood that the disclosed client can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed units can be indirect coupling or communication connection through some interfaces, units or modules, and can be electrical or other forms.
[0158] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected to achieve the purpose of the embodiment of the present application according to actual needs.
[0159] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software function unit.
[0160] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A traffic accident prediction method characterized by, The method comprises the following steps: acquiring vehicle trajectory data corresponding to a target vehicle set in a preset time period, and preprocessing the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set; based on the original parking samples, acquiring feature data corresponding to a target theme; training a preset gated neural network model according to the feature data corresponding to the target theme to obtain a trained traffic accident prediction model; the traffic accident prediction model adopts a classifier network structure of a gated recurrent unit neural network, which is a two-layer bidirectional gated recurrent neural network; inputting the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident, including: converting the to-be-predicted data corresponding to the current vehicle into a feature matrix including the number of trajectory point sequences and the number of features; and inputting the feature matrix as input features into a first layer gated network module of the trained gated neural network model to obtain a first output tensor; inputting the first output tensor into a second layer gated network module of the trained gated neural network model to obtain a first splicing tensor at a starting time and a second splicing tensor at an ending time; inputting the first splicing tensor and the second splicing tensor into a fully connected layer of the trained gated neural network model to obtain a probability of whether the current vehicle has a traffic accident; and determining whether a traffic accident occurs according to the probability.
2. The method of claim 1, wherein, The preprocessing of the vehicle trajectory data to obtain the original parking samples corresponding to the target vehicle set comprises the following steps: sorting the vehicle trajectory data by time; for each vehicle in the target vehicle set, if the speeds of two adjacent trajectory points are all zero and the time difference between the two adjacent trajectory points is within a preset time range, regarding the former trajectory point in the two adjacent trajectory points as a starting parking point; if the subsequent parking points of the current vehicle are all within a first preset distance from the starting parking point and the duration within the first preset distance exceeds a first preset time length, determining whether the vehicle is parked at a point of interest or the distance between the vehicle and the point of interest is within a second preset distance; if the current vehicle is not parked at a point of interest or the distance between the vehicle and the point of interest is greater than the second preset distance, determining the vehicle trajectory data corresponding to the current vehicle as the original parking sample corresponding to the vehicle.
3. The method of claim 1, wherein, The acquisition of the feature data corresponding to the target theme based on the original parking samples comprises the following steps: selecting a trajectory data sequence to be calculated for features of a second preset time length from the original parking samples; classifying the trajectory data sequence by target vehicles, vehicles around the target vehicles, and roads where the target vehicles are located to obtain trajectory data sequences corresponding to each theme category; wherein the target theme includes target vehicles, vehicles around the target vehicles, and roads where the target vehicles are located; determining the feature data of the trajectory data sequence corresponding to each theme category.
4. The method of claim 3, wherein, The determination of the feature data of the trajectory data sequence corresponding to the target vehicle theme category comprises: The first pre-processing data of whether the current vehicle has a collision warning, whether the current vehicle is in a driving state or a parking state, whether the current vehicle opens double flash, and whether the current target vehicle opens single flash are converted into binary types by the on-board terminal of the target vehicle; The current speed, acceleration, time difference between different trajectories, and the angle between the vehicle head and the north direction of the target vehicle are processed by outlier processing, binning processing, and normalization processing to obtain the second pre-processing data; The first pre-processing data and the second pre-processing data are used as feature data of the trajectory data sequence corresponding to the vehicle theme category of the target vehicle.
5. The method of claim 3, wherein, Determining the feature data of the trajectory data sequence corresponding to the vehicle theme category around the target vehicle further comprises: Determining the current timestamp of the target vehicle, and taking the union of the preset time period before the time corresponding to the timestamp and the preset time period after the time corresponding to the timestamp as a screening time period; Based on the screening time period, the search area is determined with the geographical location of the target vehicle as the center and the preset distance as the radius; Determining the trajectory points of the surrounding vehicles within the search area, and determining the average speed of each trajectory point as the average speed value of the surrounding vehicles; The average speed value is used as the feature data of the trajectory data sequence corresponding to the vehicle theme category around the target vehicle.
6. The method of claim 3, wherein, Determining the feature data of the trajectory data sequence corresponding to the road theme category where the target vehicle is located further comprises: The road type where the target vehicle is located and whether there is an intersection around the target vehicle are binarized to obtain the feature data of the trajectory data sequence corresponding to the road theme category where the target vehicle is located.
7. The method of claim 1, wherein, The training of the preset gating neural network model according to the feature data corresponding to the target theme to obtain the trained traffic accident prediction model comprises: Obtaining a sample trajectory data set; wherein the sample trajectory data set includes training samples and validation samples; For each sample trajectory data in the validation sample, a validation class label of whether a traffic accident occurs according to a traffic accident rule is configured; The training trajectory data in the training sample and the corresponding accident determination class label are input into the initialized gating neural network model for training to obtain a training output result, wherein in each training process of the gating neural network model, according to the number of trajectory point sequences and the number of features corresponding to the training trajectory data, the class label of the accident determination corresponding to the trajectory data is determined; In the case where the training output result indicates that the convergence condition is reached, the gating neural network model is determined, wherein the convergence condition is used to indicate that the difference between the determined class label of the accident determination of the training trajectory data and the validation class label is less than or equal to a preset threshold, and the validation class label is the class label in the validation sample with the same number of trajectory point sequences and the number of features as the training trajectory data.
8. The method of claim 7, wherein, The method further comprises: Learning the gating neural network model hyperparameters by the Bayesian parameter tuning algorithm, and obtaining the trained traffic accident prediction model when the target hyperparameters are determined.
9. A traffic accident prediction device characterized by comprising: Comprise: The first acquisition unit acquires vehicle trajectory data corresponding to a target vehicle set in a preset time period, and pre-processes the vehicle trajectory data to obtain original parking samples corresponding to the target vehicle set. The second acquisition unit is configured to acquire feature data corresponding to a target theme based on the original parking samples. The training unit is configured to train a preset gated neural network model based on the feature data to obtain a trained traffic accident prediction model. The determination unit is configured to input the to-be-predicted data corresponding to the current vehicle into the trained traffic accident prediction model to determine whether the current vehicle has a traffic accident. The determination unit is specifically configured to convert the to-be-predicted data corresponding to the current vehicle into a feature matrix including a number of trajectory point sequences and a number of features, input the feature matrix as input features into a first layer gating network module of the trained gated neural network model to obtain a first output tensor, input the first output tensor into a second layer gating network module of the trained gated neural network model to obtain a first splicing tensor at a starting time and a second splicing tensor at an ending time, input the first splicing tensor and the second splicing tensor into a fully connected layer of the trained gated neural network model to obtain a probability of whether the current vehicle has a traffic accident, and determine whether the current vehicle has a traffic accident based on the probability.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method in any one of claims 1 to 8 by using the computer program.
11. A computer readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program executes the method in any one of claims 1 to 8 when running. The computer-readable storage medium includes a stored program, wherein the program executes the method in any one of claims 1 to 8 when running.
Citation Information
Patent Citations
Freight vehicle accident judgment system, method, equipment and medium
CN114548284A
Truck accident identification method and device, storage medium and program product
CN114677254A
Highway traffic cooperative control method, electronic equipment and storage medium
CN115273497A