This study presents a novel approach for estimating vehicle speeds in real-time from traffic surveillance videos using a deep learning-based object detection model integrated with advanced computer vision techniques. The methodology leverages the YOLO (You Only Look Once) object detection framework to identify and track vehicles, combined with a perspective transformation to map detected vehicles into a bird’s-eye view for accurate distance and speed estimation. The perspective transformation ensures spatial accuracy by converting pixel-based measurements into real-world coordinates. A custom pipeline was developed to calculate vehicle speeds by analyzing frame-by-frame movement and employing pixel-to-distance conversion. The system calculates speed every second by tracking the total number of frames traveled by each vehicle. Experimental results demonstrate that the system achieves reliable vehicle detection and speed estimation, with an average accuracy of over 90% in controlled environments and 85% in complex real-world scenarios. The results underscore the system's potential to enhance road safety, enforce speed regulations, and optimize traffic management systems.
The proposed system employs a detailed multi-step pipeline for vehicle speed estimation:
Object Detection: The YOLO model, fine-tuned on a custom dataset, is utilized to detect vehicles in each frame of the input traffic video. Specific classes corresponding to vehicles (e.g., cars, trucks, buses) are filtered for further analysis. Each detection includes bounding box coordinates, class ID, and confidence score.
Perspective Transformation: A perspective transformation matrix is computed using predefined source and destination points. This transformation maps the road plane in the video to a bird’s-eye view coordinate system, enabling accurate spatial measurements. The transformation corrects for camera distortions and ensures that vehicle positions and distances are calculated with high precision.
Vehicle Tracking: Detected vehicles are tracked across consecutive frames using an Intersection over Union (IoU)-based bounding box matching algorithm. Each vehicle is assigned a unique identifier, and its position is updated frame by frame. This step ensures continuity in tracking even when vehicles temporarily overlap or occlude each other.
Speed Estimation: The system calculates the speed of each vehicle by analyzing its movement in the bird’s-eye view coordinate system. For each second of video, the total distance travelled by a vehicle is computed based on its frame-by-frame displacement. Using the video frame rate (e.g., 30 frames per second), the distance is converted to meters per second and subsequently to kilometres per hour. Vehicles exceeding a predefined speed threshold (e.g., 60 km/h) are flagged for monitoring.
Traffic Analysis: The system computes traffic metrics such as peak traffic density, average vehicle speed, and total vehicle count for each video segment. These metrics provide valuable insights into traffic flow patterns and can aid in optimizing traffic control strategies.
The above image shows the bird's eye view after the angle transformation.
The system was evaluated on traffic footage captured from a static roadside camera. Key results include:
Vehicle Detection: The YOLO model demonstrated high detection accuracy, successfully identifying and classifying vehicles under varying lighting and weather conditions.
Speed Estimation: Speed calculations were consistent with manual measurements, with an average error margin of ±5%. Vehicles exceeding the speed limit (60 Km/h) were correctly flagged.
Traffic Insights: The system identified peak traffic periods and quantified vehicle density, providing actionable data for traffic management.
The processed video outputs, overlaid with bounding boxes, speed annotations, and traffic metrics, provide a visual representation of the system’s effectiveness. These results underscore the applicability of the proposed approach for real-time traffic monitoring and law enforcement.
The above image shows the results of the speed estimation and traffic calculation.
There are no models linked
There are no models linked