Intervention Aided Reinforcement Learning for Safe and Practical Policy Optimization in Navigation

11/15/2018 ∙ by Fan Wang, et al. ∙ 0

Combining deep neural networks with reinforcement learning has shown great potential in the next-generation intelligent control. However, there are challenges in terms of safety and cost in practical applications. In this paper, we propose the Intervention Aided Reinforcement Learning (IARL) framework, which utilizes human intervened robot-environment interaction to improve the policy. We used the Unmanned Aerial Vehicle (UAV) as the test platform. We built neural networks as our policy to map sensor readings to control signals on the UAV. Our experiment scenarios cover both simulation and reality. We show that our approach substantially reduces the human intervention and improves the performance in autonomous navigation, at the same time it ensures safety and keeps training cost acceptable.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 7

page 8

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In contrast to the intense studies of deep Reinforcement Learning(RL) in games and simulations [1], employing deep RL to real world robots remains challenging, especially in high risk scenarios. Though there has been some progresses in RL based control in realistic robotics [2, 3, 4, 5], most of those previous works does not specifically deal with the safety concerns in the RL training process. For majority of high risk scenarios in real world, deep RL still suffer from bottlenecks both in cost and safety. As an example, collisions are extremely dangerous for UAV, while RL training requires thousands of times of collisions. Other works contributes to building simulation environments and bridging the gap between reality and simulation [4, 5]. However, building such simulation environment is arduous, not to mention that the gap can not be totally made up.

To address the safety issue in real-world RL training, we present the Intervention Aided Reinforcement Learning (IARL) framework. Intervention is commonly used in many automatic control systems in real world for safety insurance. It is also regarded as an important evaluation criteria for autonomous navigation systems, e.g. the disengagement ratio in autonomous driving222For details, see: Autonomous Vehicle Disengagement Reports. In this work, instead of using disruptive events such as collisions as feedbacks, we try to optimize the policy by avoiding human intervention. Though utilizing human intervention to avoid fatal mistakes in RL training has been applied to Atari games recently [6]

, our work is featured in real world applications. Besides, we propose a more general framework to take human intervention into account: We define the expression of the intervention as a combination of a unknown classifier deciding when to seize control and a reference control policy; We redefine the behavior policy as blending of the policy to be optimized and the intervention; Then we try to reduce the probability of intervention and learn from the reference policy at the same time.

In this work we are mainly interested in navigating an Unmanned Aerial Vehicle (UAV) in cluttered and unstructured environments. The agent is required to approach a specified goal at certain velocity without collision. Compared with traditional navigation, the proposed navigation policy is based on a more end-to-end architecture. The policy model takes multi-modal observations including 3D depth image, supersonic sensors, velocity, direction to the goal etc. as input and performs attitude control. We compared IARL with different learning algorithms including classic imitation learning and reinforcement learning in simulation, and tested IARL in the realistic UAV navigation task. We demonstrate that IARL learn to avoid collision nearly perfectly compared with the other baselines, even though it has never seen a single collision in the training process. In the meantime, IARL substantially reduces the human intervention more than the other methods. Furthermore, our method can be applied to various autonomous control systems in reality such as autonomous driving cars.

2 Related Works

There has been abundant works on visual navigation system[7], among which our work is closely related to map-less reactive visual navigation systems [8, 9]. Traditional reactive controllers either rely on artificially designed rules, such as boundary following, which highly adapts to specific obstacles [10, 8], or use empirical models such as Artificial Potential Fields (APF [11, 12]), which builds virtual potential fields for collision avoidance. The above works requires artificial tuning of a lot of hyper-parameters and hand-written rules. Some of those methods show competitive performance in specific scenarios, but they are not easy to be extended to unstructured scenarios.

Imitation Learning takes an important role in intelligent controllers in recent years, where policy is learned by reducing the difference between itself and a reference policy(typically the human demonstration). Among them, the supervised learning (or behavior cloning) generates the training trajectories directly from the reference policy

[13, 14]. It is relatively simple, but the performance is usually unstable due to the inconsistency between the training and testing trajectories. Ross et al. proposed the Data Aggregation(DAgger [15]) as an improvement to supervised learning, by generating trajectories with the current policy. Their subsequent work [16] successfully employed DAgger to collision-free navigation on an UAV. Yet, DAgger remains expensive, and it requires a tricky labeling process that is hard to operate in practice.

Our work is also related to recent progresses in reinforcement learning, especially the deterministic policy gradient dealing with continuous control [17, 18, 19]. We use Proximal Policy Optimization(PPO) [19]

with General Advantage Estimation 

[20](GAE) as baseline, which has been widely accepted for its robustness and effectiveness. However, most RL algorithms can not be directly deployed to the high risk scenarios due to the safety issue, thus we made the comparison in simulation only. In addition, we also use the trick of combining imitation learning and reinforcement learning to accelerate the training process, which is closely related to the previous work of [21, 22].

3 Algorithms

3.1 Backgrounds

In this part we introduce the notations as well as the representations of different benchmarking algorithms. A Markov Decision Process(MDP) is described by

, where and represent the state and action space, represents the rewards, which is typically the real number field, and represents the transition probability. We use the notation to represent the time step, where is the length of an episode. , and denote the specific state, action and reward at step . We use the notation to represent the deterministic policy that we want to optimize. We have , with representing the trainable parameters to be optimized. A more general stochastic policy is defined as a distribution over

. Usually a Gaussian distribution

is used for stochastic policy in continuous action space, which can be written as . can either be a hyper-parameter or be optimized all-together with the other trainable parameters.

Imitation Learning

. The behavior cloning is a straightforward approach in imitation learning. If we use the mean square error for the target function(loss function), it can be written as

(1)

where denotes the reference action, the notation represent the expectation over trajectories that follow policy (the behavior policy). Usually the data collection and the policy updating are separate and independent in such supervised learning process, which leads to inconsistency between training and testing. The DAgger proposed in [15] substitutes the behavior policy with to alleviate the discrepancy. We omit the loss function, as it is similar to Equation. 1.

Policy Gradient. We use the similar formulations of policy gradients as Schulman et al. [20], where the target function is written as:

(2)

There are different expressions for in Equation 2. gives the REINFORCE [23]. The Actor-Critic method [24] uses one-step temporal difference error that is given by , where represents the discounted value function on policy , and denotes the discount factor. The GAE([20] is represented by .

The calculation of mentioned above requires on-policy generation of trajectories. In case external intervention is introduced, the policy optimization in Equation 2 can not be directly applied. In the next subsection we reformulate the policy optimization paradigm with intervention.

3.2 Intervention Aided Reinforcement Learning

We assume that the expert in the IARL system is represented by , where is the possibility of intervening the system when the expert observes the agent being at state . Notice that both and is decided by the expert himself, which is not known in advance to the agent. The expert samples a decision according to at time , determining whether the agent is intervened eventually. We write the actual action as with . is regarded to be sampled from the mixed policy of the experts and the agent, which is denoted as and given by:

(3)

Note that the behavior policy (the policy under which the data is collected) in IARL is , not . In order to approximate on-policy, we optimize through the mixed policy instead of .

In order to prevent intervention, we also reshape the reward function in IARL. We treat intervention as failures, and reshape the reward by punishing the intervention with

(4)

where is a predefined hyper-parameter. Notice that all the collisions have been prevented by the expert intervention, thus the agent learns to avoid collisions only from avoiding the intervention. By replacing with and with , the derivative of policy loss in Equation 2 to is written as Equation 5. Note that any derivation of the reference policy vanishes, and we use to replace .

(5)

We can see that and if , and if . can be interpreted as a “mask” that blocks the gradient to when . For those states that , the action is intervened by and the trajectory is not determined by , thus the gradient vanishes. However, as well as cannot be directly approximated, and thus is not known exactly. We turn to use a simple approximation of . The error of the approximation is small when is close to or ; it indeed may result in large errors in other cases, but these errors turns out to be acceptable in our experiments. We rewrite the loss of IARL as:

(6)

In Equation 6 the summation is running over steps satisfying only, while the steps with are completely “masked”. Notice that the value function still backup through all states to give , thus Equation 6 tends to avoid the intervention beforehand. However, Equation 6 does not improve the performance of the policy once the intervention has taken place (e.g., when is close to 1). This is harmful to the robustness of policy , as is likely to malfunction in the states of “intervened zone”. To alleviate the defects, we introduce an additional imitation loss into Equation 6. The imitation loss matches the optimizing policy to the reference policy , which leads to:

(7)

An intuitive explanation of Equation 7 is that the first term in the right side avoids intervention beforehand, and the second term imitates the reference policy in the “intervened zone”. The hyper-parameter balances the importance of the two parts. The training process of IARL is presented in Algorithm 1. It can be easily extended to PPO, we leave those details in the supplements. We call Equation 6 IARL (No Imitation) and Equation 7 IARL (Imitation).

1:Initialize for value function , for policy and .
2:for iterations = 1,2,3,… until convergence do
3:     for episodes = 1,2,3,… until enough data collected do
4:         for t = 1,2,3,… until finished do
5:              Observe , receive from the expert
6:              if  then receive from the expert,
7:              else               
8:              Take action
9:              Receive , push the record to memory               
10:     Optimize by minimizing

for several epochs

11:     Update using Temporal Difference or Monte Carlo estimate
Algorithm 1 Intervention Aided Reinforcement Learning

4 System Setup

In order to validate IARL, we build the UAVs and the control systems in both simulation and reality. The configurations in both environments are similar to each other. In this section we briefly introduce the architecture of the control system and the neural network structure of the decision model(the policy).

4.1 Control Architecture

The overall control system includes the decision model to be optimized, two assistant Proportional-Integral-Derivative (PID) controllers and an underlying double closed loop PID controller. The input to our system includes image flows captured by binocular stereo vision, supersonic sensors in its three directions (left, right and front) and Inertial Measurement Unit(IMU).

The command of pitch and roll angle of the UAV is decided by the policy model. We use two additional controller to deal with the yaw and the thrust, which keeps the drone at a fixed height and heading angle. The central controller sends the full attitude commands to the underlying control module, which controls to the attenuators of the motor. The remote controller is able to override those commands at any time if a switch is turned on by the human expert, which corresponds to the in Algorithm 1. A sketch of the controller architecture can be found in Figure 1. The output of the policy model is calculated at a frequency of 10Hz, and the underlying controllers exports at the frequency of 400Hz.

Figure 1: Diagram of the architecture of the controllers on the drone.

4.2 Model Structure

Our model does not use raw signals as the input directly. Instead, we introduce several preprocessing steps. The IMU and stereo cameras are combined and preprocessed to generate velocities and positions as well as the depth information. We use an open-source SDK 333The boteye SDK: https://github.com/baidu/boteye. We also calculate the velocity and the direction to the goal from raw signals and use them as the observation, details of the features used can be found in the supplements.

The policy network and value network

share the same model structure but have different output and independent parameters. For each frame of depth image we apply four convolution-pooling layers. The hidden representation is then concatenated with the other features. Traditional reactive controller such as APF typically uses only observation of one single frame. However, the real system is more close to a Partially Observable MDP due to the noisy sensor signals. It is found that multiple frames of observations are helpful to reducing the noise and making up the missing information in each single observation. We build a model that is similar to the architecture reported by Hausknecht et al. 

[25]. The LSTM unit [26] is applied to encode the observations from last 2.5 seconds in order. We apply a tanh layer to restrict the output to , which corresponds to the pitch/roll angle of . The structure of the model is shown in Figure 2. We also investigated the performance of two other different models. We used a fixed dataset collected from the simulation using reference policy, which contains 1 million frames of training data and 50,000 frames of testing data. The mean square error(MSE) performance of different structures are compared: The single observation (2D convolution + MLP) gives MSE = ; Stacking multiple frames (3D convolution + MLP) gives MSE = ; Recurrent networks (2D convolution + LSTM) gives MSE = . The test result demonstrates the superiority of the proposed model structure.

Figure 2: A sketch of the policy model structure.

5 Experiments

5.1 Simulation Environments

Simulator. We use the Robot Operation System (ROS) and Gazebo 7 [27] for simulation. The drone is simulated using the open-source hector-quad-rotor package on ROS [28] . Some of the kinetic hyper-parameters are re-adjusted to match our drone in reality. An Intel Realsense sensor is attached to the simulated drone to represent the stereo vision. In the simulation, the velocity and position are directly acquired from the simulator instead of being calculated from the raw observation.

Environments. The simulation region is in scale. The drone is required to start from the start point of (m, m) and find its way to the goal on top of the region (m). The height and yaw angle of the UAV is kept unchanged. We manually designed three kinds of obstacles in Gazebo 7, including walls, walls, and buckets of diameter and height. We randomly scattered a certain amount of obstacles in the region, the scenarios without a valid inner path between the starting point and the goal is dropped. 100 different scenarios were finally generated with different random seeds. 90 of them were treated as training scenes, while the left 10 were the testing scenes.

Expert simulation. Training with real human operators in simulation is a relatively expensive choice. In order to further reduce the cost, we build a simulated expert, which gives and automatically. We use ground truth information provided by Gazebo 7 to simulate the expert, which is hidden from the agents. The details of experts simulation are left in the supplements. The simulated expert help to avoid around collision during IARL training. In order to make a fair comparison, we want the IARL agent to only learn from intervention. Thus we dropped the left collided episodes in the IARL training process.

Reward. The basic reward function for RL and IARL is set to , where is the projection of the velocity in the direction of the goal. The term of encourages the drone toward the desired goal. The term is to slow down the drone to avoid risky accelerations. The maximum reward shall be achieved if the drone moves at the speed of m/s towards the goal. The collision with any obstacle triggers the failure of an episode, which terminates the episode and gives additional punishment. If no collision is detected, the episode terminates when arriving the goal or reaching at most steps( seconds). In IARL, we use for the intervention punishment such that .

Evaluation. We perform two kinds of tests for each comparing method and each test scenario: The Normal Test evaluates by removing the external interference , is used as the criteria. The Intervention Aided Test keeps the external interference . is used as the criteria. Another criteria in Intervention Aided Test is called the intervention rate (IR), defined by

. This evaluation metric is similar to the disengagement rate evaluation in autonomous vehicle. All our evaluation results are averaged among the

test scenarios.

5.2 Methods for comparison

SL. We collect 1 million frames under policy in 90 training scenarios in advance. The policy is optimized with Adam and Equation 1 for 50 epochs. The test is performed only once.

DAgger. The behavior policy is set to . The is recorded during the training process. For every 50,000 frames, the data is collected to aggregate the current dataset. The aggregated dataset is used to train the policy using Equation 1. The optimization includes 20 epochs of training (one iteration). After each iteration we perform tests using . We run this process until 1 million frames.

RL. The RL group uses PPO ([19]) with GAE ([20]), and use collision as its feedback. Every iteration contains 10,000 frames of data and 20 epochs of training. The test is performed after each training epoch. We ran the training process up to 1 million frames.

IARL. The policy is optimized using Algorithm 1, the training trajectories include no collision. Both IARL(No Imitation) and IARL(Imitation) are tested. The periods of training and testing is kept equal to the RL group.

5.3 Simulation Results and Discussions

We compare each of the four methods in both Normal Test and Intervention Aided Test. The performance against trained frames is plotted in Figure 3. Several remarks can be made from the results. The IARL(No Imitation) group shows completely different performance with different evaluation methods: In the Intervention Aided Test where the reward and the behavior policy of the training and the testing are coherent, it achieves acceptable performance in its rewards and IR; In Normal Test where the intervention is removed, the IARL(No Imitation) group collides frequently with obstacles and results in a low performance score. On the other side, the IARL(Imitation) surpasses all the other groups in each test, especially in the IR evaluation.

We count the average collision rate (the collided cases out of 10 test scenarios) over the last 5 evaluations in the Normal Test, Tab. 1 presents the result. The IARL(Imitation) reduces its collision to 0 steadily. While the other groups suffer from occasional collision. Notice that in the Intervention Aided Test the value of IR never dropped to 0, as we found that the intervention might overreact in some cases. In other words, the expert intervenes even when the drone could have avoided collision all by itself.

We also plot the trajectories of RL, IARL(Imitation) and DAgger in Figure 4. A close look at the differences between the IARL and the other two groups shows that the IARL agent is more likely to choose a conservative trajectory. In other words, it is more likely to keep enough distance away from the obstacles, while the RL one pursues more risky trajectories for higher rewards. Besides, we can see that the DAgger and the IARL agent successfully explore a path out of a blind alley(the trajectories in the middle figure), where the RL agent fails to escape(it stops, without any collision). Nevertheless, overstepping the local optimum by exploring around is nearly impossible for reactive controllers that relies on single frame observation only.

Figure 3: Comparison of SL, DAgger, RL, IARL(No Imitation) and IARL(Imitation). (a) averaged reward in the Normal Test. (b) averaged reward in the Intervention Aided Test. (c) averaged IR in the Intervention Aided Test.
Method SL DAgger RL IARL(No Imitation) IARL(Imitation)
Average Collision 40% 24% 22.5% 42% 0%
Table 1: Average collision in Normal Test in different groups
Figure 4: Comparison of trajectories of IARL(Imitation)(Yellow Cubes), RL(Red Spheres), DAgger(Blue Crosses) in three different testing scenarios.

5.4 Experiments in Reality

Environments. The drone in real world is a X type quad-rotor helicopter with 38cm size and 1.6kg weight(Figure 5). It is equipped with Nvidia Jetson TX2 as the onboard computer, stereo vision, supersonic sensors, IMU and barometer. All computations are completed on board. For simplicity, the environment is composed of two kinds of different obstacles, which are built from foam boards, including trigonometric and square pillars(Figure 5).

Start-up Policy. In order to validate IARL in reality with more acceptable cost, we first collected 100,000 frames of expert manipulation in different cluttered scenarios. We then took advantage of the policy and the value network trained in simulation. We fine-tuned the policy on the labeled data for certain epochs. This model is further used as the start-up policy for IARL training.

IARL Training. During the training process, a human operator keeps watching on the drone and intervening with remote controller when necessary based on his own judgment. The training environments are manually readjusted randomly after several passes. Each iteration(training round) includes 5000 frames of data(around 20 passes) and 20 epochs of training. Extra 2 different scenarios are built and used for test. Similar to the evaluation in the simulations, we apply the Intervention Aided Test in the two test scenarios every 20,000 frames, but the Normal Test is not available in reality due to the safety issue.

Results. The IR in each test round is plotted in Figure 6. At the same time, we plot the average pass time(defined as the total time consumed from the start point to the goal) and average intervention time(defined as the length of time that ). It is worth mentioning that the overall performance is not as good as the simulation(where IR dropped below ). There can be two reasons: Firstly, the signals acquired from real sensors are much more noisy, especially the depth image; Secondly, there are considerable delay between the observation and the decision making, which is mainly caused by the stereo matching and visual odometer. The delay can go up to 0.3s or 0.4s. Even with those disadvantages, we can see that our model learned to substantially reduce the IR and the intervention time.

Figure 5: A close-up image of the Drone(left) and three frames during the test. The picture above is captured by external camera, the image below shows the corresponding input and output of the decision model.
Figure 6: Different evaluation criteria against the training frames in the IARL training. (a) average pass time and average intervention time. (b) IR.

6 Conclusion

In this paper, we propose the IARL framework that improves the policy by avoiding and imitating the external intervention at the same time. We successfully deploy our method to UAV platform to achieve map-less collision-free navigation in the unstructured environments. The experimental results show that IARL achieves satisfying collision avoidance and low intervention rate, and ensures safety in the training process. By looking into the future of this technique, we anticipate that IARL will serve as an effective policy optimization metric in various high risk real-world scenarios.

References

S7 Supplementary Materials

s7.1 The Value Function Approximation

In IARL, the approximation of value function is optimized by minimizing the mean square error loss in Equation 8.

(8)

There are different estimation metrics for . For example, considering the IARL paradigm, represents the Monte Carlo(MC) estimation, and represents the temporal difference estimation, where is the parameters of the target network. In this work we use n-step return estimation shown in Equation 9.

(9)

The difference between Equation 9 and the MC estimation is that we backup the value function of the last state , which is to avoid the possible bias brought by the finite horizon.

s7.2 Extending IARL(Imitation) to PPO

The policy loss of PPO based IARL is written as Equation 10. denotes the parameter from the last iteration. is dynamically controlled by another hyper-parameter . For more details please refer to [19].

(10)

s7.3 Features of Observation

At each time step, the policy and value networks take 25 frames of observation and encode the observations using LSTM unit. Each frame of observation is composed of the features listed in Table. S2

Description Dimension
Depth Images, acquired from stereo matching
Velocities in UAV body coordinate system, acquired from Visual Odometer, discretized independently in x and y directions
Distance reported by supersonic sensors, discretized
Angle of direction to the goal, discretized
Table S2: Features in each frame of observation

s7.4 Details of The Expert Simulation

Simulating experts in Gazebo 7 includes and , which represent the expert’s policy and intervention probability respectively.

: For each new scenario, we discretized the map into grids. We restrict that the UAV moves towards the neighboring 8 grids. The cost of moving to the neighboring grid is defined as the distance to the center of the grid. We then mask all the grids that intersect with the obstacles, and ran Dijkstra’s algorithm on the discretized map to acquire the cost to the goal for each grid. During each time step of the training or testing process, starting from the current position, we plan a trajectory by setting magnitude of velocity to 0.20m/s and following the direction to the grid of lowest cost. We used the next three planned positions on the current planned trajectory as the target. We defined the loss as the mean square error between the predicted positions and the target positions. We applied the Model Predictive Control to give .

: We collect a small amount of data in advance to build the simulator. Driving the UAV with a RL pre-trained policy(but not yet converged, i.e. an imperfect policy), we required the experts to keep UAV safe by intervening the UAV when necessary using keyboard in Gazebo7 simulation. We collect 50,000 frames of data. Each sample has the following features

  • The roll and pitch angle of the UAV

  • The velocity of the UAV in its body coordinate system

  • Top-10 nearest obstacles, represented by its obstacle type, and the position of the point that is closest to the UAV. The position is calculated in the UAV body coordinate system.

Each sample is labeled with

. We train a Gradient Boosting Decision Trees(GBDT) model with cross-entropy loss, which gives the

.

s7.5 Hyper-parameters

Hyper-parameter Value Description
0.96 Discount factor in RL, IARL
0.98 Exponential decay weight in generalized advantage estimation(GAE, [20]) in RL and IARL
Learning rate(policy) 1.0e-4 Adam optimizer
Learning rate(value) 1.0e-3 Adam optimizer
Mini-batch size(value and policy) 32 Mini-batch size in RL, IARL and SL
Iteration size 1.0e-3 Collect this many data before training in each iteration in RL and IARL
Action repeat 4 Repeat each action selected by the agent this many times in RL and IARL
0.003 in PPO([19]), for RL and IARL
2.0 The ratio of imitation loss and policy loss in IARL
1.8 The initial exploration noise in policy , is optimized together with during the training process in RL and IARL.
Table S3: List of the hyper-parameters in RL and IARL