Lane identification method and device, storage medium and electronic equipment
By obtaining and grouping vehicle position information in the surveillance video, and using lane segmentation algorithm to identify lane segmentation lines, the problem of road traffic system not being able to identify lanes is solved, efficient and accurate lane recognition is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202411845519.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-05-13
AI Technical Summary
The current highway traffic system cannot effectively identify lanes in the road, which consumes a lot of manpower and material resources when installing lane identification hardware, and may affect the smoothness of traffic.
By obtaining the monitoring video within the preset time, the position information of the vehicle in each frame of the image is determined, and the information is grouped. Based on the grouping results and the preset lane segmentation algorithm, the lane division line between the lanes in the road is obtained, and the lane to which the vehicle to be detected is located is judged.
It realizes accurate identification of lanes in the road, saves manpower and material resources, does not affect the smoothness of traffic, and significantly improves the user experience.
Smart Images

Figure CN119992468A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of human-computer technology, and in particular to a lane recognition method and device, a storage medium and an electronic device. Background Art
[0002] The current highway traffic system usually does not have the ability to identify lanes. For example, national highways and rural roads only have ordinary surveillance cameras. Some special areas such as tunnels are not convenient for installing gantries, and lane recognition cannot be achieved through radar technologies such as millimeter waves. If lane recognition is performed by adding lane recognition hardware, it will not only consume a lot of manpower and material resources, but may also affect the smoothness of traffic, especially during construction or installation, and cause traffic congestion. Summary of the invention
[0003] The embodiments of the present application provide a lane recognition method and device, a storage medium, and an electronic device to at least solve the technical problem in the related art that the highway traffic system cannot effectively recognize the lanes on the road.
[0004] According to one aspect of an embodiment of the present application, a lane recognition method is provided, including: obtaining a surveillance video of a target road within a preset time length, and determining the position information of a vehicle in each frame of the surveillance video; grouping the position information of multiple vehicles according to the obtained position information of the multiple vehicles; obtaining a lane dividing line between lanes in the target road based on the grouping result and a preset lane segmentation algorithm; and obtaining the lane in which the target vehicle to be detected is located according to the lane dividing line.
[0005] According to another aspect of an embodiment of the present application, a lane recognition device is also provided, including: a first acquisition unit, used to acquire a surveillance video of a target road within a preset time length, and determine the position information of the vehicle in each frame image of the surveillance video; a grouping unit, used to group the position information of multiple vehicles according to the acquired position information of the multiple vehicles; a second acquisition unit, used to acquire the lane dividing line between lanes in the target road based on the grouping result and a preset lane segmentation algorithm; and a third acquisition unit, used to acquire the lane in which the target vehicle to be detected is located according to the lane dividing line.
[0006] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the lane recognition method through the computer program.
[0007] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned lane recognition method when running.
[0008] In an embodiment of the present application, a method is adopted in which a surveillance video of a target road within a preset time length is obtained to determine the position information of the vehicle in each frame of the surveillance video; the position information of the multiple vehicles is grouped according to the obtained position information of the multiple vehicles; based on the grouping result and a preset lane segmentation algorithm, the lane dividing line between the lanes in the target road is obtained; and the lane in which the target vehicle to be detected is located is obtained according to the lane dividing line; in the above method, the position information of the vehicle is grouped according to the position information of the vehicle in the acquired surveillance video, and the lane dividing line is determined according to the grouping result, which can not only accurately and effectively identify the lanes in the road, but also save a lot of manpower and material resources, and will not affect the smoothness of traffic travel, and significantly improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0010] Figure 1 is a schematic diagram of an application environment of an optional lane recognition method according to an embodiment of the present application;
[0011] Figure 2 is a schematic diagram of an application environment of another optional lane recognition method according to an embodiment of the present application;
[0012] Figure 3 is a flow chart of an optional lane recognition method according to an embodiment of the present application;
[0013] Figure 4 is a schematic diagram of a vehicle recognition scenario of an optional lane recognition method according to an embodiment of the present application;
[0014] Figure 5 is a schematic diagram of vehicle trajectory information processing according to an optional lane recognition method of an embodiment of the present application;
[0015] Figure 6 is a schematic diagram of vehicle trajectory points obtained by a lane recognition method according to an embodiment of the present application;
[0016] Figure 7 is a schematic diagram of another vehicle trajectory point obtained by the lane recognition method according to an embodiment of the present application;
[0017] Figure 8 is a schematic diagram of another vehicle trajectory point obtained by the lane recognition method according to an embodiment of the present application;
[0018] Fig. 9 is a schematic diagram of a lane dividing line obtained by a lane recognition method according to an embodiment of the present application;
[0019] Fig.10 is a schematic diagram of a vehicle recognition scenario of another optional lane recognition method according to an embodiment of the present application;
[0020] Fig.11 is a flow chart of another optional lane recognition method according to an embodiment of the present application;
[0021] Fig.12 is a schematic structural diagram of another optional lane recognition device according to an embodiment of the present application;
[0022] Fig.13 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] According to one aspect of an embodiment of the present application, a lane recognition method is provided. Optionally, as an optional implementation, the lane recognition method may be, but is not limited to, applied to Figure 1In the application environment shown. The application environment includes: a terminal device 102 for human-computer interaction with a user, a network 104, and a server 106. A user 108 can perform human-computer interaction with the terminal device 102, and a lane recognition client runs in the terminal device 102. The above-mentioned terminal device 102 includes a human-computer interaction screen 1022, a processor 1024 and a memory 1026. The human-computer interaction screen 1022 is used to display the location information of the vehicle and the lane in which the vehicle is located; the processor 1024 is used to obtain the monitoring video of the target road within a preset time length. The memory 1026 is used to store the monitoring video of the target road within a preset time length, and the lane information in which the vehicle is located.
[0026] In addition, the server 106 includes a database 1062 and a processing engine 1064. The database 1062 is used to obtain monitoring videos of the target road within a preset time period and determine the position information of the vehicle in each frame of the monitoring video; group the position information of the multiple vehicles according to the obtained position information; obtain the lane dividing lines between the lanes in the target road based on the grouping results and a preset lane segmentation algorithm; obtain the lane where the target vehicle to be detected is located according to the lane dividing lines; and send the lane where the above-mentioned target vehicle is located to the client of the above-mentioned terminal device 102.
[0027] In one or more embodiments, the lane recognition method described above in the present application can be applied to Figure 2 In the application environment shown. Figure 2 As shown, human-computer interaction can be performed between user 202 and user device 204. User device 204 includes memory 206 and processor 208. In this embodiment, user device 204 can refer to but not be limited to executing the operations executed by the above-mentioned terminal device 102 to display the lane where the target vehicle is located.
[0028] Optionally, the terminal device 102 and the user device 204 include but are not limited to mobile phones, tablet computers, laptop computers, PCs, vehicle-mounted electronic devices, wearable devices and other terminals, and the network 104 may include but is not limited to wireless networks or wired networks. Among them, the wireless network includes: WIFI and other networks that realize wireless communication. The wired network may include but is not limited to: wide area network, metropolitan area network, local area network. The server 106 may include but is not limited to any hardware device that can perform computing. The server may be a single server, or a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0029] The current highway traffic system usually does not have the ability to identify lanes. For example, national highways and rural roads only have ordinary surveillance cameras. Some special areas such as tunnels are not convenient for installing gantries, and lane recognition cannot be achieved through radar technologies such as millimeter waves. If lane recognition is performed by adding lane recognition hardware, it will not only consume a lot of manpower and material resources, but may also affect the smoothness of traffic, especially during construction or installation, and cause traffic congestion.
[0030] To solve the above technical problems, as an optional implementation method, Figure 3 As shown, the embodiment of the present application provides a lane recognition method, comprising the following steps:
[0031] S302, obtaining a surveillance video of a target road within a preset time period, and determining the position information of a vehicle in each frame of the surveillance video;
[0032] S304, grouping the position information of the multiple vehicles according to the acquired position information of the multiple vehicles;
[0033] S306, based on the grouping result and a preset lane segmentation algorithm, obtaining lane segmentation lines between lanes in the target road;
[0034] S308: Acquire the lane where the target vehicle to be detected is located according to the lane dividing line.
[0035] Specifically, in an embodiment of the present application, the above-mentioned preset time length can be, for example, a time period greater than 10 minutes; in one example, the number of vehicles passing through the surveillance video of the target road within the preset time length can be any value greater than 30, ensuring a sufficient amount of data to complete the configuration calculation; the above-mentioned time period can ensure that the system can collect enough vehicle data to perform effective lane recognition and dividing line configuration calculations.
[0036] Here, a clustering algorithm may be used to group the trajectories of the multiple vehicles according to the acquired position information of the multiple vehicles, so as to obtain groups with the same number of lanes as the target road; the above clustering algorithm may be, for example, a density-based clustering algorithm, such as the DBSCAN algorithm.
[0037] The above-mentioned preset lane segmentation algorithm can be, for example, a binary classification algorithm, which includes a support vector machine (SVM) algorithm or a decision tree algorithm. After the trajectory points of the vehicle trajectory are grouped, the binary classification algorithm can be used to delineate the optimal straight line segmentation boundaries between different classification groups, and these boundary lines are the final lane segmentation line configurations. After the lane segmentation lines in the target road are determined, the system can use the real-time tracking function of the target detection model to automatically detect the current position of each vehicle in the video stream and determine the lane number currently occupied by it.
[0038] In an embodiment of the present application, a method is adopted in which a surveillance video of a target road within a preset time length is obtained to determine the position information of the vehicle in each frame of the surveillance video; the position information of the multiple vehicles is grouped according to the obtained position information of the multiple vehicles; based on the grouping result and a preset lane segmentation algorithm, the lane dividing line between the lanes in the target road is obtained; and the lane in which the target vehicle to be detected is located is obtained according to the lane dividing line; in the above method, the position information of the vehicle is grouped according to the position information of the vehicle in the acquired surveillance video, and the lane dividing line is determined according to the grouping result, which can not only accurately and effectively identify the lanes in the road, but also save a lot of manpower and material resources, and will not affect the smoothness of traffic travel, and significantly improve the user experience.
[0039] In one or more embodiments, determining the position information of the vehicle in each frame of the surveillance video, wherein the position information includes a track point of the vehicle, includes:
[0040] Obtain the detection frame of the vehicle contained in each frame of the image based on the preset target detection model;
[0041] The coordinate information corresponding to the detection frame in each frame of the image is obtained, and the trajectory point of the vehicle is determined based on the coordinate information.
[0042] Specifically, in the embodiment of the present application, a target detection model, such as a YOLOv8 model, is used to track and identify vehicle data appearing in a surveillance video. Figure 4 As shown in the figure, the YOLOv8 model is used to identify the vehicles that appear in each frame of the initial surveillance video, and a detection frame (green rectangular frame) is generated for each detected vehicle. In addition, the same vehicle can be tracked across frames through tracking algorithms such as BoT-SORT or ByteTrack; then the detection frame of each vehicle in each frame is recorded to form a corresponding relationship between a vehicle identifier and a detection frame sequence; the vehicle identifier here can be, for example, the vehicle frame number or license plate number.
[0043] Obtain the coordinate information corresponding to the detection frame in each frame of the image. The coordinate information may include, for example, the pixel coordinates of the upper left corner and the lower right corner of the detection frame, or the coordinates of the center point of the detection frame. Determine the trajectory point of the vehicle by using the upper left corner, the lower right corner or the center point of the detection frame.
[0044] Through the above-mentioned target detection model, the lane detection system of the present application can continuously monitor traffic flow, automatically identify the position of each vehicle in the video, and track its movement trajectory in real time.
[0045] In one or more embodiments, obtaining coordinate information corresponding to the detection frame in each frame of the image, and determining the trajectory point of the vehicle based on the coordinate information includes:
[0046] For each frame of the surveillance video, a coordinate system is established by taking any vertex of the frame as the origin and two adjacent edges of the vertex as coordinate axes;
[0047] Determine the coordinate information of any vertex of the detection frame in the coordinate system, and determine the coordinate information as the position information of the vehicle.
[0048] Specifically, in an embodiment of the present application, for each frame image in the monitoring video, any vertex of the image, such as the lower left corner, is selected as the origin (0, 0) of the coordinate system. The two edges adjacent to the vertex are used as coordinate axes to establish a two-dimensional coordinate system. Determine the coordinate information of any vertex of the detection frame, such as the lower left corner in the above coordinate system, and the coordinate information includes an x-coordinate and a y-coordinate, which respectively represent the position of the vertex of the lower left corner on the x-axis and the y-axis, that is, the position of the vehicle is represented by the coordinates of the vertex of its detection frame. In this way, the position information of the vehicle can correspond to the pixel coordinate system of the image, which is convenient for subsequent calculation and analysis of further lane detection. It should be noted that for the same batch of video frame data, when constructing the origin of the coordinate system, the vertices selected for each frame image are the same. For example, the first frame image data selects the lower left corner as the origin, and the second frame image of the vehicle also selects the lower left corner as the origin, and so on, until the last frame image of the batch of video frame data.
[0049] In one or more embodiments, the lane recognition method further includes:
[0050] Obtaining coordinate information of detection frames corresponding to the same vehicle in multiple consecutive frames of images, and drawing trajectory points corresponding to the detection frames in a target coordinate system according to the coordinate information;
[0051] According to the drawn trajectory point set diagram, the position information corresponding to the vehicle that changes lanes is eliminated.
[0052] Specifically, in the embodiments of the present application, Figure 5As shown, the coordinate information of the trajectory points corresponding to the same vehicle, for example, the vehicle with the vehicle identification number 1, in the continuous multiple frame images is obtained, and then the coordinate information corresponding to the multiple vehicles is used to draw the trajectory points corresponding to the detection frame in the target coordinate system, and the following can be obtained: Figure 6 The trajectory point set diagram shown in FIG. 1 is used to analyze the vehicle's driving trajectory. The vehicle's moving path can be inferred through the position changes of the trajectory points in consecutive frames. The position information corresponding to the vehicle that changes lanes is eliminated, and the following is obtained: Figure 7 The trajectory point set diagram is shown. Lane change is usually manifested as a significant change in the lateral (lane direction) position of the vehicle trajectory point between adjacent frames. Based on the above technical solution, the abnormal data points that may be generated by the lane change behavior are removed, which can improve the accuracy of lane recognition, thereby ensuring that the determination of the lane dividing line is more in line with the actual traffic flow situation.
[0053] In one or more embodiments, grouping the position information of the plurality of vehicles according to the acquired position information of the plurality of vehicles includes:
[0054] Obtaining a preset radius threshold and a minimum number of samples, as well as a trajectory point set consisting of trajectory points corresponding to each vehicle;
[0055] For each trajectory point in the trajectory point set, the following steps are performed: respectively calculating the Euclidean distance between the current trajectory point and the remaining trajectory points in the trajectory point set except the current trajectory point;
[0056] Determine the set of remaining trajectory points corresponding to Euclidean distances less than or equal to the radius threshold as the neighborhood set of the current trajectory point;
[0057] When the number of elements in the neighborhood set is greater than or equal to the minimum number of samples, taking the current trajectory point as a core point;
[0058] Adding the trajectory points in the domain set of the current trajectory point to the current cluster, and taking the other trajectory points in the current cluster except the core point as the current trajectory points to perform the above steps until the number of trajectory points in the current cluster no longer increases;
[0059] All the obtained clusters are regarded as grouping results.
[0060] In one embodiment of the present application, grouping the position information of the plurality of vehicles according to the acquired position information of the plurality of vehicles comprises:
[0061] Obtaining a preset radius threshold and a minimum number of samples, as well as a trajectory point set consisting of trajectory points corresponding to each vehicle;
[0062] The model encapsulated by the DBSCAN algorithm is used to classify the trajectory point set to obtain the grouping result of the trajectory points, where each cluster of trajectory points corresponds to a group.
[0063] Specifically, in an embodiment of the present application, a preset radius threshold eps and a minimum number of samples min_samples, as well as a trajectory point set consisting of trajectory points corresponding to each vehicle are obtained; for the current trajectory point p in the trajectory point set, the Euclidean distances of all other points to the current trajectory point p are calculated, and its neighborhood N(p) is found. If the neighborhood of trajectory point p |N(p)|≥min_samples, then p is set as the core point; starting from the core point, the points in its neighborhood are added to the current cluster, and continue to expand until the number of trajectory points in the current cluster no longer increases. Points that cannot be included in any cluster are marked as noise points, all clusters obtained by excluding the noise points are output, and all clusters are extracted as grouping results. Figure 7 After deleting the noise points in Figure 8 The grouping results shown are two sets of track points of different colors. Based on the above technical solution, the present application deletes the noise points in the track points corresponding to the vehicle, which can ensure that even if there is an abnormal detection or the vehicle is temporarily blocked, the vehicles in each lane can be accurately distinguished.
[0064] In one or more embodiments, the acquiring of the segmentation line information of each lane in the target road based on the grouping result and a preset lane segmentation algorithm includes:
[0065] Extracting a segmentation line coefficient of a separating hyperplane from a trained lane segmentation model, and obtaining a segmentation line equation according to the segmentation line coefficient; the separating hyperplane is used to segment the position information of vehicles in adjacent groups;
[0066] Based on the grouping result and the dividing line equation, obtaining a lane dividing line between lanes in the target road;
[0067] Each lane in the target road is determined according to the lane dividing line.
[0068] In an embodiment of the present application, the trajectory points of the two groups are merged into one data set, and a label is generated for each group of trajectory points. The segmentation line coefficients of the separating hyperplane are extracted from the trained lane segmentation model. The above-mentioned trained lane segmentation model can, for example, be a lane segmentation model that can achieve the optimal straight line segmentation boundary between different classification groups by training a support vector machine (SVM) or other machine learning model through multiple groups of vehicle trajectory classification results. These segmentation boundary lines are the final lane segmentation line configuration. In one example, the above-mentioned segmentation line coefficients are key parameters learned by the support vector machine (SVM) or other machine learning model during the training process to distinguish different lanes. The equation of the linear SVM can be: w1x1+w2x2+b=0, where: w=(w1, w2) is the normal vector of the separating hyperplane (i.e., the direction of the segmentation line). b is the intercept, which represents the offset of the segmentation line on the y-axis. (x1, x2) are the coordinates of the input trajectory point. Extract the split line coefficient from the trained model and get the split line equation: ax1+bx2+c=0; where a, b, c are split line coefficients and a is a positive number. Combine the grouping results and the split line equation, such as Fig. 9 As shown, lane dividing lines 902 between lanes in the target road can be obtained.
[0069] In one or more embodiments, acquiring the lane in which the target vehicle to be detected is located according to the lane dividing line includes:
[0070] Obtaining coordinate information of the trajectory point corresponding to the target vehicle;
[0071] Based on the coordinate information of the trajectory point, determining the positional relationship between the trajectory point and the lane dividing line;
[0072] The lane in which the target vehicle is located is determined according to the positional relationship between the trajectory point and the lane dividing line.
[0073] Specifically, in the embodiment of the present application, for example, the coordinates of the lower right corner of the detection frame where the vehicle is detected are passed into the dividing line equation ax1+bx2+c to obtain the calculation result y. If the y value is less than 0, it means that the vehicle is on the left side of the dividing line, and if the y value is greater than 0, it means that the vehicle is on the right side of the dividing line. In the case of a road with only two lanes, if the y value is less than 0, it means that the vehicle is in the left lane of the road, and if y is greater than 0, it means that the vehicle is in the right lane of the road. Fig.10 As shown, the current vehicle is in the left lane, and the lane number is: line1.
[0074] This application uses the lane dividing lines under the camera's perspective and the real-time tracking function of the target detection model to automatically detect the current position of each vehicle in the video stream and determine the lane number it currently occupies, thereby realizing automatic real-time monitoring and management of traffic flow.
[0075] In one or more embodiments, the lane detection method further includes:
[0076] When the target vehicle is in different lanes at different times in the target road section, determining that the target vehicle has changed lanes;
[0077] When lane changing is prohibited on the target road section, a prompt message prohibiting lane changing is sent to the target vehicle.
[0078] Specifically, in an embodiment of the present application, based on the lane recognition method in the present application, the lanes in which the target vehicle is located at different times in the target section are obtained. If the lanes in which the target vehicle is located at different times in the target section are different, it is determined that the target vehicle has changed lanes; for example, if the target section is a tunnel section, lane changes are prohibited on this section during driving, and a warning or prompt message prohibiting lane changes can be sent in real time to the vehicle that has changed lanes.
[0079] In an application embodiment, in combination Fig.11 As shown, the lane recognition method includes:
[0080] A1. Initialization step: Get camera videos within a certain period of time. The video length must be more than 10 minutes, and the number of vehicles in the video must be more than 30. This ensures that there is enough data to complete the configuration calculation.
[0081] A2. Object detection, tracking and recognition: Run the object detection model (such as YOLOv8) to track and recognize the vehicle data appearing in the video, record the detection frame of each vehicle in each frame, and form a correspondence between the vehicle ID and the detection frame sequence;
[0082] A3. Eliminate the vehicle data that has changed lanes: Eliminate the vehicle IDs that have changed lanes in the video;
[0083] A4. Select the lower right corner coordinates of the remaining detection boxes and run the clustering algorithm: select the lower right corner coordinates of the detection box set obtained after step A3, run the clustering algorithm (such as DBSCAN algorithm), and group the lower right corner coordinates;
[0084] A5. Run the SVM algorithm to draw the segmentation line based on the grouping results: According to the grouping results of step A4, select two adjacent groups respectively, use the SVM algorithm to draw the segmentation line, and use the obtained segmentation line as the lane segmentation line of the current camera, and save the lane segmentation line configuration;
[0085] A6. Configure dividing lines to run real-time lane recognition: The lane detection system accesses the real-time video data of the camera, performs real-time vehicle tracking detection, and uses the configured dividing line to identify the lane number to which the detection frame belongs, so as to determine in real time whether the vehicle has changed lanes.
[0086] This application combines the technical advantages of target detection models, DBSCAN and SVM algorithms, and can automatically and efficiently identify lane dividing lines in traffic monitoring videos and track the lane occupancy of vehicles in real time. It greatly reduces labor costs, improves the automation and accuracy of the system, and also has strong adaptability and is suitable for a variety of complex traffic scenarios. Through this road detection system, traffic management departments can manage traffic more efficiently, optimize traffic order, and provide strong support for the development of intelligent transportation systems.
[0087] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0088] According to another aspect of the embodiments of the present application, a lane recognition device for implementing the lane recognition method is also provided. Fig.12 As shown, the device comprises:
[0089] The first acquisition unit 1202 is used to acquire a surveillance video of a target road within a preset time period, and determine the position information of the vehicle in each frame of the surveillance video;
[0090] The grouping unit 1204 is used to group the position information of the multiple vehicles according to the acquired position information of the multiple vehicles;
[0091] A second acquisition unit 1206, configured to acquire lane dividing lines between lanes in the target road based on the grouping result and a preset lane dividing algorithm;
[0092] The third acquisition unit 1208 is used to acquire the lane where the target vehicle to be detected is located according to the lane dividing line.
[0093] In one or more embodiments, the first acquisition unit 1202 includes:
[0094] A first acquisition module is used to acquire a detection frame of a vehicle contained in each frame of image based on a preset target detection model;
[0095] The second acquisition module is used to obtain the coordinate information corresponding to the detection frame in each frame of the image, and determine the trajectory point of the vehicle based on the coordinate information.
[0096] In one or more embodiments, the second acquisition module includes:
[0097] Establish a subunit for establishing a coordinate system for each frame of the surveillance video by taking any vertex of each frame of the surveillance video as an origin and two adjacent edges of the vertex as coordinate axes;
[0098] The first determining subunit is used to determine the coordinate information of any coordinate point in the detection frame in the coordinate system, and determine the coordinate information as the position information of the vehicle.
[0099] In one or more embodiments, the lane detection device further includes:
[0100] A fourth acquisition unit is used to acquire coordinate information of a detection frame corresponding to the same vehicle in multiple consecutive frames of images, and draw the trajectory points corresponding to the detection frame in a target coordinate system according to the coordinate information;
[0101] The elimination unit is used to eliminate the position information corresponding to the vehicle that changes lanes according to the drawn trajectory point set diagram.
[0102] In one or more embodiments, the grouping unit 1204 includes:
[0103] A third acquisition module is used to obtain a preset radius threshold and a minimum number of samples, and a trajectory point set consisting of trajectory points corresponding to each vehicle;
[0104] An execution module, for each trajectory point in the trajectory point set, performs the following steps: respectively calculating the Euclidean distance between the current trajectory point and the remaining trajectory points in the trajectory point set except the current trajectory point;
[0105] Determine the set of remaining trajectory points corresponding to Euclidean distances less than or equal to the radius threshold as the neighborhood set of the current trajectory point;
[0106] When the number of elements in the neighborhood set is greater than or equal to the minimum number of samples, taking the current trajectory point as a core point;
[0107] Adding the trajectory points in the domain set of the current trajectory point to the current cluster, and taking the other trajectory points in the current cluster except the core point as the current trajectory points to perform the above steps until the number of trajectory points in the current cluster no longer increases;
[0108] All the obtained clusters are regarded as grouping results.
[0109] In one or more embodiments, the second obtaining unit 1206 includes:
[0110] A fourth acquisition module is used to extract a segmentation line coefficient of a separation hyperplane from the trained lane segmentation model, and obtain a segmentation line equation according to the segmentation line coefficient; the separation hyperplane is used to segment the position information of vehicles in adjacent groups;
[0111] A fifth acquisition module, configured to acquire a lane dividing line between lanes in the target road based on the grouping result and the dividing line equation;
[0112] A determination module is used to determine each lane in the target road according to the lane dividing line.
[0113] In one or more embodiments, the determining module includes:
[0114] A first acquisition subunit, used to acquire coordinate information of a trajectory point corresponding to the target vehicle;
[0115] A second acquisition subunit, configured to determine a positional relationship between the trajectory point and the lane dividing line based on the coordinate information of the trajectory point;
[0116] The second determining subunit is used to determine the lane where the target vehicle is located according to the positional relationship between the trajectory point and the lane dividing line.
[0117] In one or more embodiments, the lane detection device further includes:
[0118] A determination unit, configured to determine that the target vehicle changes lanes when the target vehicle is located in different lanes at different times in the target road section;
[0119] The prompt unit is used to send a prompt message prohibiting lane change to the target vehicle when lane change is prohibited on the target road section.
[0120] According to another aspect of the embodiment of the present application, an electronic device for implementing the lane recognition method is also provided. The electronic device may be Fig.13 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.13 As shown, the electronic device includes a memory 1302 and a processor 1304. The memory 1302 stores a computer program, and the processor 1304 is configured to execute the steps in any of the above method embodiments through the computer program.
[0121] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0122] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0123] S1, obtaining a surveillance video of a target road within a preset time period, and determining the position information of a vehicle in each frame of the surveillance video;
[0124] S2, grouping the position information of the plurality of vehicles according to the acquired position information of the plurality of vehicles;
[0125] S3, based on the grouping result and a preset lane segmentation algorithm, obtaining lane segmentation lines between lanes in the target road;
[0126] S4, obtaining the lane where the target vehicle to be detected is located according to the lane dividing line.
[0127] Alternatively, a person skilled in the art may understand that: Fig.13 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig.13 The electronic device and the electronic equipment described above are not limited in structure. Fig.13 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.13 Different configurations are shown.
[0128] Among them, the memory 1302 can be used to store software programs and modules, such as the program instructions / modules corresponding to the lane recognition method and device in the embodiment of the present application. The processor 1304 executes various functional applications and data processing by running the software programs and modules stored in the memory 1302, that is, to implement the above-mentioned lane recognition method. The memory 1302 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1302 may further include a memory remotely located relative to the processor 1304, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1302 can be specifically, but not limited to, used to store lane recognition results. As an example, such as Fig.13 As shown, the memory 1302 may include, but is not limited to, the first acquisition unit 1202, the grouping unit 1204, the second acquisition unit 1206, and the third acquisition unit 1208 in the lane recognition device. In addition, it may also include, but is not limited to, other module units in the lane recognition device, which will not be repeated in this example.
[0129] Optionally, the transmission device 1306 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 13013 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1306 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0130] In addition, the electronic device further includes: a display 1308 for displaying lane recognition results; and a connection bus 1310 for connecting various module components in the electronic device.
[0131] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0132] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the lane recognition method described above, wherein the computer program is configured to perform the steps of any of the above method embodiments when running.
[0133] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0134] S1, obtaining a surveillance video of a target road within a preset time period, and determining the position information of a vehicle in each frame of the surveillance video;
[0135] S2, grouping the position information of the plurality of vehicles according to the acquired position information of the plurality of vehicles;
[0136] S3, based on the grouping result and a preset lane segmentation algorithm, obtaining lane segmentation lines between lanes in the target road;
[0137] S4, obtaining the lane where the target vehicle to be detected is located according to the lane dividing line.
[0138] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0139] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0140] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.
[0141] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0142] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0143] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0144] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0145] The above are only preferred embodiments of the present invention. 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 present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A lane recognition method, characterized in that: include: Obtaining a surveillance video of a target road within a preset time period, and determining the position information of the vehicle in each frame of the surveillance video; According to the acquired position information of the multiple vehicles, the position information of the multiple vehicles is grouped; Based on the grouping result and a preset lane segmentation algorithm, obtaining lane segmentation lines between lanes in the target road; The lane in which the target vehicle to be detected is located is obtained according to the lane dividing line.
2. The method according to claim 1, characterized in that The determining of the position information of the vehicle in each frame of the monitoring video, wherein the position information includes the track point of the vehicle, comprises: Obtain the detection frame of the vehicle contained in each frame of the image based on the preset target detection model; The coordinate information corresponding to the detection frame in each frame of the image is obtained, and the trajectory point of the vehicle is determined based on the coordinate information.
3. The method according to claim 2, characterized in that The obtaining of coordinate information corresponding to the detection frame in each frame of the image and determining the trajectory point of the vehicle based on the coordinate information includes: For each frame of the surveillance video, a coordinate system is established by taking any vertex of the frame as the origin and two adjacent edges of the vertex as coordinate axes; Determine the coordinate information of any coordinate point in the detection frame in the coordinate system, and determine the coordinate information as the position information of the vehicle.
4. The method according to claim 2 or 3, characterized in that: The method further comprises: Obtaining coordinate information of detection frames corresponding to the same vehicle in multiple consecutive frames of images, and drawing trajectory points corresponding to the detection frames in a target coordinate system according to the coordinate information; According to the drawn trajectory point set diagram, the position information corresponding to the vehicle that changes lanes is eliminated.
5. The method according to claim 2 or 3, characterized in that: The step of grouping the position information of the plurality of vehicles according to the acquired position information of the plurality of vehicles comprises: Obtaining a preset radius threshold and a minimum number of samples, as well as a trajectory point set consisting of trajectory points corresponding to each vehicle; For each trajectory point in the trajectory point set, the following steps are performed: respectively calculating the Euclidean distance between the current trajectory point and the remaining trajectory points in the trajectory point set except the current trajectory point; Determine the set of remaining trajectory points corresponding to Euclidean distances less than or equal to the radius threshold as the neighborhood set of the current trajectory point; When the number of elements in the neighborhood set is greater than or equal to the minimum number of samples, taking the current trajectory point as a core point; Adding the trajectory points in the domain set of the current trajectory point to the current cluster, and taking the other trajectory points in the current cluster except the core point as the current trajectory points to perform the above steps until the number of trajectory points in the current cluster no longer increases; All the obtained clusters are regarded as grouping results.
6. The method according to claim 1, characterized in that The obtaining of the segmentation line information of each lane in the target road based on the grouping result and the preset lane segmentation algorithm includes: Extracting a segmentation line coefficient of a separating hyperplane from a trained lane segmentation model, and obtaining a segmentation line equation according to the segmentation line coefficient; the separating hyperplane is used to segment the position information of vehicles in adjacent groups; Based on the grouping result and the dividing line equation, obtaining a lane dividing line between lanes in the target road; Each lane in the target road is determined according to the lane dividing line.
7. The method according to claim 6, characterized in that The acquiring the lane where the target vehicle to be detected is located according to the lane dividing line includes: Obtaining coordinate information of the trajectory point corresponding to the target vehicle; Based on the coordinate information of the trajectory point, determining the positional relationship between the trajectory point and the lane dividing line; The lane in which the target vehicle is located is determined according to the positional relationship between the trajectory point and the lane dividing line.
8. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the target vehicle is in different lanes at different times in the target road section, determining that the target vehicle has changed lanes; When lane changing is prohibited on the target road section, a prompt message prohibiting lane changing is sent to the target vehicle.
9. A lane recognition device, characterized in that: include: A first acquisition unit is used to acquire a surveillance video of a target road within a preset time period, and determine the position information of the vehicle in each frame of the surveillance video; A grouping unit, configured to group the position information of the plurality of vehicles according to the acquired position information of the plurality of vehicles; A second acquisition unit, configured to acquire lane dividing lines between lanes in the target road based on the grouping result and a preset lane dividing algorithm; The third acquisition unit is used to acquire the lane where the target vehicle to be detected is located according to the lane dividing line.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 8 through the computer program.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 8 when executed.