Method for training end-to-end automatic driving strategy
By adopting a fusion model of convolutional neural network and recurrent neural network in the end-to-end autonomous driving model and using gradient norm calculation for weight pruning, the problem of large amount of model parameters and high calculation volume is solved, and more efficient training and wider applicability are achieved.
Patent Information
- Application Number
- CN202411670146.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing end-to-end autonomous driving models are trained and deployed due to the large number of parameters and high computational volume, resulting in long training time and low efficiency, and are difficult to deploy on resource-constrained devices, reducing the applicability of the model.
An autonomous driving fusion model based on convolutional neural networks and recurrent neural networks is adopted, and the importance of each weight is evaluated through gradient norm calculation, weight pruning is performed, the number of model parameters is reduced, and the weight recovery strategy is set to ensure model performance.
By reducing model parameters and calculation amount, training efficiency and speed are significantly improved, memory usage is reduced, model deployment is more convenient on resource-constrained devices, and model applicability and response speed are improved.
Smart Images

Figure CN119622456A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of autonomous driving training models, and in particular to a method for training an end-to-end autonomous driving strategy. Background Art
[0002] End-to-end autonomous driving aims to build a single model that can directly take data from vehicle sensors such as cameras, lidar, millimeter-wave radar, and GPS as input, and output vehicle control instructions such as steering wheel angle, accelerator pedal force, and brake pedal force without the need for intermediate human intervention or the splicing of multiple independent modules. This approach simplifies the design and implementation of the autonomous driving system and improves the efficiency and reliability of the system.
[0003] In the prior art, although an existing method for training an end-to-end autonomous driving strategy first collects data using the vehicle's own sensors, and uses these data to train the data using a suitable end-to-end autonomous driving model, and through cyclic training and evaluation, the performance of the model is improved and the safety of the model is increased, but in the actual use of this method, the end-to-end autonomous driving model is highly dependent on a large amount of data to learn the complex mapping relationship between input and output. Therefore, a large amount of data is involved when this method is used, which will result in a large number of model parameters and a high amount of computational complexity for each round of training, resulting in a significant increase in training time and low training efficiency. In addition, a large number of parameters make the model's memory usage high, which limits the deployment of the model on resource-constrained devices and reduces the applicability of the model.
[0004] Therefore, it is necessary to provide a new method for training end-to-end autonomous driving strategies to solve the above technical problems. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a method for training an end-to-end autonomous driving strategy.
[0006] The method for training an end-to-end autonomous driving strategy provided by the present invention comprises the following steps:
[0007] S1. Data collection and preprocessing: The vehicle's autonomous driving data is collected through a variety of sensors built into the vehicle, and the data is denoised through statistical filtering methods;
[0008] S2, define the loss function, optimizer and build the model, using the autonomous driving fusion model based on convolutional neural network and recurrent neural network;
[0009] S3, data division, dividing the data after preprocessing in step S1 into a training set, a validation set and a test set;
[0010] S4, model training, training the data of the training set in step S3 in the autonomous driving fusion model in batch data step S2. In each training cycle, forward propagation is performed to calculate the model output, and then the error is calculated according to the loss function, and then the gradient is calculated by the back propagation algorithm and the model parameters are updated by the optimizer;
[0011] S5. Evaluate on the validation set. After each training cycle, input the validation set data into the autonomous driving fusion model in step S2 to calculate the loss value and other relevant evaluation indicators.
[0012] S6, model adjustment and optimization, adjust the model hyperparameters according to the results of the validation set, and use the learning rate decay strategy to adjust the learning rate;
[0013] S7, test set evaluation, using the test set data to evaluate the autonomous driving fusion model in step S2, calculating the same evaluation indicators as the validation set, and judging whether the performance requirements of the actual application are met. If the requirements are not met, return to step S6;
[0014] S8, weight pruning and evaluation, using the gradient norm calculation method to calculate and evaluate the importance of each weight, starting from a smaller proportion and gradually increasing according to the importance evaluation results, and removing unimportant weights, using the test set of step S7 to evaluate the model after weight pruning. If the model performance does not meet the standards at this time, use the weight recovery strategy to restore some weights and re-evaluate until the model performance meets the standards.
[0015] Preferably, the multiple sensors in step S1 include: a laser radar, a vehicle speed sensor, a camera and a millimeter wave radar, and the multiple sensors are used to effectively collect multiple data during the automatic driving of the vehicle.
[0016] Preferably, the loss function defined in step S2 includes: a mean square error loss function and a cross entropy loss function, the mean square error loss function is used to process continuous values of vehicle control, the cross entropy loss function is used to process vehicle automatic driving classification tasks, and the optimizer selects the Adam optimizer.
[0017] Preferably, the parameter of the Adam optimizer optimization model is the learning rate, and the Adam optimizer dynamically adjusts the learning rate according to the gradient history information of each parameter.
[0018] Preferably, the evaluation indicators calculated in step S5 that are the same as those of the validation set include: the root mean square error and the mean absolute error of the regression task.
[0019] Preferably, the specific steps of step S8 are as follows:
[0020] S801, evaluate the importance, using the gradient norm calculation method to calculate the importance of the gradient of each weight of the loss function calculated by the back propagation algorithm in the evaluation step S4;
[0021] S802, weight pruning, according to the importance evaluation result, remove unimportant weights in a way of starting from a smaller proportion and gradually increasing;
[0022] S803, model evaluation, using the test set in step S7 to evaluate the model after weight pruning;
[0023] S804, adjusting the results. According to the evaluation results, if the evaluation model performance meets the standards, the model results are output; if the evaluation results do not meet the standards, a weight recovery strategy is used to restore some weights, and re-evaluate until the model performance meets the standards.
[0024] Preferably, the weight recovery strategy reinitializes the weights of some pruning by obtaining initial values in random initialization.
[0025] Compared with the related art, the method for training end-to-end autonomous driving strategy provided by the present invention has the following beneficial effects:
[0026] 1. The present invention adopts the method of gradient norm calculation to calculate and evaluate the importance of each weight and remove unimportant weights, thereby reducing the complexity of the model and the number of model parameters, so that the amount of calculation during the training of the model is reduced, which greatly improves the training efficiency of the model and reduces the time of model training. In addition, the number of model parameters is reduced, the amount of calculation during reasoning is reduced, and the calculation burden is reduced. This enables the model to make predictions faster in practical applications, speeds up the response speed of the system when in use, enhances security, and reduces the number of model parameters after pruning, and significantly reduces the memory usage of the model, making the model more widely applicable.
[0027] 2. The present invention sets a weight recovery strategy. When the performance of the model after weight pruning does not meet the standard after testing, the weight recovery strategy is used to restore some weights and re-evaluate until the model performance meets the standard. This helps to find the most appropriate pruning degree. This iterative process enables the model to maintain good performance at certain pruning ratios while reducing the burden on the system;
[0028] 3. The present invention selects an autonomous driving fusion model based on a convolutional neural network and a recurrent neural network for training, thereby providing the model with the ability to process complex inputs. When faced with new sensor types or data fusion requirements, the model has better scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1Specific steps of the method for training end-to-end autonomous driving strategy provided by the present invention;
[0030] Figure 2 The present invention provides specific steps for weight pruning and evaluation. DETAILED DESCRIPTION
[0031] The present invention will be further described below in conjunction with the accompanying drawings and implementation modes.
[0032] Please refer to Figure 1 as well as Figure 2 ,in, Figure 1 Specific steps of the method for training end-to-end autonomous driving strategy provided by the present invention; Figure 2 The present invention provides specific steps for weight pruning and evaluation.
[0033] In the specific implementation process, Figure 1-2 As shown, the method for training an end-to-end autonomous driving strategy provided by the present invention includes the following steps:
[0034] S1. Data collection and preprocessing: The vehicle's autonomous driving data is collected through a variety of sensors built into the vehicle, and the data is denoised through statistical filtering methods;
[0035] It should be noted that the various sensors here include: lidar, vehicle speed sensor, camera and millimeter wave radar. These sensors are used to effectively collect various data during vehicle automatic driving, and each point in the lidar data is marked through statistical filtering methods. By calculating the value of each point to the neighboring points, the noise points are confirmed and removed to achieve data denoising preprocessing.
[0036] S2, define the loss function, optimizer and build the model, using the autonomous driving fusion model based on convolutional neural network and recurrent neural network;
[0037] It should be noted that the above-mentioned loss functions include: mean square error loss function and cross entropy loss function. The mean square error loss function is used to process continuous values of vehicle control, and the cross entropy loss function is used to process vehicle autonomous driving classification tasks. The above-mentioned optimizer selects Adam optimizer. The parameter of the Adam optimizer optimization model is the learning rate. The Adam optimizer dynamically adjusts the learning rate according to the gradient history information of each parameter.
[0038] S3, data division, dividing the data after preprocessing in step S1 into 70%-80% of the data as a training set, 10%-15% as a validation set, and 10%-15% as a test set;
[0039] It should be noted that allocating most of the data (70%-80%) to the training set can provide the model with enough data to learn the complex mapping relationship between input and output. The model can fully adjust its parameters to fit the patterns in the data through multiple iterative training on a large amount of training data, so that the model can maintain a certain generalization ability while learning the main patterns in the data.
[0040] S4, model training, training the data of the training set in step S3 in the autonomous driving fusion model in batch data step S2. In each training cycle, forward propagation is performed to calculate the model output, and then the error is calculated according to the loss function, and then the gradient is calculated by the back propagation algorithm and the model parameters are updated by the optimizer;
[0041] It should be noted that the purpose of the above forward propagation calculation is to calculate the input data through each layer of the neural network to obtain the predicted output of the model. The calculation formula of the above mean square error loss function is as follows:
[0042]
[0043] Among them, MSE is the mean square error, and the model prediction output is The true label is y, and n is the number of samples. This method calculates the square of the difference between the predicted value and the true value of each sample, and then averages all samples. This calculation method makes the larger error be amplified by the square, so that the model pays more attention to those samples that are far from the true value. For classification tasks, the cross entropy loss function is used for calculation. The calculation formula is as follows:
[0044]
[0045] Where n is the number of samples, y i is the true label, The cross entropy loss function is the probability value predicted by the model. In classification tasks, it can make the probability distribution of the model output as close as possible to the actual category distribution. In autonomous driving, for classification tasks, such as judging different types of driving operations: acceleration, deceleration, and maintaining a constant speed, the cross entropy loss function can guide the model to learn the correct category probability distribution and improve the accuracy of the model in classification tasks.
[0046] Based on the error calculated by the loss function, the gradient of the loss function with respect to each model parameter such as weight and bias is calculated through the back propagation algorithm. Then, the model parameters are updated using this gradient information so that the predicted output of the model gradually approaches the true label, thereby reducing the value of the loss function.
[0047] S5. Evaluate on the validation set. After each training cycle, input the validation set data into the autonomous driving fusion model in step S2 to calculate the loss value and other relevant evaluation indicators.
[0048] It should be noted that the evaluation indicators mentioned above, which are the same as those of the validation set, include: the root mean square error and mean absolute error of the regression task.
[0049] S6, model adjustment and optimization, adjust the model hyperparameters according to the results of the validation set, and use the learning rate decay strategy to adjust the learning rate;
[0050] It should be noted that when the validation set data loss increases or the evaluation index no longer improves or even decreases, the model is considered to be overfitting or performance stagnant. At this time, the learning rate is reduced through the learning rate decay strategy. Specifically, the learning rate is multiplied by a factor less than 1 every several cycles. The purpose of this is to use a larger learning rate to speed up convergence in the early stages of training, and gradually reduce the learning rate as the training progresses, so that the model converges more stably when approaching the optimal solution. This allows the system to avoid oscillation or overfitting during training. In autonomous driving, the model needs to learn complex input-output relationships. The learning rate decay strategy can enable the model to adapt to different learning needs at different training stages and improve the performance and generalization ability of the model.
[0051] S7, test set evaluation, using the test set data to evaluate the autonomous driving fusion model in step S2, calculating the same evaluation indicators as the validation set, and judging whether the performance requirements of the actual application are met. If the requirements are not met, return to step S6;
[0052] S8, weight pruning and evaluation, using the gradient norm calculation method to calculate and evaluate the importance of each weight, starting from a smaller proportion and gradually increasing according to the importance evaluation results, and removing unimportant weights, using the test set of step S7 to evaluate the model after weight pruning. If the model performance does not meet the standards at this time, use the weight recovery strategy to restore some weights and re-evaluate until the model performance meets the standards.
[0053] It should be noted that the specific steps of step S8 are as follows:
[0054] S801, evaluate the importance, using the gradient norm calculation method to calculate the importance of the gradient of each weight of the loss function calculated by the back propagation algorithm in the evaluation step S4;
[0055] S802, weight pruning, according to the importance evaluation result, remove unimportant weights in a way of starting from a smaller proportion and gradually increasing;
[0056] It should be noted that the torch.nn.utils.prune model used in the above removal of unimportant weights is a practical tool module for model pruning in PyTorch. This module can be used to easily implement weight pruning without manually writing complex pruning codes. At the same time, it also provides some advanced pruning methods and functions, such as pruning based on custom masks, which can meet different pruning requirements.
[0057] S803, model evaluation, using the test set in step S7 to evaluate the model after weight pruning;
[0058] It should be noted that the pruned model is evaluated on the test set, and the same evaluation indicators as the unpruned model are calculated. By comparing the performance of the model before and after pruning on the test set, it can be determined whether the pruning operation has a significant impact on the model performance. The purpose is to determine whether the pruned model meets the performance requirements. If the performance of the pruned model does not decrease significantly, or even improves in some cases, it means that the pruning operation is effective and the subsequent optimization steps can be continued. If the performance of the pruned model decreases severely, it means that the pruning ratio may be too large and a weight recovery operation is required.
[0059] S804, adjusting the results. According to the evaluation results, if the evaluation model performance meets the standards, the model results are output; if the evaluation results do not meet the standards, a weight recovery strategy is used to restore some weights, and re-evaluate until the model performance meets the standards.
[0060] It should be noted that the weight recovery strategy reinitializes some of the pruned weights by obtaining initial values from random initialization. Reinitializing some of the pruned weights can give the model a chance to relearn. Some important weights may have been pruned incorrectly during the initial pruning process. By reinitializing these weights, the model can readjust their values in subsequent training to better adapt to the data. This allows the system to continue learning to reach a suitable degree of pruning, making the system more complete and ensuring system performance.
[0061] The working principle provided by the present invention is as follows:
[0062] In the specific use of the system, firstly, the vehicle's own sensors are used to collect the data of the vehicle's automatic driving, and the data is denoised by statistical filtering technology to make the data more accurate. After the data is preprocessed, the loss function is defined, and the optimizer uses a convolutional neural network and a recurrent neural network to build an automatic driving fusion model. The data is divided into a training set, a validation set, and a test set. The training set data is input into the automatic driving fusion model in batches for training. In each training cycle, the forward ship calculation model output is executed, and then the error is calculated according to the loss function. The gradient is calculated by the back propagation algorithm and the model parameters are updated by the optimizer. The model is evaluated by the validation set, and the loss value is calculated for relevant evaluation indicators. When the evaluation result does not meet the results required by the model, the model is adjusted and optimized at this time. The learning rate is adjusted by adopting the learning rate decay strategy. The model performance is optimized by dynamically changing the learning rate. After the model is adjusted and optimized, it is evaluated by the test set. When the evaluation result of the test set does not meet the requirements of the actual application, the system is adjusted and optimized again. When the evaluation result of the test set meets the actual application requirements, weight pruning is performed at this time.
[0063] By using the gradient norm calculation method, the importance of each weight is calculated and evaluated, and unimportant weights are removed. After removing the weights, the model is tested on the test set. If the model performance meets the standard at this time, the model is output;
[0064] When the test set test model does not meet the standards, the weight recovery strategy is adopted to restore some weights and evaluate them. The test set is then tested with the model to evaluate whether the model meets the standards. If the model meets the standards at this time, the model is output. If the model does not meet the standards at this time, the operation here is looped until the model meets the standards. This method removes unimportant weights, reduces the complexity of the model, reduces the number of model parameters, and reduces the amount of calculation during the training process of the model, greatly improving the training efficiency of the model and reducing the time of model training. In addition, the number of model parameters is reduced, the amount of calculation during inference is reduced, and the computational burden is reduced. This enables the model to make predictions faster in practical applications, making the model more applicable.
[0065] The circuits and controls involved in the present invention are all prior art and will not be described in detail here.
[0066] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for training an end-to-end autonomous driving strategy, characterized in that: The steps include: S1. Data collection and preprocessing: The vehicle's autonomous driving data is collected through a variety of sensors built into the vehicle, and the data is denoised through statistical filtering methods; S2, define the loss function, optimizer and build the model, using the autonomous driving fusion model based on convolutional neural network and recurrent neural network; S3, data division, dividing the data after preprocessing in step S1 into a training set, a validation set and a test set; S4, model training, inputting the data of the training set in step S3 into the autonomous driving fusion model in step S2 in batches for training. In each training cycle, forward propagation is performed to calculate the model output, and then the error is calculated according to the loss function, and then the gradient is calculated by the back propagation algorithm and the model parameters are updated by the optimizer; S5. Evaluate on the validation set. After each training cycle, input the validation set data into the autonomous driving fusion model in step S2 to calculate the loss value and other relevant evaluation indicators. S6, model adjustment and optimization, adjust the model hyperparameters according to the results of the validation set, and use the learning rate decay strategy to adjust the learning rate; S7, test set evaluation, using the test set data to evaluate the autonomous driving fusion model in step S2, calculating the same evaluation indicators as the validation set, and judging whether the performance requirements of the actual application are met. If the requirements are not met, return to step S6; S8, weight pruning and evaluation, using the gradient norm calculation method to calculate and evaluate the importance of each weight, starting from a smaller proportion and gradually increasing according to the importance evaluation results, and removing unimportant weights, using the test set of step S7 to evaluate the model after weight pruning. If the model performance does not meet the standards at this time, use the weight recovery strategy to restore some weights and re-evaluate until the model performance meets the standards.
2. The method for training an end-to-end autonomous driving strategy according to claim 1, characterized in that: The multiple sensors in step S1 include: laser radar, vehicle speed sensor, camera and millimeter wave radar, through which multiple data of the vehicle's automatic driving can be effectively collected.
3. The method for training an end-to-end autonomous driving strategy according to claim 1, characterized in that: The loss functions defined in the S2 step include: a mean square error loss function and a cross entropy loss function. The mean square error loss function is used to process continuous values of vehicle control, and the cross entropy loss function is used to process vehicle autonomous driving classification tasks. The optimizer selects the Adam optimizer.
4. The method for training an end-to-end autonomous driving strategy according to claim 3, characterized in that: The parameter of the Adam optimizer optimization model is the learning rate, and the Adam optimizer dynamically adjusts the size of the learning rate according to the gradient history information of each parameter.
5. The method for training an end-to-end autonomous driving strategy according to claim 1, characterized in that: The evaluation indicators calculated in step S5 that are the same as those of the validation set include: the root mean square error and the mean absolute error of the regression task.
6. The method for training an end-to-end autonomous driving strategy according to claim 1, characterized in that: The specific steps of step S8 are as follows: S801, evaluate the importance, using the gradient norm calculation method to calculate the importance of the gradient of each weight of the loss function calculated by the back propagation algorithm in the evaluation step S4; S802, weight pruning, according to the importance evaluation result, remove unimportant weights in a way of starting from a smaller proportion and gradually increasing; S803, model evaluation, using the test set in step S7 to evaluate the model after weight pruning; S804, adjusting the results, according to the evaluation results, if the evaluation model performance meets the standards, then outputting the model results; If the evaluation result does not meet the standard, the weight recovery strategy is used to restore some weights and re-evaluate until the model performance meets the standard.
7. The method for training an end-to-end autonomous driving strategy according to claim 1, characterized in that: The weight recovery strategy reinitializes the weights of some pruning branches by obtaining initial values from random initialization.
Citation Information
Patent Citations
Deep learning model compression method and device
CN111598238A
Lightweight and network optimization method based on YOLOX
CN116306813A
End-to-end automatic driving method and system under complex road condition
CN116331251A
Iterative random pruning method and system based on meta transfer learning
CN117787377A
Cited By
Multifunctional integrated service terminal and data processing method applied by same
CN120277620A
Automatic driving strategy generation method and device and vehicle-mounted large model deployment method and device
CN120671782A
Automatic driving end-to-end model training method and device based on weak annotation data
CN121330427A
Method and device for training end-to-end model of automatic driving based on weakly labeled data
CN121330427B