A truck traffic safety hidden danger point identification method, device, equipment and medium
By using prior rules based on expert experience and typical accident scenarios, and adjusting historical data, combined with a random forest model, the problems of lag and insufficient accuracy in identifying potential safety hazards in truck traffic have been solved, achieving efficient and accurate hazard identification.
Patent Information
- Application Number
- CN202511592188.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-03
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-11-03
AI Technical Summary
Existing technologies for identifying potential traffic safety hazards in trucks suffer from significant delays, limited coverage, and large subjective biases. Furthermore, existing models do not fully explore and utilize multi-source heterogeneous data from trucks, resulting in insufficient identification accuracy and precision.
Prior features are selected based on expert experience and typical accident scenarios. Prior rules are preset to screen road sections. The hazard rating level is adjusted by combining historical accident data. A random forest model is used to input prior features and truck traffic safety assessment features for prediction, thereby improving the efficiency and accuracy of identification.
By combining prior rules and historical data, false alarms are reduced, recognition accuracy is improved, and precise location of potential traffic safety hazards for trucks is achieved.
Smart Images

Figure CN121051612B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of road traffic safety evaluation, in particular to a truck traffic safety hidden danger point identification method, device, equipment and medium. BACKGROUND
[0002] Road traffic safety is an important guarantee for social and economic development, and truck vehicles (hereinafter referred to as "trucks") as the main force of highway transportation, their safe operation is particularly critical. Due to the characteristics of large load, strong inertia, long driving time, etc., the accident risk of trucks is significantly higher than that of ordinary vehicles. Therefore, it is particularly important for traffic safety to identify the road sections where traffic accidents of trucks are prone to occur.
[0003] The traditional hidden danger identification method mainly relies on historical accident statistics and manual inspection, and has problems such as strong lag, limited coverage, and large subjective bias. With the rapid development of artificial intelligence technology, especially the breakthrough in the field of deep learning, the use of neural network and other machine learning models for automatic identification of traffic safety hidden dangers has become a research hotspot and an important direction of practical application. At present, the identification of traffic safety hidden danger points by model usually uses existing data to train the model, and the trained model identifies new road sections. However, the accuracy and precision of the identification are highly dependent on the selection of data sources and features, and the existing model has insufficient feature coverage, and the multi-source heterogeneous data of the truck itself is not fully mined and utilized to improve the accuracy of risk identification. Moreover, the existing model uniformly extracts and identifies the features of the road section data, but the importance of each feature to the identification of truck traffic safety hidden danger points is different. If the extremely important features are treated equally with ordinary features, it is easy to misjudge during identification. SUMMARY
[0004] The purpose of the present application is to provide a truck traffic safety hidden danger point identification method, device, equipment and medium with high efficiency and high accuracy.
[0005] In order to achieve the above purpose, the present application provides a truck traffic safety hidden danger point identification method, comprising:
[0006] Based on expert experience evaluation and typical accident scene induction, prior features are selected and prior rules are preset, the prior rules are that when a specific prior feature combination is met, a corresponding hidden danger score level is given;
[0007] Obtain the prior features of all road sections in the target area;
[0008] If the prior features of the road section are given a hidden danger score level according to the prior rules, the road section is included in the preliminary screening list, otherwise it is included in the to-be-identified road section;
[0009] acquire historical accident data of each road section in the preliminary screening list, and predict the accident occurrence probability of each road section according to the historical accident data;
[0010] adjust the hidden danger score level of each road section in the preliminary screening list according to the accident occurrence probability, wherein the road section with a lower hidden danger score level and a lower accident occurrence probability based on the prior rule is removed from the preliminary screening list and classified as a to-be-identified road section to form a new preliminary screening list; and the hidden danger score level of all road sections in the new preliminary screening list is outputted;
[0011] acquire truck traffic safety evaluation features of the to-be-identified road section;
[0012] input the prior features and the truck traffic safety evaluation features of the to-be-identified road section into a trained random forest model for prediction, and output the hidden danger score level of each to-be-identified road section.
[0013] The application further provides a truck traffic safety hidden danger point identification device, comprising:
[0014] a preset module configured to select prior features and preset prior rules based on expert experience assessment and typical accident scene induction, wherein the prior rule is to give a corresponding hidden danger score level when a specific prior feature combination is met;
[0015] a prior feature acquisition module configured to acquire prior features of all road sections in a target area;
[0016] a preliminary screening module configured to classify a road section into a preliminary screening list if the prior features of the road section are given a hidden danger score level according to the prior rules, or classify all road sections into to-be-identified road sections;
[0017] a history module configured to acquire historical accident data of each road section in the preliminary screening list, and predict the accident occurrence probability of each road section according to the historical accident data;
[0018] an adjustment module configured to adjust the hidden danger score level of each road section in the preliminary screening list according to the accident occurrence probability, wherein the road section with a lower hidden danger score level and a lower accident occurrence probability based on the prior rule is removed from the preliminary screening list and classified as a to-be-identified road section to form a new preliminary screening list; and the hidden danger score level of all road sections in the new preliminary screening list is outputted;
[0019] a truck traffic safety evaluation feature acquisition module configured to acquire truck traffic safety evaluation features of the to-be-identified road section;
[0020] a prediction module configured to input the prior features and the truck traffic safety evaluation features of the to-be-identified road section into a trained random forest model for prediction, and output the hidden danger score level of each to-be-identified road section.
[0021] The application also provides an electronic device, comprising a memory for storing a computer program, and a processor for implementing the steps of the truck traffic safety hidden danger point identification method when executing the computer program.
[0022] The application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the truck traffic safety hidden danger point identification method when executed by a processor.
[0023] Compared with the prior art, the application has the following beneficial effects:
[0024] The application selects prior features and presets prior rules based on expert experience evaluation and typical accident scene induction, judges the prior features of the road section based on the prior rules, gives corresponding hidden danger score levels to the road sections meeting specific prior feature combinations and classifies them into the preliminary screening list, then acquires the historical data of the road sections in the preliminary screening list, predicts the accident occurrence probability according to the historical data, adjusts the hidden danger score levels of the road sections and whether to remove them from the preliminary screening list according to the accident occurrence probability, and outputs the hidden danger score levels of all road sections in the new preliminary screening list; for the road sections not in the new preliminary screening list, the truck traffic safety evaluation features are acquired, and the prior features and the truck traffic safety evaluation features are input into the random forest model for prediction. Prior is performed before inputting the random forest model, the prior features are selected based on expert experience evaluation and typical accident scene, and only the prior features are acquired, which can greatly improve the identification efficiency, the prior rules directly give corresponding hidden danger score levels according to the prior feature combinations, which can prevent misjudgment of the random forest model and improve the identification accuracy and accuracy. After giving the hidden danger score levels according to the prior rules, the application adjusts according to the prediction of the historical data, which can reduce false positives and improve the objectivity and robustness of the prior system. In addition, the prior features and the truck traffic safety evaluation features of the application cover road structure features, traffic operation features, vehicle behavior features, accident statistics features, visual perception features and environmental features, etc., and the random forest model is used for quantitative analysis of multi-dimensional features, comprehensive analysis and accurate positioning. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 is a flowchart of the truck traffic safety hidden danger point identification method of the embodiment of the application.
[0026] Figure 2 is a schematic diagram of random forest model training of the identification and scoring method of the embodiment of the application.
[0027] Figure 3 is a random forest model classification confusion matrix of the identification and scoring method of the embodiment of the application.
[0028] Figure 4is a principle block diagram of a truck traffic safety hidden danger point identification device of an embodiment of the present application.
[0029] In the figure, 100 - preset module; 200 - prior feature acquisition module; 300 - preliminary screening module; 400 - history module; 500 - adjustment module; 600 - truck traffic safety evaluation feature acquisition module; 700 - prediction module. DETAILED DESCRIPTION
[0030] The specific embodiments of the present application are described in further detail below in combination with the accompanying drawings and examples. The following examples are used to illustrate the present application, but are not used to limit the scope of the present application.
[0031] Example One
[0032] As shown in the figure, a truck traffic safety hidden danger point identification method of a preferred embodiment of the present application comprises: Figures 1 to 3
[0033] S1, selecting prior features and presetting prior rules based on expert experience evaluation and typical accident scene induction, wherein the prior rules are to give corresponding hidden danger score levels when specific prior feature combinations are met;
[0034] S2, acquiring prior features of all road segments in a target area;
[0035] S3, if the prior features of a road segment are given hidden danger score levels according to the prior rules, then the road segment is included in a preliminary screening list, otherwise all are included in to-be-identified road segments;
[0036] S4, acquiring historical accident data of each road segment in the preliminary screening list, and predicting accident occurrence probabilities of each road segment according to the historical accident data;
[0037] S5, adjusting hidden danger score levels of each road segment in the preliminary screening list according to the accident occurrence probabilities, wherein road segments with lower hidden danger score levels and lower accident occurrence probabilities based on prior rules are removed from the preliminary screening list and included in to-be-identified road segments to form a new preliminary screening list; outputting hidden danger score levels of all road segments in the new preliminary screening list;
[0038] S6, acquiring truck traffic safety evaluation features of the to-be-identified road segments;
[0039] S7, inputting the prior features and the truck traffic safety evaluation features of the to-be-identified road segments into a trained random forest model for prediction, and outputting hidden danger score levels of each to-be-identified road segment.
[0040] This embodiment selects prior features and presets prior rules based on expert experience assessment and typical accident scenario summarization. Based on these rules, it judges the prior features of road segments, assigns corresponding hazard ratings to road segments that meet specific combinations of prior features, and includes them in a preliminary screening list. Then, it acquires historical data for road segments in the preliminary screening list, predicts the probability of accidents based on this data, and adjusts the hazard ratings of road segments and determines whether to remove them from the preliminary screening list based on the accident probability. The resulting new preliminary screening list outputs the hazard ratings for all road segments. For road segments not in the new list, it acquires truck traffic safety assessment features and inputs them along with the prior features into a random forest model for prediction. Prior assessment is performed before inputting into the random forest model. The prior features are selected based on expert experience assessment and typical accident scenarios, and the prior rules directly assign corresponding hazard ratings based on combinations of prior features, preventing misjudgments by the random forest model and improving recognition accuracy. This invention further adjusts the hazard ratings based on historical data predictions after assigning them according to the prior rules, reducing false alarms and improving the objectivity and robustness of the prior system.
[0041] In the prior stage, only the prior features of all road segments within the target area need to be obtained. When inputting into the trained random forest model, only the prior features of the road segments to be identified and the truck traffic safety assessment features need to be input, which can greatly reduce the amount of data processing in the prior stage and the random forest model prediction stage, and improve efficiency.
[0042] In step S1, the prior rules mainly come from the following two types of information:
[0043] (1) Expert assessment: Based on on-site surveys and road attribute analysis, experts in transportation, road planning, and safety supervision identify road features with significant risks. In this embodiment, experts identify a batch of road segment types with significant structural risks (such as low-grade roads crossing heavy freight transport areas).
[0044] (2) Typical accident scenario summary: Extract common road characteristics from serious traffic accidents and obtain the severity of traffic accidents. In this embodiment, high-risk combinations are summarized from typical accident scenarios, such as "rural road + logistics park", "branch road + wholesale market", "village road + industrial zone", etc.
[0045] In the priori rule setting, when the priori characteristics of a road section meet the relevant types, a certain hidden danger score level is given, and when they do not meet, no hidden danger score level is given. Based on expert experience and typical scene induction, the priori characteristics are selected. The priori characteristics of this embodiment are "road grade" and "POI (Point of Interest) type". And the priori rule is set as when a road section meets a certain road grade and POI type combination, the corresponding hidden danger score level is given to the road section. The priori characteristics and priori rule of this embodiment are shown in Table 1.
[0046] Table 1 Road grade-POI type-priori score level mapping table
[0047]
[0048] When a road section meets a certain road grade and POI combination (such as "country road + logistics park" and "expressway + port"), it is marked by the system as a high-risk hidden danger point with a score level of 4 or 5, and enters the preliminary screening list.
[0049] In this embodiment, the priori rule is used to pre-judge and score part of the high-risk road sections before model reasoning, so as to improve the overall recognition efficiency and high-risk interception ability of the scoring system.
[0050] In step S4, the historical accident data of each road section in the preliminary screening list is obtained, and the accident occurrence probability of each road section is predicted according to the historical accident data, including: obtaining the historical accident data of each road section in the preliminary screening list; predicting the accident occurrence probability of each road section according to the historical accident data through a gamma Poisson distribution model.
[0051] In this embodiment, the historical accident data of each road section includes the historical accident number of each road section and the exposure (road number or total length), and the following statistical assumptions are made:
[0052]
[0053] Among them, the traffic accident is a rare event in unit time or space, and approximately independent occurs under fixed road combination, which meets the mean ≈ variance characteristics of Poisson process.
[0054] Considering that the average accident rate of different road grade and functional area combinations has systematic differences, these differences are all non-negative values, and the distribution form may be skewed or fat-tailed, the Gamma distribution can flexibly describe this continuous distribution of positive values, so the accident rate obeys Gamma distribution between combinations:
[0055]
[0056] The posterior distribution is
[0057]
[0058] Take the 95% quantile as the robust upper bound of accident rate:
[0059]
[0060] where, , is a hyper-parameter, which is obtained by the Method of Moments from historical accident data.
[0061] According to the quantile ranking of the robust upper bound of accident rate in all combinations, set the threshold , ; Take the 70% quantile of the sequence of robust upper bound of accident rate, the value is 0.13; Take the 90% quantile of the sequence of robust upper bound of accident rate, the value is 0.17; Then the score level is 5 (extremely high risk); Then the score level is 4 (high risk).
[0062] If the hazard score level of a road segment in the preliminary screening list obtained according to the prior rule is consistent with the hazard score level obtained by the Gamma-Poisson distribution model, the road segment adopts the hazard score level; if the hazard score level of a road segment in the preliminary screening list obtained according to the prior rule is inconsistent with the hazard score level obtained by the Gamma-Poisson distribution model, the higher hazard score level is adopted; if the hazard score level of a road segment in the preliminary screening list is not obtained according to the Gamma-Poisson distribution model, the road segment is removed from the preliminary screening list and classified as a to-be-identified road segment, which is predicted by the trained random forest model subsequently. For example, see Table 2.
[0063] Table 2 Comparison and explanation of hazard score levels of prior rules and Gamma-Poisson distribution model
[0064]
[0065] From the comparison results, it can be seen that the model scores of most combinations are consistent with the prior scores, verifying the effectiveness of expert experience and typical scenario induction. At the same time, the Gamma-Poisson method identifies potential high risks in some combinations (such as "national road + logistics park" and "main road + catering night market concentrated area"), suggesting that the prior assessment may have underestimated the situation; a small number of combinations do not trigger prior interception because the accident rate is below the threshold, reflecting the advantage of the model in reducing false positives. In summary, the data-driven robust upper bound judgment can complement the prior, improving the objectivity and scientificity of the prior knowledge system.
[0066] In step S6, the truck traffic safety evaluation features include road structure features, traffic operation features, vehicle behavior features, accident statistics features, visual perception features, and environmental features. Specifically, the road structure features include road name, road form, lane widening difference, road level difference, curve radius, and road grade; the traffic operation features include flow index, road section speed limit value, and average vehicle speed; the vehicle behavior features include heavy truck proportion and fatigue driving time; and the environmental features include land use attribute, road lighting condition, weather type, and POI type. This embodiment constructs a truck traffic safety evaluation feature library. Finally, 15 representative and discriminative core features are selected for the construction and training of the random forest model for hazard identification, as shown in Table 3.
[0067] Table 3: Prior feature and truck traffic safety evaluation feature description table
[0068]
[0069] The road form, lane widening difference, and road level difference are obtained according to the intersections in the target area. The intersections in the target area are obtained as follows:
[0070] Traverse each road segment in the target area, extract all key points on the road segment geometry, and generate a candidate node set A, which includes the start point, end point, and all intermediate turning points that define the curved shape of each road segment.
[0071] According to the spatial relationship between all road segments in the target area, calculate the intersection points between each pair of road segments, and generate a candidate node set B, which includes all intersection points. The intersection point is a point formed by one road segment penetrating another road segment.
[0072] With the candidate node set A as a reference, a first error range is defined, and it is checked whether there is a point of the candidate node set B within the first error range of a point of the candidate node set A; if there is one or more points of the candidate node set B within the first error range of a point of the candidate node set A, the point of the candidate node set A is a strictly intersecting intersection point, and an intersection point set L is generated; if there is no point of the candidate node set B within the first error range of a point of the candidate node set A, the point of the candidate node set A is put into a candidate node set C; if the point of the candidate node set C is an endpoint of one road segment and there is a non-endpoint of another road segment within a second error range of the point, the point of the candidate node set C is a road endpoint connection point, and an intersection point set M is generated; if the point of the candidate node set C is an endpoint of one road segment and there is an endpoint of another road segment within a third error range of the point, the point of the candidate node set C is a tolerance intersection point, and an intersection point set N is generated; the points of the intersection point set L, the intersection point set M and the intersection point set N are intersection points in the target region.
[0073] Specifically, the embodiment obtains intersection points in the target region by processing road network data through ArcMap. The road break points are extracted as point features by using a "Feature Vertices to Points" tool in ArcMap to obtain a candidate node set A, which includes all points constituting road lines and road intersection points. Then, an "Intersect" tool is used to identify points where road lines intersect to obtain a candidate node set B. However, the "Intersect" analysis depends on the topological relationship between features and can only identify strictly mathematically intersecting intersection points. The candidate node set A can include road endpoint connection points (endpoints contact but do not penetrate) and tolerance intersection points (do not strictly intersect due to surveying errors) that are not identified by the intersect tool. Therefore, a "Spatial Join" is further used to perform spatial connection query on the candidate node set A and the candidate node set B. The search radius of the spatial connection tool can still associate the endpoint connection points (even if the road endpoints do not strictly penetrate), automatically match the offset tolerance intersection points with the nearest break points, and naturally include the strictly intersecting intersection points. Thus, the final intersection point data is screened out. Through this extraction method, the extraction accuracy of the intersection can be improved to a certain extent, and the performance optimization balance is achieved.
[0074] The extraction process of the partial features of the embodiment is as follows:
[0075] (1) Road shape: According to the number of road segments connected by the intersection and the angle between two adjacent road segments connected by the intersection, the road shape is determined. For each point in the intersection set L, the number of road segments connected by the intersection is directly obtained; for the points in the intersection set M and the intersection set N, the number of road segments connected by the intersection within the fourth error range is obtained. Specifically, the number of roads connected by each node is identified by "Spatial Join", and the angle between two adjacent roads is calculated by Python script in ArcMap to determine the structural shape. For example, "cross intersection", "T-shaped intersection", "ring intersection" or "straight road segment", "ramp", etc. For example, if a node has three roads connected, and two of them are approximately in a straight line, and the other is perpendicular to them, it is determined to be a "T-shaped intersection"; if the connected roads reach four and form an approximately orthogonal structure, it is identified as a "cross intersection". This feature is finally used in the model through classification coding to capture the potential influence of road segment structure on traffic behavior and risk.
[0076] (2) Widening lane difference: The number of lanes connected by the intersection is obtained, and the difference in the number of lanes between two adjacent road segments connected by the intersection is calculated to obtain the widening lane difference. The extraction of the widening lane difference relies on the "lane number" field in the road attribute data, and combines the "Near" and "Spatial Join" operations of ArcMap to identify the connected roads of the intersection point. The number of lanes of the road connected to each intersection point is extracted, and the difference in the number of lanes between two adjacent roads at the intersection point is calculated. For example, at the intersection of a city trunk road, a car enters from the north road of the intersection and exits from the east road, the north entrance road is 3 lanes, and the east exit road is 2 lanes. The "widening lane difference" between the two adjacent lanes of the north and east is -1, indicating that there is a certain degree of bottleneck effect. If the road layer lacks lane number information, it can also be supplemented by superimposing road section maps or using high-resolution remote sensing images to assist in interpretation and assignment. Road section maps and high-resolution images can clearly see the road markings, driving directions, etc. of each road, and the number of lanes of the road is interpreted by manual visual interpretation method, and then standardized as a numerical input attribute table.
[0077] (3) Road grade difference: The road grade field of the road segments connected by the intersection is obtained, and the difference between the road grade values of the road segments connected by the intersection is calculated by using the field calculator to obtain the road grade difference. The road grade difference is calculated based on the grade field of each road in the urban administrative road network layer (such as highway, trunk road, branch road, etc.). The road intersection is identified by the "Intersect" tool in ArcMap, and the difference between the intersection road grade values is calculated by using the field calculator. For example, a national road intersects with a village road, and the grade difference is |1-6|=5 (assuming the coding rule of highway=1 and village road=6), which is used to measure the traffic risk or organizational complexity caused by structural inequality.
[0078] (4) Land use attribute: The extraction of land use attribute is completed by the "Buffer" and "Spatial Join" tools in ArcMap. Usually, the road centerline is taken as the reference, and the buffer radius is 50-100 meters. The road buffer is generated by expanding 50-100 meters to the left and right sides of the road line, and the urban land use map (such as industrial land, residential land, logistics and warehousing land, etc.) is superimposed to extract the dominant land use type covered in the buffer. For multi-type overlapping areas (such as commercial and residential areas), multi-label coding is generated. Taking a road segment in Guangzhou Development Zone as an example, the two sides of the road are both "industrial and warehousing land", so T8 is marked as "industrial zone". If the buffer area also contains residential areas, it is marked as "industrial + residential".
[0079] (5) Road grade: Road grade is an important variable for describing the road traffic function, which is usually directly obtained from the "grade" field of the urban road network layer. In ArcMap, the line-shaped road layer with "grade" attribute is imported, and all sample road segments are mapped and numbered according to the grade field value. For example, "highway" is marked as 1, and "village road" is marked as 10, which is used as an ordered numerical value in the modeling process. In addition, for road segments with missing or unclassified grades in the layer, the average grade of adjacent roads or the main grade of the spatial adjacent area can be used to fill in the missing grades, ensuring the continuity of the global data.
[0080] (6) POI type: The extraction of POIs is based on the POI point layer (point feature) in ArcMap, which is usually derived from the urban functional area database provided by the open platform or the urban planning institute. Similarly, a buffer zone is constructed around the road, and the POI points appearing in the buffer zone are classified and counted. For example, there are 4 "logistics park" label points and 2 "industrial enterprise" label points within a 100-meter range around a certain road, then the road segment is marked as "logistics functional area + industrial functional area", and multi-label coding processing is performed. This method can accurately reflect the functional environment and freight behavior characteristics of the road, such as the fact that logistics-intensive areas are more likely to produce frequent stopping and loading behavior, which in turn affects traffic safety risks.
[0081] In addition to using ArcMap platform to extract the above features, other features of this embodiment are mainly based on a variety of external data sources and traffic system collection, covering vehicle operation behavior, dynamic traffic state and environmental meteorological factors, etc.
[0082] In addition, prior features and truck traffic safety evaluation features are preprocessed before being input into the random forest model during prediction and as samples to train the random forest model. Preprocessing includes missing value completion, category variable encoding, unit conversion and normalization, and construction of key derived features, to ensure that all input fields have a unified data structure and learnability. Among them, T1 "road name" is a sensitive identification field and is not involved in modeling during training and testing, and will be directly deleted. The following describes the processing strategy for each feature:
[0083] T2. Road morphology (category type)
[0084] The field is derived from road network structure data and is used to represent the structure type of the intersection or road segment, including typical intersection shapes (such as "T", "cross", "round") and road segment shapes (such as "straight segment", "curve", "ramp"). For some types with low occurrence frequency (such as special-shaped ramps or temporary construction segments), they can be merged into "other". During preprocessing, One-Hot Encoding is used to convert each structure type into an independent binary variable, thereby adapting to the input requirements of the machine learning model. A total of eight encoding fields are set: (1) T_type (T-shaped intersection), (2) Cross_type (cross-shaped intersection), (3) Round_type (round-shaped intersection), (4) Straight_type (straight road segment), (5) Curve_type (curve), (6) Ramp_type (ramp), (7) Other (other).
[0085] In addition, in order to reduce the influence of spatial error, for the missing value of the road form field, the present application adopts an inference method based on spatial continuity and structural logic to fill in. Specifically, the system will not simply keep consistent with the adjacent nodes, but will comprehensively refer to the structural characteristics of the missing road section and its adjacent road sections (i.e. adjacent nodes) before and after it and the upstream road to infer its most possible form type. For example, when the adjacent road sections are all crossroads, the missing section is also most likely to be a crossroad; if it is in the area of a highway exit and the previous section is a ramp and the next section is a straight section, then the current section is most likely to be a ramp. In the inference process, the spatial continuity and functional logic of the road network are given priority to ensure that the completion result is reasonable and has structural consistency, thereby enhancing the completeness and expression accuracy of the model input features.
[0086] T3. Widening lane difference (numerical type)
[0087] The difference in the number of lanes in the direction of the intersection is represented by the number of lanes. In preprocessing, the missing values are first filled in by using the average value of adjacent intersections or the regional average value. Since the standard deviation of the number of lanes in different regions is large, Z-score standardization processing is also required to eliminate the influence of the scale difference between regions.
[0088] T4. Road level difference (category type / numerical type)
[0089] This field is used to reflect the level difference between intersecting roads and is derived from road level data. In preprocessing, the road level is first mapped to an ordered numerical value to reflect the importance level of the road, and the specific mapping is as follows: Expressway: 1; National Highway: 2; Provincial Road: 3; County Road: 4; Township Road: 5; Other roads (such as village roads, non-grade roads): 6. By calculating the level difference of two intersecting roads (for example: Expressway vs. County Road -> |1 4|=3), the "road level difference" numerical feature is obtained, which is used to quantify the complexity of road connection and traffic adaptability. If there are missing or ambiguous records (such as "secondary arterial road" or "planned road"), the upstream and downstream extension levels of the road, the administrative level, or the average value of the spatial adjacent road sections will be used to infer and complete the missing values.
[0090] T5. Curve radius (numerical type, unit: meters)
[0091] The value represents the degree of road curvature, coming from road network geometry data. When processing, first unify the unit to "meters", and then identify and remove outliers for abnormally small radii (such as <20m). For missing items, the average value can be filled according to the road type (such as urban branch vs. highway). Finally, use Min-Max normalization to make it in a unified numerical interval. Min-Max normalization formula: ; wherein: is the original curve radius value; , are the minimum and maximum values of all samples in the field, respectively; is the normalized value, ranging between [0, 1]. Assuming that the minimum value of the curve radius of a certain area is 30 meters and the maximum value is 500 meters, and the curve radius of a certain road is 150 meters, the normalization result is: , the model will input 0.255 to represent the degree of road curvature, so that the feature values of each field are in a unified scale range
[0092] T6. Flow index (numeric)
[0093] Traffic flow per unit time is identified and counted through high-speed gantries or toll gates. Missing values are completed using regional average or interpolation of previous and subsequent time periods. Since its range is large (such as tens to tens of thousands), it needs to be log-transformed to reduce the scale difference before standardization to enhance the stability of model learning. The formula for log transformation is: , wherein: is the original flow value; is the log-transformed value; adding 1 is to avoid the occurrence of abnormal values (NaN).
[0094] The natural logarithm (ln) is used for conversion, as shown in Table 4:
[0095] Table 4. Flow index conversion example table
[0096]
[0097] T7. Heavy truck proportion (numeric, %)
[0098] The heavy truck proportion in a specific road segment is represented by GPS trajectory combined with weight information. If the data is missing or GPS is incomplete, it can be estimated by similar functional sections or historical data. The percentage data retains the original percentage value and performs Min-Max scaling. If an abnormally high value (such as more than 90%) is found, it needs to be evaluated whether there is an identification error or a gantry failure. Min-Max normalization formula: ; wherein: For the original overload ratio value (e.g., 35%); , For the minimum and maximum overload ratio in the data set; For the normalized input value. Assuming the historical overload ratio range is 10% minimum and 80% maximum, The value will be used as the final input feature for the model.
[0099] T8. Land use attribute (category type)
[0100] Describes the road surrounding use (e.g., residential, industrial, logistics park). Derived from urban land planning data. Converted to numerical type using one-hot encoding. If encountering boundary overlap (e.g., commercial + residential), can be split into a multi-label structure. Low-frequency categories such as "agricultural area" are unified into "other".
[0101] T9. Fatigue driving duration (numerical type, hours)
[0102] Identify the continuous driving time of the truck through GPS trajectory. If it exceeds 4 hours continuously, it is considered a fatigue section. Field missing generally results from GPS interruption, which needs to be estimated in combination with timestamps and interval between previous and subsequent trajectories. Data range is generally 0-10 hours, and standardization processing is performed.
[0103] T10. Road lighting condition (category type)
[0104] Derived from lighting facility database, divided into "with light", "without light", "partial lighting", etc. Preprocessing uses one-hot encoding. If there is record missing, remote sensing images or camera images at night can be used to assist in identification, improving data integrity.
[0105] T11. Weather type (category type)
[0106] Data is obtained from meteorological monitoring system, such as sunny, rainy, foggy, etc. During processing, it is converted into weather grade coding. If historical weather data is missing, the average weather in the recent time window is used as a substitute. "Average weather in the recent time window" refers to selecting a just-past, specific-length time period (i.e., "window") and calculating the average value of one or more weather elements within that time period.
[0107] T12. Road section speed limit value (numerical type, km / h)
[0108] This field is derived from road administration system, which is the value specified by traffic signs. When missing, it is filled by the average speed limit of surrounding roads of the same type.
[0109] T13. Average vehicle speed (numerical type, km / h)
[0110] Calculated through toll gate data statistics, formula: , remove abnormal records with speed less than 5 km / h (may be parking or traffic jam) or greater than 120 km / h (may be identification error).
[0111] T14. Road grade
[0112] Since the road grade field has a clear hierarchical relationship, it is mapped to an ordered numerical value during preprocessing to express the difference in road capacity and risk intensity. If there is a missing or ambiguous grade for a road segment (such as "planned road"), the average of the upstream and downstream roads or the dominant grade of the spatially adjacent area is used to complete it.
[0113] T15. POI type
[0114] To reduce encoding complexity and improve model stability, this field integrates the original dozens of POI fine categories into 8 general functional areas, including logistics functional area, industrial functional area, commercial functional area, educational functional area, residential living area, public service area, hub transition area, and others. During processing, multi-label binary encoding is used. If a road segment corresponds to multiple functional area types (such as "logistics + industry"), the corresponding fields are set to 1. Low-frequency categories are classified as "others" for uniform processing. This field is used for both model input and prior risk rule determination, and is an important variable for measuring road operating scenario complexity and potential conflict probability. As shown in Table 5.
[0115] Table 5 POI type encoding table
[0116]
[0117] In step S7, the prior features and truck traffic safety evaluation features of the to-be-identified road section are input into the trained random forest model for prediction, and the risk score level of each to-be-identified road section is output, including: selecting core features most relevant to truck traffic safety risk from the prior features and truck traffic safety evaluation features; inputting the core features into the trained random forest model for prediction to output the risk score level of each to-be-identified road section.
[0118] Specifically, the prior features and truck traffic safety evaluation features are selected by a multi-dimensional feature value evaluation system, which includes four types of evaluation indexes: importance evaluation, single variable discrimination ability evaluation, statistical correlation analysis, and perturbation importance evaluation. Each prior feature and truck traffic safety evaluation feature obtains a corresponding evaluation value in the four types of evaluation indexes. After standardizing the four types of evaluation values, the weighted average score is calculated. According to the comparison result of the evaluation value and the retention threshold and the high and low of the weighted average score, the core features are selected. Specifically:
[0119] (1) Importance Evaluation (Gini Importance): The Gini Index of the cumulative contribution of each feature in decision splitting is obtained through the random forest algorithm, reflecting its frequency of use and information gain effect in the model learning process;
[0120]
[0121] where, : the i-th feature; : the set of all used features : the set of all used features : the decrease in Gini Index (information gain) at node j due to using feature .
[0122] (2) Univariate Discrimination Ability Evaluation (AUC Score): A binary classification model is constructed with each feature as the only input, and the Area Under the ROC Curve (AUC) of its discrimination of hidden points is calculated to measure the discrimination ability of a single feature;
[0123]
[0124] where, : the i-th feature; : the ROC curve of the binary classification model constructed only with feature as input; : the area under the ROC curve (value range 0-1, the closer to 1, the stronger the discrimination ability).
[0125] (3) Statistical Correlation Analysis (Correlation Coefficient): By calculating the correlation coefficient (such as Point-Biserial or Pearson / Spearman) between the feature and the target variable (whether there is an accident or high-risk labeling), the linear or order correlation is evaluated;
[0126]
[0127] where, : the i-th feature; : the target variable (e.g., whether there is an accident, 1 indicates high risk, 0 indicates low risk); : the correlation coefficient of feature and target variable Y (Pearson, Spearman, or Point-Biserial correlation coefficient).
[0128] (4) Permutation Importance: Shuffle each input feature of the trained random forest model, measure the change in model performance, and evaluate the real contribution of this feature to the overall model accuracy.
[0129]
[0130] where, : the i-th feature; : the accuracy of the model on the original dataset; : the accuracy of the model on the same dataset after randomly shuffling the values of the feature .
[0131] To facilitate cross-indicator horizontal comparison, the four types of evaluation values are standardized to [0-1] and then calculated as a weighted average score , where the importance and perturbation weights are 0.35, and the AUC and correlation weights are 0.15, determined by model design experience and experimental verification, to balance the contribution proportion of different evaluation indicators to the final score.
[0132] .
[0133] In the data set used to train the random forest model in this embodiment, the screening results of the prior features and truck traffic safety evaluation features are shown in Table 6.
[0134] Table 6 Multidimensional Feature Value Evaluation Table
[0135]
[0136] The two features finally eliminated are the road speed limit value (T12) and the curve radius (T5), which are eliminated based on the following:
[0137] 1. In the four types of indicators, the scores are in the bottom 20% range, and the comprehensive evaluation value is lower than 0.40. For example, the comprehensive score of the curve radius is only 0.308, which is significantly lower than the retention threshold;
[0138] 2. Strong redundancy: such as "road speed limit value" and other operating features (such as average speed, illegal intensity) have high correlation in the training set, and the information is seriously repeated;
[0139] 3. Poor stability: in the perturbation evaluation, the elimination of this feature has little effect on the overall accuracy of the model (change amplitude <0.01), indicating that its contribution to the model performance is limited;
[0140] 4. Engineering applicability is weak: although the "bend radius" has theoretical risk significance, the data quality is limited (such as missing or rough estimation of some road sections), and it is difficult to extract and maintain stably in large-scale modeling.
[0141] Therefore, the features of the trained random forest model input by the embodiment are: road shape, lane widening difference, road level difference, flow index, heavy truck proportion, land use attribute, fatigue driving time, road lighting condition, weather type, average speed, road grade, POI type. It should be pointed out that when identifying the truck traffic safety hidden danger points of different target areas, the historical data of the target area is used to train the random forest model, and the core features obtained are different.
[0142] In the design of the random forest model, the following core parameters are experimentally verified and optimized:
[0143] (1) The number of decision trees (n_estimators)
[0144] It is set to 150. Experiments show that when the number of trees increases from 50 to 150, the F1 score and AUC of the model are significantly improved, and the improvement rate tends to slow down when the number of trees exceeds 200. Considering the balance between model training efficiency and performance, 150 trees are finally set.
[0145] (2) Maximum decision tree depth (max_depth)
[0146] It is set to 12. Smaller tree depth (such as less than 5) has the risk of underfitting, which makes the model unable to capture the non-linear relationship between complex risk factors; while too large depth (such as more than 20) may lead to overfitting and decreased generalization ability. Multiple rounds of cross-validation experiments show that when the depth is set to 12, the Recall and F1 values are most balanced and optimal.
[0147] (3) Minimum leaf node sample size (min_samples_leaf)
[0148] It is set to 3. This parameter controls the lower limit of the number of samples in the leaf nodes finally split by each tree, avoiding overfitting of the model to weak noise and enhancing the stability of the model in judging small sample road sections.
[0149] (4) Class weight (class_weight)
[0150] It is set to 'balanced'. Considering that the number of samples of different score levels is unevenly distributed in the actual training set, the invention uses the built-in class automatic weight balancing mechanism to give higher weight to high-score (high-risk) samples, thereby improving the identification ability of hidden danger road sections.
[0151] (5) Feature division method (criterion)
[0152] The "gini" is used as the splitting criterion. This index can effectively evaluate the purity improvement effect of feature division, and is suitable for stable tree building process in multi-classification scenarios.
[0153] (6) The final prediction result is determined by majority voting
[0154] During model training, an ensemble learning model in the supervised learning method is used for training, and the core is to guide the model to learn the risk discrimination rule through the "safety hazard level" label of the known sample. In the sample construction stage, the system divides all data into a training set and a test set in a ratio of 70:30, and each sample contains a pre-processed multi-dimensional feature vector and two core fields:
[0155] 1. Road name: used for sample uniqueness identification and subsequent spatial division (such as preventing label leakage);
[0156] 2. Safety hazard level label: represents the true risk level of the road segment, which is the learning goal of the model, and the value range is 1-5 points. The safety hazard level label is determined by the following methods: 1. According to the historical accident frequency, accident level, behavior risk index, etc. Comprehensive scoring; 2. Combined with field experts and typical scene manual evaluation grading (such as 5 points representing a typical high-risk road segment with frequent accidents and significant heavy-load behavior); 3. Through clustering-labeling method, the road segment data is clustered and scored.
[0157] In the model training process, the random forest will learn the nonlinear mapping relationship between the pre-processed features and the known hazard level. Each tree will use labeled data for modeling during training, and through the ensemble mechanism, the prediction ability of the risk level is formed. These hazard levels are used as label variables, and the mapping relationship between the input features and the hazard level is learned through a large number of labeled samples, that is, the decision path of "input features → hazard level" is constructed. This label not only provides the training direction of the model, but also serves as the basis for the construction of the scoring system.
[0158] In the model deployment and inference stage, the system will automatically extract the corresponding features (excluding road name and hazard level) from the new road segment, input them into the trained model, and based on the rules learned by the model during the training stage, predict the safety hazard level of the road segment, thereby realizing intelligent hazard assessment of unlabeled data.
[0159] After completing the training sample construction and parameter configuration, the embodiment formally starts the model training process based on the random forest classification algorithm. During the training process, a combination of full sample learning is used to maximize the mapping relationship between features and hazard levels, and an integrated model with scoring ability is generated.
[0160] The model training input is the completed training sample set, which includes a multi-dimensional feature matrix and corresponding hazard level score labels (1-5 points). The present application uses an optimized random forest parameter combination to build 150 decision trees with a depth of no more than 12. Each tree uses Bootstrap Sampling and random feature subset selection strategies during the training process, thereby maintaining individual differences while forming an integrated structure with discriminant ability. During the training process, the model minimizes the Gini Index to build the optimal partition path and gradually learns the influence of each feature on the score level. The final generated model outputs the score prediction result of each sample in a majority voting manner. After training, the model structure and training parameters are saved in the system module, supporting model export, deployment, and remote calling. Model training logs, index score results, feature importance rankings, and other auxiliary information are recorded simultaneously to facilitate model effectiveness evaluation and subsequent version iteration. To comprehensively evaluate the effectiveness and stability of the constructed random forest scoring model, the present application divides 30% of the overall sample set as a test set to independently verify the model's scoring ability and generalization performance on unseen data. The evaluation process not only compares the true labels and model output results of the test set, but also introduces a multi-dimensional, multi-index performance verification mechanism to ensure the accuracy and engineering practicability of the model in road traffic safety hazard level discrimination. During verification:
[0161] (I) 5-fold cross-validation method (5-Fold Cross Validation)
[0162] The training sample set is divided into five equal-sized subsets (or folds), of which four are used to train the model and the remaining one is used to test the model. This process is repeated five times, with a different subset selected as the test set each time and the remaining subsets as the training set. Finally, the performance evaluation results of the five times are averaged to obtain the final evaluation result.
[0163] (II) Division mechanism and improvement points
[0164] To improve the scientificity and robustness of the verification process, the present application improves the cross-validation method as follows:
[0165] 1. Stratified Sampling: The samples are stratified according to the score level y ∈ {1, 2, 3, 4, 5}, ensuring that each category of samples accounts for the same proportion as the overall population, effectively controlling the bias caused by sample imbalance.
[0166] 2. Road Uniqueness Constraint Division: Given that the sample unit is a road segment, to avoid the same segment appearing in both the training and validation sets, causing the "label leakage" problem, the scheme is grouped and divided according to the "road name" field, ensuring that each group is allocated to a single fold in its entirety.
[0167] 3. Repeated Cross Validation
[0168] 4. In the formal evaluation, perform R times five-fold validation, and take the average of all results to further reduce the evaluation variance caused by accidental division, where R ≥ 10.
[0169] (Three) Identification of the Recognition Shift Trend of Score Levels
[0170] For multi-classification models with output as 1-5 level scores, the invention also uses the classification confusion matrix (Confusion Matrix) to analyze the prediction shift between each level score, identifying the recognition stability of the model in adjacent levels (such as score 4 being judged as 3 or 5).
[0171] As shown in Figure 3 , the diagonal elements of the confusion matrix (dark squares) represent the number of samples correctly predicted by the model, for example, the number of road segments with a score of 3 accurately identified is as high as 12,000, indicating that the model has the strongest discrimination ability in this level. The darker the color of the diagonal line, the higher the prediction accuracy of that level. In the non-diagonal line positions, some prediction shifts can be observed, for example: (1) 800 samples with a score of 1 are misjudged as a score of 2, indicating that the model has some confusion between low-risk levels; (2) 840 samples with a score of 2 are judged as a score of 3, reflecting the transitional error between low-risk levels; (3) 1,080 samples with a score of 4 are misjudged as a score of 3, and 540 samples are misjudged as a score of 5, indicating that the model still has some difficulty in distinguishing between adjacent classes in high-risk levels. Overall, the matrix shows that the model has high recognition accuracy in extreme levels (1, 3, 5), but relatively low discrimination ability in adjacent levels.
[0172] The model is stable in the validation set, with an average accuracy of over 88%, an F1 score of 0.79, an AUC of 0.89 for the binary classification task of high-risk level (score of 4-5) and non-high-risk level (1-3), and a recall rate of high-risk level (score of 5) that is more than 10% higher than the traditional single model baseline, effectively improving the coverage of the system for hidden points.
[0173] (Four) Verification indicators and analysis dimensions
[0174] The present application adopts five basic classification indicators of accuracy (Accuracy), precision (Precision), recall (Recall), F1 score (F1 Score) and AUC-ROC for quantitative evaluation of the model.
[0175] In practical application, the system first filters the prior rules according to the road level and POI type from the business database or data interface. The system scores the high-risk hidden points with a score of 4 or 5 without entering the machine learning process. Secondly, the feature data of all the target areas of the remaining target area are obtained, including structural features, behavior features, running features and image derived features, etc. After the same data preprocessing process as in the training stage, the unified input is input into the trained random forest model.
[0176] The model inference process adopts batch prediction mode, and outputs the probability distribution of each sample belonging to 1-5 rating levels. The system classifies it into a specific score level according to the maximum posterior probability, as the safety hazard level judgment result of the road section. The corresponding relationship between the score level and the safety hazard level is shown in Table 7:
[0177] Table 7 Score and hidden danger level table
[0178]
[0179] In the visualization platform, different score levels will be mapped to different color layers, and the color will gradually change from green to red to reflect the increase of risk level.
[0180] Example two
[0181] (I) Purpose of the test
[0182] The actual operation case is based on two typical areas of B district and C district in A city, the former is used as a model training set, a total of 1852 road samples are collected, covering urban expressway, national and provincial highway, industrial park branch and highway interchange section, with rich freight transport scene and structural characteristics. Due to the same road section on different dates generating multiple records, B district actually generates a total of 31457 training data, of which 23,615 samples are used for model learning. The latter is used as a test area, 624 road samples are collected, covering airport expressway, village branch and mountain bypass road, finally forming 12112 test data, of which 8,929 samples are used for model prediction. The data covers airport expressway, village branch and mountain bypass road, with diverse structure and complex data, and has significant migration verification value. All samples have calculated the 13 reserved features proposed by the application, ensuring the consistency and effectiveness of the modeling input.
[0183] (II) Use and screening of prior knowledge
[0184] Before modeling, the prior risk knowledge system based on "road grade + POI type" is introduced in this embodiment, and combined with the Gamma-Poisson accident rate robust upper bound determination method, the pre-scoring and automatic labeling of part of the high-risk combined road sections are carried out. In the data preprocessing stage, the system preferentially matches the road section combination conforming to the rules, and directly gives the corresponding high risk level (scored as 4 or 5 points), so as to skip the model reasoning process, reduce the calculation complexity, and enhance the stability of the scoring result. The prior knowledge rule is derived from expert evaluation, accident scene induction and historical data extraction, and is widely applicable to complex freight transport environment in urban and suburban areas, especially in the scene of structural mutation, data loss and unstable model judgment. The steps include:
[0185] (1) Expert and scene preliminary screening: first, according to the expert experience and typical accident scene summary, a batch of road grade and functional area combinations with potential high risk are preliminarily screened out to form a preliminary screening list. For example, "country road + logistics park", "village road + industrial park", "county road + agricultural market" and other combinations, which are often identified by experts as risk outstanding scenes due to dense traffic flow, concentrated freight vehicles or complex traffic organization.
[0186] (2) Historical data modeling: statistical analysis is carried out on the actual accident performance of these combinations combined with the historical accident database. Through the Gamma-Poisson empirical Bayes method, the upper bound of the accident rate of each combination is calculated, which can obtain a more robust risk intensity estimate considering the difference in sample size and data fluctuation. Unlike the traditional dependence on accident mean or single point statistics, the robust upper bound avoids accidental misjudgment due to too few samples.
[0187] (3) Fusion determination: The quantile ranking in all combinations is combined with the screening list, if then score level 5 (very high risk); if then score level 4 (high risk). The remaining combinations enter the model inference loop, which is refined by a random forest. As shown in Table 8,
[0188] Table 8 Road section-road level-POI type-score level determination table
[0189]
[0190] In the prior rule application stage, there are 7,842 samples in the B area training data that meet the "road level + POI" high-risk combination, and are directly assigned a score level of 4 or 5 by the Gamma-Poisson upper bound determination; the remaining 23,615 samples are used as a training set to enter model learning. There are 2,183 samples in the C area test data that are directly labeled by the prior determination, and the remaining 9,827 samples enter the model inference to perform hazard score prediction.
[0191] (Three) Data preprocessing
[0192] In terms of data preprocessing, the project systematically analyzed the proportion of missing values. Among the 1,852 original roads in the B area, 423 samples had varying degrees of field missing, accounting for 22.8%. Among them, the missing of traffic index was the most prominent, reaching 134 (about 7.2%); the fatigue driving duration was missing in 245 (13.2%) due to discontinuous GPS records. To solve the above problems, the project adopted a field-by-field completion strategy: numerical fields such as traffic index were completed using the "time period-road class bidirectional average" method, and fatigue driving duration was recovered by interpolation based on trajectory continuity reconstruction algorithm. After completion, the field completeness rate improved to 98.9%.
[0193] For categorical variable encoding, the invention processed three key fields: T2 (road form), T8 (land use attribute), and T15 (POI type). In the B area samples, the road form distribution was 41.3% for straight sections, 27.2% for curves, 8.5% for ramps, 19.6% for T-shaped / cross intersections, and the rest were classified as "others". All were converted to seven-dimensional Boolean vectors using one-hot encoding. In the land use attribute, industrial areas accounted for 33.1%, logistics parks for 19.4%, residential areas for 29.2%, commercial areas for 10.5%, and the rest were combined as "mixed / other", totaling four categories.
[0194] In terms of unit standardization, the numerical fields in the 13 reserved features are involved in normalization or standardization processing, especially the fields with significant scale differences such as traffic index (the number of vehicles spans from 120 to 12750), lane difference, and fatigue driving time. The project adopts Z-score standardization processing for characteristics such as accident intensity and fatigue time, and uses Min-Max normalization processing for interval type characteristics such as lane difference and traffic index.
[0195] After preprocessing, all training samples are constructed into a unified feature matrix with a dimension of (31457x34), containing 13 reserved features and their coded expansion fields, providing a standardized input basis for model training.
[0196] (Four) Model and parameter configuration
[0197] The present application adopts the random forest (Random Forest) algorithm as the core classifier, and the model takes a single road section as the basic prediction unit, the input is the structured feature vector constructed as described above, and the output is the hazard level score, ranging from 1 (lowest risk) to 5 (highest risk).
[0198] In the model parameter tuning phase, the present application adopts a strategy combining grid search and 5-fold cross-validation (5-Fold Cross Validation) to systematically evaluate key hyperparameters. The tuning parameters include: the number of trees (n_estimators), the maximum tree depth (max_depth), the minimum leaf node sample size (min_samples_leaf), and the class weight balance (class_weight). In the grid experiment, five typical parameter combinations (P1-P5) are constructed, and their accuracy, precision, recall, F1 score, and AUC on the training set are tested. The results show that when n_estimators=150, max_depth=12, min_samples_leaf=3, and class_weight='balanced' is set, the model achieves the best performance under 5-fold validation: the F1 score reaches 0.85, and the AUC is close to 0.89, achieving a good balance between model complexity and generalization ability.
[0199] To avoid model bias caused by uneven sample labels, the class_weight='balanced' setting is used to automatically adjust the sample weight during training, giving more weight to high-risk level samples, thereby improving the model's sensitivity to 4-5 point samples. At the same time, during feature selection, the input features are sorted by importance based on the Gini importance and perturbation impact double evaluation indicators, and 13 high-weight features are retained, effectively improving the model's learning efficiency and interpretability.
[0200] The final trained model contains 150 decision trees with a depth of no more than 12, trained using bootstrap and feature bagging methods, with stable output capabilities and support for subsequent batch inference and deployment applications. All training logs, cross-validation records, and model structure information are saved in the platform log, supporting model version management and iterative updates.
[0201] (Five) Generalization test results
[0202] After the model training is completed, the parameters are fixed and deployed to the inference engine for direct scoring prediction on C area data. In this migration test, no retraining or fine-tuning is performed on the model, and the parameters obtained from the B area training are used for external sample inference, thereby objectively testing the model's cross-regional generalization ability. Among the 9,827 test data in the C area, the score distribution shows a high bias trend (score ≥ 4 accounts for 29.3%), which is consistent with the actual situation of mountainous road sections and dense logistics routes. The model's test accuracy in this area is 87.3%, the F1 score is 0.83, and the AUC is 0.88, which is highly similar to the performance indicators of the training area, indicating that the model also has strong recognition and good stability in unseen areas.
[0203] In addition, the model's recall rate for high-risk levels (score = 5) reaches 81.2%, which is 12 percentage points higher than the traditional BP neural network in the control experiment, especially in road sections with low accident frequency but significant behavior risk (such as mountainous sections with load fluctuation rate > 0.4 + fatigue duration > 6 hours), showing better sensitivity. In terms of prediction bias, the classification confusion matrix shows that the model has high recognition concentration for score levels, with some acceptable range of fuzzy judgment between scores "3" and "4", and the misjudgment mainly occurs between adjacent levels, and the overall score trend of the model is consistent with the true level. Performance evaluation is shown in Table 9:
[0204] Table 9 Comparison of classification performance indicators
[0205]
[0206] To further verify the model's recognition performance on actual road sections, this embodiment selects several representative road segments from the test sample in Zone C and lists the comparison results between the model score and the actual hazard level. The table includes typical high-risk curved road segments, main logistics channels, and ordinary secondary roads with low accident rates, comprehensively demonstrating the model's adaptability and error range under different traffic structures and risk environments. Comparative analysis shows that the model can accurately determine the hazard level in most cases and has a certain "risk pre-identification" capability for high-risk areas. The comparison between model predictions and actual scores is shown in Table 10.
[0207] Table 10 Comparison of Model Predictions and Actual Scores
[0208]
[0209] (vi) Conclusion
[0210] This practical case study uses Area B of City A as the training sample source and Area C as an independent validation area to systematically verify the effectiveness, generalization ability, and practical application value of the invention. At the data level, a complete structured feature system is constructed by integrating multi-source data such as road network structure, traffic flow, truck behavior, and image recognition. Complex derived variables (such as load fluctuation rate and fatigue driving duration) are combined to enhance the model's risk perception capability. At the modeling level, a random forest scoring model with strong generalization ability and high interpretability is successfully constructed through refined feature processing, parameter tuning, and supervised learning strategies.
[0211] Experimental results show that the model achieved an accuracy of over 88% and an F1 score of 0.85 in the training region (region B), while maintaining a recognition accuracy of over 87% and a good high-risk recall rate in the unseen region (region C), fully verifying the transfer adaptability of the invention under different traffic environments. Simultaneously, the scoring results can be intuitively displayed and rendered with heatmaps on the platform, providing traffic regulatory units with a visual, controllable, and early warning-enabled governance support tool.
[0212] Example 3
[0213] like Figure 4 As shown, this embodiment provides a truck traffic safety hazard identification device, including:
[0214] The preset module 100 is used to select prior features and preset prior rules based on expert experience assessment and typical accident scenario induction. The prior rules are to give a corresponding hazard rating level when a specific combination of prior features is met.
[0215] The prior feature acquisition module 200 is used to acquire the prior features of all road segments within the target area;
[0216] The screening module 300 is used for classifying the road sections into a screening list if the prior feature of the road section is given a hidden danger score level according to the prior rule, and classifying the road sections into a to-be-identified road section if not;
[0217] The history module 400 is used for acquiring historical accident data of each road section in the screening list, and predicting an accident occurrence probability of each road section according to the historical accident data;
[0218] The adjustment module 500 is used for adjusting the hidden danger score level of each road section in the screening list according to the accident occurrence probability, wherein the road section with a lower hidden danger score level and a lower accident occurrence probability based on the prior rule is removed from the screening list and classified into a to-be-identified road section to form a new screening list; and the hidden danger score level of all road sections in the new screening list is output.
[0219] The truck traffic safety evaluation feature acquisition module 600 is used for acquiring truck traffic safety evaluation features of the to-be-identified road section;
[0220] The prediction module 700 is used for inputting the prior feature and the truck traffic safety evaluation feature of the to-be-identified road section into a trained random forest model for prediction, and outputting a hidden danger score level of each to-be-identified road section.
[0221] Embodiment four
[0222] The embodiment of the present application also provides an electronic device, which comprises a memory for storing a computer program and a processor for executing the computer program to realize the processes of the truck traffic safety hidden danger point identification method and achieve the same technical effects. To avoid repetition, details are not described herein.
[0223] Embodiment five
[0224] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to realize the processes of the truck traffic safety hidden danger point identification method and achieve the same technical effects. To avoid repetition, details are not described herein. The computer readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0225] The above description is only preferred embodiments of the present application, and it should be pointed out that, for those skilled in the art, without departing from the technical principles of the present application, a number of improvements and replacements can be made, which should be considered as the protection scope of the present application.
Claims
1. A method for identifying potential traffic safety hazards in trucks, characterized in that, include: Prior features are selected based on expert experience assessment and typical accident scenario summarization, and prior rules are preset. The prior rules are used to assign a corresponding hazard rating level when a specific combination of prior features is met. Obtain the prior features of all road segments within the target area; If the prior features of a road segment are assigned a hazard rating according to the prior rules, then the road segment is included in the preliminary screening list; otherwise, it is classified as a road segment to be identified. Obtain historical accident data for each road segment in the initial screening list, and predict the probability of accidents occurring on each road segment based on the historical accident data; The hazard rating of each road segment in the initial screening list is adjusted according to the probability of the accident. Specifically, road segments with low hazard ratings and low accident probability obtained based on prior rules are removed from the initial screening list and classified as road segments to be identified, forming a new initial screening list. The hazard rating of all road segments in the new initial screening list is output. Obtain the truck traffic safety assessment features of the road segment to be identified; The prior features of the road segment to be identified and the truck traffic safety assessment features are input into a trained random forest model for prediction, and the hazard score level of each road segment to be identified is output.
2. The method according to claim 1, characterized in that, The step of obtaining historical accident data for each road segment in the initial screening list and predicting the probability of accidents occurring on each road segment based on the historical accident data includes: Obtain historical accident data for each road segment in the initial screening list; The probability of accidents occurring on each road segment is predicted using the historical accident data based on the Gamma-Poisson distribution model.
3. The method according to claim 1, characterized in that, The characteristics of truck traffic safety assessment include road structure characteristics, traffic operation characteristics, vehicle behavior characteristics, accident statistics characteristics, visual perception characteristics, and environmental characteristics.
4. The method according to claim 3, characterized in that, The prior features of the road segments to be identified and the truck traffic safety assessment features are input into a trained random forest model for prediction, and the hazard score level of each road segment to be identified is output, including: Feature selection is performed on the prior features and the truck traffic safety assessment features to screen out the core features most relevant to truck traffic safety risks; The core features are input into a trained random forest model for prediction, and the hazard rating level of each road segment to be identified is output.
5. The method according to claim 4, characterized in that, The prior features and the truck traffic safety assessment features are selected using a multi-dimensional feature value evaluation system. The multidimensional feature value assessment system includes four types of assessment indicators: importance assessment, univariate discriminant ability assessment, statistical correlation analysis, and disturbance importance assessment. Each of the prior features and the truck traffic safety assessment features obtains a corresponding assessment value in the four types of assessment indicators. After standardizing the four types of assessment values, a weighted average score is calculated. The core features are selected based on the comparison results between the assessment values and the retention threshold, as well as the weighted average score. The importance assessment is performed by obtaining the Gini coefficient of each feature's cumulative contribution to decision splitting using the random forest algorithm, reflecting its frequency of use and information gain effect during model learning. The univariate discrimination ability assessment is to construct a binary classification model with each feature as a unique input, and calculate the area under the ROC curve for the discrimination of hidden danger points, which is used to measure the discrimination ability of a single feature. The statistical correlation analysis is performed by calculating the correlation coefficient between the feature and the target variable, where the target variable is the presence or absence of an accident or high-risk label, and assessing its linear or ordinal correlation. The perturbation importance assessment involves scrambling each input feature of the trained random forest model, measuring the change in model performance, and evaluating the true contribution of that feature to the overall model accuracy.
6. The method according to claim 3, characterized in that, The road structural features include road morphology, lane width difference, and road rank difference. The acquisition of the road morphology, lane width difference, and road rank difference includes: Obtain the intersection points within the target area; The road shape is determined based on the number of road segments connected by the intersection and the angle between any two adjacent road segments connected by the intersection. Obtain the number of lanes in the road segments connected by the intersection, and calculate the lane widening difference by calculating the difference in the number of lanes between each pair of adjacent road segments connected by the intersection. Obtain the road grade field of the road segments connected by the intersection, and use the field calculator to calculate the difference in road grade values of the roads connected by the intersection based on the road grade field to obtain the road rank difference.
7. The method according to claim 6, characterized in that, The step of obtaining the intersection points within the target area includes: Traverse each road segment within the target area, extract all key points on the road segment geometry, and generate a candidate node set A. The candidate node set A includes the start point, end point, and all intermediate turning points that define the curvature of each road segment. Based on the spatial relationship between all road segments within the target area, the intersection points between each pair of road segments are calculated to generate a candidate node set B. The candidate node set B includes all points where intersections occur, and the intersection point is the point formed when one road segment penetrates another road segment. Using the candidate node set A as a reference, a first error range is defined. The system checks whether any point in candidate node set B exists within the first error range of any point in candidate node set A. If one or more points in candidate node set B exist within the first error range of any point in candidate node set A, then the points in candidate node set A are strictly intersecting intersection points, generating an intersection point set L. If no points in candidate node set B exist within the first error range of any point in candidate node set A, then the points in candidate node set A are placed into candidate node set C. If a point in candidate node set C is an endpoint of one road segment and there is a non-endpoint of another road segment within the second error range of that point, then the points in candidate node set C are road endpoint connection points, generating an intersection point set M. If a point in candidate node set C is an endpoint of one road segment and there is an endpoint of another road segment within the third error range of that point, then the points in candidate node set C are tolerance intersection points, generating an intersection point set N. The points in intersection point set L, intersection point set M, and intersection point set N are intersection points within the target area.
8. A device for identifying potential traffic safety hazards in trucks, characterized in that, include: The preset module (100) is used to select prior features and preset prior rules based on expert experience assessment and typical accident scenario induction. The prior rules are to give a corresponding hazard rating level when a specific combination of prior features is met. The prior feature acquisition module (200) is used to acquire the prior features of all road segments within the target area; The initial screening module (300) is used to include a road segment in the initial screening list if the prior features of the road segment are given a hazard rating according to the prior rules; otherwise, the road segment is classified as a road segment to be identified. The historical module (400) is used to obtain historical accident data for each road segment in the preliminary screening list and predict the probability of accidents occurring in each road segment based on the historical accident data. The adjustment module (500) is used to adjust the hazard rating of each road segment in the initial screening list according to the probability of the accident. Specifically, road segments with low hazard ratings and low accident probability obtained based on prior rules are removed from the initial screening list and classified as road segments to be identified, forming a new initial screening list. The hazard rating of all road segments in the new initial screening list is output. The truck traffic safety assessment feature acquisition module (600) is used to acquire the truck traffic safety assessment features of the road segment to be identified; The prediction module (700) is used to input the prior features of the road segment to be identified and the truck traffic safety assessment features into the trained random forest model for prediction, and output the hazard score level of each road segment to be identified.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor is configured to implement the steps of the truck traffic safety hazard identification method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the truck traffic safety hazard identification method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Traffic risk factor assessment method and device, electronic equipment and storage medium
CN120145227A
Lightweight Internet of Things malicious traffic sensing method and system based on multi-model collaboration
CN120415789A