Unmanned driving safety control method
By using proximal policy optimization algorithms and safety constraint mechanisms in autonomous driving systems, combined with expert network guidance, the problem of safety risks not being considered in traditional deep reinforcement learning methods is solved, achieving higher safety and decision-making efficiency.
Patent Information
- Application Number
- CN202410759061.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-15
AI Technical Summary
Traditional deep reinforcement learning methods fail to fully consider safety risks in autonomous driving applications, resulting in possible safety problems in the algorithm in complex traffic environments.
An unmanned driving safety control method based on the Proximal Policy Optimization (PPO) algorithm is adopted. By constructing a Markov decision process model, the safety reward function and adaptive safety constraints are designed, and the expert network is used to guide policy network learning to ensure that the agent behavior is within within a safe range.
It improves the safety and efficiency of the autonomous driving system in complex traffic environments, ensures the stability and safety of the agent's behavior, and improves decision-making quality and learning efficiency.
Smart Images

Figure CN118778640A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of unmanned driving technology, and in particular to an unmanned driving safety control method. Background Art
[0002] In the field of autonomous driving, the integration of deep reinforcement learning algorithms is the key to improving the intelligence level of decision-making systems. Deep reinforcement learning can process high-dimensional perceptual inputs such as images and radar data through algorithms such as deep neural networks, thereby achieving a high level of understanding of the environment. The reinforcement learning part is responsible for adjusting behavioral strategies based on environmental feedback and optimizing long-term rewards. This learning mechanism allows the autonomous driving system to learn how to make optimal decisions in various situations through continuous trial and error. However, traditional deep reinforcement learning methods often fail to fully consider safety risks during the training process of applications such as autonomous driving. This is mainly because these algorithms usually focus on learning to maximize cumulative rewards from interactions rather than directly evaluating potential safety threats, which may cause safety issues in the algorithms in autonomous driving applications. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide an unmanned driving safety control method based on the Proximal Policy Optimization (PPO) algorithm to achieve unmanned driving safety control and improve the safety and efficiency of the automatic driving system in a complex traffic environment.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is: an unmanned driving safety control method, comprising the following steps:
[0005] Step 1: Construct an unmanned driving system control model based on the Markov decision process;
[0006] The unmanned driving system is modeled as a deep reinforcement learning agent, and the reinforcement learning process is represented as a Markov decision process consisting of a seven-tuple (S, A, P, R, Ω, O, γ);
[0007] Where S represents the state space, {s1,s2,...,s t} is a set of environmental states, representing the information of the autonomous vehicle and its surroundings; the state input of the agent includes the environmental feature information collected by the vehicle's front camera and the state feature information of the vehicle itself;
[0008] The vehicle's own state characteristic information includes current speed, last steering value, throttle, distance from the track, and direction of the vehicle relative to the lane forward vector;
[0009] A is the action space, {a1,a2,...,at} is the action set, which represents all actions taken by the vehicle, including acceleration, deceleration, and turning;
[0010] P(s t+1 |s t ,a t ) is the state transition probability, which means that after executing action at in state st, the state is transferred to st +1 The probability distribution of
[0011] R is the reward function, which represents the immediate reward value obtained after executing the action; considering the offset distance between the center of the vehicle and the center of the lane, the degree of alignment between the vehicle and the lane direction, and the current speed of the vehicle, the following reward function is designed:
[0012]
[0013] Where, v is the current speed of the vehicle, v min and v max is the minimum and maximum speed of the vehicle, v target is the target speed, p is the penalty reward when the agent violates the rules or the speed exceeds the maximum speed; d norm is the offset distance between the center of the vehicle and the center of the lane, as shown in the following formula:
[0014]
[0015] Among them, d norm The offset distance between the center of the vehicle and the center of the lane, d max is the maximum offset distance, d norm Convert the distance value into a score so that positions closer to the lane center have higher scores and positions farther from the lane center have lower scores;
[0016] ξ rew is the degree of alignment between the vehicle and the lane direction, as shown in the following formula:
[0017]
[0018] Among them, ξ rew The degree of alignment of the vehicle with the lane direction, ξ diff is the angle difference between the vehicle's forward vector and the current path point's forward vector; ξ max The maximum angle between the vehicle's forward vector and the current path point's forward vector. When this angle threshold is exceeded, the reward value becomes zero.
[0019] Ω(o|s t ,a t ) is the observation probability, O is the observation space, γ is the discount factor, γ∈(0.1);
[0020] The agent is based on the current state s t and strategy π(a t |s t ) to select action a t , and interact with the environment; at the current time t, the agent performs action at, according to the state transition probability P(s t+1 |s t ,a t )Get the next state st +1 , and obtain the immediate reward R according to the reward function R t ;
[0021] Step 2: Use the proximal policy optimization algorithm to train the deep reinforcement learning agent;
[0022] Using the PPO-Clip algorithm as the benchmark algorithm, the objective function for training the deep reinforcement learning agent policy network is as follows:
[0023]
[0024] Among them, L clip (θ) is the PPO-Clip loss function used to limit the range of policy updates, θ represents the parameters of the current policy network, represents the expected return obtained by the agent in a cycle τ of interaction with the environment, ∈ is a constant, ω t (θ) is the importance sampling ratio, A(s t ,a t ) is the advantage function, and the clip function limits the input value to [1-∈, 1+∈] in order to avoid overly aggressive strategy updates due to large changes in probability ratios;
[0025] Value loss function:
[0026]
[0027] Among them, L value (φ) is the value function loss, which is used to measure the estimation error of the value function, V φ (s t ) represents the value network estimated at state s t The value of is the target value;
[0028] The overall objective function for training a deep reinforcement agent is:
[0029] L PPO (θ) = E t [L clip (θ)-c1·L value (φ)+c2·H(πθ (s t ))]
[0030] Among them, E t represents the expected value at time step t, H(π θ (s t )) represents the strategy entropy, which is used to encourage the exploration of the strategy; c1 and c2 are weight coefficients;
[0031] Step 3: Evaluate the stability of the vehicle's behavior and add a safety constraint penalty function to the overall objective function of training the reinforcement learning agent policy network to constrain the agent's behavior;
[0032] Step 3.1: Dynamically evaluate the stability of vehicle behavior according to the EWMA method;
[0033] EWMA application expression based on autonomous driving action space:
[0034] m t =βm t-1 +(1-β)(a t 2 )
[0035] Among them, a t is the action taken by the agent at time t, m t is the EWMA value of the action at time t, β is the attenuation factor of EWMA, 0<β<1;
[0036] Calculate the safety threshold as shown in the following formula:
[0037]
[0038] Among them, the safety threshold δ is the mean of the sum of squares of action vectors in the EWMA window; ewma_window is the size of the EWMA window, that is, the number of sums of squares of action vectors recorded in the most recent period of time;
[0039] When the system's action value exceeds this threshold, the adaptive penalty mechanism will intervene to increase the loss, reduce the possibility of the action being selected in the future, and prevent potential unsafe behaviors from occurring, thereby ensuring that the autonomous driving operation is always carried out within a safe and controllable range, maintaining the stability and safety of the overall driving process;
[0040] Step 3.2: Based on PPO-Clip loss function L clip The difference between (θ) and the safety threshold constructs an adaptive safety constraint penalty function:
[0041]
[0042] Among them, θ′ represents the parameters of the previous strategy, which is used to calculate the difference in advantage function between the current strategy and the previous strategy to evaluate the effect of the strategy network update;
[0043] Finally, the safety constraint penalty function penalty is added to the overall objective function of training the deep reinforcement agent to constrain the behavior of the agent. The adaptive penalty strategy combined with the loss function is shown in the following formula:
[0044] L penalty (θ) = L clip (θ)+c1·L value (φ)-c2·H(π θ (s t ))+λ·penalty
[0045] Among them, λ is the weight of the penalty term, which is a fixed value and is used to adjust the coefficient of the weight between the loss function and the penalty function;
[0046] Step 4: Use the "expert model" to guide the policy network learning to improve the learning efficiency and policy performance of the policy network;
[0047] Design a network structure based on expert guidance mechanism, which includes two neural networks: one is an expert network and the other is a policy network; the expert network is responsible for extracting the feature vector φ(s t ) generates expert action information and provides this information to the policy network to provide action guidance, thereby adjusting the parameters of the policy network to improve decision quality;
[0048] The input φ(s) of the expert network and the policy network t ) is the state feature vector, and the network architecture consists of fully connected layers;
[0049] The strategy network architecture consists of four fully connected layers; the expert network architecture consists of five fully connected layers and has more neurons than the strategy network; the number of neurons in the last fully connected layer of the strategy network and the expert network is the size of the action space a dim , and uses the hyperbolic tangent tanh as the activation function, allowing the output to represent a wide range of potential decisions;
[0050] The expert network and the policy network both standardize the action outputs of the action space to a reasonable and bounded interval;
[0051] The set strategy network is expressed as: π(a t φ(s t );θ policy );
[0052] The expert network is expressed as: π'(aexpert,t φ(s t );θ expert );
[0053] Among them, a expert,t is an expert action; a t is the action output by the policy network; φ(s t ) is the state feature vector; strategy π is about action a t Given a state s t The conditional probability distribution of the expert strategy π' is about the expert action a expert,t Given a state s t The conditional probability distribution of θ policy is the parameter set of the policy network; θ expert The set of parameters of the expert network;
[0054] In order to make the policy network learn to imitate the expert network, a new objective function is defined, using KL divergence to measure the difference between the policy network output action and the expert action:
[0055] J(θ)=E s~S [D KL (π'(a expert,t φ(s t );θ expert )π(a t φ(s t );θ policy ))]
[0056] For autonomous driving, it belongs to the continuous action space:
[0057]
[0058] Among them, s~S represent the sampling state from the environment state distribution; action a traverses all possible action spaces, and when calculating the KL divergence, the difference between the probability given by the expert strategy and the probability given by the parameterized strategy at each action a is calculated;
[0059] The goal of training the policy network is to minimize the loss function, that is, to reduce the difference between the policy network output and the expert model output, as shown in the following formula:
[0060] L Clone =argmin θ J(θ)
[0061] Among them, L Clone The cloning loss is to push the agent to be closer to the expert's behavior by comparing the agent's actions with the expert's actions;
[0062] In this way, the policy network learns to imitate the action decisions of the expert model, thereby not directly optimizing the cumulative reward, but rather serving as a supervisory signal that influences the learning process of the policy network through example actions and cloning loss;
[0063] The final objective function for training a deep reinforcement learning agent is:
[0064] L total (θ) = L clip (θ)+c1·L value (φ)-c2·H(π θ (s t ))+λ·penalty+μ·L Clone
[0065] Among them, μ is the clone weight, which is a fixed value.
[0066] The beneficial effect of adopting the above technical solution is that the unmanned driving safety control method provided by the present invention can learn in real time and make efficient decisions in complex dynamic environments by integrating advanced deep neural networks and reinforcement learning technology. In addition, the addition of a safety constraint mechanism ensures that the behavior of the intelligent agent is carried out within a safe range, and the introduction of an expert network is to provide experienced decision support, so that the entire method can reach higher standards in terms of safety and decision-making efficiency. The design of this method emphasizes real-time and adaptability to meet the requirements for speed and accuracy in different application scenarios, while optimizing strategies through continuous learning to adapt to the constant changes in the environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 A flowchart of an unmanned driving safety control method provided by an embodiment of the present invention;
[0068] Figure 2 A schematic diagram of intermediate waypoints provided by an embodiment of the present invention;
[0069] Figure 3 A schematic diagram of vehicle exterior characteristic indicators provided by an embodiment of the present invention;
[0070] Figure 4 A schematic diagram of an autonomous driving Markov decision process provided by an embodiment of the present invention;
[0071] Figure 5 A schematic diagram of expected rewards provided by an embodiment of the present invention;
[0072] Figure 6 Schematic diagram of the PPO-CLIP benchmark algorithm provided by an embodiment of the present invention;
[0073] Figure 7A schematic diagram of a behavior constraint process provided by an embodiment of the present invention;
[0074] Figure 8 A schematic diagram of a tutor guidance mechanism provided by an embodiment of the present invention;
[0075] Fig. 9 This is a diagram of the expert guidance network architecture provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0076] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0077] This embodiment is based on the Carla simulation environment and adopts an unmanned driving safety control method of the present invention to realize unmanned driving simulation safety control.
[0078] In this embodiment, an unmanned driving safety control method is provided. Figure 1 As shown, the following steps are included:
[0079] Step 1: Construct an unmanned driving system control model based on the Markov decision process;
[0080] Markov decision process (MDP) is a theoretical foundation of reinforcement learning, which provides a framework to describe the process of intelligent agents making decisions in uncertain environments. In the context of autonomous driving, MDP can be used to model the decision-making process of vehicle control, where each state can be represented as the vehicle's position, speed, and information about the surrounding environment, and the action can be different driving operations such as acceleration, deceleration, or steering. The reward function gives positive or negative feedback based on the vehicle's behavior to guide the vehicle to drive safely and efficiently.
[0081] The unmanned driving system is modeled as a deep reinforcement learning agent. The agent learning process is represented as a Markov decision process (MDP) consisting of a seven-tuple (S, A, P, R, Ω, O, γ).
[0082] Where S represents the state space, {s1,s2,...,s t} is a set of environmental states, representing the information of the autonomous vehicle and its surroundings; in the Carla simulation platform, the state input of the agent includes the image information collected by the vehicle's front camera and the vehicle's external features;
[0083] The external features include current speed, last steering value, throttle, distance from the track, and direction of the vehicle relative to the lane forward vector;
[0084] Waypoints are an important factor in defining the vehicle path in autonomous driving research, including position and direction information, as well as how to calculate intermediate waypoints to ensure a smooth path. Figure 2 shown.
[0085] In this embodiment, the external features used as state input in this embodiment are as follows: Figure 3 As shown, it includes the current speed, the last steering value, the throttle, the distance from the track, and the direction of the vehicle relative to the lane forward vector. These features are described as follows:
[0086] Throttle: represents the acceleration of the vehicle, and the range is [-1.0,1.0].
[0087] Current Speed: The vehicle's current speed is expressed in kilometers per hour (km / h).
[0088] Previous Steer: The steering value is determined by the vehicle's steering operation at the previous moment. Its value range is [-1.0, 1.0].
[0089] Distance from Waypoint: The signed vertical distance of the vehicle relative to the optimal waypoint trajectory provides information about the vehicle's position. This value increases if the vehicle deviates from the trajectory;
[0090] Waypoint Orientation: It is the angle between the vehicle's forward vector and the waypoint's forward vector.
[0091] A is the action space, {a1,a2,...,a t} is the action set, which represents all actions taken by the vehicle, including acceleration, deceleration, and turning;
[0092] P(s t+1 |s t ,a t ) is the state transition probability, which means that after executing action at in state st, the state is transferred to st +1 The probability distribution of
[0093] R is the reward function, which represents the immediate reward value obtained after executing the action; considering the offset distance between the center of the vehicle and the center of the lane, the degree of alignment between the vehicle and the lane direction, and the current speed of the vehicle, the following reward function is designed:
[0094]
[0095] Where, v is the current speed of the vehicle, v min and v max is the minimum and maximum speed of the vehicle, v target is the target speed, p is the penalty reward when the agent violates the rules or the speed exceeds the maximum speed; d norm is the offset distance between the center of the vehicle and the center of the lane, as shown in the following formula:
[0096]
[0097] Among them, d norm The offset distance between the center of the vehicle and the center of the lane, d max is the maximum offset distance, d norm Convert the distance value into a score so that positions closer to the lane center have higher scores and positions farther from the lane center have lower scores;
[0098] ξ rew is the degree of alignment between the vehicle and the lane direction, as shown in the following formula:
[0099]
[0100] Among them, ξ rew The degree of alignment of the vehicle with the lane direction, ξ diff is the angle difference between the vehicle's forward vector and the current path point's forward vector; ξ max It is the maximum angle between the vehicle's forward vector and the current path point's forward vector. When this angle threshold is exceeded, the reward value becomes zero.
[0101] In the designed reward function, the current speed v of the vehicle is expressed in kilometers per hour (km / h). In order to obtain the maximum reward, we set a speed range, v min and v max are the minimum and maximum speeds, v target is the target speed. When the speed is between the target speed and the minimum speed, it will receive the highest reward. When the speed is less than the minimum speed or greater than the target speed and less than the maximum speed, the reward will be reduced. In this embodiment, when the agent violates the rules or the speed exceeds the maximum speed, a -10 reward is designed to punish the agent's improper behavior.
[0102] Ω(o|s t ,a t ) is the observation probability, O is the observation space, γ is the discount factor, γ∈(0.1);
[0103] The agent is based on the current state s t and strategy π(a t |s t ) to select action at , and interact with the environment; at the current time t, the agent performs action at, according to the state transition probability P(s t+1 |s t ,a t )Get the next state st +1 , and obtain the immediate reward R according to the reward function R t ;
[0104] In this embodiment, the Markov decision process of autonomous driving is as follows: Figure 4 As shown, through interaction with the environment, the agent tries to learn an optimal strategy to maximize the cumulative reward, that is, to achieve optimal control.
[0105] Step 2: Use the proximal policy optimization algorithm to train the deep reinforcement learning agent;
[0106] The policy gradient theorem states that the gradient of the policy parameter θ can be estimated by the following expectation:
[0107]
[0108] Among them, J θ is the objective function (usually expected return), π θ is a strategy with parameter θ, γ is a discount factor, R(t) represents the cumulative return obtained by the agent and the environment at time t, and the expected reward is Figure 5 As shown, Represents a trajectory.
[0109] PPO-Clip adopts a more simplified approach and introduces a clipping function. Therefore, Figure 6 The PPO-Clip algorithm shown is used as the benchmark algorithm. The objective function for training the deep reinforcement learning intelligent policy network is as follows:
[0110]
[0111] Among them, L clip (θ) is the PPO-Clip loss function used to limit the range of policy updates, θ represents the parameters of the current policy network, represents the expected return obtained by the agent in a cycle τ of interaction with the environment, ∈ is a constant, ω t (θ) is the importance sampling ratio, A(s t ,a t ) is the advantage function, and the clip function limits the input value to [1-∈, 1+∈] in order to avoid overly aggressive strategy updates due to large changes in probability ratios;
[0112] Value loss function:
[0113]
[0114] Among them, L value (φ) is the value function loss, which is used to measure the estimation error of the value function, V φ (s t ) represents the value network estimated at state s t The value of is the target value;
[0115] The overall objective function for training a deep reinforcement agent is:
[0116] L PPO (θ) = E t [L clip (θ)-c1·L value (φ)+c2·H(π θ (s t ))]
[0117] Among them, E t represents the expected value at time step t, H(π θ (s t )) represents the strategy entropy, which is used to encourage the exploration of the strategy; c1 and c2 are weight coefficients;
[0118] The policy entropy H(π θ (s t )) is added to the loss function. One of the main benefits is that it makes the output of the model more probabilistic, which helps to improve the robustness and generalization ability of the model. c1 and c2 are weight coefficients, which respectively control the contribution of the error term of the value function and the policy entropy to the overall objective function.
[0119] Step 3: Evaluate the stability of the vehicle's behavior and add a safety constraint penalty function to the overall objective function of training the deep reinforcement learning agent policy network to constrain the agent's behavior, such as Figure 7 As shown;
[0120] Step 3.1: Dynamically evaluate the stability of vehicle behavior according to the EWMA method;
[0121] Exponential Weighted Moving Average (EWMA) is a sequence data smoothing technique that gives more weight to recent data than a simple moving average (SMA), making it more effective in capturing the latest trends. This method is particularly useful in scenarios that require a quick response to recent changes, such as financial market analysis, weather forecasting, and research on autonomous driving systems.
[0122] In the design of the autonomous driving system, the EWMA model with a properly set weight coefficient can sensitively capture the real-time changes in vehicle behavior. This weight distribution mechanism not only effectively reveals the instantaneous fluctuations in driving behavior, but also smoothes outliers in historical data. Since this mechanism reduces the impact of trend changes on the evaluation results, it effectively alleviates the randomness problem of the PPO (Proximal Policy Optimization) algorithm in action decision-making and avoids dangerous behaviors that the autonomous driving system may take. Therefore, the EWMA model provides a more stable and reliable behavior evaluation benchmark for the autonomous driving system.
[0123] EWMA application expression based on autonomous driving action space:
[0124] m t =βm t-1 +(1-β)(a t 2 )
[0125] Among them, a t is the action taken by the agent at time t, m t is the EWMA value of the action at time t, β is the attenuation factor of EWMA, 0<β<1;
[0126] The EWMA retains a certain degree of historical information. This is useful for assessing the safety of current actions because it takes into account the average of past actions rather than just a single data point.
[0127] The purpose of calculating EWMA using the square of the action value is to nonlinearly amplify larger action values and highlight those actions that may lead to unstable or unsafe behavior. This calculation method not only amplifies the energy effect of the action, but also eliminates the influence of directionality, that is, it emphasizes positive and negative aggressive actions equally. In addition, the square of the action value helps to reduce the noise of small actions and only emphasize those important outliers, while maintaining the continuity and smoothness of the derivative in mathematical processing, which is beneficial to the stability and convergence of the algorithm.
[0128] Calculate the safety threshold as shown in the following formula:
[0129]
[0130] Among them, the safety threshold δ is the mean of the sum of squares of action vectors in the EWMA window; ewma_window is the size of the EWMA window, that is, the number of sums of squares of action vectors recorded in the most recent period of time;
[0131] The safety threshold is a criterion formed by dynamically evaluating the stability of the vehicle's recent behavior based on the EWMA method and normalizing it with the set time window. This safety threshold not only reflects the system's sensitivity to immediate actions, but can also be adaptively adjusted according to different driving environments and system performance. When the system's action value exceeds this threshold, the adaptive penalty mechanism will intervene to increase the loss and reduce the possibility of the action being selected in the future, preventing potential unsafe behaviors from occurring, thereby ensuring that autonomous driving operations are always carried out within a safe and controllable range, maintaining the stability and safety of the overall driving process.
[0132] The safety threshold δ is adaptively changed according to the action. This allows the agent to better adapt to a variety of different driving environments and tasks. For example, when driving on a highway, the definition of the safety threshold may be different from that in urban traffic. Adaptivity can help the autonomous driving system adjust the threshold according to the action, so that the agent can better generalize and adapt in new environments. This allows the algorithm to adapt to different situations and enhances the generalization performance of the algorithm.
[0133] Step 3.2: Based on PPO-Clip loss function L clip The difference between (θ) and the safety threshold constructs an adaptive safety constraint penalty function:
[0134]
[0135] Among them, θ′ represents the parameters of the previous strategy, which is used to calculate the difference in advantage function between the current strategy and the previous strategy to evaluate the effect of the strategy network update;
[0136] The purpose of using the max function is to ensure that the safety penalty will not be negative. clip If the difference between (θ) and the safety threshold is positive, it will return L clip (θ) and the safety threshold, otherwise it will return zero. This ensures that the safety penalty is always non-negative, because its purpose is to encourage policy updates to stay within the safety threshold δ, and if the policy update is outside this range, it will be penalized. Doing so ensures that new policy updates do not lead to overly aggressive policy changes, helping to maintain the stability and safety of training.
[0137] Finally, the safety constraint penalty function penalty is added to the overall objective function of training the deep reinforcement agent to constrain the behavior of the agent. The adaptive penalty strategy combined with the loss function is shown in the following formula:
[0138] L penalty (θ) = L clip (θ)+c1·L value (φ)-c2·H(πθ (s t ))+λ·penalty
[0139] Among them, λ is the weight of the penalty term, which is a fixed value and is used to adjust the coefficient of the weight between the loss function and the penalty function. By combining the penalty function with the loss function, a strategy optimization framework that comprehensively considers incentives, exploration, and constraints can be formed, which not only pursues performance optimization, but also ensures that the constraints are met.
[0140] By introducing a penalty function to constrain the update of the strategy, the potential risk of the agent to the environment during the learning process can be reduced. The agent will weigh the relationship between safety and reward when considering actions. This can prompt the agent to choose actions more carefully to avoid exceeding the safety range, thereby optimizing performance while maintaining safety.
[0141] Step 4: Use the "expert model" to guide the policy network learning to improve the learning efficiency and policy performance of the policy network;
[0142] An important way for humans to learn is by learning from experts, which helps improve learners' understanding and speed up their learning. However, the PPO algorithm uses a convolutional neural network to extract image features and maps the features to the probability distribution of actions through a fully connected layer. Such a neural network essentially outputs a reactive strategy that relies on the current state of the environment to make decisions. In the absence of expert guidance, the agent learns only by interacting with the environment, so there are problems with low algorithm efficiency and poor transferability. Especially in autonomous driving, when the environmental information is partially considerable and the rewards are sparse, the agent cannot make effective decisions.
[0143] To this end, the present invention proposes an expert action guide (EAG) method, which draws on the idea of imitation learning and guides policy network learning through a high-performance "expert model", aiming to improve learning efficiency and policy performance. The present invention constructs a deep reinforcement learning framework, which includes two key components: one is a deep network model as an expert guide, and the other is a policy network that needs to be trained. The expert model is a deeper network with more neurons, which can obtain more complex strategies and behavior sequences from environmental state characteristics and output high-quality action guidance. The policy network is relatively simple, and its purpose is to optimize its decision-making process by imitating the actions of experts.
[0144] The PPO algorithm is a method that minimizes the loss function by selecting actions that are suitable for the training environment, thereby learning an excellent strategy in a given environment. Although this strategy can show good performance on the training set, it often shows low data efficiency and transferability when facing an environment that has never been encountered. In order to use data more efficiently based on the existing state information and select the most suitable actions for the training environment to improve the decision-making ability of the intelligent agent, the present invention proposes a network structure based on an expert guidance mechanism, which includes two neural networks: one is an expert network (expert net) and the other is a policy network (actor net); the expert network is responsible for selecting the feature vector φ(s t ) and provide this information to the policy network to provide action guidance, thereby adjusting the parameters of the policy network to improve the quality of decision-making. This method aims to enhance the performance of the model when dealing with unknown environments by combining expert knowledge with learning strategies, thereby solving the problems of low data utilization and poor transferability of the traditional PPO algorithm.
[0145] In this embodiment, Figure 8 , 9 As shown, the input φ(s t ) is the state feature vector, and the network architecture is composed of fully connected layers. The similarity of the structure enables the policy network to directly learn to imitate the expert's actions, thereby effectively reducing unnecessary perturbations in learning. The policy network architecture is designed to consist of four fully connected layers, with sizes of 500, 300, 100, and a respectively. dim ;
[0146] However, the network structure of the expert network is deeper than that of the policy network and has more neurons. The network structure sizes are 1000, 600, 300, 100 and a dim , which gives it more parameters to represent potential strategies. This means that the expert network can represent more complex functional relationships, learn more complex strategies and behavior sequences, and is close to the task space, which is particularly useful for solving tasks that require advanced policy reasoning and long-term planning for autonomous driving. dim is the size of the action space, generating corresponding action outputs according to different state feature information; the policy network and the expert network use hyperbolic tangent tanh as the activation function, allowing the output to represent a wide range of potential decisions;
[0147] The expert MLP is designed as a large, deep neural network model. After the pre-training data is collected, cleaned, and pre-processed, it can achieve a high level of performance on autonomous driving tasks. Its output behavior is considered "expert-level", so it can be used as a benchmark to guide the learning of the policy network. The expert network usually does not continue to learn in the same training process as the actor network. Its role is more like a fixed coach or instructor. The expert MLP is designed to have a similar structure to the policy MLP. The similarity of the structure enables the policy network to directly learn to imitate the expert's actions, thereby effectively reducing unnecessary perturbations in learning. However, the network structure of the expert network is deeper than that of the policy network, and it has more neurons, which gives it more parameters to represent potential policies. This means that the expert network can represent more complex functional relationships, learn more complex strategies and behavior sequences, and is close to the task space, which is particularly useful for solving tasks that require advanced policy reasoning and long-term planning for autonomous driving. After sufficient pre-training, it often performs better in unseen environmental states because it can learn a wider range of patterns and laws from the training data, thus having good generalization ability.
[0148] The strategy network has a relatively simple structure, which can improve its operation speed and response time, which is very important for autonomous driving application scenarios that require real-time decision-making. By observing and imitating the behavior of the expert network, the actor network can gradually learn to perform complex tasks while maintaining a relatively fast speed.
[0149] The expert network is specially designed to assist in training the policy network. It does not interact with the environment online directly with the policy network, but is trained on offline data.
[0150] Fixing the weights ensures that the policy network is guided consistently throughout training. This helps maintain a certain level of exploration without becoming overly dependent on example actions from the teacher network.
[0151] When dealing with continuous autonomous driving action spaces, normalizing the agent’s action output to a reasonable, bounded interval makes it suitable for further action sampling. dim Usually represents the dimension of the action vector, that is, the number of actions that can be taken in each state. For each action i, it ranges from 1 to a dim , represents each element in the action vector. Specifically, if the size of the action space a dim is n, then o is a vector containing n elements, that is, o=(o1,o2,...,o n ).
[0152] Therefore, the normalization process of the action is applied to each element of the action vector o i , as shown below:
[0153] μ i =(max(min(o i ,1),-1)+1) / 2
[0154] Among them, i represents the original, unscaled action mean, and μ i is the adjusted action mean, applicable to the range of each specific action. dim , which means that each action element o i All are processed by the same normalization formula and scaled to the interval [0,1]. Each action element o i After normalization, the specific values of will conform to the normalized range [0,1].
[0155] In the standardized formula of the above action:
[0156] Internal function min(o i ,1): This part ensures o i The value of will not exceed 1. If o i If it is greater than 1, the function limits it to 1; otherwise, it keeps its original value. This prevents the action value from being too high and exceeding the upper limit of the allowed action space.
[0157] External function max(result,-1): Next, the result of the previous step is sent to this step. This function ensures that the processed value will not be less than -1. If the result of the internal function is less than -1, this step raises it to -1; otherwise, it remains unchanged. This is equivalent to setting a lower limit for the action value.
[0158] Final adjustment (result+1): Finally, the result of the previous step is added with 1 and then divided by 2. This conversion maps the original range [-1,1] to [0,1]. This is because after adding 1, the original -1 becomes 0 and the original 1 becomes 2; then dividing by 2 converts this range to [0,1]. This process completes the original output o i Adjust to a new value μ within the range i , to meet specific range of motion requirements.
[0159] In this embodiment, the strategy network is set as: t φ(s t );θ policy ); the expert network is expressed as: π'(a expert,t φ(s t );θ expert);
[0160] Among them, a expert,t is an expert action; a t is the action output by the policy network; φ(s t ) is the state feature vector; strategy π is about action a t Given a state s t The conditional probability distribution of the expert strategy π' is about the expert action a expert,t Given a state s t The conditional probability distribution of θ policy is the parameter set of the policy network; θ expert The set of parameters of the expert network;
[0161] The policy network and the expert network output two probability distribution models, and the KL divergence is an asymmetric indicator that measures the difference between two probability distributions. Therefore, we use the KL divergence to measure the difference between the two.
[0162] In order to make the policy network learn to imitate the expert network, a new objective function is defined, using KL divergence (Kullback-Leibler divergence) to measure the difference between the policy network output action and the expert action:
[0163] J(θ)=E s~S [D KL (π'(a expert,t φ(s t );θ expert )π(a t φ(s t );θ policy ))]
[0164] For autonomous driving, it belongs to the continuous action space:
[0165]
[0166] Among them, s~S represent the sampling state from the environment state distribution; action a traverses all possible action spaces, and when calculating the KL divergence, the difference between the probability given by the expert strategy and the probability given by the parameterized strategy at each action a is calculated;
[0167] The goal of training the policy network is to minimize the loss function, that is, to reduce the difference between the policy network output and the expert model output, as shown in the following formula:
[0168] L Clone =argmin θ J(θ)
[0169] Among them, L CloneThe cloning loss is to push the agent to be closer to the expert's behavior by comparing the agent's actions with the expert's actions;
[0170] In this way, the policy network learns to imitate the action decisions of the expert model, thereby not directly optimizing the cumulative reward, but rather serving as a supervisory signal that influences the learning process of the policy network through example actions and cloning loss;
[0171] The final objective function for training a deep reinforcement learning agent is:
[0172] L total (θ) = L clip (θ)+c1·L value (φ)-c2·H(π θ (s t ))+λ·penalty+μ·L Clone
[0173] Where μ is the cloning weight, which is a fixed value. Set the cloning weight to a fixed value. This means that the impact of the expert actions output by the expert network on optimizing the agent actions is constant throughout the training process, which can make the training process more stable. Because the cloning weights do not change over time or as training progresses, the agent does not need to adapt to changing weights, which helps reduce training instability.
[0174] In this embodiment, for the unmanned driving safety control method of the present invention, an unmanned driving simulation system is built to realize unmanned driving simulation control, including the following parts:
[0175] 1. System environment initialization
[0176] In the initial stage of system construction, the Carla simulation environment is first selected for training and testing the agent. This environment needs to be able to provide sufficient information and feedback so that the agent can learn and optimize its behavior through interaction with the environment. Next, set preliminary parameters for the policy network and value network. The selection and initialization of these parameters are key factors affecting the learning effect. At the same time, the Adam optimizer is selected as the main optimization tool. Its adaptive learning rate adjustment function is very suitable for handling large-scale and complex parameter update tasks. Through the reasonable configuration of these steps, it can be ensured that the system achieves optimal performance in subsequent training and practical applications.
[0177] 2. Observation and Data Processing
[0178] After the system is configured, continuous observation of the environment will be started to collect the necessary data to drive the learning process. This data includes image data fed back by the camera and some defined external feature indicators. The collected data will be cached and preprocessed in real time to meet the needs of subsequent batch learning. Effective management and processing of data is the key to ensuring learning efficiency and decision quality. Therefore, an efficient data processing process is required to ensure data quality and availability. In addition, proper cleaning and normalization of the data can improve the accuracy and generalization ability of model training.
[0179] 3. Policy Execution and Security Management
[0180] In the strategy execution phase, the agent will make action decisions based on the current strategy and the collected environmental information. In order to ensure the safety of operations, the system introduces the concept of dynamic safety thresholds, which dynamically adjusts the safety boundary based on the current environment and historical behavior data to prevent potential dangerous behaviors. At the same time, the guidance provided by the expert system is not only based on empirical rules, but may also include insights obtained through data analysis, which are used to optimize and adjust the decision logic of the agent. In this way, the system can continuously optimize its strategy and improve the accuracy and efficiency of decision-making while ensuring safety.
[0181] 4. Learning and Optimization
[0182] The agent continuously learns and adjusts in the process of executing the strategy to adapt to changes in the environment and improve the quality of decision-making. By calculating the advantage value of each action, the system can identify which actions are more likely to lead to positive results, thereby guiding the update of the strategy. In addition, the batch processing method is used to update the policy and value function parameters, which can effectively utilize the accumulated data to improve the learning efficiency. To avoid the gradient explosion problem during training, the system will also perform gradient clipping. In addition, the optional linear annealing strategy can be used to gradually reduce the learning rate to improve the stability and reliability of the strategy in the later stages of learning.
[0183] 5. Performance Evaluation and Iteration
[0184] Regular evaluation of the system's performance is key to ensuring its continued effective operation. Comprehensive testing is performed in the Carla simulation environment to evaluate the agent's decision-making quality and ability to cope with complex situations, and to verify the effectiveness of the method. Based on these test results and feedback from domain experts, the strategy is iteratively optimized, and system parameters are continuously adjusted and optimized to adapt to environmental changes and the evolution of application requirements.
[0185] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.
Claims
1. An unmanned driving safety control method, characterized in that: The following steps are involved: Step 1: Construct an unmanned driving system control model based on the Markov decision process; Step 2: Use the proximal policy optimization algorithm to train the deep reinforcement learning agent; Step 3: Evaluate the stability of the vehicle’s behavior and add a safety constraint penalty function to the overall objective function of training the deep reinforcement learning agent to constrain the agent’s behavior. Step 4: Use the "expert model" to guide the strategy network learning to improve the learning efficiency and strategy performance of the intelligent agent.
2. The unmanned driving safety control method according to claim 1, characterized in that: The step 1 models the unmanned driving system as a reinforcement learning agent, and represents the reinforcement learning process as a Markov decision process consisting of a seven-tuple (S, A, P, R, Ω, O, γ); Where S represents the state space, {s1,s2,...,s t } is a set of environmental states, representing the information of the autonomous vehicle and its surroundings; A is the action space, {a1,a2,...,a t } is the action set, which represents all actions taken by the vehicle, including acceleration, deceleration, and turning; P(s t+1 |s t ,a t ) is the state transition probability, representing the state s t Next, perform action a t Then transfer to state s t+1 The probability distribution of R is the reward function, which represents the immediate reward value obtained after executing the action; Ω(o|s t ,a t ) is the observation probability, O is the observation space, γ is the discount factor, γ∈(0.1); The agent is based on the current state s t and strategy π(a t |s t ) to select action a t , and interact with the environment; at the current time t, the agent performs action a t , according to the state transition probability P(s t+1 |s t ,a t ) Get the next state s t+1 , and obtain the immediate reward R according to the reward function R t .
3. The unmanned driving safety control method according to claim 2, characterized in that: The state input of the intelligent agent includes environmental feature information collected by the vehicle's front camera and the vehicle's own state feature information; the vehicle's own state feature information includes current speed, last steering value, throttle, distance from the trajectory, and the direction of the vehicle relative to the lane forward vector.
4. The unmanned driving safety control method according to claim 2, characterized in that: The step 1 considers the offset distance between the center of the vehicle and the center of the lane, the degree of alignment between the vehicle and the lane direction, and the current speed of the vehicle, and designs the following reward function: Where, v is the current speed of the vehicle, v min and v max is the minimum and maximum speed of the vehicle, v target is the target speed, p is the penalty reward when the agent violates the rules or the speed exceeds the maximum speed; d norm is the offset distance between the center of the vehicle and the center of the lane, as shown in the following formula: Among them, d norm The offset distance between the center of the vehicle and the center of the lane, d max is the maximum offset distance, d norm Convert the distance value into a score so that positions closer to the lane center have higher scores and positions farther from the lane center have lower scores; ξ rew is the degree of alignment between the vehicle and the lane direction, as shown in the following formula: Among them, ξ rew The degree of alignment of the vehicle with the lane direction, ξ diff is the angle difference between the vehicle's forward vector and the current path point's forward vector; ξ max It is the maximum angle between the vehicle's forward vector and the current path point's forward vector. When this angle threshold is exceeded, the reward value becomes zero.
5. The unmanned driving safety control method according to claim 4, characterized in that: The step 2 uses the PPO-Clip algorithm as the benchmark algorithm, and the objective function of training the deep reinforcement learning intelligent strategy network is as follows: Among them, L clip (θ) is the PPO-Clip loss function used to limit the range of policy updates, θ represents the parameters of the current policy network, represents the expected return obtained by the agent in a cycle τ of interaction with the environment, ∈ is a constant, ω t (θ) is the importance sampling ratio, A(s t ,a t ) is the advantage function, and the clip function limits the input value to [1-∈, 1+∈] in order to avoid overly aggressive strategy updates due to large changes in probability ratios; Value loss function: L value (φ)=||V φ (s t )-V t target || 2 Among them, L value (φ) is the value function loss, which is used to measure the estimation error of the value function, V φ (s t ) represents the value network estimated at state s t The value of V t target is the target value; The overall objective function for training a deep reinforcement agent is: L PPO (θ)=E t [L clip (θ)-c1·L value (φ)+c2·H(π θ (s t ))] Among them, E t represents the expected value at time step t, H(π θ (s t )) represents the strategy entropy, which is used to encourage the exploratory nature of the strategy; c1 and c2 are both weight coefficients.
6. The unmanned driving safety control method according to claim 5, characterized in that: The specific method of step 3 is: Step 3.1: Dynamically evaluate the stability of vehicle behavior according to the EWMA method; EWMA application expression based on autonomous driving action space: m t =βm t-1 +(1-b)(a) t 2 ) Among them, a t is the action taken by the agent at time t, m t is the EWMA value of the action at time t, β is the attenuation factor of EWMA, 0<β<1; Calculate the safety threshold as shown in the following formula: Among them, the safety threshold δ is the mean of the sum of squares of action vectors in the EWMA window; ewma_window is the size of the EWMA window, that is, the number of sums of squares of action vectors recorded in the most recent period of time; When the system's action value exceeds this threshold, the adaptive penalty mechanism will intervene to increase the loss and reduce the possibility of the action being selected in the future, preventing potential unsafe behaviors from occurring, thereby ensuring that the autonomous driving operation is always carried out within a safe and controllable range, maintaining the stability and safety of the overall driving process. Step 3.2: Based on PPO-Clip loss function L clip The difference between (θ) and the safety threshold constructs an adaptive safety constraint penalty function: Among them, θ′ represents the parameters of the previous strategy, which is used to calculate the difference in advantage function between the current strategy and the previous strategy to evaluate the effect of the strategy network update; Finally, the safety constraint penalty function penalty is added to the overall objective function of training the deep reinforcement agent to constrain the behavior of the agent. The adaptive penalty strategy combined with the loss function is shown in the following formula: L penalty (θ)=L clip (θ)+c1·L value (φ)-c2·H(π θ (s t ))+λ·penalty Among them, λ is the weight of the penalty term, which is a fixed value and is used to adjust the coefficient of the weight between the loss function and the penalty function.
7. The unmanned driving safety control method according to claim 6, characterized in that: The step 4 designs a network structure based on an expert guidance mechanism, which includes two neural networks: one is an expert network and the other is a policy network; the expert network is responsible for generating expert action information from the feature vector of the current state, and providing this information to the policy network for action guidance, thereby adjusting the parameters of the policy network to improve the decision quality; The input of the expert network and the policy network is the state feature vector, and the network architecture is composed of a fully connected layer; The strategy network architecture consists of four fully connected layers; the expert network architecture consists of five fully connected layers and has more neurons than the strategy network; the number of neurons in the last fully connected layer of the strategy network and the expert network is the size of the action space a dim , and adopts the hyperbolic tangent tanh as the activation function, allowing the output to represent a wide range of potential decisions.
8. The unmanned driving safety control method according to claim 7, characterized in that: Both the expert network and the policy network normalize the action outputs in the action space to a reasonable and bounded interval.
9. The unmanned driving safety control method according to claim 8, characterized in that: The specific method of step 4 is: The set policy network is expressed as: π(a t |φ(s t );θ policy ); The expert network is expressed as: π'(a expert,t |φ(s t );θ expert ); Among them, a expert,t is an expert action; a t is the action output by the policy network; φ(s t ) is the state feature vector; strategy π is about action a t Given a state s t The conditional probability distribution of the expert strategy π' is about the expert action a expert,t Given a state s t The conditional probability distribution of θ policy is the parameter set of the policy network; θ expert The set of parameters of the expert network; In order to make the policy network learn to imitate the expert network, a new objective function is defined, using KL divergence to measure the difference between the policy network output action and the expert action: J(θ)=E s~S [D KL (π'(a expert,t |φ(s t );i expert )||π(a t |φ(s t );i policy ))] For autonomous driving, it belongs to the continuous action space: Among them, s~S represent the sampling state from the environment state distribution; action a traverses all possible action spaces, and when calculating the KL divergence, the difference between the probability given by the expert strategy and the probability given by the parameterized strategy at each action a is calculated; The goal of training the policy network is to minimize the loss function, that is, to reduce the difference between the policy network output and the expert model output, as shown in the following formula: L Clone =arg min θ J(θ) Among them, L Clone The cloning loss is to push the agent to be closer to the expert's behavior by comparing the agent's actions with the expert's actions; In this way, the policy network learns to imitate the action decisions of the expert model, thereby not directly optimizing the cumulative reward, but rather serving as a supervisory signal that influences the learning process of the policy network through example actions and cloning loss; The final objective function for training a deep reinforcement learning agent is: L total (θ)=L clip (θ)+c1·L value (φ)-c2·H(π θ (s t ))+λ·penalty+μ·L Clone Among them, μ is the clone weight, which is a fixed value.
Citation Information
Cited By
Oil-separation cooperation strategy optimization method and system based on reinforcement learning algorithm
CN119004684A
Construction method and device of vehicle automatic driving behavior evaluation model
CN119047085A
A method and device for constructing a vehicle automatic driving behavior evaluation model
CN119047085B
Improved imitation learning control method based on Markov chain
CN119575807A
Operation speed safety control method based on reinforcement learning hybrid control strategy
CN119758838A
