Method for judging whether distant vehicle moves or not in vehicle moving inspection

By training the vehicle detection model and using the target tracking algorithm, and saving vehicle position information in combination with the historical queue, the false alarm problem of judging whether a distant vehicle is moving in the prior art is solved, and effective vehicle dynamic detection judgment is achieved.

CN119888636APending Publication Date: 2025-04-25INGENIC SEMICON CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202311390597.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, there is a false alarm in the method of judging whether a distant vehicle is moving, especially when a person walks by the vehicle, the vehicle is judged to be moved; and judging whether the vehicle is moving based on the number of vehicles will also cause false alarms.

Method used

By training a vehicle detection model (such as the yolov5 target detection framework) to detect the vehicle position, obtain the vehicle's trackID in combination with the target tracking (such as the KCF tracking algorithm), create a historical queue to save the vehicle's historical position information, and determine whether the vehicle moves is that the displacement of the center point of the same vehicle is greater than one-half of the vehicle's size.

Benefits of technology

This method can effectively determine whether a remote vehicle is moving, reduce false alarms, and is simple and effective.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888636A_ABST
    Figure CN119888636A_ABST
Patent Text Reader

Abstract

The invention provides a method for judging whether a distant vehicle moves or not in vehicle moving inspection. The method comprises the following steps: S1, training a vehicle detection model: firstly, training the vehicle detection model; s2, adding target tracking: in order to judge whether a vehicle moves or not, firstly finding the same vehicle in continuous frames; the target tracking can complete the task; s3, obtaining the historical frame position coordinates of the same vehicle: creating a history queue as the attribute of the vehicle, the size of which is 10, and when the queue is full of data and then new data is put, deleting the first data put in, and then inserting the new data at the tail of the queue, namely first-in first-out; and S4, judging whether the vehicle moves or not: judging whether the vehicle moves or not according to the information of the history queue in the step S3, judging that the vehicle moves if the displacement of the central point of the same vehicle is greater than one half of the size of the vehicle, and otherwise, judging that the vehicle is static. The method is an effective method for judging whether the remote vehicle moves or not in the vehicle moving inspection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent video processing, and in particular relates to a method for judging whether a distant vehicle is moving during vehicle motion detection. Background Art

[0002] In the prior art, with the development of computer technology and the widespread application of computer vision principles, the use of computer image processing technology to detect and track targets in real time has become increasingly popular. Dynamic real-time tracking and positioning of targets are used in intelligent transportation systems, intelligent monitoring systems, and military target detection, and positioning of surgical instruments in medical navigation surgery has a wide range of application value. The task of target detection is to find all targets of interest in the image and determine their position and size, which is one of the core issues in the field of machine vision. Due to the different appearances, shapes, and postures of various objects, coupled with the interference of factors such as illumination and occlusion during imaging, target detection has always been the most challenging problem in the field of machine vision.

[0003] At the same time, target detection learning algorithms are moving from academia to industry, and there are many difficulties in this process. Although the data imbalance problem is not the most difficult, it is definitely one of the most important problems.

[0004] Existing methods for determining whether a vehicle is moving during vehicle dynamic inspection:

[0005] 1. Adopt the method of adding motion detection: motion detection can determine the position of the change in the two frames of pictures. According to the intersection of the motion detection result and the vehicle detection result, it is judged that the vehicle has moved; 2. Determine whether the vehicle has moved according to the number of vehicles: if the number of vehicles changes, the vehicle has moved. An increase in the number of vehicles indicates that the vehicle has entered the camera, and a decrease in the number of vehicles indicates that the vehicle has left the camera. If the number of vehicles remains unchanged, determine the intersection of the result of the current frame and the result of the previous frame. If there are few or no vehicles with intersection, the vehicle has moved.

[0006] However, the defects of the prior art are:

[0007] There are many methods for judging whether a vehicle is moving in the existing vehicle motion detection. By adding motion detection, the vehicle will be judged as moving when a person walks by the vehicle; judging whether a vehicle is moving based on the number of vehicles will cause many false alarms.

[0008] In addition, terms commonly used in the prior art include:

[0009] Vehicle motion detection: monitor moving vehicles, that is, alarm when the vehicle moves. Summary of the invention

[0010] In order to solve the above problems, the purpose of the present application is to solve the problem of determining whether a distant vehicle is moving during vehicle motion inspection for distant vehicles.

[0011] Specifically, the present invention provides a method for determining whether a distant vehicle is moving during vehicle motion detection, wherein the distant vehicle refers to a vehicle whose size in an image is less than 1 / 2 of the image, and the method comprises the following steps:

[0012] S1. Train the vehicle detection model:

[0013] First, train a vehicle detection model. The vehicle detection here uses the yolov5 target detection framework, the network uses yolov5s, and the data uses the vehicle data in the open source coco dataset and the object365 dataset, which includes car, bus and truck categories;

[0014] After the model is trained, it is used to detect vehicles. The detection result of the model is to output the location information of the vehicle, that is, the upper left coordinates (x1, y1) and lower right coordinates (x2, y2) of the vehicle. Since the vehicle detection model only outputs the coordinates of the vehicle's location information in each frame of the real-time stream, it is not possible to determine whether the vehicle is moving at this time.

[0015] S2. Add target tracking:

[0016] To determine whether a vehicle is moving, we first need to find the same vehicle in consecutive frames; this is accomplished through target tracking.

[0017] S3. Get the historical frame position coordinates of the same vehicle:

[0018] Create a history queue to save the historical information of vehicles. Assume that it can hold the historical information of 10 vehicles. When the queue is full and new data is added, the first data put in is deleted first, and then the new data is inserted at the end of the queue, that is, first in, first out. In addition, each vehicle also has position coordinate information and trackID. The history array stores the position coordinates of vehicles with the same trackID in the historical frame, that is, the upper left coordinates (x1, y1) and the lower right coordinates (x2, y2). The trackID of the vehicle is obtained through step S2, and the position information of vehicles with the same trackID can be put into a queue.

[0019] S4. Determine whether the distant vehicle is moving:

[0020] According to the history queue information in step S3, it can be determined whether the vehicle is moving. If the displacement of the center point of the same vehicle is greater than half of the vehicle size, it can be determined that the distant vehicle is moving, otherwise the vehicle is stationary.

[0021] The tracking algorithm used for the target tracking in step S2 is the KCF tracking algorithm. The purpose of target tracking here is to obtain the trackID of the vehicle. If the trackID of a vehicle in the previous and next frames is the same, they are considered to be the same vehicle.

[0022] In step S4, since the vehicle detection result may fluctuate, the ratio of the displacement of the center point of the same vehicle to the size of the vehicle may be adjusted according to actual conditions, including two-thirds.

[0023] The step S4 further comprises:

[0024] S4.1, first obtain the center coordinates of the head and tail data in the history queue, the center coordinates of the head data (x, y) = ((x1+x2) / 2, (y1+y2) / 2), the center coordinates of the tail data (x', y') = ((x1'+x2') / 2, (y1'+y2') / 2);

[0025] S4.2, obtain the distance between the center points of the head data and the tail data on the x-axis and y-axis, distance_x = |x'-x|, distance_y = |y'-y|;

[0026] S4.3, get the average width and height of the head and tail vehicles to replace the size of the vehicles. The width and height of the head vehicle are vehicle_w1=|x2-x1|, vehicle_h1=|y2-y1|, and the width and height of the tail vehicle are vehicle_w2=|x2'-x1'|, vehicle_h2=|y2'-y1'|; take their average values ​​vehicle_w=(vehicle_w1+vehicle_w2) / 2, vehicle_h=(vehicle_h1+vehicle_h2) / 2; the purpose of this is that when the vehicle is from far to near, the width and height of the vehicle will increase, and it is not possible to take only one value in the queue as the width and height of the vehicle. Taking the average of all the data in the queue will result in a larger amount of calculation, so taking the average of the head and tail of the queue is simple and not affected by distance;

[0027] S4.4, when distance_x is greater than vehicle_w / 2 or distance_y is greater than vehicle_h / 2, it can be determined that the vehicle has moved, otherwise the vehicle has not moved.

[0028] Therefore, the advantages of the present application are: the method is simple, and it is an effective method for determining whether a distant vehicle is moving during vehicle dynamic inspection. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.

[0030] Figure 1 is a schematic diagram of the process of this method. DETAILED DESCRIPTION

[0031] In order to more clearly understand the technical content and advantages of the present invention, the present invention is now further described in detail in conjunction with the accompanying drawings.

[0032] This application proposes a method for determining whether a distant vehicle is moving during vehicle dynamic detection. This technical training method originates from vehicle detection and can be extended to all target detections, such as Figure 1 shown.

[0033] Step S1. Training vehicle detection model

[0034] The premise of vehicle dynamic inspection is to detect the vehicle, so we first train a vehicle detection model. The vehicle detection model does not distinguish between distant and nearby vehicles, that is, it includes the detection of distant and nearby vehicles. The vehicle detection here uses the yolov5 target detection framework, the network uses yolov5s, and the data uses the vehicle data in the open source coco dataset and the object365 dataset, which includes car, bus and truck categories.

[0035] After the model is trained, it is used to detect vehicles and output the vehicle's location information, i.e., the upper left and lower right coordinates. Since vehicle detection only outputs the vehicle's location information in each frame of the real-time stream, it is not possible to determine whether the vehicle is moving.

[0036] Step S2. Add target tracking

[0037] In order to determine whether a vehicle is moving, the same vehicle should first be found in consecutive frames; target tracking can accomplish this task. The target tracking task is to predict the size and position of the target in subsequent frames given the target size and position of the initial frame of a video sequence. When the predicted vehicle position overlaps with the detected vehicle position, the trackID can be obtained. The purpose of target tracking here is to obtain the vehicle's trackID, or tracking ID. If the trackID of a vehicle in the previous and next frames is the same, it is considered to be the same vehicle. The KCF tracking algorithm is used here to complete target tracking. The full name of the KCF tracking algorithm is the Kernel Correlation Filter kernel correlation filter algorithm. This is a prior art tracking algorithm and will not be described here.

[0038] Step S3. Obtain the historical frame position coordinates of the same vehicle

[0039] Create a history queue as a vehicle attribute, with a size of 10. When the queue is full and new data is added, the first data put in is deleted first, and then the new data is inserted at the end of the queue, that is, first in, first out. In addition, each vehicle has position coordinate information and trackID. The history array stores the position coordinates of vehicles with the same trackID in the history frame, that is, the upper left coordinates (x1, y1) and the lower right coordinates (x2, y2). The vehicle's trackID can be obtained through step 2. The position information of vehicles with the same trackID can be put into an array.

[0040] Step S4. Determine whether the vehicle is moving

[0041] According to the history queue information in step S3, it can be determined whether the vehicle is moving. If the displacement of the center point of the same vehicle is greater than half of the vehicle size, it can be determined that the vehicle is moving. Otherwise, the vehicle is stationary. The specific steps are as follows:

[0042] S4.1, first obtain the center coordinates of the head and tail data in the history queue, the center coordinates of the head data (x, y) = ((x1+x2) / 2, (y1+y2) / 2), the center coordinates of the tail data (x', y') = ((x1'+x2') / 2, (y1'+y2') / 2), S4.2, obtain the distance between the center points of the head data and the tail data on the x-axis and y-axis, distance_x = |x'-x|, distance_y = |y'-y|.

[0043] S4.3, get the average width and height of the head and tail vehicles to replace the size of the vehicles. The width and height of the head vehicle are vehicle_w1 = |x2-x1|, vehicle_h1 = |y2-y1|, and the width and height of the tail vehicle are vehicle_w2 = |x2'-x1'|, vehicle_h2 = |y2'-y1'|. Take the average value vehicle_w = (vehicle_w1+vehicle_w2) / 2, vehicle_h = (vehicle_h1+vehicle_h2) / 2. The purpose of this is that when the vehicle is from far to near, the width and height of the vehicle will increase. It is not possible to take only one value in the queue as the width and height of the vehicle. Taking the average of all the data in the queue will result in a larger amount of calculation. Therefore, taking the average of the head and tail of the queue is simple and not affected by distance.

[0044] S4.4, when distance_x is greater than vehicle_w / 2 or distance_y is greater than vehicle_h / 2, it can be determined that the vehicle has moved, otherwise the vehicle has not moved.

[0045] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for determining whether a distant vehicle is moving during vehicle motion detection, characterized in that: The distant vehicle refers to a vehicle whose size in the image is less than 1 / 2 of the image. The method comprises the following steps: S1. Train the vehicle detection model: First, train a vehicle detection model. The vehicle detection here uses the yolov5 target detection framework, the network uses yolov5s, and the data uses the vehicle data in the open source coco dataset and the object365 dataset, which includes car, bus and truck categories; After the model is trained, it is used to detect vehicles. The detection result of the model is to output the location information of the vehicle, that is, the upper left coordinates (x1, y1) and lower right coordinates (x2, y2) of the vehicle. Since the vehicle detection model only outputs the coordinates of the vehicle's location information in each frame of the real-time stream, it is not possible to determine whether the vehicle is moving at this time. S2. Add target tracking: To determine whether a vehicle is moving, we first need to find the same vehicle in consecutive frames; this is accomplished through target tracking. S3. Get the historical frame position coordinates of the same vehicle: Create a history queue to save the historical information of vehicles. Assume that it can hold the historical information of 10 vehicles. When the queue is full and new data is added, the first data put in is deleted first, and then the new data is inserted at the end of the queue, that is, first in, first out. In addition, each vehicle also has position coordinate information and trackID. The history array stores the position coordinates of vehicles with the same trackID in the historical frame, that is, the upper left coordinates (x1, y1) and the lower right coordinates (x2, y2). The trackID of the vehicle is obtained through step S2, and the position information of vehicles with the same trackID can be put into a queue. S4. Determine whether the distant vehicle is moving: According to the history queue information in step S3, it can be determined whether the vehicle is moving. If the displacement of the center point of the same vehicle is greater than half of the vehicle size, it can be determined that the distant vehicle is moving, otherwise the vehicle is stationary.

2. The method for determining whether a distant vehicle is moving in vehicle motion detection according to claim 1, characterized in that: The tracking algorithm used for the target tracking in step S2 is the KCF tracking algorithm. The purpose of target tracking here is to obtain the trackID of the vehicle. If the trackID of a vehicle in the previous and next frames is the same, they are considered to be the same vehicle.

3. The method for determining whether a distant vehicle is moving in vehicle motion detection according to claim 1, characterized in that: In step S4, since the vehicle detection result may fluctuate, the ratio of the displacement of the center point of the same vehicle to the size of the vehicle may be adjusted according to actual conditions, including two-thirds.

4. The method for determining whether a distant vehicle is moving in vehicle motion detection according to claim 1, characterized in that: The step S4 further comprises: S4.1, first obtain the center coordinates of the head and tail data in the history queue, the center coordinates of the head data (x, y) = ((x1+x2) / 2, (y1+y2) / 2), the center coordinates of the tail data (x', y') = ((x1'+x2') / 2, (y1'+y2') / 2); S4.2, obtain the distance between the center points of the head data and the tail data on the x-axis and y-axis, distance_x = |x'-x|, distance_y = |y'-y|; S4.3, get the average width and height of the head and tail vehicles to replace the size of the vehicles. The width and height of the head vehicle are vehicle_w1=|x2-x1|, vehicle_h1=|y2-y1|, and the width and height of the tail vehicle are vehicle_w2=|x2'-x1'|, vehicle_h2=|y2'-y1'|; take their average values ​​vehicle_w=(vehicle_w1+vehicle_w2) / 2, vehicle_h=(vehicle_h1+vehicle_h2) / 2; the purpose of this is that when the vehicle is from far to near, the width and height of the vehicle will increase, and it is not possible to take only one value in the queue as the width and height of the vehicle. Taking the average of all the data in the queue will result in a larger amount of calculation, so taking the average of the head and tail of the queue is simple and not affected by distance; S4.4, when distance_x is greater than vehicle_w / 2 or distance_y is greater than vehicle_h / 2, it can be determined that the vehicle has moved, otherwise the vehicle has not moved.

Citation Information

Patent Citations

  • Vehicle dynamic detection method and device, computer equipment and storage medium

    CN111126286A

  • Method, device and equipment for determining driving direction of vehicle and storage medium

    CN113486816A

  • Target driving track identification method of vehicle

    CN114078240A

  • Motor vehicle illegal parking intelligent identification method and system based on deep learning

    CN114648748A

  • Vehicle motion information identification method based on YOLO-V5

    CN114743173A