Method and device for attributing traffic safety accidents by using Bayesian inference theory
By applying Bayesian inference theory to construct Bayesian perceptrons in traffic accident attribution analysis, the problems of inaccurate attribution results and large calculations in the existing technology are solved, and more accurate and robust traffic accident arising Because of analysis.
Patent Information
- Application Number
- CN202411627578.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-18
AI Technical Summary
The existing technology lacks uncertainty analysis of attribution results in traffic accident attribution analysis, resulting in inaccurate attribution results and requires a large amount of accident data for training, with large amounts of calculation and poor robustness.
Bayesian perceptron is constructed by using Bayesian inference theory. By inputting video clip samples carrying labels one by one, model parameters are obtained based on Bayesian inference theory, training Bayesian perceptron is obtained, and traffic safety accident attribution is carried out. Analysis, the probability of obtaining the attribution results and their confidence interval.
It improves the accuracy and credibility of traffic accident attribution results, reduces the amount of data and computing resources required for training, and enhances the robustness of the model.
Smart Images

Figure CN119478789A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of traffic accident data processing, and in particular to a method and device for attributing traffic safety accidents using Bayesian inference theory. Background Art
[0002] Traffic safety management is an important part of road traffic management. It can obtain a large amount of accurate and complete accident data through various intelligent communication equipment, monitoring and surveillance equipment, and conduct accident attribution analysis based on the accident data.
[0003] In the related art, the attribution analysis of traffic accidents based on accident data using a neural network accident attribution model can obtain the attribution results of traffic accidents, but lacks uncertainty analysis of the attribution results, resulting in inaccurate attribution results. In addition, a large amount of accident data is required to train the accident attribution model in order to obtain a model with accident attribution capabilities, which results in large computational complexity and poor robustness. Summary of the invention
[0004] In view of the above problems, the embodiments of the present application provide a method and device for attributing traffic safety accidents using Bayesian inference theory, so as to overcome the above problems or at least partially solve the above problems.
[0005] In a first aspect of the embodiments of the present application, a method for attributing traffic safety accidents using Bayesian inference theory is disclosed, the method comprising: Input multiple video clip samples with labels in the input data set into the Bayesian perceptron one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; Based on the Bayesian inference theory, the model parameters of the Bayesian perceptron are obtained, and the trained Bayesian perceptron is obtained; The video clip of the traffic safety accident is input into the trained Bayesian perceptron to obtain an attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0006] Optionally, the model parameters of the Bayesian perceptron are Obey Gaussian distribution: ,in, is the mean vector, is the covariance matrix; The forward propagation process of the Bayesian perceptron corresponds to the first task, which is: for a video clip sample carrying a label input into the Bayesian perceptron , estimates the output of the Bayesian perceptrony The probability density function of ,in, represents the input data set and obeys Gaussian distribution; The back propagation process of the Bayesian perceptron corresponds to the second task, which is to estimate the probability density function Parameters and .
[0007] Optionally, the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory, including: In the first to the second steps of the Bayesian perceptron, Sample video clips with labels In the case of , the corresponding model parameters are the prior distribution of the model parameters ,in, The weights of the Bayesian perceptron composition; The first Sample video clips with labels Input to the Bayesian perceptron, and estimate the posterior distribution of weights based on Bayesian inference theory .
[0008] Optionally, estimate the posterior distribution of the weights based on Bayesian inference theory ,include: Compute the first conditional distribution , the first conditional distribution characterizes and The joint probability distribution of , where , represents the bias parameter; Based on Bayesian inference theory, estimate the second conditional distribution , the second conditional distribution characterizes The probability distribution of According to the first conditional distribution and the second conditional distribution, the posterior distribution of the weight is estimated according to the following formula: ,in, represents the field of all real numbers.
[0009] Optionally, calculate the first conditional distribution ,include: , in, , , the average vector and the covariance matrix According to the prior distribution Calculated, The mean , Variance .
[0010] Optionally, based on Bayesian inference theory, estimate the second conditional distribution ,include: , in, , , is the mean of the Kalman estimate , is the Kalman estimate variance ; is the Kalman gain, is the Kalman measurement, represents the mean of y, is the Kalman measure variance, .
[0011] The second aspect of the embodiment of the present application discloses a method for attributing traffic safety accidents using Bayesian inference theory, comprising: Inputting a plurality of video clip samples with labels in the input data set into the Kalman Bayesian neural network one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; Obtaining model parameters of a Kalman Bayesian neural network based on the Bayesian inference theory to obtain a trained Kalman Bayesian neural network, wherein the Kalman Bayesian neural network has multiple hidden layers and multiple Bayesian perceptrons, and the Bayesian perceptron is the trained Bayesian perceptron described in the first aspect of the embodiment of the present application; The video clip of the traffic safety accident is input into the trained Ka Bayesian perceptron to obtain the attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0012] In a third aspect of the embodiment of the present application, a device for attributing traffic safety accidents using Bayesian inference theory is disclosed, comprising: A first input module is used to input a plurality of video clip samples carrying labels in an input data set into a Bayesian perceptron in order one by one, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; The first training module is used to obtain the model parameters of the Bayesian perceptron based on the Bayesian inference theory to obtain the trained Bayesian perceptron; The second input module is used to input the video clip of the traffic safety accident into the trained Bayesian perceptron to obtain the attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0013] In a fourth aspect of the embodiments of the present application, a device for attributing traffic accidents using Bayesian inference theory is disclosed, comprising: A third input module is used to input a plurality of video clip samples carrying labels in the input data set into the Kalman Bayesian neural network one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; A second training module is used to obtain model parameters of a Kalman Bayesian neural network based on the Bayesian inference theory to obtain a trained Kalman Bayesian neural network, wherein the Kalman Bayesian neural network has multiple hidden layers and multiple Bayesian perceptrons, and the Bayesian perceptron is the trained Bayesian perceptron described in the first aspect of the embodiment of the present application; The fourth input module is used to input the video clip of the traffic safety accident into the trained Ka Bayesian perceptron to obtain the attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0014] The fifth aspect of the embodiments of the present application discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the first aspect of the embodiments of the present application are implemented, or the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the second aspect of the embodiments of the present application are implemented.
[0015] The sixth aspect of the embodiments of the present application discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the first aspect of the embodiments of the present application are implemented, or the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the second aspect of the embodiments of the present application are implemented.
[0016] The seventh aspect of the embodiments of the present application discloses a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the first aspect of the embodiments of the present application, or the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the second aspect of the embodiments of the present application.
[0017] The embodiments of the present application include the following advantages: In an embodiment of the present application, a plurality of video clip samples carrying labels in an input data set are input into a Bayesian perceptron one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents occurring in the video sample clips; model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory to obtain a trained Bayesian perceptron; and then the video clips where traffic safety accidents occur are input into the trained Bayesian perceptron to obtain attribution results, wherein the attribution results characterize the probability of the causes of traffic safety accidents occurring and the corresponding confidence intervals.
[0018] In this way, combined with the characteristic that the Bayesian network can express output uncertainty, the trained Bayesian perceptron is used to obtain the attribution result including the probability of the cause of the traffic safety accident and the corresponding confidence interval, so that the obtained attribution result is more accurate and reliable. In addition, the Bayesian perceptron is trained using the video clip samples input one by one, and the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory. Therefore, the training of the Bayesian perceptron is gradient-free and carried out in sequence, and does not require a gradient descent algorithm. The Bayesian perceptron can learn data structures faster. Compared with the training method using gradient descent and batch processing, the embodiment of the present application does not require a large amount of data and computing resources to achieve training, and has better robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 It is a flowchart of the steps of a method for attributing traffic safety accidents using Bayesian inference theory provided in an embodiment of the present application; Figure 2 It is a flowchart of another method for attributing traffic safety accidents using Bayesian inference theory provided by an embodiment of the present application; Figure 3 It is a schematic diagram of the structure of a device for attributing traffic safety accidents using Bayesian inference theory provided in an embodiment of the present application; Figure 4 This is a schematic diagram of the structure of another device for attributing traffic safety accidents using Bayesian inference theory provided in the embodiment of the present application. Figure 5It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0022] In the related art, although the attribution results of traffic accidents can be obtained by using a neural network accident attribution model based on accident data, there is a lack of uncertainty analysis of the attribution results, and thus there is a problem of inaccurate attribution results. For example, for a certain traffic accident, there is a 30% probability that it is caused by reason 1 and a 70% probability that it is caused by reason 2. However, the accident attribution model does not know the certainty that the traffic accident is caused by a 30% probability. However, in some cases, the uncertainty of the output of the accident attribution model is significant. For example, if the uncertainty of the output of an accident attribution model is very high, the result may not be used because if the external conditions change, the result will fluctuate dramatically. The existing use of the neural network accident attribution model for attribution analysis of traffic accidents, therefore, there is a problem of inaccurate attribution results.
[0023] In addition, the neural network accident attribution model needs to utilize a large amount of accident data and use variational inference methods or Markov chain Monte Carlo (MCMC) methods to update parameters, which results in high computational complexity and poor robustness.
[0024] In order to overcome the limitations of the relevant technology, the embodiment of the present application provides a method for attributing traffic safety accidents using Bayesian inference theory. The method constructs a Bayesian perceptron. Compared with other neural networks, the Bayesian perceptron does not require a large amount of data, has good robustness, can express the uncertainty of model output and parameters, and uses the trained Bayesian perceptron to obtain the attribution result including the probability of the cause of the traffic safety accident and the corresponding confidence interval, so that the attribution result obtained is more accurate and reliable; and the Bayesian perceptron is trained using the video clip samples input one by one, and the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory, so the training of the Bayesian perceptron is gradient-free and sequential, and does not require a gradient descent algorithm. The Bayesian perceptron can learn data structures faster. Compared with the training method using gradient descent and batch processing, the embodiment of the present application does not require a large amount of data and computing resources to achieve training, and has better robustness. In this way, a more accurate traffic accident attribution analysis is achieved.
[0025] The following describes the method of attributing traffic accidents using Bayesian inference theory in an embodiment of the present application in conjunction with the accompanying drawings.
[0026] Reference Figure 1 As shown, Figure 1 This is a flowchart of a method for attributing traffic safety accidents using Bayesian inference theory provided in an embodiment of the present application. Figure 1 As shown, the method may include steps S110 to S130: Step S110: input multiple video clip samples carrying labels in the input data set into the Bayesian perceptron one by one in sequence, the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips.
[0027] Step S120: Obtain model parameters of the Bayesian perceptron based on the Bayesian inference theory to obtain a trained Bayesian perceptron.
[0028] Step S130: inputting the video clip of the traffic safety accident into the trained Bayesian perceptron to obtain an attribution result, wherein the attribution result represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0029] In an embodiment of the present application, the Bayesian perceptron is a neural network model based on Bayesian estimation. The model parameters of the Bayesian perceptron obey Gaussian distribution. For the trained Bayesian perceptron, attribution results can be generated based on video clips of traffic safety accidents.
[0030] The input data set contains multiple labeled video clip samples, which are input into the Bayesian perceptron one by one in sequence for processing. In the Bayesian perceptron, each labeled video clip sample is processed sequentially, rather than processing training data in batches like an ordinary neural network.
[0031] After receiving the labeled video clip samples one by one, the Bayesian perceptron obtains the model parameters of the Bayesian perceptron based on the Bayesian inference theory. Therefore, using multiple labeled video clip samples in the input data set to update the model parameters of the Bayesian perceptron is essentially a Kalman filtering process, that is, using the observed value of the existing video clip sample to update the estimated value to modify the model parameters of the Bayesian perceptron. In this way, the Bayesian perceptron itself is combined with the Kalman filtering feature to predict and update the existing observation data. Compared with the existing neural network model, the Bayesian perceptron does not need to consider parallel computing, all video clip samples only need to be processed once, and there is no need to use methods such as stochastic gradient descent to calculate the gradient, which greatly reduces the training computational cost of the Bayesian perceptron.
[0032] After obtaining the trained Bayesian perceptron, the video clip of the traffic safety accident is input into the trained Bayesian perceptron to obtain the attribution result representing the probability of the cause of the traffic safety accident and the corresponding confidence interval. For example, the attribution result can be expressed as: the probability of cause 1 is 30%, and the confidence level is 0.6 to 0.7; the probability of cause 2 is 70%, and the confidence level is 0.6 to 0.75.
[0033] In the above process, combined with the characteristic of the Bayesian network that can express output uncertainty, the trained Bayesian perceptron is used to obtain the attribution result including the probability of the cause of the traffic safety accident and the corresponding confidence interval, so that the obtained attribution result is more accurate and reliable. In addition, the Bayesian perceptron is trained using the video clip samples input one by one, and the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory. Therefore, the training of the Bayesian perceptron is gradient-free and carried out in sequence, and does not require a gradient descent algorithm. The Bayesian perceptron can learn data structures faster. Compared with the training method using gradient descent and batch processing, the embodiment of the present application does not require a large amount of data and computing resources to achieve training, and has better robustness.
[0034] In a specific embodiment, the model parameters of the Bayesian perceptron are Obey Gaussian distribution: ,in, is the mean vector, is the covariance matrix; The forward propagation process of the Bayesian perceptron corresponds to the first task, which is: for a video clip sample carrying a label input into the Bayesian perceptron , estimates the output of the Bayesian perceptron y The probability density function of ,in, represents the input data set and obeys Gaussian distribution; The back propagation process of the Bayesian perceptron corresponds to the second task, which is to estimate the probability density function Parameters and .
[0035] For example, a Bayesian perceptron can be represented as: , , in, The weights of the Bayesian perceptron Composition, weights follow Gaussian distribution ; b represents the bias parameter, represents the activation function. In some embodiments, the activation function may be a sigmoid activation function ; In some embodiments, the activation function may be a piecewise linear activation function .
[0036] In the embodiment of the present application, the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory to obtain a trained Bayesian perceptron, which requires completing the above-mentioned first task and second task.
[0037] (1) The first task is to calculate the y The distribution of, according to the Bayesian problem, assuming that the output of the Bayesian perceptron y The probability density function of If it obeys Gaussian distribution, then y The probability density function of can be transformed into: , , in, represents the mean of y, represents the variance of y.
[0038] Since the weights follow a Gaussian distribution, It also obeys the Gaussian distribution, so The mean It can be expressed as: , According to the properties of covariance, Variance It can be expressed as: , Therefore, when the activation function is the sigmoid activation function, y The mean It can be expressed as:
[0039] in, is the inverse of the sigmoid activation function, .
[0040] y Variance It can be expressed as: , When the activation function is a piecewise linear activation function, y The mean It can be expressed as: , y Variance It can be expressed as: , (2) The second task is to update the model parameters of the Bayesian perceptron based on the backward propagation of the training data. In the Bayesian perceptron, each training data (a sample of a video clip carrying a label) is processed sequentially to obtain a probability density function Parameters and .
[0041] In this way, by inputting multiple labeled video clip samples in the input data set into the Bayesian perceptron one by one in sequence, for each labeled video clip sample, the Bayesian perceptron respectively performs the above forward propagation process corresponding to the first task and the backward propagation process corresponding to the second task, and finally obtains the model parameters Obeying the Gaussian distribution, we get the trained Bayesian perceptron.
[0042] In a specific implementation, the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory, including step A1 and step A2: Step A1: Input the first to the second Sample video clips with labels In the case of , the corresponding model parameters are the prior distribution of the model parameters ,in, The weights of the Bayesian perceptron composition.
[0043] Step A2: Sample video clips with labels Input to the Bayesian perceptron, and estimate the posterior distribution of weights based on Bayesian inference theory .
[0044] In the embodiment of the present application, the Bayesian perceptron updates the model parameters based on each input video clip sample carrying a label. Sample video clips with labels , using the previous 1st to Sample video clips with labels The corresponding prior distribution , and, Sample video clips with labels , calculate the delayed distribution of weights In some embodiments, for ease of calculation, a Gaussian distribution is selected to approximate the backward distribution of the weights.
[0045] Specifically, the posterior distribution of weights is estimated based on Bayesian inference theory , including steps A21 to A23: Step A21: Calculate the first conditional distribution , the first conditional distribution characterizes and The joint probability distribution of , where , Represents the bias parameter.
[0046] Step A22: Estimate the second conditional distribution based on Bayesian inference theory , the second conditional distribution characterizes The probability distribution of .
[0047] Step A23: Estimate the posterior distribution of the weight according to the following formula based on the first conditional distribution and the second conditional distribution: , in, represents the field of all real numbers.
[0048] In the embodiment of the present application, the posterior distribution estimation of the weight is converted into solving the first conditional distribution and the second conditional distribution. The first conditional distribution represents the weight and The joint probability distribution of the second conditional distribution characterizes The probability distribution of , according to the product of these two conditional distributions, can get the posterior distribution of weights.
[0049] (1) Calculate the first conditional distribution ,include: , in, , , the average vector and the covariance matrix According to the prior distribution Calculated, The mean , Variance .
[0050] It is calculated as follows: , and, The mean and variance Based on the video clip sample It is obtained during the forward propagation process of the Bayesian perceptron. In this way, all variables in the first conditional distribution are known, so the first conditional distribution can be calculated.
[0051] (2) Based on Bayesian inference theory, estimate the second conditional distribution ,include: , in, , , is the mean of the Kalman estimate , is the Kalman estimate variance ; is the Kalman gain, is the Kalman measurement, express y The mean of is the Kalman measure variance, .
[0052] In the embodiment of the present application, and They are The posterior estimates of the mean and variance of The calculation of the mean and variance of is different. and Corresponding to the Kalman filtering process, the process updates the predicted value according to the observed value at each time step, that is, through the Kalman filter according to Calculate the prior distribution of Specifically, we can is regarded as a Kalman prior estimate and is calculated by forward propagation. can be regarded as a Kalman measurement; if the Kalman gain A higher value indicates that the uncertainty of the measurement result is lower and the posterior estimate depends more on the Kalman measurement result; is the Kalman estimate variance, is the Kalman measurement variance. In Kalman filter theory, the variance consists of process variance and measurement variance. Therefore, and The calculation of corresponds to the characteristics of Kalman filtering, that is, the result after filtering is a combination of prediction and measurement, so its mean is closer to the true value and the variance is smaller. In this way, all variables in the second conditional distribution are known, so the second conditional distribution can be calculated.
[0053] In the above process, the Bayesian perceptron itself is combined with the Kalman filter feature. The Bayesian perceptron is trained using video clip samples input one by one, and the model parameters of the Bayesian perceptron are obtained based on the Bayesian inference theory. Compared with the existing neural network model, the training of the Bayesian perceptron is gradient-free and performed sequentially, and does not require a gradient descent algorithm. The Bayesian perceptron can learn data structures faster. Compared with the training method using gradient descent and batch processing, the embodiment of the present application does not require a large amount of data and computing resources to achieve training, and has better robustness.
[0054] Reference Figure 2 As shown, Figure 2 This is a flowchart of another method for attributing traffic safety accidents using Bayesian inference theory provided by the embodiment of the present application. Figure 2 As shown, the method may include steps S210 to S230: Step S210: Input multiple video clip samples carrying labels in the input data set into the Kalman Bayesian neural network one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips.
[0055] Step S220: Obtain model parameters of the Kalman Bayesian neural network based on the Bayesian inference theory to obtain a trained Kalman Bayesian neural network, wherein the Kalman Bayesian neural network has multiple hidden layers and multiple Bayesian perceptrons, and the Bayesian perceptron is the trained Bayesian perceptron described in the embodiment of the present application.
[0056] Step S230: Input the video clip of the traffic safety accident into the trained Karl Bayesian perceptron to obtain an attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0057] In an embodiment of the present application, the Bayesian perceptron is expanded to a neural network with multiple hidden layers to obtain a Kalman Bayesian neural network. The Kalman Bayesian neural network is a neural network composed of multiple hidden layers and multiple Bayesian perceptrons, and each block of the Kalman Bayesian neural network is a Bayesian perceptron.
[0058] The input data set contains multiple labeled video clip samples, which are input into the Kalman Bayesian neural network one by one in sequence for processing. In the Kalman Bayesian neural network, each labeled video clip sample is processed sequentially, rather than processing training data in batches like ordinary neural networks.
[0059] After obtaining the labeled video clip samples input one by one, the Kalman Bayesian neural network obtains the model parameters of the Kalman Bayesian neural network based on the Bayesian inference theory. Therefore, using multiple labeled video clip samples in the input data set to update the model parameters of the Kalman Bayesian neural network is essentially a Kalman filtering process, that is, using the existing video clip sample as an observation value to update the estimated value to modify the model parameters of the Kalman Bayesian neural network. In this way, the Kalman Bayesian neural network itself is combined with the Kalman filtering feature to predict and update the existing observation data. Compared with the existing neural network model, the Kalman Bayesian neural network does not need to consider parallel computing, all video clip samples only need to be processed once, and there is no need to use methods such as stochastic gradient descent to calculate the gradient, which greatly reduces the training and computing cost of the Kalman Bayesian neural network.
[0060] After the trained Kalman Bayesian neural network is obtained, the video clip of the traffic safety accident is input into the trained Kalman Bayesian perceptron to obtain the attribution result representing the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0061] In the above process, the attribution result is obtained based on the Kalman Bayesian neural network. Since the Kalman Bayesian neural network has more parameters, it has better fitting characteristics. Therefore, based on the trained Kalman Bayesian perceptron, a more accurate attribution analysis of traffic accidents can be achieved. Moreover, the attribution result includes the probability of the cause of the traffic safety accident and the corresponding confidence interval, so the attribution result obtained is more accurate and reliable. In addition, the Kalman Bayesian neural network is trained using video clip samples input one by one, and the model parameters of the Kalman Bayesian neural network are obtained based on the Bayesian inference theory. Therefore, the training of the Kalman Bayesian neural network is gradient-free and carried out in sequence, and does not require a gradient descent algorithm. The Kalman Bayesian neural network can learn data structures faster. Compared with the training method using gradient descent and batch processing, the embodiment of the present application does not require a large amount of data and computing resources to achieve training, and has better robustness.
[0062] In a specific embodiment, the model parameters of the Kalman Bayesian neural network are Obey Gaussian distribution: ,in, is the mean vector, is the covariance matrix; The forward propagation process of the Kalman Bayesian neural network corresponds to the third task, and the third task is: for a video clip sample carrying a label input into the Kalman Bayesian neural network , estimates the output of the Kalman Bayesian neural network y The probability density function of ,in, represents the input data set and obeys Gaussian distribution; The back propagation process of the Kalman Bayesian neural network corresponds to the fourth task, which is to estimate the probability density function Parameters and .
[0063] (1) The third task is to calculate the distribution of y based on any sample of video clips carrying labels. According to the Bayesian problem, assume that the output of the Kalman Bayesian neural network is y The probability density function of If it obeys Gaussian distribution, then y The probability density function of Can be converted into y The mean and variance of .
[0064] For the input layer of the Kalman Bayesian neural network, the output y The mean and variance Respectively with the Bayesian perception output y The mean and variance For the hidden layer of the Kalman Bayesian neural network, since the input of the hidden layer is the output of the input layer, the hidden layer The covariance of should correspond to the input layer The output variance of the hidden layer The covariance of is expressed as: , That is, the output variance of the input layer is set to the diagonal value of the covariance of the hidden layer, and the other values of the covariance are set to zero. Because each Bayesian perceptron is calculated separately, it can be assumed that there is no correlation between the hidden layers, and the diagonal values represent the uncertainty of the previous layer. After that, the hidden layer can also be calculated The mean and covariance .
[0065] It is understandable that when the output value of the input layer is passed to the hidden layer, the data range is completely different. For example, the input data is always scaled to the range of [-1 1], which is a common data preprocessing method in machine learning, especially for classification tasks. However, due to the nature of the sigmoid function and the Relu function, the output of the input layer must be positive, which will lead to incomplete learning results when passing parameters between layers. Therefore, the input of the hidden layer can be expressed as: , Among them, 0.5 is the bias parameter.
[0066] When there are multiple hidden layers, the output of each hidden layer is obtained in the same way as above. This forward pass is applicable to any final output dimension. When deploying this forward pass, you only need to determine the number of hidden neurons in each hidden layer.
[0067] (2) The fourth task is to update the model parameters of the Kalman Bayesian neural network based on the backward propagation of the training data. In the Kalman Bayesian neural network, each training data (a sample of a video clip carrying a label) is processed sequentially to obtain the parameters of the probability density function. and .
[0068] Specifically, the principle of backward propagation in the Kalman Bayesian neural network is different from that of the Bayesian perceptron. For the output layer, because the actual observed output is defined by the training data, so The update method of the posterior estimate of is: , , For the hidden layer, there is no real observation output, so it is necessary to calculate the hidden layer The posterior estimate of , or finding the approximate true output y for the hidden layer.
[0069] In the Kalman Bayesian neural network, the model parameters are updated based on the Bayesian inference theory instead of the widely used gradient descent method, so the error distribution rule can be used to calculate For the hidden layer, The posterior estimate of is calculated as: , in, For the output layer Back propagation of error.
[0070] Furthermore, It can be expressed as: , in, is the weight between the i-th neuron in the hidden layer and the j-th neuron in the output layer. Assume that the output is n-dimensional and there are m neurons in the hidden layer.
[0071] In this way, by inputting multiple labeled video clip samples in the input data set into the Kalman Bayesian neural network one by one in sequence, for each labeled video clip sample, the Kalman Bayesian neural network respectively executes the above-mentioned forward propagation process corresponding to the third task and the backward propagation process corresponding to the fourth task, and finally obtains the Gaussian distribution obeyed by the model parameters, that is, the trained Bayesian perceptron is obtained.
[0072] The present application also provides a device for attributing traffic accidents using Bayesian inference theory, referring to Figure 3 As shown, Figure 3 : is a schematic diagram of a structure of a device for attributing traffic safety accidents using Bayesian inference theory provided in an embodiment of the present application, the device comprising: A first input module 310 is used to input a plurality of video clip samples carrying labels in an input data set into a Bayesian perceptron in order one by one, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; A first training module 320 is used to obtain the model parameters of the Bayesian perceptron based on the Bayesian inference theory to obtain a trained Bayesian perceptron; The second input module 330 is used to input the video clip of the traffic safety accident into the trained Bayesian perceptron to obtain an attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0073] The present application also provides another device for attributing traffic accidents using Bayesian inference theory, referring to Figure 4 As shown, Figure 4 : is a schematic diagram of the structure of another device for attributing traffic safety accidents using Bayesian inference theory provided in an embodiment of the present application, the device comprising: A third input module 410 is used to input a plurality of video clip samples carrying labels in the input data set into the Kalman Bayesian neural network one by one in order, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; The second training module 420 is used to obtain the model parameters of the Kalman Bayesian neural network based on the Bayesian inference theory, and obtain the trained Kalman Bayesian neural network, wherein the Kalman Bayesian neural network has multiple hidden layers and multiple Bayesian perceptrons, and the Bayesian perceptron is the trained Bayesian perceptron described in the embodiment of the present application; The fourth input module 430 is used to input the video clip of the traffic safety accident into the trained Karl Bayesian perceptron to obtain an attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
[0074] The present application also provides an electronic device, referring to Figure 5 , Figure 5 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 includes: a memory 510 and a processor 520. The memory 510 and the processor 520 are connected via a bus communication. A computer program is stored in the memory 510. The computer program can be run on the processor 520 to implement the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the embodiment of the present application.
[0075] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the embodiment of the present application are implemented.
[0076] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in the embodiment of the present application.
[0077] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0078] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods and devices according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0079] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0080] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0081] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0082] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0083] The above is a detailed introduction to the method and device for attributing traffic safety accidents using Bayesian inference theory provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for attributing traffic accidents using Bayesian inference theory, characterized in that: include: Input multiple video clip samples with labels in the input data set into the Bayesian perceptron one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; Based on the Bayesian inference theory, the model parameters of the Bayesian perceptron are obtained, and the trained Bayesian perceptron is obtained; The video clip of the traffic safety accident is input into the trained Bayesian perceptron to obtain an attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
2. The method for attributing traffic accidents using Bayesian inference theory according to claim 1, characterized in that: The model parameters of the Bayesian perceptron Obey Gaussian distribution: ,in, is the mean vector, is the covariance matrix; The forward propagation process of the Bayesian perceptron corresponds to the first task, which is: for a video clip sample carrying a label input into the Bayesian perceptron , estimates the output of the Bayesian perceptron y The probability density function of ,in, represents the input data set and obeys Gaussian distribution; The back propagation process of the Bayesian perceptron corresponds to the second task, which is to estimate the probability density function Parameters and .
3. The method for attributing traffic accidents using Bayesian inference theory according to claim 2, characterized in that: Based on the Bayesian inference theory, the model parameters of the Bayesian perceptron are obtained, including: In the first to the second steps of the Bayesian perceptron, Sample video clips with labels In the case of , the corresponding model parameters are the prior distribution of the model parameters ,in, The weights of the Bayesian perceptron composition; The first Sample video clips with labels Input to the Bayesian perceptron, and estimate the posterior distribution of weights based on Bayesian inference theory .
4. The method for attributing traffic accidents using Bayesian inference theory according to claim 3 is characterized in that: Estimating the posterior distribution of weights based on Bayesian inference theory ,include: Compute the first conditional distribution , the first conditional distribution characterizes and The joint probability distribution of , where , represents the bias parameter; Based on Bayesian inference theory, estimate the second conditional distribution The second conditional distribution representation The probability distribution of According to the first conditional distribution and the second conditional distribution, the posterior distribution of the weight is estimated according to the following formula: ,in, represents the field of all real numbers.
5. The method for attributing traffic accidents using Bayesian inference theory according to claim 4 is characterized in that: Compute the first conditional distribution ,include: , in, , , the average vector and the covariance matrix According to the prior distribution Calculated, The mean , Variance .
6. The method for attributing traffic accidents using Bayesian inference theory according to claim 4 is characterized in that: Based on Bayesian inference theory, estimate the second conditional distribution ,include: , in, , , is the mean of the Kalman estimate , is the Kalman estimate variance ; is the Kalman gain, is the Kalman measurement, represents the mean of y, is the Kalman measure variance, .
7. A method for attributing traffic accidents using Bayesian inference theory, characterized in that: include: Inputting a plurality of video clip samples with labels in the input data set into the Kalman Bayesian neural network one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; Obtaining model parameters of a Kalman Bayesian neural network based on the Bayesian inference theory to obtain a trained Kalman Bayesian neural network, wherein the Kalman Bayesian neural network has multiple hidden layers and multiple Bayesian perceptrons, and the Bayesian perceptron is a trained Bayesian perceptron as described in any one of claims 1 to 6; The video clip of the traffic safety accident is input into the trained Ka Bayesian perceptron to obtain the attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
8. A device for attributing traffic accidents using Bayesian inference theory, characterized in that: include: A first input module is used to input a plurality of video clip samples carrying labels in an input data set into a Bayesian perceptron in order one by one, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; The first training module is used to obtain the model parameters of the Bayesian perceptron based on the Bayesian inference theory to obtain the trained Bayesian perceptron; The second input module is used to input the video clip of the traffic safety accident into the trained Bayesian perceptron to obtain the attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
9. A device for attributing traffic accidents using Bayesian inference theory, characterized in that: include: A third input module is used to input a plurality of video clip samples carrying labels in the input data set into the Kalman Bayesian neural network one by one in sequence, wherein the video clip samples are video clips where traffic safety accidents occur, and the labels are used to characterize the causes of traffic safety accidents in the video sample clips; A second training module is used to obtain model parameters of a Kalman Bayesian neural network based on the Bayesian inference theory to obtain a trained Kalman Bayesian neural network, wherein the Kalman Bayesian neural network has multiple hidden layers and multiple Bayesian perceptrons, and the Bayesian perceptron is a trained Bayesian perceptron as described in any one of claims 1 to 6; The fourth input module is used to input the video clip of the traffic safety accident into the trained Ka Bayesian perceptron to obtain the attribution result, which represents the probability of the cause of the traffic safety accident and the corresponding confidence interval.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in any one of claims 1 to 6, or the steps of the method for attributing traffic safety accidents using Bayesian inference theory as described in claim 7.
Citation Information
Patent Citations
Method for analyzing cause of highway traffic accident
CN109523786A
Emergency event prevention and control scheduling method and device, electronic equipment and storage medium
CN114662583A
Automatic overstocked material inventory method based on multivariate collaborative cause tracing
CN114881578A