Data processing method and device and electronic equipment
By using the density clustering algorithm of time and space dimensions in traffic accident data to screen the maximum clustering coefficient and statistical accident risk value, the problem of insufficient data mining caused by the single data type and large quantity in the existing technology is solved, and the Multi-level mining of traffic accident data and improvement of clustering effect.
Patent Information
- Application Number
- CN202411247891.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the process of clustering traffic accident data, the existing technology cannot effectively distinguish different types of traffic accident data. Especially when the data type is single and the number is large, accident characteristics cannot be extracted, resulting in insufficient data mining and inability to provide traffic accident prevention. Valid basis.
By obtaining the historical accident data set, including the coordinate location and accident risk value, a density clustering algorithm based on the time dimension and the spatial dimension is used, the clustering radius and the minimum number of samples are set, the clustering cluster with the largest clustering coefficient is screened out, and statistics are collected The total number of accident risk values ensures the accuracy and adequacy of the clustering results.
It realizes multi-level mining of traffic accident data, improves the accuracy of clustering effects and the reliability of output results, can better distinguish different types of traffic accident data, extract accident characteristics, and provide a basis for road safety analysis.
Smart Images

Figure CN118760914A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent transportation technology, and in particular to a data processing method, device and electronic equipment. Background Art
[0002] With the development of information technology, traffic accident data has received more and more attention. Based on the recorded traffic accident data, the accident characteristics and causes of traffic accidents can be excavated, providing data support for preventing the occurrence of traffic accidents.
[0003] At present, in order to prevent the occurrence of traffic accidents, historical traffic accident data corresponding to traffic sections is usually obtained, and the historical traffic accident data is clustered to obtain clustering results, which include at least one type of traffic accident data and the location identifier of each traffic accident data.
[0004] In the above clustering process, traffic accident data of the same type are simply clustered into one category. There are different location identifiers in the traffic accident data of the same type. When the distance between the location identifiers in the traffic accident data of the same type is far, this group of data is only meaningful for data statistics and cannot provide a basis for preventing the occurrence of traffic accidents. If there is only one type of historical traffic data and the total amount of historical traffic data is large, it is impossible to distinguish the traffic accident data of the same type, and it is impossible to extract the accident characteristics of the traffic accident data of the same type, which makes the mining of traffic accident data insufficient. Summary of the invention
[0005] The present application provides a data processing method, device and electronic device for fully mining historical accident data.
[0006] In a first aspect, the present application provides a data processing method, the method comprising: Obtaining a historical accident data set, wherein each historical accident data in the historical accident data set includes a corresponding coordinate position and an accident risk value corresponding to each coordinate position; Clustering all the historical accident data in the historical accident data set based on different set clustering parameters to obtain clustering coefficients corresponding to each clustering parameter, wherein the clustering coefficients are used to evaluate the clustering effect; Screening out a maximum clustering coefficient from all clustering coefficients, and determining a clustering cluster corresponding to the historical accident data set corresponding to the maximum clustering coefficient; The total number of accident risk values in each cluster is counted, and the clusters whose total number values are greater than the total number threshold are output as clustering results.
[0007] Through the above method, the clustering cluster with the best clustering effect is screened out based on the maximum clustering coefficient, and the total number of accident risk values corresponding to the clustering cluster is determined. The clustering cluster with a total number value greater than the total number threshold is output as the clustering result, ensuring the accuracy of the output clustering result and realizing the full mining of historical accident data.
[0008] In a possible design, clustering all the historical accident data in the historical accident data set based on different set clustering parameters includes: The specific steps of clustering all the historical accident data in the historical accident data set for one clustering parameter are as follows: Extracting the clustering radius and the minimum number of samples from the clustering parameters, and determining the accident nodes corresponding to each of the historical accident data; Determine and calculate the i-th accident node and the j-th accident node from all accident nodes, and calculate the time distance and space distance between the i-th accident node and the j-th accident node, wherein both i and j are positive integers, and i is not equal to j; When the time distance is lower than the preset time distance, and the space distance is lower than the preset space distance, determining the total number of accident nodes within the current clustering radius with the i-th accident node as the cluster center; When the total number is greater than the minimum sample number, the i-th accident node is clustered as a cluster center.
[0009] Through the above method, historical accident data are clustered based on the time dimension and the space dimension, ensuring full mining of historical accident data in the time dimension and the space dimension.
[0010] In a possible design, calculating the spatial distance between the i-th accident node and the j-th accident node includes: Determine the i-th coordinate position corresponding to the i-th accident node, and determine the j-th coordinate position corresponding to the j-th accident node; Extracting the i-th horizontal coordinate and the i-th vertical coordinate in the i-th coordinate position, and extracting the j-th horizontal coordinate and the j-th vertical coordinate in the j-th coordinate position; Substitute the i-th horizontal coordinate, the i-th vertical coordinate, the j-th horizontal coordinate and the j-th vertical coordinate into the spatial distance formula to calculate the spatial distance between the i-th accident node and the j-th accident node.
[0011] Through the above method, the spatial distance between the i-th accident node and the j-th accident node is calculated based on the coordinate position, ensuring that an accurate spatial distance can be obtained.
[0012] In a possible design, calculating the time distance between the i-th accident node and the j-th accident node includes: Determine the i-th accident time corresponding to the i-th accident node, and determine the j-th accident time corresponding to the j-th accident node; Substitute the i-th accident time and the j-th accident time into the angle formula respectively, and calculate the i-th angle value corresponding to the i-th accident time and the j-th angle value corresponding to the j-th accident time, wherein the angle value is the angle on the circumference determined based on the accident time; The i-th angle value and the j-th angle value are input into the time distance formula to calculate the time distance corresponding to the i-th accident node and the j-th accident node, wherein the time distance represents the gap between the i-th accident node and the j-th accident node in the time dimension.
[0013] Through the above method, the time distance between the i-th accident node and the j-th accident node is calculated based on the coordinate position, ensuring that the accurate time distance can be obtained.
[0014] In a possible design, obtaining the clustering coefficients corresponding to the clustering parameters includes: The specific steps to obtain the clustering coefficient corresponding to a clustering parameter are as follows: Determine a target accident node at the cluster center and a target cluster to which the target accident node belongs; Calculating a first distance between the target accident node and each other accident node in the target cluster, and calculating a first average distance based on all the first distances; Determine a second distance between the target accident node and each accident node in other clusters, and calculate a second average distance based on all the second distances; The first average distance and the second average distance are brought into a preset clustering formula to obtain a clustering coefficient corresponding to the clustering parameter.
[0015] Through the above method, the clustering coefficient is calculated based on the preset clustering formula, which ensures the accuracy of the clustering coefficient.
[0016] In a possible design, the total number of accident risk values in each cluster is calculated, including: Determine the accident nodes of each historical accident data in each cluster, and the coordinate positions corresponding to each accident node; Selecting a starting point from each cluster based on the coordinate position, and connecting the starting point to each accident node to obtain a plurality of connecting lines; Determine the angle between each connecting line and the preset coordinate axis along the set direction, and determine the maximum angle from all the angles; The connecting line corresponding to the maximum angle is used as the boundary line, and all accident nodes in the cluster are traversed until all the boundary lines form a closed polygon, and the total number of accident risk values is counted from the polygon.
[0017] Through the above method, the boundary range corresponding to each cluster is determined, ensuring that a complete and accurate cluster can be output.
[0018] In a second aspect, the present application provides a data processing device, the device comprising: An acquisition module is used to obtain a historical accident data set, wherein each historical accident data in the historical accident data set includes a corresponding coordinate position and an accident risk value corresponding to each coordinate position; A clustering module, used to cluster all the historical accident data in the historical accident data set based on different set clustering parameters, and obtain the clustering coefficients corresponding to the respective clustering parameters, wherein the clustering coefficients are used to evaluate the clustering effect; A screening module, used to screen out a maximum clustering coefficient from all clustering coefficients, and determine a clustering cluster corresponding to the historical accident data set corresponding to the maximum clustering coefficient; The output module is used to count the total number of accident risk values in each cluster, and output the clusters whose total number values are greater than the total number threshold as clustering results.
[0019] In a possible design, the clustering module is specifically used to cluster all historical accident data in the historical accident data set according to a clustering parameter. The specific steps are as follows: extract the clustering radius and the minimum number of samples in the clustering parameter, and determine the accident nodes corresponding to each historical accident data, determine and calculate the i-th accident node and the j-th accident node from all accident nodes, and calculate the time distance and space distance between the i-th accident node and the j-th accident node. When the time distance is lower than the preset time distance, and the space distance is lower than the preset space distance, determine the total number of accident nodes within the current clustering radius with the i-th accident node as the clustering center. When the total number is higher than the minimum number of samples, cluster the i-th accident node as a clustering center.
[0020] In a possible design, the clustering module is also used to determine the i-th coordinate position corresponding to the i-th accident node, and determine the j-th coordinate position corresponding to the j-th accident node, extract the i-th horizontal coordinate and the i-th vertical coordinate in the i-th coordinate position, and extract the j-th horizontal coordinate and the j-th vertical coordinate in the j-th coordinate position, substitute the i-th horizontal coordinate, the i-th vertical coordinate, the j-th horizontal coordinate and the j-th vertical coordinate into the spatial distance formula, and calculate the spatial distance between the i-th accident node and the j-th accident node.
[0021] In a possible design, the clustering module is also used to determine the i-th accident time corresponding to the i-th accident node, and determine the j-th accident time corresponding to the j-th accident node, respectively substitute the i-th accident time and the j-th accident time into the angle formula, calculate the i-th angle value corresponding to the i-th accident time, and the j-th angle value corresponding to the j-th accident time, input the i-th angle value and the j-th angle value into the time distance formula, and calculate the time distance corresponding to the i-th accident node and the j-th accident node.
[0022] In a possible design, the clustering module is also used to obtain the specific steps of a clustering coefficient corresponding to a clustering parameter as follows: determine the target accident node of the cluster center, and the target clustering cluster to which the target accident node belongs, calculate the first distance between the target accident node and each other accident node in the target clustering cluster, and calculate the first average distance based on all the first distances, determine the second distance between the target accident node and each accident node in other clustering clusters, and calculate the second average distance based on all the second distances, bring the first average distance and the second average distance into the preset clustering formula, and obtain the clustering coefficient corresponding to the clustering parameter.
[0023] In a possible design, the output module is specifically used to determine the accident nodes of each historical accident data in each clustering cluster, and the coordinate position corresponding to each accident node, select the starting point from each clustering cluster based on the coordinate position, connect the starting point with each accident node respectively to obtain multiple connecting lines, determine the angle between each connecting line and the preset coordinate axis along the set direction, determine the maximum angle from all the angles, use the connecting line corresponding to the maximum angle as the boundary line, and traverse all accident nodes in the clustering cluster until all the boundary lines form a closed polygon, and count the total number of accident risk values from the polygon.
[0024] In a third aspect, the present application provides an electronic device, including: Memory, used to store computer programs; The processor is used to implement the above-mentioned data processing method steps when executing the computer program stored in the memory.
[0025] In a fourth aspect, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned data processing method are implemented.
[0026] For each aspect from the first to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flowchart of the steps of a data processing method provided in this application; Figure 2 A schematic diagram of the angle between the wiring provided in this application and the preset coordinate axis; Figure 3 A schematic diagram for determining the boundary range of a cluster provided by this application; Figure 4 A schematic diagram of the structure of a data processing device provided by the present application; Figure 5 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. It should be noted that in the description of the present application, "multiple" is understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent: A is directly connected to B and A is connected to B through C. In addition, in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0029] In the previous technology, in order to prevent the occurrence of traffic accidents, historical traffic accident data corresponding to traffic sections is usually obtained, and the historical traffic accident data is clustered to obtain clustering results. In the above clustering process, traffic accident data of the same type are only clustered into one category. There are different location identifiers in the same type of traffic accident data. When the distance between location identifiers in the same type of traffic accident data is far, this group of data is only meaningful for data statistics and cannot provide a basis for preventing the occurrence of traffic accidents. If there is only one type of historical traffic data and the total amount of historical traffic data is large, it is impossible to distinguish the same type of traffic accident data, and it is impossible to extract the accident characteristics of the same type of traffic accident data, which makes the mining of traffic accident data insufficient.
[0030] In order to solve the above problems, the embodiment of the present application provides a data processing method to fully mine traffic story data. The method and device described in the embodiment of the present application are based on the same technical concept. Since the principles of the problems solved by the method and the device are similar, the embodiments of the device and the method can refer to each other, and the repeated parts will not be repeated.
[0031] The embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0032] Reference Figure 1 , the present application provides a data processing method, which can fully mine traffic accident data. The implementation process of the method is as follows: Step S1: Obtain historical accident data set.
[0033] In order to realize multi-level mining of traffic accident data in the embodiment of the present application, it is necessary to first obtain a historical accident data set from other platform databases. The historical accident data set includes various historical accident data and the coordinate positions of various historical accident data. The coordinate positions may be the longitude and latitude of the traffic accident. Since a traffic accident has occurred at each coordinate position, it is necessary to determine the accident risk value of each coordinate position. The accident risk value represents the severity of the traffic accident. The specific process of determining the accident risk value is as follows: Aggregate historical accident data according to coordinate positions, and store historical accident data at the same coordinate positions in a list. In order to obtain the severity of traffic accidents at each coordinate position, it is necessary to determine the number of traffic accidents, the number of deaths in traffic accidents, and the number of injuries in traffic accidents at each coordinate position, and bring the determined number of accidents, deaths, and injuries into the accident risk formula. The accident risk formula is as follows:
[0034] In the above formula, pts represents the accident risk value, Q represents the number of traffic accidents, D represents the number of deaths in traffic accidents, J represents the number of injuries in traffic accidents, α is the weight value of fatal accidents, and β is the weight value of injured accidents. The weight values of fatal accidents and injured accidents can be adjusted according to actual conditions.
[0035] Through the above method, the accident risk value of each coordinate position is determined, and the accident risk of each coordinate position is quantified into a parameter value, so that the accident risk of the corresponding coordinate position can be intuitively determined through the accident risk value.
[0036] Step S2: Cluster all historical accident data in the historical accident data set based on different set clustering parameters to obtain the clustering coefficients corresponding to each clustering parameter.
[0037] After determining all the historical accident data, in order to better distinguish different categories of historical accident data in the historical accident data set, all the historical accident data need to be clustered. The embodiment of the present application can adopt a density clustering algorithm (full name in English: Density-Based Spatial Clustering of Applications with Noise, abbreviated as: DBSCAN). In the clustering process, different clustering parameters correspond to different clustering effects. In order to ensure the optimal clustering effect, all historical accident data need to be clustered based on different clustering parameters. The clustering parameters include at least: a clustering radius and a minimum number of samples. The clustering radius is the radius of a circle with the cluster center as the center, and the minimum number of samples is the total number of points of all clusters in the circle corresponding to the clustering radius.
[0038] The embodiment of the present application mines historical accident data based on the time dimension and the space dimension. Since it is necessary to determine the characteristics of each accident node in the time dimension and the characteristics of each accident node in the space dimension, the clustering radius can be divided into a preset time distance in the time dimension and a preset space distance in the space dimension.
[0039] After determining the clustering radius and the minimum number of samples, take each historical accident data as an accident node, and arbitrarily select an i-th accident node from all accident nodes, where i is a positive integer and i is not greater than the total number of all accident nodes. Determine the total number of other accident nodes within the clustering radius with the i-th accident node as the center. If the total number is greater than the minimum number of samples, take the i-th accident node as the clustering center, and continue to judge whether other accident nodes within the clustering radius can be used as clustering centers. If the total number value is less than the minimum number of samples, judge whether accident nodes in other clusters can be used as clustering centers. If all accident nodes in the current cluster do not meet the above conditions for the accident node to be the clustering center, the current cluster stops expanding, and looks for accident nodes that do not belong to any cluster, and restarts to judge whether it is the clustering center until all accident nodes are traversed.
[0040] The embodiment of the present application can also calculate the time distance and space distance between the ith accident node and the jth accident node, where j is a positive integer and is not greater than the total number of all accident nodes. The ith accident node and the jth accident node are different accident nodes. When the time distance is less than the preset time distance and the space distance is less than the preset space distance, the total number of accident nodes within the clustering radius is counted. When the total number is higher than the minimum number of samples, the ith accident node is used as the clustering center, and it is continued to be judged whether other accident nodes within the clustering radius can be used as clustering centers. If the total number value is less than the minimum number of samples, it is judged whether accident nodes in other clustering clusters can be used as clustering centers. If all accident nodes in the current clustering cluster do not meet the above conditions for the accident node to be the clustering center, the current clustering cluster stops expanding, and searches for accident nodes that do not belong to any clustering cluster, and restarts to judge whether it is the clustering center until all accident nodes are traversed.
[0041] Specifically, in order to calculate the time distance and the space distance, it is necessary to determine the i-th horizontal coordinate and the i-th vertical coordinate of the i-th coordinate position, as well as determine the j-th horizontal coordinate and the j-th vertical coordinate of the j-th coordinate position. If the coordinate position is longitude and latitude, it is necessary to convert the longitude and latitude into coordinate points in the plane rectangular coordinate system. Since the process of calculating the time distance between two accident nodes is the same, and the process of calculating the space distance between two accident nodes is the same, therefore, in the embodiment of the present application, the calculation of the time distance and the space distance between the i-th accident node and the j-th accident node is used as an example for explanation.
[0042] After determining the i-th horizontal coordinate, the i-th vertical coordinate, the j-th horizontal coordinate, and the j-th vertical coordinate, the i-th horizontal coordinate, the i-th vertical coordinate, the j-th horizontal coordinate, and the j-th vertical coordinate are substituted into the spatial distance formula. The spatial distance formula is as follows:
[0043] In the above spatial distance formula, represents the spatial distance between the i-th accident node and the j-th accident node, represents the i-th horizontal coordinate, represents the i-th vertical coordinate, represents the j-th horizontal coordinate, and represents the j-th vertical coordinate.
[0044] In order to determine the time distance, in the embodiment of the present application, 12 months are equally divided into a 360° circle, and each month occupies an angle range of 30°. Thus, the accident node can be recorded on the circumference according to the time when the accident occurred. In the embodiment of the present application, the following angle formula can be used to calculate the angle value of the accident node on the circumference. The specific angle formula is as follows:
[0045] In the above angle formula, Represents the month in which the historical accident data corresponding to the accident node occurred. Represents the date on which the historical accident data corresponding to the accident node occurred. When the historical accident data corresponding to the accident node occurs, Represents the points where the historical accident data corresponding to the accident node occurred. Represents the second when the historical accident data corresponding to the accident node occurred. Represents the total number of seconds corresponding to a day, Represents the total number of seconds corresponding to an hour. Represents the total number of seconds in a minute and the total number of days in the current month.
[0046] After determining the angle value corresponding to the accident node on the circumference, the angle value is substituted into the time distance formula. The embodiment of the present application is explained by calculating the time distance between the i-th accident node and the j-th accident node. The time distance formula is as follows:
[0047] In the above time distance formula, represents the i-th angle value, represents the jth angle value, Represents the time distance between the i-th accident node and the j-th accident node. The time distance characterizes the gap between the i-th accident node and the j-th accident node in the time dimension. The method for calculating the time distance between other accident nodes can be found in the above example and will not be elaborated on here.
[0048] Through the above method, all accident nodes are presented on the circumference based on the time dimension, so that the angle value is determined based on the position of the accident node on the circumference, and the historical accident data is mined based on the time dimension.
[0049] Since the process of clustering all historical accident data based on each clustering parameter is consistent, the clustering process of historical accident data is only described once in the embodiment of the present application, and the process of clustering all historical accident data based on other clustering parameters refers to the above description.
[0050] After clustering all historical accident data based on the clustering parameters, the clustering coefficient corresponding to the current clustering parameters is determined. The larger the clustering coefficient is, the better the clustering effect based on the current clustering parameters is, that is, the features of the historical accident data in the same cluster are highly offset, and the features of the historical accident data in different clusters have obvious differences. The features can be the time features, spatial features, etc. of the historical accident data. The features can be added according to the actual situation and are not explained in detail here.
[0051] Specifically, the specific process of determining the clustering coefficient corresponding to the current clustering parameters is as follows: Determine the accident node at the cluster center, take the accident node as the target accident node, and determine the target cluster to which the target accident node belongs, calculate the first distance between the target accident node and each accident node in the target cluster, add all the first distances to obtain the first total distance, determine the first total number of accident nodes in the target cluster, calculate the first ratio between the first total distance and the first total number, and use the first ratio as the first average distance.
[0052] Determine other clustering clusters outside the target clustering cluster, and determine the second distance between the target accident node and each accident node in the other clustering clusters, add all the second distances to obtain the second total distance, then determine the second total number of the target accident node and all accident nodes in the other clustering clusters, calculate the second ratio between the second total distance and the second total number, and use the second ratio as the second average distance.
[0053] It should be noted that in the embodiment of the present application, the second average distance between the target cluster and one of the other clusters may be calculated to obtain multiple second average distances, and then the smallest second average distance may be selected.
[0054] After determining the first average distance and the second average distance, the first average distance and the second average distance are brought into a preset clustering formula, which is as follows:
[0055] In the above preset clustering formula, represents the first average distance, represents the second mean distance, Represents the clustering coefficient.
[0056] Through the above method, all historical accident data are clustered based on multiple clustering parameters, and the corresponding clustering coefficient after each clustering is obtained, which ensures that the clustering effect can be judged based on the clustering coefficient and can improve the clustering effect of historical accident data.
[0057] Step S3: Filter out the maximum clustering coefficient from all clustering coefficients, and determine the clustering cluster corresponding to the historical accident data set corresponding to the maximum clustering coefficient.
[0058] After determining the clustering coefficients corresponding to different clustering parameters, all clustering coefficients are arranged in order from large to small, the maximum clustering coefficient is screened out, and the cluster cluster corresponding to the maximum clustering coefficient is used as the cluster cluster after clustering all historical accident data.
[0059] Through the above method, the cluster corresponding to the maximum clustering coefficient is determined, ensuring that the cluster with the best clustering effect can be accurately screened out.
[0060] Step S4: Count the total number of accident risk values in each cluster, and output the cluster whose total number value is greater than the total number threshold as the clustering result.
[0061] After determining the cluster corresponding to the maximum clustering coefficient, in order to determine the boundary line of each cluster, it is necessary to obtain the horizontal and vertical coordinates of the coordinate position of each accident node, select the accident node corresponding to the largest vertical coordinate from all accident nodes, and then select the accident node corresponding to the smallest horizontal coordinate from the accident nodes corresponding to the largest vertical coordinate, and use the accident node as the starting point.
[0062] In order to determine the boundary range corresponding to the cluster, it is necessary to connect the starting point with each accident node to obtain multiple connecting lines, and determine the angle between each connecting line and the preset coordinate axis along the set direction. The preset coordinate axis can be the horizontal axis in the rectangular coordinate system. The schematic diagram of the angle between the connecting line and the preset coordinate axis is shown in Figure 2 As shown, in Figure 2 In , the angles between the starting point and the three accident nodes are recorded. The angles are the angles between the clockwise direction and the preset coordinate axis. Therefore, the angle between the starting point and accident node 1 is the first angle, the angle between the starting point and accident node 2 is the second angle, and the angle between the starting point and accident node 3 is the third angle. The largest angle is the first angle. The process of determining other angles can be referred to the above example and will not be explained in detail here.
[0063] After the angle is determined, the maximum angle is selected from all the angles, and the connecting line corresponding to the maximum angle is used as a boundary line. Then, the accident node corresponding to the maximum angle is used as the starting point. The above process is repeated to determine multiple boundary lines in sequence until all boundary lines form a closed polygon, thereby determining the boundary range corresponding to the cluster, that is, the polygon. The schematic diagram of determining the boundary range of the cluster in the embodiment of the present application is as follows Figure 3 As shown, in Figure 3 In the example, if the angle between the initial starting point and the connecting line between accident node 1 is the largest, an edge is determined to be the connecting line between the starting point and accident node 1. At this time, accident node 1 is taken as the starting point, and the angle between accident node 1 and accident node 2 is determined to be the largest. Then the second edge is determined to be the connecting line between accident node 1 and accident node 2, and accident node 2 is taken as the starting point. The traversal is performed according to the above-described process until the connecting line determined by accident node 4 coincides with the initial starting point. Thus, the determined pentagon is the boundary range of the cluster, which is only used as an example here.
[0064] Furthermore, the accident risk values of all accident nodes in the boundary range are determined, and all accident risk values corresponding to the boundary range are added together to obtain a total quantity value. When the total quantity value is greater than the total quantity threshold, the clustering cluster corresponding to the boundary range is output as the clustering result.
[0065] The embodiment of the present application may further sort the total quantity values corresponding to each boundary range, and output the clusters greater than the total quantity threshold in order of the total quantity values from large to small, so as to obtain a clustering result.
[0066] Based on the above description, historical accident data are clustered based on the time dimension and the space dimension during clustering, and the clustering cluster with the best clustering effect is screened out based on the clustering coefficient, and the clustering results are output to achieve full mining of historical accident data. In addition, the clustering results take into account the accident risk value, the time of the accident, and the coordinate location of the accident, which is conducive to road safety analysis of the clustering results.
[0067] Based on the same inventive concept, a data processing device is also provided in the embodiment of the present application. The data processing device is used to implement the function of a data processing method. Figure 4 , the device comprises: An acquisition module 401 is used to obtain a historical accident data set, wherein each historical accident data in the historical accident data set includes a corresponding coordinate position and an accident risk value corresponding to each coordinate position; A clustering module 402 is used to cluster all the historical accident data in the historical accident data set based on different set clustering parameters to obtain clustering coefficients corresponding to each clustering parameter, wherein the clustering coefficients are used to evaluate the clustering effect; A screening module 403 is used to screen out a maximum clustering coefficient from all clustering coefficients, and determine a cluster corresponding to the historical accident data set corresponding to the maximum clustering coefficient; The output module 404 is used to count the total quantity of accident risk values in each cluster, and output the clusters whose total quantity values are greater than the total quantity threshold as clustering results.
[0068] In a possible design, the clustering module 402 is specifically used to perform the following steps of clustering all historical accident data in the historical accident data set according to a clustering parameter: extracting the clustering radius and the minimum number of samples in the clustering parameter, and determining the accident nodes corresponding to each historical accident data, determining and calculating the i-th accident node and the j-th accident node from all accident nodes, and calculating the time distance and space distance between the i-th accident node and the j-th accident node; when the time distance is lower than the preset time distance, and the space distance is lower than the preset space distance, determining the total number of accident nodes within the current clustering radius with the i-th accident node as the clustering center; when the total number is higher than the minimum number of samples, clustering the i-th accident node as a clustering center.
[0069] In a possible design, the clustering module 402 is also used to determine the i-th coordinate position corresponding to the i-th accident node, and determine the j-th coordinate position corresponding to the j-th accident node, extract the i-th horizontal coordinate and the i-th vertical coordinate in the i-th coordinate position, and extract the j-th horizontal coordinate and the j-th vertical coordinate in the j-th coordinate position, substitute the i-th horizontal coordinate, the i-th vertical coordinate, the j-th horizontal coordinate and the j-th vertical coordinate into the spatial distance formula, and calculate the spatial distance between the i-th accident node and the j-th accident node.
[0070] In a possible design, the clustering module 402 is also used to determine the i-th accident time corresponding to the i-th accident node, and determine the j-th accident time corresponding to the j-th accident node, respectively substitute the i-th accident time and the j-th accident time into the angle formula, calculate the i-th angle value corresponding to the i-th accident time, and the j-th angle value corresponding to the j-th accident time, input the i-th angle value and the j-th angle value into the time distance formula, and calculate the time distance between the i-th accident node and the j-th accident node.
[0071] In a possible design, the clustering module 402 is also used to obtain the specific steps of a clustering coefficient corresponding to a clustering parameter as follows: determine the target accident node of the cluster center, and the target clustering cluster to which the target accident node belongs, calculate the first distance between the target accident node and each other accident node in the target clustering cluster, and calculate the first average distance based on all the first distances, determine the second distance between the target accident node and each accident node in other clustering clusters, and calculate the second average distance based on all the second distances, bring the first average distance and the second average distance into the preset clustering formula to obtain the clustering coefficient corresponding to the clustering parameter.
[0072] In one possible design, the output module 404 is specifically used to determine the accident nodes of each historical accident data in each clustering cluster, and the coordinate position corresponding to each accident node, select the starting point from each clustering cluster based on the coordinate position, connect the starting point with each accident node respectively to obtain multiple connecting lines, determine the angle between each connecting line and the preset coordinate axis along the set direction, determine the maximum angle from all the angles, use the connecting line corresponding to the maximum angle as the boundary line, and traverse all accident nodes in the clustering cluster until all the boundary lines form a closed polygon, and count the total number of accident risk values from the polygon.
[0073] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the electronic device can realize the functions of the aforementioned data processing device, referring to Figure 5 , the electronic device comprises: At least one processor 501, and a memory 502 connected to the at least one processor 501. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 In the example, the processor 501 and the memory 502 are connected via a bus 500. The bus 500 is Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 500 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller, and there is no limitation on the name.
[0074] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 can execute a data processing method discussed above by executing the instructions stored in the memory 502. The processor 501 can implement Figure 4The functions of each module in the device shown.
[0075] Among them, the processor 501 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 502 and calling data stored in the memory 502, the various functions of the device and processing data, the device can be monitored as a whole.
[0076] In one possible design, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.
[0077] Processor 501 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of a data processing method disclosed in the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.
[0078] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0079] By programming the processor 501, the code corresponding to the data processing method described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 1 A data processing step of the embodiment shown. How to design and program the processor 501 is a technique known to those skilled in the art and will not be described in detail here.
[0080] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes a data processing method discussed above.
[0081] In some possible implementations, various aspects of a data processing method provided by the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on an apparatus, the program code is used to enable the control device to execute the steps of a data processing method according to various exemplary implementations of the present application described above in this specification.
[0082] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0083] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0084] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0085] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0086] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A data processing method, characterized in that: The method includes: Obtaining a historical accident data set, wherein each historical accident data in the historical accident data set includes a corresponding coordinate position and an accident risk value corresponding to each coordinate position; Clustering all the historical accident data in the historical accident data set based on different set clustering parameters to obtain clustering coefficients corresponding to each clustering parameter, wherein the clustering coefficients are used to evaluate the clustering effect; Screening out a maximum clustering coefficient from all clustering coefficients, and determining a clustering cluster corresponding to the historical accident data set corresponding to the maximum clustering coefficient; The total number of accident risk values in each cluster is counted, and the clusters whose total number values are greater than the total number threshold are output as clustering results.
2. The method according to claim 1, characterized in that The clustering of all the historical accident data in the historical accident data set based on different set clustering parameters includes: The specific steps of clustering all the historical accident data in the historical accident data set for one clustering parameter are as follows: Extracting the clustering radius and the minimum number of samples from the clustering parameters, and determining the accident nodes corresponding to each of the historical accident data; Determine and calculate the i-th accident node and the j-th accident node from all accident nodes, and calculate the time distance and space distance between the i-th accident node and the j-th accident node, wherein both i and j are positive integers, and i is not equal to j; When the time distance is lower than the preset time distance, and the space distance is lower than the preset space distance, determining the total number of accident nodes within the current clustering radius with the i-th accident node as the cluster center; When the total number is greater than the minimum sample number, the i-th accident node is clustered as a cluster center.
3. The method according to claim 2, characterized in that The calculating the spatial distance between the i-th accident node and the j-th accident node includes: Determine the i-th coordinate position corresponding to the i-th accident node, and determine the j-th coordinate position corresponding to the j-th accident node; Extracting the i-th horizontal coordinate and the i-th vertical coordinate in the i-th coordinate position, and extracting the j-th horizontal coordinate and the j-th vertical coordinate in the j-th coordinate position; Substitute the i-th horizontal coordinate, the i-th vertical coordinate, the j-th horizontal coordinate and the j-th vertical coordinate into the spatial distance formula to calculate the spatial distance between the i-th accident node and the j-th accident node.
4. The method according to claim 2, characterized in that The calculating the time distance between the i-th accident node and the j-th accident node includes: Determine the i-th accident time corresponding to the i-th accident node, and determine the j-th accident time corresponding to the j-th accident node; Substitute the i-th accident time and the j-th accident time into the angle formula respectively, and calculate the i-th angle value corresponding to the i-th accident time and the j-th angle value corresponding to the j-th accident time, wherein the angle value is the angle on the circumference determined based on the accident time; The i-th angle value and the j-th angle value are input into the time distance formula to calculate the time distance corresponding to the i-th accident node and the j-th accident node, wherein the time distance represents the gap between the i-th accident node and the j-th accident node in the time dimension.
5. The method according to claim 1, characterized in that The obtaining of the clustering coefficients corresponding to the respective clustering parameters includes: The specific steps to obtain the clustering coefficient corresponding to a clustering parameter are as follows: Determine a target accident node at the cluster center and a target cluster to which the target accident node belongs; Calculating a first distance between the target accident node and each other accident node in the target cluster, and calculating a first average distance based on all the first distances; Determine a second distance between the target accident node and each accident node in other clusters, and calculate a second average distance based on all the second distances; The first average distance and the second average distance are brought into a preset clustering formula to obtain a clustering coefficient corresponding to the clustering parameter.
6. The method according to claim 1, characterized in that The total number of accident risk values in each cluster is calculated, including: Determine the accident nodes of each historical accident data in each cluster, and the coordinate positions corresponding to each accident node; Selecting a starting point from each cluster based on the coordinate position, and connecting the starting point to each accident node to obtain a plurality of connecting lines; Determine the angle between each connecting line and the preset coordinate axis along the set direction, and determine the maximum angle from all the angles; The connecting line corresponding to the maximum angle is used as the boundary line, and all accident nodes in the cluster are traversed until all the boundary lines form a closed polygon, and the total number of accident risk values is counted from the polygon.
7. A data processing device, characterized in that: The device includes: An acquisition module is used to obtain a historical accident data set, wherein each historical accident data in the historical accident data set includes a corresponding coordinate position and an accident risk value corresponding to each coordinate position; A clustering module, used to cluster all the historical accident data in the historical accident data set based on different set clustering parameters, and obtain the clustering coefficients corresponding to the respective clustering parameters, wherein the clustering coefficients are used to evaluate the clustering effect; A screening module, used to screen out a maximum clustering coefficient from all clustering coefficients, and determine a clustering cluster corresponding to the historical accident data set corresponding to the maximum clustering coefficient; The output module is used to count the total number of accident risk values in each cluster, and output the clusters whose total number values are greater than the total number threshold as clustering results.
8. The device according to claim 7, characterized in that The clustering module is specifically used to cluster all historical accident data in the historical accident data set according to a clustering parameter. The specific steps are as follows: extract the clustering radius and the minimum number of samples in the clustering parameter, and determine the accident nodes corresponding to each historical accident data, determine and calculate the i-th accident node and the j-th accident node from all accident nodes, and calculate the time distance and space distance between the i-th accident node and the j-th accident node. When the time distance is lower than the preset time distance, and the space distance is lower than the preset space distance, determine the total number of accident nodes within the current clustering radius with the i-th accident node as the clustering center. When the total number is higher than the minimum number of samples, cluster the i-th accident node as a clustering center.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing the computer program stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Traffic accident early warning method and device, terminal equipment and storage medium
CN111815986A
Traffic accident site clustering method and system
CN112052908A
Expressway traffic accident black spot road section identification method and computer device
CN115424430A
Urban core area determination method, apparatus and device, and storage medium
CN115511343A
Automatic driving accident occurrence mechanism analysis method based on clustering model
CN116484244A
