A traffic flow rapid counting method based on geomagnetic sensor and target detection
By using a geomagnetic sensor to trigger a camera to take pictures and combining it with a target detection algorithm, the problem of difficult target tracking and inaccurate counting in traffic flow statistics is solved, enabling fast and accurate traffic flow statistics and prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA SHIPBUILDING LINGJIU HIGH TECH (WUHAN) CO LTD
- Filing Date
- 2023-10-24
- Publication Date
- 2026-05-15
AI Technical Summary
Existing traffic flow statistics methods suffer from problems such as difficulty in target tracking and inaccurate sensor counting, especially when video surveillance is blurry and multiple vehicles pass by simultaneously using geomagnetic loops, which can easily lead to errors.
A geomagnetic sensor is used to trigger a camera to take pictures. A binary target classification algorithm is used to filter single-target images. A deep learning target detection algorithm is used to count multiple target images. Traffic flow is calculated by combining the number of camera triggers and a deep model is built for prediction.
It enables fast and accurate traffic flow statistics, reduces data processing complexity and equipment costs, improves detection speed and accuracy, and supports real-time monitoring and prediction of traffic flow.
Smart Images

Figure CN117523866B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent transportation technology, and in particular relates to a method for rapid traffic flow statistics based on geomagnetic sensors and target detection. Background Technology
[0002] In recent years, the continuous construction of my country's road network and the steady growth of car ownership have led to a rapid increase in transportation demand. Ensuring stable and smooth road traffic is paramount in road management. However, traffic congestion occurs frequently, significantly impacting traffic flow and safety. This places higher demands on traffic management departments' capabilities in road network operation management and emergency response. Therefore, traffic flow statistics and forecasting are crucial issues in traffic management and planning. They help traffic managers understand real-time traffic conditions and predict future traffic flow, thereby better planning and adjusting traffic flow to improve traffic efficiency and safety. Effective traffic flow statistics are a necessary condition for developing traffic congestion response strategies.
[0003] With the rapid expansion of my country's road network video surveillance, basic full coverage has been achieved. Therefore, utilizing surveillance video for vehicle monitoring can improve the level of intelligent traffic management. This involves collecting video stream data through surveillance cameras and using deep learning methods to detect and track vehicles, thereby achieving traffic flow statistics. However, target tracking faces several challenges: issues such as target loss, difficulty in detecting object boundaries, and inaccurate tracking results can arise when the target object is occluded, the background is cluttered, lighting changes, or the target object moves rapidly. Furthermore, surveillance video images are generally blurry and have low resolution, posing a significant challenge to traffic flow statistics.
[0004] In addition, the application of geomagnetic coils for vehicle triggering is also quite common, such as in parking lots and roadside parking spaces. However, there are still some problems with the vehicle data statistics of geomagnetic coils. For example, if multiple vehicles pass by simultaneously within a short time interval, the sensor may only trigger once, leading to counting errors. Figure 1 As shown in the diagram, the geomagnetic sensors, specifically the geomagnetic coil L, are arranged throughout the four lanes. If vehicles A and B pass the inductive coil almost simultaneously, the inductive coil will only undergo a change in inductance once in a very short time. Therefore, only the data of one vehicle can be collected, resulting in significant data errors.
[0005] Therefore, the current methods of counting road traffic flow still have problems such as difficulty in target tracking and inaccurate sensor counts. Summary of the Invention
[0006] In view of the above problems, the purpose of this invention is to provide a rapid traffic flow statistics method based on geomagnetic sensors and target detection, aiming to solve the technical problems of difficult target tracking and inaccurate sensor counting in existing traffic flow statistics methods.
[0007] The present invention adopts the following technical solution:
[0008] The method for rapid traffic flow statistics based on geomagnetic sensors and target detection includes the following steps:
[0009] Step S1: When the local magnetic sensor is triggered by a vehicle, it automatically triggers the camera to take pictures of the designated area and collects the pictures. The number of pictures is the number of times the camera is triggered.
[0010] Step S2: Use a target binary classification algorithm to classify and filter the collected images to obtain two classes: one with one or more vehicle targets in the image.
[0011] Step S3: For images with more than one target, the target detection algorithm is used to count the targets in the image, and the traffic flow data is calculated by combining the number of camera triggers.
[0012] Furthermore, the geomagnetic sensor is a geomagnetic coil, which is located at a designated position for the camera to capture images. When a vehicle passes over the geomagnetic coil, the camera is automatically triggered to take a picture.
[0013] Furthermore, in step S1, a statistical time period is set, and the images taken within each time period are categorized and collected.
[0014] Furthermore, in step S3, the target detection algorithm is a deep learning-based target detection algorithm.
[0015] Furthermore, the specific process of step S3 is as follows:
[0016] S31. For the j-th time period, the number of images with a target quantity greater than one is denoted as q. j The number of times the camera was triggered within the current time period is m. j We use an object detection algorithm to detect objects in these images and obtain the number of objects in each image, where the number of objects in the i-th image is n. ji The actual number of vehicles S in the j-th time period is obtained. j for:
[0017]
[0018] S32. Add up the actual number of vehicles calculated for each time period to obtain the traffic flow for the entire time period. Where k represents the total number of time periods included in the statistics.
[0019] Furthermore, the statistical method also includes the following steps:
[0020] Step S4: Construct a deep model prediction framework for predicting traffic flow.
[0021] The beneficial effects of this invention are:
[0022] This invention combines a geomagnetic sensor and a camera. The geomagnetic sensor detects passing vehicles, automatically triggering the camera to take a picture. For image processing, single-target images are filtered using binary image classification. For images with more than one target, deep learning is used for target detection to determine the number of vehicles in the image. The results are then corrected to obtain traffic flow data. This method eliminates the need for video stream processing and target tracking, requiring only image target recognition, significantly reducing processing complexity. Furthermore, by filtering out images with only one target through binary classification, the number of remaining images is significantly reduced, making target detection more lightweight and effectively improving detection speed for rapid querying.
[0023] This invention combines a geomagnetic sensor and a camera, and uses binary classification and target detection to obtain accurate traffic flow data with high processing efficiency. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of multiple vehicles passing by a geomagnetic sensor simultaneously.
[0025] Figure 2 This is a flowchart of a method for rapid traffic flow statistics based on geomagnetic sensors and target detection provided in an embodiment of the present invention;
[0026] Figure 3 This is a flowchart illustrating the implementation of step S2 in an embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram illustrating the process of constructing a deep model prediction framework for prediction.
[0028] Figure 5 This is a schematic diagram of a software interface for a practical application of the method of this embodiment of the invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0030] To illustrate the technical solution described in this invention, specific embodiments are described below.
[0031] like Figure 2 As shown, the rapid traffic flow statistics method based on geomagnetic sensors and target detection provided in this embodiment includes the following steps:
[0032] Step S1: When the local magnetic sensor is triggered by a vehicle, it automatically triggers the camera to take pictures of the designated area and collects the pictures. The number of pictures is the number of times the camera is triggered.
[0033] This step involves first embedding a geomagnetic sensor, which is a coil, along the roadway. The installation method is as follows: Figure 1 As shown, this ensures that when a vehicle passes over the inductive loop, the corresponding camera is triggered to take a picture. Then, a certain range in front of and behind the geomagnetic sensor is designated as the recognition area for the image.
[0034] As vehicles travel on the road, each time they pass a geomagnetic sensor, an induced current is generated, which automatically triggers the corresponding camera to capture an image. If the geomagnetic sensor is triggered m times within a given time period, m images will be obtained, which can then be processed for vehicle statistics.
[0035] Existing deep learning-based target tracking methods for counting vehicles require analyzing video streams to identify vehicles and track their trajectories. This often leads to problems such as target loss, difficulty in detecting object boundaries, and inaccurate tracking results, resulting in significant errors in traffic flow statistics. This new method, by embedding geomagnetic sensors, automatically triggers camera capture and counting based on the sensors' signals. This eliminates the need for video stream processing, reduces data processing complexity, and improves response time, indirectly lowering equipment development costs.
[0036] Step S2: Use a target binary classification algorithm to classify and filter the collected images to obtain two categories: those with one or more vehicle targets in the images.
[0037] like Figure 1 The diagram illustrates that when two vehicles, A and B, pass the geomagnetic sensor L almost simultaneously, the sensor L experiences only one inductance change within a very short time, triggering the camera only once and counting only once, leading to statistical errors. To address this issue, this invention uses a target detection algorithm to assist in calculating the actual number of vehicles. To reduce image processing complexity, this step first performs binary classification on the image.
[0038] There are currently various deep learning-based object detection algorithms that can identify the number of objects in an image. However, these algorithms process large amounts of data and are highly complex, significantly increasing the server load and reducing processing efficiency for massive image datasets. In reality, when a geomagnetic sensor detects a vehicle, it usually only detects one vehicle passing by. Therefore, most captured images only show one vehicle. To address this characteristic, [further analysis is needed]. Figure 3 As shown, this step uses a binary image classification method to classify the collected images, directly filtering out images with a target quantity of one, and then processing the remaining images. This reduces the amount of data processing and improves the response speed.
[0039] For binary image classification, the system determines whether the number of objects is greater than or equal to one. Before training the model, a dataset for training and testing needs to be prepared. The dataset should contain two classes of images: images with more than one object and images with one object. A ResNet34 network model is used to train the classification model for object classification. The complexity of binary image classification is much lower than that of object recognition in images.
[0040] Step S3: For images with more than one target, the target detection algorithm is used to count the targets in the image, and the traffic flow data is calculated by combining the number of camera triggers.
[0041] Assume a geomagnetic sensor is triggered m times, recording m images. After binary classification, q images contain more than one target. For these images, a deep learning-based target detection algorithm is selected to count the targets. Each image contains n targets, and there are mq images containing only one target. Specifically, the target count for each multi-target image is reduced by one, accumulated, and then added to m to obtain the traffic flow. This calculation method is simple and fast, with the main time cost being the target detection of the q images. Since q is generally much smaller than m, the overall processing speed is very fast and efficient.
[0042] To facilitate subsequent traffic flow statistics for different time periods and identify traffic flow characteristics within those periods, thus enabling later big data mining and utilization, this invention allows for setting statistical time periods. For example, a 24-hour day can be divided into multiple time periods, and the above method can be used to perform statistics for each time period. In step S1, the images taken within each time period need to be categorized and collected. This step is as follows:
[0043] S31. For the j-th time period, the number of images with a target quantity greater than one is denoted as q. j The number of times the camera was triggered within the current time period is m. jWe use an object detection algorithm to detect objects in these images and obtain the number of objects in each image, where the number of objects in the i-th image is n. ji The actual number of vehicles S in the j-th time period is obtained. j for:
[0044] S j =m j +(n j1 -1)+(n j2 -1)+...+(n ji -1)+...+(n jq -1)
[0045]
[0046] S32. Add up the actual number of vehicles calculated in each time period to obtain the traffic flow W for the entire time period.
[0047] First, divide W into k time periods, calculate the number of vehicles in each time period, and then sum them up. That is:
[0048] W = S1 + S2 + ... + S j +...+S k
[0049] Where k represents the total number of time periods included in the statistics.
[0050] This invention employs an object detection algorithm to assist in counting, and before object detection, it uses an object classification algorithm to perform image binary classification on the images captured by the camera. Due to the large detection model and large amount of data processing in traditional vehicle counting methods for object detection and tracking, the image data after image binary classification makes the subsequent object detection model lighter, effectively improving the detection speed and achieving the purpose of fast query.
[0051] Furthermore, as a preferred embodiment, the present invention further includes the following steps:
[0052] Step S4: Construct a deep model prediction framework for predicting traffic flow.
[0053] To more intuitively monitor and obtain traffic flow information, traffic flow can be predicted. Combined with... Figure 4 As shown, the collected traffic flow data is first sent to a message queue. Then, a deep model prediction architecture is built to predict traffic flow. The front-end webpage (Chrome) accesses the server via HTTP through an Nginx reverse proxy, receives data from the message queue, and returns it to the front-end webpage, where the relevant information can then be viewed.
[0054] A deep model prediction architecture combines Convolutional Neural Networks (CNNs) and Long Short-Term Memory (LSTM) networks for traffic flow prediction. The CNN captures local trends and features of traffic flow data, while the LSTM learns the short-term changes and long-term dependencies in the data. A feature fusion layer integrates different spatiotemporal features to improve prediction accuracy. Finally, a regression layer is used for traffic flow prediction. An attention mechanism can be incorporated into the deep model for traffic flow prediction to enhance the model's focus on key spatiotemporal locations.
[0055] like Figure 5 The diagram shows the application software interface of the method of this invention. The interface displays the locations of geomagnetic sensors and cameras within a certain road network, as well as the statistical and predicted traffic flow in both the up and down directions. It acquires the date of traffic flow data collection, the statistical and predicted numbers of various vehicle types (passenger cars, freight cars, special-purpose vehicles, and unknown vehicle types), and uses different colored numbers to represent the daily traffic flow and the predicted traffic flow based on that day's flow. Traffic flow data can be queried on this interface, and users can access and analyze the data as needed. This data can be used to optimize traffic flow, reduce congestion, and improve overall road safety. Furthermore, it can be integrated with other transportation systems, such as public transport timetables and traffic control systems, to provide a comprehensive view of traffic in a given area.
[0056] In summary, this invention uses a geomagnetic sensor and a camera to capture and count images, combined with image target detection, to complete traffic flow statistics. Due to issues such as incorrect counting triggered by the geomagnetic sensor and the excessively long detection time caused by large sample sizes in commonly used deep learning target detection algorithms, this invention first performs binary classification on the sample images. Based on the classification results, for images with more than one target, an target detection algorithm is used to obtain the target count, and this is combined with a statistical formula to calculate traffic flow. Finally, based on the obtained traffic flow data, a deep model prediction architecture incorporating an attention mechanism is used to predict traffic flow, thus obtaining traffic flow and prediction data.
[0057] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for rapid traffic flow statistics based on geomagnetic sensors and target detection, characterized in that, The statistical method includes the following steps: Step S1: When the local magnetic sensor is triggered by a vehicle, it automatically triggers the camera to take pictures of the designated area and collects the pictures. The number of pictures is the number of times the camera is triggered. Step S2: Use a target binary classification algorithm to classify and filter the collected images to obtain two classes: one with one or more vehicle targets in the image. Step S3: For images with more than one target, the target detection algorithm is used to count the targets in the image, and the traffic flow data is calculated by combining the number of camera triggers. In step S1, a statistical time period is set, and the images taken within each time period are categorized and collected. The specific process of step S3 is as follows: S31. For the j-th time period, the number of images with a target quantity greater than one is denoted as q. j The number of times the camera was triggered within the current time period is m. j We use an object detection algorithm to detect objects in these images and obtain the number of objects in each image, where the number of objects in the i-th image is n. ji The actual number of vehicles S in the j-th time period is obtained. j for: ; S32. Add up the actual number of vehicles calculated for each time period to obtain the traffic flow for the entire time period. , where k is the total number of time periods included in the statistics.
2. The method for rapid traffic flow statistics based on geomagnetic sensors and target detection as described in claim 1, characterized in that, The geomagnetic sensor is a geomagnetic coil, which is located at a designated position for the camera to capture images. When a vehicle passes over the geomagnetic coil, the camera is automatically triggered to take a picture.
3. The method for rapid traffic flow statistics based on geomagnetic sensors and target detection as described in claim 2, characterized in that, In step S3, the target detection algorithm is a deep learning-based target detection algorithm.
4. The method for rapid traffic flow statistics based on geomagnetic sensors and target detection as described in any one of claims 1-3, characterized in that, The statistical method also includes the following steps: Step S4: Construct a deep model prediction framework for predicting traffic flow.