CN-121982879-A - Unmanned aerial vehicle-based road congestion detection method and system
Abstract
The application relates to a road congestion detection method based on an unmanned aerial vehicle, which comprises the steps of analyzing a road image of a target area acquired by the unmanned aerial vehicle to obtain a vehicle target frame and a trunk line, determining central points of all vehicles according to the vehicle target frame, obtaining a vehicle fitting line according to the central points, analyzing angles, distances and overlapping degrees of the trunk line and the vehicle fitting line to determine similarity, tracking all target vehicles when the similarity is larger than a preset similarity threshold, determining the speed of all target vehicles based on tracking results, unmanned aerial vehicle position information and unmanned aerial vehicle camera operation parameters, determining reference speeds based on the speeds and the quantity of all target vehicles, and judging whether congestion occurs according to the reference speeds and the quantity of the target vehicles. The method solves the problem of poor road congestion detection flexibility and expandability, relies on the unmanned aerial vehicle to acquire the image, screens the target vehicle through the similarity threshold value, and can adapt to scenes of different lane widths and road trends.
Inventors
- WANG HAOYANG
- ZHU WEI
- Shi Qiaomu
Assignees
- 杭州靖安科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251230
Claims (10)
- 1. The method for detecting the road congestion based on the unmanned aerial vehicle is characterized by comprising the following steps of: acquiring a road image of a target area through an unmanned aerial vehicle, and analyzing the road image to obtain a vehicle target frame and a trunk line; Determining a central point of each vehicle according to the vehicle target frame, obtaining a vehicle fitting straight line according to the central point through a RANSAC algorithm, analyzing the angle, the distance and the overlapping degree between a trunk line and the vehicle fitting straight line, and determining the similarity of the trunk line and the vehicle fitting straight line according to an analysis result; tracking each target vehicle under the condition that the similarity is larger than a preset similarity threshold value, and determining the speed of each target vehicle based on a tracking result, unmanned aerial vehicle position information and unmanned aerial vehicle camera operation parameters, wherein the target vehicles are determined based on the vehicle fitting straight line; And counting the number of the target vehicles, determining a reference speed based on the speeds and the number of all the target vehicles, and judging whether the target area is congested according to the reference speed and the number of the target vehicles.
- 2. The method of claim 1, wherein analyzing the road image to obtain a trunk line comprises: dividing the road image based on a YOLO11 model to obtain a mask image containing road classification information; According to the road classification information, converting the mask image into a binary image; and determining the trunk line according to the mask image and the binarized image based on a principal component analysis method.
- 3. The method of claim 2, wherein the determining the trunk line from the mask image and the binarized image based on the principal component analysis method comprises: performing centering processing on all pixel points in the mask image, and calculating a covariance matrix of the mask image after the centering processing; calculating the eigenvalue of the covariance matrix and the eigenvector corresponding to the eigenvalue, and taking the eigenvector with the largest eigenvalue as the principal component direction; And determining a target centroid based on the binarized image, and determining the trunk line according to the target centroid and the principal component direction.
- 4. The method of claim 1, wherein the obtaining a vehicle fit line from the center point by the RANSAC algorithm comprises: Randomly sampling all the center points to generate a preset number of center point subsets, and performing straight line fitting based on each center point subset to obtain candidate parameters of a plurality of groups of straight lines; for each group of candidate parameters, obtaining errors from all center points to straight lines under the candidate parameters, marking the center points with the errors less than or equal to a preset error threshold as inner points of the straight lines under the candidate parameters, and counting the number of the inner points; and taking the straight line with the largest number of the inner points as a vehicle fitting straight line.
- 5. The method of claim 1, wherein analyzing the angle, distance and overlap between the trunk line and the vehicle fit line, and determining the similarity between the trunk line and the vehicle fit line based on the analysis result comprises: determining the angle difference between the trunk line and the vehicle fitting line, and obtaining an angle score based on the angle difference and a preset angle scoring model; respectively determining endpoints of the trunk road straight line and the vehicle fitting straight line in the road image to obtain a trunk road line segment and a vehicle fitting line segment, calculating the shortest distance from the vehicle fitting line segment to the trunk road line segment, and obtaining a distance score based on the shortest distance and a preset distance scoring model; Projecting the vehicle fitting line segment onto the trunk line segment, and taking the intersection length of the projection interval as an overlapping score; And carrying out weighted calculation on the angle score, the distance score and the overlapping score to obtain the similarity of the trunk line and the vehicle fitting line.
- 6. The method of claim 1, wherein the unmanned aerial vehicle position information comprises unmanned aerial vehicle longitude and latitude information, ground clearance information, and pan-tilt attitude information, and wherein determining the speed of each of the target vehicles based on the tracking result, the unmanned aerial vehicle position information, and unmanned aerial vehicle camera operating parameters comprises: Acquiring continuous multi-frame tracking results as target frames, and determining pixel coordinates of a target vehicle in each target frame; normalizing pixel coordinates of the target vehicle in each target frame to a camera coordinate system based on the ground clearance information, the cradle head posture information and the unmanned aerial vehicle camera operation parameters to obtain relative coordinates of the target vehicle in each target frame; obtaining world coordinates of a target vehicle in each target frame according to the longitude and latitude information of the unmanned aerial vehicle and the relative coordinates; and determining a time parameter corresponding to the target frame based on the unmanned aerial vehicle camera operation parameter, and determining the speed of each target vehicle based on the time parameter and the world coordinates of the target vehicle.
- 7. The method of claim 1, wherein the determining a reference speed based on the speeds of all of the target vehicles comprises: Determining a median of the vehicle speeds according to the number of the target vehicles and the speeds of all the target vehicles, taking the median as the reference speed, or And determining the average speed of the vehicle according to the speeds of all the target vehicles, and taking the average speed as the reference speed.
- 8. A system for detecting road congestion based on an unmanned aerial vehicle, the system comprising: The image acquisition module is used for acquiring a road image of a target area through the unmanned aerial vehicle, and analyzing the road image to obtain a vehicle target frame and a trunk line; The similarity calculation module is used for determining the center point of each vehicle according to the vehicle target frame, obtaining a vehicle fitting straight line according to the center point through a RANSAC algorithm, analyzing the angle, the distance and the overlapping degree between the trunk straight line and the vehicle fitting straight line, and determining the similarity of the trunk straight line and the vehicle fitting straight line according to an analysis result; the speed determining module is used for tracking each target vehicle under the condition that the similarity is larger than a preset similarity threshold value, and determining the speed of each target vehicle based on a tracking result, unmanned aerial vehicle position information and unmanned aerial vehicle camera operation parameters, wherein the target vehicles are determined based on the vehicle fitting straight line; the judging module is used for counting the number of the target vehicles, determining a reference speed based on the speeds and the number of all the target vehicles, and judging whether the target area is congested according to the reference speed and the number of the target vehicles.
- 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, implements the unmanned aerial vehicle-based road congestion detection method of any of claims 1 to 7.
- 10. A storage medium having stored thereon a computer program, which when executed by a processor implements the unmanned aerial vehicle-based road congestion detection method according to any one of claims 1 to 7.
Description
Unmanned aerial vehicle-based road congestion detection method and system Technical Field The application relates to the field of traffic detection, in particular to a road congestion detection method and system based on an unmanned aerial vehicle. Background In the prior art, the scheme for detecting road congestion is mostly based on road information acquired by a fixed monitoring camera, a vehicle-mounted terminal camera and a related platform, and the comprehensive information considers the condition of road congestion. The vehicle detection model is generally utilized to identify vehicles in the video picture, the multi-frame joint is utilized to realize target tracking, the target speed is calculated, and the road congestion condition is obtained according to the actual speed and the number of vehicles with preset speed. However, in these road congestion detection methods, the road trend needs to be determined in advance, for example, the fixed camera needs to confirm the camera direction and the road condition in advance, and the vehicle-mounted camera collects the traffic density information based on the vehicle driving direction, so that the flexibility and the expandability are poor. Disclosure of Invention The embodiment of the application provides a road congestion detection method, a system, electronic equipment and a storage medium based on an unmanned aerial vehicle, which are used for at least solving the problems of poor flexibility and expandability of the road congestion detection method in the related technology. In a first aspect, an embodiment of the present application provides a method for detecting road congestion based on an unmanned aerial vehicle, where the method includes: acquiring a road image of a target area through an unmanned aerial vehicle, and analyzing the road image to obtain a vehicle target frame and a trunk line; Determining a central point of each vehicle according to the vehicle target frame, obtaining a vehicle fitting straight line according to the central point through a RANSAC algorithm, analyzing the angle, the distance and the overlapping degree between a trunk line and the vehicle fitting straight line, and determining the similarity of the trunk line and the vehicle fitting straight line according to an analysis result; tracking each target vehicle under the condition that the similarity is larger than a preset similarity threshold value, and determining the speed of each target vehicle based on a tracking result, unmanned aerial vehicle position information and unmanned aerial vehicle camera operation parameters, wherein the target vehicles are determined based on the vehicle fitting straight line; And counting the number of the target vehicles, determining a reference speed based on the speeds and the number of all the target vehicles, and judging whether the target area is congested according to the reference speed and the number of the target vehicles. In some embodiments, the analyzing the road image to obtain a trunk line includes: dividing the road image based on a YOLO11 model to obtain a mask image containing road classification information; According to the road classification information, converting the mask image into a binary image; and determining the trunk line according to the mask image and the binarized image based on a principal component analysis method. In some embodiments, the determining the trunk line from the mask image and the binarized image based on a principal component analysis method includes: performing centering processing on all pixel points in the mask image, and calculating a covariance matrix of the mask image after the centering processing; calculating the eigenvalue of the covariance matrix and the eigenvector corresponding to the eigenvalue, and taking the eigenvector with the largest eigenvalue as the principal component direction; And determining a target centroid based on the binarized image, and determining the trunk line according to the target centroid and the principal component direction. In some embodiments, the obtaining, by the RANSAC algorithm, a vehicle fit line according to the center point includes: Randomly sampling all the center points to generate a preset number of center point subsets, and performing straight line fitting based on each center point subset to obtain candidate parameters of a plurality of groups of straight lines; for each group of candidate parameters, obtaining errors from all center points to straight lines under the candidate parameters, marking the center points with the errors less than or equal to a preset error threshold as inner points of the straight lines under the candidate parameters, and counting the number of the inner points; and taking the straight line with the largest number of the inner points as a vehicle fitting straight line. In some embodiments, the analyzing the angle, the distance and the overlapping degree between the trunk line and the vehicle fitting lin