Self-adaptive illegal parking detection method, detection system and storage medium
By combining the YOLO and DeepSort algorithms to develop an adaptive illegal parking detection method, the problems of low efficiency and poor accuracy in illegal parking detection are solved. This method enables intelligent and automated multi-dimensional illegal parking judgment, providing efficient and accurate illegal parking detection and enforcement evidence.
Patent Information
- Application Number
- CN202511003549.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-11-04
AI Technical Summary
Existing technologies for detecting illegal parking suffer from problems such as low efficiency, high cost, poor environmental adaptability, inability to distinguish between temporary parking and long-term illegal parking, and lack of effective tracking mechanisms, resulting in insufficient detection accuracy and robustness.
By employing a YOLO object detection model based on deep learning combined with the DeepSort tracking algorithm, and through vehicle state calculation and multi-dimensional judgment logic, the system can achieve vehicle identity tracking and multi-dimensional illegal parking judgment, dynamically adjust the illegal parking judgment criteria, and perform intelligent detection by combining timing thresholds and environmental information.
It achieves highly accurate and robust illegal parking detection, has a high degree of automation, reduces labor costs, provides intuitive law enforcement evidence, adapts to complex traffic environments, reduces false alarm rates, and improves detection efficiency.
Smart Images

Figure CN120894918A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of vehicle traffic technology, and more particularly, to a self-adaptive illegal parking detection method, a detection system and a storage medium. BACKGROUND
[0002] With the rapid development of social economy and the acceleration of urbanization, the number of motor vehicles has increased dramatically, while the growth rate of urban parking facilities cannot meet the growing demand for parking. Therefore, the phenomenon of random parking of motor vehicles, i.e. illegal parking, is becoming increasingly common in major cities. Illegal parking not only seriously affects road traffic efficiency and causes traffic congestion, but also may block critical areas such as fire access and sidewalks, causing huge traffic safety hazards and damaging the city image and the quality of life of residents.
[0003] In order to effectively govern the problem of illegal parking, the traffic management department has invested a lot of manpower and resources. The traditional supervision method mainly relies on traffic police or supervisors to conduct on-site patrol, paste tickets and impose penalties. However, this method has many inherent limitations.
[0004] Under this background, using computer vision and artificial intelligence technology, through the existing city monitoring cameras (“Sky Net Project” and “Snow Bright Project”), automatic, real-time and efficient detection and alarm of illegal parking behavior have become an important development direction in the field of smart city and intelligent transportation.
[0005] Currently, the technologies used for illegal parking detection mainly include the following:
[0006] Manual video round patrol: personnel in the monitoring center manually switch and observe the monitoring video screen to find and record illegal parked vehicles; the disadvantages are: low efficiency, requiring a large number of manpower, and unable to achieve 24-hour uninterrupted monitoring; monitoring personnel are prone to visual fatigue after long hours of work, resulting in missed or false reports; and the response is not timely, with a long time delay from discovery to disposal;
[0007] Magnetic / induction coil technology: a magnetic sensor or coil is pre-buried under the road surface in the prohibited parking area, and when a vehicle is parked above, the sensor detects changes in the earth's magnetic field or electromagnetic field, thereby determining that a vehicle has parked; the disadvantages are: high installation and maintenance costs, requiring excavation construction on the road surface, which has a significant impact on traffic; easily affected by environmental interference, such as manhole covers, subways and high-voltage lines, which may affect its accuracy; unable to obtain image information of the vehicle, unable to distinguish between temporary parking and long-term illegal parking, lack of intuitive image evidence, and easy to cause disputes;
[0008] Traditional image processing techniques: mainly use background subtraction or frame difference method, by establishing a static background model, comparing the current video frame with the background model, to identify the foreground target (i.e. vehicle); The shortcomings are: poor environmental adaptability, sensitive to light changes, weather (rain, snow, fog), tree shadow shaking and other environmental factors, prone to false positives; Unable to effectively distinguish between legal temporary parking (such as taxi pick-up and drop-off) and long-term illegal parking; For the small movement of the vehicle or the long-term static in the scene, which is misjudged as part of the background by the algorithm, resulting in missed detection;
[0009] Basic target detection technology: use early target detection algorithm (such as Haar feature and Adaboost, or early deep learning model) to identify vehicles; The shortcomings are: although the vehicle can be detected, it cannot be continuously identified and tracked. If a vehicle is temporarily blocked and then appears again, the system may identify it as a new target, resulting in incorrect calculation of parking time. It is difficult to set accurate illegal parking judgment standards because it cannot accurately accumulate the complete stay time of a vehicle in the no-parking area.
[0010] Chinese patent document 1 (application number: 202411918675.4, application date: 2024.12.25) discloses a method, device and equipment for detecting illegal parking, and a storage medium. The method for detecting illegal parking comprises the following steps: acquiring a real-time video stream in a traffic checkpoint monitoring, and extracting image frames in the real-time video stream according to a preset time interval; performing parking space recognition based on the image frames to generate a parking space area detection result, and simultaneously extracting the range of the no-parking area; previously, subsequently, or simultaneously; performing vehicle and license plate detection based on the image frames to obtain the current position coordinates of the vehicle and license plate information; judging whether the vehicle is illegally parked according to whether the current position coordinates of the vehicle are within the range of the no-parking area; if the vehicle is illegally parked, a report is automatically generated, and system prompt information with an illegal parking symbol is generated. In this scheme, a single dimension is used to judge whether parking is illegal, and there are still problems such as large noise influence in complex environment and poor robustness. Therefore, there is an urgent need for a detection method with high accuracy, high robustness, intelligence and automation to solve the problems of high labor cost and low efficiency in the prior art, high hardware cost and difficult maintenance, poor algorithm robustness, inability to accurately distinguish between temporary parking and illegal parking, and lack of effective tracking mechanism. SUMMARY
[0011] Therefore, the present application provides a deep learning-based automatic detection algorithm and system for motor vehicle illegal parking, which can automatically adjust the judgment criteria according to the "vehicle state" (type, speed) and "spatiotemporal scenario" (time period, location) based on the combination of timing threshold and identity tracking.
[0012] In a first aspect, the application provides a self-adaptive illegal parking detection method, comprising:
[0013] System initialization: load a pre-trained YOLO target detection model, wherein the YOLO target detection model is obtained based on a COCO dataset training; load a pre-configured rule configuration file, wherein the rule configuration file includes rule configurations corresponding to at least four detection dimensions, the detection dimensions include a time period dimension, a vehicle category dimension, a speed threshold dimension, and a dynamic parking duration threshold dimension, the rule configuration of the dynamic parking duration threshold dimension includes a matrix structure or a nested structure constructed by upper limits of illegal parking time of different time periods and different vehicle types, wherein the first layer of the nested structure is a time period, the second layer is a vehicle category, and the third layer is a dynamic parking duration threshold; initialize a tracker, create a DeepSort tracking model and a vehicle information dictionary for each video stream task, wherein the DeepSort tracking model is obtained based on a re-identification dataset training; and the vehicle information in the vehicle information dictionary includes a vehicle ID, a start time, a vehicle category, a static duration, an average instantaneous speed, and a current position;
[0014] For each video frame in the input video stream, the following steps are performed:
[0015] Vehicle detection: input the video frame into the YOLO target detection model for detection, output a vehicle detection result of the vehicle target, the vehicle detection result includes a vehicle bounding box, a confidence, and a vehicle category, the vehicle category includes a car, a bus, and a truck, wherein inputting the video frame into the YOLO target detection model to output the vehicle detection result includes the following steps:
[0016] Feature extraction and prediction: input the video frame into the YOLO target detection model, perform forward calculation through a convolutional neural network inside the YOLO target detection model, extract image features, and predict a pre-selected detection result of the tracked vehicle, the pre-selected detection result includes a candidate bounding box of the tracked vehicle, a confidence, and a vehicle category;
[0017] Result screening and optimization: apply a non-maximum suppression algorithm to the candidate bounding box, merge overlapping predictions for the same vehicle, filter out low-confidence predictions, and output the vehicle detection result;
[0018] Region filtering: calculate whether the bounding box of the vehicle coincides with a no-parking area polygon according to a pre-set no-parking area polygon, filter out vehicles outside the no-parking area, and output a filtering result, wherein the filtering result includes a vehicle category, a vehicle bounding box, and a confidence;
[0019] Multi-target tracking: pass the filtering results to the DeepSort tracking model, which tracks the filtering results and outputs the vehicle ID of the tracked vehicle and the bounding box of the tracked vehicle;
[0020] Vehicle state calculation: iterate through each tracked vehicle and update the information of the tracked vehicle in the CarInfo vehicle information object, including the following steps:
[0021] Identification and recording: for a first appearing vehicle, create a CarInfo instance, record the start time of the appearance of the first appearing vehicle, and the vehicle category obtained by detecting the YOLO target detection model;
[0022] Position history update: store the center point coordinates of the current bounding box of the tracked vehicle and the corresponding timestamp in the position queue;
[0023] Speed calculation: based on the change of the position and the corresponding timestamp in the position queue, calculate the average instantaneous speed of the tracked vehicle, wherein the position is the center point coordinates of the bounding box of the vehicle;
[0024] Parking duration calculation: when the average instantaneous speed of the tracked vehicle is not higher than the parking speed threshold, the tracked vehicle is judged to be in a stationary state, and a stationary timer starts or continues to accumulate the parking duration; when the average instantaneous speed of the tracked vehicle is higher than the parking speed threshold, the tracked vehicle is judged to be in a moving state, and the parking duration corresponding to the tracked vehicle is reset;
[0025] Multi-dimensional illegal parking judgment and alarm: according to the result of the parking duration calculation, the following judgment logic is executed:
[0026] Iterate through all stationary vehicles: judge the tracked vehicles whose average instantaneous speed is not higher than the parking speed threshold;
[0027] Determine the scene: get the current system time, and determine the time period according to the rule configuration;
[0028] Get dynamic threshold: from the loaded preconfigured rule configuration file, query the corresponding dynamic parking duration threshold according to the time period and the vehicle category;
[0029] Trigger condition judgment: get the cumulative parking duration of the tracked vehicle, when the cumulative parking duration is not less than the dynamic parking duration threshold, and the notification flag of the tracked vehicle is false (False), the alarm condition is met;
[0030] Trigger action: set global alarm flag to true; set notified flag of the tracked vehicle to true; generate and send alarm information containing detailed context, wherein the alarm information containing detailed context includes vehicle ID, vehicle category, parking duration, and time period;
[0031] Result visualization and output: call the draw_box method to draw the analysis result of the illegal parking information on the original frame, wherein the illegal parking information includes vehicle ID, vehicle category, vehicle state, and illegal parking duration;
[0032] Resource cleanup: when the task is completed, call the cleanup method to release the DeepSort tracking model associated with the task and the vehicle information of all vehicles.
[0033] Optionally, in the result visualization and output step, the color of the bounding box is dynamically set according to whether the vehicle is determined to be illegal parking, and the illegal parking information including vehicle ID, vehicle category, vehicle state, and illegal parking duration is drawn above the bounding box.
[0034] Optionally, the step of calculating whether the bounding box of the vehicle coincides with the no-parking area polygon to filter vehicles outside the no-parking area and outputting the filtering result includes the following steps:
[0035] Obtain vehicle representative point: traverse each vehicle detection result output by the YOLO target detection model, and calculate the representative coordinate point of the vehicle position of the tracked vehicle according to the coordinates of the bounding box, wherein the coordinates of the bounding box are (x, y, w, h), x is the horizontal coordinate of the left upper point of the bounding box, y is the vertical coordinate of the left upper point of the bounding box, w is the width of the bounding box, and h is the height of the bounding box; the representative coordinate point of the vehicle position of the tracked vehicle is the center point coordinate (x+w / 2, y+h / 2) of the bounding box of the tracked vehicle;
[0036] Perform the judgment of whether the representative coordinate point is inside the no-parking area polygon: for each representative coordinate point of the vehicle position of the tracked vehicle, apply a ray casting algorithm or a winding number algorithm to judge whether the representative coordinate point is inside the no-parking area polygon;
[0037] Generate filtering result: if the result of judging whether the representative coordinate point is inside the no-parking area polygon is true, retain the vehicle detection result of the tracked vehicle; if the result of judging whether the representative coordinate point is inside the no-parking area polygon is false, discard the vehicle detection result of the tracked vehicle; output all retained vehicle detection results of the tracked vehicle as the filtering result.
[0038] Optionally, the average instantaneous speed of the tracked vehicle is calculated based on the changes in position and corresponding timestamp in the location queue, including the following steps:
[0039] Data point extraction: In the location queue, extract two location data points of the same tracked vehicle that differ in time, including the current location point and the corresponding timestamp, and the historical location point and the corresponding timestamp;
[0040] Pixel displacement calculation: Calculate the pixel displacement D of the current position point and historical position points in the two-dimensional image coordinate system of the video frame. pixel ;
[0041] Real-world distance conversion: Applying a pre-calibrated pixel-to-meter scale S, the pixel displacement D is... pixel Converted to real-world physical distance D real ;
[0042] Time difference calculation: Calculate the time difference Δt between the timestamps of the two location points;
[0043] Speed value calculation: Calculate the average instantaneous speed V of the tracked vehicle according to the formula.
[0044] V=D real / Δt.
[0045] Secondly, this application provides an adaptive illegal parking detection system, including a memory and a processor; wherein,
[0046] The memory is used to store computer programs, pre-trained YOLO object detection models, DeepSort tracking models, and pre-configured rule configuration files;
[0047] The processor, connected to the memory, is used to execute the computer program to implement the aforementioned adaptive illegal parking detection method. The processor includes an initialization unit, a video image acquisition unit, a detection and tracking unit, a state calculation unit, a multi-dimensional illegal parking judgment and alarm unit, a result output unit, and a resource cleanup unit.
[0048] An initialization unit, coupled to the memory, is used to load the YOLO target detection model, the DeepSort tracking model, and the rule configuration file from the memory when the adaptive illegal parking detection system is started or a new task begins, and to create and initialize an independent DeepSort tracking model and the vehicle information dictionary for each video stream task;
[0049] a video image acquisition unit, configured to acquire and receive real-time video streams from at least one source, decode the real-time video streams into continuous video frames, and send the video frames to the detection and tracking unit;
[0050] a detection and tracking unit, coupled to the video image acquisition unit and the initialization unit, configured to receive the video frames, detect and region filter vehicle targets in the video frames using a YOLO target detection model loaded by the initialization unit, and output vehicle detection results containing vehicle categories, bounding boxes, and confidence levels; and perform multi-target tracking on the vehicle detection results output by the YOLO target detection model and filtered using a DeepSort tracking model loaded by the initialization unit, and assign and update vehicle IDs, bounding boxes, and vehicle categories of each tracked vehicle;
[0051] a state calculation unit, coupled to the detection and tracking unit, configured to receive the vehicle detection results of the tracked vehicle, maintain a position queue including center point coordinates of the bounding boxes of the vehicle and corresponding time stamps in real time, and calculate average instantaneous speed and accumulated parking duration of the tracked vehicle based on changes in data in the position queue;
[0052] a multi-dimensional illegal parking judgment and alarm unit, coupled to the state calculation unit and the initialization unit, configured to acquire average instantaneous speed, accumulated parking duration, and vehicle categories of the tracked vehicle, query a dynamic parking duration threshold matching a current time period and vehicle categories from a rule configuration file loaded by the initialization unit according to a current system time, perform multi-dimensional illegal parking judgment logic, and generate alarm information containing vehicle IDs, vehicle categories, parking durations, and time periods and send the alarm information to the outside when alarm conditions are met;
[0053] a result output unit, coupled to the detection and tracking unit and the multi-dimensional illegal parking judgment and alarm unit, configured to receive original video frames and alarm information judged by the multi-dimensional illegal parking judgment and alarm unit, draw illegal parking analysis information containing vehicle IDs, vehicle categories, vehicle states, and illegal parking durations on the video frames in different colors according to whether the tracked vehicle is in an illegal parking state, and output visualized results with labeled information;
[0054] a resource cleaning unit, coupled to the detection and tracking unit, the state calculation unit, and the multi-dimensional illegal parking judgment and alarm unit, configured to release tracking model instances and all vehicle information associated with a video analysis task when the video analysis task ends or is stopped.
[0055] In a third aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program or computer instructions capable of being loaded by a processor and executing the adaptive illegal parking detection method.
[0056] Compared with the prior art, the adaptive illegal parking detection method, the detection system and the storage medium provided by the present application at least achieve the following beneficial effects:
[0057] First, high accuracy and high robustness: the present scheme adopts YOLO as the core target detector, combines the DeepSort tracking algorithm, and uses the appearance features of the vehicle for re-identification, which greatly enhances the stability of tracking in complex scenes, and the overall detection accuracy is high, and the false negative and false positive rates are low.
[0058] Second, intelligence and automation: the entire detection, tracking, analysis, judgment, alarm and evidence generation process is fully automated and does not require human intervention, greatly liberating human resources and improving the intelligent level of traffic management.
[0059] Third, intelligent and multi-dimensional illegal parking judgment logic: this is the core advantage of the present scheme. By establishing a comprehensive information file containing speed, type, and location history for each tracked vehicle, and combining a configurable dynamic rule engine, the present scheme realizes precise judgment far beyond a single time threshold. The system can dynamically adjust the tolerance of illegal parking according to whether it is peak time or late at night, whether it is a bus or a private car, and whether the vehicle is completely stationary or slowly moving in congestion. This makes the alarm more humanized and reasonable, and can accurately adapt to complex urban traffic conditions, significantly reducing the false alarm rate.
[0060] Fourth, strong multi-target continuous tracking capability: by instantiating an independent DeepSort tracker for each camera task (task_id), the DeepSort algorithm assigns a unique and unchanged ID (ds_ids) to each detected vehicle across frames, which is crucial for subsequent precise analysis and timing.
[0061] Fifth, low cost and easy deployment: the present scheme is a pure software solution that can be directly deployed on the back-end server of an existing video surveillance system, utilizing the already laid camera hardware, thereby saving a large amount of hardware procurement and maintenance costs.
[0062] Sixth, visualization and solid evidence: the present scheme provides strong visualization functions, which can draw detection boxes in real time on video images and distinguish vehicle states with different colors. At the same time, the tracking ID, type, and dynamically updated parking time of the vehicle are labeled on the box, and the output image information is intuitive and clear, which can be used as indisputable evidence for law enforcement.
[0063] Of course, implementing any product of the present application does not necessarily require achieving all of the above-mentioned technical effects simultaneously.
[0064] Other features of the present application, and its particular advantages, will become apparent to those skilled in the art from the following detailed description, together with the drawings. BRIEF DESCRIPTION OF DRAWINGS
[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description, serve to explain the principles of the application.
[0066] Figure 1 is a flowchart of an adaptive illegal parking detection method in an embodiment of the present application;
[0067] Figure 2 is a schematic diagram of a core processing flow in an adaptive illegal parking detection method in an embodiment of the present application;
[0068] Figure 3 is a flowchart of vehicle state calculation in an adaptive illegal parking detection method in an embodiment of the present application;
[0069] Figure 4 is a flowchart of multi-dimensional illegal parking judgment and alarm in an adaptive illegal parking detection method in an embodiment of the present application;
[0070] Figure 5 is a structural block diagram of an adaptive illegal parking detection system in an embodiment of the present application.
[0071] In the drawings:
[0072] 100, memory; 200, processor; 201, initialization unit; 202, video image acquisition unit; 203, detection and tracking unit; 204, state calculation unit; 205, multi-dimensional illegal parking judgment and alarm unit; 206, result output unit; 207, resource cleaning unit; 300, camera. DETAILED DESCRIPTION
[0073] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of the components and steps set forth in these embodiments, numerical expressions, and numerical values are not limiting to the scope of the present application unless otherwise specifically stated.
[0074] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way limiting to the scope of the application or its applications or uses.
[0075] Techniques, methods, and apparatus known to those of ordinary skill in the relevant art(s) can not be discussed in detail herein. However, where appropriate, the techniques, methods, and apparatus should be considered as being part of the description of the application.
[0076] In all of the examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Thus, other examples of the exemplary embodiments can have different values.
[0077] It should be noted that like reference numerals and letters refer to like items throughout the drawings, and once an item is defined in one drawing, it need not be discussed further in subsequent drawings.
[0078] Embodiment 1
[0079] Referring to Figures 1-4 , Figure 1 is a flowchart of an adaptive illegal parking detection method in an embodiment of the application, Figure 2 is a schematic diagram of a core processing flow in an adaptive illegal parking detection method in an embodiment of the application, Figure 3 is a flowchart of vehicle state calculation in an adaptive illegal parking detection method in an embodiment of the application, Figure 4 is a flowchart of multi-dimensional illegal parking judgment and warning in an adaptive illegal parking detection method in an embodiment of the application.
[0080] The core of the application is a motor vehicle illegal parking detection algorithm combining target detection, multi-target tracking, and multi-dimensional space-time analysis, which solves the following technical problems:
[0081] 1. Solving the problem of low efficiency and high cost of manual supervision;
[0082] 2. Solving the problem of poor environmental adaptability and low accuracy of traditional algorithms;
[0083] 3. Solving the problem of being unable to effectively distinguish between temporary parking and long-term illegal parking;
[0084] 4. Solving the problem of being unable to continuously identify and track vehicles;
[0085] 5. Solving the problem of lacking intuitive and effective law enforcement evidence.
[0086] In the application, an adaptive illegal parking detection method replaces manual round patrols through a fully automated video analysis process, realizes 7x24 hour uninterrupted intelligent monitoring, reduces labor costs, improves supervision efficiency, and solves the problem of low efficiency and high cost of manual supervision, as shown in Figure 1 The specific steps include (S100-S300):
[0087] S100, system initialization: load a pre-trained YOLO target detection model, the YOLO target detection model is obtained based on a COCO dataset training; load a pre-configured rule configuration file, wherein the rule configuration file includes rule configurations corresponding to at least four detection dimensions, the detection dimensions include a time period dimension, a vehicle category dimension, a speed threshold dimension, and a dynamic parking time threshold dimension, the rule configuration of the dynamic parking time threshold dimension includes a matrix structure or a nested structure constructed by upper limits of illegal parking times of different time periods and different vehicle types, wherein a first layer of the nested structure is a time period, a second layer is a vehicle category, and a third layer is a dynamic parking time threshold; initialize a tracker, create a DeepSort tracking model and a vehicle information dictionary for each video stream task, the DeepSort tracking model is obtained based on a re-identification dataset training, and vehicle information in the vehicle information dictionary includes a tracking ID, a start time, a vehicle category, a static time length, an average instantaneous speed, and a current position.
[0088] It should be noted that the YOLOv8 target detection model is used in the embodiment, and the model is obtained by training on the COCO dataset. The COCO dataset is a large-scale, content-rich, and widely used general target detection dataset, and contains tens of thousands of complex daily scene pictures. The annotation file is stored in JSON format, and contains image information, a category list, and detailed information of each object instance.
[0089] DeepSort is a tracking algorithm, and the DeepSort tracking model is trained on a re-identification dataset (such as MARS). The re-identification dataset focuses on a more specific and more vertical task: cross-camera tracking of a specific individual, and the image is usually a pedestrian or vehicle detected and cropped by a target detection model. Typical tasks include vehicle re-identification, which is used to track a specific vehicle.
[0090] In some optional embodiments, the CarInfo vehicle information mainly records:
[0091] track_id, vehicle ID, after a vehicle is identified by DeepSor, a unique tracking ID is assigned to the vehicle;
[0092] start_time, start time, which refers to the time when the vehicle is first identified;
[0093] vehicle_type, vehicle category, which specifically refers to types such as car, bus, truck, etc.;
[0094] park_time, static time length, which is a parking time length calculated by a core algorithm and is continuously dynamically updated;
[0095] avg_speed, average instantaneous speed, is the instantaneous speed calculated by the core algorithm, which is continuously dynamically updated;
[0096] position, current position, i.e. the bounding box of the vehicle, is generally stored in the format of xywh, 4 numerical values, x is the horizontal coordinate of the upper left point, y is the vertical coordinate of the upper left point, w is the width of the bounding box, and h is the height of the bounding box.
[0097] In this embodiment, the system initialization S100 includes:
[0098] S101, load model: execute the load_model() method to load the pre-trained YOLO target detection model.
[0099] S102, load the illegal parking rule configuration: the system will load an external rule configuration file (such as JSON or YAML format). The file defines the strategy of multi-dimensional judgment, for example:
[0100] Time period definition: such as rush_hour: ["07:00-09:00", "17:00-19:00"], night: ["22:00-06:00"];
[0101] Vehicle type: car, bus, truck;
[0102] Speed threshold: such as STOP_SPEED_THRESHOLD = 2 (km / h), below this speed is considered to be stationary;
[0103] Dynamic parking duration threshold: a matrix or nested structure defines the upper limit of illegal parking time for different time periods and different vehicle types (unit: seconds). Taking JSON format as an example, for example: {"rush_hour": {"car": 30, "bus": 120}, "night": {"car": 180, "bus": 180}}.
[0104] Specifically, the first layer is the time period (the value is rush_hour or night, indicating whether it is rush hour or night, of course, it can also be accurate to hours, such as 1 / 2 / 3... / 24); The second layer is the vehicle type (the value is car / bus / truck, indicating different types of vehicles); The third layer is the duration threshold (the value is 30, 120, 180, etc., which is the parking duration threshold, unit: seconds, exceeding this threshold triggers the alarm judgment).
[0105] S103, initializing tracker: creating an independent DeepSort tracker and a vehicle information dictionary self.car_info[task_id]={} for each video stream task (task_id).
[0106] S200, for each video frame in the input video stream, as shown in the following steps: Figure 2
[0107] S201, vehicle detection: inputting the video frame into the YOLO target detection model for detection, outputting a vehicle detection result of the vehicle target, the vehicle detection result including a bounding box of the vehicle, a confidence, and a vehicle category, the vehicle category including a car, a bus, and a truck.
[0108] Inputting the video frame into the YOLO target detection model, outputting the vehicle detection result, including the following steps:
[0109] a. feature extraction and prediction: inputting the video frame into the YOLO target detection model, performing forward calculation through the convolutional neural network inside the YOLO target detection model to extract image features and directly predict pre-selected detection results of the tracked vehicle, the pre-selected detection results including a candidate bounding box of the tracked vehicle, a confidence, and a vehicle category;
[0110] b. result screening and optimization: applying a Non-Maximum Suppression algorithm to the candidate bounding box to merge overlapping predictions for the same vehicle and filter out predictions with low confidence, thereby outputting the final and accurate vehicle detection result.
[0111] In this embodiment, the video frame is input into the YOLO detector, and the bounding box, confidence, and vehicle category (cls, such as "car", "bus", and "truck") of all vehicles are output.
[0112] It should be noted that in this embodiment, the advanced deep learning target detection model can more accurately identify vehicles in complex scenes (such as different lighting, weather, and partial occlusion), and combined with multi-target tracking technology, the robustness and accuracy of the algorithm are improved, and the problems of poor environmental adaptability and low accuracy of traditional algorithms are solved.
[0113] S202, region filtering: filtering vehicles outside the forbidden parking area according to the preset forbidden parking area polygon (zone), outputting a filtering result, the filtering result including a vehicle category, a bounding box of the vehicle, and a confidence. In the method of the present application, it is necessary to calculate whether the bounding box of the vehicle coincides with the detection area, and the vehicles outside the area are directly ignored.
[0114] In some optional embodiments, according to a preset no-parking area polygon, whether the bounding box of the vehicle coincides with the no-parking area polygon is calculated, vehicles outside the no-parking area are filtered, and a filtering result is output, including the following steps:
[0115] a. Obtain a vehicle representative point: traverse each vehicle detection result output by the YOLO target detection model, and calculate a coordinate point that can represent the position of the vehicle, i.e., a representative point coordinate, according to the bounding box coordinates (x, y, w, h) of the vehicle detection result. The left side of the representative point coordinate is preferably the center point coordinate (x+w / 2, y+h / 2) of the bounding box of the vehicle; wherein x is the horizontal coordinate of the top-left point of the bounding box, y is the vertical coordinate of the top-left point of the bounding box, w is the width of the bounding box, and h is the height of the bounding box;
[0116] b. Perform a judgment on whether the representative point coordinate is inside the no-parking area polygon: for the representative point coordinate of the position of each tracked vehicle, apply a Ray Casting Algorithm or a Winding Number Algorithm to judge whether the point is inside the preset no-parking area polygon;
[0117] c. Generate a filtered result: if the judgment result of step b is true, i.e., the vehicle representative point is inside the no-parking area polygon, the detection result of the vehicle (including the bounding box of the vehicle, the confidence, and the vehicle category) is retained; if the judgment result is false, the detection result of the vehicle is discarded; all retained vehicle detection results are collected as the final filtering result and output.
[0118] S203, multi-target tracking: the filtering result is transmitted to the DeepSort tracking model, the DeepSort tracking model tracks the filtering result, and outputs a vehicle ID of a tracked vehicle and a position (a bounding box) of the tracked vehicle.
[0119] It should be noted that the key output of the DeepSort tracking model is the vehicle ID (track_id), which is the unique identifier of the vehicle and is used to create vehicle information (CarInfo) and continuously track the vehicle information. Although the position information of the vehicle is also output by the YOLOV8 target detection model, the position information of the DeepSort tracking model is ultimately used as the standard. The two are basically consistent.
[0120] In the method of the present application, a bounding box is used to identify the vehicle position, which is generally stored in the format of xywh, that is, represented by four values, x is the horizontal coordinate of the upper left point of the bounding box, y is the vertical coordinate of the upper left point of the bounding box, w is the width of the bounding box, and h is the height of the bounding box. Compared with the center point coordinate mode, the bounding box mode contains more information. If only the center point is recorded, the length and width of the vehicle will be lost.
[0121] In the present embodiment, the filtered vehicle detection result (including the category) is sent to the DeepSort tracker. The tracker returns the unique tracking ID (ds_ids) of all active targets in the current frame and their positions.
[0122] It should be noted that the present embodiment assigns a unique identity ID to each vehicle entering the monitoring area by integrating a multi-target tracking algorithm (such as DeepSort), and can continuously track the vehicle in subsequent video frames. Even if the vehicle is temporarily obscured or moves slightly, the continuity of its identity can be maintained, thereby ensuring the accuracy of the parking timing, to solve the problem of being unable to continuously identify and track the vehicle.
[0123] S204, vehicle state calculation: traverse each tracked vehicle and update the information of the tracked vehicle in the vehicle information CarInfo object, such as Figure 3 As shown, comprising the following steps:
[0124] S2041, identification and recording: for a first appearing vehicle, create a vehicle information CarInfo instance, record the starting time of the first appearing vehicle and the vehicle category obtained by detecting the vehicle through the YOLO target detection model;
[0125] S2042, position history update: store the center point coordinates of the bounding box of the vehicle and the corresponding time stamp of the tracked vehicle in the position queue, and the position queue retains 2 seconds of data.
[0126] It should be noted that the 2 seconds retained by the position queue is an empirically derived value and cannot be too long or too short. In the present application, it can be set to 2 seconds or selected according to specific circumstances and experience. Its significance is to eliminate the "shaking" phenomenon of the vehicle speed (i.e., the vehicle speed is high and low, and jumps up and down constantly) when calculating the current instantaneous speed, so that the vehicle speed appears to change more smoothly. If it is too short, it will not have the effect of preventing shaking, and if it is too long, it may cause a relatively large vehicle speed error.
[0127] S2043, speed calculation: based on the change of the position and the corresponding time stamp in the position queue, calculate the average instantaneous speed of the tracked vehicle, wherein the position is the center point coordinate of the bounding box of the vehicle;
[0128] S2044, parking duration calculation: when the average instantaneous speed of the tracked vehicle is not higher than the parking speed threshold, it is determined that the tracked vehicle is in a static state, and a static timer starts timing or continues to accumulate the parking duration; when the average instantaneous speed of the tracked vehicle is higher than the parking speed threshold, it is determined that the tracked vehicle is in a moving state, and the parking duration corresponding to the tracked vehicle is reset.
[0129] In some optional embodiments, the average instantaneous speed of the vehicle is calculated based on the change of the positions in the position queue and the corresponding time stamps, including the following steps:
[0130] a. Data point extraction: in the position queue, two position data points of the same tracked vehicle with a time difference are extracted, including a current position point and a corresponding time stamp, a historical position point and a corresponding time stamp;
[0131] b. Pixel displacement calculation: the pixel distance D pixel between the current position point and the historical position point in the two-dimensional image coordinate system of the video frame is calculated;
[0132] c. Real-world distance conversion: an application of a pre-calibrated pixel-meter scale S is applied to convert the pixel distance D pixel into a physical distance D real in the real world;
[0133] d. Time difference calculation: the time difference Δt between the time stamps corresponding to the two position points is calculated;
[0134] e. Speed value calculation: the physical distance D real in the real world is divided by the time difference Δt, thereby calculating the average instantaneous speed V of the tracked vehicle, i.e., V = D real / Δt.
[0135] In this embodiment, the vehicle state calculation (Vehicle State Calculation) iterates through each tracked vehicle and updates its information in the CarInfo object, including:
[0136] (1) Identification and recording: if the vehicle is first appeared, a CarInfo instance is created for it, and the start_time and vehicle_type obtained from the detector are recorded.
[0137] (2) Position history update: the current center point coordinates and time stamp of the vehicle are stored in the position_history queue. This queue only retains the data of the last N seconds.
[0138] (3) Speed calculation: Based on the position and time change in position_history, the average instantaneous speed of the vehicle is calculated.
[0139] (4) Park time calculation: If the current speed of the vehicle is lower than the configured STOP_SPEED_THRESHOLD, it is considered to be in a stationary state, and its stationary timer starts or continues to accumulate the park time. If the speed is higher than this threshold, its park_time is reset.
[0140] S205, Multi-dimensional Violation Judgement & Alarm: Based on the results of the park time calculation, the following judgment logic is executed, as shown in Figure 4
[0141] S2051, Traverse all stationary vehicles: The tracked vehicles with average instantaneous speed not higher than the parking speed threshold are judged.
[0142] S2052, Determine the scenario: Get the current system time and determine the time period it belongs to according to the rule configuration.
[0143] S2053, Get dynamic threshold: From the loaded pre-configured rule configuration file, query the corresponding dynamic parking time threshold according to the time period and vehicle category.
[0144] S2054, Trigger condition judgment: Get the cumulative parking time of the tracked vehicle. When the cumulative parking time is not less than the dynamic parking time threshold, and the notification flag of the tracked vehicle is False, the alarm condition is met.
[0145] S2055, Trigger action: Set the global alarm flag to True; set the notification flag of the vehicle to True; generate and send alarm information containing detailed scenarios, including vehicle ID, vehicle category, parking time, and time period.
[0146] In this embodiment, Multi-dimensional Violation Judgement & Alarm is the core of optimization. After predict, the check_notify method will execute the following intelligent judgment logic:
[0147] (1) Traverse all stationary vehicles: Only vehicles with current speed lower than STOP_SPEED_THRESHOLD are judged.
[0148] (2) Determine the current scenario: Get the current system time and determine the time period it belongs to according to the rule configuration (e.g. "peak period").
[0149] (3) Obtain dynamic threshold: from the loaded rule configuration, query the corresponding dynamic parking time limit dynamic_parking_limit according to the current period and the type of the vehicle (vehicle_type).
[0150] (4) Trigger condition judgment:
[0151] Obtain the accumulated static time park_time of the vehicle.
[0152] When park_time>dynamic_parking_limit and the notified flag of the vehicle is False, the alarm condition is met.
[0153] In this method, the parking time is obtained by cumulative calculation, and is continuously updated.
[0154] (5) Trigger action:
[0155] Set the global alarm flag is_notify to True;
[0156] Set the notified flag of the vehicle to True to prevent repeated alarms;
[0157] Generate alarm information containing detailed scenarios (vehicle ID, type, parking time, period) and send it externally.
[0158] It should be noted that in this embodiment, a multi-dimensional dynamic strategy-based illegal parking judgment mechanism is introduced. First, the rule engine is loaded, including period definition, vehicle type, speed threshold, parking threshold, multi-dimensional parking judgment is based on the above four dimensions for automatic judgment. Through comprehensive analysis of the speed, type, specific period and cumulative stay time of the vehicle, accurate judgment of the illegal parking event is realized, effectively reducing the false alarm caused by normal temporary parking of the vehicle (such as picking up and dropping off passengers, short-term static under traffic congestion), to solve the problem of being unable to effectively distinguish between temporary parking and long-term illegal parking.
[0159] S206, result visualization and output: call the draw_box method to draw the analysis result of the illegal parking information on the original frame, wherein the illegal parking information includes vehicle ID, vehicle category, vehicle state, and parking time.
[0160] In some optional embodiments, the result visualization and output step includes: dynamically setting the color of the bounding box according to whether the vehicle is determined to be illegal parking, and drawing the illegal parking information above the bounding box, the illegal parking information including vehicle ID, vehicle category, vehicle state, and parking time.
[0161] In this embodiment, the result visualization and output (Visualization & Output) are as follows:
[0162] The draw_box method is called to draw the analysis result on the original frame:
[0163] (1) According to whether the vehicle is determined to be illegally parked, the color of the bounding box is dynamically set (e.g., red for illegally parked and green for normal).
[0164] (2) Above the box, more detailed information is drawn, such as ID: 101 Type: Car Status: Still (1 minute 35 seconds).
[0165] It should be noted that the method of the present embodiment can automatically intercept the image or video clip containing the illegal vehicle while generating an alarm, and clearly mark the illegal vehicle, its unique ID, vehicle type, and the accumulated illegal parking duration on the image, providing strong and visual evidence support for subsequent law enforcement work, to solve the problem of lack of intuitive and effective law enforcement evidence.
[0166] S300, the adaptive illegal parking detection method further comprises resource cleaning:
[0167] At the end of the task, the cleanup(task_id) method is called to release the DeepSort tracker associated with the task and the vehicle information of all vehicles. It should be noted that this step is to prevent memory leakage.
[0168] By introducing this multi-dimensional dynamic judgment logic, the technical solution of the present embodiment can more intelligently and accurately identify illegal parking behavior, significantly improving the practicality and reliability of the system.
[0169] Embodiment 2
[0170] Referring to Figure 5 , Figure 5 is a structural block diagram of an adaptive illegal parking detection system according to an embodiment of the present application. The adaptive illegal parking detection system mentioned in the present embodiment is used to execute the adaptive illegal parking detection method of embodiment 1, and specifically comprises a memory 100 and a processor 200 connected with the memory;
[0171] Among them, the memory 100 stores a computer program, a pre-trained YOLO target detection model, a DeepSort tracking model and a pre-configured rule configuration file;
[0172] The processor 200 is connected with the memory 100, and is used to implement the adaptive stop violation detection method of embodiment 1 when the computer program is executed, and realize the functions of the following units, including an initialization unit 201, a video image acquisition unit 202, a detection tracking unit 203, a state calculation unit 204, a multi-dimensional stop violation judgment and alarm unit 205, a result output unit 206 and a resource cleaning unit 207, wherein
[0173] The initialization unit 201 is coupled with the memory 100, and is used to load the YOLO target detection model, the DeepSort tracking model and the rule configuration file from the memory 100 when the adaptive stop violation detection system is started or a new task is started, and create and initialize an independent DeepSort tracking model and a vehicle information dictionary for each video stream task;
[0174] The video image acquisition unit 202 is used to acquire and receive real-time video streams from one or more sources, and decode the real-time video streams into continuous video frames, and send the real-time video streams to the detection tracking unit 203 for subsequent processing; wherein the real-time video streams come from a network camera 300 or other devices that can acquire real-time video streams.
[0175] The detection tracking unit 203 is coupled with the video image acquisition unit 202 and the initialization unit 201, and is used to receive video frames, and detect and regionally filter vehicle targets in the video frames by using the YOLO target detection model loaded by the initialization unit, and output detection results containing vehicle categories, bounding boxes and confidence; and perform multi-target tracking on the filtered detection results by using the DeepSort tracking model loaded by the initialization unit 201, and assign and continuously update a unique ID, a vehicle position (i.e. a bounding box of the tracked vehicle) and a vehicle category for each tracked vehicle;
[0176] The state calculation unit 204 is coupled with the detection tracking unit 203, and is used to receive vehicle detection results of the tracked vehicle, and maintain a position and a queue containing center point coordinates of a vehicle bounding box and corresponding time stamps of the tracked vehicle in real time, and calculate an average instantaneous speed and a cumulative parking time of the tracked vehicle based on changes in data in the queue;
[0177] The multi-dimensional stop violation judgment and alarm unit 205 is coupled with the state calculation unit 204 and the initialization unit 201, and is used to acquire an average instantaneous speed, a cumulative parking time and a vehicle category of the tracked vehicle, and query a dynamic parking time threshold that matches a current time period and the vehicle category from the rule configuration file loaded by the initialization unit 201 according to a current system time, and execute a multi-dimensional stop violation judgment logic, and generate alarm information containing a vehicle ID, a vehicle category, a parking time, a belonging time period and the like when an alarm condition is met, and send the alarm information to the outside.
[0178] The result output unit 206 is coupled with the detection and tracking unit 203 and the multi-dimensional illegal parking judgment and warning unit 205, and is used for receiving original video frames and judgment and warning results, and visualizing illegal parking analysis information including vehicle ID, category, state and time length on the video frames according to different colors according to whether the vehicle is illegally parked or not, and outputting visualized results with labeled information.
[0179] The resource cleaning unit 207 is coupled with the detection and tracking unit 203, the state calculation unit 204 and the multi-dimensional illegal parking judgment and warning unit 205, and is used for releasing tracking model instances and all vehicle information associated with the video analysis task when the task is ended or stopped, so as to recover system resources and prevent memory leakage.
[0180] Embodiment 3
[0181] In particular, according to the embodiments of the present application, the processes described in the above flowchart can be implemented as a computer software program.
[0182] The technical solutions of the present application or the parts of the technical solutions that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of a software product, and the computer software is stored in a storage medium, i.e., the embodiments of the present application also provide a computer readable storage medium including computer programs or computer instructions for making a computer device (which can be a personal computer, a server or a network device, etc.) or a processor execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes U disk, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and various program code storage media.
[0183] As can be seen from the above embodiments, the adaptive illegal parking detection method and system provided by the present application at least achieves the following beneficial effects:
[0184] 1. The method and system of the present embodiment have high accuracy and high robustness, YOLO is used as the core target detector, combined with the DeepSort tracking algorithm, the appearance features of the vehicle are used for re-identification, which greatly enhances the stability of tracking in complex scenes, and the overall detection accuracy is high, and the false negative and false positive rates are low.
[0185] 2. The method and system of the present embodiment are intelligent and automatic, the whole detection, tracking, analysis, judgment, warning and evidence generation process is completely automated and does not require human intervention, which greatly liberates human resources and improves the intelligent level of traffic management.
[0186] 3、The method of the embodiment adopts intelligent and multi-dimensional illegal parking judgment logic, which is the core advantage of the scheme. By establishing a comprehensive information file containing speed, type, and location history for each tracked vehicle, and combining a configurable dynamic rule engine, the method realizes accurate judgment far beyond a single time threshold. The system can dynamically adjust the tolerance of illegal parking according to whether it is peak hours or late at night, whether it is a bus or a private car, and whether the vehicle is completely stationary or slowly moving in congestion. This makes the alarm more humanized and reasonable, and can accurately adapt to complex urban traffic conditions, significantly reducing the false positive rate.
[0187] 4、The method and system of the embodiment have strong multi-target continuous tracking capability. By instantiating a separate DeepSort tracker for each camera task (task_id), the DeepSort algorithm assigns a unique and unchanged ID (ds_ids) across frames to each detected vehicle, which is the key to subsequent accurate analysis and timing.
[0188] 5、The method and system of the embodiment are low-cost and easy to deploy. The scheme is a pure software solution that can be directly deployed on the backend server of an existing video surveillance system, utilizing the existing camera hardware, saving a large amount of hardware procurement and maintenance costs.
[0189] 6、The method and system of the embodiment have visualization and can provide solid evidence. The system provides strong visualization capabilities, can draw detection boxes on the video screen in real time, and distinguish vehicle states with different colors. At the same time, the tracking ID, type, and dynamically updated parking time of the vehicle are labeled on the box. The output image information is intuitive and clear, and can be used as indisputable evidence for law enforcement.
[0190] Although some specific embodiments of the present application have been described in detail through examples, those skilled in the art should understand that the above examples are only for illustration, not for limiting the scope of the present application. Those skilled in the art should understand that the above embodiments can be modified without departing from the scope and spirit of the present application. The scope of the present application is defined by the appended claims.
Claims
1. An adaptive illegal parking detection method, characterized in that, include: System initialization: Load the pre-trained YOLO object detection model, which is trained on the COCO dataset; load the pre-configured rule configuration file, which includes rule configurations for at least four detection dimensions, including time period dimension, vehicle category dimension, speed threshold dimension, and dynamic parking duration threshold dimension. The rule configuration for the dynamic parking duration threshold dimension includes a matrix structure or nested structure constructed from the upper limit of illegal parking time for different time periods and different vehicle types. The first layer of the nested structure is the time period, the second layer is the vehicle category, and the third layer is the dynamic parking duration threshold; initialize the tracker, creating a DeepSort tracking model and a vehicle information dictionary for each video stream task. The DeepSort tracking model is trained on the re-identification dataset, and the vehicle information dictionary includes vehicle ID, start time, vehicle category, stationary duration, average instantaneous speed, and current position. For each frame of the input video stream, process it according to the following steps: Vehicle detection: The video frames are input into the YOLO object detection model for detection, and the vehicle detection results are output. The vehicle detection results include the vehicle's bounding box, confidence score, and vehicle category. The vehicle categories include cars, buses, and trucks. The process of inputting the video frames into the YOLO object detection model and outputting the vehicle detection results includes the following steps: Feature extraction and prediction: The video frame is input into the YOLO object detection model. The convolutional neural network inside the YOLO object detection model performs forward calculation to extract image features and predict the pre-selection detection results of the tracked vehicle. The pre-selection detection results include the candidate bounding box, confidence score and vehicle category of the tracked vehicle. Results filtering and optimization: Apply nonmaximum suppression algorithm to the candidate bounding boxes, merge overlapping predictions for the same vehicle, filter out low-confidence predictions, and output the vehicle detection results; Region filtering: Based on the preset no-parking zone polygon, calculate whether the bounding box of the vehicle coincides with the no-parking zone polygon, filter vehicles outside the no-parking zone, and output the filtering result, which includes vehicle category, vehicle bounding box, and confidence level. Multi-target tracking: The filtering results are passed to the DeepSort tracking model, which tracks the filtering results and outputs the vehicle ID and bounding box of the tracked vehicle. Vehicle status calculation: Iterate through each tracked vehicle and update the information of the tracked vehicle in the vehicle information object, including the following steps: Identification and Recording: For vehicles appearing for the first time, a vehicle information instance is created, and the start time of the first appearance of the vehicle and the vehicle category detected by the YOLO object detection model are recorded. Location history update: Store the current center point coordinates of the bounding box of the tracked vehicle and the corresponding timestamp into the location queue; Speed calculation: Based on the changes in the position and corresponding timestamp in the position queue, calculate the average instantaneous speed of the tracked vehicle, where the position is the coordinate of the center point of the vehicle's bounding box; Parking time calculation: When the average instantaneous speed of the tracked vehicle is not higher than the parking speed threshold, the tracked vehicle is determined to be stationary, and the stationary timer starts counting or continues to accumulate the parking time; when the average instantaneous speed of the tracked vehicle is higher than the parking speed threshold, the tracked vehicle is determined to be in motion, and the parking time corresponding to the tracked vehicle is reset. Multi-dimensional illegal parking judgment and alarm: Based on the parking duration calculation, the following judgment logic is executed: Traverse all stationary vehicles: Determine which tracked vehicles have an average instantaneous speed that is not higher than the stopping speed threshold; Determine the scenario: Obtain the current system time and determine the time period based on the configured rules; Obtain dynamic threshold: Query the corresponding dynamic parking duration threshold from the pre-configured rule configuration file, based on the time period and vehicle category; Triggering condition judgment: Obtain the cumulative parking time of the tracked vehicle. When the cumulative parking time is not less than the dynamic parking time threshold and the notification flag of the tracked vehicle is false, the alarm condition is met. Triggering actions: Set the global alarm flag to true; set the notification flag of the tracked vehicle to true; generate alarm information containing detailed scenarios and send it out, wherein the alarm information containing detailed scenarios includes vehicle ID, vehicle type, parking duration, and time period; Results visualization and output: The analysis results of illegal parking information are plotted on the original frame, wherein the illegal parking information includes vehicle ID, vehicle category, vehicle status, and illegal parking duration; Resource cleanup: When the task is completed, release the DeepSort tracking model associated with the task and the vehicle information of all vehicles.
2. The adaptive illegal parking detection method according to claim 1, characterized in that, The results visualization and output steps include: dynamically setting the boundary box color based on whether the vehicle is determined to be illegally parked, and drawing illegal parking information above the boundary box. The illegal parking information includes vehicle ID, vehicle category, vehicle status, and illegal parking duration.
3. The adaptive illegal parking detection method according to claim 1, characterized in that, The process of calculating whether the bounding box of the vehicle coincides with the polygon of the no-parking zone based on the preset no-parking zone polygon, filtering out vehicles outside the no-parking zone, and outputting the filtering result includes the following steps: Obtaining representative vehicle points: Iterate through each vehicle detection result output by the YOLO object detection model, and calculate the representative coordinate points of the tracked vehicle's position based on the bounding box coordinates. The bounding box coordinates are (x, y, w, h), where x is the x-coordinate of the top-left point of the bounding box, y is the y-coordinate of the top-left point of the bounding box, w is the width of the bounding box, and h is the height of the bounding box. The representative coordinate points of the tracked vehicle's position are the center point coordinates of the tracked vehicle's bounding box (x+w / 2, y+h / 2). Perform the determination that the representative coordinate point is within the no-stopping area polygon: For the representative coordinate point of the vehicle position of each tracked vehicle, apply the ray casting algorithm or the surround number algorithm to determine whether the representative coordinate point is located inside the no-stopping area polygon; Generate filtering results: If the result of determining whether the representative coordinate point is located inside the no-stopping area polygon is true, retain the vehicle detection result of the tracked vehicle; if the result of determining whether the representative coordinate point is located inside the no-stopping area polygon is false, discard the vehicle detection result of the tracked vehicle; output the set of all retained vehicle detection results of the tracked vehicle as the filtering result.
4. The adaptive illegal parking detection method according to claim 1, characterized in that, Based on the changes in the positions and corresponding timestamps in the location queue, the average instantaneous speed of the tracked vehicle is calculated, including the following steps: Data point extraction: In the location queue, extract two location data points of the same tracked vehicle that differ in time, including the current location point and the corresponding timestamp, and the historical location point and the corresponding timestamp; Pixel displacement calculation: Calculate the pixel displacement D of the current position point and historical position points in the two-dimensional image coordinate system of the video frame. pixel ; Real-world distance conversion: Applying a pre-calibrated pixel-to-meter scale S, the pixel displacement D is... pixel Converted to real-world physical distance D real ; Time difference calculation: Calculate the time difference Δt between the timestamps of the two location points; Speed value calculation: Calculate the average instantaneous speed V of the tracked vehicle according to the formula. V=D real / Δt。 5. An adaptive illegal parking detection system, characterized in that, Includes memory and processor; among which, The memory is used to store computer programs, pre-trained YOLO object detection models, DeepSort tracking models, and pre-configured rule configuration files; The processor, connected to the memory, is used to execute the computer program to implement the adaptive illegal parking detection method according to any one of claims 1-4. The processor includes an initialization unit, a video image acquisition unit, a detection and tracking unit, a state calculation unit, a multi-dimensional illegal parking judgment and alarm unit, a result output unit, and a resource cleanup unit. An initialization unit, coupled to the memory, is used to load the YOLO target detection model, the DeepSort tracking model, and the rule configuration file from the memory when the adaptive illegal parking detection system is started or a new task begins, and to create and initialize an independent DeepSort tracking model and the vehicle information dictionary for each video stream task; The video image acquisition unit is used to acquire and receive real-time video streams from at least one source, decode the real-time video streams into continuous video frames, and send them to the detection and tracking unit. The detection and tracking unit, coupled to the video image acquisition unit and the initialization unit, is used to receive the video frame, detect and filter vehicle targets in the video frame using the YOLO target detection model loaded by the initialization unit, and output vehicle detection results including vehicle category, bounding box, and confidence score; and use the DeepSort tracking model loaded by the initialization unit to perform multi-target tracking on the vehicle detection results detected and filtered by the YOLO target detection model, and assign and update the vehicle ID, bounding box, and vehicle category of each tracked vehicle. The state calculation unit, coupled to the detection and tracking unit, is used to receive the vehicle detection results of the tracked vehicle, maintain a position queue in real time including the center point coordinates of the vehicle's bounding box and the corresponding timestamp, and calculate the average instantaneous speed and cumulative parking time of the tracked vehicle based on the data changes in the position queue. A multi-dimensional illegal parking judgment and alarm unit is coupled to the state calculation unit and the initialization unit; it is used to obtain the average instantaneous speed, cumulative parking time and vehicle category of the tracked vehicle, and according to the current system time, query the dynamic parking time threshold that matches the current time period and vehicle category from the rule configuration file loaded by the initialization unit, execute the multi-dimensional illegal parking judgment logic, and when the alarm conditions are met, generate alarm information containing vehicle ID, vehicle category, parking time and time period and send it to the outside. The result output unit is coupled to the detection and tracking unit and the multi-dimensional illegal parking judgment and alarm unit; it is used to receive the original video frame and the alarm information judged by the multi-dimensional illegal parking judgment and alarm unit, and to visualize the illegal parking analysis information, including vehicle ID, vehicle category, vehicle status and illegal parking duration, on the video frame in different colors according to whether the tracked vehicle is illegally parked, and output the visualization result with annotation information. The resource cleanup unit, coupled to the detection and tracking unit, the state calculation unit, and the multi-dimensional illegal parking judgment and alarm unit, is used to release the tracking model instance and all vehicle information associated with the video analysis task when the video analysis task ends or is stopped.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program or computer instructions that can be loaded by a processor and executed by the adaptive illegal parking detection method according to any one of claims 1-4.
Citation Information
Patent Citations
Illegal parking detection method, device and equipment and storage medium
CN119380293A
Cited By
Non-motor vehicle illegal parking determination method and device for smart park, and medium
CN121527724A
Method and system for detecting abnormal road occupation along street based on dynamic patrol
CN121564664A
Dynamic patrol-based street abnormal occupation detection method and system
CN121564664B
Electric vehicle no-parking area supervision method and system
CN121982647A
False alarm suppression and repeated alarm elimination method and system for power transmission line engineering vehicle monitoring
CN122157173A