A method for detecting abnormal vehicles in traffic videos
Patent Information
- Application Number
- CN202410011795.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-03
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2044-01-03
AI Technical Summary
然而,由于摄像头的安装位置和角度的不同,车辆在视场的远近处的像素移动速度差异显著,这严重影响了速度估测的准确性
[0056] Dual-optimized anomaly detection: This invention does not rely solely on background modeling or speed estimation for anomaly detection. Instead, it combines background modeling with spatial indexing of vehicle trajectory queries, aiming to ensure the accuracy and reliability of anomaly detection from two dimensions. This avoids the limitations and inaccuracies of single methods in complex and ever-changing traffic environments.
Smart Images

Figure CN117830736B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of abnormal vehicle detection technology, and in particular to a method for detecting abnormal vehicles in traffic videos. Background Technology
[0002] Anomaly detection in traffic accidents is crucial because traffic anomalies typically significantly reduce traffic flow efficiency. With the deployment of numerous traffic cameras recording various types of road information, developing an efficient, universal, and automated anomaly detection method has become paramount. However, designing a computer vision algorithm capable of detecting road traffic anomalies is an extremely challenging task. This is primarily because vehicle movement patterns on the road are often quite complex, and different anomalies can exhibit highly variable behavioral characteristics. Furthermore, anomalies occur relatively infrequently compared to normal events. Therefore, there is an urgent need for an efficient and effective method to automatically detect anomalies in video footage.
[0003] With the continuous advancement of deep learning models, research on traffic anomalies has once again become a focus. Prediction-based methods attempt to detect anomalous events by predicting the motion trends of the next frame. For example, the speed of a moving vehicle can be calculated using a speed estimation model, and anomalous events can be detected based on these speed analyses. Recently, detection-based methods have also been used to identify stopped vehicles in the background. These methods typically first extract the background using background modeling methods, and then deploy object detection models such as Faster-RCNN, Mask-RCNN, and YOLO.
[0004] Existing abnormal vehicle detection methods typically rely on a single detection or prediction strategy, which often proves inadequate when faced with complex and ever-changing road traffic environments. For example, detection-based methods often employ background modeling to identify static vehicles. These methods construct a background model by calculating the running average of a frame sequence, but due to jitter in the average image, the background may be misidentified as a vehicle, resulting in a detection result filled with false positives from the background image.
[0005] On the other hand, prediction-based methods typically rely on estimating vehicle speed to determine whether an anomaly is an anomaly. However, due to the varying perspectives in traffic videos, the conversion between pixel distance and actual distance in near and far scenes is not linear, significantly complicating accurate speed estimation. Even with relatively accurate speed estimation, this method cannot distinguish between normal situations where a vehicle is stopped due to traffic congestion or traffic lights, and abnormal situations where it is stopped due to vehicle malfunction. Furthermore, this method struggles to handle non-speed-related abnormal behaviors, such as illegal lane changes or driving against traffic.
[0006] Taking a speed estimation-based anomaly detection method as an example, this method estimates the speed of a vehicle by analyzing its trajectory in a video, and then determines whether an abnormal stopping event has occurred. However, due to differences in camera installation position and angle, the pixel movement speed of the vehicle varies significantly at different distances within the field of view, which severely affects the accuracy of speed estimation. Even if we can accurately estimate the vehicle's speed, the reliability of this method remains challenged because it cannot distinguish whether the vehicle stopped due to obeying traffic rules (e.g., stopping at a red light) or due to vehicle malfunction. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to address the shortcomings of the prior art by providing a method for detecting abnormal vehicles in traffic videos. This method combines background modeling and trajectory retrieval to detect abnormal vehicles, thus avoiding the inaccuracies caused by relying on a single method.
[0008] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for detecting abnormal vehicles in traffic videos, comprising the following steps:
[0009] Step 1: Use a background modeling algorithm to obtain the weighted average background of all frames in the traffic video;
[0010] First, extract each frame of the traffic video. Then, taking into account the current frame and all its preceding frames, calculate the average background of the current frame, enhance the static parts, and suppress the moving parts in the video.
[0011] The average background of each frame in the traffic video is obtained using the following formula:
[0012] Average i = (1-α)*Average i-1 +α*framei
[0013] Among them, frame i For the i-th frame in the traffic video, Average i-1 is the average background of the (i-1)th frame, and α is the rate at which the average background is updated.
[0014] Step 2: Perform target detection on all abnormal vehicles in the average background of each frame to initially obtain the regions where abnormal vehicles are located, and record them as abnormal regions;
[0015] The YOLOv5 model is used to perform object detection on the average background of each frame. The detection result is a bounding box for suspected abnormal vehicles in the background. The object detection result for the average background of each frame is in the following format:
[0016] {frame_id,x,y,width,height}
[0017] Where frame_id is the frame number, (x,y) are the center coordinates of the detection box for identifying abnormal vehicles, and (width,height) are the width and height of the detection box, respectively;
[0018] Finally, the region corresponding to all abnormal vehicle detection boxes in the average background of each frame is recorded as the abnormal region.
[0019] Step 3: Based on the abnormal vehicle target detection results, use the DeepSORT vehicle tracking algorithm to extract the trajectory data of all vehicles in the video;
[0020] The DeepSORT algorithm is used to extract the motion trajectory of vehicles from suspected abnormal vehicle detection boxes in consecutive frames.
[0021] DeepSORT algorithm input: vehicle detection bounding box information from step 2;
[0022] DeepSORT algorithm output: Vehicle trajectory information: {track_id} j ,frame_id i ,x,y,width,height}, where track_id j This represents the trajectory ID of the j-th vehicle, corresponding to the detection box information of this vehicle's trajectory in the i-th frame;
[0023] Step 4: Use the quadtree algorithm to build a spatial index for all vehicle trajectories in the video, so as to quickly query the vehicle trajectories in the abnormal area obtained in Step 2.
[0024] A quadtree is a tree-like data structure used for spatial indexing, in which each node represents a two-dimensional spatial region that is recursively divided into four subregions or "quadrants".
[0025] Define a quadtree node as follows: Node = {Region, Data, NW, NE, SW, SE}
[0026] Here, RegionRegion is a rectangular region defined as (xmin, ymin, xmax, ymax), representing the coordinates of the top-left and bottom-right vertices of the rectangular region covered by the node, respectively; DataData is a collection containing all vehicle trajectory data within this region; NW, NE, SW, SE are pointers to the four sub-regions of northwest, northeast, southwest, and southeast, respectively; the data in each quadtree is also a rectangular region of RegionRegion, stored in the leaf nodes of the quadtree;
[0027] Insert new vehicle trajectory data into the quadtree using the following method:
[0028] (1) If the rectangular area covered by the current quadtree node intersects with the rectangular area of the new vehicle trajectory data, then determine whether the current quadtree node is a leaf node and go to (2).
[0029] (2) If the current quadtree node is a leaf node, the new vehicle trajectory data is directly stored in the leaf node of the current quadtree, and the insertion ends.
[0030] (3) If the current quadtree node is not a leaf node, determine which child nodes of the current quadtree node's rectangular region intersect with the rectangular region of the new vehicle trajectory data, and then proceed to (4).
[0031] (4) Insert the new vehicle trajectory data into the intersecting quadtree child nodes and return (1).
[0032] Step 5: Use the constructed quadtree spatial index to query vehicle trajectories related to the abnormal region obtained in Step 2;
[0033] Step 5.1: Define the query range;
[0034] The abnormal region obtained from background modeling is defined as the query region; this region is represented as a rectangle, defined as (xmin, ymin, xmax, ymax), where (xmin, ymin) are the coordinates of the upper left corner of the region, and (xmax, ymax) are the coordinates of the lower right corner;
[0035] Step 5.2: Initialize the query;
[0036] Initialize an empty result set to store the retrieved vehicle trajectories; then, call a recursive query function with the root node of the quadtree and the query region as initial inputs, and add the query results to the result set.
[0037] Step 5.3: Perform a recursive query using a recursive query function;
[0038] The recursive query function takes the current quadtree node and the query region as input, and outputs all data points in the current node and its child nodes that intersect with the query region. The specific query process is as follows:
[0039] 1) If the region of the current quadtree node does not intersect with the query region, return an empty result set;
[0040] 2) If the current quadtree node contains data points, check if these data points are within the query range. If so, add these data points to the result set.
[0041] 3) If the current quadtree node has child nodes, call the recursive query function for each child node and add the query results to the result set;
[0042] 4) Return the result set;
[0043] Step 5.4: Analyze the recursive query results;
[0044] The result set returned by the recursive query function contains all vehicle trajectories related to the anomaly region. Each trajectory is represented as a sequence of data points, and each data point contains the vehicle's position information in a given frame, in the following format:
[0045] {track_id j ,frame_id i ,x,y,width,height}
[0046] Step 6: Identify abnormal trajectories among all vehicle trajectories, and then determine the abnormal vehicle information;
[0047] The detection boxes corresponding to all vehicle trajectory data obtained in step 3 are used to perform IOU calculation with the abnormal area. If the IOU result is greater than the threshold, the vehicle corresponding to the trajectory is marked as an abnormal vehicle. The start time and spatial location information of the abnormal parking of this vehicle are found from the abnormal area in step 2.
[0048] Step 6.1: Calculate the IoU between the termination detection box and the abnormal region for each trajectory;
[0049] IoU is the ratio of the area of the overlapping region of two bounding boxes to the area of the union region of the two bounding boxes. The IoU between the termination detection box and the outlier region of each trajectory is shown in the following formula:
[0050]
[0051] Where Box1 is the termination detection box of the trajectory, and Box2 is the bounding box of the abnormal region; Area(Box1∩Box2) represents the area of the intersection of the two regions, and Area(Box1∪Box2) represents the area of the union of the two regions.
[0052] Step 6.2: Set a threshold to determine whether a trajectory represents an abnormal vehicle; set a threshold θ to determine whether a trajectory represents an abnormal vehicle; if the IoU between a trajectory and an abnormal region exceeds this threshold, the vehicle corresponding to the trajectory is considered abnormal.
[0053] Step 6.3: Mark abnormal vehicles;
[0054] For those trajectories that are judged to be abnormal, the corresponding vehicles will be marked as abnormal vehicles, and the spatial location and time information of the abnormal vehicles will be obtained from the trajectories of the abnormal vehicles.
[0055] The beneficial effects of adopting the above technical solution are as follows: This invention provides a method for detecting abnormal vehicles in traffic videos.
[0056] Dual-optimized anomaly detection: This invention does not rely solely on background modeling or speed estimation for anomaly detection. Instead, it combines background modeling with spatial indexing of vehicle trajectory queries, aiming to ensure the accuracy and reliability of anomaly detection from two dimensions. This avoids the limitations and inaccuracies of single methods in complex and ever-changing traffic environments.
[0057] Accurate background modeling: Background modeling is performed using a weighted average method, which strengthens the static part and suppresses the dynamic part, significantly reducing false alarms caused by background jitter and providing a more stable and accurate background benchmark for subsequent target detection and trajectory analysis.
[0058] Efficient spatial index query: By constructing a quadtree spatial index, this invention can quickly and efficiently query vehicle trajectories related to abnormal areas, greatly reducing the computational complexity of trajectory querying in large amounts of data and improving detection efficiency.
[0059] Accurate abnormal vehicle identification: This invention calculates the IoU between the termination detection box of the trajectory and the abnormal region, and compares it with a predetermined threshold to accurately determine whether a vehicle is abnormal, reducing the possibility of false alarms and missed alarms.
[0060] This invention achieves efficient and accurate detection of abnormal vehicles in traffic videos by comprehensively utilizing background modeling and spatial indexing techniques. Compared with existing single detection or prediction strategies, it demonstrates significant advantages and superior performance. The following are the main effects and advantages of this invention, compared with methods using only speed or background modeling:
[0061] Improved detection accuracy: This invention reduces false alarms and false negatives caused by background jitter and viewpoint differences through a dual strategy of background modeling and spatial indexing. Compared with single background modeling or speed estimation methods, it significantly improves the accuracy of abnormal vehicle detection.
[0062] Optimize detection efficiency: By using a quadtree spatial index, vehicle trajectories related to abnormal areas can be quickly queried, greatly reducing computational complexity and improving detection efficiency, especially when processing large amounts of traffic video data, the efficiency improvement is particularly significant.
[0063] Reduced false alarm rate: By calculating the IoU between the termination detection box of the trajectory and the abnormal region and comparing it with a predetermined threshold, this invention can accurately determine whether a vehicle is abnormal, significantly reducing the false alarm rate and improving the reliability of detection.
[0064] Adaptable to complex and ever-changing traffic environments: This invention is not affected by the complexity of the traffic environment. It can maintain high detection accuracy and stability even in environments with high traffic volume, diverse vehicles, and complex road conditions.
[0065] Enhancing the comprehensiveness of anomaly detection: This invention can not only detect abnormal situations such as vehicles stopping due to malfunctions, but also identify and analyze other non-speed-related abnormal behaviors to a certain extent, such as illegal lane changes or driving in the wrong direction, thus enhancing the comprehensiveness and practicality of anomaly detection. Attached Figure Description
[0066] Figure 1 This is a flowchart of a method for detecting abnormal vehicles in traffic videos, provided as an embodiment of the present invention. Detailed Implementation
[0067] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0068] In this embodiment, a method for detecting abnormal vehicles in traffic videos, such as... Figure 1 As shown, it includes the following steps:
[0069] Step 1: Use a background modeling algorithm to obtain the weighted average background of all frames in the traffic video;
[0070] First, extract each frame of the traffic video. Then, taking into account the current frame and all its preceding frames, calculate the average background of the current frame, enhance the static parts, and suppress the moving parts in the video.
[0071] The average background of each frame in the traffic video is obtained using the following formula:
[0072] Average i = (1-α)*Average i-1 +α*framei
[0073] Among them, frame i For the i-th frame in the traffic video, Average i-1 It is the average background of the (i-1)th frame, and α is the update speed of the average background. In this embodiment, α = 0.01 is taken.
[0074] Step 2: Perform target detection on all abnormal vehicles in the average background of each frame to initially obtain the regions where abnormal vehicles are located, and record them as abnormal regions;
[0075] The YOLOv5 model is used to perform object detection on the average background of each frame. The detection result is a bounding box for suspected abnormal vehicles in the background. The object detection result for the average background of each frame is in the following format:
[0076] {frame_id,x,y,width,height}
[0077] Where frame_id is the frame number, (x,y) are the center coordinates of the detection box for identifying abnormal vehicles, and (width,height) are the width and height of the detection box, respectively;
[0078] Finally, the region corresponding to all abnormal vehicle detection boxes in the average background of each frame is recorded as the abnormal region.
[0079] Step 3: Based on the abnormal vehicle target detection results, use the DeepSORT vehicle tracking algorithm to extract the trajectory data of all vehicles in the video;
[0080] The DeepSORT algorithm is used to extract the motion trajectory of vehicles from suspected abnormal vehicle detection boxes in consecutive frames.
[0081] DeepSORT algorithm input: vehicle detection bounding box information from step 2: {frame_id,x,y,width,height};
[0082] DeepSORT algorithm output: Vehicle trajectory information: {track_id} j ,frame_id i ,x,y,width,height}, where track_id j This represents the trajectory ID of the j-th vehicle, corresponding to the detection box information of this vehicle's trajectory in the i-th frame;
[0083] Step 4: Store all vehicle trajectory data in a quadtree spatial index and query all vehicle trajectories within the abnormal area obtained in Step 2; use the quadtree algorithm to build a spatial index for all vehicle trajectories in the video so as to quickly query vehicle trajectories within the abnormal area obtained in Step 2.
[0084] A quadtree is a tree-like data structure used for spatial indexing, in which each node represents a two-dimensional spatial region that is recursively divided into four subregions or "quadrants".
[0085] Define a quadtree node as follows: Node = {Region, Data, NW, NE, SW, SE}
[0086] Here, RegionRegion is a rectangular region defined as (xmin, ymin, xmax, ymax), representing the coordinates of the top-left and bottom-right vertices of the rectangular region covered by the node, respectively; DataData is a collection containing all vehicle trajectory data within this region; NW, NE, SW, SE are pointers to the four sub-regions of northwest, northeast, southwest, and southeast, respectively; the data in each quadtree is also a rectangular region of RegionRegion, stored in the leaf nodes of the quadtree;
[0087] Insert new vehicle trajectory data into the quadtree using the following method:
[0088] (1) If the rectangular area covered by the current quadtree node intersects with the rectangular area of the new vehicle trajectory data, then determine whether the current quadtree node is a leaf node and go to (2).
[0089] (2) If the current quadtree node is a leaf node, the new vehicle trajectory data is directly stored in the leaf node of the current quadtree, and the insertion ends.
[0090] (3) If the current quadtree node is not a leaf node, determine which child nodes of the current quadtree node's rectangular region intersect with the rectangular region of the new vehicle trajectory data, and then proceed to (4).
[0091] (4) Insert the new vehicle trajectory data into the intersecting quadtree child nodes and return (1).
[0092] Step 5: Use the constructed quadtree spatial index to query vehicle trajectories related to the abnormal region obtained in Step 2;
[0093] Step 5.1: Define the query range;
[0094] The abnormal region obtained from background modeling is defined as the query region; this region is represented as a rectangle, defined as (xmin, ymin, xmax, ymax), where (xmin, ymin) are the coordinates of the upper left corner of the region, and (xmax, ymax) are the coordinates of the lower right corner;
[0095] Step 5.2: Initialize the query;
[0096] Initialize an empty result set to store the retrieved vehicle trajectories; then, call a recursive query function with the root node of the quadtree and the query region as initial inputs, and add the query results to the result set.
[0097] Step 5.3: Perform a recursive query using a recursive query function;
[0098] The recursive query function takes the current quadtree node and the query region as input, and outputs all data points in the current node and its child nodes that intersect with the query region. The specific query process is as follows:
[0099] 1) If the region of the current quadtree node does not intersect with the query region, return an empty result set;
[0100] 2) If the current quadtree node contains data points, check if these data points are within the query range. If so, add these data points to the result set.
[0101] 3) If the current quadtree node has child nodes, call the recursive query function for each child node and add the query results to the result set;
[0102] 4) Return the result set;
[0103] Step 5.4: Analyze the recursive query results;
[0104] The result set returned by the recursive query function contains all vehicle trajectories related to the anomaly region. Each trajectory is represented as a sequence of data points, and each data point contains the vehicle's position information in a given frame, in the following format:
[0105] {track_id j ,frame_id i ,x,y,width,height}
[0106] Step 6: Identify abnormal trajectories among all vehicle trajectories, and then determine the abnormal vehicle information;
[0107] The detection boxes corresponding to all vehicle trajectory data obtained in step 3 are used to perform IOU calculation with the abnormal area. If the IOU result is greater than the threshold, the vehicle corresponding to the trajectory is marked as an abnormal vehicle. The start time and spatial location information of the abnormal parking of this vehicle are found from the abnormal area in step 2.
[0108] The Intersection over Union (IoU) metric is used to evaluate the degree of overlap between the termination detection box of the trajectory and the outlier region.
[0109] Step 6.1: Calculate the IoU between the termination detection box (i.e., the last detection box of the trajectory) and the abnormal region for each trajectory;
[0110] IoU is the ratio of the area of the overlapping region of two bounding boxes to the area of the union region of the two bounding boxes. The IoU between the termination detection box and the outlier region of each trajectory is shown in the following formula:
[0111]
[0112] Where Box1 is the termination detection box of the trajectory, and Box2 is the bounding box of the abnormal region; Area(Box1∩Box2) represents the area of the intersection of the two regions, and Area(Box1∪Box2) represents the area of the union of the two regions.
[0113] Step 6.2: Set a threshold to determine whether a trajectory represents an abnormal vehicle; set a threshold θ = 0.9 to determine whether a trajectory represents an abnormal vehicle; if the IoU between a trajectory and an abnormal region exceeds this threshold, the vehicle corresponding to the trajectory is considered abnormal.
[0114] IsAnomaly=IoU>θ
[0115] Step 6.3: Mark abnormal vehicles;
[0116] For those trajectories that are judged to be abnormal, the corresponding vehicles will be marked as abnormal vehicles, and the spatial location and time information of the abnormal vehicles will be obtained from the trajectories of the abnormal vehicles.
[0117] In this embodiment, compared to methods that solely use background modeling or speed estimation, the method of the present invention is better able to adapt to complex traffic environments across multiple traffic video scenarios. Especially in complex scenarios such as traffic congestion, multi-lane conditions, and different perspectives, the stability and reliability of this algorithm are also superior. The method of the present invention demonstrates significant technical advantages and application value.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.
Claims
1. A method for detecting abnormal vehicles in traffic videos, characterized in that: Includes the following steps: Step 1: Use a background modeling algorithm to obtain the weighted average background of all frames in the traffic video; Step 2: Perform target detection on all abnormal vehicles in the average background of each frame to initially obtain the regions where abnormal vehicles are located, and record them as abnormal regions; use the YOLOv5 model to perform target detection on the average background of each frame, and the detection result is the detection box of suspected abnormal vehicles in the background; finally, record the regions corresponding to all abnormal vehicle detection boxes in the average background of each frame as abnormal regions. Step 3: Based on the abnormal vehicle target detection results, extract the trajectory data of all vehicles in the video; The DeepSORT algorithm is used to extract the motion trajectory of vehicles from suspected abnormal vehicle detection boxes in consecutive frames. The DeepSORT algorithm takes the vehicle detection bounding box information from step 2 as input. The DeepSORT algorithm outputs vehicle trajectory information: {track_id} j ,frame_id i ,x,y, width,height}, where track_id j This represents the trajectory ID of the j-th vehicle, corresponding to the detection box information of this vehicle's trajectory in the i-th frame; Step 4: Use a quadtree algorithm to build a spatial index for all vehicle trajectories in the video, so as to quickly query vehicle trajectories within the abnormal areas obtained in Step 2; insert new vehicle trajectory data into the quadtree using the following method: (1) If the rectangular area covered by the current quadtree node intersects with the rectangular area of the new vehicle trajectory data, then determine whether the current quadtree node is a leaf node and go to (2). (2) If the current quadtree node is a leaf node, the new vehicle trajectory data is directly stored in the leaf node of the current quadtree, and the insertion ends; (3) If the current quadtree node is not a leaf node, determine which child nodes of the current quadtree node's rectangular region intersect with the rectangular region of the new vehicle trajectory data, and then proceed to (4). (4) Insert the new vehicle trajectory data into the intersecting quadtree child nodes and return (1); Step 5: Use the constructed quadtree spatial index to query vehicle trajectories related to the abnormal area; Step 6: Identify abnormal trajectories among all vehicle trajectories, and then determine the abnormal vehicle information; The detection boxes corresponding to all vehicle trajectory data obtained in step 3 are used to perform IOU calculation with the abnormal area. If the IOU result is greater than the threshold, the vehicle corresponding to the trajectory is marked as an abnormal vehicle. The start time and spatial location information of the abnormal parking of this vehicle are found from the abnormal area.
2. The method for detecting abnormal vehicles in traffic videos according to claim 1, characterized in that: The specific method for step 1 is as follows: First, extract each frame of the traffic video. Then, taking into account the current frame and all its preceding frames, calculate the average background of the current frame, enhance the static parts, and suppress the moving parts in the video. The average background of each frame in the traffic video is obtained using the following formula: Average i = ( 1 − α) ∗ Average i-1 + α ∗ framei; Among them, frame i For the i-th frame in the traffic video, Average i-1 α is the average background of the (i-1)th frame, and α is the rate at which the average background is updated.
3. The method for detecting abnormal vehicles in traffic videos according to claim 2, characterized in that: The target detection result of the average background for each frame in step 2 is as follows: {frame_id,x,y, width,height}; Where frame_id is the frame number, (x,y) are the center coordinates of the detection box for identifying abnormal vehicles, and (width,height) are the width and height of the detection box, respectively.
4. The method for detecting abnormal vehicles in traffic videos according to claim 3, characterized in that: Step 4 defines a quadtree node as follows: Node={Region,Data,NW,NE,SW,SE}; Here, RegionRegion is a rectangular region defined as (xmin, ymin, xmax, ymax), representing the coordinates of the top-left and bottom-right vertices of the rectangular region covered by the node, respectively; DataData is a collection containing all vehicle trajectory data within this region; NW, NE, SW, SE are pointers to the four sub-regions of northwest, northeast, southwest, and southeast, respectively; the data in each quadtree is also a rectangular region of RegionRegion, stored in the leaf nodes of the quadtree.
5. The method for detecting abnormal vehicles in traffic videos according to claim 4, characterized in that: The specific method for step 5 is as follows: Step 5.1: Define the query range; The abnormal region obtained from background modeling is defined as the query region; this region is represented as a rectangle, defined as (xmin, ymin, xmax, ymax), where (xmin, ymin) are the coordinates of the upper left corner of the region, and (xmax, ymax) are the coordinates of the lower right corner; Step 5.2: Initialize the query; Initialize an empty result set to store the retrieved vehicle trajectories; then, call a recursive query function with the root node of the quadtree and the query region as initial inputs, and add the query results to the result set. Step 5.3: Perform a recursive query using a recursive query function; The input of the recursive query function is the current quadtree node and the query region, and the output is all data points in the node and its child nodes that intersect with the query region; Step 5.4: Analyze the recursive query results; The result set returned by the recursive query function contains all vehicle trajectories related to the anomaly area. Each trajectory is represented as a sequence of data points, and each data point contains the vehicle's position information in a certain frame.
6. The method for detecting abnormal vehicles in traffic videos according to claim 5, characterized in that: The specific method for step 5.3 is as follows: 1) If the region of the current quadtree node does not intersect with the query region, return an empty result set; 2) If the current quadtree node contains data points, check if these data points are within the query range. If so, add these data points to the result set. 3) If the current quadtree node has child nodes, call the recursive query function for each child node and add the query results to the result set; 4) Return the result set.
7. The method for detecting abnormal vehicles in traffic videos according to claim 6, characterized in that: The specific method for step 6 is as follows: Step 6.1: Calculate the IoU between the termination detection box and the abnormal region for each trajectory; IoU is the ratio of the area of the overlapping region of two bounding boxes to the area of the union region of the two bounding boxes. The IoU between the termination detection box and the outlier region of each trajectory is shown in the following formula: ; Where Box1 is the termination detection box of the trajectory, Box2 is the bounding box of the abnormal region; Area(Box1∩Box2) represents the area of the intersection of the two regions, and Area(Box1∪Box2) represents the area of the union of the two regions; Step 6.2: Set a threshold to determine whether a trajectory represents an abnormal vehicle; set a threshold θ to determine whether a trajectory represents an abnormal vehicle; if the IoU between a trajectory and an abnormal region exceeds this threshold, the vehicle corresponding to the trajectory is considered abnormal. Step 6.3: Mark abnormal vehicles; For those trajectories that are judged to be abnormal, the corresponding vehicles will be marked as abnormal vehicles, and the spatial location and time information of the abnormal vehicles will be obtained from the trajectories of the abnormal vehicles.
Citation Information
Patent Citations
Color image color feature extraction method and device thereof
CN102663398A
Traffic video intelligent analysis method based on target detection and tracking
CN110472496A