Railway dispatching accident prediction method based on feature image
By converting railway accident records into feature images and using convolutional neural networks for prediction, the problem of great influence of human subjective factors in traditional methods is solved, and the accuracy and pertinence of accident classification prediction is improved.
Patent Information
- Application Number
- CN202411859033.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-29
AI Technical Summary
The traditional railway scheduling accident classification prediction method relies on artificially defining the probability and logical relationship of bottom events, resulting in a large difference between the prediction results and the actual situation.
By converting the text data recorded by railway accidents into feature images and using convolutional neural networks for classification prediction, the interference of human subjective factors is eliminated and the laws of events are explored.
It improves the accuracy of railway dispatch accident classification prediction, can intuitively present the characteristics of the bottom events that lead to accidents, and provides targeted probability analysis for accident prevention.
Smart Images

Figure CN119904675A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of railway dispatching accident classification prediction, and in particular relates to a railway dispatching accident prediction method based on feature images. Background Art
[0002] With the rapid development of my country's railways, safety issues in the railway industry have also received great attention. Traditional accident classification and prediction methods are generally based on the analysis of existing accident record databases, extracting the underlying events that lead to accidents and establishing Bayesian networks to predict accidents. However, when constructing Bayesian networks, the probability of occurrence of underlying events and the logical relationship between underlying events are mostly defined artificially, resulting in large differences between the prediction results and the actual situation.
[0003] In recent years, machine learning algorithms have regained attention with the upgrade of computer hardware. Due to their excellent performance in data feature extraction, they have been widely used in text mining, data prediction and other fields. Among them, neural network models represented by convolutional neural networks are relatively mature in the field of image recognition. Compared with text records, image data can carry more data information. For special texts such as accident records that are composed of basic elements such as time and basic events, their basic elements can be digitized, and the text can be converted into image data through specific conversion methods. The neural network model is used to learn the image data to discover the characteristic laws existing in it, so as to be applied to the field of accident classification and prediction. Summary of the invention
[0004] The purpose of the present invention is to provide a railway dispatching accident classification prediction method based on feature images, eliminate the interference of human subjective factors, and make full use of historical data records of railway accidents to explore and discover the laws of the underlying events that lead to accidents, so as to provide a new method for the existing railway dispatching accident classification prediction.
[0005] In order to achieve the above technical effects, the present invention provides a railway scheduling accident prediction method based on feature images, comprising:
[0006] S1: Build an accident event database;
[0007] S2: Based on the accident bottom event database of S1, construct the bottom event coordinate database corresponding to the accident;
[0008] S3: Count the average number of bottom events and the maximum time sequence of bottom events contained in the existing accident case texts, draw a grid base map, and fill the corresponding positions in the grid base map with the bottom event colors determined in S1 according to the bottom event coordinate library of the corresponding accident constructed in S2, so as to generate a feature image of the corresponding accident;
[0009] S4: Classify the feature images of S3, build a convolutional neural network accident classification prediction model, and train the model; after the training is completed, call the model to predict railway scheduling accidents.
[0010] Preferably, S1 is specifically:
[0011] The text records of railway dispatching accident cases are collected, the underlying events leading to the accidents and the time sequence of the underlying events are extracted, the underlying events are classified, and in specific categories, a single underlying event is assigned a specific color RGB value to distinguish different underlying events.
[0012] Preferably, S2 is specifically:
[0013] Different base event numbers are assigned to each type of base event in S1, and the numbers are the corresponding X-axis coordinates of the base events. Y-axis coordinates are assigned to each base event in the order of their occurrence time, and then a base event coordinate library corresponding to the accident is constructed.
[0014] Preferably, S3 includes:
[0015] S3.1: Count the average number of background events and the maximum time sequence of background events contained in the existing accident case texts, call the matplotlib library in Python to draw a grid background map, and fill the corresponding positions of the grid background map with the specific colors of the background events determined in S1 according to the background event coordinate library of the corresponding accident constructed in S2, that is, generate a feature image of the corresponding accident;
[0016] S3.2: Define the accident case as E i , the corresponding feature image is represented by the following matrix:
[0017]
[0018] Where m is the total number of accident cases; RGB i Indicates the specific color of the i-th bottom event;
[0019] S3.3: Define the accident type name set as L = {L j |j=1,2,...,N}, N is the total number of accident type names, then the data set used for training the convolutional neural network accident classification prediction model is expressed as:
[0020] T={[E1,L1],[E2,L3],...,[E i ,L j ]|i=1,2,...,mj=1,2,...,N};
[0021] S3.4: Assign the name of the corresponding accident as a label to generate a feature image of the corresponding accident.
[0022] Preferably, S4 includes:
[0023] S4.1: The feature images of S3.4 are used as the data set for building the convolutional neural network accident classification prediction model, and the data set is divided into training set, validation set and test set in a ratio of 3:1:1;
[0024] S4.2: Construct a convolutional neural network accident classification prediction model including an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer, and input the training set into the convolutional neural network accident classification prediction model for training;
[0025] S4.3: After the convolutional neural network accident classification prediction model is trained, the metrics module in the sklearn library is called, and the roc_curve and auc methods are used to calculate and draw the ROC curve. This method is used to test the performance of the model for the accuracy of classifying and predicting various types of accidents.
[0026] Preferably, in step 4.1, the feature images in the training set are subjected to data standardization, specifically, the matrix E corresponding to each channel of the image is normalized. i RGB i The element value is scaled from [0, 255] to [0.0, 1.0], and then the matrix element value is subtracted from the mean and divided by the standard deviation to obtain the standardized matrix data:
[0027]
[0028] In the formula, x s Represents the matrix element value after normalization, x r represents the value of the matrix element before processing, μ and σ represent the mean and standard deviation of the matrix elements respectively. The matrix data after standardization satisfies the normal distribution with a mean of 0 and a standard deviation of 1.
[0029] Preferably, the convolution kernel weights and the fully connected layer weights in the convolutional neural network accident classification prediction model are adjusted using a back propagation algorithm until the convolutional neural network model reaches a preset maximum number of selections to complete training. The process is expressed as follows:
[0030]
[0031] In the formula, represents the eigenvalue of the jth sample of the i-th type accident in the k-th layer of the convolutional neural network, ω k and b k They represent the weights and bias values in the k-th layer of the convolutional neural network. The calculation results of each layer of the network are passed to the next layer of the network through the ReLU activation function;
[0032] After training, the convolutional neural network accident classification prediction model is obtained.
[0033] Preferably, the output layer in S4.1 is a Softmax classifier, and the Softmax classifier is trained using the sample images in the training set and the accident name labels in the training sample images:
[0034]
[0035] Where x i Represents the feature values corresponding to each accident type in the last fully connected layer of the convolutional neural network model.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] 1. The method of the present invention proposes a railway dispatching accident classification prediction method based on feature images. By abstracting the accident record text into image data, the characteristics of the underlying events that led to the accident can be intuitively presented, while eliminating the interference of human subjective factors, thereby improving the accuracy of accident classification prediction;
[0038] 2. When individual bottom events occur, the method of the present invention can give the probability of various types of accidents, so as to achieve targeted prevention and early disposal of accidents. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0040] In the attached picture:
[0041] Figure 1 An overall flow chart of a railway dispatching accident classification prediction method based on feature images proposed in an embodiment of the present invention;
[0042] Figure 2 A schematic diagram of a characteristic image corresponding to the accident drawn in step 3;
[0043] Figure 3 A schematic diagram of the basic structure of a convolutional neural network provided by an embodiment of the present invention;
[0044] Figure 4 This is the ROC curve diagram of the model prediction effect. DETAILED DESCRIPTION
[0045] The following is combined with Figure 1 -Attached Figure 4 The preferred embodiments of the present invention are described. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0046] Example:
[0047] A railway dispatching accident prediction method based on feature images, comprising:
[0048] S1: Construct an accident event database; specifically:
[0049] The text records of railway dispatching accident cases are collected, the underlying events leading to the accidents and the time sequence of the underlying events are extracted, the underlying events are classified, and in specific categories, a single underlying event is assigned a specific color RGB value to distinguish different underlying events.
[0050] The bottom events are classified into four types: personnel, equipment, environment, and management. In a specific category, a single bottom event is assigned a specific color RGB value to distinguish different bottom events. The color RGB values corresponding to different types of bottom events are shown in Table 1, where RGB_num∈[0,255] and RGB_num∈N:
[0051] Table 1 Color RGB values corresponding to different types of bottom events
[0052]
[0053] S2: Based on the accident bottom event database of S1, construct the bottom event coordinate library of the corresponding accident; specifically: for each type of bottom event of S1, assign different bottom event numbers, for example: in personnel factors, personnel error is assigned number 1, personnel poor condition is assigned number 2, etc.; in equipment factors, equipment overheating is assigned number -1, equipment leakage is assigned number -2, etc., and similarly for other types, the number is the corresponding X-axis coordinate of the bottom event; for each bottom event, assign the Y-axis coordinate according to the chronological order of its occurrence, the larger the absolute value, the later the bottom event occurs, and then construct the bottom event coordinate library of the corresponding accident.
[0054] Table 2 Coordinate value ranges corresponding to different types of bottom events
[0055]
[0056] S3: Count the average number of base events and the maximum value of the time sequence of base events contained in the existing accident case texts, draw a grid base map, fill the corresponding positions in the grid base map with the base event colors determined in S1 according to the base event coordinate library of the corresponding accident constructed in S2, and generate a feature image of the corresponding accident; including:
[0057] S3.1: Count the average number of background events and the maximum time sequence of background events contained in the existing accident case texts, determine the size of the grid background map, use the matplotlib library in Python to draw the grid background map, and fill the corresponding positions in the grid background map with the specific colors of the background events determined in S1 according to the background event coordinate library of the corresponding accident constructed in S2, so as to generate a characteristic image of the corresponding accident; the accident characteristic image generated in the embodiment of the present invention is a three-dimensional RGB image with an image size of 192×192 pixels.
[0058] S3.2: Define the accident case as E i , the corresponding feature image is represented by the following matrix:
[0059]
[0060] Where m is the total number of accident cases; RGB i Indicates the specific color of the i-th bottom event;
[0061] S3.3: Define the accident type name set as L = {L j |j=1,2,...,N}, N is the total number of accident type names, then the data set used for training the convolutional neural network accident classification prediction model is expressed as:
[0062] T={[E1,L1],[E2,L3],...,[E i ,L j ]|i=1,2,...,mj=1,2,...,N};
[0063] S3.4: The name of the corresponding accident is assigned as a label to generate the feature image of the corresponding accident. The feature image is a png image named "case_NUM", where NUM is the number corresponding to the specific accident. The feature images corresponding to the same accident are stored in the same folder, which is named the name of the accident type.
[0064] S4: Classify the feature images of S3, build a convolutional neural network accident classification prediction model, and train the model; after the training is completed, call the model to predict railway scheduling accidents. Including:
[0065] S4.1: Use the feature images generated in S3.3 to construct a data set for the convolutional neural network accident classification prediction model, and divide the data set into a training set, a validation set, and a test set in a ratio of 3:1:1; and then train the convolutional neural network accident classification prediction model. The training set is used to train the model, the validation set is used to evaluate the model performance, adjust the model hyperparameters, and monitor whether the model is overfitting, and the test set is used to test the generalization ability of the evaluation model.
[0066] In order to eliminate the dimension effect, the feature images in the training set in step 4.1 are subjected to data standardization. Specifically, the matrix E corresponding to each channel of the image is i RGB i The element value is scaled from [0, 255] to [0.0, 1.0], and then the matrix element value is subtracted from the mean and divided by the standard deviation to obtain the standardized matrix data:
[0067]
[0068] In the formula, x s Represents the matrix element value after normalization, x r represents the value of the matrix element before processing, μ and σ represent the mean and standard deviation of the matrix elements respectively. The matrix data after standardization satisfies the normal distribution with a mean of 0 and a standard deviation of 1.
[0069] S4.2: If Figure 3 As shown in the figure, a convolutional neural network accident classification prediction model is constructed, which includes an input layer, two convolutional layers, two pooling layers, three fully connected layers and an output layer, and the training set is input into the convolutional neural network accident classification prediction model for training; the convolutional layer and the pooling layer are set at intervals, the output channel of the first convolutional layer is 32, the convolution kernel size is 3×3, the step size is 1, and there is no padding; the output channel of the second convolutional layer is 64, the convolution kernel size is 3×3, the step size is 1, and there is no padding; the pooling window size of the first and second pooling layers is 2×2, and the step size is 2.
[0070] In the accident classification prediction model of convolutional neural network, the main operation of the convolution layer is the convolution operation. A minimum batch file mini-batch is constructed from the training set by random sampling. The file contains batch_size image files. Batch_size is the set value. The minimum batch file is used as input, the convolution kernel (filter) is W, the bias is b, and the input image has C channels. The convolution layer performs convolution filtering on the image data entering the layer. The convolution operation calculates each channel separately and adds the results to generate batch_size neighborhood feature maps. The output Y(i,j) of the convolution layer is:
[0071]
[0072] Where C represents the Cth channel, W c is the weight of the convolution kernel on this channel, and X(i+m,j+n) represents the local area of the input image.
[0073] The result of the convolution operation is usually passed through an activation function to introduce nonlinearity. In the present invention, the ReLU (Rectified Linear Unit) function is used as the activation function between the convolution layer and the pooling layer and between the fully connected layer and the output layer. The expression of the ReLU activation function is as follows:
[0074] ReLU(x)=max(0,x)
[0075] The output of the convolutional layer Y(i,j) after the activation function is:
[0076] Z(i,j)=ReLU(Y(i,j))
[0077] The neighborhood feature map enters the pooling layer, and the pooling layer uses the maximum pooling technology to sample the neighborhood feature map to obtain a new feature map, which can be expressed as:
[0078]
[0079] The fully connected layer is a standard neural network layer in which each neuron is connected to all neurons in the previous layer. Assuming that the input of the fully connected layer is a vector X, the weight matrix is W, and the bias is b, the output Y is:
[0080] Y=WX+b
[0081] The output of the fully connected layer after the activation function is:
[0082] Z=f(Y)=f(WX+b)
[0083] When training CNN, the loss function is used to measure the gap between the model's predicted output and the true label. In this invention, the main task of CNN is classification, so the cross entropy loss is used as the loss function. Assume that there are N samples, each sample belongs to one of K categories, and the true label is y i , the predicted probability is The cross entropy loss function is expressed as:
[0084]
[0085] After calculating the loss function, the gradient of the loss function relative to the model parameters (such as convolution kernel weights and fully connected layer weights) is calculated through the back-propagation algorithm, and the parameters are updated through the gradient descent algorithm. The formula for gradient update is:
[0086]
[0087] Where θ is the model parameter (such as the weight and bias of the convolution kernel), η is the learning rate, is the gradient of the loss function with respect to the parameters.
[0088] In summary, the fully connected layer expands the new feature map entering it into a one-dimensional feature vector, and improves the model expression ability through the ReLU function, and enters the output layer as the training sample image feature. The convolutional neural network model can be expressed as:
[0089] Z=f(W FC ·f(pool(f(W conv *X+b conv )))+b FC )
[0090] Where X is the input data, W conv and b conv are the weights and biases of the convolutional layer, f is the activation function, * indicates the convolution operation, pool refers to the pooling operation, and W FC and b FC are the weights and biases of the fully connected layers.
[0091] S4.3: After the convolutional neural network accident classification prediction model is trained, the metrics module in the sklearn library is called, and the roc_curve and auc methods are used to calculate and draw the ROC curve. This method is used to test the performance of the model for the accuracy of classifying and predicting various types of accidents.
[0092] The back propagation algorithm is used to adjust the convolution kernel weights and the fully connected layer weights in the convolutional neural network accident classification prediction model until the convolutional neural network model reaches the preset maximum number of selections to complete the training. The process is expressed as:
[0093]
[0094] In the formula, represents the eigenvalue of the jth sample of the i-th type accident in the k-th layer of the convolutional neural network, ω k and b k They represent the weights and bias values in the k-th layer of the convolutional neural network. The calculation results of each layer of the network are passed to the next layer of the network through the ReLU activation function;
[0095] After training, the convolutional neural network accident classification prediction model is obtained.
[0096] The output layer is a Softmax classifier, which is trained using the sample images in the training set and the accident name labels in the training sample images:
[0097]
[0098] Where x i Represents the feature values corresponding to each accident type in the last fully connected layer of the convolutional neural network model.
[0099] Application examples:
[0100] Execute S1. The railway accident case text data used in this example comes from more than 1,300 railway accident records from a certain bureau from 2013 to 2023. The accident types can be divided into 7 types. The original data contains attributes such as the time of the accident, the location of the accident, and the detailed records of the accident process. All accident records are sorted out to sort out the various types of events that led to the accident, and at the same time, a specific color RGB is assigned.
[0101] Execute S2 to assign X-axis coordinates to the bottom events; sort out all accident records and assign Y-axis coordinates according to the order in which the bottom events occur, and obtain the bottom event coordinate library as shown in Table 3:
[0102] Table 3 Bottom event coordinate library
[0103]
[0104] Execute S3. According to the statistical results, the average number of bottom events in the existing accident records is 8, and the maximum time sequence of bottom events is 7. Therefore, the size of the grid bottom map is determined to be 14×14. The center point of the grid bottom map is used as the origin of the coordinate axis. Combined with the bottom event coordinate library in step 2, the corresponding position is filled with the bottom event color determined in step 1. The characteristic image drawn by taking a specific case record of a certain type of accident as an example is as follows Figure 2 shown.
[0105] Execute S4, repeat S3 to generate feature images corresponding to all accident records, and classify them according to accident types to form a convolutional neural network data set. Divide the data set into a training set, a validation set, and a test set in a ratio of 3:1:1 to train the convolutional neural network.
[0106] After the training is completed, the test is performed on various types of accident test sets, and the ROC curve is drawn as follows Figure 4 As shown in the figure, it can be seen that the ROC curves of the model prediction effect for all 7 accident types are above the baseline and are close to the upper left corner, indicating that the method proposed in the present invention performs well on the test set.
[0107] The above shows and describes the basic principles, main features and advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A railway dispatching accident prediction method based on feature images, characterized in that: include: S1: Build an accident event database; S2: Based on the accident bottom event database of S1, construct the bottom event coordinate database corresponding to the accident; S3: Count the average number of bottom events and the maximum time sequence of bottom events contained in the existing accident case texts, draw a grid base map, and fill the corresponding positions in the grid base map with the bottom event colors determined in S1 according to the bottom event coordinate library of the corresponding accident constructed in S2, so as to generate a feature image of the corresponding accident; S4: Classify the feature images of S3, build a convolutional neural network accident classification prediction model, and train the model; after the training is completed, call the model to predict railway scheduling accidents.
2. The method for predicting railway scheduling accidents based on feature images according to claim 2 is characterized in that: S1 is specifically: The text records of railway dispatching accident cases are collected, the underlying events leading to the accidents and the time sequence of the underlying events are extracted, the underlying events are classified, and in specific categories, a single underlying event is assigned a specific color RGB value to distinguish different underlying events.
3. The method for predicting railway scheduling accidents based on feature images according to claim 2 is characterized in that: S2 is specifically: Different base event numbers are assigned to each type of base event in S1, and the numbers are the corresponding X-axis coordinates of the base events. Y-axis coordinates are assigned to each base event in the order of their occurrence time, and then a base event coordinate library corresponding to the accident is constructed.
4. The method for predicting railway scheduling accidents based on feature images according to claim 3 is characterized in that: S3 includes: S3.1: Count the average number of background events and the maximum time sequence of background events contained in the existing accident case texts, call the matplotlib library in Python to draw a grid background map, and fill the corresponding positions of the grid background map with the specific colors of the background events determined in S1 according to the background event coordinate library of the corresponding accident constructed in S2, that is, generate a feature image of the corresponding accident; S3.2: Define the accident case as E i , the corresponding feature image is represented by the following matrix: Where m is the total number of accident cases; RGB i Indicates the specific color of the i-th bottom event; S3.3: Define the accident type name set as L = {L j |j=1,2,...,N}, N is the total number of accident type names, then the data set used for training the convolutional neural network accident classification prediction model is expressed as: T={[E1,L1],[E2,L3],...,[E i ,L j ]|i=1,2,...,m j=1,2,...,N}; S3.4: Assign the name of the corresponding accident as a label to generate a feature image of the corresponding accident.
5. The method for predicting railway scheduling accidents based on feature images according to claim 4 is characterized in that: S4 includes: S4.1: The feature images of S3.4 are used as the data set for building the convolutional neural network accident classification prediction model, and the data set is divided into training set, validation set and test set in a ratio of 3:1:1; S4.2: Construct a convolutional neural network accident classification prediction model including an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer, and input the training set into the convolutional neural network accident classification prediction model for training; S4.3: After the convolutional neural network accident classification prediction model is trained, the metrics module in the sklearn library is called, and the roc_curve and auc methods are used to calculate and draw the ROC curve. This method is used to test the performance of the model for the accuracy of classifying and predicting various types of accidents.
6. The method for predicting railway scheduling accidents based on feature images according to claim 5 is characterized in that: Step 4.1 The feature images in the training set are subjected to data standardization, specifically, the matrix E corresponding to each channel of the image is normalized. i RGB i The element value is scaled from [0, 255] to [0.0, 1.0], and then the matrix element value is subtracted from the mean and divided by the standard deviation to obtain the standardized matrix data: In the formula, x s Represents the matrix element value after normalization, x r represents the value of the matrix element before processing, μ and σ represent the mean and standard deviation of the matrix elements respectively. The matrix data after standardization satisfies the normal distribution with a mean of 0 and a standard deviation of 1.
7. The method for predicting railway scheduling accidents based on feature images according to claim 6 is characterized in that: The back propagation algorithm is used to adjust the convolution kernel weights and the fully connected layer weights in the convolutional neural network accident classification prediction model until the convolutional neural network model reaches the preset maximum number of selections to complete the training. The process is expressed as: In the formula, represents the eigenvalue of the jth sample of the i-th type accident in the k-th layer of the convolutional neural network, ω k and b k They represent the weights and bias values in the k-th layer of the convolutional neural network. The calculation results of each layer of the network are passed to the next layer of the network through the ReLU activation function; After training, the convolutional neural network accident classification prediction model is obtained.
8. The method for predicting railway scheduling accidents based on feature images according to claim 7 is characterized in that: The output layer in S4.1 is a Softmax classifier, which is trained using the sample images in the training set and the accident name labels in the training sample images: Where x i Represents the feature values corresponding to each accident type in the last fully connected layer of the convolutional neural network model.