Method, device, equipment and storage medium for determining traffic flow index

By tracking the vehicle's driving trajectory in traffic video, determining the cross-line vehicles and performing clustering processing, the existing traffic flow detection technology is solved and more efficient and accurate traffic flow detection is achieved.

CN113469075BActive Publication Date: 2025-03-18SHANGHAI SENSETIME INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110767463.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-07
Publication Date
2025-03-18
Estimated Expiration
2041-07-07

AI Technical Summary

Technical Problem

The existing traffic flow detection technology is complicated and has insufficient accuracy, making it difficult to effectively alleviate traffic congestion and congestion problems.

Method used

By obtaining the vehicle driving trajectory information in the traffic video, determining the cross-line vehicles, and clustering these vehicles to calculate the traffic flow index of the target intersection.

Benefits of technology

It improves the accuracy and efficiency of traffic flow detection, can maintain high accuracy when the vehicle is saturated, and simplifies the detection process and reduces operational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113469075B_ABST
    Figure CN113469075B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a method, device, equipment and storage medium for determining traffic flow indicators. The detection results of tracking and detecting multiple vehicles in a traffic video can be obtained, the traffic video is a video of a target intersection collected, and the detection results include driving trajectory information of the multiple vehicles; a crossing vehicle is determined from the multiple vehicles based on the driving trajectory information, the driving trajectory of the crossing vehicle intersects with a detection line, and the detection line is located in the target intersection area and covers one or more lanes of the target intersection; the crossing vehicles are clustered, and the traffic flow indicator of the target intersection is determined based on the clustering processing results. Through the above method, the traffic flow indicator of the road intersection can be determined more accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method, device, equipment and storage medium for determining a traffic flow index. Background Art

[0002] With the popularization of cars, the number of cars on the road is increasing, which has also caused a series of traffic problems such as traffic congestion, traffic jams, and frequent traffic accidents. In order to alleviate problems such as traffic jams and traffic congestion, the traffic flow on the road can be detected, and the traffic flow can be scientifically and reasonably controlled based on the detection results to improve the traffic environment. The current traffic flow detection technology mainly detects the traffic flow of each lane. The detection method is relatively cumbersome, and the detection accuracy needs to be improved. Summary of the invention

[0003] The present invention provides a method, device, equipment and storage medium for determining a traffic flow index.

[0004] According to a first aspect of an embodiment of the present disclosure, a method for determining a traffic flow index is provided, the method comprising:

[0005] Acquire detection results of tracking and detecting multiple vehicles in a traffic video, wherein the traffic video is a video collected of a target intersection, and the detection results include driving trajectory information of the multiple vehicles;

[0006] Determine a crossing vehicle from the plurality of vehicles based on the driving trajectory information, wherein the driving trajectory of the crossing vehicle intersects with a detection line covering one or more lanes of the target intersection;

[0007] The crossing vehicles are clustered, and the traffic flow index of the target intersection is determined based on the clustering result.

[0008] In some embodiments, the detection line coincides with a stop line or a zebra crossing at the target intersection.

[0009] In some embodiments, determining a crossing vehicle from the plurality of vehicles based on the driving trajectory information includes:

[0010] Determine a crossing vehicle from the vehicles in each video frame of the traffic video based on the driving trajectory information;

[0011] The vehicles that have crossed the line in each video frame are accumulated to obtain the vehicles that have crossed the line among the multiple vehicles.

[0012] In some embodiments, the driving trajectory information includes coordinates of trajectory points of the multiple vehicles in different video frames of the traffic video, and determining the crossing vehicle from the vehicles in each video frame of the traffic video based on the driving trajectory information includes:

[0013] For each current video frame, perform the following operations:

[0014] Based on the driving track information of each vehicle in the current video frame, determine the coordinates of a first track point of each vehicle in the current video frame, and the coordinates of a second track point of each vehicle in a frame previous to the current video frame;

[0015] When it is determined that a line connecting the first track point and the second track point intersects the detection line based on the coordinates of the first track point, the coordinates of the second track point and the coordinates of the two end points of the detection line, the vehicle is determined as a crossing vehicle.

[0016] In some embodiments, the traffic flow index includes the traffic flow of one or more lanes of the target intersection, clustering the crossing vehicles, and determining the traffic flow index of the target intersection based on the clustering processing result, including:

[0017] Performing clustering processing on the intersections of the driving trajectory of the crossing vehicle and the detection line to obtain one or more intersection cluster centers, wherein each intersection cluster center represents a first group;

[0018] Based on the distance between the intersection of the crossing vehicle and the one or more intersection cluster centers, the crossing vehicle is divided into the first group;

[0019] Based on the lanes represented by each first group and the number of crossing vehicles in each first group, the traffic flow of one or more lanes of the target intersection is determined.

[0020] In some embodiments, the operation of clustering the intersections of the driving trajectory of the crossing vehicle and the detection line is performed after a preset condition is triggered, and the preset condition includes:

[0021] The number of vehicles crossing the line reaches a preset number threshold; and / or

[0022] The duration of the traffic video reaches a preset duration threshold.

[0023] In some embodiments, the traffic flow index includes vehicle flow from the target intersection to different driving directions, and clustering the crossing vehicles and determining the traffic flow index of the target intersection based on the clustering result includes:

[0024] Performing clustering processing on the exit trajectory points to obtain one or more exit trajectory point cluster centers, wherein the exit trajectory points are trajectory points of the crossing vehicle in the video frame in which the crossing vehicle is detected for the last time, and each exit trajectory point cluster center represents a second group;

[0025] Based on the distance between the exit trajectory point of the crossing vehicle and the one or more exit trajectory point cluster centers, the crossing vehicle is divided into the second group;

[0026] Based on the driving direction category represented by each second group and the number of crossing vehicles in each second group, the vehicle flow from the target intersection to different driving directions is determined.

[0027] In some embodiments, before clustering the exit trajectory points, the method further includes:

[0028] Based on the driving trajectory information of the crossing vehicles, the crossing vehicles with abnormal driving trajectories are filtered out, wherein the crossing vehicles with abnormal driving trajectories include vehicles with interrupted driving trajectories.

[0029] In some embodiments, the driving direction category represented by each second group is determined based on the following method:

[0030] When the number of the one or more exit trajectory point cluster centers is consistent with the number of driving direction categories included in the target intersection, respectively determine the angle between the line connecting the exit trajectory point cluster center representing each second group and the center of the detection line and the detection line;

[0031] The driving direction category represented by each second group is determined based on the sorting result of the angles.

[0032] In some embodiments, the driving direction category represented by each second group is determined based on the following method:

[0033] In a case where the number of the one or more exit point cluster centers is less than the number of driving direction categories included in the target intersection, determining the driving direction category to which each crossing vehicle in each second group belongs based on the driving trajectory of each crossing vehicle in each second group;

[0034] Determine a target driving direction category from the driving direction categories to which each crossing vehicle in the second group belongs, wherein the number of crossing vehicles in the target driving direction category is greater than the number of crossing vehicles in other driving direction categories;

[0035] The target driving direction category is used as the driving direction category represented by the second group.

[0036] In some embodiments, the method further comprises:

[0037] Determine the angle between the driving trajectory of the crossing vehicle and the detection line;

[0038] The driving direction of the crossing vehicle with the angle less than or equal to 0 is determined as the U-turn direction.

[0039] In some embodiments, determining the driving direction category of each crossing vehicle in each second group based on the driving trajectory of each crossing vehicle in each second group includes:

[0040] Performing linear fitting on the driving trajectory of each of the crossing vehicles in the second group;

[0041] Based on the result of linear fitting, a crossing vehicle whose driving direction is a straight direction is determined from the crossing vehicles in each of the second groups.

[0042] In some embodiments, determining the driving direction category of each crossing vehicle in each second group based on the driving trajectory of each crossing vehicle in each second group includes:

[0043] Performing linear fitting on the driving trajectories of the crossing vehicles in each of the second groups, and determining the crossing vehicles whose driving directions are not straight directions based on the results of the linear fitting;

[0044] Based on the cosine similarity between the driving trajectories of the vehicles crossing the line in the non-straight direction and the detection line, the vehicles crossing the line with a left turn and the vehicles crossing the line with a right turn are determined from the vehicles crossing the line in the non-straight direction.

[0045] In some embodiments, after determining the traffic flow of the target intersection, the method further includes:

[0046] The traffic light at the target intersection is controlled based on the traffic flow. According to a second aspect of an embodiment of the present disclosure, a device for determining a traffic flow index is provided, the device comprising:

[0047] An acquisition module, used to acquire detection results of tracking and detecting multiple vehicles in a traffic video, wherein the traffic video is a video of a target intersection collected, and the detection results include driving trajectory information of the multiple vehicles;

[0048] A processing module, configured to determine a crossing vehicle from the plurality of vehicles based on the driving trajectory information, wherein the driving trajectory of the crossing vehicle intersects with a detection line of one or more lanes covering the target intersection;

[0049] The clustering module is used to perform clustering processing on the crossing vehicles and determine the traffic flow index of the target intersection based on the clustering processing result.

[0050] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a processor, a memory, and computer instructions stored in the memory and executable by the processor, wherein when the processor executes the computer instructions, the method mentioned in the first aspect above can be implemented.

[0051] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed, the method mentioned in the first aspect is implemented.

[0052] In the disclosed embodiment, a video of the target intersection can be collected, and the vehicles in the video can be tracked and detected to obtain the driving trajectory of the vehicles in the video, and a detection line can be pre-set at the target intersection position in the video frame, and the detection line can cover one or more lanes of the target intersection. Then, the vehicles crossing the line whose driving trajectory intersects with the detection line can be screened out from the vehicles in the video, and the vehicles crossing the line can be clustered to obtain various traffic flow indicators of the target intersection, such as the traffic volume of each lane, or the traffic volume in each direction. Since the disclosed embodiment determines whether the vehicle passes through a certain lane or a certain intersection by whether the vehicle's driving trajectory intersects with the detection line, compared with the method of detecting traffic volume through a virtual coil, its detection accuracy will be greatly improved, and even when the vehicles on the road are very saturated, its detection accuracy will not be affected. In addition, since there is no need to mark a virtual coil for each lane, it is easy to operate, making this detection method more convenient and quick.

[0053] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

[0055] FIG. 1( a ) and FIG. 1( b ) are schematic diagrams of using a virtual coil to detect vehicle flow according to an embodiment of the present disclosure.

[0056] Figure 2 It is a flow chart of a method for determining traffic flow indicators according to an embodiment of the present disclosure.

[0057] Figure 3 It is a schematic diagram of marking a detection line at a target intersection according to an embodiment of the present disclosure.

[0058] Figure 4 It is a schematic diagram of the driving direction of traffic flow at a target intersection according to an embodiment of the present disclosure.

[0059] Figure 5 It is a schematic diagram of an angle between an exit trajectory point of a vehicle crossing the line in different driving directions at a target intersection and a line connecting the center of a detection line and the detection line in an embodiment of the present disclosure.

[0060] Figure 6 It is a schematic diagram of the logical structure of a device for determining a traffic flow index according to an embodiment of the present disclosure.

[0061] Figure 7 It is a schematic diagram of the logical structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0062] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0063] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items. In addition, the term "at least one" herein means any combination of at least two of any one or more of a plurality of.

[0064] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0065] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present disclosure and to make the above-mentioned purposes, features and advantages of the embodiments of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings.

[0066] In order to alleviate a series of traffic problems such as traffic congestion and blockage, the traffic flow on the road can usually be detected, and then the traffic flow can be controlled based on the detection results. For example, the traffic flow can be diverted to avoid congestion, or the user can be reminded of the traffic flow conditions of each section of the road in real time so that the user can avoid congested sections. Accurate detection of traffic flow is the prerequisite for achieving scientific and reasonable traffic control.

[0067] The current traffic flow detection technology generally collects road videos through cameras installed on the road, and analyzes and processes the videos to determine the traffic flow. At present, when performing traffic flow detection, as shown in Figure 1(a), the user is generally required to pre-mark a virtual coil on each lane, and then determine whether a vehicle has passed the virtual coil based on the pixel changes in the position of the virtual coil in two adjacent video frames. For example, as shown in Figure 1(b), assume that there are three video frames collected at time T1, time T2, and time T3. In the video frame at time T1, the vehicle has not entered the virtual coil, in the video frame at time T2, the vehicle is just located at the virtual coil, and in the video frame at time T3, the vehicle has left the virtual coil. The pixels at the position of the virtual coil in the above three video frames will change significantly, and each time the pixels in the virtual coil change significantly, it means that a vehicle has passed the virtual coil, so the traffic flow of each lane can be counted. The above-mentioned traffic flow detection method can generally only detect the traffic flow indicator of the traffic flow of each lane, and because it is necessary to pre-mark the virtual coil in each lane by manual marking, the workload is large and cumbersome. Moreover, this method of detecting traffic flow by pixel changes in virtual coils will not change significantly when the road is saturated with vehicles, that is, when the average headway (the time difference between two adjacent vehicles passing the virtual coil) is very small. The virtual coil will always be occupied by vehicles and the pixels will not change significantly, resulting in a sharp drop in detection accuracy.

[0068] Based on this, the disclosed embodiment provides a method for determining traffic flow indicators, which can collect videos of target intersections, track and detect vehicles in the video to obtain the driving trajectory of the vehicles in the video, and then filter out vehicles in the video whose driving trajectory intersects with the detection line. The detection line covers one or more lanes of the target intersection, and can cluster the vehicles that cross the line to obtain various traffic flow indicators of the target intersection, such as the traffic volume of each lane at the target intersection, or the traffic volume from the target intersection to each direction. Since the disclosed embodiment determines whether a vehicle passes through a certain lane or a certain intersection by whether the vehicle's driving trajectory intersects with the detection line, compared with the method of detecting traffic volume through a virtual coil, its detection accuracy will be greatly improved, and even when the vehicles on the road are very saturated, its detection accuracy will not be affected. In addition, since there is no need to mark a virtual coil for each lane, it is easy to operate, making the detection method more convenient and quick.

[0069] The method for determining traffic flow indicators in the embodiments of the present disclosure can be executed by various road traffic information collection devices. In some scenarios, the road traffic information collection device can be an image collection device installed at a road intersection. In some scenarios, the road traffic information collection device can also be a device that is communicatively connected to the image collection device installed at a road intersection, such as a cloud server, a server cluster, etc., which is not limited by the embodiments of the present disclosure.

[0070] The target intersection in the embodiment of the present disclosure may be any intersection whose traffic flow needs to be detected, and the target intersection may be any type of intersection, such as a cross intersection, a T-shaped intersection, or an intersection of other shapes, etc. For each target intersection, a dedicated image acquisition device may be provided to acquire a traffic video indicating the traffic conditions of the intersection.

[0071] The traffic flow index in the embodiment of the present disclosure refers to various indicator parameters used to indicate the traffic flow conditions of the target intersection. For example, it can be the traffic flow of a certain lane or each lane in the target intersection, or the overall traffic flow passing through the target intersection, or the traffic flow going in different directions after passing through the target intersection, such as the traffic flow going straight, the traffic flow turning left, the traffic flow making U-turns, etc.

[0072] Specifically, Figure 2 As shown, the method may include the following steps:

[0073] Step S202: obtaining detection results of tracking multiple vehicles in a traffic video, wherein the traffic video is a video of a target intersection collected, and the detection results include driving trajectory information of the multiple vehicles;

[0074] The detection results of tracking and detecting multiple vehicles in the traffic video of the target intersection can be obtained, wherein the detection results can include the driving trajectory information of the multiple vehicles in the traffic video. Among them, the tracking and detection of vehicles in the video can be implemented by using a target tracking algorithm. For example, the vehicle in each video frame can be detected based on the target detection algorithm, and the vehicles in different video frames can be matched, so that the position of the same vehicle in different video frames can be known, and the tracking of the vehicle can be achieved. When performing target tracking, an identifier can be set for each vehicle in the traffic video. For example, each vehicle can correspond to a number to identify the vehicle. After the vehicle that has crossed the line is determined, the identifier corresponding to the vehicle that has crossed the line can be stored.

[0075] The driving trajectory information may be various information that characterizes the driving trajectory of the vehicle, for example, it may be the position information of the vehicle at different times, or the position information of the vehicle in different video frames, etc. The position information may be the pixel coordinates in the video frame, or the pixel coordinates may be converted into three-dimensional coordinates in a three-dimensional space based on the internal and external parameters of the image acquisition device. The specific setting may be based on actual needs, and the present embodiment does not impose any limitation thereto.

[0076] In some embodiments, the driving trajectory information may be the coordinates of the trajectory points of the vehicle in the traffic video in different video frames of the traffic video. For example, for each vehicle in the video frame, a pixel point that can characterize the position of the vehicle in the video frame can be determined as the driving trajectory point of the vehicle in the current video frame or the current moment. For example, the center of the vehicle can be used as the driving trajectory point, or the center of the area surrounded by the contact points of the four tires of the vehicle with the ground can be used as the driving trajectory point. The specific setting can be based on actual needs. For each frame of the video, the driving trajectory point of the vehicle can be determined, so that the driving trajectory information of the vehicle in the traffic video can be obtained. For example, in some scenarios, the driving trajectory information may include the identification of the vehicle and the coordinates of the driving trajectory points of the vehicle in different video frames (different video frames can be identified by the acquisition time of the video frame, or by the video frame number).

[0077] In addition, the multiple vehicles may be all the vehicles detected in the traffic video, or may be some of the vehicles detected in the traffic video, and the embodiments of the present disclosure are not limited thereto.

[0078] In some embodiments, tracking and detecting vehicles in traffic videos and determining traffic flow indicators based on the detection results can be performed by the same device. For example, tracking and detecting vehicles in traffic videos and determining traffic flow indicators based on the detection results can be performed by different modules or components on the same device, or by the same module or component on the same device. In some embodiments, tracking and detecting vehicles in traffic videos and determining traffic flow indicators based on the detection results can also be performed by two different devices.

[0079] Step S204: determining a crossing vehicle from the multiple vehicles based on the driving trajectory information, wherein the driving trajectory of the crossing vehicle intersects with detection lines of one or more lanes covering the target intersection.

[0080] After obtaining the driving trajectory information of the vehicle in the traffic video, the crossing vehicle whose driving trajectory intersects with the detection line can be determined from the multiple vehicles based on the vehicle driving trajectory information. The detection line is used to detect whether the vehicle merges into the intersection from the target intersection. Therefore, the detection line can cover one or more lanes of the target intersection, and all vehicles passing through the target intersection and flowing into other intersections will pass through the detection line.

[0081] In some embodiments, the detection line can be calibrated in advance by the user in the video frame of the traffic video. For example, two pixel points can be selected at the target intersection in the video frame as the two end points of the detection line, and the position coordinates of the two end points can be recorded. Of course, in order to detect all vehicles flowing out of the target intersection, when calibrating the detection line, the two end points of the detection line can be located on both sides of the entrance road of the target intersection, that is, the detection line can cover one or more lanes of the entrance road of the target intersection.

[0082] Since vehicles going from the target entrance to other directions will pass through the stop line or zebra crossing of the target intersection, in some embodiments, when calibrating the detection line, in order to facilitate calibration, the detection line can be calibrated according to the stop line or zebra crossing of the target intersection, that is, the detection line can coincide with the stop line or zebra crossing of the target intersection. Of course, when calibrating the detection line, it is not necessary to coincide with the stop line, as long as it can cover one or more lanes to be detected in the target intersection and ensure that the driving trajectory of vehicles passing through the lanes to be detected will intersect with the detection line.

[0083] Since the viewing angle of the image acquisition device for video acquisition of the target intersection is generally fixed, the position of the detection line in each video frame in the traffic video is fixed. Therefore, when calibrating the detection line, it is only necessary to calibrate the positions of the two end points of the detection line in one video frame and determine the position coordinates of the two end points.

[0084] In one embodiment, the detection line can also be automatically identified from the video frame of the traffic video. For example, the detection line can be a zebra crossing or a stop line at the target intersection. The zebra crossing or the stop line in the video frame can be automatically identified to determine the pixel coordinates of the two end points of the zebra crossing and the stop line as the coordinates of the two end points of the detection line. By automatically identifying the zebra crossing or the stop line as the detection line from the video frame, the step of the user marking the detection line can be omitted, making the detection method more convenient and quick.

[0085] like Figure 3 As shown, it is a schematic diagram of an intersection, which includes four intersections (a), (b), (c), and (d). For each intersection, an image acquisition device can be set to collect the traffic video of the intersection, and the traffic flow index corresponding to the intersection will be determined based on the traffic video. Taking intersection (a) as an example, there is an entrance road in intersection (a), and vehicles enter the intersection from the entrance road and drive into other intersections. Therefore, a detection line can be calibrated at the position of the entrance road of the target intersection. The detection line can cover lane 1, lane 2, and lane 3 in the target intersection, so that vehicles entering the intersection from lane 1, lane 2, and lane 3 will pass through the detection line, that is, their driving trajectories will intersect with the detection line, so they can be detected.

[0086] In some embodiments, when determining a crossing vehicle from multiple vehicles in a traffic video based on driving trajectory information, the crossing vehicle can be determined from each vehicle in the video frame according to the driving trajectory information of the vehicle for each video frame in the traffic video, and then the crossing vehicles in each video frame are accumulated to obtain the crossing vehicles in a section of the traffic video. Since some vehicles may be determined as crossing vehicles in multiple video frames, when accumulating crossing vehicles in different video frames, the crossing vehicles that have been repeatedly counted in different video frames can be merged to avoid repeated counting.

[0087] In some embodiments, the driving trajectory information may be the coordinates of the trajectory points of the vehicles in the traffic video in different video frames of the traffic video. When determining the vehicles crossing the line from the vehicles in each video frame of the traffic video based on the driving trajectory information, the following method may be adopted: for each vehicle in the current video frame, the coordinates of the first trajectory point of the vehicle in the current video frame and the coordinates of the second trajectory point of the vehicle in the previous frame of the current video frame may be determined based on the driving trajectory information of the vehicle, and then the coordinates of the first trajectory point, the coordinates of the second trajectory point and the coordinates of the two end points of the detection line are determined to determine whether the line connecting the first trajectory point and the second trajectory point intersects with the detection line. If they intersect, the vehicle is determined as a crossing vehicle. For each vehicle in the current video frame, the above steps may be repeated one by one to determine whether each vehicle in each current video frame is a crossing vehicle. For each video frame in the traffic video, the above steps may also be repeated frame by frame to obtain the crossing vehicles in each video frame. By determining the crossing vehicles in each video frame frame by frame, and accumulating the crossing vehicles in each video frame, the crossing vehicles in a section of the traffic video may be obtained.

[0088] Among them, it is determined whether the line connecting the first track point and the second track point intersects with the detection line, that is, whether the two line segments intersect. In some embodiments, a rapid repulsion test and a straddle test can be used to determine whether the two line segments intersect. For example, assuming that the coordinates of the second track point of the vehicle in the previous frame of the current video frame are: p pre =(x pre ,y pre ), the coordinates of the first track point in the current video frame are: p cur =(x cur ,y cur ), the coordinates of the two end points of the detection line are: p1 = (x1, y1), p2 = (x2, y2).

[0089] In order to improve the detection speed of vehicles crossing the line, first, a fast exclusion experiment can be performed to quickly filter out vehicles whose driving trajectories do not intersect the detection line. For example, when the coordinates of the first trajectory point, the coordinates of the second trajectory point, and the coordinates of the two end points of the detection line meet any of the following conditions, it can be determined that the line connecting the first trajectory point and the second trajectory point does not intersect the detection line:

[0090] min(x pre ,x cur )≤max(x1,x2);

[0091] min(x1, x2)≤max(x pre , x cur );

[0092] min(y pre,y cur )≤max(y1,y2);

[0093] min(y1,y2)≤max(y pre ,y cur );

[0094] If the coordinates of the first trajectory point, the coordinates of the second trajectory point, and the coordinates of the two endpoints of the detection line do not meet the above conditions, a straddle experiment can be further performed to determine whether the line connecting the first trajectory point and the second trajectory point intersects the detection line. When the coordinates of the first trajectory point, the coordinates of the second trajectory point, and the coordinates of the two endpoints of the detection line meet any of the following conditions, it can be determined that the two intersect, otherwise it is determined that the two do not intersect;

[0095] ((x1-x pre )(y1-y cur )-(x1-x cur )(y1-y pre ))×

[0096] ((x2-x pre )(y2-y cur )-(x2-x cur )(y2-y pre ))≤0;

[0097] ((x pre -x1)(y pre -y2)-(x pre -x2)(y pre -y1))×

[0098] ((x cur -x1)(y cur -y2)-(x cur -x2)(y cur -y1))≤0;

[0099] Based on the above determination conditions, the vehicles crossing the line in each video frame can be determined.

[0100] Of course, when actually determining whether the driving trajectory intersects with the detection, the trajectory points of two adjacent frames can be used to determine the driving trajectory, or the trajectory points of two video frames separated by a certain number of frames can be selected to determine the driving trajectory, and the embodiments of the present disclosure do not limit this.

[0101] After determining the crossing vehicle in each video frame, the coordinates of the intersection of the crossing vehicle's driving trajectory and the detection line, as well as the identification of the video frame at the moment when the crossing vehicle's driving trajectory intersects the detection line and parameters such as the crossing time can be recorded for subsequent use by users.

[0102] Step S206: cluster the crossing vehicles, and determine the traffic flow index of the target intersection based on the clustering processing result.

[0103] After determining the vehicles that have passed the detection line of the target intersection, the determined vehicles that have passed the line can be clustered, and then the traffic flow index of the target intersection can be determined based on the clustering results. Since the vehicles whose driving trajectories intersect with the detection line are all vehicles that will pass through the target intersection and flow to various directions, the vehicles passing through the target intersection can be accurately detected, and then these vehicles can be further clustered to determine the number of vehicles that meet various detection requirements. Among them, the detection requirements can be to detect the traffic flow of one or more lanes, or to detect the traffic flow in one direction or multiple directions. Therefore, the traffic flow of one or more lanes can be determined through clustering, or the traffic flow from the target intersection to a certain direction can be determined through clustering to obtain various traffic flow indicators of the target intersection.

[0104] In some embodiments, the traffic flow index may be the traffic flow of one or more lanes at the target intersection. When clustering the crossing vehicles and determining the traffic flow of one or more lanes at the target intersection based on the clustering results, the intersections of the crossing vehicle's driving trajectory and the detection line may be clustered, and the traffic flow of each lane may be determined based on the clustering results of the intersections. Clustering the intersections may use a DBSCAN clustering algorithm, a K-means clustering algorithm, etc., which is not limited in the embodiments of the present disclosure.

[0105] For example, in some scenarios, the vehicles corresponding to the intersections in each category obtained by clustering can be directly regarded as vehicles in the same lane. Of course, directly using the clustering results of the intersections as the result of lane division for vehicles crossing the line may not be very accurate. In some embodiments, when determining the traffic volume of each lane, the intersections of the driving trajectories of the vehicles crossing the line and the detection lines can also be clustered to obtain one or more clusters, wherein each cluster corresponds to one or more cluster centers, hereinafter referred to as intersection cluster centers, and each intersection cluster center can represent a group, hereinafter referred to as the first group. For example, assuming there are three lanes, three intersection cluster centers can be obtained after clustering the intersections, and each intersection cluster center corresponds to a first group. After determining the intersection cluster centers, the distances between the intersections of each crossing vehicle and each intersection cluster center can be determined respectively, and then the crossing vehicle can be divided into the first group represented by the intersection cluster center with the closest distance to its intersection. Among them, the distance between the intersection and the intersection cluster center can be the Euclidean distance or other types of distances, which can be set according to actual needs.

[0106] For example, suppose the intersection point of the vehicle trajectory and the detection line is p v=(x,y), there are two cluster centers, namely p c1 =(x1,y1),p c2 =(x2,y2), the first group to which the crossing vehicle belongs can be determined according to formula (1):

[0107] max((x1-x) 2 +(y1-y) 2 ,(x2-x) 2 +(y2-y) 2 ) Formula (1)

[0108] That is, the intersection point is closest to which intersection cluster center, and the vehicle is divided into the first group represented by that intersection cluster center. After each crossing vehicle is divided into the first group represented by each intersection cluster center, the traffic flow of one or more lanes to be detected in the target intersection can be determined based on the lanes represented by each first group and the number of crossing vehicles in the first group.

[0109] In some embodiments, the operation of clustering the intersection of the driving trajectory of the crossing vehicle and the detection line can be performed after the preset condition is triggered. The preset condition can be that the number of crossing vehicles reaches a preset number threshold, or it can be that the duration of the traffic video reaches a preset duration threshold. For example, in some embodiments, the crossing vehicles in each video frame can be determined one by one, and the crossing vehicles in each video frame can be accumulated. When the accumulated crossing vehicles reach the preset number threshold, the intersection of the crossing vehicles can be clustered to obtain the traffic flow of each lane within a period of time. Of course, in some embodiments, the duration of the traffic video of the detected crossing vehicles can also be counted. When the duration reaches the preset duration threshold, the intersection of the crossing vehicles in this period of time is clustered to obtain the traffic flow of each lane within this period of time.

[0110] In some embodiments, Figure 4As shown, the traffic flow index can be the traffic flow from the target intersection to different driving directions. For example, assuming that the vehicles merging into the intersection through the target intersection can go straight, turn left, turn right, or turn around, it is necessary to count the traffic flow to different directions so as to regulate the traffic flow based on this index. When clustering the vehicles crossing the line and determining the traffic flow from the target intersection to different directions based on the clustering results, the coordinates of the exit trajectory point of each crossing vehicle can be determined first, wherein the exit trajectory point is the trajectory point of the crossing vehicle in the video frame where the crossing vehicle is last detected in the traffic video, that is, the trajectory point of the crossing vehicle at the moment when the crossing vehicle exits the viewing angle range of the image acquisition device. After determining the coordinates of the exit trajectory point of each crossing vehicle, the exit trajectory points of all crossing vehicles can be clustered based on the coordinates of the exit trajectory points, and the traffic flow from the target intersection to each driving direction can be determined based on the clustering results of the exit trajectory points.

[0111] For example, in some embodiments, the clustering results of the exit trajectory points can be directly used as the result of dividing the driving directions of the crossing vehicles. For example, the vehicles corresponding to the exit trajectory points in each category obtained by clustering are regarded as vehicles in one driving direction. However, the division results determined in this way are not very accurate.

[0112] In some embodiments, the exit trajectory points of the crossing vehicles can be clustered to obtain one or more clusters and the cluster center corresponding to each cluster, hereinafter referred to as the exit trajectory point cluster center, wherein each exit trajectory point cluster center represents a group, hereinafter referred to as the second group. Each second group can represent a driving direction category. For example, assuming that there are three driving directions of the vehicles flowing out of the target intersection, such as straight, left turn, and right turn, then three exit trajectory point cluster centers and three second groups can be obtained, and the driving directions of the crossing vehicles divided into each second group are straight, left turn, and right turn respectively. After obtaining the exit trajectory point cluster center, the distance between the exit trajectory point of each crossing vehicle and each exit trajectory point cluster center can be determined respectively, and the crossing vehicles can be divided into the second group based on the distance, for example, the crossing vehicles can be divided into the second group represented by the exit trajectory point cluster center with the closest distance to its exit trajectory point. Then, the traffic flow from the target intersection to different driving directions can be determined based on the driving direction category represented by each second group and the number of crossing vehicles in each second group.

[0113] In the related art, when determining traffic flow, usually only the traffic flow of a certain lane can be determined, and the traffic flow from the intersection to various driving directions cannot be detected, that is, the traffic flow in various directions such as U-turns and turns on multi-function lanes cannot be detected. The method provided in the embodiment of the present disclosure can determine the traffic flow from the target intersection to different directions, so as to better control the traffic flow based on these traffic flow indicators.

[0114] In some embodiments, the driving direction may include one or more of going straight, turning left, turning right, and turning around. Of course, the categories of driving directions may be set according to the specific conditions of the intersection. For example, the categories of driving directions are different for cross intersections, T-shaped intersections, intersections where turning around is allowed and intersections where turning around is not allowed. For intersections with more complex road conditions, there may be more categories of driving directions.

[0115] Since there may be recognition errors when tracking and detecting vehicles, resulting in errors in the tracking results, the determined vehicle driving trajectory may also be wrong. Since the exit trajectory point cluster center is the basis for grouping vehicles that cross the line, accurately determining the exit trajectory point cluster center is the key to accurately grouping vehicles that cross the line. Therefore, in some embodiments, before clustering the exit trajectory points based on the coordinates of the exit trajectory points of the vehicles that cross the line, the vehicles that cross the line with abnormal driving trajectories can be filtered out according to the driving trajectory information of the vehicles that cross the line. For example, the vehicles with abnormal driving trajectories can be vehicles with interrupted driving trajectories. By removing the vehicles that cross the line with abnormal driving trajectories, and then clustering the exit trajectory points of the vehicles that cross the line with normal driving trajectories that have been screened out, the exit point cluster center is obtained and the vehicles that cross the line are grouped based on the exit trajectory point cluster center, the vehicles that cross the line can be grouped more accurately.

[0116] After dividing the crossing vehicles into one or more second groups based on the distance between the crossing vehicles and the exit trajectory point cluster center, the driving direction category represented by each second group can be determined, for example, whether the second group represents a straight, left turn, or right turn direction, so as to determine the driving direction of the crossing vehicles divided into the second group. In some embodiments, the driving direction represented by each second group can be determined based on the number of exit trajectory point cluster centers obtained by clustering. For example, in some embodiments, if the number of exit trajectory point cluster centers is consistent with the number of driving direction categories included in the target intersection, the angle between the line connecting the exit trajectory point cluster center representing each second group and the detection line center and the detection line can be determined respectively, and then the driving direction represented by each second group is determined based on the sorting result of the angle. Usually, the size relationship between the angle between the line connecting the center of the exit trajectory point and the center of the detection line of the vehicles heading from the target intersection to each driving direction and the detection line is certain. Therefore, when the number of the exit trajectory point cluster centers is consistent with the number of driving directions, it means that there are vehicles crossing the line in each driving direction. Therefore, the driving direction represented by each second group can be directly determined based on the sorting result of the angle between the line connecting the center of the exit trajectory point cluster and the center of the detection line representing the second group and the detection line. Of course, in some embodiments, the angle can also be the angle between the exit trajectory point cluster center and the stop line of the target intersection, or the center of the zebra crossing, which can be set according to actual conditions.

[0117] For example, in some embodiments, the driving directions of vehicles flowing out of the target intersection include: going straight, turning left, turning right, and turning around, and the number of determined exit trajectory point cluster centers is exactly 4, that is, there are 4 second groups. Then, when determining the driving direction represented by each second group based on the sorting result of the angle between the exit point cluster center representing each second group and the detection line, the second groups can be sorted in the order of the angle from small to large, and the driving directions corresponding to the sorted second groups are: turning around, turning right, going straight, and turning left. Figure 4 As shown in , the driving directions of vehicles flowing out of the target intersection include: straight ahead, left turn, right turn and U-turn. Figure 5As shown in the figure, the points in the figure represent the exit trajectory points of the crossing vehicles, wherein the cluster center of the exit trajectory points in the U-turn direction is P1 (black dot in the figure), the cluster center of the exit trajectory points in the right turn direction is P2 (black dot in the figure), the cluster center of the exit trajectory points in the straight direction is P3 (black dot in the figure), and the cluster center of the exit trajectory points in the left turn direction is P4 (black dot in the figure), and the center point of the detection line is P0, wherein the angle between P1P0 and the detection line is θ1, the angle between P2P0 and the detection line is θ2, the angle between P3P0 and the detection line is θ3, and the angle between P4P0 and the detection line is θ4. It can be seen from the figure that the sizes of the above four angles will follow the following rule: θ1<θ2<θ3<θ4. Therefore, if there are exactly four cluster centers of the exit trajectory points, that is, the crossing vehicles can be divided into 4 second groups, that is, the driving direction categories represented by the 4 second groups can be determined based on the sorting results of the angles.

[0118] In some implementations, if the number of exit point cluster centers is less than the number of driving direction categories included in the target intersection, then the driving direction category represented by each second group cannot be accurately determined based only on the relationship between the angle between the line connecting the exit trajectory point cluster center representing each second group and the detection line center and the detection line. For example, assuming that the driving direction categories include U-turn, right turn, straight ahead, and left turn, and the number of exit trajectory point cluster centers determined is 2, that is, there are only 2 second groups, then the driving direction category represented by the two second groups cannot be accurately determined based only on the relationship between the angle between the line connecting the exit trajectory point cluster center representing the two second groups and the detection line center and the detection line. For example, assuming that the angles between the exit trajectory point cluster center representing the two second groups and the detection line center and the detection line are θ1 and θ2, respectively, and θ1>θ2, then the driving direction categories represented by the two groups may be right turn and straight ahead, or may be straight ahead and left turn, etc.

[0119] In view of this situation, the driving direction of the crossing vehicle can be pre-judged based on the driving trajectory of the crossing vehicle to obtain the pre-judgment result of the driving direction of each crossing vehicle, and then the driving direction category represented by each second group can be assisted in determining based on the pre-judgment result. For example, in some embodiments, for the crossing vehicles in each second group after division, the driving direction category to which each crossing vehicle in each second group belongs can be determined based on the driving trajectory of each crossing vehicle, and then the target driving direction category is determined from the driving direction categories to which each crossing vehicle in the second group belongs, wherein the number of crossing vehicles in the target driving direction category is greater than the number of crossing vehicles in other driving direction categories, and then the target driving direction category is used as the driving direction category represented by the second group.

[0120] For example, suppose that the exit trajectory points of the crossing vehicles are clustered to obtain four exit trajectory point cluster centers a, b, c, and d, and then each crossing vehicle is divided into the groups represented by the above four cluster centers based on the distance between each crossing vehicle and the cluster center. It is assumed that they are group A, group B, group C, and group D, respectively. Among them, the IDs of the crossing vehicles in group A are {1, 2, 3, 4, 5}, the IDs of the crossing vehicles in group B are {6, 7, 8, 9}, the IDs of the crossing vehicles in group B are {10, 11, 12, 13, 14, 15}, and the IDs of the crossing vehicles in group D are {16, 17, 18, 19, 20}. In order to determine the driving direction category represented by group A, group B, group C and group D respectively (that is, the driving direction of the vehicles in the group), the driving directions of the vehicles crossing the line {1, 2, 3, 4, 5} in group A can be determined based on their driving trajectories. For example, vehicle 1 turns left, vehicle 2 turns left, vehicle 3 turns left, vehicle 4 goes straight, and vehicle 5 turns right. Among them, the number of vehicles turning left is the largest, so it can be determined that the driving direction represented by group A is turning left.

[0121] In some embodiments, a set of vehicles crossing the line with different driving direction categories can also be obtained based on the driving trajectory of the vehicles crossing the line, and then the driving direction category represented by the second group is determined based on the identification of the vehicles crossing the line in each set and the comparison result of the identification of the vehicles crossing the line in the second group. For example, assuming that the ID of the vehicles crossing the line in the straight direction based on the driving trajectory information of the vehicles crossing the line is {1, 2, 3, 4, 5}, the ID of the vehicles crossing the line in the left turn direction is {6, 7, 8, 9}, and the vehicle ID of the second group A is {1, 2, 3, 4}, which is the smallest difference from the ID of the vehicles crossing the line in the straight direction, so the driving direction represented by the second group A is execution.

[0122] In some embodiments, when the driving direction of the crossing vehicles is pre-judged based on the driving trajectories of the crossing vehicles in each second group and the driving direction category of each crossing vehicle in the second group is obtained, the driving trajectories of the crossing vehicles can be linearly fitted, and the vehicles whose driving directions are in the straight direction can be determined from the crossing vehicles according to the linear fitting results. Since the driving trajectories of the vehicles in the straight direction tend to be straight lines as a whole, the driving directions of the crossing vehicles whose driving trajectories have linear fitting results tending to be straight lines can be determined as the straight direction.

[0123] In some embodiments, a linear fitting can be performed on the driving trajectory of the crossing vehicle. For the crossing vehicle whose driving direction is not straight ahead as determined by the result of the linear fitting, the cosine similarity between the driving trajectory of the crossing vehicle in the non-straight ahead direction and the detection line can be determined. Then, the crossing vehicle whose driving direction is a left turn and the crossing vehicle whose driving direction is a right turn can be determined from the non-straight ahead vehicles according to the cosine similarity. For example, assuming that the coordinates of the vehicle trajectory point in the previous video frame of the current video frame are: p pre =(x pre ,y pre ), the coordinates of the vehicle trajectory point in the current video frame are: p af =(x af ,y af ); the coordinates of the two endpoints of the detection line are: p1 = (x1, y1), p2 = (x2, y2), then the vector representing the driving trajectory can be obtained: Vector representing the detection line: Then the cosine similarity of the driving trajectory and the detection line can be calculated by the following formula (2):

[0124]

[0125] After obtaining the cosine sum of the angles of each non-straight-moving vehicle, it is possible to preliminarily determine whether each non-straight-moving vehicle is a left-turning vehicle or a right-turning vehicle based on the cosine similarity. For example, if the cosine similarity is greater than a preset threshold, it is a right turn, and if it is less than the preset threshold, it is a left turn.

[0126] Among them, when performing linear fitting on the driving trajectory of the crossing vehicle and determining the angle between the vehicle's driving trajectory and the detection line, a frame extraction method can be used to extract multiple video frames at intervals, and the driving trajectory of the crossing vehicle is determined based on the trajectory points of the crossing vehicle on the extracted video frames.

[0127] Since the number of U-turn vehicles on the road is usually small, when clustering the exit trajectory points of crossing vehicles, the exit trajectory points of vehicles in the U-turn direction are usually treated as noise points, resulting in the number of exit trajectory point cluster centers actually determined to be 1 less than the number of actual driving directions. For example, assume that the driving directions of crossing vehicles passing the target intersection include: U-turn, right turn, straight, and left turn. However, since the number of U-turn vehicles is very small, far less than the number of vehicles in other directions, when clustering the exit trajectory points using the clustering algorithm, the exit trajectory points of U-turn vehicles are usually treated as noise points, so that the final exit trajectory point cluster centers are only 3, which will lead to missed detection of U-turn vehicles.

[0128] In order to solve this problem, in some embodiments, if the number of exit trajectory point cluster centers is less than the number of driving directions, it can be determined whether there are U-turn vehicles among the vehicles crossing the line. If not, the driving direction represented by each exit trajectory point cluster center is determined based on the pre-judgment result of the driving direction of each vehicle crossing the line. If so, all U-turn vehicles can be screened out from the vehicles crossing the line. Since the angle between the driving trajectory of the U-turn vehicle and the detection line usually tends to 0 or is less than 0, the angle between the driving trajectory of the vehicle crossing the line and the detection line can be determined, and the vehicles with the angle less than or equal to 0 can be screened out from the vehicles crossing the line, and the driving direction of the vehicle with the angle less than or equal to 0 is determined as the U-turn direction.

[0129] Then, for other non-U-turn vehicles, the driving direction categories represented by the second group where the other non-U-turn vehicles are located can be further determined to determine the driving directions of these vehicles. Among them, the driving direction category represented by the second group can be determined based on the angle sorting results in the above embodiment, or it can be determined in combination with the driving direction categories predicted by the driving trajectories of the vehicles in each group. For example, when the number of driving direction categories included in the target intersection is 4, and the number of exit trajectory point cluster centers is 3, after filtering out the vehicles in the U-turn direction, for the remaining 3 second groups of crossing vehicles, the sorting results of each second group can be determined based on the sorting results of the angle between the connection between the exit trajectory point cluster centers representing these 3 second groups and the detection line center and the detection line. Of course, the driving direction category of the crossing vehicles in each second group can be predicted in combination with the driving trajectories of the crossing vehicles, and the driving direction category represented by the second group can be determined based on the predicted results. Of course, when the number of driving direction categories included in the target intersection is 4, and the number of exit trajectory point cluster centers is 2, after filtering out the vehicles in the U-turn direction, for the vehicles crossing the line in the remaining 2 second groups, their driving direction categories can be predicted based on the driving trajectories of the vehicles crossing the line in each second group, and the driving direction category represented by the second group can be determined based on the prediction results.

[0130] After determining the traffic flow index of the target intersection, the traffic flow can be further controlled based on the traffic flow index. For example, the traffic lights can be controlled based on the traffic flow index, or the road traffic conditions can be analyzed based on the traffic flow index. For sections with large traffic flow, measures to close the section can be taken, or the traffic flow conditions of each lane can be updated to the user in real time so that the user can avoid congested sections according to the traffic flow conditions. In some embodiments, the traffic lights at the target intersection can be controlled based on the determined traffic flow index. For example, the duration of the traffic lights at the target intersection can be adjusted in real time according to the traffic flow in each driving direction. If the traffic flow in a certain direction is large, the duration of the green light in that direction can be appropriately extended to avoid traffic problems such as congestion at the target intersection in time.

[0131] Corresponding to the above method, the embodiment of the present disclosure also provides a device for determining traffic flow index, such as Figure 6 As shown, the device comprises:

[0132] An acquisition module 61 is used to acquire detection results of tracking multiple vehicles in a traffic video, wherein the traffic video is a video of a target intersection collected, and the detection results include driving trajectory information of the multiple vehicles;

[0133] A processing module 62, configured to determine a crossing vehicle from the plurality of vehicles based on the driving trajectory information, wherein the driving trajectory of the crossing vehicle intersects with a detection line of one or more lanes covering the target intersection;

[0134] The clustering module 63 is used to perform clustering processing on the crossing vehicles and determine the traffic flow index of the target intersection based on the clustering processing result.

[0135] In some embodiments, the detection line coincides with a stop line or a zebra crossing at the target intersection.

[0136] In some embodiments, when the processing module is used to determine the crossing vehicle from the multiple vehicles based on the driving trajectory information, it is specifically used to:

[0137] Determine a crossing vehicle from the vehicles in each video frame of the traffic video based on the driving trajectory information;

[0138] The vehicles that have crossed the line in each video frame are accumulated to obtain the vehicles that have crossed the line among the multiple vehicles.

[0139] In some embodiments, the driving trajectory information includes coordinates of trajectory points of the multiple vehicles in different video frames of the traffic video, and the processing module is used to determine the crossing vehicle from the vehicles in each video frame of the traffic video based on the driving trajectory information, specifically for:

[0140] For each current video frame, perform the following operations:

[0141] Based on the driving track information of each vehicle in the current video frame, determine the coordinates of a first track point of each vehicle in the current video frame, and the coordinates of a second track point of each vehicle in a frame previous to the current video frame;

[0142] When it is determined that a line connecting the first track point and the second track point intersects the detection line based on the coordinates of the first track point, the coordinates of the second track point and the coordinates of the two end points of the detection line, the vehicle is determined as a crossing vehicle.

[0143] In some embodiments, the traffic flow index includes the traffic flow of one or more lanes of the target intersection, and the clustering module is used to perform clustering processing on the crossing vehicles, and when determining the traffic flow index of the target intersection based on the clustering processing result, it is specifically used to:

[0144] Performing clustering processing on the intersections of the driving trajectory of the crossing vehicle and the detection line to obtain one or more intersection cluster centers, wherein each intersection cluster center represents a first group;

[0145] Based on the distance between the intersection of the crossing vehicle and the one or more intersection cluster centers, the crossing vehicle is divided into the first group;

[0146] Based on the lanes represented by each first group and the number of crossing vehicles in each first group, the traffic flow of one or more lanes of the target intersection is determined.

[0147] In some embodiments, the operation of clustering the intersections of the driving trajectory of the crossing vehicle and the detection line is performed after a preset condition is triggered, and the preset condition includes:

[0148] The number of vehicles crossing the line reaches a preset number threshold; and / or

[0149] The duration of the traffic video reaches a preset duration threshold.

[0150] In some embodiments, the traffic flow index includes the traffic flow from the target intersection to different driving directions, and the clustering module is used to cluster the crossing vehicles, and when determining the traffic flow index of the target intersection based on the clustering result, it is specifically used to:

[0151] Performing clustering processing on the exit trajectory points to obtain one or more exit trajectory point cluster centers, wherein the exit trajectory points are trajectory points of the crossing vehicle in the video frame in which the crossing vehicle is detected for the last time, and each exit trajectory point cluster center represents a second group;

[0152] Based on the distance between the exit trajectory point of the crossing vehicle and the one or more exit trajectory point cluster centers, the crossing vehicle is divided into the second group;

[0153] Based on the driving direction category represented by each second group and the number of crossing vehicles in each second group, the vehicle flow from the target intersection to different driving directions is determined.

[0154] In some embodiments, before the device performs clustering processing on the exit trajectory points, the device is further used to:

[0155] Based on the driving trajectory information of the crossing vehicles, the crossing vehicles with abnormal driving trajectories are filtered out, wherein the crossing vehicles with abnormal driving trajectories include vehicles with interrupted driving trajectories.

[0156] In some embodiments, the driving direction category represented by each second group is determined based on the following method:

[0157] When the number of the one or more exit trajectory point cluster centers is consistent with the number of driving direction categories included in the target intersection, respectively determine the angle between the line connecting the exit trajectory point cluster center representing each second group and the center of the detection line and the detection line;

[0158] The driving direction category represented by each second group is determined based on the sorting result of the angles.

[0159] In some embodiments, the driving direction category represented by each second group is determined based on the following method:

[0160] In a case where the number of the one or more exit point cluster centers is less than the number of driving direction categories included in the target intersection, determining the driving direction category to which each crossing vehicle in each second group belongs based on the driving trajectory of each crossing vehicle in each second group;

[0161] Determine a target driving direction category from the driving direction categories to which each crossing vehicle in the second group belongs, wherein the number of crossing vehicles in the target driving direction category is greater than the number of crossing vehicles in other driving direction categories;

[0162] The target driving direction category is used as the driving direction category represented by the second group.

[0163] In some embodiments, the method further comprises:

[0164] Determine the angle between the driving trajectory of the crossing vehicle and the detection line;

[0165] The driving direction of the crossing vehicle with the angle less than or equal to 0 is determined as the U-turn direction.

[0166] In some embodiments, determining the driving direction category of each crossing vehicle in each second group based on the driving trajectory of each crossing vehicle in each second group includes:

[0167] Performing linear fitting on the driving trajectory of each of the crossing vehicles in the second group;

[0168] Based on the result of linear fitting, a crossing vehicle whose driving direction is a straight direction is determined from the crossing vehicles in each of the second groups.

[0169] In some embodiments, determining the driving direction category of each crossing vehicle in each second group based on the driving trajectory of each crossing vehicle in each second group includes:

[0170] Performing linear fitting on the driving trajectories of the crossing vehicles in each of the second groups, and determining the crossing vehicles whose driving directions are not straight directions based on the results of the linear fitting;

[0171] Based on the cosine similarity between the driving trajectories of the vehicles crossing the line in the non-straight direction and the detection line, the vehicles crossing the line with a left turn and the vehicles crossing the line with a right turn are determined from the vehicles crossing the line in the non-straight direction.

[0172] In some embodiments, after determining the traffic flow at the target intersection, the device is further configured to:

[0173] The traffic light at the target intersection is controlled based on the traffic flow.

[0174] In addition, the present disclosure also provides an electronic device, such as Figure 7 As shown, the electronic device includes a processor 71, a memory 72, and computer instructions stored in the memory 72 and executable by the processor 71. When the processor executes the computer instructions, the method described in any of the above embodiments can be implemented.

[0175] The present disclosure also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any of the above embodiments is implemented.

[0176] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0177] It can be known from the above description of the implementation mode that the technicians in this field can clearly understand that the embodiments of this specification can be implemented by means of software plus the necessary general hardware platform. Based on such an understanding, the technical solution of the embodiments of this specification can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium, such as 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 device, etc.) to execute the methods described in each embodiment or some parts of the embodiments of this specification.

[0178] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0179] Each embodiment in this specification is described in a progressive manner, and the same and 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, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment scheme of this specification. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0180] The above is only a specific implementation of the embodiments of this specification. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiments of this specification. These improvements and modifications should also be regarded as the protection scope of the embodiments of this specification.

Claims

1. A method for determining a traffic flow index, characterized in that: The method comprises: Acquire detection results of tracking and detecting multiple vehicles in a traffic video, wherein the traffic video is a video collected at a target intersection, and the detection results include driving trajectory information of the multiple vehicles; Determine a crossing vehicle from the plurality of vehicles based on the driving trajectory information, wherein the driving trajectory of the crossing vehicle intersects with a detection line covering one or more lanes of the target intersection; Performing clustering processing on the crossing vehicles, and determining the traffic flow index of the target intersection based on the clustering processing result; The traffic flow index includes the traffic flow from the target intersection to different driving directions, and the clustering process is performed on the crossing vehicles, and the traffic flow index of the target intersection is determined based on the clustering process result, including: Performing clustering processing on the exit trajectory points to obtain one or more exit trajectory point cluster centers, wherein the exit trajectory point is a trajectory point of the crossing vehicle in the video frame in which the crossing vehicle is detected for the last time, and each exit trajectory point cluster center represents a second group; Based on the distance between the exit trajectory point of the crossing vehicle and the one or more exit trajectory point cluster centers, the crossing vehicle is divided into the second group; Determine the traffic volume from the target intersection to different driving directions based on the driving direction category represented by each second group and the number of crossing vehicles in each second group; The driving direction category represented by each second group is determined based on the following method: When the number of the one or more exit trajectory point cluster centers is consistent with the number of driving direction categories included in the target intersection, respectively determine the angle between the line connecting the exit trajectory point cluster center representing each second group and the center of the detection line and the detection line; Determining the category of the driving direction represented by each second group based on the ordering result of the included angles; When the number of the one or more exit trajectory point cluster centers is less than the number of driving direction categories included in the target intersection, determining the driving direction category to which each crossing vehicle in each second group belongs based on the driving trajectory of each crossing vehicle in each second group; Determine a target driving direction category from the driving direction categories to which each crossing vehicle in the second group belongs, wherein the number of crossing vehicles in the target driving direction category is greater than the number of crossing vehicles in other driving direction categories; The target driving direction category is used as the driving direction category represented by the second group.

2. The method according to claim 1, characterized in that The detection line coincides with the stop line or zebra crossing of the target intersection.

3. The method according to claim 1 or 2, characterized in that: Determining a crossing vehicle from the plurality of vehicles based on the driving trajectory information includes: Determine a crossing vehicle from the vehicles in each video frame of the traffic video based on the driving trajectory information; The vehicles that have crossed the line in each video frame are accumulated to obtain the vehicles that have crossed the line among the multiple vehicles.

4. The method according to claim 3, characterized in that: The driving trajectory information includes coordinates of trajectory points of the plurality of vehicles in different video frames of the traffic video, and determining a crossing vehicle from vehicles in each video frame of the traffic video based on the driving trajectory information includes: For each current video frame, perform the following operations: Based on the driving track information of each vehicle in the current video frame, determine the coordinates of a first track point of each vehicle in the current video frame, and the coordinates of a second track point of each vehicle in a frame previous to the current video frame; When it is determined that a line connecting the first track point and the second track point intersects the detection line based on the coordinates of the first track point, the coordinates of the second track point and the coordinates of the two end points of the detection line, the vehicle is determined as a crossing vehicle.

5. The method according to claim 1, characterized in that The traffic flow index includes the vehicle flow of one or more lanes of the target intersection, clustering the crossing vehicles, and determining the traffic flow index of the target intersection based on the clustering processing result, including: Performing clustering processing on the intersections of the driving trajectory of the crossing vehicle and the detection line to obtain one or more intersection cluster centers, wherein each intersection cluster center represents a first group; Based on the distance between the intersection of the crossing vehicle and the one or more intersection cluster centers, the crossing vehicle is divided into the first group; Based on the lanes represented by each first group and the number of crossing vehicles in each first group, the traffic flow of one or more lanes of the target intersection is determined.

6. The method according to claim 5, characterized in that The operation of clustering the intersections of the driving trajectory of the crossing vehicle and the detection line is performed after a preset condition is triggered, and the preset condition includes: The number of vehicles crossing the line reaches a preset number threshold; and / or The duration of the traffic video reaches a preset duration threshold.

7. The method according to claim 1, characterized in that Before clustering the exit trajectory points, the method further includes: Based on the driving trajectory information of the crossing vehicles, the crossing vehicles with abnormal driving trajectories are filtered out, wherein the crossing vehicles with abnormal driving trajectories include vehicles with interrupted driving trajectories.

8. The method according to claim 1, characterized in that The method further comprises: Determine the angle between the driving trajectory of the crossing vehicle and the detection line; The driving direction of the crossing vehicle with the angle less than or equal to 0 is determined as the U-turn direction.

9. The method according to claim 1, characterized in that: Determining the driving direction category of each crossing vehicle in each second group based on the driving trajectory of each crossing vehicle in each second group includes: Performing linear fitting on the driving trajectory of each of the crossing vehicles in the second group; Based on the result of linear fitting, a crossing vehicle whose driving direction is a straight direction is determined from the crossing vehicles in each of the second groups.

10. The method according to any one of claims 1, 8-9, characterized in that: Determining the driving direction category of each crossing vehicle in each second group based on the driving trajectory of each crossing vehicle in each second group includes: Performing linear fitting on the driving trajectories of the crossing vehicles in each of the second groups, and determining the crossing vehicles whose driving directions are not straight directions based on the results of the linear fitting; Based on the cosine similarity between the driving trajectories of the vehicles crossing the line in the non-straight direction and the detection line, the vehicles crossing the line with a left turn and the vehicles crossing the line with a right turn are determined from the vehicles crossing the line in the non-straight direction.

11. The method according to claim 1, characterized in that: After determining the traffic flow of the target intersection, the method further includes: The traffic light at the target intersection is controlled based on the traffic flow.

12. A device for determining a traffic flow index, characterized in that: The device comprises: An acquisition module, used to acquire detection results of tracking and detecting multiple vehicles in a traffic video, wherein the traffic video is a video of a target intersection collected, and the detection results include driving trajectory information of the multiple vehicles; A processing module, configured to determine a crossing vehicle from the plurality of vehicles based on the driving trajectory information, wherein the driving trajectory of the crossing vehicle intersects with a detection line of one or more lanes covering the target intersection; A clustering module, used for clustering the crossing vehicles and determining the traffic flow index of the target intersection based on the clustering processing result; The traffic flow index includes the traffic flow from the target intersection to different driving directions, and the clustering module is specifically used for: Performing clustering processing on the exit trajectory points to obtain one or more exit trajectory point cluster centers, wherein the exit trajectory point is a trajectory point of the crossing vehicle in the video frame in which the crossing vehicle is detected for the last time, and each exit trajectory point cluster center represents a second group; Based on the distance between the exit trajectory point of the crossing vehicle and the one or more exit trajectory point cluster centers, the crossing vehicle is divided into the second group; Determine the traffic volume from the target intersection to different driving directions based on the driving direction category represented by each second group and the number of crossing vehicles in each second group; The driving direction category represented by each second group is determined based on the following method: When the number of the one or more exit trajectory point cluster centers is consistent with the number of driving direction categories included in the target intersection, respectively determine the angle between the line connecting the exit trajectory point cluster center representing each second group and the center of the detection line and the detection line; Determining the category of the driving direction represented by each second group based on the ordering result of the included angles; When the number of the one or more exit trajectory point cluster centers is less than the number of driving direction categories included in the target intersection, determining the driving direction category to which each crossing vehicle in each second group belongs based on the driving trajectory of each crossing vehicle in each second group; Determine a target driving direction category from the driving direction categories to which each crossing vehicle in the second group belongs, wherein the number of crossing vehicles in the target driving direction category is greater than the number of crossing vehicles in other driving direction categories; The target driving direction category is used as the driving direction category represented by the second group.

13. An electronic device, characterized in that: The electronic device includes a processor, a memory, and computer instructions stored in the memory and executable by the processor. When the processor executes the computer instructions, the method according to any one of claims 1 to 11 can be implemented.

14. A computer-readable storage medium, characterized in that: The storage medium stores computer instructions, which, when executed, implement the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Lane information detection method, device, apparatus and medium

    CN110389995A

  • Passing flow confirmation method and device for overwater cross section line and computer equipment

    CN111932945A