Method for determining traffic light change period and related device
By obtaining and analyzing the vehicle's speed at the traffic light intersection and determining the traffic light change cycle, the problem of low accuracy when there is less traffic flow is solved and the user's travel experience is improved.
Patent Information
- Application Number
- CN202411240361.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art is difficult to accurately determine the traffic light change cycle when there is a small traffic flow, which affects the user's travel experience.
By obtaining the speed of multiple vehicles at the target traffic light intersection and time, the speed of M group M is determined, where each set of vehicle speed includes the earliest first speed and the latest second speed, and comparing it according to the speed threshold, the traffic light change period is determined. , simulate increasing vehicle flow to improve accuracy.
In the case of low traffic, the traffic light change cycle is accurately determined through simulation, which improves the user's travel experience.
Smart Images

Figure CN119169843A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of traffic, and in particular to a method for determining a traffic light change period and a related device. Background Art
[0002] With the rapid development of traffic technology, it is crucial for users to understand the changes of traffic lights in real time during driving to improve driving efficiency, reduce waiting time, and optimize travel experience. Traffic lights are often controlled based on a preset time cycle. For example, the change cycle of a red light is 30 seconds, and the change cycle of a green light is 40 seconds. The traffic light can first change to a red light, the red light lasts for 30 seconds, the traffic light changes to a green light, the green light lasts for 40 seconds, and the traffic light changes to a red light again, and so on.
[0003] In the related art, the change of traffic lights can be determined by detecting the number of vehicles at an intersection with traffic lights. When the number of vehicles at the intersection is greater than a threshold, the traffic light is determined to be a red light, and when the number of vehicles at the intersection is less than or equal to the threshold, the traffic light is determined to be a green light. Then, based on the number of vehicles at the intersection at different times, the change cycle of the traffic light is determined. However, when the traffic volume at the intersection is small, that is, when there are few vehicles passing through the intersection, it is easy to make mistakes in determining the change cycle of the traffic light, which in turn leads to inaccurate changes in the traffic light prompted to the user, affecting the user's travel experience. Summary of the invention
[0004] In view of this, an embodiment of the present application provides a method for determining a traffic light change cycle and a related device, with the aim of providing a solution for determining a traffic light change cycle, improving the accuracy of the determined traffic light change cycle, and thereby improving the user's travel experience.
[0005] In a first aspect, an embodiment of the present application provides a method for determining a traffic light change period, the method comprising:
[0006] Acquire the speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each speed; the target traffic light intersection has a target traffic light; the multiple vehicles travel based on changes in the target traffic light;
[0007] M groups of vehicle speeds are determined from the vehicle speeds corresponding to a plurality of vehicles; M≥2, each group of vehicle speeds in the M groups of vehicle speeds includes at least two vehicle speeds arranged in a time sequence; each group of vehicle speeds in the M groups of vehicle speeds includes a first vehicle speed at the earliest time and a second vehicle speed at the latest time; the first vehicle speed is greater than a vehicle speed threshold, and the vehicle speed corresponding to the moment before the moment corresponding to the first vehicle speed is less than or equal to the vehicle speed threshold; the second vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the moment after the moment corresponding to the second vehicle speed is greater than the vehicle speed threshold; the time periods corresponding to the M groups of vehicle speeds are the same;
[0008] For at least two vehicle speeds respectively included in the M vehicle speed groups, a plurality of vehicle speeds are arranged in ascending order according to the first time difference between the time corresponding to each vehicle speed and the starting time of the time period corresponding to the vehicle speed; the plurality of vehicle speeds after the arrangement are the same as the time period respectively corresponding to each vehicle speed in the M vehicle speed groups;
[0009] Determine a third vehicle speed from the arranged multiple vehicle speeds; the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first moment difference value of the first moment difference value corresponding to the third vehicle speed is greater than the vehicle speed threshold;
[0010] In the first period between the starting moment of the time period and the difference between the first moment corresponding to the third vehicle speed, it is determined that the target traffic light changes to a red light; in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period, it is determined that the target traffic light changes to a green light.
[0011] In a second aspect, an embodiment of the present application provides a device for determining a traffic light change period, the device comprising:
[0012] A vehicle speed and time acquisition module, used to acquire the vehicle speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each vehicle speed; the target traffic light intersection has a target traffic light; the multiple vehicles travel based on the changes of the target traffic light;
[0013] The first vehicle speed determination module is used to determine M vehicle speed groups from the vehicle speeds corresponding to a plurality of vehicles; M≥2, each vehicle speed group in the M vehicle speed groups includes at least two vehicle speeds arranged in a time sequence; each vehicle speed group in the M vehicle speed groups includes a first vehicle speed at the earliest time and a second vehicle speed at the latest time; the first vehicle speed is greater than a vehicle speed threshold, and the vehicle speed corresponding to the moment before the moment corresponding to the first vehicle speed is less than or equal to the vehicle speed threshold; the second vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the moment after the moment corresponding to the second vehicle speed is greater than the vehicle speed threshold; the time periods corresponding to the M vehicle speed groups are the same;
[0014] a vehicle speed sorting module, for arranging at least two vehicle speeds respectively included in the M vehicle speed groups in order of the first time difference between each vehicle speed corresponding time and the start time of the time period corresponding to the vehicle speed from small to large to obtain a plurality of arranged vehicle speeds; the plurality of arranged vehicle speeds are the same as the time period respectively corresponding to each vehicle speed group in the M vehicle speed groups;
[0015] A second vehicle speed determination module is used to determine a third vehicle speed from the arranged multiple vehicle speeds; the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first moment difference value of the first moment difference value corresponding to the third vehicle speed is greater than the vehicle speed threshold;
[0016] The traffic light change determination module is used to determine that the target traffic light changes to a red light in the first period between the start moment of the time period and the difference between the first moment corresponding to the third vehicle speed; and to determine that the target traffic light changes to a green light in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period.
[0017] In a third aspect, an embodiment of the present application provides a device for determining a traffic light change period, the device comprising a memory and a processor:
[0018] The memory is used to store a computer program and transmit the computer program to the processor;
[0019] The processor is used to execute the computer program so that the device executes the method for determining the traffic light change cycle described in the first aspect.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed, the device executing the computer program implements the method for determining the traffic light change cycle described in the first aspect above.
[0021] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0022] The embodiment of the present application provides a method for determining a traffic light change period and a related device. In the method, first, the speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each speed are obtained. The target traffic light intersection has a target traffic light, and the multiple vehicles travel based on the change of the target traffic light; then, M groups of speeds with the same time period are determined from the speeds corresponding to the multiple vehicles, M≥2, each group of speeds in the M groups of speeds includes at least two speeds arranged in order of time, each group of speeds in the M groups of speeds includes a first speed with the earliest time and a second speed with the latest time, that is, the first speed in a group of speeds is the first speed, and the last speed is the second speed; The first vehicle speed is greater than the speed threshold, and the vehicle speed corresponding to the previous moment corresponding to the first vehicle speed is less than or equal to the speed threshold, the second vehicle speed is less than or equal to the speed threshold, and the vehicle speed corresponding to the next moment corresponding to the second vehicle speed is greater than the speed threshold, that is, the first vehicle speed of a group of speeds is a speed that increases to exceed the speed threshold, indicating that the target traffic light has changed from red to green, and at the same time, the last vehicle speed of a group of speeds is a speed that is about to increase to exceed the speed threshold, indicating that the moment corresponding to the first vehicle speed and the moment corresponding to the last vehicle speed in a group of speeds are both when the target traffic light changes from red to green, that is, the time period corresponding to this group of speeds includes the period corresponding to the red light and the period corresponding to the green light.
[0023] Then, for at least two vehicle speeds respectively included in the M vehicle speed groups, the first time difference between each vehicle speed corresponding moment and the starting moment of the time period corresponding to the vehicle speed is arranged in ascending order to obtain a plurality of arranged vehicle speeds, and the plurality of arranged vehicle speeds are the same as the time period corresponding to each vehicle speed group in the M vehicle speed groups, that is, at least two vehicle speeds respectively included in the M vehicle speed groups corresponding to the same period are superimposed into the same time period, and the number of vehicle speeds in the time period is increased, that is, the number of vehicles passing the target traffic light intersection in the time period is increased; then a third vehicle speed is determined from the plurality of arranged vehicle speeds, the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first time difference of the first time difference corresponding to the third vehicle speed is greater than the vehicle speed threshold, indicating that the third vehicle speed corresponds to a time when the target traffic light changes from green to red; finally, in the first period between the starting moment of the time period and the first time difference corresponding to the third vehicle speed, it is determined that the target traffic light changes to red; in the second period between the first time difference corresponding to the third vehicle speed and the end moment of the time period, it is determined that the target traffic light changes to green.
[0024] In this way, when the traffic volume at the target traffic light intersection is small, at least two vehicle speeds included in the M groups of vehicle speeds corresponding to the same time period can be superimposed on the same time period to simulate the increase in the traffic volume at the target traffic light intersection, and then based on the comparison results of the vehicle speeds of multiple vehicles at the target traffic light intersection with the vehicle speed threshold, the change period of the target traffic light can be accurately determined. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0026] Figure 1 An application scenario of a method for determining a traffic light change period provided in an embodiment of the present application;
[0027] Figure 2 A flow chart of a method for determining a traffic light change cycle provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of a preset area of a target traffic light intersection provided in an embodiment of the present application;
[0029] Figure 4a A timing diagram of vehicle speeds of multiple vehicles provided in an embodiment of the present application;
[0030] Figure 4b A timing diagram of a target traffic light provided in an embodiment of the present application;
[0031] Figure 5 A schematic diagram of clustering multiple time periods provided in an embodiment of the present application;
[0032] Figure 6 A schematic diagram of an initial time period and a time period provided in an embodiment of the present application;
[0033] Figure 7 A schematic diagram of superimposing multiple vehicle speeds corresponding to the same time period provided in an embodiment of the present application;
[0034] Figure 8 A schematic diagram of a periodic sequence provided in an embodiment of the present application;
[0035] Fig. 9 A schematic diagram of a code for determining a cycle period by using a KMP algorithm provided in an embodiment of the present application;
[0036] Fig.10 A schematic diagram of a specific method for determining a traffic light change period provided in an embodiment of the present application;
[0037] Fig.11 A schematic diagram of the structure of a device for determining a traffic light change period provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] At present, the existing method for determining the traffic light change cycle is: determining whether the traffic light changes to a red light or a green light based on the number of vehicles at the intersection with the traffic light, if the number of vehicles at the intersection is greater than the threshold, indicating that there are many vehicles stopped at the intersection, the traffic light is red at this time, and the number of vehicles at the intersection is less than or equal to the threshold, indicating that there are few vehicles at the intersection, the traffic light is green at this time. However, the inventor has found through research that in the case of less traffic volume, even if the number of vehicles at the intersection is less than the threshold, it is possible that the number of vehicles parked at the intersection is small, that is, the traffic light may change to a red light, but the existing method for determining the traffic light change cycle may determine that the traffic light changes to a green light, resulting in an inaccurate traffic light change cycle that is finally determined, thereby affecting the user's travel experience.
[0040] Based on this, in order to solve the above problems, the embodiments of the present application provide a method for determining the change cycle of traffic lights and related devices, with the purpose of providing a solution for determining the change cycle of traffic lights, improving the accuracy of the determined change cycle of traffic lights, and thus improving the travel experience of users. In this method, the speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each speed are obtained; the target traffic light intersection has a target traffic light; multiple vehicles travel based on the changes in the target traffic light; M groups of speeds are determined from the speeds corresponding to the multiple vehicles; M≥2, each group of speeds in the M groups of speeds includes at least two speeds arranged in order of time; each group of speeds in the M groups of speeds includes a first speed with the earliest time and a second speed with the latest time; the first speed is greater than a speed threshold, and the speed corresponding to the previous moment to which the first speed corresponds is less than or equal to the speed threshold; the second speed is less than or equal to the speed threshold, and the speed corresponding to the next moment to which the second speed corresponds is greater than the speed threshold; the time periods corresponding to the M groups of speeds are the same. The same; for at least two vehicle speeds respectively included in the M group of vehicle speeds, arrange the vehicle speeds in ascending order according to the difference between the first moment corresponding to each vehicle speed and the starting moment of the time period corresponding to the vehicle speed to obtain a plurality of arranged vehicle speeds; the plurality of arranged vehicle speeds are the same as the time period corresponding to each group of vehicle speeds in the M group of vehicle speeds; a third vehicle speed is determined from the plurality of arranged vehicle speeds; the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous moment of the moment corresponding to the third vehicle speed is greater than the vehicle speed threshold; in the first period between the starting moment of the time period and the difference between the first moment corresponding to the third vehicle speed, it is determined that the target traffic light changes to a red light; in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period, it is determined that the target traffic light changes to a green light.
[0041] In this way, when the traffic volume at the target traffic light intersection is small, the M groups of vehicle speeds corresponding to the same time period, including at least two vehicle speeds, can be superimposed on the same time period to simulate the increase in the traffic volume at the target traffic light intersection, and then based on the comparison results of the vehicle speeds of multiple vehicles at the target traffic light intersection with the vehicle speed threshold, the change cycle of the target traffic light can be accurately determined.
[0042] For example, the embodiments of the present application can be applied to Figure 1 In the scenario shown. The scenario includes multiple vehicles 101 and a server 102, wherein the server 102 can be an independent server, a cluster server or a cloud server, etc. The server 102 obtains the speeds of the multiple vehicles 101 at the target traffic light intersection and the time corresponding to each speed, and then uses the implementation method provided in the embodiment of the present application to determine the change cycle of the target traffic light at the target traffic light intersection.
[0043] First, in the above application scenario, although the actions of the implementation method provided in the embodiment of the present application are described as being executed by the server 102, the embodiment of the present application is not limited in terms of the execution subject, as long as the actions disclosed in the implementation method provided in the embodiment of the present application are executed. For example, the execution subject of the embodiment of the present application may also be a terminal device, which may be a smart phone, a computer, a tablet computer, etc.
[0044] Secondly, the above scenario is only an example scenario provided by the embodiment of the present application, and the embodiment of the present application is not limited to this scenario.
[0045] The specific implementation of the method for determining the traffic light change period and related devices in the embodiment of the present application will be described in detail below with reference to the accompanying drawings through embodiments.
[0046] See also Figure 2 , which is a flow chart of a method for determining a traffic light change cycle provided by an embodiment of the present application, combined with Figure 2 As shown, it may specifically include:
[0047] S201: Obtain the speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each speed.
[0048] The target traffic light intersection refers to an intersection with a target traffic light, and multiple vehicles travel at the target traffic light intersection based on changes in the target traffic light.
[0049] In an embodiment of the present application, when multiple vehicles pass through a target traffic light intersection, the speeds of the multiple vehicles and the corresponding time when the speeds are obtained can be obtained. Exemplarily, the multiple vehicles include vehicle 1-vehicle 3, and vehicles 1-vehicle 3 pass through the target traffic light intersection at 8:00, 8:02, and 8:05, respectively. Then, the speed of vehicle 1 at the target traffic light intersection can be obtained as 2m / s, and the corresponding time is 8:00; the speed of vehicle 2 at the target traffic light intersection can be obtained as 40m / s, and the corresponding time is 8:02; the speed of vehicle 3 at the target traffic light intersection can be obtained as 2m / s, and the corresponding time is 8:05.
[0050] In one possible implementation, the position data of the target traffic light intersection may be obtained first, and then the real-time position data of the vehicle may be obtained. Subsequently, based on the position data of the target traffic light intersection and the real-time position data of the vehicle, the speeds of multiple vehicles at the target traffic light intersection may be determined.
[0051] In some embodiments, the position information of the stop line of the target traffic light intersection may be obtained, and the position information of the stop line may be used as the position information of the target traffic light intersection.
[0052] For example, the location information of the stop line of the target traffic light intersection can be directly obtained through the high-precision map. For example, in the high-precision map, the longitude and latitude of the stop line of the target traffic light intersection are searched to obtain the location information.
[0053] As another example, a normal map may not include the location information of the stop line at the target traffic light intersection. In this case, the location information of the center point of the target traffic light intersection can be first found on the normal map. For example, if the location information of the transverse stop line at the target traffic light intersection needs to be determined, the width of the transverse lane can be found on the normal map, and then the location information of the transverse stop line can be obtained based on the longitudinal coordinate in the location information of the center point and the width of the transverse lane. For example, assuming that the transverse lane is a single lane, the longitudinal coordinate of the transverse stop line can be obtained as its location information by subtracting the width of the transverse lane from the longitudinal coordinate of the center point (that is, the longitudinal coordinate of the center point minus the width of the transverse lane). For details, please refer to the following embodiments. Figure 3 ; Assuming that the transverse lane is a double lane, the longitudinal coordinate of the transverse stop line can be obtained by subtracting twice the width of the transverse lane from the longitudinal coordinate of the center point as its position information (that is, the longitudinal coordinate of the center point - the width of the transverse lane × 2).
[0054] In some embodiments, the real-time location data of the vehicle can be obtained through the vehicle's navigation software, and the speed of the vehicle at the target traffic light intersection can be obtained through the vehicle's system.
[0055] It should be noted that the introduction of the method of obtaining the location data of the target traffic light intersection and the real-time location data of the vehicle in the above examples is only an example, and it can also be obtained by other methods, and this application does not limit this.
[0056] In a possible implementation, the speeds of multiple vehicles can be obtained when the position data of the target traffic light intersection coincides with the real-time position data of the vehicle. For example, the longitudinal coordinate of the horizontal stop line is the same as the longitudinal coordinate of the front of the vehicle in the real-time position data of the vehicle.
[0057] In practical applications, it is considered that when a vehicle stops at a target traffic light intersection, it may not stop exactly at the stop line, but may exceed the stop line due to the vehicle not stopping in time, or may not reach the stop line due to the vehicle stopping too early. In addition, it is also considered that when the vehicle is about to reach the stop line, the driver may slow down in advance, so the vehicle speed can be obtained when the vehicle reaches the preset area of the target traffic light intersection.
[0058] Therefore, in a possible implementation of the present application, the vehicle speeds corresponding to the multiple vehicles can be obtained when the multiple vehicles are in the preset area of the target traffic light intersection. Exemplarily, based on the above example, the vehicle speeds of the multiple vehicles can be obtained when the longitudinal coordinates of the front of the vehicle in the real-time position data of the vehicle are within the longitudinal coordinate range of the position data of the preset area of the target traffic light intersection. Exemplarily, the vehicle speeds of the multiple vehicles can be obtained when the longitudinal coordinates of the center point of the vehicle in the real-time position data of the vehicle are within the longitudinal coordinate range of the position data of the preset area of the target traffic light intersection. The present application does not limit this.
[0059] Accordingly, the preset area of the target traffic light intersection can be determined in the following manner: first, obtain the position data of the stop line of the target traffic light intersection; and then take the sum of the lane area that exceeds the stop line by a first preset number and the lane area that does not exceed the stop line by a second preset number as the preset area.
[0060] In an embodiment of the present application, the length of an area in the lane area parallel to the stop line is the lane width, that is, the length of an area in the preset area parallel to the stop line is the lane width; the length of an area in the lane area perpendicular to the stop line is the vehicle length, that is, the length of an area in the preset area perpendicular to the stop line is the vehicle length, indicating that the vehicle's speed can be obtained when the vehicle exceeds the stop line in its lane by at most a first preset number of vehicle lengths and when the vehicle does not exceed the stop line in its lane by at most a second preset number of vehicle lengths.
[0061] For example, the first number may be one vehicle length, and the second number may be two vehicle lengths, which is not limited in the present application.
[0062] As an example, see Figure 3 , which is a schematic diagram of a preset area of a target traffic light intersection provided in an embodiment of the present application. Figure 3 As shown, the position information of the center point of the target traffic light intersection can be obtained first, and then the width of the transverse lane can be obtained. Then, the longitudinal coordinate of the transverse stop line can be obtained by subtracting the width of the transverse lane from the longitudinal coordinate of the center point as the position information of the target traffic light intersection. Then, the sum of the lane area that exceeds the transverse stop line by one vehicle body length and the lane area that does not exceed the transverse stop line by two vehicle body lengths is used as the preset area of the target traffic light intersection. When the real-time position data of the vehicle coincides with the position data of the preset area, that is, when the vehicle is in the preset area, the speed of the vehicle is obtained, and then the speeds of multiple vehicles at the target traffic light intersection and the time corresponding to each speed are obtained.
[0063] In this way, it is convenient to obtain the speeds of more vehicles at the target traffic light intersection, increase the data volume of the vehicle speed data, and facilitate the subsequent accurate determination of the change cycle of the target traffic light.
[0064] In addition, in some embodiments, there may be multiple traffic lights at the target traffic light intersection, and the navigation path planning data thereof can be obtained through the navigation software of the vehicle, thereby determining the direction of travel of the vehicle at the target traffic light intersection. For example, if the target traffic light is a straight-through traffic light, the navigation path planning data of the vehicle can be obtained first, and when it is determined that the target traffic light intersection is a straight-through traffic light, the vehicle speed at the target traffic light intersection can be obtained. The same is true when the target traffic light is a left-turn traffic light or a right-turn traffic light, which will not be described in detail here.
[0065] S202: Determine M groups of vehicle speeds from the vehicle speeds corresponding to the plurality of vehicles.
[0066] It should be understood that when a vehicle passes through a target traffic light intersection, if the target traffic light is red, the vehicle needs to slow down to a near-stationary or stationary state; if the target traffic light is green, the vehicle drives normally.
[0067] Therefore, in a possible implementation manner, the color of the target traffic light at the moment corresponding to the speed of the vehicle may be determined based on the speeds of multiple vehicles at the target traffic light intersection.
[0068] In some embodiments, when a vehicle is at a target traffic light intersection, the speed of the vehicle (also referred to as instantaneous speed) is obtained. If the speed of the vehicle is greater than a speed threshold, the target traffic light is determined to be green at the current moment. If the speed of the vehicle is less than or equal to the speed threshold, the target traffic light is determined to be red at the current moment. For example, the speed threshold may be 0 or 5 m / s, which is not limited in this application.
[0069] As an example, see Figure 4a , which is a time sequence diagram of the speeds of multiple vehicles provided in an embodiment of the present application, and may also be referred to as speed statistics. Figure 4b , which is a timing diagram of a target traffic light provided by an embodiment of the present application, and can also be called traffic light statistics. When the traffic volume at the target traffic light intersection is large and continuous, the speeds of multiple vehicles at the target traffic light intersection (i.e., car speed) and the time corresponding to each speed (i.e., time) can be obtained first, and then Figure 4a The speed sequence diagram shown in FIG. Then, based on the comparison between multiple speeds and speed thresholds, determine whether the target traffic light is red or green at each speed. If the speed is greater than the speed threshold, the target traffic light is determined to be green. If the speed is less than or equal to the speed threshold, the target traffic light is determined to be red. Figure 4bAs shown in FIG. 1 , the color of the target traffic light (ie, traffic light) is 1, indicating that the target traffic light is green, and traffic light is 0, indicating that the target traffic light is red. Figure 4b The change cycle of the target traffic light can be clearly identified.
[0070] It is understandable that when determining the traffic light change cycle, it is necessary to determine the time when the target traffic light changes from green to red, and it is also necessary to determine the time when the target traffic light changes from red to green. Regardless of whether the traffic volume at the target traffic light intersection is large or small, when the target traffic light is red, as long as there is at least one vehicle that needs to pass through the target traffic light intersection, the vehicle needs to stop at the target traffic light intersection, and when the target traffic light changes from red to green, the speed of the vehicle will increase from a stationary or stationary state to pass through the target traffic light intersection.
[0071] If the traffic volume at the target traffic light intersection is small, the vehicle will pass through the target traffic light intersection directly when the target traffic light is green, unless there is a vehicle that needs to pass through the target traffic light intersection when the target traffic light changes from green to red. In this case, the vehicle's speed will be reduced from a higher speed to a stationary or tending to stationary state to stop at the target traffic light intersection. Otherwise, it is difficult to determine the moment when the target traffic light changes from green to red.
[0072] Therefore, in the embodiment of the present application, the speed of the vehicle at the target traffic light intersection can be obtained during the time period between the events of two target traffic lights changing from red to green. That is, M groups of vehicle speeds are determined from the speeds corresponding to the multiple vehicles, and each group of vehicle speeds in the M groups of vehicle speeds corresponds to the time period between the events of two target traffic lights changing from red to green.
[0073] Among them, M≥2, each group of speeds in the M groups of speeds includes at least two speeds arranged in chronological order, and each group of speeds in the M groups of speeds includes a first speed at the earliest time and a second speed at the latest time; the first speed is greater than the speed threshold, and the speed corresponding to the previous moment before the moment corresponding to the first speed is less than or equal to the speed threshold, that is, the first speed recorded in the group of speeds is recorded when the target traffic light changes from red to green; the second speed is less than or equal to the speed threshold, and the speed corresponding to the next moment after the moment corresponding to the second speed is greater than the speed threshold, and the last speed recorded in the group of speeds is also recorded when the target traffic light changes from red to green.
[0074] It should be noted that, considering that the change cycle of a target traffic light may be non-fixed, that is, the time cycle composed of a cycle corresponding to a red light and a cycle corresponding to a green light may change, the time cycles corresponding to the M groups of vehicle speeds need to be the same.
[0075] Exemplarily, when M is 2, a group of vehicle speeds may include multiple vehicle speeds between 8:00-8:01, the first vehicle speed (i.e., the first vehicle speed) of the group of vehicle speeds is greater than the vehicle speed threshold, and the vehicle speed of the vehicle speeds corresponding to the multiple vehicles is less than or equal to the vehicle speed threshold compared with the first vehicle speed, for example, the first vehicle speed corresponding to 8:00:01 is 18, and the vehicle speed corresponding to the previous moment 7:59:58 corresponding to the first vehicle speed is 4, for example, the second vehicle speed corresponding to 8:00:53 is 1, and the vehicle speed corresponding to the next moment 8:01:01 corresponding to the second vehicle speed is 14. It can be seen that the last vehicle speed (i.e., the second vehicle speed) of the group of vehicle speeds is less than or equal to the vehicle speed threshold, and the vehicle speed of the vehicle speeds corresponding to the multiple vehicles is greater than the vehicle speed threshold compared with the last vehicle speed; another group of vehicle speeds may include multiple vehicle speeds between 8:02-8:03, and the time periods corresponding to the two groups of vehicle speeds are the same, both of which are 60s.
[0076] In a possible implementation of the present application, the vehicle speeds corresponding to the multiple vehicles are arranged in order of time; then S202 may specifically include the following steps:
[0077] A1: Determine a plurality of first vehicle speeds from a plurality of vehicle speeds arranged in chronological order.
[0078] First, multiple first vehicle speeds with obvious increasing changes are determined from multiple vehicle speeds sorted in chronological order, that is, the vehicle speed at the previous moment is less than or equal to the vehicle speed threshold, and the vehicle speed at the next moment is greater than the vehicle speed threshold, then the vehicle speed corresponding to the next moment is determined as the first vehicle speed.
[0079] A2: Among the multiple vehicle speeds arranged in chronological order, multiple vehicle speeds between the previous first vehicle speed and the vehicle speed corresponding to the previous moment of the moment corresponding to the next first vehicle speed are determined as a group of vehicle speeds to obtain N groups of vehicle speeds.
[0080] After determining a plurality of first vehicle speeds from the plurality of vehicle speeds arranged in order of time, the plurality of vehicle speeds between two consecutive first vehicle speeds are arranged in order of time corresponding to the plurality of first vehicle speeds, and a group of vehicle speeds is determined. In some embodiments, a group of vehicle speeds includes the first first vehicle speed of the two consecutive first vehicle speeds, and the second first vehicle speed belongs to the next group of vehicle speeds.
[0081] In the embodiment of the present application, N≥M, that is, the number of the determined N groups of vehicle speeds will be greater than or equal to the number of the M groups of vehicle speeds in subsequent processing.
[0082] A3: For each of the N groups of vehicle speeds, based on a second time difference between the latest time and the earliest time corresponding to the group of vehicle speeds, a time period corresponding to the group of vehicle speeds is obtained.
[0083] A group of vehicle speeds includes at least two vehicle speeds, and the at least two vehicle speeds correspond to at least two moments. The time period corresponding to the group of vehicle speeds can be obtained by using the second time difference between the latest moment and the earliest moment of the at least two moments. Exemplarily, the latest moment of the at least two moments corresponding to the group of vehicle speeds is 8:01, and the earliest moment is 8:00, and the time period corresponding to the group of vehicle speeds is 60s.
[0084] A4: Among the N groups of vehicle speeds, the M group of vehicle speeds is determined from the K groups of vehicle speeds having the same time period.
[0085] It should be understood that there may be multiple cycles for the target traffic light to change to a red light, and there may also be multiple cycles for the target traffic light to change to a green light. If the time periods corresponding to a set of vehicle speeds include a cycle for the target traffic light to change to a red light and a cycle for the target traffic light to change to a green light, then the time periods corresponding to multiple sets of vehicle speeds may also be different.
[0086] Therefore, the M groups of vehicle speeds to be used can be determined from the K groups of vehicle speeds with the same time period among the N groups of vehicle speeds, N≥K≥M.
[0087] In this way, by easily determining the moment when the target traffic light changes from red to green, a period including a target traffic light changing to red and a period of a target traffic light changing to green (that is, a set of time periods corresponding to vehicle speeds) is determined, thereby facilitating the subsequent determination of the accurate traffic light change period.
[0088] It should be understood that in actual applications, no vehicle may pass the target traffic light intersection when the target traffic light changes from red to green, that is, the time period corresponding to the determined set of vehicle speeds may have errors.
[0089] In order to solve the above problem, in a possible implementation of the present application, A3 may specifically include:
[0090] A31: For each of the N groups of vehicle speeds, based on a second time difference between the latest time and the earliest time corresponding to the group of vehicle speeds, obtain an initial time period corresponding to the group of vehicle speeds.
[0091] That is, the second moment difference is used as the initial time period of the vehicle speed group.
[0092] A32: Clustering the N initial time periods corresponding to the N groups of vehicle speeds to obtain multiple clustering results.
[0093] In some embodiments, a kmeans algorithm may be used to perform clustering processing on the N initial time periods. The N initial time periods may be divided according to the distances between them to obtain multiple clustering results, each of which may include one or more initial time periods.
[0094] It should be noted that the present application does not limit the method used for clustering processing.
[0095] A33: For each of the N groups of vehicle speeds, determine the center point of the clustering result to which the initial time period corresponding to the group of vehicle speeds belongs as the time period corresponding to the group of vehicle speeds.
[0096] Then, for a set of vehicle speeds, the time period corresponding to the center point of the clustering result to which the corresponding initial time period belongs is determined as the final time period.
[0097] As an example, see Figure 5 , which is a schematic diagram of a clustering of multiple time periods provided in an embodiment of the present application. Figure 5 As shown, after clustering multiple initial time periods, three clustering results can be obtained, and the time periods corresponding to their respective center points (ie, black points) are 60s, 70s, and 90s, respectively.
[0098] As an example, see Figure 6 , which is a schematic diagram of an initial time period and a time period provided in an embodiment of the present application. The initial time period is adjusted using the center point of the determined clustering result to obtain the final time period corresponding to each group of vehicle speeds. For example, the initial time period corresponding to a group of vehicle speeds is 59s, which belongs to Figure 5 The center point in the clustering result is 60s, then it can be adjusted to 60s, and the rest can be seen in Figure 6 As shown, no further description is given here.
[0099] In this way, by clustering a plurality of initial time periods, the error of the determined time period can be reduced, and the accuracy of the determined change period of the target traffic light can be further improved.
[0100] S203: For at least two vehicle speeds respectively included in the M group of vehicle speeds, arrange them in ascending order according to the first moment difference between each vehicle speed corresponding moment and the starting moment of the time period corresponding to the vehicle speed to obtain a plurality of arranged vehicle speeds.
[0101] In the embodiment of the present application, the time period corresponding to the arranged multiple vehicle speeds is the same as the time period corresponding to each group of vehicle speeds in the M groups of vehicle speeds.
[0102] Based on the introduction of the above steps, the M groups of vehicle speeds correspond to the same time period. When a time period corresponds to a group of vehicle speeds, it may be difficult to determine the moment when the target traffic light changes from green to red due to the small number of vehicle speeds (that is, the number of vehicles passing through the target traffic light intersection is small). In this case, the M groups of vehicle speeds corresponding to the same time period can be integrated together.
[0103] Taking a time period of 60 seconds and M of 2 as an example, 7 vehicle speeds corresponding to 7 vehicles are obtained in the 60 seconds from 8:00 to 8:01, and 13 vehicle speeds corresponding to 13 vehicles are obtained in the other 60 seconds from 8:02 to 8:03. They are then integrated together (also called superimposed together), that is, there are 20 vehicle speeds corresponding to 20 vehicles in one 60 seconds, indicating that the traffic flow at the target traffic light intersection can be simulated to increase.
[0104] In some embodiments, based on the above example, taking 8:00-8:01 and 8:02-8:03, both time periods of 60 seconds, as examples, multiple vehicle speeds can be arranged in order from small to large according to the first moment difference between each vehicle speed in a group of vehicle speeds corresponding to 8:00-8:01 and the starting time 8:00 of the corresponding time period, and according to the first moment difference between each vehicle speed in a group of vehicle speeds corresponding to 8:02-8:03 and the starting time 8:02 of the corresponding time period.
[0105] As an example, see Figure 7 , which is a schematic diagram of a superposition of multiple vehicle speeds corresponding to the same time period provided by an embodiment of the present application. Figure 7 As shown, the two groups of vehicle speeds corresponding to the same time periods of 8:00-8:01 and 8:02-8:03 can be superimposed together, and the vehicle speeds can be arranged in ascending order according to the difference between the first moment of the corresponding moment of the vehicle speed and the start moment of the time period to obtain multiple arranged vehicle speeds.
[0106] In addition, in some embodiments, if the arranged multiple vehicle speeds include at least two vehicle speeds corresponding to the same first time difference, an average value may be calculated for the at least two vehicle speeds corresponding to the same first time difference, and the average value is used as the vehicle speed corresponding to the same first time difference. Figure 7 As shown, the first moment difference of 0:01 corresponds to a vehicle speed of 14 and a vehicle speed of 18, and the average value of 14 and 18 can be calculated to obtain 16 as the vehicle speed corresponding to the first moment difference of 0:01.
[0107] In some embodiments, if the multiple speeds after arrangement include three or more speeds corresponding to the same first moment difference, the median of the at least three speeds corresponding to the same first moment difference is taken, and the median is used as the speed corresponding to the same first moment difference. For example, if the first moment difference 0:01 corresponds to speed 14, speed 15, and speed 18, the median 15 can be used as the speed corresponding to the first moment difference 0:01.
[0108] In some embodiments, if the multiple arranged vehicle speeds include at least three vehicle speeds corresponding to the same first moment difference, the mode of the at least three vehicle speeds corresponding to the same first moment difference is taken, and the mode is used as the vehicle speed corresponding to the same first moment difference. For example, if the first moment difference 0:01 corresponds to a speed of 14, a speed of 18, and a speed of 18, the mode 18 can be used as the vehicle speed corresponding to the first moment difference 0:01.
[0109] S204: Determine a third vehicle speed from the arranged multiple vehicle speeds.
[0110] Based on the above introduction, the time periods corresponding to the multiple arranged vehicle speeds include a period when the target traffic light changes to a red light and a period when the target traffic light changes to a green light. Then, the first time difference when the target traffic light changes from a green light to a red light can be determined from the multiple first time differences corresponding to the multiple arranged vehicle speeds, that is, the time when the vehicle speed significantly decreases in the time period.
[0111] The third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first moment difference of the first moment difference corresponding to the third vehicle speed is greater than the vehicle speed threshold, that is, the first moment difference corresponding to the third vehicle speed is the moment when the vehicle speed is significantly reduced in the time period.
[0112] S205: In the first period between the start moment of the time period and the difference between the first moment corresponding to the third vehicle speed, determine that the target traffic light changes to a red light; in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period, determine that the target traffic light changes to a green light.
[0113] In some embodiments, based on the above example, taking the time period of 60s as an example, assuming that the difference between the third vehicle speed and the first moment is 20s, then within the time period of 0-20s, the target traffic light changes to a red light, and within the time period of 20-60s, the target traffic light changes to a green light.
[0114] It should be understood that there may be cyclical periods in multiple time periods of different durations, that is, the change period of the target traffic light may change cyclically. For example, during the morning and evening rush hours of a day, the time period is longer, and the time period is shorter at other times.
[0115] In a possible implementation manner of the present application, the time period includes a plurality of time periods of different durations, and the method for determining the traffic light change period further includes the following steps:
[0116] B1: Firstly, the first period and the second period respectively included in a plurality of time periods are arranged in order of time, and the plurality of periods after arrangement are obtained as a period sequence.
[0117] Herein, one cycle represents the cycle in which the target traffic light changes to a red light, or one cycle represents the cycle in which the target traffic light changes to a green light.
[0118] As an example, see Figure 8 , this figure is a schematic diagram of a periodic sequence provided in an embodiment of the present application, and the duration of each period of the periodic sequence is the duration of a red light or the duration of a green light.
[0119] B2: traverse the multiple periods in the periodic sequence in sequence, and for each traversed period, determine the longest identical prefix and suffix located at a sequence position before the sequence position corresponding to the period, and obtain the longest identical prefix and suffix corresponding to the multiple periods in the periodic sequence.
[0120] In some embodiments, the periodic sequence includes period 1 to period 5, and it is necessary to determine the longest identical prefix and suffix in the sequence position before period 1 to period 5. Taking period 3 as an example, it is necessary to determine the longest identical prefix and suffix of the sub-period sequence of period 1 and period 2. Taking period 5 as an example, it is necessary to determine the longest identical prefix and suffix of the sub-period sequence of period 1 to period 4.
[0121] The longest identical prefix and suffix is the longest sequence fragment of a sub-period sequence of equal length that can be found in a sub-period sequence and is both a prefix and a suffix. For example, the periodic sequence is [30 20 30 20 10 30 203020 10], then the longest identical prefix and suffix corresponding to the first position in the periodic sequence is a null character, that is, 0, and the longest identical prefix and suffix corresponding to the ninth position in the periodic sequence is [30 20 30].
[0122] B4: Determine the cyclic period of the periodic sequence based on a first number of the multiple periods in the periodic sequence and a second number of the longest identical prefix and suffix corresponding to the last period in the periodic sequence.
[0123] Wherein, the cycle period includes at least two periods.
[0124] In some embodiments, based on the above example, the periodic sequence is [30 20 30 20 10 30 20 30 2010], then the first number of multiple periods in the periodic sequence is 10, the longest identical prefix and suffix corresponding to the tenth position (i.e., the last period) in the periodic sequence is [30 20 30 20 10], and the second number is 5, then the cyclic period of the periodic sequence can be determined based on the first number and the second number.
[0125] In a possible implementation of the present application, B4 may specifically include: first subtracting the second number from the first number to obtain the length of the initial cycle period; if the first remainder obtained by dividing the first number by the length of the initial cycle period is 0, then the cycle period can be obtained by traversing from the starting position of the period sequence based on the length of the initial cycle period.
[0126] In some embodiments, based on the above example, the first number 10 minus the second number 5 obtains an initial cycle period length of 5, and the first number 10 is divided by the initial cycle period length 5 to obtain 2, and the first remainder is 0. Then, based on the initial cycle period length 5, the cycle period [30 20 30 20 10] can be traversed from the starting position of the periodic sequence to obtain.
[0127] It should be noted that the above method of determining the cycle period can be referred to as using the Knuth-Morris-Pratt Algorithm (KMP) to determine the cycle period.
[0128] As an example, see Fig. 9 , which is a schematic diagram of a code for determining a cycle period by a KMP algorithm provided in an embodiment of the present application. Fig. 9 As shown, length[sequence] represents the length of the periodic sequence (that is, the first quantity), "m<-length[sequence]" means first assigning the length of the periodic sequence to m; "lps[m]<-0" means initializing an array of length m, the array is named lps, lps represents the longest identical prefix and suffix (longestprefixsuffix), the initial value of each element in the lps array is 0, each element represents the number of the longest identical prefix and suffix corresponding to a period in the periodic sequence, the periodic sequence length is m, indicating that there are m arrays, corresponding to the m longest identical prefix and suffixes of the m arrays, then the lps data includes m elements.
[0129] "k<-0" means initializing k to 0, and k is used as the index of the lps array and sequence. For example, the index k is 0, which indicates the first element of the lps array and sequence. q is used as the index of the sequence, and "For q<--1to m" means looping from the first period of the periodic sequence, that is, each time the period before the period corresponding to the period indicated by index q is traversed, the longest identical prefix and suffix corresponding to the period corresponding to index q is determined.
[0130] In each traversal, "Do wihle k>0and sequence[q]!=sequence[k]" means that if both conditions are met, the loop will remain in place, that is, if either of the two conditions is not met, the loop will be exited. The first condition is k>0, which ensures that the index of the lps array cannot be a negative number. The second condition is that the values corresponding to index k and index p in sequence are not equal; "Do k<--lps[k-1]" means moving index k back to the corresponding value stored in lps[k-1].
[0131] "lps[q]<--k" means that if the values corresponding to index k and index p in sequence are equal, then the period from the first to index q (including the period corresponding to index q) in sequence is the longest valid identical prefix and suffix; "Thenk<--k+1" and "lps[q]<--k" mean that if the previous match is successful, the value of k is increased by 1, and the value of k is filled into the q position of the lps array; "cycle_length<--lps[-1]" means that the last element (that is, the second number) corresponding to the lps array may store the longest identical prefix and suffix of the entire periodic sequence; finally, "Returnsequence[cycle_length,...]" means returning the cyclic part of the sequence (that is, the loop period).
[0132] In some embodiments, it is necessary to first assume multiple pending cyclic period cycles (i.e., multiple longest identical prefixes and suffixes, whose corresponding numbers are different k) to traverse the period sequence to find matching items. When the period in the longest identical prefix and suffix does not match the period of the period sequence at the beginning, for example, when comparing the first period 30 in the longest identical prefix and suffix [30 20 30 20 10] (i.e., the period corresponding to index q) and the second period 20 in the period sequence [30 20 30 20 10 30 20 30 20 10] (i.e., the period corresponding to index k), instead of simply moving the longest identical prefix and suffix one position to the right, the moving distance is determined according to the number of periods corresponding to the longest identical prefix and suffix (i.e., moving the index k of the lps array back to the corresponding value stored in lps[k-1]), the number of the longest identical prefix and suffix corresponding to 30 in the longest identical prefix and suffix can be found and moved to the right to avoid repeated comparisons.
[0133] In addition, in some embodiments, after determining the initial cycle period, it is also possible to compare whether the number of cycles of the initial cycle period is greater than half of the number of cycles of the entire cycle sequence. If so, return to execute S201 (for example, the number of cycles of the initial cycle period is 6, and the number of cycles of the cycle sequence is 10) to accumulate more vehicle speed data, determine a longer cycle sequence, and then mine the cycle period again; otherwise, based on the length of the initial cycle period, traverse from the starting position of the cycle sequence to obtain the cycle period (for example, the number of cycles of the initial cycle period is 4, and the number of cycles of the cycle sequence is 10).
[0134] In this way, when the KMP algorithm is used to determine the cyclic period of a periodic sequence, there is no need to traverse multiple sequence positions in sequence to determine them one by one. Instead, the sequence positions that have been compared can be stored based on the longest identical prefix and suffix to avoid repeated comparisons. The time complexity can be reduced from O(m*n) to O(m+n), where m represents the first number and n represents the number of cyclic periods to be determined.
[0135] In a possible implementation manner of the present application, the method for determining the traffic light change period may further include the following steps:
[0136] C1: Obtain the historical time and current time of the start period of the cycle period.
[0137] For example, see Figure 8 As shown, the cycle period may include multiple periods of [40 20 60 30]. Assume that the historical moment of the start period of the cycle period is 8:00:00 on May 29, 24 years. That is, from this historical moment, the target traffic light changes to green and lasts for 40 seconds, and so on. Assume that the current time is 10:00:30 on May 29, 24 years.
[0138] C2: Subtract the historical moment from the current moment to obtain a third moment difference.
[0139] Exemplarily, based on the above example, 7230s can be obtained by subtracting the historical time of the start period of the cyclic period, 8:00:00 on May 29, 24, from the current time, 10:00:30 on May 29, 24, to obtain 7230s.
[0140] C3: Divide the third time difference by the duration of the cycle period to obtain a second remainder.
[0141] Exemplarily, based on the above example, the duration of the cycle period is 150s, then the third time difference can be divided by 7230s and divided by the duration of the cycle period 150s to obtain 48, and the second remainder is 30.
[0142] C4: Determine a target period in which the second remainder is located in the cycle period and a target time in the target period.
[0143] Exemplarily, based on the above example, the target period of 30 in the cycle period is the first period, and the target time is the 30th second of the first period.
[0144] C5: Determine the current color of the target traffic light based on the target cycle, and determine the remaining duration of the target cycle based on the target time of the target cycle.
[0145] Exemplarily, based on the above example, in the first cycle of the cycle period, the current color of the target traffic light is green, the duration of the target cycle is 40 seconds, and the remaining duration of the target cycle is 10 seconds.
[0146] C6: Prompt the user based on the current color of the target traffic light and the remaining time.
[0147] Exemplarily, based on the above example, the user may be prompted that the green light will continue for 10 seconds to remind the driver to slow down.
[0148] It should be noted that the above is only an example. When in the target cycle, the current color of the target traffic light may be red, and the user may be prompted with the number of seconds the red light will last to remind the driver to prepare to start.
[0149] As an example, see Fig.10 , which is a schematic diagram of a specific method for determining a traffic light change cycle provided in an embodiment of the present application, combined with Fig.10 As shown, it may specifically include:
[0150] S1001: Obtain the speeds of multiple vehicles within a preset area of a target traffic light intersection and the time corresponding to each speed.
[0151] S1002: Determine N groups of vehicle speeds from the vehicle speeds corresponding to the plurality of vehicles.
[0152] S1003: Clustering the N initial time periods corresponding to the N groups of vehicle speeds to obtain multiple clustering results.
[0153] S1004: For each of the N groups of vehicle speeds, determine the center point of the clustering result to which the initial time period corresponding to the group of vehicle speeds belongs as the time period corresponding to the group of vehicle speeds.
[0154] S1005: Among the N groups of vehicle speeds, determine the M group of vehicle speeds from the K groups of vehicle speeds having the same time period.
[0155] S1006: For at least two vehicle speeds respectively included in the M group of vehicle speeds, arrange them in ascending order according to the first moment difference between the moment corresponding to each vehicle speed and the starting moment of the time period corresponding to the vehicle speed to obtain a plurality of arranged vehicle speeds.
[0156] S1007: Determine a third vehicle speed from the arranged multiple vehicle speeds.
[0157] S1008: In the first period between the starting moment of the time period and the difference between the first moment corresponding to the third vehicle speed, determine that the target traffic light changes to a red light; in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period, determine that the target traffic light changes to a green light.
[0158] S1009: If the KMP algorithm is used to determine the cyclic segment period from the period sequence including the arranged multiple periods, execute S1011.
[0159] S1010: If the KMP algorithm fails to determine the cyclic segment period from the period sequence including the arranged multiple periods, the process returns to S1001.
[0160] In some embodiments, if the first remainder obtained by dividing the first number by the length of the initial cycle period is not 0, the process returns to S1001 to accumulate more vehicle speed data, determine a longer cycle sequence, and then mine the cycle period again.
[0161] S1011: Predict the change of the target traffic light at the current moment by using the cycle period.
[0162] In some embodiments, the implementation of S1011 can refer to the specific implementations of C1-C6 in the above embodiments.
[0163] It should be noted that the implementation of S1001-1011 can refer to the specific implementation of S201-S205 in the above embodiment, which will not be repeated here.
[0164] The above are some specific implementations of the method for determining the traffic light change period provided in the embodiment of the present application. Based on this, the present application also provides a corresponding device for determining the traffic light change period. The following will introduce the device for determining the traffic light change period provided in the embodiment of the present application from the perspective of functional modularization.
[0165] See also Fig.11 , which is a schematic diagram of the structure of a device for determining a traffic light change period provided in an embodiment of the present application, the device 1100 for determining a traffic light change period may include:
[0166] The vehicle speed and time acquisition module 1110 is used to acquire the vehicle speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each vehicle speed; the target traffic light intersection has a target traffic light; the multiple vehicles travel based on the changes of the target traffic light;
[0167] The first vehicle speed determination module 1120 is used to determine M vehicle speed groups from the vehicle speeds corresponding to a plurality of vehicles; M≥2, each vehicle speed group in the M vehicle speed groups includes at least two vehicle speeds arranged in a time sequence; each vehicle speed group in the M vehicle speed groups includes a first vehicle speed at the earliest time and a second vehicle speed at the latest time; the first vehicle speed is greater than a vehicle speed threshold, and the vehicle speed corresponding to the moment before the moment corresponding to the first vehicle speed is less than or equal to the vehicle speed threshold; the second vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the moment after the moment corresponding to the second vehicle speed is greater than the vehicle speed threshold; the time periods corresponding to the M vehicle speed groups are the same;
[0168] The vehicle speed sorting module 1130 is used to arrange at least two vehicle speeds respectively included in the M vehicle speed groups in order of the first time difference between each vehicle speed corresponding time and the start time of the time period corresponding to the vehicle speed from small to large to obtain a plurality of arranged vehicle speeds; the plurality of arranged vehicle speeds are the same as the time period respectively corresponding to each vehicle speed group in the M vehicle speed groups;
[0169] The second vehicle speed determination module 1140 is used to determine a third vehicle speed from the arranged multiple vehicle speeds; the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first moment difference value of the first moment difference value corresponding to the third vehicle speed is greater than the vehicle speed threshold;
[0170] The traffic light change determination module 1150 is used to determine that the target traffic light changes to a red light in the first period between the start moment of the time period and the difference between the first moment corresponding to the third vehicle speed; and to determine that the target traffic light changes to a green light in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period.
[0171] As an implementation manner, the vehicle speeds corresponding to the plurality of vehicles are arranged in a time sequence, and the first vehicle speed determination module 1120 may specifically include:
[0172] A first vehicle speed determining unit, used to determine a plurality of first vehicle speeds from a plurality of vehicle speeds arranged in chronological order;
[0173] A vehicle speed obtaining unit is used to determine, from the plurality of vehicle speeds arranged in order of time, a plurality of vehicle speeds between a previous first vehicle speed and a vehicle speed corresponding to a previous moment of a moment corresponding to a next first vehicle speed as a group of vehicle speeds, to obtain N groups of vehicle speeds; N ≥ M;
[0174] A time period obtaining unit, configured to obtain, for each of the N groups of vehicle speeds, a time period corresponding to the group of vehicle speeds based on a second time difference between a latest time and an earliest time corresponding to the group of vehicle speeds;
[0175] The second vehicle speed determination unit is used to determine the M group of vehicle speeds from K groups of vehicle speeds having the same time period among the N groups of vehicle speeds; N≥K≥M.
[0176] As an implementation manner, the time period obtaining unit is specifically used to:
[0177] For each of the N groups of vehicle speeds, based on a second time difference between the latest time and the earliest time corresponding to the group of vehicle speeds, an initial time period corresponding to the group of vehicle speeds is obtained;
[0178] Performing clustering processing on the N initial time periods corresponding to the N groups of vehicle speeds one by one to obtain multiple clustering results;
[0179] For each of the N groups of vehicle speeds, the center point of the clustering result to which the initial time period corresponding to the group of vehicle speeds belongs is determined as the time period corresponding to the group of vehicle speeds.
[0180] As an implementation manner, the time period includes a plurality of time periods of different durations, and the traffic light change period determination device 1100 may further include:
[0181] A cycle sequence obtaining module, used for arranging the first cycle and the second cycle respectively included in a plurality of time cycles in a time sequence, and obtaining a plurality of arranged cycles as a cycle sequence; one cycle represents a cycle in which the target traffic light changes to a red light, or one cycle represents a cycle in which the target traffic light changes to a green light;
[0182] The longest identical prefix and suffix determination module is used to sequentially traverse the multiple periods from the periodic sequence, and for each traversed period, determine the longest identical prefix and suffix located at a sequence position before the sequence position corresponding to the period, and obtain the longest identical prefix and suffix corresponding to the multiple periods in the periodic sequence respectively;
[0183] A cyclic segment period determination module is used to determine the cyclic segment period of the cycle sequence based on a first number of multiple cycles in the cycle sequence and a second number of the longest identical prefix and suffix corresponding to the last cycle in the cycle sequence; the cyclic segment period includes at least two cycles.
[0184] As an implementation manner, the cycle period determination module may specifically include:
[0185] a length obtaining unit, configured to obtain a length of an initial cycle period by subtracting the second number from the first number;
[0186] The cyclic segment period obtaining unit is used to obtain the cyclic segment period by traversing from the starting position of the period sequence based on the length of the initial cyclic segment period if the first remainder obtained by dividing the first number by the length of the initial cyclic segment period is 0.
[0187] As an implementation manner, the traffic light change period determination device 1100 may further include:
[0188] A time acquisition module, used to acquire the historical time and current time of the starting period of the cycle period;
[0189] A third time difference obtaining module, configured to obtain a third time difference by subtracting the historical time from the current time;
[0190] A remainder obtaining module, used for obtaining a second remainder by dividing the third time difference by the duration of the cyclic period;
[0191] A time determination module, used to determine a target period in which the second remainder is located in the cycle period and a target time in the target period;
[0192] A remaining duration determination module, configured to determine the current color of the target traffic light based on the target cycle, and determine the remaining duration of the target cycle based on the target moment of the target cycle;
[0193] A prompt module is used to prompt a user based on the current color of the target traffic light and the remaining time.
[0194] As an implementation manner, the vehicle speeds corresponding to the plurality of vehicles are respectively obtained when the plurality of vehicles are in a preset area of the target traffic light intersection, and the preset area of the target traffic light intersection is determined by the following units:
[0195] A position data acquisition unit, used to acquire the position data of the stop line of the target traffic light intersection;
[0196] A preset area determination unit is used to take the sum of a first preset number of lane areas that exceed the stop line and a second preset number of lane areas that do not exceed the stop line as the preset area; the length of an area in the lane area that is parallel to the stop line is the lane width; and the length of an area in the lane area that is perpendicular to the stop line is the vehicle length.
[0197] The embodiments of the present application also provide a corresponding traffic light change cycle determination device and a computer-readable storage medium for implementing the solution provided in the embodiments of the present application.
[0198] Among them, the device for determining the traffic light change period includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program so that the device executes the method for determining the traffic light change period described in any embodiment of the present application.
[0199] The computer-readable storage medium stores a computer program. When the computer program is executed, the device executing the computer program implements the method for determining the traffic light change period described in any embodiment of the present application.
[0200] The "first" and "second" in the names such as "first" and "second" (if any) mentioned in the embodiments of the present application are only used as name identifiers and do not represent the first or second in order.
[0201] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a readable storage medium, such as a read-only memory (ROM) / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.
[0202] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0203] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for determining a traffic light change period, characterized in that: include: Obtaining the speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each speed; the target traffic light intersection has a target traffic light; The plurality of vehicles travel based on a change in the target traffic light; M groups of vehicle speeds are determined from the vehicle speeds corresponding to a plurality of vehicles; M≥2, each group of vehicle speeds in the M groups of vehicle speeds includes at least two vehicle speeds arranged in a time sequence; each group of vehicle speeds in the M groups of vehicle speeds includes a first vehicle speed at the earliest time and a second vehicle speed at the latest time; the first vehicle speed is greater than a vehicle speed threshold, and the vehicle speed corresponding to the moment before the moment corresponding to the first vehicle speed is less than or equal to the vehicle speed threshold; the second vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the moment after the moment corresponding to the second vehicle speed is greater than the vehicle speed threshold; the time periods corresponding to the M groups of vehicle speeds are the same; For at least two vehicle speeds respectively included in the M vehicle speed groups, a plurality of vehicle speeds are arranged in ascending order according to the first time difference between the time corresponding to each vehicle speed and the starting time of the time period corresponding to the vehicle speed; the plurality of vehicle speeds after the arrangement are the same as the time period respectively corresponding to each vehicle speed in the M vehicle speed groups; Determine a third vehicle speed from the arranged multiple vehicle speeds; the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first moment difference value of the first moment difference value corresponding to the third vehicle speed is greater than the vehicle speed threshold; In the first period between the starting moment of the time period and the difference between the first moment corresponding to the third vehicle speed, it is determined that the target traffic light changes to a red light; in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period, it is determined that the target traffic light changes to a green light.
2. The method according to claim 1, characterized in that The vehicle speeds corresponding to the plurality of vehicles are arranged in a time sequence; and the step of determining M groups of vehicle speeds from the vehicle speeds corresponding to the plurality of vehicles includes: Determining a plurality of first vehicle speeds from a plurality of vehicle speeds arranged in chronological order; Among the multiple vehicle speeds arranged in order of time, multiple vehicle speeds between the last first vehicle speed and the vehicle speed corresponding to the last moment of the moment corresponding to the next first vehicle speed are determined as a group of vehicle speeds to obtain N groups of vehicle speeds; N≥M; For each of the N groups of vehicle speeds, based on a second time difference between the latest time and the earliest time corresponding to the group of vehicle speeds, a time period corresponding to the group of vehicle speeds is obtained; Among the N groups of vehicle speeds, the M group of vehicle speeds are determined from K groups of vehicle speeds having the same time period; N≥K≥M.
3. The method according to claim 2, characterized in that The step of obtaining, for each of the N groups of vehicle speeds, a time period corresponding to the group of vehicle speeds based on a second time difference between the latest time and the earliest time corresponding to the group of vehicle speeds, comprises: For each of the N groups of vehicle speeds, based on a second time difference between the latest time and the earliest time corresponding to the group of vehicle speeds, an initial time period corresponding to the group of vehicle speeds is obtained; Performing clustering processing on the N initial time periods corresponding to the N groups of vehicle speeds one by one to obtain multiple clustering results; For each of the N groups of vehicle speeds, the center point of the clustering result to which the initial time period corresponding to the group of vehicle speeds belongs is determined as the time period corresponding to the group of vehicle speeds.
4. The method according to claim 1, characterized in that: The time period includes a plurality of time periods of different durations, and the method further includes: Arranging the first period and the second period respectively included in the plurality of time periods in order of time, and obtaining the plurality of periods after arrangement as a period sequence; one period represents a period during which the target traffic light changes to a red light, or one period represents a period during which the target traffic light changes to a green light; The multiple periods in the periodic sequence are sequentially traversed, and for each traversed period, the longest identical prefix and suffix located at a sequence position before a sequence position corresponding to the period is determined to obtain the longest identical prefix and suffix corresponding to the multiple periods in the periodic sequence respectively; Based on a first number of multiple cycles in the cycle sequence and a second number of the longest identical prefix and suffix corresponding to the last cycle in the cycle sequence, a cyclic segment period of the cycle sequence is determined; the cyclic segment period includes at least two cycles.
5. The method according to claim 4, characterized in that The determining of the cyclic period of the periodic sequence based on a first number of the plurality of periods in the periodic sequence and a second number of the longest identical prefix and suffix corresponding to the last period in the periodic sequence comprises: Subtracting the second number from the first number to obtain the length of the initial cycle period; If a first remainder obtained by dividing the first number by the length of the initial cyclic segment period is 0, the cyclic segment period is obtained by traversing from the starting position of the periodic sequence based on the length of the initial cyclic segment period.
6. The method according to claim 4 or 5, characterized in that: The method further comprises: Obtain the historical moment and current moment of the starting period of the cycle period; Subtracting the historical moment from the current moment to obtain a third moment difference; Dividing the third time difference by the duration of the cyclic period to obtain a second remainder; Determine a target period in which the second remainder is located in the cyclic period and a target time in the target period; Determining a current color of the target traffic light based on the target cycle, and determining a remaining duration of the target cycle based on a target time of the target cycle; The user is prompted based on the current color of the target traffic light and the remaining time.
7. The method according to any one of claims 1 to 5, characterized in that: The vehicle speeds corresponding to the plurality of vehicles are obtained when the plurality of vehicles are in a preset area of the target traffic light intersection; the preset area of the target traffic light intersection is determined by: Acquire the position data of the stop line of the target traffic light intersection; The sum of a first preset number of lane areas beyond the stop line and a second preset number of lane areas that do not exceed the stop line is taken as the preset area; The length of the area in the lane area parallel to the stop line is the lane width; the length of the area in the lane area perpendicular to the stop line is the vehicle length.
8. A device for determining a traffic light change period, characterized in that: The device comprises: A vehicle speed and time acquisition module, used to acquire the vehicle speeds of multiple vehicles at a target traffic light intersection and the time corresponding to each vehicle speed; the target traffic light intersection has a target traffic light; the multiple vehicles travel based on the changes of the target traffic light; The first vehicle speed determination module is used to determine M vehicle speed groups from the vehicle speeds corresponding to a plurality of vehicles; M≥2, each vehicle speed group in the M vehicle speed groups includes at least two vehicle speeds arranged in a time sequence; each vehicle speed group in the M vehicle speed groups includes a first vehicle speed at the earliest time and a second vehicle speed at the latest time; the first vehicle speed is greater than a vehicle speed threshold, and the vehicle speed corresponding to the moment before the moment corresponding to the first vehicle speed is less than or equal to the vehicle speed threshold; the second vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the moment after the moment corresponding to the second vehicle speed is greater than the vehicle speed threshold; the time periods corresponding to the M vehicle speed groups are the same; a vehicle speed sorting module, for arranging at least two vehicle speeds respectively included in the M vehicle speed groups in order of the first time difference between each vehicle speed corresponding time and the start time of the time period corresponding to the vehicle speed from small to large to obtain a plurality of arranged vehicle speeds; the plurality of arranged vehicle speeds are the same as the time period respectively corresponding to each vehicle speed group in the M vehicle speed groups; A second vehicle speed determination module is used to determine a third vehicle speed from the arranged multiple vehicle speeds; the third vehicle speed is less than or equal to the vehicle speed threshold, and the vehicle speed corresponding to the previous first moment difference value of the first moment difference value corresponding to the third vehicle speed is greater than the vehicle speed threshold; The traffic light change determination module is used to determine that the target traffic light changes to a red light in the first period between the start moment of the time period and the difference between the first moment corresponding to the third vehicle speed; and to determine that the target traffic light changes to a green light in the second period between the difference between the first moment corresponding to the third vehicle speed and the end moment of the time period.
9. A device for determining a traffic light change period, characterized in that: The device comprises a memory and a processor: The memory is used to store a computer program and transmit the computer program to the processor; The processor is used to execute the computer program so that the device performs the steps of the method for determining the traffic light change period as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed, a device executing the computer program implements the steps of the method for determining a traffic light change period as described in any one of claims 1 to 7.
Citation Information
Cited By
Ship port order information acquisition method and system, electronic equipment and storage medium
CN120014884A
