A risk road section prediction method, system, computer device and storage medium
By employing semantic segmentation and ensemble learning techniques, and utilizing the XGBOOST algorithm and SHAP model, the pixel proportion of environmental elements in street view images is analyzed. This solves the problem of existing technologies not considering road environmental factors, and enables accurate prediction and safety assessment of road risk sections.
Patent Information
- Application Number
- CN202410150470.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2044-02-02
AI Technical Summary
Existing technologies do not consider the pixel proportion of road environmental elements in street view images when predicting road risk sections, resulting in poor prediction accuracy.
A semantic segmentation model is used to segment street view images to obtain the pixel ratio of different environmental elements. A risk road segment prediction model is constructed using the XGBOOST algorithm, which is then interpreted in conjunction with the SHAP model. Finally, risk road segment prediction is performed using ensemble learning techniques.
It improves the accuracy and stability of road risk section prediction, can quickly identify high-risk sections, and provides a theoretical basis to enhance transportation safety.
Smart Images

Figure CN118015829B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of road safety, in particular to a risk road section prediction method and system, computer equipment and a storage medium. BACKGROUND
[0002] With the acceleration of urbanization in the country, there are more and more problems in urban construction, and traffic problems, as a major problem that cannot be ignored in people's daily life, are also a challenge that must be addressed in the process of urban planning and construction. The traditional traffic accident response measures focus on the planning in the process of traffic system operation, the control when the accident occurs and the response after the accident, but the detailed means focusing on reducing traffic risk by assessing the risk of transportation routes and the collocation of environmental factors to indirectly reduce the probability of traffic accidents are relatively lacking. Therefore, it is of great significance to safety assessment of street view and road planning.
[0003] Due to the existence of various objects in the street view of the driver's field of vision, the workload and difficulty of manual checking and classification are huge, and the help of computers is needed for recognition and extraction. With the advent of the big data era, causal relationship models, machine learning models and deep learning models are being used for the analysis of traffic system empirical data, but the selected data set usually includes traditional traffic indicators such as traffic flow, vehicle speed and vehicle information, which cannot be well associated with the driver's perspective, and it is difficult to play a good explanatory role in street planning, and it is also difficult to realize the rapid extraction of risk road sections of transportation routes.
[0004] Traffic accident prediction has traditional statistical prediction methods and machine learning prediction methods, but the machine learning prediction method is currently the main method. Common statistical models include Poisson series models, negative binomial models and Logit regression models, and common machine learning prediction methods include artificial neural networks (ANN), unsupervised adversarial learning (GAN), etc. The result of traffic accident prediction is usually expressed as the probability of accident occurrence or the number of accidents, but as an explanatory variable, different researchers select different angles, generally including traffic accident data, road attribute data, road vehicle data, etc.
[0005] The data selected by the existing technology does not consider the proportion of environmental factors covered by the street view image, and cannot well explain whether other road information (such as green belts) has an impact on traffic risk, resulting in a high error in the accuracy of risk road section prediction. SUMMARY
[0006] In view of the fact that the pixel proportion of road environment factors is not considered in the prior art when predicting a risk road section, thereby resulting in poor prediction accuracy, the present application provides a risk road section prediction method, system, computer device and storage medium, wherein a semantic segmentation model is used to segment a street view image, the pixel proportion of different environmental elements in the street view image is obtained, the pixel proportion of different environmental elements is input into a risk road section prediction model, and the prediction probability of an accident in the street view image is calculated, thereby solving the problem that the pixel proportion of road environment factors is not considered in the prior art when predicting a risk road section, thereby resulting in poor prediction accuracy.
[0007] A risk road section prediction method, comprising the following steps:
[0008] Obtain street view image data of a to-be-detected area;
[0009] Build a semantic segmentation model based on a DeepLabV3+ neural network, input the street view image data of the to-be-detected area into the semantic segmentation model, and output a segmented image of the street view image data of the to-be-detected area;
[0010] Select a programming method to calculate the pixel proportion of different environmental elements in the segmented image;
[0011] Build a risk road section prediction model based on an XGBOOST algorithm, input the pixel proportion of different environmental elements into the risk road section prediction model, and output the prediction probability of an accident in the street view image of the to-be-detected area;
[0012] According to the prediction probability, predict a risk road section in the street view image of the to-be-detected area.
[0013] Further, after obtaining the street view image data of the to-be-detected area, the image data is densified at a unit of 10 m, and then a factor turning point conversion operation is performed.
[0014] Further, the backbone network of the semantic segmentation model adopts MobileNetV2 for extracting image features, and the semantic segmentation model adopts a hollow pyramid pooling module to capture multi-scale information at different sampling rates.
[0015] Further, the semantic segmentation model is trained, specifically comprising the following steps:
[0016] Select image data containing different environmental element types;
[0017] Input the image data containing different environmental element types into the semantic segmentation model, and train the semantic segmentation model by setting different training periods and training rounds.
[0018] Further, before inputting the pixel proportions of different environmental elements into the risk road section prediction model, the pixel proportions of the different environmental elements are classified by encoding, specifically including the following steps:
[0019] According to the proportion of different environmental elements in the street view image, the average value, standard deviation, maximum value and minimum value of the environmental index are calculated;
[0020] Discretize the environmental elements in the street view image according to the standards of equidistant segmentation, equal proportion and category number;
[0021] According to the maximum value and the minimum value, set appropriate coding intervals in ascending order to encode the pixel proportions of different environmental elements.
[0022] Further, the parameters of the risk road section prediction model are optimized, specifically including the following steps:
[0023] Train and test the XGBOOST model on randomly selected data according to the set proportion;
[0024] Search for the best parameters in the training process through K=5-fold cross-validation grid search method.
[0025] Further, the SHAP model is used to explain the prediction results of the risk road section prediction model.
[0026] Further, a risk road section prediction system, comprising:
[0027] An acquisition module for acquiring street view image data of a detection area;
[0028] A segmentation module for building a semantic segmentation model based on a DeepLabV3+ neural network, inputting the street view image data of the detection area into the semantic segmentation model, and outputting a segmented image of the detection area street view image data;
[0029] A pixel proportion calculation module for calculating the pixel proportions of different environmental elements in the segmented image by programming method;
[0030] A probability prediction module for constructing a risk road section prediction model based on XGBOOST algorithm, inputting the pixel proportions of different environmental elements into the risk road section prediction model, and outputting the prediction probability of accidents in the detection area street view image;
[0031] A prediction module for predicting the risk road section in the detection area street view image according to the prediction probability.
[0032] Furthermore, a risk road segment prediction computer device is characterized by comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the risk road segment prediction method.
[0033] Furthermore, a readable storage medium stores a computer program, the computer program including program instructions, which, when executed by a processor, are used to perform the steps of the risk segment prediction method.
[0034] This invention provides a method, system, computer device, and storage medium for predicting risky road sections, which has the following beneficial effects:
[0035] This invention segments street view images using a semantic segmentation model and obtains the pixel proportions of different environmental elements in the street view image based on the segmented images. A risk road segment prediction model is constructed based on the XGBOOST algorithm. The pixel proportions of different environmental elements are input into the risk road segment prediction model to calculate the predicted probability of an accident occurring in the street view image. This invention enhances the accuracy and stability of XGBOOST prediction by deeply analyzing the pixel proportions of different environmental elements in the street view image, accurately assessing the risks of local transportation routes, and analyzing the proportions of different environmental elements in the road segment, thus having broad application prospects. Attached Figure Description
[0036] Figure 1 This is a flowchart of a risk road segment prediction method according to an embodiment of the present invention;
[0037] Figure 2 This is a schematic diagram of accident-free road sections in the ArcMap road network in an embodiment of the present invention;
[0038] Figure 3 This is a conceptual diagram of the random forest model in an embodiment of the present invention;
[0039] Figure 4 This is a comparison chart of the overall evaluation results of different algorithms in the embodiments of the present invention;
[0040] Figure 5 This is a comparison chart showing the ranking of global feature importance SHAP values in embodiments of the present invention;
[0041] Figure 6 This is a graph showing the impact of the percentage of variables on the number of accidents in an embodiment of the present invention;
[0042] Figure 7 This is a schematic diagram showing the specific location of the transportation route in an embodiment of the present invention;
[0043] Figure 8 This is a driver's visual image in an embodiment of the present invention;
[0044] Figure 9 This is a street scene image near the intersection of Xiying Road and Leyou North Road in an embodiment of the present invention;
[0045] Figure 10 This is a street scene image near the South Gate 2 of the Shaanxi History Museum, as described in this embodiment of the invention.
[0046] Figure 11 This is a street scene image of the intersection of Xiaozhai West Road and Chang'an Middle Road in an embodiment of the present invention. Detailed Implementation
[0047] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0048] This invention proposes a method for predicting risky road sections, such as... Figure 1 As shown, this invention combines street view maps and machine learning technology to quickly and accurately identify high-risk sections in transportation routes, thereby improving the efficiency and accuracy of transportation safety assurance. By analyzing the pixel proportions of various objects in the driver's visual environment, the probability of accidents is assessed, providing a theoretical basis for the safe operation of transportation routes. Simultaneously, an XGBOOST-based classification model is used to predict the number of accidents on transportation routes, improving the accuracy and stability of the prediction. The method proposed in this invention is not limited to a specific region and can be extended to other regions and types of transportation networks to perform rapid risk assessment and risk segment extraction for transportation routes, providing targeted and strong support for urban transportation route planning and design, and the safety of travelers, especially drivers. Specifically, it includes the following steps:
[0049] Step A: Street view map and traffic accident data collection and processing.
[0050] Step A1: Download road network data from OSM (OpenStreetMap); using street view images of Xi'an City for analysis, download road network data for Lianhu District, Beilin District, and Xincheng District of Xi'an City from OSM (OpenStreetMap) and import it into ArcMap for processing.
[0051] Step A2: In ArcMap, use the coordinate system to calculate the latitude and longitude of the location point.
[0052] (1) Calculation of latitude and longitude using Baidu Maps coordinate system; The calculation of latitude and longitude using Baidu Maps coordinate system is mainly for extracting street view images of the road section where the accident occurred. The detailed steps are as follows: First, data on the severity of injuries (including fatalities) in road traffic accidents that occurred in Lianhu District, Beilin District, and Xincheng District of Xi'an City from 2019 to 2021 are collected from traffic police statistics. The recorded content mainly includes jurisdiction, road name, accident location, number of deaths, number of injuries, date and time of the accident, cause of the accident, and brief case details. Second, the research area is determined based on the "jurisdiction" information, and then the road where the accident occurred is located by combining the "road name" and "accident location". Finally, the detailed description of the accident process in the "brief case details" is combined with road information from major websites such as Baidu Maps (https: / / map.baidu.com / ), 360 Maps (https: / / map.so.com), and Gaode Maps (map.gaode.com) to match the road direction and landmark environmental features, and the specific accident point is located on the Baidu coordinate system, thereby reading the latitude and longitude coordinates of the accident point. Finally, two points were taken every 10 meters before and after each accident point, for a total of five consecutive points, and their latitude and longitude coordinates were obtained, thereby increasing the fault tolerance rate and enhancing comparability.
[0053] (2) ArcMap latitude and longitude calculation; The main purpose of calculating latitude and longitude in ArcMap is to extract street view images of accident-free road sections. First, based on data from 86 traffic accidents with fatalities between 2019 and 2021, 22 major urban arterial roads in the three study areas that were not mentioned in the traffic police accident descriptions such as "road name," "accident location," and "brief case details" were selected, as shown in Table 1:
[0054] Table 1. Major Accident-Free Roads in Lianhu, Beilin, and New Urban Districts, 2019-2021
[0055]
[0056] Secondly, using ArcGIS's ArcMap tool, 22 representative accident-free roads were extracted from the road network of the three study areas of Xi'an City downloaded from the OSM map in the early stage, such as... Figure 2 As shown in the diagram. Then, using the same method as for accident points, randomly selected segments of the 22 roads were densified in 10m units, ensuring that the route length between each location point was 10m. Next, through feature vertices, the accident-free points were discretized across the road networks of the three study areas. Finally, X and Y fields were added to the attribute table of the location points, and computational geometry was used to calculate the latitude and longitude coordinates of the location points, exporting the latitude and longitude coordinates of the accident-free location points as "document / invention" type for subsequent use.
[0057] Step A3: Access Street View Image via URL; First, apply for the panoramic static image service API on the Baidu Maps Open Platform. After obtaining permission, uniformly set the image size to 1024 pixels wide and 512 pixels high. Based on the obtained latitude and longitude coordinates of the accident point and the accident-free point, and according to the specific road conditions near the accident point and the accident-free point, set parameters such as horizontal viewing angle, vertical viewing angle, and horizontal direction. Send an HTTP request to access the Baidu Maps panoramic static image service, as shown in Table 2, to obtain the street view image directly in front of the driver's field of vision. Example: http: / / api.map.baidu.com / panorama / v2?ak=E4805d16520de693a3fe707cdc962045&width=512&height=256&location=116.313393,40.04778&fov=180;
[0058] Table 2 Panoramic Static Service Parameters
[0059]
[0060] Step A4: Batch extraction of street view data using Python; the ratio of accident-prone to accident-free data should be approximately 1:2. Based on the latitude and longitude coordinates of accident-prone points obtained from the Baidu coordinate system and the latitude and longitude coordinates of accident-free points exported from ArcMap, Python code is written to embed the Baidu Maps panoramic API, access street view images via URL, and implement batch extraction and storage using code.
[0061] Step B: Image segmentation and understanding model based on deep learning.
[0062] Step B1: Training dataset and label selection; Select the Cityscapes dataset, classify and merge the existing image labels in the original dataset, select the label types related to this invention (such as trees, roads, buildings, etc.), merge the remaining unrelated labels, and finally establish images with 20 types of label annotations in the dataset as the input for training the semantic segmentation model.
[0063] Step B2: Network selection and environment configuration.
[0064] (1) Selecting the basic neural network for semantic segmentation: The DeepLabV3+ neural network from the DeepLab series was selected as the deep learning model for semantic segmentation. Its backbone network adopts MobileNetV2 to extract image features and form high-level semantic information. ASPP (Diffuse Pyramid Pooling Module) is used to capture multi-scale information at different sampling rates.
[0065] (2) Configure the network training environment; Hardware requirements: GPU model: NVIDIA GeForce RTX 3050Ti Laptop GPU, CPU: AMD Ryzen 55600H with Radeon Graphics; Software requirements: Use Python 3.7, build the DeepLabV3+ neural network using the PyTorch deep learning platform (PyTorch version 1.12.0), configure the Torch training environment using Anaconda, CUDA version 11.6.
[0066] Step B3: Semantic Segmentation Model Training and Parameter Tuning; Adjust DeepLabV3+ neural network parameters, such as computer parameters, number of iterations, backbone network, etc. Import the labeled CityScapes dataset, set different training cycles and training epochs to obtain multiple models. Use the original dataset to validate the model's prediction accuracy. Based on the comparison of evaluation metrics such as Intersection over Union (IoU), Pixel Accuracy, and Mean Intersection over Union (mIoU), select the optimal number of training epochs (795 epochs) and the corresponding semantic segmentation model as the final model.
[0067] Step B4: Segment the Xi'an street scene and obtain the pixel ratio; Divide the Xi'an street scene images extracted in Step A into two categories: accident point images and accident-free images, import them into the trained semantic segmentation model, and output the predicted segmented images and the pixel ratio of each annotation.
[0068] Step C: Risk segment prediction model based on ensemble learning.
[0069] Step C1: Ensemble Model Selection; Ensemble learning algorithms can specifically analyze the degree and importance of the influence of different factors on accidents. Therefore, this invention uses a tree-based ensemble learning model to estimate the number of accidents, selecting three relatively mature algorithms: Random Forest, XGBOOST, and Light GBM. The conceptual diagram of the Random Forest model is shown below. Figure 3 As shown.
[0070] Step C2: Data analysis and coding; The pixel ratio of the road environment elements obtained in step B is a continuous variable with a value range of 0 to 100.
[0071] Therefore, it is encoded and classified to make it suitable for ensemble learning models. The steps are as follows:
[0072] First, the average, standard deviation, maximum, and minimum values of 20 indicators measuring the driver's visual environment, including the proportions of roads, trees, buildings, and sky, were calculated. These are shown in Table 3 below.
[0073] Table 3 Statistical Description of Data
[0074]
[0075] Driver visual environment factors are discretized based on the criteria of equidistant segmentation, balanced proportion, and appropriate number of categories.
[0076] This invention encodes data in ascending order and sets appropriate coding intervals based on the maximum and minimum values of descriptive statistics.
[0077] The dependent variable for accident data was set to the number of accidents as 1, and the dependent variable for no accident data was set to the number of accidents as 0. The coding results are shown in Table 4:
[0078] Table 4 Variable Encoding Table
[0079]
[0080]
[0081] Step C3: Model Evaluation and Comparison; First, the training and testing of the three models are based on the same dataset. The train_test_split function is used to randomly select 70% of the data for model training, and the remaining 30% of the data is used for testing and performance comparison.
[0082] Secondly, the accuracy (Acc), precision (Pre), recall (Rec), F1 score (F1-Score), and AUC (area under the ROC curve) of different models are compared, which is essentially calculated based on the confusion matrix.
[0083] The specific meanings of each evaluation indicator and the basis for the evaluation are shown in Table 5 below:
[0084] Table 5 Evaluation Indicators and Their Meanings and Basis
[0085]
[0086] The results are shown in Table 6 below:
[0087] Table 6 Evaluation results of different algorithms
[0088]
[0089] like Figure 4 The overall evaluation results for different algorithms are shown below.
[0090] The model built using the XGBOOST algorithm performed best across all metrics. Therefore, the XGBOOST algorithm was chosen to construct a risk road segment prediction model, and the classification performance of the model was optimized to explore the key influencing factors.
[0091] Step C4: XGBOOST Classification Model Parameter Tuning Instructions; During the XGBOOST model classification process, this invention aims to achieve high accuracy while also considering model complexity to prevent overfitting. A grid search method is used to traverse the given parameter combinations to optimize the model's performance. Different parameter value ranges are set according to their definitions. The XGBOOST model is trained and tested on randomly selected data at a set ratio. The optimal parameters are searched using a grid search method with K=5-fold cross-validation. The parameter ranges set and the obtained optimal parameters are shown in Table 7 below.
[0092] Table 7. Parameter descriptions and tuning results of the XGBoost model.
[0093]
[0094] Note: The values marked with * are the parameter values used during the second parameter tuning.
[0095] Step C5: Visualization analysis based on SHAP; the XGBOOST model is considered a black box model. This invention uses the SHAP model to interpret the classification results of the XGBOOST model, divided into global accident influencing factors and countermeasures analysis and single-factor accident influencing factors and countermeasures analysis.
[0096] (1) Analysis of global accident influencing factors and countermeasures
[0097] The factors influencing the accident were ranked according to the mean absolute SHAP value, and the characteristics were visualized.
[0098] A comprehensive analysis of accident-prone and accident-free road sections in Lianhu District, Xincheng District, and Beilin District, such as... Figure 5 As shown.
[0099] The importance of the features in the classification results, in descending order, is as follows: fence, road, car, background, sidewalk, pole, wall, terrain, vegetation, traffic light, sky, building, pedestrian, traffic sign, truck, bicycle, motorcycle, bus, cyclist and train.
[0100] Further analysis of accident-prone road sections in Lianhu District, Xincheng District, and Beilin District revealed that the higher the proportion of fences, walls, traffic lights, and traffic signs in the driver's visual environment, the less likely accidents are to occur. This provides a basis for road facility design, and traffic lights and signs on the road surface should be clearly and unambiguously placed. Conversely, the lower the proportion of terrain, sky, buildings, trucks, bicycles, and motorcycles in the driver's visual environment, the less likely accidents are to occur. Therefore, the design of buildings around the road should be simple and clear, and should not be too tall or dense.
[0101] (2) Analysis of accident influencing factors and countermeasures based on single factors.
[0102] Figure 6 As shown, the distribution of features such as cars, vegetation, roads, background, sidewalks, poles, pedestrians, buses, cyclists, and trains does not exhibit a regularity, so a single-factor analysis was performed. First, the three features contributing very little (the proportions of buses, cyclists, and trains) and the manually added category (background) for the sake of image segmentation completeness during semantic segmentation were excluded. Second, the impact of the proportions of roads, cars, sidewalks, poles, vegetation, and pedestrians on the number of accidents being 1 was analyzed.
[0103] 1) Road proportion: First promote, then inhibit, then promote again: In Figure 6 (a) shows the relationship between road percentage and SHAP value when the number of accidents is 1. For accident sections, when the road percentage feature code is 1 or 2, the SHAP value is above the 0 axis, indicating that when the road percentage is about 20-35%, accidents are more likely to occur. When the road percentage feature code is 4, the portion of the SHAP value above the 0 axis is more than the portion below the 0 axis, indicating that when the motor vehicle lane is wide enough, the proportion of pedestrians becomes relatively smaller, and drivers may have difficulty spotting pedestrians. In addition, in an overly open field of vision environment, drivers' attention is easily diverted, which may make accidents more likely to occur.
[0104] 2) Automobile Proportion: First Promote, Then Suppress: In Figure 6 (b) shows the relationship between the percentage of vehicles and the SHAP value when the number of accidents is 1. For accident-prone road sections, when the vehicle percentage feature code is 0 or 1, the SHAP value is generally above the 0 axis, indicating that a smaller vehicle percentage promotes accidents. However, when the vehicle percentage feature code is 2, 3, or 4, the SHAP value is generally below the 0 axis, indicating that a higher vehicle percentage helps prevent accidents. Overall, as the vehicle percentage gradually increases, its effect on road accidents shifts from promoting to inhibiting them.
[0105] 3) Sidewalk ratio: First promote, then inhibit: In Figure 6(c) shows the relationship between the sidewalk occupancy rate and the SHAP value when the accident count is 1. When the sidewalk occupancy rate feature code is 0, the SHAP value is generally above the 0 axis, indicating that when the sidewalk occupancy rate is very small, less than 1%, pedestrians are not easily observed by drivers, which can easily lead to accidents. Subsequently, when the sidewalk occupancy rate feature code is greater than 0, as the sidewalk occupancy rate continues to increase, the SHAP value is generally below the 0 axis, which has a positive effect on preventing accidents. Therefore, by properly designing the sidewalk width at road intersections, accidents can be prevented to a certain extent.
[0106] 4) Rod ratio: In Figure 6 (d) shows the relationship between pole percentage and SHAP value when the number of accidents is 1. For accident-prone road sections, when the road percentage feature code is 0 or 1, the SHAP value is above the 0 axis, indicating that when the pole percentage is small, accidents are more likely to occur; when the pole percentage is between 0.1% and 1%, it can have a certain inhibitory effect on accidents. When the pole percentage is large, the increased traffic complexity may promote the occurrence of accidents.
[0107] 5) Vegetation ratio: First suppress, then promote: Figure 6 (e) illustrates the impact of vegetation coverage on the number of accidents. The figure shows that for road sections with one accident, a lower vegetation coverage inhibits accidents, while a higher coverage (feature codes 4 and 5) results in positive SHAP values, indicating a higher likelihood of accidents. As the vegetation coverage in the driver's visual environment increases, it initially inhibits accidents, but then promotes them as the coverage continues to increase. Therefore, regular inspection and maintenance of roadside vegetation are necessary. This includes ensuring the vegetation's role in alleviating driver fatigue, regularly pruning and thinning branches to reduce obstruction and interference with the driver's view, and preventing overly dense foliage or branches perpendicular to the road that could cause accidents.
[0108] 6) Pedestrian ratio: in Figure 6 (f) shows the relationship between pedestrian percentage and SHAP value when the number of accidents is 1. When the pedestrian percentage feature code is 0, 1, or 4, the SHAP value is distributed both above and below the 0 axis, and the positive or negative impact on accident occurrence is unclear. When the pedestrian percentage feature code is 2, i.e., the pedestrian percentage is 0.2%–0.5%, it promotes the occurrence of accidents; when the pedestrian percentage feature code is 3, i.e., the pedestrian percentage is 0.5%–1%, it inhibits the occurrence of accidents. This influencing factor has certain particularities, and the reasons need to be further explored through experiments or other methods.
[0109] The unknown risk transportation route used in this embodiment of the invention is a transportation route that starts from the Yupinxuan Bakery, about 250m west of the intersection of Jixiang Road and the southern section of Hanguang Road, and follows the route of "Jixiang Road - Xiaozhai West Road - Xiaozhai East Road - Xiying Road" to the destination, the Jintaitang 618 Time Art Center, about 150m west of the intersection of Xiying Road and Xin'an Road, with a total length of about 10km.
[0110] First, download the road network data for Yanta District from the OSM map. Export the road network near the transportation route in Yanta District from the OSM map and open it in ArcGIS's ArcMap. Locate the transportation route using Baidu Maps. Next, use ArcMap to densify the transportation route in 100m increments, ensuring that the route length between each location point is 100m. Then, use feature vertices to convert points to achieve spatial representation of the location points on the road network. Figure 7 As shown. Add X and Y fields to the attribute table of the positioning point, calculate the latitude and longitude coordinates of the positioning point using computational geometry, then delete the redundant field information in the attribute table, and export the latitude and longitude coordinates of the positioning point as a "document / invention" type.
[0111] Finally, using a fully adjustable panoramic static image service API, the image size was uniformly set to 1024 pixels wide and 512 pixels high. Based on the obtained latitude and longitude coordinates of the positioning points and the road conditions near the transportation route, parameters such as horizontal viewing angle, vertical viewing angle, and horizontal direction were adjusted to locate the driver's perspective. An HTTP request was sent to access the Baidu Maps panoramic static image service, and Python code was used to batch extract street view images of the positioning points, thereby obtaining the street view image directly in front of the driver's field of vision as the driver's visual environment image. In the end, 101 street view images were actually collected as driver visual data.
[0112] First, the trained DeepLabv3+ semantic segmentation model (database is the aforementioned Cityscapes, 20-class label, 745 training rounds) was used to perform semantic segmentation on 101 images of transportation route location points. The segmentation results are as follows: Figure 8 As shown.
[0113] A programming method was chosen to calculate the pixel proportion of different environmental elements. This method was used to accurately identify various colors in the image and their corresponding color codes, and to calculate the sum of all pixels of each color in the image. Some calculation results are shown in Table 8 below.
[0114] Table 8. Calculation results of pixel ratios for environmental elements (excerpt)
[0115]
[0116]
[0117] Identifying high-risk road sections along transportation routes is a binary classification problem, classifying routes based on the likelihood of accidents occurring within each 100m unit length. Analysis shows that this task involves numerous features, all of which are pixel proportions of road environmental elements, continuous variables ranging from 0 to 100. Machine learning models cannot recognize this type of data. Therefore, appropriate encoding processing is required for these feature values.
[0118] The specific steps are as follows:
[0119] First, the average, standard deviation, maximum, and minimum values of 20 indicators measuring the driver's visual environment, including the proportions of roads, trees, buildings, and sky, were calculated.
[0120] Secondly, the driver's visual environment factors were discretized using the criteria of equidistant segmentation, moderate number of categories, and balanced proportion, and coded within the same coding intervals as in Table 4. The coding results for each factor are shown in Table 9 below:
[0121] Table 9 Variable Coding Table
[0122]
[0123]
[0124] To predict the number of accidents in the dependent variable Y, the XGBOOST model, which performed best in the model evaluation, was first selected. The parameters were set according to the optimal parameters obtained by traversing the given parameter combinations using the grid search method (GridSearchCV) as shown in Table 7. The XGBOOST model, which was saved after parameter tuning, was then used to predict the risk of accidents occurring on each section of the transportation route.
[0125] Secondly, using the pixel ratio encoding results of 20 environmental variables from 101 street view images of transportation route location points as independent variables, the probability of an accident occurring in each street view image is predicted using the XGBOOST risk section prediction model.
[0126] Then, it is stipulated that when the model predicts that the probability of an accident at a certain location point is greater than 0.5, the location point is considered to be prone to accidents, and therefore the predicted dependent variable, i.e., the number of accidents, is 1; when the model predicts that the probability of an accident at a certain location point is less than 0.5, the location point is considered to be not prone to accidents, and therefore the predicted dependent variable, i.e., the number of accidents, is 0.
[0127] Based on the model predictions, along a transportation route approximately 10km long, 19 out of 101 location points had a predicted accident count of 1 in their street view images, while 82 locations had a predicted accident count of 0. Of the 19 locations with a predicted accident count of 1, there were four instances where two locations had consecutive predicted accident counts of 1, while the rest were distributed intermittently along the transportation route.
[0128] The risky road segment is defined as follows: 50m before and after the location point in the transportation route where the dependent variable (accident number) is predicted to be 1 by the XGBOOST model is extracted along the route direction and designated as the risky road segment of the transportation route. The risky road segment of the transportation route is visualized using ArcMap.
[0129] The marked line segments indicate the risk sections of this transportation route. These risk sections total 1.9 km, approximately 19% of the entire route. There are four consecutive risk sections: near the administrative campus of Xi'an Jiaotong University Continuing Education College on Xiaozhai West Road, at the intersection of Xiaozhai Road and Chang'an Middle Road, at the intersection of Xiaozhai East Road and Yanta North Road, and near the Yanxiang Gas Station on Xiying Road.
[0130] The pixel proportions of various environmental variables in the street view images of the 19 risk road sections were analyzed by using the prediction of the ensemble learning model, as shown in Table 10.
[0131] Table 10 Classification of Risk Sections
[0132]
[0133] This invention selects some typical high-risk road sections as examples to analyze the safety factors of transportation routes, and provides warnings and safety suggestions for drivers when driving on these high-risk road sections.
[0134] like Figure 9 As shown, the risky section is located near the intersection of Xiying Road and Leyou North Road. (1) Pedestrians frequently cross and mix in this section, and there are no sidewalks. When driving to this section, drivers should slow down and pay attention to the movement of pedestrians around them. (2) At the same time, the roadside buildings and vegetation occupy a large proportion of the driver's visual environment, and the driver's vision is easily blocked. The motor vehicle lane is narrow and the field of vision is not wide enough. Drivers should be more vigilant and concentrate on driving.
[0135] like Figure 10As shown, the high-risk section is located on Xiaozhai East Road, near the South Gate 2 of the Shaanxi History Museum. The road is covered with vegetation on both sides, especially on the left side where the vegetation is too dense, blocking some of the light in the driver's visual environment, resulting in a relatively dark driving environment and obstructing and interfering with the driver's vision. In this high-risk section, (1) attention should be paid to parked vehicles on the side of the road; (2) the vegetation on both sides of the road should be regularly inspected and maintained to ensure that the greening plays a role in relieving driver visual fatigue, and to regularly prune and thin branches to reduce the occurrence of accidents; (3) there is a central divider on the left side, and attention should be paid to vehicles making U-turns and pedestrians crossing.
[0136] like Figure 11 As shown, the risky section is located at the intersection of Xiaozhai West Road and Chang'an Middle Road, near the SEG International Shopping Center. (1) The traffic volume is high near the intersection, so drivers should pay attention to vehicles in front and around. (2) There are tall buildings and pedestrian overpasses in front, making the driver's visual environment very complex and causing visual impact and pressure. Since the area around the intersection is a continuous 200m risky section, drivers should be vigilant from the time they enter the intersection until they exit it to prevent traffic accidents.
[0137] Based on an inventive concept, this invention proposes a risk road segment prediction system, comprising:
[0138] The acquisition module is used to acquire street view image data of the area to be detected.
[0139] The segmentation module is used to build a semantic segmentation model based on DeepLabV3+ neural network. It inputs the street view image data of the area to be detected into the semantic segmentation model and outputs a segmented image of the street view image data of the detected area.
[0140] The pixel ratio calculation module is used to select a programming method to calculate the pixel ratio of different environmental elements in the segmented image.
[0141] The probability prediction module is used to build a risk road segment prediction model based on the XGBOOST algorithm. It inputs the pixel ratio of different environmental elements into the risk road segment prediction model and outputs the predicted probability of an accident occurring in the street view image of the detection area.
[0142] The prediction module is used to predict risky road sections in the street view image of the area to be detected based on the prediction probability.
[0143] Based on the same inventive concept, this invention also proposes a risk road segment prediction computer device, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the risk road segment prediction method.
[0144] Based on the same inventive concept, the present invention also proposes a readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, are used to perform steps of the risk road segment prediction method.
[0145] This invention employs deep learning and ensemble learning techniques based on street view maps. Through semantic segmentation of the driver's visual environment and classification and encoding of accident feature variables, it uses a tree-based ensemble model to estimate the number of accidents. Furthermore, it constructs a risk segment prediction model based on XGBOOST and an interpretability analysis method based on SHAP, enabling rapid extraction of risk segments and understanding of environmental elements along transportation routes. In addition, this invention utilizes multiple conditions, such as oncoming and outgoing traffic directions and the left and right sides of the median strip, to accurately identify roads in the image where accidents may occur, providing drivers with more comprehensive and accurate traffic safety information.
[0146] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for predicting risky road sections, characterized in that, Includes the following steps: Acquire street view image data of the area to be detected; A semantic segmentation model is built based on DeepLabV3+ neural network. The street view image data of the area to be detected is input into the semantic segmentation model, and the segmented image of the street view image data of the detected area is output. A programming method was selected to calculate the pixel ratio of different environmental elements in the segmented image; A risk road segment prediction model is constructed based on the XGBOOST algorithm. The pixel ratio of different environmental elements is input into the risk road segment prediction model, and the predicted probability of an accident occurring in the street view image of the detection area is output. Risky road sections in the street view image of the area to be detected are predicted based on the predicted probability.
2. The risk road segment prediction method according to claim 1, characterized in that, After acquiring the street view image data of the area to be detected, the image data is densified in units of 10m, and then the turning point operation is performed through the element turning point.
3. The risk road segment prediction method according to claim 1, characterized in that, The backbone network of the semantic segmentation model uses MobileNetV2 to extract image features; the semantic segmentation model uses a hollow pyramid pooling module to capture multi-scale information at different sampling rates.
4. The risk road segment prediction method according to claim 1, characterized in that, It also includes training the semantic segmentation model, specifically including the following steps: Select image data containing different types of environmental elements; Image data containing different environmental elements are input into the semantic segmentation model, and the semantic segmentation model is trained by setting different training periods and training rounds.
5. The method for predicting risky road sections according to claim 1, characterized in that, Before inputting the pixel proportions of different environmental elements into the risk road segment prediction model, the pixel proportions of the different environmental elements are encoded and classified, specifically including the following steps: The average, standard deviation, maximum, and minimum values of environmental indicators are calculated based on the proportion of different environmental elements in the street view image. The environmental elements in the street view image are discretized according to the criteria of equidistant segmentation, balanced proportion, and number of categories. The pixel ratios of different environmental elements are encoded in ascending order, based on the maximum and minimum values, with appropriate encoding ranges set accordingly.
6. The method for predicting risky road sections according to claim 1, characterized in that, It also includes optimizing the parameters of the risk road segment prediction model, which specifically includes the following steps: The XGBOOST model was trained and tested on data randomly selected according to a set ratio. The optimal parameters during training are searched using a grid search method with K=5 fold cross-validation.
7. The method for predicting risky road sections according to claim 1, characterized in that, The SHA P model is used to interpret the prediction results of the risk road segment prediction model.
8. A risk road segment prediction system, characterized in that, include: The acquisition module is used to acquire street view image data of the area to be detected; The segmentation module is used to build a semantic segmentation model based on DeepLabV3+ neural network. It inputs the street view image data of the area to be detected into the semantic segmentation model and outputs a segmented image of the street view image data of the detected area. The pixel ratio calculation module is used to select a programming method to calculate the pixel ratio of different environmental elements in the segmented image; The probability prediction module is used to build a risk road segment prediction model based on the XGBOOST algorithm. It inputs the pixel ratio of different environmental elements into the risk road segment prediction model and outputs the predicted probability of an accident occurring in the street view image of the detection area. The prediction module is used to predict risky road sections in the street view image of the area to be detected based on the prediction probability.
9. A computer device for predicting risky road sections, characterized in that, include: A memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the risk road segment prediction method according to any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program, which includes program instructions that, when executed by a processor, perform the steps of the risk road segment prediction method according to any one of claims 1-7.
Citation Information
Patent Citations
Road traffic accident quantity prediction method based on road condition factor regression analysis
CN111784017A
Method and device for automatically identifying and classifying satellite navigation positioning scene
CN117288215A