Logistics park vehicle tracking and flow counting method and device, equipment and storage medium
By using a vehicle tracking and computing model based on the NanoDet network model in the logistics park, the problem of low operation efficiency of the logistics park during peak vehicles is solved, and efficient vehicle management and operation are achieved.
Patent Information
- Application Number
- CN202510151376.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-05-27
AI Technical Summary
The logistics park has low operating efficiency during peak vehicles, resulting in a sharp increase in road traffic pressure, a decrease in vehicle driving speed, and a decrease in operational efficiency.
The vehicle tracking calculation model based on the NanoDet network model is adopted, and animated image data of the logistics park vehicles is obtained and marked, and an accurate vehicle tracking calculation model is trained. This model can generate vehicle position and type information in real time, and generate the vehicle's driving trajectory and count the park's vehicle traffic through the target tracking algorithm.
Real-time tracking and traffic statistics of vehicles in the logistics park are realized, and the vehicle situation can be monitored in a timely manner, dispatched vehicles, avoid congestion, and improve the operational efficiency of the logistics park.
Smart Images

Figure CN120047906A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of logistics park management, and in particular to a logistics park vehicle tracking and flow counting method, device, equipment and storage medium. Background Art
[0002] In today's rapidly developing logistics industry, logistics parks play a vital role as the core hub for the centralized storage, sorting and distribution of goods. However, in the daily operation of logistics parks, many drawbacks have gradually been exposed in vehicle management, which has brought serious challenges to the entire logistics operation. With the vigorous development of e-commerce and the growing demand for logistics services, the number of vehicles entering and leaving logistics parks has shown a sharp upward trend. Every day, logistics parks need to handle a large number of vehicles from different suppliers, carriers and express companies, including large freight trucks, small vans, forklifts and other types of transportation tools. The gathering of these vehicles in the park has formed a huge traffic flow. During peak hours, vehicles enter and exit the park intensively, causing a sharp increase in traffic pressure on the internal roads and gates of the park. For example, in some large comprehensive logistics parks, the frequency of vehicles entering and exiting can reach thousands of times a day, and during holidays or shopping seasons, this number may increase exponentially. A large number of vehicles have poured into the park roads, making road resources very tight, and the vehicle driving speed has dropped significantly. Logistics vehicles that were originally able to operate efficiently often fall into congestion.
[0003] It can be seen that the existing technology still needs to be improved and enhanced. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a logistics park vehicle tracking and flow counting method, device, equipment and storage medium, aiming to solve the technical problem of low operating efficiency of logistics parks during vehicle peak hours in the prior art.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] The first aspect of the present invention provides a method for tracking and counting vehicles in a logistics park, comprising the following steps: obtaining image data of vehicles in the logistics park and annotating them, preprocessing the annotated image data to obtain an image data set; constructing a basic model based on the NanoDet network model, improving the basic model using a data enhancement method to obtain a preliminary model, and training the preliminary model using an image data set to obtain a vehicle tracking calculation model; obtaining real-time image data, using a vehicle tracking calculation model, and generating vehicle position and vehicle type information based on the real-time image data; using a target tracking algorithm, generating a vehicle driving trajectory based on the vehicle position and vehicle type information, and performing statistics on vehicles in the logistics park.
[0008] Optionally, in a first implementation method of the first aspect of the present invention, the image data of vehicles in a logistics park are acquired and annotated, and the annotated image data are preprocessed to obtain an image data set, specifically including: acquiring image data of vehicles in a logistics park, and using an annotation tool to annotate the vehicle type in the image data; using a coordinate system to annotate the vehicle position in the image data; and preprocessing the annotated image data to obtain an image data set.
[0009] Optionally, in a second implementation method of the first aspect of the present invention, the preprocessing of the annotated image data to obtain an image data set specifically includes: scaling the annotated image data at different ratios to obtain scaled data; rotating the annotated image data at different angles to obtain multi-angle data; horizontally flipping and vertically flipping the annotated image data to obtain flipped data; performing image brightness adjustment, contrast adjustment, and color saturation adjustment on the annotated image data for multiple times to obtain simulated lighting data; and merging the scaled data, multi-angle data, flipped data, and simulated lighting data to obtain an image data set.
[0010] Optionally, in a third implementation method of the first aspect of the present invention, the basic model based on the NanoDet network model is constructed, the basic model is improved by a data enhancement method to obtain a preliminary model, and the preliminary model is trained by an image data set to obtain a vehicle tracking calculation model, specifically including: constructing a backbone network, a feature pyramid network and a detection head, connecting and configuring the backbone network, the feature pyramid network and the detection head to construct a basic model based on the NanoDet network model, setting the learning rate, batch size and number of iterations of the basic model; improving the basic model by RandCrop and Mixupk data enhancement methods to obtain a preliminary model; and training the preliminary model by an image data set to obtain a vehicle tracking calculation model.
[0011] Optionally, in a fourth implementation method of the first aspect of the present invention, the image dataset is used to train the preliminary model to obtain a vehicle tracking calculation model, specifically including: dividing the image dataset into multiple batches, inputting them into the preliminary model for training in sequence, and using the preliminary model to make preliminary predictions about the vehicle type and location; calculating the difference between the preliminary prediction results and the annotations to obtain a loss value; using a back-propagation algorithm to back-propagate the loss value back to the preliminary model to calculate gradient information, and based on the gradient information, using an optimizer to update and adjust the parameters of the preliminary model, and iterating repeatedly to obtain a vehicle tracking calculation model that meets the requirements.
[0012] Optionally, in a fifth implementation of the first aspect of the present invention, the target tracking algorithm is used to generate a vehicle's driving trajectory based on the vehicle position and vehicle type information and to perform statistics on the vehicles in the logistics park, specifically including: using a Kalman filter algorithm to predict the vehicle's motion state based on the vehicle's position, so as to predict the possible position range of the vehicle in the next frame of the image, and obtain position prediction data; using a Hungarian algorithm to match the same vehicle in the previous and next frames of the image based on the position prediction data, and generating a driving trajectory based on the matching results; and counting the flow of vehicles in the logistics park based on the vehicle type information, and matching the vehicle's driving trajectory and flow conditions with pre-established dispatching rules to obtain a scheduling plan.
[0013] Optionally, in a sixth implementation method of the first aspect of the present invention, the flow conditions of vehicles in the logistics park are counted according to the vehicle type information, and the vehicle's driving trajectory and flow conditions are matched with pre-established dispatching rules to obtain a scheduling plan, which specifically includes: formulating dispatching rules, setting a flow warning value for the logistics park, and setting multiple guided driving routes according to the flow warning value, and setting an abnormal situation handling plan; the flow conditions of vehicles in the logistics park are counted according to the vehicle type information, and if the vehicle flow conditions in the logistics park reach the flow warning value, the guided driving route is output to the vehicle drivers in the park according to the dispatching rules; whether congestion and abnormality occur according to the vehicle's driving trajectory, and if so, the guided driving route is output to the vehicle drivers in the park according to the dispatching rules, and the abnormal situation handling plan is output to the logistics park managers.
[0014] The second aspect of the present invention provides a logistics park vehicle detection, tracking and flow counting device, including: a data acquisition module, used to acquire and annotate image data of logistics park vehicles, and preprocess the annotated image data to obtain an image data set; a construction module, used to construct a basic model based on the NanoDet network model, improve the basic model using a data enhancement method to obtain a preliminary model, and train the preliminary model using an image data set to obtain a vehicle tracking calculation model; a generation module, used to acquire real-time image data, use a vehicle tracking calculation model, and generate vehicle position and vehicle type information based on the real-time image data; a statistical module, used to use a target tracking algorithm to generate a vehicle's driving trajectory based on the vehicle position and vehicle type information and to perform statistics on logistics park vehicles.
[0015] Optionally, in a first implementation method of the second aspect of the present invention, the data acquisition module includes: a vehicle labeling unit, used to acquire image data of vehicles in a logistics park, and use a labeling tool to label the vehicle type in the image data; a coordinate labeling unit, used to use a coordinate system to label the vehicle position in the image data; and a preprocessing unit, used to preprocess the labeled image data to obtain an image data set.
[0016] Optionally, in a second implementation method of the second aspect of the present invention, the preprocessing unit includes: a scaling subunit, used to scale the annotated image data according to different proportions to obtain scaled data; a rotation subunit, used to rotate the annotated image data at different angles to obtain multi-angle data; a flipping subunit, used to flip the annotated image data horizontally and vertically to obtain flipped data; an adjustment subunit, used to perform image brightness adjustment, contrast adjustment, and color saturation adjustment on the annotated image data for multiple times to obtain simulated lighting data; and a merging subunit, used to merge the scaled data, multi-angle data, flipped data, and simulated lighting data to obtain an image data set.
[0017] Optionally, in a third implementation of the second aspect of the present invention, the construction module includes: a construction unit, used to construct a backbone network, a feature pyramid network and a detection head, connect and configure the backbone network, the feature pyramid network and the detection head to construct a basic model based on the NanoDet network model, and set the learning rate, batch size and number of iterations of the basic model; an improvement unit, used to improve the basic model using RandCrop and Mixupk data enhancement methods to obtain a preliminary model; a training unit, used to train the preliminary model using an image data set to obtain a vehicle tracking calculation model.
[0018] Optionally, in a fourth implementation of the second aspect of the present invention, the training unit includes: a division subunit, used to divide the image data set into multiple batches, and input them into the preliminary model in sequence for training, using the preliminary model to make preliminary predictions on the vehicle type and location; a calculation subunit, used to calculate the difference between the preliminary prediction results and the annotations to obtain a loss value; an iteration subunit, used to use a back-propagation algorithm to back-propagate the loss value back to the preliminary model to calculate gradient information, and based on the gradient information, use an optimizer to update and adjust the parameters of the preliminary model, and iterate repeatedly to obtain a vehicle tracking calculation model that meets the requirements.
[0019] Optionally, in a fifth implementation of the second aspect of the present invention, the statistical module includes: a prediction unit, which is used to adopt a Kalman filter algorithm to predict the motion state of the vehicle according to the vehicle position, so as to predict the position range where the vehicle may appear in the next frame of the image, and obtain position prediction data; a matching unit, which is used to adopt a Hungarian algorithm to match the same vehicle in the previous and next frames of the image according to the position prediction data, and generate a driving trajectory according to the matching result; a statistical unit, which is used to count the flow of vehicles in the logistics park according to the vehicle type information, and match the vehicle's driving trajectory and flow conditions with pre-established allocation rules to obtain a scheduling plan.
[0020] Optionally, in a sixth implementation of the second aspect of the present invention, the statistical unit includes: a formulation subunit, used to formulate dispatching rules, set a flow warning value for the logistics park, and set multiple guided driving routes according to the flow warning value, and set an abnormal situation handling plan; a warning subunit, used to count the flow conditions of vehicles in the logistics park according to vehicle type information, if the vehicle flow conditions in the logistics park reach the flow warning value, output the guided driving route to the vehicle drivers in the park according to the dispatching rules; a judgment subunit, used to judge whether congestion and abnormalities occur according to the vehicle's driving trajectory, and if so, output the guided driving route to the vehicle drivers in the park according to the dispatching rules, and output the abnormal situation handling plan to the logistics park managers.
[0021] The third aspect of the present invention provides a logistics park vehicle detection, tracking and flow counting device, comprising a memory and at least one processor, wherein the memory stores computer-readable instructions; the at least one processor calls the computer-readable instructions in the memory to execute the various steps of the logistics park vehicle tracking and flow counting method as described above.
[0022] A fourth aspect of the present invention provides a computer-readable storage medium having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by a processor, implement the various steps of the logistics park vehicle tracking and flow counting method as described above.
[0023] Beneficial effect: The present invention provides a method for tracking and counting vehicles in a logistics park. The method first obtains image data of vehicles in the logistics park and annotates them to obtain an image data set for model training. Then, the image data set is used to train a basic model based on the NanoDet network model and improved to obtain a vehicle tracking calculation model with high accuracy. The vehicle tracking calculation model then generates vehicle location and vehicle type information according to real-time image data, and uses a target tracking algorithm to further generate the vehicle's driving trajectory and count the vehicle flow in the park, thereby enabling real-time monitoring of the overall vehicle situation in the logistics park, allowing logistics park managers to fully understand the vehicle situation in the logistics park, and to make timely dispatches when congestion or other abnormal situations occur, to ensure efficient operation of the logistics park. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A first flow chart of a method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0025] Figure 2 A second flow chart of the method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0026] Figure 3 A third flow chart of the method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0027] Figure 4 A fourth flow chart of the method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0028] Figure 5 A fifth flow chart of the method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0029] Figure 6 A sixth flow chart of the method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0030] Figure 7 A seventh flow chart of the method for tracking and counting vehicles in a logistics park provided by an embodiment of the present invention;
[0031] Figure 8 A schematic diagram of the structure of a vehicle tracking and flow counting device for a logistics park provided by an embodiment of the present invention;
[0032] Fig. 9 Another structural schematic diagram of a logistics park vehicle tracking and flow counting device provided by an embodiment of the present invention;
[0033] Fig.10A schematic diagram of the structure of a logistics park vehicle tracking and flow counting device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The present invention provides a method, device, equipment and storage medium for tracking and counting vehicles in a logistics park. The present invention first obtains image data of vehicles in the logistics park and marks them, pre-processes the marked image data to obtain an image data set, provides sufficient and effective data for model training, and makes the model training effect better; then builds a basic model based on a NanoDet network model, adopts a data enhancement method to improve the basic model, thereby improving the accuracy of the model, obtains a preliminary model, and trains the preliminary model with an image data set to obtain a vehicle tracking calculation model; then adopts the trained vehicle tracking calculation model to generate vehicle position and vehicle type information according to real-time image data; finally, adopts a target tracking algorithm to generate a vehicle driving trajectory according to the vehicle position and vehicle type information and counts the vehicles in the logistics park, so as to monitor the conditions of each vehicle in the logistics park in real time and effectively monitor the flow of the logistics park, so that management personnel can perform more effective scheduling for special situations and maintain the efficient operation of the logistics park.
[0035] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0036] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 The first embodiment of the method for tracking and counting vehicles in a logistics park in the embodiment of the present invention includes:
[0037] S101. Obtain image data of vehicles in the logistics park and annotate them, and preprocess the annotated image data to obtain an image data set;
[0038] When acquiring image data, it can be achieved by installing multiple image acquisition devices in the logistics park. When installing an image acquisition device, it is necessary to set the position and angle of the image acquisition device to ensure that all areas of the logistics park can be fully covered, including entrances, exits, parking lots, loading and unloading areas, etc. By installing multiple high-definition cameras, images of vehicles can be captured from different perspectives. In addition, it is also necessary to pay attention to setting the time interval for image acquisition to ensure that vehicle images in different time periods can be acquired, including peak and off-peak periods. Images can be collected every few minutes or seconds. Image acquisition under different weather conditions also needs to be considered, such as collecting image data on sunny days, cloudy days, rainy days, snowy days, etc., to ensure that the model can adapt to various environments.
[0039] S102. Construct a basic model based on the NanoDet network model, improve the basic model using a data enhancement method to obtain a preliminary model, and train the preliminary model using an image dataset to obtain a vehicle tracking calculation model;
[0040] NanoDet uses advanced network architecture and design concepts, such as improved backbone network and feature fusion methods. These designs help the model to better extract features from images, locate and identify vehicle targets more accurately, and provide a good foundation for subsequent vehicle tracking. Through data enhancement technology, the diversity of data can be increased, thereby improving the generalization ability of the model.
[0041] S103 obtains real-time image data, uses a vehicle tracking calculation model, and generates vehicle position and vehicle type information based on real-time image data;
[0042] By using the vehicle tracking calculation model to generate vehicle location and vehicle type information based on real-time image data, each vehicle in the logistics park can be quickly and accurately located, and the vehicle type can be quickly distinguished, making subsequent vehicle tracking and statistics more efficient. For example, when multiple vehicles appear in real-time image data, the vehicle tracking calculation model will automatically identify the type of vehicle and mark it, and will continuously mark the location where the vehicle appears in the real-time image data, that is, each frame of the image will be marked.
[0043] Specifically, after receiving the real-time image, the model goes through a series of internal convolutions, feature fusions, and prediction calculations, and outputs information about the vehicle's location and type in the form of bounding box coordinates. For example, the model outputs the vehicle's upper left corner horizontal coordinate, vertical coordinate, lower right corner horizontal coordinate, vertical coordinate, and vehicle type information in the image. The possibility of each type of vehicle is expressed in the form of probability, and the category with the highest probability is taken as the predicted vehicle type, thereby providing basic data for subsequent vehicle tracking and traffic counting.
[0044] S104. Use a target tracking algorithm to generate a vehicle's driving trajectory based on the vehicle's location and vehicle type information and to collect statistics on the vehicles in the logistics park.
[0045] Specifically, whenever the center of a vehicle's bounding box crosses the detection line or enters the counting area, the vehicle type information output by the model is classified and counted, and the number of vehicles of different types passing through is recorded. At the same time, combined with the time information, the flow of various types of vehicles per unit time is calculated, such as the number of cars and trucks passing through per hour, etc., to provide accurate data for understanding the traffic flow dynamics in the park. On the logistics management system side, after receiving this data, it is stored in the corresponding database table according to the pre-set data storage structure and format for subsequent query and analysis. The system can analyze the traffic congestion in various areas of the park based on the real-time tracking trajectory and flow information of the vehicle.
[0046] See also Figure 2 The second embodiment of the method for tracking and counting vehicles in a logistics park according to the present invention includes:
[0047] S201. Obtain image data of vehicles in the logistics park, and use annotation tools to annotate the vehicle type in the image data;
[0048] Specifically, you can select annotation tools such as LabelImg, VGG Image Annotator, etc. to annotate vehicle types. You can classify vehicle types in detail, such as vans, trucks, trailers, cars, motorcycles, etc. At the same time, you can further subdivide the brand, model and other information of the vehicle to improve the accuracy of the model. By classifying the vehicles in detail, the tracking accuracy of each vehicle can be improved during subsequent tracking and recording. When there is a need to review the records later, you can accurately track them according to the records formed by the model and review the corresponding image data.
[0049] S202. Using a coordinate system, marking the vehicle position in the image data;
[0050] Specifically, a Cartesian coordinate system can be used. Before annotation, the actual distance represented by each pixel in the image needs to be determined to ensure the accuracy of the actual coordinates of the annotation. According to the shape and structure of the vehicle, select some representative key points to determine the vehicle position, such as the four corners of the vehicle, the center of the front and rear of the vehicle, etc. The annotation tool clicks the corresponding position on the image to mark the key points of the vehicle. The tool automatically records the coordinate information of each key point.
[0051] S203. Preprocess the labeled image data to obtain an image data set.
[0052] By preprocessing image data, data stability can be enhanced, the training efficiency of subsequent models can be improved, and model performance can be improved.
[0053] See also Figure 3 The third embodiment of the method for tracking and counting vehicles in a logistics park in the embodiment of the present invention includes:
[0054] S301. Scaling the annotated image data at different ratios to obtain scaled data;
[0055] Specifically, different scaling ratios can be used, such as reducing the size to 50%, 75%, etc. of the original size, and enlarging the size to 150%, 200%, etc., so that the model can learn vehicle features at different scales and enhance its generalization ability;
[0056] S302. Rotate the annotated image data at different angles to obtain multi-angle data;
[0057] Randomly rotating the image by a certain angle, such as 30 degrees, 60 degrees, 90 degrees, etc., helps the model learn the appearance of the vehicle at different angles and improve its adaptability to different shooting angles.
[0058] S303. Perform horizontal and vertical flipping on the annotated image data to obtain flipped data;
[0059] Flipping the image data horizontally and vertically can also increase the diversity of the data and allow the model to learn symmetrical vehicle features.
[0060] S304. Performing multiple adjustments to the image brightness, contrast, and color saturation on the annotated image data to obtain simulated illumination data;
[0061] By simulating image data under different lighting conditions, the adaptability of subsequent models to different scenarios can be improved.
[0062] S305. Combine the scaling data, multi-angle data, flip data and simulated illumination data to obtain an image data set.
[0063] See also Figure 4 The fourth embodiment of the method for tracking and counting vehicles in a logistics park in the embodiment of the present invention includes:
[0064] S401. Build a backbone network, a feature pyramid network, and a detection head, connect and configure the backbone network, the feature pyramid network, and the detection head to build a basic model based on the NanoDet network model, and set the learning rate, batch size, and number of iterations of the basic model;
[0065] NanoDet network usually includes backbone network (used to extract image features, lightweight convolutional neural network architecture such as ShuffleNet can be used), feature pyramid network (FPN, used to fuse feature information of different scales to better detect vehicle targets of different sizes) and detection head (used to output target category prediction and location information) and other main modules. According to its standard network structure design, each module is constructed in turn, and they are reasonably connected and configured to build a complete NanoDet network framework.
[0066] Specifically, NanoDet can be used as the framework, and ShuffleNetV2 can be used as the backbone skeleton network. The 8x, 16x, and 32x downsampled feature layers can be input into the PAN network structure for multi-scale feature fusion, and the fused features can be used for target classification calculation. The algorithm of the basic model adds an attention mechanism global relationship perception attention module between PAN and backbone, and performs attention calculation on the backbone downsampled feature data. The use of global relationship attention helps to strengthen the separation of image foreground and background, thereby reducing the impact of background image features on target classification. The key point of the attention mechanism is to use the mutual correlation between spatial feature points and channels to generate a relationship matrix, and on this basis generate an attention coefficient. The attention mechanism model is divided into spatial attention and channel attention. The channel attention calculation method is similar to that of spatial attention. The difference is that the spatial attention mechanism calculates the affinity between points, and the channel attention calculates the affinity between different channels.
[0067] The steps for generating the spatial attention mechanism are as follows: (1) Input the input feature tensor into two convolutional layers for convolution operations, and adjust the output size of the intermediate feature matrix template to (H×W)×C and C×(H×W) respectively. Since the algorithm not only pays attention to the relationship information between feature points, but also pays attention to the information of the image features itself, it is also necessary to consider retaining the feature map information of the image and integrating it into the calculation process. Therefore, while the two convolutional layers are operating, the feature tensor is max-pooled to retain the global significant feature information. (2) Multiply the two matrices in the previous step to obtain a (H×W)×(H×W) matrix, which represents the affinity relationship between each feature point in the space. (3) Reshape the affinity matrix and concatenate it with the max-pooled feature map. (4) Convolve the concatenated feature tensor to obtain a spatial attention coefficient template, which contains multiple attention coefficients.
[0068] S402. Improve the basic model using RandCrop and Mixupk data enhancement methods to obtain a preliminary model;
[0069] RandCrop can randomly crop part of the image and then resize it to a fixed size to input into the model. This allows the model to learn the characteristics of vehicles in different local areas and improve the robustness to partial occlusion and different perspectives. Mixupk is a more powerful data enhancement method that can linearly combine multiple images to generate new images. The intensity of data enhancement can be controlled by adjusting the parameters of Mixupk, such as the mixing ratio, the number of mixed images, etc. In addition to RandCrop and Mixupk, other data enhancement techniques can also be considered, such as random erasing, Cutout, CutMix, etc. These techniques can further increase the diversity of data and improve the generalization ability of the model.
[0070] S403. Use the image data set to train the preliminary model to obtain a vehicle tracking calculation model.
[0071] See also Figure 5 The fifth embodiment of the method for tracking and counting vehicles in a logistics park in the embodiment of the present invention includes:
[0072] S501. Divide the image data set into multiple batches, input them into the preliminary model for training, and use the preliminary model to make preliminary predictions on the vehicle type and location;
[0073] The image dataset is divided into multiple batches, which are fed into the model for training in sequence, and then the parameters of the model are updated using stochastic gradient descent (SGD) or other optimization algorithms.
[0074] The preprocessed image data is divided into training set, validation set and test set in a certain proportion to ensure that the training set contains enough vehicle image samples of different types and scenarios for model parameter learning and optimization; the validation set is used to regularly evaluate the performance of the model during the training process to help adjust the training strategy and hyperparameters; the test set is used to objectively evaluate the generalization ability and actual recognition effect of the model after the model training is completed.
[0075] S502. Calculate the difference between the preliminary prediction result and the annotation to obtain a loss value;
[0076] S503. Use the back propagation algorithm to back propagate the loss value back to the preliminary model to calculate the gradient information. According to the gradient information, use the optimizer to update and adjust the parameters of the preliminary model, and iterate repeatedly to obtain a vehicle tracking calculation model that meets the requirements.
[0077] Monitor indicators such as loss function and accuracy during training so as to adjust the training strategy in time. If the model is found to be overfitting, regularization, early stopping and other measures can be taken to prevent overfitting. Use technologies such as data parallelism or model parallelism to speed up the model training process. If computing resources are limited, consider using a distributed training framework:
[0078] Such as PyTorch DistributedDataParallel or TensorFlow Distributed Strategies.
[0079] Specifically, in each iterative training, a batch of image samples are first input into the network, and the model's predicted output for vehicle type and location is obtained through forward propagation calculation. Then, according to the difference between the predicted result and the true labeled label, the loss value is calculated using an appropriate loss function. Next, the loss value is back-propagated back to each layer of the network through the back-propagation algorithm, and the parameters of the network are updated and adjusted using the optimizer based on the calculated gradient information. This process is repeated until the set number of iterations is reached or the performance indicators of the model on the validation set reach a satisfactory convergence state.
[0080] See also Figure 6 The sixth embodiment of the method for tracking and counting vehicles in a logistics park according to the embodiment of the present invention includes:
[0081] S601. Using the Kalman filter algorithm, the motion state of the vehicle is predicted according to the vehicle position to predict the possible position range of the vehicle in the next frame of the image and obtain the position prediction data;
[0082] S602. Using the Hungarian algorithm, the same vehicle in the previous and next frames of the image is matched according to the position prediction data, and a driving trajectory is generated according to the matching results;
[0083] The target tracking algorithm based on the combination of Kalman filter and Hungarian algorithm is adopted. The vehicle position information output by the model is used to match and associate the same vehicle in continuous video frames. The vehicle's motion state is predicted by Kalman filter, and its possible position range in the next frame is estimated. Then, the vehicle targets in the previous and next frames are accurately matched according to the similarity of vehicle positions and other indicators by combining the Hungarian algorithm, so as to realize the real-time tracking of each vehicle's driving trajectory in the park and understand its movement route and stop position. Virtual detection lines or counting areas are set at the key entrance and exit positions or specific monitoring areas of the park. Whenever the center of a vehicle's bounding box crosses the detection line or enters the counting area, the vehicle type information output by the model is classified and counted, and the number of vehicles of different types passing through is recorded. At the same time, combined with time information, the flow of various types of vehicles per unit time is calculated, such as the number of cars and trucks passing through per hour, etc., to provide accurate data for mastering the traffic flow dynamics in the park.
[0084] S603. Calculate the traffic flow of vehicles in the logistics park based on the vehicle type information, match the vehicle's driving trajectory and traffic flow with the pre-established dispatching rules to obtain a dispatch plan.
[0085] See also Figure 7 The seventh embodiment of the method for tracking and counting vehicles in a logistics park in the embodiment of the present invention includes:
[0086] S701. Formulate deployment rules, set the flow warning value of the logistics park, set multiple guided driving routes according to the flow warning value, and set abnormal situation handling plans;
[0087] By setting guided driving routes in advance, vehicles entering and leaving the logistics park can be guided to avoid congested sections in an orderly manner according to different abnormal situations, thereby improving logistics transportation efficiency.
[0088] S702. Statistics on the flow of vehicles in the logistics park are calculated based on the vehicle type information. If the vehicle flow in the logistics park reaches the flow warning value, the driving route is guided to the vehicle driver in the park according to the dispatching rules;
[0089] When there are too many vehicles in the logistics park, it will cause traffic congestion and slow traffic, especially when too many vehicles are concentrated at the entrances and exits of individual parks. At this time, vehicles can be guided to other entrances and exits with low traffic according to the vehicle flow situation.
[0090] In addition, when the overall traffic volume in the logistics park is too high, it may even cause congestion at the entrances and exits. According to the preset dispatching rules, new vehicles can be temporarily suspended from entering the logistics park, and waiting vehicles can be guided to the designated waiting area to avoid congestion on the roads around the logistics park.
[0091] S703. Determine whether congestion and abnormality occur based on the vehicle's driving trajectory. If so, output a guiding route to the vehicle drivers in the park based on the dispatching rules, and output an abnormal situation handling plan to the logistics park management personnel.
[0092] The trajectory information obtained by real-time vehicle tracking and the statistical results of traffic counts can be transmitted to the logistics management system in real time through the network communication interface. On the logistics management system side, after receiving these data, they are stored in the corresponding database table according to the pre-set data storage structure and format, which is convenient for subsequent query and analysis. The system analyzes the traffic congestion in various areas of the park based on the real-time tracking trajectory and traffic information of the vehicle. For congested sections, the vehicle dispatch plan can be adjusted in time to guide new vehicles entering the park to avoid congested areas and choose a smoother route to the destination, thereby improving logistics transportation efficiency. At the same time, through real-time monitoring of vehicle traffic, abnormal vehicle gathering or illegal driving can be discovered, and alarms can be issued in time and corresponding safety measures can be taken, such as notifying security personnel to check and direct traffic diversion, thereby improving the operational safety of the entire logistics park.
[0093] The above describes the method for tracking and counting vehicles in a logistics park according to an embodiment of the present invention. The following describes the device for tracking and counting vehicles in a logistics park according to an embodiment of the present invention. Figure 8 In one embodiment of the present invention, a vehicle tracking and flow counting device for a logistics park includes:
[0094] The data acquisition module 10 is used to acquire and annotate the image data of the vehicles in the logistics park, and pre-process the annotated image data to obtain an image data set;
[0095] A construction module 20 is used to construct a basic model based on the NanoDet network model, improve the basic model using a data enhancement method to obtain a preliminary model, and train the preliminary model using an image data set to obtain a vehicle tracking calculation model;
[0096] A generating module 30 is used to obtain real-time image data, and use a vehicle tracking calculation model to generate vehicle position and vehicle type information according to the real-time image data;
[0097] The statistics module 40 is used to generate the vehicle's driving trajectory and to collect statistics on the vehicles in the logistics park based on the vehicle's position and vehicle type information by using a target tracking algorithm.
[0098] See also Fig. 9 In one embodiment of the present invention, a vehicle tracking and flow counting device for a logistics park includes:
[0099] The data acquisition module 10 is used to acquire and annotate the image data of the vehicles in the logistics park, and pre-process the annotated image data to obtain an image data set;
[0100] A construction module 20 is used to construct a basic model based on the NanoDet network model, improve the basic model using a data enhancement method to obtain a preliminary model, and train the preliminary model using an image data set to obtain a vehicle tracking calculation model;
[0101] A generating module 30 is used to obtain real-time image data, and use a vehicle tracking calculation model to generate vehicle position and vehicle type information according to the real-time image data;
[0102] A statistics module 40 is used to generate a vehicle driving trajectory and to count the vehicles in the logistics park based on the vehicle position and vehicle type information by using a target tracking algorithm;
[0103] In this embodiment, the data acquisition module 10 includes:
[0104] The vehicle labeling unit 11 is used to obtain image data of vehicles in the logistics park and label the vehicle type in the image data using a labeling tool;
[0105] A coordinate marking unit 12, used to mark the vehicle position in the image data using a coordinate system;
[0106] A preprocessing unit 13, used for preprocessing the labeled image data to obtain an image data set;
[0107] In this embodiment, the preprocessing unit 13 includes:
[0108] The scaling subunit 131 is used to scale the annotated image data according to different proportions to obtain scaled data;
[0109] A rotation subunit 132, used to rotate the annotated image data at different angles to obtain multi-angle data;
[0110] A flip subunit 133, used to flip the labeled image data horizontally and vertically to obtain flipped data;
[0111] An adjustment subunit 134 is used to perform image brightness adjustment, contrast adjustment, and color saturation adjustment on the annotated image data for multiple times to obtain simulated illumination data;
[0112] A merging subunit 135, for merging the scaling data, the multi-angle data, the flipping data and the simulated illumination data to obtain an image data set;
[0113] In this embodiment, the building module 20 includes:
[0114] A construction unit 21 is used to construct a backbone network, a feature pyramid network and a detection head, connect and configure the backbone network, the feature pyramid network and the detection head to build a basic model based on the NanoDet network model, and set the learning rate, batch size and number of iterations of the basic model;
[0115] An improvement unit 22 is used to improve the basic model by using RandCrop and Mixupk data enhancement methods to obtain a preliminary model;
[0116] A training unit 23, used to train the preliminary model using the image data set to obtain a vehicle tracking calculation model;
[0117] In this embodiment, the training unit 23 includes:
[0118] A division subunit 231 is used to divide the image data set into a plurality of batches, which are sequentially input into the preliminary model for training, and the preliminary prediction results of the vehicle type and position are obtained using the preliminary model;
[0119] A calculation subunit 232, used to calculate the difference between the preliminary prediction result and the annotation to obtain a loss value;
[0120] The iterative subunit 233 is used to use the back propagation algorithm to back propagate the loss value back to the preliminary model to calculate the gradient information, and according to the gradient information, use the optimizer to update and adjust the parameters of the preliminary model, and iterate repeatedly to obtain a vehicle tracking calculation model that meets the requirements;
[0121] In this embodiment, the statistical module 40 includes:
[0122] The prediction unit 41 is used to use a Kalman filter algorithm to predict the motion state of the vehicle according to the vehicle position, so as to predict the possible position range of the vehicle in the next frame of the image and obtain position prediction data;
[0123] A matching unit 42 is used to match the same vehicle in the previous and next frames of the image according to the position prediction data using the Hungarian algorithm, and generate a driving trajectory according to the matching result;
[0124] The statistical unit 43 is used to calculate the flow of vehicles in the logistics park according to the vehicle type information, and match the vehicle's driving trajectory and flow with the pre-established dispatching rules to obtain a dispatching plan;
[0125] In this embodiment, the statistical unit 43 includes:
[0126] The formulation subunit 431 is used to formulate the deployment rules, set the flow warning value of the logistics park, set a plurality of guided driving routes according to the flow warning value, and set the abnormal situation handling plan;
[0127] The warning subunit 432 is used to calculate the traffic situation of the vehicles in the logistics park according to the vehicle type information. If the traffic situation of the vehicles in the logistics park reaches the traffic warning value, the driving route is guided to the drivers of the vehicles in the park according to the dispatching rules.
[0128] The judgment subunit 433 is used to judge whether congestion and abnormality occur according to the driving trajectory of the vehicle. If so, it outputs a guiding driving route to the vehicle drivers in the park according to the deployment rules, and outputs an abnormal situation handling plan to the logistics park management personnel.
[0129] The logistics park vehicle tracking and flow counting device provided by the present invention first obtains an image data set by annotating and preprocessing the image data of the logistics park vehicles, thereby obtaining a high-quality data set, and then uses the image data set to train a preliminary model based on the NanoDet network model and improved by the data enhancement method, thereby obtaining a vehicle tracking calculation model; then, through the vehicle tracking calculation model, the vehicle position and vehicle type information are generated according to the real-time image data, so that the vehicle position and vehicle type can be automatically tracked by the system, which solves the problem that the vehicle could not be tracked in real time and effectively classified in the past; finally, a target tracking algorithm is used to generate the vehicle's driving trajectory according to the vehicle position and vehicle type information and to count the logistics park vehicles, so as to provide real-time data for vehicle management and monitoring of the logistics park, so that the logistics park can be dispatched in time according to the change of traffic flow, thereby improving the operation efficiency of the park.
[0130] The above is a detailed description of the logistics park vehicle tracking and flow counting device in the embodiment of the present invention from the perspective of modular functional entities. The following is a detailed description of the logistics park vehicle tracking and flow counting device in the embodiment of the present invention from the perspective of hardware processing.
[0131] Fig.10A schematic diagram of the structure of a logistics park vehicle tracking and flow counting device provided in an embodiment of the present invention. The logistics park vehicle tracking and flow counting device 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 910 (for example, one or more processors) and a memory 920, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 933 or data 932. Among them, the memory 920 and the storage medium 930 can be short-term storage or permanent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the logistics park vehicle tracking and flow counting device 900. Furthermore, the processor 910 may be configured to communicate with the storage medium 930, and execute a series of instruction operations in the storage medium 930 on the logistics park vehicle tracking and flow counting device 900 to implement the steps of the logistics park vehicle tracking and flow counting method provided in the above-mentioned method embodiments.
[0132] The logistics park vehicle tracking and flow counting device 900 may also include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input and output interfaces 960, and / or, one or more operating systems 931, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Fig.10 The structure of the logistics park vehicle tracking and flow counting equipment shown does not constitute a limitation of the logistics park vehicle tracking and flow counting equipment, and may include more or less components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0133] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of a method for tracking and counting vehicles in a logistics park.
[0134] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the equipment or device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0135] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0136] It is understandable that those skilled in the art can make equivalent substitutions or changes based on the technical solution and inventive concept of the present invention, and all these changes or substitutions should fall within the protection scope of the claims attached to the present invention.
Claims
1. A method for tracking and counting vehicles in a logistics park, characterized in that: The steps include: Obtain image data of vehicles in the logistics park and annotate them, and preprocess the annotated image data to obtain an image data set; Build a basic model based on the NanoDet network model, use data enhancement methods to improve the basic model to obtain a preliminary model, and use image datasets to train the preliminary model to obtain a vehicle tracking calculation model; Acquire real-time image data, use a vehicle tracking calculation model, and generate vehicle location and vehicle type information based on the real-time image data; The target tracking algorithm is used to generate the vehicle's driving trajectory and collect statistics on the vehicles in the logistics park based on the vehicle's location and type information.
2. The method for tracking and counting vehicles in a logistics park according to claim 1, characterized in that: The obtaining and labeling of image data of vehicles in the logistics park, and preprocessing of the labeled image data to obtain an image data set specifically includes: Obtain image data of vehicles in the logistics park and use annotation tools to annotate the vehicle types in the image data; Using a coordinate system, the vehicle position in the image data is marked; The labeled image data is preprocessed to obtain an image dataset.
3. The method for tracking and counting vehicles in a logistics park according to claim 2, characterized in that: The preprocessing of the annotated image data to obtain an image data set specifically includes: scaling the annotated image data at different ratios to obtain scaled data; Rotate the annotated image data at different angles to obtain multi-angle data; The labeled image data is flipped horizontally and vertically respectively to obtain flipped data; The image brightness, contrast and color saturation are adjusted for multiple times on the annotated image data to obtain simulated illumination data; The scaling data, multi-angle data, flip data, and simulated illumination data are combined to obtain an image dataset.
4. The method for tracking and counting vehicles in a logistics park according to claim 1, characterized in that: The construction of a basic model based on the NanoDet network model, using a data enhancement method to improve the basic model to obtain a preliminary model, and using an image data set to train the preliminary model to obtain a vehicle tracking calculation model specifically includes: Build the backbone network, feature pyramid network and detection head, connect and configure the backbone network, feature pyramid network and detection head to build a basic model based on the NanoDet network model, and set the learning rate, batch size and number of iterations of the basic model; The RandCrop and Mixupk data augmentation methods were used to improve the base model to obtain a preliminary model; The preliminary model is trained using an image dataset to obtain a vehicle tracking computational model.
5. The method for tracking and counting vehicles in a logistics park according to claim 4, characterized in that: The image dataset is used to train the preliminary model to obtain a vehicle tracking calculation model, specifically including: The image dataset is divided into multiple batches, which are input into the preliminary model for training in sequence, and the preliminary model is used to obtain preliminary prediction results of vehicle type and location; Calculate the difference between the initial prediction and the annotation to get the loss value; The back-propagation algorithm is used to propagate the loss value back to the preliminary model to calculate the gradient information. According to the gradient information, the optimizer is used to update and adjust the parameters of the preliminary model, and the iteration is repeated to obtain a vehicle tracking calculation model that meets the requirements.
6. The method for tracking and counting vehicles in a logistics park according to claim 1, characterized in that: The target tracking algorithm is used to generate the vehicle's driving trajectory and count the vehicles in the logistics park according to the vehicle location and vehicle type information, specifically including: The Kalman filter algorithm is used to predict the vehicle's motion state based on the vehicle's position, so as to predict the possible position range of the vehicle in the next frame of the image and obtain the position prediction data; The Hungarian algorithm is used to match the same vehicle in the previous and next frames of the image according to the position prediction data, and the driving trajectory is generated according to the matching results; The flow of vehicles in the logistics park is counted based on the vehicle type information, and the vehicle's driving trajectory and flow situation are matched with the pre-established dispatching rules to obtain a scheduling plan.
7. The method for tracking and counting vehicles in a logistics park according to claim 6, characterized in that: The flow of vehicles in the logistics park is counted according to the vehicle type information, and the vehicle's driving trajectory and flow are matched with the pre-established dispatching rules to obtain a dispatching plan, which specifically includes: Formulate dispatching rules, set traffic flow warning values for logistics parks, set up multiple guided driving routes based on traffic flow warning values, and set up abnormal situation handling plans; The traffic situation of the logistics park vehicles is counted based on the vehicle type information. If the traffic situation of the logistics park vehicles reaches the traffic warning value, the driving route is guided to the vehicle drivers in the park according to the dispatching rules. Determine whether congestion and abnormalities occur based on the vehicle's driving trajectory. If so, output a guiding route to the vehicle drivers in the park based on the dispatching rules, and output an abnormal situation handling plan to the logistics park managers.
8. A vehicle detection, tracking and flow counting device for a logistics park, characterized in that: include: A data acquisition module is used to acquire and annotate image data of vehicles in the logistics park, and preprocess the annotated image data to obtain an image data set; A construction module is used to build a basic model based on the NanoDet network model, improve the basic model using data enhancement methods to obtain a preliminary model, and train the preliminary model using an image dataset to obtain a vehicle tracking calculation model; A generation module, used to obtain real-time image data, adopt a vehicle tracking calculation model, and generate vehicle position and vehicle type information according to the real-time image data; The statistical module is used to generate the vehicle's driving trajectory and to collect statistics on the vehicles in the logistics park based on the vehicle's location and vehicle type information using a target tracking algorithm.
9. A vehicle detection, tracking and flow counting device for a logistics park, characterized in that: comprising a memory and at least one processor, wherein the memory has computer-readable instructions stored therein; The at least one processor calls the computer-readable instructions in the memory to execute the various steps of the logistics park vehicle tracking and traffic counting method as described in any one of claims 1-7.
10. A computer-readable storage medium having computer-readable instructions stored thereon, characterized in that: When the computer-readable instructions are executed by a processor, the various steps of the logistics park vehicle tracking and flow counting method as described in any one of claims 1-7 are implemented.
Citation Information
Cited By
Camera-based vehicle track generation method and device, equipment and medium
CN121366490A