Method and device for intelligently detecting illegal driving of vehicle by using AI visual technology, and storage medium
Through AI vision technology, using cameras and vehicle positioning coefficients, efficient and accurate detection of vehicle violations is achieved, misjudgment and resource waste in the existing technology is solved, and the accuracy and efficiency of detection are improved.
Patent Information
- Application Number
- CN202411176387.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-13
AI Technical Summary
When the prior art detects vehicle driving illegally, image recognition technology processes complexity, resulting in misjudgment and waste of resources, insufficient accuracy, and controversy.
AI vision technology is used to collect video images through the camera, manually calibrate the detection area, set the vehicle positioning coefficient, perform vehicle information detection and trajectory tracking, determine whether to drive in violation, and trigger an alarm when a violation is detected.
It realizes efficient, accurate and automatic identification of vehicle violations, reduces the burden of manual review, improves the accuracy and efficiency of detection, and is suitable for situations where resources are limited.
Smart Images

Figure CN119132064A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of AI vision technology, and in particular to a method, device and storage medium for intelligently detecting vehicle violations using AI vision technology. Background Art
[0002] Video surveillance and image recognition technology monitors traffic conditions in real time by placing cameras at key road sections and intersections. Using image processing techniques such as edge detection, background modeling, and object tracking, vehicles in the video are identified and tracked, thereby detecting illegal driving behaviors such as driving against traffic and illegal U-turns.
[0003] However, image recognition technology requires processing complex image data, including factors such as background noise, lighting variations, and occlusion, placing high demands on the algorithm. Furthermore, due to the limitations of image recognition technology, the system may misjudge an innocent vehicle, misidentifying it as a violating vehicle. Summary of the Invention
[0004] The purpose of the present invention is to address the deficiencies of the prior art and to provide a method for detecting vehicle violations, which solves the problems of complex image processing and insufficient accuracy in current image recognition technology, leading to misjudgments, disputes, or waste of resources.
[0005] To achieve the above objectives, the present invention provides a method for intelligently detecting vehicle violations using AI vision technology, the specific steps of which are as follows:
[0006] S1. Capture images of the target area and use a camera to capture video images of vehicles traveling in the environment;
[0007] S2. Mark the target area, manually calibrate the detection area, draw line 1 and line 2, and the area between line 1 and line 2 is the detection area;
[0008] S3. Set the vehicle positioning coefficient, which is used to calculate the vehicle position point on the vehicle position coordinate frame;
[0009] S4. Detect vehicle information within the detection area;
[0010] S5. Tracking the vehicle in step S4;
[0011] S6. Determine whether the vehicle has entered the current detection area. Generate a detection frame based on Marker Line 1 and Marker Line 2. Determine whether the vehicle has entered the detection area by determining the relative position of the vehicle's position coordinates and the detection frame. Vehicles that have not passed through the detection area will not be processed.
[0012] Preferably, the method further includes step S7, wherein the specific details of step S7 are as follows:
[0013] S7. Determine if the vehicle is illegally traveling within the detection area. Based on the acquired vehicle trajectory information, determine if the vehicle is illegally traveling within the detection area, such as driving against traffic or making an illegal U-turn.
[0014] Preferably, the method further includes step S8, wherein the specific details of step S8 are as follows:
[0015] S8. Save the video images and license plate numbers of the illegally driven vehicles. Use AI recognition technology to identify and store the license plate numbers and video images of the illegally driven vehicles.
[0016] Preferably, the method further includes step S9, wherein the specific details of step S9 are as follows:
[0017] S9. The edge AI device triggers an alarm. Upon detecting a vehicle violation, the device pushes an alarm message to a web page for preview and issues an audible alarm.
[0018] Preferably, step S4 is specifically as follows: obtaining each frame of the video image, performing necessary preprocessing, using AI recognition technology to detect the vehicle position coordinate information on the current image, and cropping the vehicle image according to the coordinates, and then using AI recognition technology to further obtain the characteristic value information corresponding to each vehicle.
[0019] Preferably, the step S5 is specifically as follows: generating a number ID for each vehicle in the current picture according to the feature value, saving the vehicle number and the corresponding position frame coordinates and other information, performing identification detection and feature value extraction on each frame of the vehicle in motion, and obtaining the corresponding running trajectory information of each vehicle on the video screen.
[0020] The present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.
[0021] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the steps of the above method when executed by a processor.
[0022] Compared with the existing technology, the technical solution proposed in this application has the following beneficial effects: the present invention adopts AI vision technology to realize efficient and accurate automatic recognition and judgment of illegal driving behaviors, reduce the burden of manual review, and under limited resources, can detect the vehicle's driving direction, track the vehicle's driving trajectory, and determine vehicle violations, thereby improving the accuracy and efficiency of vehicle illegal driving detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments with reference to the following drawings:
[0024] Figure 1 Schematic diagram of the method of the present invention. DETAILED DESCRIPTION
[0025] The following will clearly and completely describe and discuss the technical solutions in the embodiments of the present invention in conjunction with the drawings of the present invention. Obviously, what is described here is only a part of the examples of the present invention, not all the examples. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0026] It should be noted that when a component is referred to as being "fixed to" another component, it may be directly on the other component or there may also be a central component. When a component is considered to be "connected to" another component, it may be directly connected to the other component or there may also be a central component. When a component is considered to be "set on" another component, it may be directly set on the other component or there may also be a central component. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used in this specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0028] See also Figure 1 This embodiment provides a method for intelligently detecting vehicle violations using AI vision technology. The specific technical solution is as follows:
[0029] Step 1: Train a vehicle detection model, a vehicle feature extraction model, and a license plate recognition model based on deep learning and deploy them on edge AI devices.
[0030] Step 2: Use a camera to capture images in the environment and connect them to the edge AI device.
[0031] Step 3: Manually mark the detection area. Draw entry mark line 1 and exit mark line 2 on the preview image, and transfer the normalized position coordinates of the mark lines to the AI device for use in analysis;
[0032] Step 4. Set the vehicle positioning coefficient. The positioning coefficient is a two-dimensional coefficient value representing the vertical and horizontal coordinates, which is used to calculate the vehicle positioning point on the vehicle position coordinate frame. For example, when the coefficient is (1,1), the coordinate point at the lower right corner of the vehicle position coordinate rectangle is used as the vehicle positioning point;
[0033] Step 5: Generate a detection frame based on the markings. Use the passed coordinates of markings 1 and 2 to generate a detection frame respectively. Markings 1 and 2 can be polyline segments with multiple points or straight lines with two points. The points at both ends of each line segment are perpendicular to the line segment and extend a certain distance toward the detection area. All the points are connected to form a polygonal detection frame. The detection area is between markings 1 and 2.
[0034] Step 6: Detect vehicle location coordinates and feature value information. In the edge AI device, the connected video image is acquired frame by frame, and after cropping, scaling, and other processing, the vehicle model is used to detect the vehicle location coordinate information on the current image. The image of each vehicle is cropped according to the location coordinates, and the feature information of each vehicle is further identified through the vehicle feature value extraction model. A unique vehicle identification ID is generated, and the location coordinates and other information of each vehicle are stored according to the ID to track the trajectory of each vehicle.
[0035] Step seven, obtain the trajectory of the vehicle traveling in the detection area. Generate a two-dimensional NumPy array initialized to 0 based on the resolution of the preprocessed image, initialize the points in detection frame 1 to 1, and initialize the points in detection frame 2 to 2. Calculate the positioning point of each vehicle based on the vehicle position coordinates, and determine the positional relationship between the vehicle and the detection area through the positioning point. When it is detected that the vehicle first and for the first time enters detection frame 1, obtain the vehicle ID and create and store the corresponding position coordinates, current image data, and current system time and other information records based on the ID, and continuously update and store the information records of the vehicle's travel before reaching detection frame 2. If it does not pass through detection frame 2, no subsequent processing is performed. If the vehicle first passes through detection frame 2, the operation is the same as detection frame 1, and the relevant records are stored. Finally, the complete trajectory data of the target vehicle traveling in the detection area is collected;
[0036] Step 8: Determine whether the vehicle is driving illegally. Draw a line on the road section where driving against traffic is prohibited. By judging whether the target vehicle has passed through detection box 2 when it reaches detection box 1, the vehicle is determined to be driving against traffic. Draw a line on the road section where U-turns are prohibited. By judging whether the vehicle has passed through detection box 1 and detection box 2 when it reaches detection box 1, the vehicle is determined to be making an illegal U-turn.
[0037] Step 9. Obtain and save the images and license plate number and other information of the illegally driving vehicles. After detecting the violation of the vehicle, use the license plate number detection model to identify the license plate number of the illegal vehicle image. To reduce calculations, a detection is performed every 25 frames. The two images of the vehicle that violates the law by entering the detection frame 2 for the first time and leaving the detection frame 1 for the first time are saved as warning images of illegal driving; the three images of the vehicle that violates the law by entering the detection frame 1 and detection frame 2 for the first time and leaving the detection frame 1 for the second time are saved as warning images of illegal driving;
[0038] Step 10: The edge AI device triggers an alarm. Upon detecting a vehicle driving against traffic or making an illegal U-turn, the alarm mechanism is triggered, and information such as the warning image and license plate number is pushed to a web page for preview. An audible alarm is also sounded.
[0039] This embodiment also provides a computer device, such as a smartphone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server, or cabinet server (including a standalone server or a server cluster consisting of multiple servers), capable of executing programs. The computer device of this embodiment includes at least, but is not limited to, a memory and a processor that can be interconnected via a system bus.
[0040] In this embodiment, the memory (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory may be an internal storage unit of a computer device, such as the hard disk or internal memory of the computer device. In other embodiments, the memory may also be an external storage device of the computer device, such as a plug-in hard disk equipped with the computer device, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. Of course, the memory may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory is generally used to store the operating system and various application software installed on the computer device. In addition, the memory may also be used to temporarily store various types of data that have been output or are about to be output.
[0041] The processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 22 is generally used to control the overall operation of the computer device. In this embodiment, the processor is used to run program code stored in the memory or process data.
[0042] This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the corresponding function is realized when the program is executed by a processor.
[0043] The above describes specific embodiments of the present invention. It should be understood that the present invention is not limited to the specific embodiments described above, and that one or more of the above embodiments may be combined. Those skilled in the art may make various changes, modifications, or combinations within the scope of the claims, which do not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments may be combined with each other in any manner.
Claims
1. A method for intelligently detecting vehicle driving violations using AI visual technology, characterized in that: The specific steps are as follows: S1. Capture images of the target area and use a camera to capture video images of vehicles driving in the environment; S2. Mark the target area, manually calibrate the detection area, draw line 1 and line 2, and the area between line 1 and line 2 is the detection area; S3. Set the vehicle positioning coefficient, which is used to calculate the vehicle position positioning point on the vehicle position coordinate frame; S4. Detect vehicle information of vehicles within the detection area; S5. Tracking the vehicle in step S4; S6. Determine whether the vehicle enters the current detection area. A detection frame is generated according to marking line 1 and marking line 2 respectively. By judging the relative position of the positioning point of the vehicle position coordinates and the detection frame, it is determined whether the vehicle enters the detection area. Vehicles that do not pass through the detection area are not processed.
2. According to claim 1, a method for intelligently detecting vehicle driving violations using AI visual technology is characterized in that: The step S7 is further included, and the specific details of the step S7 are as follows: S7. Determine whether the vehicle is driving illegally. Determine whether the vehicle is driving illegally in the detection area based on the acquired vehicle trajectory information, such as whether the vehicle is driving in the wrong direction or making an illegal U-turn in the detection area.
3. According to claim 2, a method for intelligently detecting vehicle driving violations using AI visual technology is characterized in that: The step S8 is further included, and the specific details of the step S8 are as follows: S8. Save the video images and license plate numbers of the vehicles that violate the regulations. Use AI recognition technology to identify and store the license plate numbers and video images of the vehicles that violate the regulations.
4. According to claim 3, a method for intelligently detecting vehicle driving violations using AI visual technology is characterized in that: The step S9 is further included, and the step S9 is specifically as follows: S9. The edge AI device triggers an alarm. After detecting that a vehicle is driving illegally, the alarm information is pushed to the web page for preview, and a sound alarm is issued.
5. According to claim 4, a method for intelligently detecting vehicle driving violations using AI visual technology is characterized in that: The step S4 is specifically as follows: obtaining each frame of the video image, and performing necessary preprocessing, using AI recognition technology to detect the vehicle position coordinate information on the current image, and cropping the vehicle image according to the coordinates, and then using AI recognition technology to further obtain the feature value information corresponding to each vehicle.
6. The method for intelligently detecting vehicle driving violations using AI visual technology according to claim 4 is characterized in that: The step S5 specifically comprises: generating a number ID for each vehicle in the current picture according to the feature value, saving the vehicle number and the corresponding position frame coordinates and other information, performing identification detection and feature value extraction on each frame of the vehicle in motion, and obtaining the corresponding running track information of each vehicle in the video screen.
7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
