Method for acquiring vehicle speed and judging rapid acceleration and rapid deceleration based on multi-target detection
Through a multi-object detection method based on visual monitoring, Yolov8 and DeepSort are used to detect vehicles, and combined with the channel Transformer module, the relative distance and speed are estimated, which solves the problem of insufficient detection relying on sensor data in the existing technology, and realizes emergency acceleration and emergency acceleration of commercial vehicles Accurate and accurate detection of slowing behavior improves safety.
Patent Information
- Application Number
- CN202410813239.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2025-01-07
AI Technical Summary
In the prior art, detecting the sudden acceleration and deceleration behavior of a vehicle usually depends on hardware sensor data, lacks visual monitoring methods, and it is difficult to detect abnormal driving behaviors of commercial vehicles in real time and accurately.
Using a visual monitoring method, multi-object detection is performed through real-time video, Yolov8 and DeepSort are used to detect vehicles, combined with the channel Transformer module and convolutional neural network, estimate the relative distance and speed, calculate the driving speed change rate, and distinguish between normal by preset thresholds. and rapid acceleration/deceleration behavior.
Real-time detection based on visual information is realized, replacing sensor data, improving the accuracy and real-time detection, effectively identifying the emergency acceleration and rapid deceleration behavior of commercial vehicles, and reducing the risk of traffic accidents.
Smart Images

Figure CN119274153A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision and machine learning, and specifically relates to a method for determining driving behavior of sudden acceleration and deceleration of a vehicle based on vision. Background Art
[0002] Although multi-target detection and visual speed measurement have been successfully applied in the field of low-level computer vision, few researchers have combined the detection of sudden acceleration and deceleration driving behavior with visual speed measurement to solve the problem that driving behavior depends on data from hardware sensors.
[0003] The present invention proposes a method for detecting abnormal driving behavior of commercial vehicles based on visual monitoring, which is used to detect sudden acceleration and deceleration behaviors of commercial vehicles. The detection of sudden acceleration / deceleration behavior is based on the rate of change of driving speed. Specifically, the current vehicle's driving speed is first obtained by the relative speed of other vehicles in the real-time video, and then the rate of change of driving speed is obtained by comparing the speed difference between the current second and the previous second. Finally, a preset threshold is used to distinguish between normal acceleration / deceleration behavior and sudden acceleration / deceleration behavior. It is worth noting that since sudden deceleration behavior may be caused by emergency braking or avoiding obstacles, the threshold of sudden deceleration is usually higher than that of sudden acceleration.
[0004] Distance estimation is crucial for the detection of sudden acceleration / deceleration because distance is an important factor in correctly determining abnormal driving behavior. Specifically, the distance between different vehicles is estimated by using the position and size of the bounding box of other vehicles [2-7]. The longitudinal distance between vehicles is obtained by calculating the distance from the bottom of the bounding box to the bottom of the image, while the lateral distance between vehicles is obtained by measuring the distance from the edge of the bounding box to the center line of the image. Specifically, the longitudinal distance and lateral distance of other vehicles are estimated using the camera parameters, and the calculation formula is as follows:
[0005]
[0006] Here D represents the distance, F represents the focal length of the camera, W represents the width or height of the other vehicle, and P represents the width in the x direction or the height in the y direction. By setting the actual height of bicycles, cars, motorcycles, buses, and trucks, the above formula can be used to calculate the distance between the current vehicle and other vehicles. Summary of the invention
[0007] The present invention provides a method for obtaining vehicle speed and judging sudden acceleration and deceleration based on multi-target detection, which is used to detect sudden acceleration and deceleration behavior of a vehicle. The detection of sudden acceleration / deceleration behavior is based on the change rate of driving speed. The method comprises: 1) firstly performing multi-target detection based on Yolov8 through real-time video, and obtaining the driving speed of the current vehicle according to the relative speed of other vehicles; 2) then estimating the relative distance and relative speed; 3) obtaining the change rate of driving speed by comparing the speed difference between the current second and the previous second; 4) finally distinguishing normal acceleration / deceleration behavior from sudden acceleration / deceleration behavior through a preset threshold. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 This is the framework diagram of the method proposed in this paper;
[0009] Figure 2 This is a flow chart for rapid acceleration and deceleration detection;
[0010] Figure 3 Flow chart for rapid acceleration detection;
[0011] Figure 4 Flowchart for rapid deceleration detection DETAILED DESCRIPTION
[0012] The technical solution of the present invention is described in detail below with reference to the accompanying drawings:
[0013] The purpose of the present invention is to provide a method for obtaining vehicle speed and judging sudden acceleration and deceleration based on multi-target detection. The method proposed in this paper aims to realize the detection of sudden acceleration and deceleration of the vehicle during driving based on real-time image information, so as to replace the method of collecting speed data using sensors. The method proposed in this paper includes three stages: relative distance estimation stage, relative speed estimation stage and sudden acceleration and deceleration detection stage, which specifically includes the following steps:
[0014] 1. Estimation of relative distance and speed
[0015] A monocular camera is used to capture image information in real time. Yolov8 and DeepSort are used for vehicle detection and tracking respectively. The real-time speed of each vehicle is obtained by formula (3). In the first step, the actual width and pixel width of the vehicle are used to calculate the ratio of the actual distance to the pixel distance. In the second step, the pixel distance of the detected vehicle between two consecutive frames is calculated by using the difference between the center coordinates of the vehicle boundary box in the previous and next frames. In the third step, the actual distance of the detected vehicle between two consecutive frames is calculated by using the ratio obtained in the first step and the pixel distance obtained in the second step. Finally, the distance between two consecutive frames is divided by the corresponding time interval to calculate the speed of the detected vehicle.
[0016] The channel transformer module combines the advantages of convolutional neural networks and transformer models, using deep convolution and cross-channel self-attention to expand the receptive field and encode multi-scale features, realizing the interaction of global contextual information between tokens in the channel dimension.
[0017] 1.1 Distance Estimation
[0018] The process of sudden acceleration and deceleration detection is as follows Figure 2 Specifically, the speed is estimated first, and the speed data obtained at the last moment is retrieved, and the time difference is calculated to obtain the difference between the current speed and the speed at the last moment. Then, sudden acceleration and deceleration are detected based on the speed change rate between two consecutive seconds.
[0019] 1.2. Sudden acceleration detection
[0020] Sudden acceleration is usually defined as a significant increase in speed in a short period of time, which may lead to a decrease in vehicle control safety and an increase in the risk of traffic accidents. To detect sudden acceleration behavior, this paper proposes a detection algorithm based on speed change rate.
[0021] like Figure 3 As shown in the figure, the sudden acceleration detection algorithm first analyzes a large amount of real vehicle speed data and determines the appropriate acceleration threshold to distinguish between normal acceleration behavior and sudden acceleration behavior; then, the current speed of the vehicle is obtained from the real-time video and compared with the speed of the previous second to obtain the rate of change of the speed. Since the video image is sampled once per second, the time interval for acceleration calculation is set to 1 second.
[0022] 1.3. Sudden deceleration detection
[0023] Just as important as sudden acceleration behavior detection is sudden deceleration behavior detection, which is crucial for preventing sudden accidents and assessing driving risks. Sudden deceleration usually refers to a significant reduction in driving speed in a short period of time, and sudden deceleration detection is also based on the rate of change of driving speed. Considering the characteristics of the braking system and the emergency braking scenario, the threshold for sudden deceleration is usually set higher than the threshold for sudden acceleration. The process of sudden deceleration behavior detection is similar to that of sudden acceleration behavior detection, such as Figure 4 shown.
[0024] 2. Distance Estimation
[0025] In the camera coordinate system, the camera center is represented as the origin O, and the coordinate axes point to the front of the camera, with the x-axis pointing to the right and the y-axis pointing downward. When point P passes through the camera aperture O, it is projected on the physical imaging plane ox′y′ and forms an image point P'. Given the focal length f of the camera, the following formula can be derived using the principle of similar triangles:
[0026]
[0027] The negative sign indicates that the image is inverted. The above equation can be rewritten as follows:
[0028]
[0029] In this way, a space consisting of point P' and the corresponding image point P can be constructed. Since digital images are composed of pixels, a pixel coordinate system o'-uv is defined on the physical imaging plane. In the pixel coordinate system, the origin o' is located in the upper left corner of the image, where the u-axis is parallel to the right x-axis and is positive, and the v-axis is parallel to the y-axis but is negative. There is a scaling and translation relationship between the pixel projection plane and the physical imaging plane. Given that the pixel coordinates of P' are [u, v]T, the u-axis is scaled by a times, the v-axis is scaled by b times, and there is a translation [cx, cy]T. Therefore, the relationship between the coordinates of P' in the physical imaging plane and the corresponding coordinates in the pixel projection plane can be expressed by the following formula:
[0030]
[0031] Where fz and fy represent the focal lengths on the x-axis and y-axis respectively, and cz and cy represent the translation. These formulas describe the transformation relationship between the point P' in the physical imaging plane and the pixel projection plane.
Claims
1. A method for obtaining vehicle speed and judging sudden acceleration and deceleration based on multi-target detection, comprising the following steps: Step A: Use YOLOv8 to train the vehicle recognition model and use DeepSort to detect vehicles in real time. In the first step, use the actual width and pixel width of the vehicle to calculate the ratio of the actual distance to the pixel distance. In the second step, use the difference between the center coordinates of the vehicle boundary box in the previous and next frames to calculate the pixel distance of the detected vehicle between two consecutive frames. In the third step, use the ratio obtained in the first step and the pixel distance obtained in the second step to calculate the actual distance of the detected vehicle between two consecutive frames. In the fourth step, divide the distance between two consecutive frames by the corresponding time interval to calculate the speed of the detected vehicle. Finally, use the detected speed to perform calculations according to the algorithm to determine and output sudden acceleration or deceleration events.
2. The method as claimed in claim 1, in the first step, divides each input image into a number of image blocks of uniform size, such as 7×7 image blocks; in the second step, for each image block, provides multiple category information and corresponding bounding boxes, wherein each bounding box is represented by five parameters: center coordinates, width, height and confidence of the object in the bounding box; in the third step, for each image block, the number of predicted bounding boxes is 2, which means that each image block detects at most 2 objects; in the fourth step, non-maximum suppression is used to eliminate overlapping bounding boxes, and only the bounding boxes with the highest confidence are retained; finally, the bounding boxes with confidence higher than the threshold are selected as the final detection results.
3. The method as claimed in claim 1, wherein the relative distance is estimated based on the recognition result, and the relationship between the coordinates of P' in the physical imaging plane and the corresponding coordinates in the pixel projection plane can be expressed by the following formula: Where fz and fy represent the focal lengths on the x-axis and y-axis respectively, and cz and cy represent the translation. These formulas describe the transformation relationship between the point P' in the physical imaging plane and the pixel projection plane.
4. The method according to claim 1, wherein the speed of the detected vehicle is calculated based on the distance between the current vehicle and the detected vehicle and the relative speed of the vehicles:
5. According to the method of claim 1, the sudden acceleration detection algorithm first analyzes a large amount of real vehicle speed data and determines an appropriate acceleration threshold to distinguish between normal acceleration behavior and sudden acceleration behavior; then, the current speed of the vehicle is obtained from the real-time video and compared with the speed of the previous second to obtain the rate of change of the speed. Since the video image is sampled once per second, the time interval for acceleration calculation is set to 1 second. The speed is first estimated, and then sudden acceleration and deceleration are detected based on the rate of change of speed between two consecutive seconds.