A traffic flow prediction method based on channel pruning combined with network quantization

By combining channel pruning and network quantization, the overfitting problem of traffic flow prediction models is solved, the generalization ability and hardware adaptability of the models are improved, and they are applicable to a variety of hardware platforms, achieving efficient traffic flow prediction.

CN120071641BActive Publication Date: 2025-12-16HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510007975.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-12-16
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

Existing traffic flow prediction models are prone to overfitting in deep learning modeling, resulting in poor generalization ability and difficulty in effectively predicting traffic flow in practical applications.

Method used

A method combining channel pruning and network quantization is adopted. Redundant channels are pruned and floating-point values ​​are quantized into low-precision integers to reduce computation and storage requirements. At the same time, convolutional neural networks and recurrent neural networks are used to extract spatiotemporal features, and model fine-tuning and quantization training are performed to optimize the model.

Benefits of technology

Without significantly reducing accuracy, it reduces computational resource consumption and storage requirements, improves model inference speed and adaptability, is suitable for low-power devices and edge computing, reduces hardware costs and improves processing power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120071641B_ABST
    Figure CN120071641B_ABST
Patent Text Reader

Abstract

The application discloses a traffic flow prediction method based on channel pruning and network quantization combination, which comprises the following steps: collecting data; data preprocessing; constructing a traffic flow prediction model; model optimization; combining channel pruning and network quantization to form an efficient deep learning traffic flow prediction model; by simplifying the model, reducing the depth of the network or the number of neurons in each layer, reducing the degree of freedom of the model, thereby reducing the possibility of overfitting, simplifying the model under the premise of ensuring high precision of the model to reduce complexity and improve the generalization ability of the model; the traffic flow can be accurately predicted, and effective support can be provided for traffic management and planning.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a traffic flow prediction method, in particular to a traffic flow prediction method based on channel pruning and network quantization combination. BACKGROUND

[0002] A traffic flow prediction model is a mathematical model or algorithm used to predict traffic flow within a specific time period. By analyzing historical traffic data, weather conditions, holidays, road conditions and other factors, it predicts future traffic flow changes to facilitate traffic management, planning, optimization and early warning. Traffic flow prediction helps to reduce traffic congestion, improve road capacity, optimize traffic signals and reasonably arrange travel. The main problem that a traffic flow prediction model may face when performing deep learning modeling is overfitting. How to avoid overfitting of a traffic flow prediction model in deep learning modeling and ensure its good generalization ability.

[0003] The application number 202211175626.7 discloses a traffic flow prediction model establishment method, device and equipment, relating to the field of artificial intelligence. The traffic flow prediction model establishment method includes: obtaining traffic flow in different time periods and first data related to vehicle operation; obtaining traffic flow in the second time period associated with the traffic flow in the first time period according to the traffic flow in different time periods; obtaining target data associated with traffic flow according to traffic flow and first data; and obtaining a traffic flow prediction model according to traffic flow in the first time period, traffic flow in the second time period, target data and ASTGCN model. The above technical solution may have overfitting phenomenon when performing deep learning modeling, i.e. the model performs well on the training set but has poor generalization ability in actual application, if the training data is insufficient or the model is too complex. SUMMARY

[0004] The purpose of the application is to provide a traffic flow prediction method based on channel pruning and network quantization combination to reduce overfitting and improve generalization ability.

[0005] Technical solution: the traffic flow prediction method based on channel pruning and network quantization combination comprises the following steps:

[0006] (1) Collect data;

[0007] (2) Data preprocessing: fill in the missing values in the traffic flow data with the average value of adjacent time points, correct the data outliers, and number the data information;

[0008] (3) Construct a traffic flow prediction model: use the preprocessed data as input, use convolutional neural network and recurrent neural network to extract spatio-temporal features, and implement channel pruning and network quantization operation on the model;

[0009] (4) Model optimization: fine-tune the pruned model, perform quantization training simultaneously, and perform layer-by-layer quantization and pruning after training to accurately predict traffic flow.

[0010] The step (2) uses the average value of adjacent time point data to fill in the missing values in the traffic flow data, corrects abnormal data deviating from the normal range, and numbers the weather data, holiday information and road construction information affecting traffic flow.

[0011] The step (3) specifically comprises the following steps:

[0012] (31) input the preprocessed data, the input data dimension is [sample number, time series length, feature dimension];

[0013] (32) use convolutional neural network and recurrent neural network to extract spatio-temporal features, wherein the convolutional neural network is used to extract spatial features, and the recurrent neural network is used to capture the dependence relationship of time series;

[0014] (33) channel pruning: calculate L1 norm and L2 norm to measure the weight size of the channel, and then calculate the gradient information to determine the importance of pruning;

[0015] (34) network quantization: convert floating point values to low precision integers, including weight quantization and activation value quantization;

[0016] The weight quantization formula is:

[0017] ,

[0018] Wherein: is the weight of the floating point type, W min is the minimum value of the weight, is the quantization step, calculated as , b is the number of bits after quantization, W max is the maximum value of the weight, is the rounding to the nearest integer;

[0019] The activation value quantization formula is:

[0020] ,

[0021] Wherein, is the activation value, A minis the minimum value of the activation value, S a is the step size of the activation quantization

[0022] The step (4) fine-tunes the pruned model, and the fine-tuning formula is: ,

[0023] wherein, is the fine-tuned weight, is the pruned weight, is the learning rate.

[0024] In the fine-tuning process, the gradient of the loss function with respect to the pruned weight is calculated, and the weight is updated according to the gradient direction and the learning rate.

[0025] The step (4) quantization training is quantization-aware training, and the formula is:

[0026] ,

[0027] wherein is the fine-tuned weight; in the quantization-aware training, the quantization error is introduced, and the quantization-aware training error calculation formula is:

[0028] ,

[0029] wherein is the original loss function, m is the number of weights, n is the number of activation values, L is the loss function after adding the quantization error, is the regularization coefficient.

[0030] The step (4) layer-by-layer quantization and pruning is specifically pruning each layer of channels according to the channel pruning method, and then quantizing the weights and activation values of each layer to determine the appropriate quantization parameter.

[0031] After the step (4) layer-by-layer quantization and pruning, the final optimization processing is performed, the performance of the model is evaluated on the validation set, and the parameters of the model are adjusted according to the performance indicators. If the performance of the model on the validation set decreases, the learning rate is reduced or the regularization coefficient is increased, and the model is continuously trained until the performance of the model on the validation set is stable and meets the requirements. Finally, the optimized model is used to predict the test set, and the performance of the model on the test set is evaluated.

[0032] A computer device comprising one or more processors, a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs are executed by the processor to realize the steps of the traffic flow prediction method based on the combination of channel pruning and network quantization.

[0033] A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the traffic flow prediction method based on channel pruning combined with network quantization.

[0034] Advantages: Compared with the prior art, the present application has the following significant advantages: (1) Channel pruning reduces the amount of calculation and storage requirements in the network by removing redundant channels. In deep neural networks, some channels may contribute less to the final prediction of the model, so pruning these unimportant channels can reduce the consumption of computing resources without significantly sacrificing accuracy. Network quantization further reduces the storage occupancy and memory bandwidth requirements by mapping the floating-point weights and activation values of the model to low-precision integers, reducing the complexity of hardware computation. This combination not only improves the inference speed of the model, but also meets the requirements of low-power devices and edge computing. (2) The number of parameters in the network is reduced by pruning techniques, allowing the network to run in smaller storage space. Quantization reduces the bit width of the data, reducing the requirements for hardware computing and storage capacity. This can reduce the cost of hardware while improving the processing capacity of the device, allowing the model to be deployed on a wider variety of hardware platforms, thereby accelerating its application in industry and consumer electronics. (3) The combination of channel pruning and network quantization can simplify the model while maintaining high accuracy. Pruning reduces unnecessary channels or parameters, effectively reducing the complexity of the model, while quantization further reduces redundant information in model computation. Although these optimizations may result in a slight decrease in accuracy, careful design of the fine-tuning strategy can recover some of the accuracy after pruning and quantization, ensuring that the performance of the simplified model is not overly compromised. Therefore, this technical solution can reduce the consumption of computing resources without significantly sacrificing accuracy, providing a balanced solution for tasks in practical applications that require high efficiency and accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0035] Figure 1 The model channel pruning and network quantization flowchart described in the present application. DETAILED DESCRIPTION

[0036] The technical solutions of the present application will be further described below in conjunction with the accompanying drawings.

[0037] A traffic flow prediction method based on channel pruning combined with network quantization, comprising the following steps:

[0038] (1) Collecting data;

[0039] (2) Data preprocessing: filling missing values in traffic flow data with the average value of adjacent time points, and correcting data outliers, and numbering data information; (1) Collecting data; (2) Data preprocessing: filling missing values in traffic flow data with the average value of adjacent time points, and correcting data outliers, and numbering data information;

[0040] (3) Construct a traffic flow prediction model: use the preprocessed data as input, use convolutional neural network and recurrent neural network to extract spatio-temporal features, implement channel pruning and network quantization operation on the model;

[0041] (4) Model optimization: fine-tune the pruned model, perform quantization training simultaneously, and perform layer-by-layer quantization and pruning after training to accurately predict traffic flow.

[0042] The following describes the steps of the traffic flow prediction method based on channel pruning and network quantization combination.

[0043] (1) Collect data;

[0044] Obtain the traffic flow data of the past year from the traffic management department, the time interval of the data record is 15 minutes, including traffic flow, speed and corresponding timestamp. At the same time, collect the weather data, holiday information and road construction situation of the same time period in the region.

[0045] (2) Data preprocessing;

[0046] The missing values in the traffic flow data are filled with the average value of adjacent time points. For the missing traffic flow data in a 15-minute interval, the average value of the traffic flow of the previous and next two time points is calculated as the filling value.

[0047] The abnormal values are corrected, and the data that deviates from the normal range is reasonably corrected according to the distribution of historical data.

[0048] Convert the timestamp information into time features that can be used for model input, and encode the weather data, holiday information and road construction situation. Sunny is coded as 0, rainy is coded as 1; holidays are divided into weekdays, weekend holidays, statutory holidays and other different categories for coding; road construction is coded as under construction and not under construction.

[0049] (3) Construct a traffic flow prediction model;

[0050] Design a traffic flow prediction model combining deep learning and spatio-temporal feature analysis.

[0051] Use the preprocessed traffic flow data, time features, weather encoding, holiday encoding and road construction encoding as input, the dimension of the input data is [sample number, time series length, feature dimension].

[0052] Convolutional Neural Network (CNN) and Recurrent Neural Network (RNN) are combined to extract spatio-temporal features. CNN is used to extract spatial features, and the relationship between different features at the same time point is modeled through a convolution layer with a kernel size of 3 * 3; RNN is used to capture the dependency relationship on the time sequence, and the number of hidden units of LSTM is set to 64.

[0053] Channel pruning operation is performed after the spatio-temporal feature extraction layer.

[0054] L1 norm-based pruning: calculate the L1 norm of each channel weight, the formula is

[0055] where W is the convolution kernel weight matrix, c is the channel index, h is the convolution kernel height, w is the width, and d is the depth. After calculating the L1 norm of all channels, sort them from small to large, and select the 30% channels with smaller L1 norm for pruning.

[0056] L2 norm-based pruning: the L2 norm calculation formula is

[0057]

[0058] Similarly, sort the channels according to the L2 norm, and select the 25% channels with smaller L2 norm for pruning.

[0059] Gradient information-based pruning: according to the formula

[0060] ,

[0061] where L is the loss function, is the weight of the i-th sample on the channel c, and n is the number of samples. Calculate the gradient information of each channel, the smaller the gradient, the smaller the impact on the loss function, select the 20% channels with the smallest gradient for pruning. During training, the gradient of each channel is calculated through back propagation.

[0062] Quantize the pruned model, convert floating-point values to low-precision integers.

[0063] Use the linear quantization formula:

[0064] ,

[0065] where W is the floating-point weight, is the minimum value of the weight, s is the quantization step, , and b is the number of quantized bits.

[0066] The activation quantization formula is

[0067] ,

[0068] wherein A is an activation value, is the minimum value of the activation value, is the step of activation quantization. In actual calculation, the distribution of the activation value is determined and At the same time, in the quantization-aware training, the quantization error is introduced, and the quantization-aware training error calculation formula is:

[0069] ,

[0070] wherein is the original loss function, is a regularization coefficient, m is the number of weights, and n is the number of activation values. By adjusting the value of to balance the influence of the original loss and the quantization error.

[0071] (4) Model optimization;

[0072] Pruning is followed by fine-tuning, and the fine-tuning optimization formula is:

[0073] ,

[0074] wherein is the fine-tuned weight, is the pruned weight, is the learning rate. In the fine-tuning process, the gradient of the loss function with respect to the pruned weight is calculated, and the weight is updated according to the gradient direction and the learning rate.

[0075] Quantization-aware training (QAT) is performed after quantization, and the formula is:

[0076] ,

[0077] wherein is the fine-tuned weight. By simulating low-precision calculation, the model is optimized to adapt to low-precision inference, and after QAT training, quantization is performed to reduce the performance loss caused by quantization.

[0078] Layer-by-layer quantization and pruning are then performed, and quantization and pruning are applied to each convolutional layer separately. First, the channels of each layer are pruned according to the above channel pruning method, and then the weights and activation values of each layer are quantized, and appropriate quantization parameters are determined according to the specific circumstances of each layer.

[0079] After completing the pruning and quantization operations, the model is fine-tuned and optimized again. By evaluating the performance of the model on the validation set, the parameters of the model are adjusted according to the performance indicators. If it is found that the performance of the model on the validation set decreases, the learning rate can be appropriately reduced or the regularization coefficient can be increased, and then the model is continued to be trained until the performance of the model on the validation set is stable and meets the requirements. Finally, the optimized model is used to make predictions on the test set, and the performance of the model on the test set is evaluated.

Claims

1. A traffic flow prediction method based on a combination of channel pruning and network quantization, characterized in that, The method includes the following steps: (1) Data collection; (2) Data preprocessing: The missing values ​​in the traffic flow data are filled with the average value of the data at adjacent time points, and the outliers are corrected. The data information is then numbered. (3) Constructing a traffic flow prediction model: Using the preprocessed data as input, the model extracts spatiotemporal features by combining convolutional neural networks and recurrent neural networks, and performs channel pruning and network quantization operations on the model; (31) Input the preprocessed data. The input data dimensions are [number of samples, time series length, feature dimension]; (32) Convolutional neural networks and recurrent neural networks are used to extract spatiotemporal features. Convolutional neural networks are used to extract spatial features, and recurrent neural networks are used to capture the dependencies of time series. (33) Perform channel pruning: The weight of the channel is measured by calculating the L1 norm and L2 norm, and the importance of pruning is determined by calculating gradient information. (34) Perform network quantization: convert floating-point values ​​into low-precision integers, including weight quantization and activation value quantization; The formula for weight quantization is: , in: For floating-point weights, W min It is the minimum value of the weight. To quantize the step size, calculate as follows: b is the number of bits after quantization, W max It is the maximum value of the weight. To indicate rounding to the nearest integer; The activation value quantization formula is: , in, It is the activation value, A min It is the minimum activation value, S a It is the step size for activation quantization; (4) Model optimization: Fine-tune the pruned model and perform quantitative training simultaneously. After training, perform layer-by-layer quantization and pruning to enable accurate prediction of traffic flow. The fine-tuning formula is: , in, The weights are after fine-tuning. The weight after pruning. The learning rate; During fine-tuning, the gradient of the loss function with respect to the pruned weights is calculated, and the weights are updated based on the gradient direction and the learning rate. The quantitative training is quantitative perception training, and the formula is: , in, These are the fine-tuned weights; in quantization-aware training, quantization error is introduced, and the formula for calculating quantization-aware training error is: , Among them, L It is the original loss function, L It is the loss function after adding quantization error. It is the regularization coefficient. It is the sum of squares of the quantization error.

2. The traffic flow prediction method based on a combination of channel pruning and network quantization according to claim 1, characterized in that, Step (2) fills in the missing values ​​in the traffic flow data with the average value of adjacent time points, corrects abnormal data that deviates from the normal range, and numbers the weather data, holiday information and road construction information that affect traffic flow.

3. The traffic flow prediction method based on a combination of channel pruning and network quantization according to claim 1, characterized in that, The step (4) of layer-by-layer quantization and pruning specifically involves pruning the channels of each layer according to the channel pruning method, and then quantizing the weights and activation values ​​of each layer to determine appropriate quantization parameters.

4. The traffic flow prediction method based on a combination of channel pruning and network quantization according to claim 1, characterized in that, After layer-by-layer quantization and pruning, step (4) performs final optimization by evaluating the model's performance on the validation set and adjusting the model's parameters according to the performance metrics. If the model's performance on the validation set decreases, the learning rate is reduced or the regularization coefficient is increased, and the model is trained until its performance on the validation set is stable and meets the requirements. Finally, the optimized model is used to predict the test set and evaluate the model's performance on the test set.

5. A computer device, characterized in that, The method includes one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the programs, when executed by the processors, implement the steps of a traffic flow prediction method based on a combination of channel pruning and network quantization as described in any one of claims 1-4.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of a traffic flow prediction method based on a combination of channel pruning and network quantization as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method, device and equipment for establishing traffic flow prediction model

    CN116992993A

  • Traffic flow prediction method based on adaptive lightweight time convolution network

    CN117334052A

  • Lightweight traffic flow prediction method based on deep learning

    CN118396184A