Method and device for acquiring road traffic state and server
1. A method for acquiring a road traffic state comprises the following steps:
acquiring historical traffic flow data of a road within a preset time length from the current moment;
in the historical traffic flow data of the road, determining an observation window where a specified first detection moment is located and at least one corresponding historical window; the first detection moment is the current moment or the moment adjacent to the current moment; the time length of the history window is the same as that of the observation window, and the history window is earlier than that of the observation window;
determining whether the flow of the road at the first detection moment is abnormal or not according to the comparison result of the flow sum in the observation window and the flow sum in the at least one historical window;
and when the flow of the road at the first detection moment is determined to be abnormal, determining that the current traffic state of the road is abnormal.
2. The method of claim 1, further comprising:
when the road at the first detection moment is determined to be abnormal, sliding the observation window to enable the sliding observation window to comprise a second detection moment, determining whether the flow of the road at the second detection moment is abnormal or not according to a comparison result of the flow sum of the sliding observation window and the at least one historical window, and repeating the process until the flow of the road is determined to be normal; the second detection time is a detection time which is earlier than the first detection time in the historical road traffic flow data;
and determining the time interval from the last second detection time under the road abnormal condition to the first detection time under the road abnormal condition as the time interval when the road state is abnormal.
3. The method of claim 2, sliding the observation window, comprising:
and moving the observation window forwards for one or more unit time corresponding to the first detection time.
4. The method of claim 2, until after determining that the flow of the road is normal, the method further comprising:
determining the flow abnormal degree value at the first detection moment and each second detection moment according to the flow in the observation window and the change rate of the flow sum relative to each historical window;
and accumulating the flow abnormal degree values at the first detection time and all the second detection times to obtain the flow abnormal degree value of the time interval of the road with the flow abnormality.
5. The method of claim 1, determining an observation window in which the first detection time is located, comprising:
determining a time window with preset duration at the tail end of the first detection moment as the observation window;
the determining at least one history window corresponding to the detection time includes:
an odd number of history windows are randomly selected from before the observation window.
6. The method of claim 1 or 2, wherein the history window is one, and determining whether the traffic of the road at the first detection time or the second detection time is abnormal according to the comparison result of the traffic sum in the observation window and the history window comprises:
determining the flow rate in the observation window and the change rate relative to the flow rate sum in the history window according to the flow rate sum in the observation window and the flow rate sum in the history window;
and when the change rate is smaller than a preset change rate threshold value, determining that the road at the detection moment is abnormal.
7. The method as claimed in claim 1 or 2, wherein the history window is multiple, and determining whether the traffic of the road at the first detection time or the second detection time is abnormal according to the comparison result of the traffic sums in the observation window and the at least one history window comprises:
for each historical window, determining the flow sum in the observation window and the change rate of the flow sum relative to each historical window respectively according to the flow sum in the observation window and the flow sum in the historical window;
and when determining that the flow rate in the observation window and the change rate of the flow rate sum in the history window which is more than half of all the history windows are smaller than a preset change rate threshold value, determining that the road flow rate at the first detection time or the second detection time is abnormal.
8. The method of any of claims 1-5, wherein the duration of the history window and the observation window is predetermined by:
traversing a plurality of assumed values of the preset time length, and sequentially determining the ratio of the absolute value of the difference between the flow sum of the historical window and the observation window to the assumed value under each assumed value;
and selecting the assumed value when the ratio is minimum as the time length of the historical window and the observation window.
9. An apparatus for acquiring a road traffic state, comprising:
the acquisition module is used for acquiring historical traffic flow data of a road within a preset time length from the current moment;
the historical window determining module is used for determining an observation window where a specified first detection moment is located and at least one corresponding historical window in the historical road traffic flow data; the first detection moment is the current moment or the moment adjacent to the current moment; the time length of the history window is the same as that of the observation window, and the history window is earlier than that of the observation window;
the flow abnormity determining module is used for determining whether the flow of the road at the first detection moment is abnormal according to the comparison result of the flow sum in the observation window and the flow sum in at least one historical window;
and the road state determining module is used for determining that the current traffic state of the road is abnormal when the flow abnormity determining module determines that the flow of the road at the first detection moment is abnormal.
10. A road traffic status monitoring server, comprising: a memory and a processor; wherein the memory stores a computer program which, when executed by the processor, is capable of implementing the method of obtaining a road traffic status according to any one of claims 1-8.
11. A computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the method of obtaining a road traffic status according to any one of claims 1-8.
Background
There are various reasons for causing the road condition abnormality, wherein the dynamic events of the road (such as road closure, road construction, traffic accidents, etc.) are the main aspects causing the road flow abnormality, and the real-time traffic flow is the basic dynamic attribute for measuring whether the state of one road is abnormal or not. Therefore, when a dynamic event occurs on the road, the real-time traffic flow is abnormally changed, and the road flow abnormality mainly causes the flow of the road to be reduced, namely the traffic state of the road is abnormal. Based on this, whether the road is abnormal can be effectively judged by detecting the abnormal degree of the real-time traffic flow.
At present, the following two methods mainly exist in the method for detecting the road abnormity:
first, road anomaly detection based on intelligence information. Information personnel (such as a traffic bureau, a government, new media, users and the like) can report the collected traffic information after the real-time traffic flow is abnormal. After manual review, whether the road is abnormal or not can be effectively judged.
The efficiency of obtaining traffic information through road abnormity detection based on information is low, and the obtained traffic information can be checked manually to finally judge whether the road is abnormal, so that the operation cost is very high.
Second, an automatic anomaly detection method is a road anomaly detection method based on a statistical method, and if real-time traffic flow is counted in units of days, the mean and variance of the real-time traffic flow of the road in several days are counted in advance. The mean value represents the real-time traffic flow level of the whole road, and the variance represents the fluctuation of the real-time traffic flow relative to the mean value every day. If the real-time traffic flow fluctuation of a road on a certain day is larger than n times of variance (in practical application, the value of n is usually set to be 2 or 3), the real-time traffic flow of the road on the same day is abnormal, and the road can be judged to be abnormal on the same day.
Although the problem of low efficiency of acquiring traffic information is solved to a certain extent by road anomaly detection based on a statistical method, because whether anomalies occur in the time granularity range is judged by fixed granularity (such as days), often, in a day, because the daily real-time traffic flow of roads is not an ideal mean distribution, the fluctuation of the real-time traffic flow of roads in each day may be very large, and it is difficult to detect that the fluctuation is caused by the anomalies of the roads, and what are not, the anomalies of roads with smaller time granularity or the anomalies of roads with cross-time granularity cannot be found in a mode of judging according to the fixed time granularity, so that the roads which really have dynamic events cannot be accurately judged, and the accuracy of road anomaly detection is low.
Therefore, how to efficiently, accurately and economically detect whether a dynamic event occurs on a road becomes an urgent problem to be solved.
Disclosure of Invention
In view of the above, the present disclosure is proposed to provide a method, an apparatus and a server for acquiring a road traffic state that overcome the above problems or at least partially solve the above problems.
In a first aspect, an embodiment of the present disclosure provides a method for acquiring a road traffic state, including:
acquiring historical traffic flow data of a road within a preset time length from the current moment;
in the historical traffic flow data of the road, determining an observation window where a specified first detection moment is located and at least one corresponding historical window; the first detection moment is the current moment or the moment adjacent to the current moment; the time length of the history window is the same as that of the observation window, and the history window is earlier than that of the observation window;
determining whether the flow of the road at the first detection moment is abnormal or not according to the comparison result of the flow sum in the observation window and the flow sum in the at least one historical window;
and when the flow of the road at the first detection moment is determined to be abnormal, determining that the current traffic state of the road is abnormal.
In one embodiment, the method further comprises:
when the road at the first detection moment is determined to be abnormal, sliding the observation window to enable the sliding observation window to contain a second detection moment, determining whether the road at the second detection moment is abnormal or not according to a comparison result of the flow sum of the sliding observation window and the at least one historical window, and repeating the process until the road is determined to be normal; the second detection time is a detection time which is earlier than the first detection time in the historical road traffic flow data;
and determining the time interval from the last second detection time under the road abnormal condition to the first detection time under the road abnormal condition as the time interval when the road state is abnormal.
In one embodiment, the sliding the observation window comprises:
and moving the observation window forwards for one or more unit time corresponding to the first detection time.
In one embodiment, until after determining that the flow rate of the road is normal, the method further comprises:
determining the flow abnormal degree value at the first detection moment and each second detection moment according to the flow in the observation window and the change rate of the flow sum relative to each historical window;
and accumulating the flow abnormal degree values at the first detection time and all the second detection times to obtain the flow abnormal degree value of the time interval of the road with the flow abnormality.
In one embodiment, determining the observation window in which the first detection time is located includes:
determining a time window with preset duration at the tail end of the first detection moment as the observation window;
the determining at least one history window corresponding to the detection time includes:
an odd number of history windows are randomly selected from before the observation window.
In one embodiment, if there are a plurality of history windows, determining whether the traffic of the road at the first detection time or the second detection time is abnormal according to the comparison result of the traffic sums in the observation window and the at least one history window includes:
for each historical window, determining the flow sum in the observation window and the change rate of the flow sum relative to each historical window respectively according to the flow sum in the observation window and the flow sum in the historical window;
and when determining that the flow rate in the observation window and the change rate of the flow rate sum in the history window which is more than half of all the history windows are smaller than a preset change rate threshold value, determining that the road flow rate at the first detection time or the second detection time is abnormal.
In one embodiment, the durations of the history window and the observation window are predetermined by:
traversing a plurality of assumed values of the preset time length, and sequentially determining the ratio of the absolute value of the difference between the flow sum of the historical window and the observation window to the assumed value under each assumed value;
and selecting the assumed value when the ratio is minimum as the time length of the historical window and the observation window.
In a second aspect, an embodiment of the present disclosure provides an apparatus for acquiring a road traffic state, including:
the acquisition module is used for acquiring historical traffic flow data of a road within a preset time length from the current moment;
the historical window determining module is used for determining an observation window where a specified first detection moment is located and at least one corresponding historical window in the historical road traffic flow data; the first detection moment is the current moment or the moment adjacent to the current moment; the time length of the history window is the same as that of the observation window, and the history window is earlier than that of the observation window;
the flow abnormity determining module is used for determining whether the flow of the road at the first detection moment is abnormal according to the comparison result of the flow sum in the observation window and the flow sum in at least one historical window;
and the road state determining module is used for determining that the current traffic state of the road is abnormal when the flow abnormity determining module determines that the flow of the road at the first detection moment is abnormal.
In a third aspect, an embodiment of the present disclosure provides a road traffic state monitoring server, including: a memory and a processor; wherein the memory stores a computer program which, when executed by the processor, is capable of implementing the method for obtaining the road traffic status.
In a fourth aspect, the disclosed embodiments provide a computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the method for acquiring the road traffic status is implemented.
The beneficial effects of the above technical scheme provided by the embodiment of the present disclosure at least include:
the method, the device and the server for acquiring the road traffic state acquire historical traffic flow data of a road in a preset time period before the current time, determine an observation window and at least one corresponding history window where the current time or the time adjacent to the current time is located in the acquired historical traffic flow data of the road, determine whether the current traffic of the road is abnormal or not according to the comparison result of the flow sum of the observation window and the history window, and further determine whether the traffic state of the road is abnormal or not. In addition, the method for acquiring the road traffic state provided by the disclosure has the advantages that observation windows and history windows with different time granularities are arranged according to roads with different flow rates, whether flow rate abnormality occurs at each moment of the roads can be sequentially detected with smaller time granularity, and thus, a time period formed by all moments with abnormal flow rates can be finally obtained, the time period can truly reflect the abnormal condition of the actual roads, various problems caused by detection according to fixed time granularity in the prior art can be avoided, and the accuracy of road abnormality detection is greatly improved.
On the other hand, when the road at the first detection time is determined to be abnormal, the observation window is continuously slid, whether the road at the previous detection time before the detection time is abnormal or not is continuously determined, and the operation is repeated until the road is determined to be normal; and determining the time interval from the last second detection time to the first detection time under the condition of road abnormity as the time interval when the road state is abnormal. The method for acquiring the road traffic state provided by the disclosure can not only determine whether the current road traffic is abnormal in real time, but also determine the accurate time period during which the traffic is abnormal, and the time period can truly reflect the condition of the actual road abnormality, thereby avoiding various problems caused by detection according to fixed time granularity in the prior art and greatly improving the accuracy of road abnormality detection.
In addition, the scheme of the embodiment of the disclosure can not only detect whether the road is abnormal, but also determine the time interval of the road with the abnormality and the degree value of the road with the abnormality, and determine the severity of the road abnormality according to the time interval and the degree value. Therefore, after the scheme is adopted to monitor the real-time traffic flow of the road, the capability of actively finding the abnormal road can be greatly improved, the problem of insufficient accuracy rate caused by fluctuation of the real-time traffic flow is greatly improved, and the abnormal road can be more quickly and accurately positioned. In addition, the implementation of this scheme does not need a large amount of manual works, can save a large amount of cost of labor, can reduce the influence of the human factor in the road anomaly detection process simultaneously.
Additional features and advantages of the disclosure will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the disclosure. The objectives and other advantages of the disclosure may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
The technical solution of the present disclosure is further described in detail by the accompanying drawings and examples.
Drawings
The accompanying drawings are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the principles of the disclosure and not to limit the disclosure. In the drawings:
fig. 1 is a flowchart of a method for acquiring a traffic status of a channel in an embodiment of the disclosure;
FIG. 2 is a schematic diagram of an example of historical traffic flow data for a roadway according to one embodiment of the present disclosure;
fig. 3 is a schematic diagram of an observation window and a history window where a first detection time is located in a first embodiment of the disclosure;
FIG. 4 is a schematic diagram illustrating fluctuations in historical traffic flow data according to a first embodiment of the disclosure;
FIG. 5 is a flowchart illustrating determining durations of an observation window and a history window according to a first embodiment of the disclosure;
fig. 6 is a flowchart illustrating a process of determining a time interval when a traffic state abnormality occurs on a road according to a first embodiment of the disclosure;
fig. 7A is a schematic diagram illustrating an example of a method for a channel traffic status according to a second embodiment of the disclosure;
fig. 7B is a schematic diagram of another example of a method for a channel traffic status in a second embodiment of the disclosure;
fig. 8 is a block diagram of a channel pass-through state device in the embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The first embodiment is as follows:
the embodiment of the present disclosure provides a method for acquiring a road traffic status, a flow of which is shown in fig. 1, and the method includes the following steps:
s11, acquiring historical traffic flow data of the road within a preset time period from the current moment to the front;
s12, determining an observation window where the specified first detection moment is located and at least one corresponding history window in the historical road traffic flow data; the first detection moment is the current moment or the adjacent moment of the current moment; the time length of the history window is the same as that of the observation window, and the history window is earlier than that of the observation window;
and S13, determining whether the flow of the road at the first detection moment is abnormal according to the comparison result of the flow sum in the observation window and the flow sum in at least one historical window. When it is determined that the road at the first detection time is abnormal, performing step S14; otherwise, go to step S15;
s14, determining that the current traffic state of the road is abnormal;
and S15, ending the current flow.
The method for obtaining the road traffic status provided by the embodiment of the disclosure obtains the historical traffic flow data of the road within the preset time period from the current time, determines the observation window and the corresponding at least one history window at the current time or the time adjacent to the current time in the obtained historical traffic flow data of the road, then determines whether the current traffic flow of the road is abnormal or not according to the comparison result of the flow sum of the observation window and the history windows, and further determines whether the traffic status of the road is abnormal or not, and the embodiment of the disclosure can realize real-time tracking of the historical traffic flow data of the road within the preset time period from the current time, and further determine the traffic status of the current road in real time, without acquiring abnormal information of the road in a manual manner or determining whether the road is abnormal or not only within a longer and fixed time granularity as in the prior art, in addition, the method for acquiring the road traffic state provided by the disclosure has the advantages that observation windows and history windows with different time granularities are arranged according to roads with different flow rates, whether flow rate abnormality occurs at each moment of the roads can be sequentially detected with smaller time granularity, and thus, a time period formed by all moments with abnormal flow rates can be finally obtained, the time period can truly reflect the abnormal condition of the actual roads, various problems caused by detection according to fixed time granularity in the prior art can be avoided, and the accuracy of road abnormality detection is greatly improved.
The above-described flow is described in detail below.
In step S11, historical traffic flow data of a preset time before the current time is obtained for the road that needs to be monitored for flow anomaly, where the historical traffic flow data of the road includes historical traffic flow data of multiple roads in a road network, and the historical traffic flow data of one or multiple roads included in the historical traffic flow data can be selected according to the requirement for subsequent processing.
An example of historical traffic flow data within a preset time period of a road is shown in fig. 2, wherein a horizontal axis represents a time axis formed by a plurality of moments, and the time axis sequentially corresponds to the time sequence from left to right, namely the time is earlier the farther the left is, and the time is later the opposite is. The vertical axis represents the historical flow rate at each time.
For a road, if it is desired to determine whether the road is abnormal, for example, whether the traffic of the road changes significantly at the current time or at a time adjacent to the current time may be determined by comparing the traffic data with the historical traffic flow data, so as to determine whether the traffic of the road changes significantly at the current time, that is, determine that the road is abnormal.
In the embodiment of the present disclosure, the detection time may be a time point, or may be a very small time period, that is, a unit time of a preset duration. Since the collection of the historical flow data may be a continuous collection of one unit of time (e.g., 5 minutes) and one unit of time, the detection time may also be a time period composed of several continuous time points.
The duration of the first detection moment is unit time of preset duration. The preset time duration can be flexibly set according to specific conditions, different roads can be selected differently, for example, the preset time duration can be determined according to the magnitude of the road flow, and as different roads have different flow rates, for a road with high flow rate, the flow rate passing through the road within a short time duration (such as 1 hour, 10 minutes and the like) is already high, and the possibility of abnormal fluctuation of the flow rate is increased, so the time duration of the unit time can be set to be shorter, for example, 10 minutes, even 5 minutes; for low traffic roads, the duration of this unit of time may be set slightly longer. If the time length of the unit time is set to be too large, the time period in which the abnormal fluctuation actually occurs cannot be accurately positioned, and if the time length of the unit time is set to be too small, the problem of increased calculated amount may be caused, so that the conditions such as road flow data, calculation capacity and calculation time requirements can be selected comprehensively.
When determining whether the road at the first detection time is abnormal, firstly, determining an observation window where the first detection time is located and a history window for comparison. The observation window in which the first detection time is located is a time window with a preset duration in which the first detection time is located at the tail end, as shown in fig. 3, a horizontal axis in fig. 3 is a time axis, and the time sequence sequentially corresponds from left to right, that is, the time is earlier the farther left, and the time is later the later on, otherwise; the vertical axis represents the historical traffic flow corresponding to the time; the position indicated by the triangular arrow is the position on the time axis of the detection time.
The observation window is a time window with a preset duration along the direction (i.e. leftward) of the transverse axis to the previous moment of the first detection moment, taking the first detection moment as a starting point; the number of the history windows corresponding to the first detection time may be one or more, and all the history windows are located before the observation window as viewed from the time axis, as shown in fig. 3, that is, all the history windows are always located at the left side of the observation window.
The window size of the history window is equal to the observation window size.
The historical window selection may be, for example, random, and is therefore performed primarily because the historical traffic flow data may fluctuate and not conform to an ideal mean distribution. The method for randomly selecting the historical window and comparing the flow of the historical window with the flow of the observation window can reduce the possibility that the detection result is inaccurate due to improper selection of the observation window caused by abnormal fluctuation of historical traffic flow data to the maximum extent.
Referring to the example shown in fig. 4, the duration of the history window is 4 days, and the time is represented by the example of the history window in the case of 1 day as a unit time, and it can be seen that there is a large fluctuation in the flow rate of the window. If the history window is compared with the observation window of the first detection moment, the comparison result may have a large error.
The number of the randomly selected history windows can be one or more, and when one history window is selected, whether the road is abnormal or not can be determined according to the comparison between the history window and the observation window.
Preferably, a plurality of historical windows are randomly selected, and the method can reduce the possibility that the detection result is inaccurate due to the fact that abnormal fluctuation exists in historical traffic flow data and the observation windows are not properly selected to the greatest extent. When a plurality of history windows are selected for calculation, in order to facilitate calculation, in the embodiment of the present disclosure, whether the road flow at the first detection time is abnormal is determined according to a comparison result of the flow rate in the observation window and a change rate of a flow rate sum of more than half of the history windows.
Of course, other manners may also be used to determine the comparison result of the flow rate change of the multiple history windows and the observation window, so as to obtain whether the flow rate abnormality occurs at the detection time of the observation window.
In practical applications, if the size of each road observation window is limited, for example, 3 hours. Although a certain convenience is brought by this, for roads with different flow rates, the observation window is fixed, and it is impossible to accurately and efficiently judge whether a road is abnormal according to the characteristics of the flow rate data of each road. For example: for a high-flow road, a small observation window can detect whether a large amount of flow is abnormal; for a low-flow road, a long period of observation is required to detect whether the flow of the road is abnormal. The calculation of the duration of the observation window and the historical window is provided by the disclosure, so that the observation window and the historical window with different durations can be adapted to roads with different flows. Therefore, the specific time length of the observation window and the history window needs to be selected optimally according to the factors such as the road traffic flow, for example, the following method is adopted:
referring to fig. 5, the following process can be implemented:
s511, traversing a plurality of assumed values of preset duration, and sequentially determining the ratio of the absolute value of the difference between the flow sum of the history window and the observation window to the assumed value under each assumed value;
to facilitate understanding of the above step S511, an example is described here:
for a road with a lower traffic flow, it is assumed that the acquired historical traffic flow data represents each time in the basic unit of 5 minutes, i.e., every 5 minutes. The durations of the observation window and the history window are set to x (representing x times), where x is 1, 2, 3, 4, 5, 6, 7 (e.g., the durations of the observation window and the history window are 15 minutes, as represented by x being 3) … …
Counting the difference of the flow sum in the observation window and the history window at each moment, and recording as delta t; for convenience of explanation, the default of the history window is to select one; go through all x untilThe minimum value is obtained.
The present embodiment is described by taking days as unit time, and the determination manners of the preset durations of the observation window and the history window in the case of taking hours, minutes and the like as unit time are the same as the above manners, and are not described herein again. When there are a plurality of history windows, for example, there may be 3 history windows, and the difference Δ t between the sum of the flow rates in the observation window and the history window corresponding to each detection time is calculated1、Δt2And Δ t3Go through all x untilUntil the minimum value is obtained.
S512, selecting the assumed value when the ratio is minimum as the duration of the history window and the observation window.
Is obtained byAfter the minimum value of (a), the size of x at this time (x times) is determined as the duration of the observation window and the history window.
The comparison of the flow sums within the observation window and the at least one history window includes two cases:
first, when there is one history window, it is possible to determine whether the road is abnormal or not based on the comparison result of the flow sum in the observation window and the history window.
Secondly, when a plurality of historical windows are provided, whether the road is abnormal or not needs to be determined according to a plurality of groups of comparison data of flow sum in the observation window and the plurality of historical windows, and the road can be finally determined to be abnormal only when more than half of the comparison data in the plurality of groups of comparison data are determined to be abnormal.
In step S13, the comparison result of the flow sum in the observation window and the history window mainly takes the change rate of the flow sum as an evaluation criterion, and the specific calculation process of the flow sum change rate is as follows:
first, when there is one history window, it is assumed that the sum of the flow rates in the history window corresponding to a certain first detection time is fnThe sum of the flows in the observation window is foAnd if the flow rate change is flowratio, the calculation formula of the flow rate change is as follows:
for example, when the flowratio is less than 0.9, it is determined that the road traffic is abnormal, that is, the road is abnormal at the first detection time.
Second, when there are a plurality of history windows, it is assumed that there are 5 history windows at a certain detection time, and the sum of their flow rates isThe sum of the flow rates within the observation window is foAnd if the flow rate change is flowratio, the calculation formulas of the flow rate change of the observation window relative to the 5 historical windows are respectively as follows:
only when the values of more than half of the change rates in the 5 groups of change rates are less than 0.9, it can be determined that the road flow is abnormal at the first detection time, otherwise, the road flow is not considered to be abnormal at the first detection time.
Through the mode, whether the first detection moment is abnormal or not can be determined according to the comparison result of the flow sum in the observation window and the at least one history window, and the comparison result can be quantized through a specific numerical value, so that the road abnormal detection is more accurate.
Because in the actual road condition, the abnormal traffic condition of the road due to the abnormal traffic flow is not a transient event, but continues for a period of time, when it is detected that the traffic flow is abnormal at a first detection time, more information about the abnormal traffic flow needs to be obtained, for example, when the traffic flow is abnormal, how long it has been after the first detection time, and so on, based on this, after the step S13 determines that the traffic flow of the road at the first detection time is abnormal, as shown in fig. 6, the embodiment of the present disclosure may further execute the following steps:
s61, when the road abnormality at the first detection time is determined, sliding the observation window to enable the sliding observation window to include a second detection time;
the second detection time is a detection time earlier than the first detection time in the historical road traffic flow data;
s62, according to the comparison result of the flow sum of the observation window after sliding and the at least one history window, determining whether the road flow at the second detection time is abnormal, if so, turning to S61 to repeatedly execute the operation of sliding the observation window, otherwise, executing the following step S63;
and S63, determining the time interval from the last second detection time under the abnormal road condition to the first detection time under the abnormal road condition as the abnormal road condition.
For the sake of illustration, in the embodiment of the present disclosure, a designated detection time is referred to as a first detection time, after sliding the observation window, the first detection time moves forward by one time, which is referred to as a second detection time, and after repeatedly sliding the observation window again, each of the subsequent detection times is referred to as a second detection time.
In step S61, the sliding length is equal to a unit time corresponding to one time, and the sliding direction is the direction N times before the first detection time (N is 1 or more) each time the observation window is slid. After the sliding is completed, the observation window where the first detection time is located moves forward by a time to reach the observation window where the second detection time is located, at this time, the second detection window is also located at the rightmost end of the observation window, and in order to further compare the flow sum of the observation window and the history window, at least one history window corresponding to the second detection time needs to be continuously selected according to the above manner of selecting the history window. Similar to step S12, an odd number of history windows may be randomly selected, for example.
And determining whether the road traffic state at the second detection moment is abnormal or not according to the comparison result of the flow sum in the sliding observation window and the corresponding at least one historical window.
In the embodiment of the present disclosure, at least one history window corresponding to the observation window after the sliding may be completely the same as, may be completely different from, or may be partially the same as (that is, some of the history windows are different from) at least one history window corresponding to the observation window before the sliding.
In the above steps S61 to S63, by sliding the observation window, it is possible to sequentially detect whether or not a traffic anomaly occurs at each time with a relatively small time granularity, so as to finally obtain a time period from the second detection time when the last traffic anomaly occurs to the first detection time when the traffic anomaly occurs, and this time period can truly reflect the situation of the time interval when the traffic anomaly occurs on the actual road, thereby avoiding various problems caused by detection according to the fixed time granularity in the prior art, and making the determination of the road traffic state more accurate.
In the step S62, the manner of determining whether the road traffic state at the second detection time is abnormal is the same as that in the step S13, and details thereof are not repeated here.
In step S63, that is, when the time interval in which the road traffic state is abnormal is determined, the embodiment of the present disclosure may further determine the degree of abnormality occurring at each time point of the road according to the rate of change of the flow sum.
For example, the flow rate abnormality level value in the time interval in which the entire road is abnormal may be further determined based on the level value of the road abnormality at each detection time (the first detection time or the second detection time).
Abnormal degree value N at each detection timeaThe calculation formula of (a) is as follows:
wherein the sigmoid function:
when the history window is one, the abnormal degree value at the detection moment is as follows:
when a plurality of history windows are available, calculating abnormal degree values of detection moments (including a first detection moment and at least one second detection moment) corresponding to each history window, and summing the abnormal degree values; for convenience of explanation, here, taking 5 history windows as an example, the abnormal degree value N at the detection time (the first detection time or the second detection time) isaThe calculation method of (c) is as follows:
in addition, since the time section in which the road is abnormal includes a plurality of different detection times (i.e., the first detection time and the at least one second detection time), it is necessary to calculate the entire abnormal value N of the time section in which the road is abnormalbAssuming that the time interval in which the road is abnormal includes 3 detection times, the abnormal degree value corresponding to each detection time is: n is a radical of1 a、N2 aAnd N3 aIf the abnormal degree value at the detection time is as described above, the overall abnormal degree value N of the road in the abnormal time intervalbThe calculation method of (c) is as follows:
Nb=N1 a+N2 a+N3 a
according to the road anomaly detection method provided by the disclosure, the observation windows and the history windows with different time granularities are arranged according to roads with different flow rates, whether flow anomalies occur at each moment of the roads can be detected in sequence by using smaller time granularity, so that a time period formed by all the moments with abnormal flow rates can be obtained finally, the time period can truly reflect the actual road anomaly conditions, various problems caused by detection according to fixed time granularity in the prior art can be avoided, and the accuracy of road anomaly detection is greatly improved.
In addition, the scheme can detect whether the road traffic state is abnormal or not, determine the time interval of the road traffic state and the degree value of the road traffic state, and determine the severity of the road traffic abnormality according to the time interval and the degree value. Therefore, after the scheme is adopted to monitor the real-time traffic flow of the road, the capability of actively finding the abnormal road traffic state can be greatly improved, the problem of insufficient accuracy caused by the fluctuation of the real-time traffic flow is greatly improved, and the abnormal road can be more quickly and accurately positioned. In addition, the implementation of this scheme does not need a large amount of manual works, can save a large amount of cost of labor, can reduce the influence of the human factor in the road anomaly detection process simultaneously.
Example two
The second embodiment of the present disclosure is a specific example of a method for acquiring a road traffic state.
Referring to fig. 7A, the horizontal axis represents a time axis consisting of 57 times, the vertical axis represents the magnitude of the historical flow rate corresponding to each time, and the position indicated by the triangular arrow is the position of the detection time a. Assuming that the duration of each time is 10 minutes, according to the obtained historical traffic flow data, the historical flow corresponding to each time can be obtained. Referring to the first embodiment, the duration of the observation window at the detection time a is determined, and the duration of the observation window at the detection time a and the duration of the corresponding history window are 3 × 10 — 30 minutes. The history windows are 3 randomly selected windows and all are located before the observation window where the detection time a is located. The observation window of the detection time a is A, and the history windows are A1, A2 and A3.
According to the comparison result of the flow sum in the observation window A and the history windows A1, A2 and A3 at the detection time a, whether the road at the detection time a is abnormal or not can be determined. Specifically, regarding the calculation processes of the flow rate and the change rate in the observation window a and the history windows a1, a2, and A3, reference is made to the first embodiment, which is not described herein again, and it is assumed that the traffic state of the channel is abnormal at the detection time a.
If the detection time a is the current time or the time adjacent to the current time, it can be monitored that the traffic abnormality occurs on the road at the current time or at a time earlier or later than the current time.
Further, the sliding time window is slid to the left by a time (10 minutes) along the time axis, the position after the sliding is shown in the time window B in fig. 7B, fig. 7B is a schematic diagram of the observation window at which the previous time B (the position indicated by the triangular arrow is the position of the detection time B) of the detection time a is located and the corresponding history windows B1, B2 and B3, and in fig. 7B, the history windows B1, B2 and B3 may be the same as the history windows a1, a2 and A3 in fig. 7A, may also be different from the history windows a1, a2 and A3 or may be partially the same. After the observation window at the detection time b and the corresponding history window are determined, the change rate of the flow sum in the observation window at the detection time b and the corresponding history window also needs to be calculated, and it is assumed that the traffic state of the road is also abnormal at the detection time b.
The time window is continuously slid forwards until the traffic of the road is detected to be normal at a certain detection time, the sum of the time periods of all abnormal detection times before the detection time when the traffic of the road is detected to be normal is used as the time period of the road abnormality, for example, at the detection time c (not shown in the figure) before the detection time b when the traffic of the detected road is normal, the time period formed by the sum of the time a and the time b is the time interval when the traffic of the road is abnormal.
In this way, by continuously sliding the observation window in which the detection time is located in the direction of the time immediately before the detection time, the time interval in which the traffic abnormality (traffic state abnormality) occurs on the road can be finally specified. After the time interval of the road with the abnormal flow is determined, the degree value of the road with the abnormal flow in the time interval may be calculated according to the calculation method of the degree of the road abnormality provided in the first embodiment, so as to measure the severity of the road with the abnormal flow.
Based on the same inventive concept, the embodiment of the present disclosure further provides a road anomaly detection device and a server, and because the principles of the problems solved by the devices and the server are similar to the road anomaly detection method, the implementation of the devices and the server can refer to the implementation of the method, and repeated parts are not described again.
Referring to fig. 8, an embodiment of the present disclosure further provides an apparatus for acquiring a road traffic state, including: an acquisition module 81, a history window determination module 82 and a flow abnormity determination module 83; and a road condition determination module 84, wherein:
the acquisition module 81 is used for acquiring historical traffic flow data of a road within a preset time period from the current moment to the front;
a window determination module 82, configured to determine, in the historical traffic flow data of the road, an observation window where the specified first detection time is located and at least one corresponding historical window; the first detection moment is the current moment or the moment adjacent to the current moment; the time length of the history window is the same as that of the observation window, and the history window is earlier than that of the observation window;
the flow abnormity determining module 83 is used for determining whether the flow of the road at the first detection moment is abnormal according to the comparison result of the flow sum in the observation window and the flow sum in at least one historical window;
and a road state determining module 84, configured to determine that the current traffic state of the road is abnormal when the traffic abnormality determining module determines that the traffic of the road at the first detection time is abnormal.
In an embodiment, the apparatus for acquiring the road traffic status, as shown in fig. 8, may further include: a time window sliding module 85 and a time interval determination module 86; wherein:
a time window sliding module 85, configured to slide the observation window when the flow anomaly determination module 83 determines that the road at the first detection time is anomalous, so that the slid observation window includes a second detection time; when the traffic of the road is abnormal at the second detection moment, sliding the observation window again; until the flow of the road is normal; the second detection time is a detection time which is earlier than the first detection time in the historical road traffic flow data;
the flow anomaly determination module 83 is further configured to determine whether the road at the second detection time is anomalous or not according to a comparison result of the flow sums of the sliding observation window and the at least one history window;
the time interval determination module 86 is configured to determine that the time interval from the last second detection time when the road is abnormal to the first detection time when the road is abnormal is a time interval when the road state is abnormal.
In an embodiment, the window determining module 82 is specifically configured to determine a time window of a preset duration at the end of the first detection time as the observation window; an odd number of history windows are randomly selected from before the observation window.
In an embodiment, when there is one history window, the flow anomaly determination module 83 is specifically configured to determine a change rate of a flow sum in the observation window relative to a flow sum in the history window according to the flow sum in the observation window and the flow sum in the history window; and when the change rate is smaller than a preset change rate threshold value, determining that the road flow at the first detection moment or the second detection moment is abnormal.
In an embodiment, when there are a plurality of history windows, the flow anomaly determination module 83 is specifically configured to determine, for each history window, a change rate of a flow sum in the observation window with respect to each flow sum in the history window according to the flow sum in the observation window and the flow sum in the history window; and when the change rate of the flow sum in the observation window relative to more than half of the flow sum in the historical window is smaller than a preset change rate threshold value, determining that the road flow at the first detection time or the second detection time is abnormal.
In an embodiment, the time window sliding module 85 is specifically configured to move the observation window forward by one or more unit times corresponding to the first time of detection.
In an embodiment, the apparatus for acquiring the road traffic status, as shown in fig. 8, may further include: the flow abnormal degree calculation module 87 is used for determining flow abnormal degree values at the first detection time and each second detection time according to the flow in the observation window and the change rate of the flow sum relative to each historical window; and accumulating the flow abnormal degree values at the first detection time and all the second detection times to obtain the flow abnormal degree value of the time interval of the road with the flow abnormality.
In an embodiment, the time window sliding module 85 is further configured to traverse a plurality of assumed values of the preset duration, and sequentially determine a ratio of an absolute value of a difference between flow sums of the history window and the observation window to the assumed value under each assumed value; and selecting the assumed value when the ratio is minimum as the time length of a history window and the observation window.
The embodiment of the present disclosure further provides a traffic passing state monitoring server, including: a memory and a processor; wherein the memory stores a computer program which, when executed by the processor, is capable of implementing the above-mentioned method for acquiring a road traffic status.
The embodiment of the disclosure also provides a computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the method for acquiring the road traffic state is implemented.
With regard to the road abnormality detection apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications can be made in the present disclosure without departing from the spirit and scope of the disclosure. Thus, if such modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include such modifications and variations as well.