Incorporating Human Domain Knowledge into Large Scale Cost Function Learning
Recent advances have shown the capability of Fully Convolutional Neural Networks (FCN) to model cost functions for motion planning in the context of learning driving preferences purely based on demonstration data from human drivers. While pure learning from demonstrations in the framework of Inverse Reinforcement Learning (IRL) is a promising approach, we can benefit from well informed human priors and incorporate them into the learning process. Our work achieves this by pretraining a model to regress to a manual cost function and refining it based on Maximum Entropy Deep Inverse Reinforcement Learning. When injecting prior knowledge as pretraining for the network, we achieve higher robustness, more visually distinct obstacle boundaries, and the ability to capture instances of obstacles that elude models that purely learn from demonstration data. Furthermore, by exploiting these human priors, the resulting model can more accurately handle corner cases that are scarcely seen in the demonstration data, such as stairs, slopes, and underpasses.
Manual handcrafting of cost functions for motion planning systems is an inherently complex and time consuming task. It requires high competency in the target area and expert knowledge about robotics systems and the applied algorithms. Ideally, robotic behaviour can be defined by untrained personnel, enabling task adaptation without involving highly trained experts. Inverse Reinforcement Learning (IRL) targets this problem by learning direct reward models from demonstration samples, and has been successfully applied to problems in a wide range of areas .
Recent advances exploit the ease of generating samples for learning from demonstration, and combining with with high capacity representations through Neural Networks in domains such as games  and autonomous driving . While the possibility to create large amounts of training data without manual labelling enabled training large networks, corner cases still represent a challenge for deep learning as less training data is present. Our work targets initialising neural networks by employing human priors to improve performance in these cases.
While CNNs can be integrated straightforwardly into different domains, the IRL framework introduces additional challenges. One of the dominant influences is spatially sparse feedback from our objective function as displayed in Figure 1. For example, when training a model for image segmentation, the objective creates feedback for each individual pixel. When training with a loss based on Deep Inverse Reinforcement Learning on the other hand, error terms will focus on the region around the demonstration trajectories. These error terms are based on states visited by the demonstration samples and the planning algorithm, which inherently focuses around sample data. Our work addresses the shortcomings by pretraining the network towards a dense human-provided prior, to learn richer feature representations for untraversed areas and increase the network’s ability to generalise.
We will show quantitatively that regression based pretraining improves prediction performance as well as classification performance for traversable terrain. Furthermore, we qualitatively present the advantages in the context of corner cases of manual cost functions, where pretraining followed by IRL-based training is able to recover more accurate and safe cost representations.
A major share of early work in IRL focuses on small-scale scenarios and benchmarks . However, with recent technological advances, IRL approaches have been applied to larger state and feature spaces in real life applications . In particular, these techniques harness the potential of deep neural networks, learning rich representations that are able to model the relationship between the state of the environment and the reward structure implied by demonstrated behaviour.
When working with large state spaces and end-to-end learning of reward functions, exploration of the state space becomes more important to enable learning rich feature representations and improve on generalisation. Such capabilities are particularly important when learning driving behaviours from human demonstration: since the demonstrations cannot cover every possible driving scenario, it is necessary to ensure the vehicle can handle the unseen or scarcely seen “corner cases”.
One paradigm that has been commonly employed in the past for deep neural networks is that of pretraining. In previous work, networks are pretrained in a greedy layer-wise fashion , by training each layer as a single layer unsupervised model (such as an autoencoder or restricted Boltzmann machine ), and using the hidden activations as the input to the next layer of unsupervised training. This pretraining has the effect of initialising the weights of the deep neural network to a region of the parameter space that is good for unsupervised tasks , from which the entire model can be fine-tuned to the specific classification task. This can be seen as being conceptually similar to the notion of inductive transfer, in which a model or representation learned for one task can be utilised or adapted to another.
In this work, we draw inspiration from these ideas, by performing pretraining of the deep IRL model with a manual cost map. In contrast to the unsupervised layer-wise training approach, however, we pretrain the network as a regressor to predict the manual cost map as output. This has the effect of initialising the network weights to a region of the parameter space which can accurately represent the manual cost map. This affords us the ability to inject domain knowledge into the network as a ‘human prior’, which is a crucial capability for self-driving vehicles to ensure that environments and behaviours that are absent from the expert demonstration data are handled gracefully.
3.1Maximum Entropy Deep Inverse Reinforcement Learning
The goal of IRL is to infer the reward structure that underlies certain behaviours. The process can be defined under a Markov Decision Process framework , where is the state space, is the set of possible actions, denotes the state transition model, is a discount factor that moderates the influence of future rewards, and is a function specifying the reward structure. As is unknown, it must be inferred from a set of demonstrations , each of which is a sequence of state-action pairs representing a sample trajectory.
The IRL model commonly needs to overcome two problems when reasoning about reward structures: suboptimality of sample trajectories given the underlying reward; and reward ambiguity, where multiple rewards can explain the same behaviour.
The Maximum Entropy (MaxEnt) approach to IRL explicitly addresses these concerns, by representing the expert behaviour as a distribution over demonstrated trajectories and assuming that this distribution has maximal entropy. The agent’s behaviour under the policy maximises the reward given the current model. Consequently, the probability of any trajectory between specified initial and final states is proportional to the exponential of the reward along the path:
The training loss in Maximum Entropy Deep Inverse Reinforcement Learning (MEDIRL)  consists of a data term, which maximises the log likelihood of the demonstration trajectories given the parametrised reward function, and a regularisation term:
The data term in Equation 2 can be split using the chain rule, into the gradient of the objective with respect to the reward, and the gradient of the reward with respect to the network parameters:
Here, the first term computes the difference in state visitation frequencies - how often specific states are traversed - between the demonstrations () and the model; while the second term backpropagates this error through the network. It becomes obvious in this formulation that the area and therefore the types of features learned based on these error terms focus around the demonstration trajectories.
The CNN architecture used for this work is the multi-scale fully convolutional network (MS-FCN) proposed in . The input to the network is a 2D laser occupancy grid, and the output is a cost map specifying the reward for each location in the grid. The architecture consists of , , and convolutional layers, including nonlinearities, max pooling and upsampling layers, and a separate branch to learn intermediate representations at a different scale, which are concatenated in the higher layers. For more details, the reader is referred to .
Each iteration of training under the MEDIRL framework is composed of the following steps. First, the reward function (cost map) is computed by performing a forward pass of the network, and the MDP is solved for this current reward estimate. Using the policy computed by the MDP, we can obtain the expected state visitation frequencies and the MaxEnt loss and gradients from Equations Equation 2 and Equation 3. Finally, these errors are backpropagated through the network to obtain the weight updates.
In the pretraining setup, the CNN first learns to predict the manual cost map as output - which results in a dense map of gradients over the full area - and then fine-tuned with the above steps. This is discussed in further detail in the next section.
3.4Incorporating Human Priors
Due to the iterative nature of planning and refining the cost model in the training process, the approach described in Section 3.1 tends to focus on discriminative features around highly visited states as depicted in Figure 1. Features for terrains that are neither explored by demonstration samples nor the planning step will never be formed by backpropagation of error terms through the network. Therefore, the model has to generalise based on similarity to more commonly traverse areas, resulting in artifacts and noisy reward maps. This situation is enhanced in scenarios where feature representations for similar places differ based on their position in state space, as is the case in the dataset used in this work . The LIDAR scan points in this setup will be spread sparser at greater distance from the car, resulting in spatially variant representation.
In order to address this shortcoming, we suggest training the network as a regressor towards a prior cost map. These cost maps can be automatically generated from the laser input data based on manually handcrafted features, which enables us to utilise the availability of large amounts of data without human labelling efforts. However, the principal benefit is the ability to explore all features relevant to generating the cost function, leading to better generalisation in areas with greater distance from the demonstration trajectories.
We evaluate all approaches on the large scale dataset presented in  and investigate how performance progresses between training from random initialisation and employing prior human knowledge.
The dataset consists of 25,000 demonstration samples of urban driving from 13 different drivers. The data was collected in the inner city of Milton Keynes and includes driving around different types of obstacles, including but not restricted to: bollards, green patches, bike racks, slopes, cars, and underpasses. To increase the performance of our approaches as path planning cost maps, we added common preprocessing steps, such as normalising the input data, and trained on shorter trajectories that are more representative for the motion primitives employed in our motion planning framework.
To evaluate how well the trained models approximate human behaviour, we use two common metrics: the negative log-likelihood (NLL) and the modified Hausdorff Distance (MHD) . The first metric is representing how likely the expert demonstrations are given the current cost function and the latter is a spatial metric for how close the demonstrations are to samples drawn from a probability distribution given the cost map. The learned models generally outperform the handcrafted approach as increasing the probability of the demonstration samples is inherently part of their objective function, in contrast to the manual cost function. As Table 1 displays pretraining improves our ability to predict where people are more likely to drive.
|Manual cost function||56.402||0.286|
One major drawback for evaluating all approaches in a real world setup is the absence of absolute ground truth for the cost map. To overcome this impediment, we evaluate the approach based on its performance as a classifier for feasible example trajectories. Given a set of traversable trajectories - taken from our test set - and a set of artificial collision trajectories, we can analyse the accuracy of the model in a classification setup for traversable trajectories. In this setup, traversable terrain is taken as the positive class, meaning that a high precision model is conservative when assigning traversability.
While utilising human priors already improves accuracy for prediction, its principal gain lies in being able to improve spatial generalisation and the ability to learn more robust cost functions. Figure 3 depicts the Precision-Recall curves for networks with and without pretraining. The handcrafted cost function does not include a threshold parameter and is therefore represented as a point. While this approach is manually designed to be conservative and enables us to operate at maximum precision, it falsely rejects much of the terrain as untraversable. The learned cost functions enable us to find possible paths in many situations when the manual cost function will get stuck. When introducing human prior knowledge into the training process, the approach achieves a significant gain in precision compared to random initialisation. Hence, utilising this knowledge is an important step towards robust application of learned cost maps.
|Scenario||Manual cost function||wo pretraining||w pretraining|
4.4Qualitative Assessment of Learned Cost Functions
Table 2 represents various situations emphasising shortcomings of the manual cost function. One point of high importance is, that all learned cost functions show additional obstacles starting at about 13 meters distance from the vehicle position, which is the length of the demonstration trajectories. By choosing the length of the trajectories, we define how far we trust our perception systems. Since features in distant areas are only traversed but planner and not demonstration samples in the training process, they will classified as untraversable with high probability.
The principal rules behind the handcrafted cost function are based on a threshold on the height range of detected points within a cell and the expansion of obstacles by the size of the vehicle to enable point based planning. This can lead to inaccuracies in the presence of slopes, which can exceed the threshold and will be shown as untraversable, and the same can occur for underpasses, where scans from ceiling and floor result in a high height range. Stairs on the other hand can still fit within the same threshold but present obstacles for any vehicle since they cannot be traversed due to their indiscontinuity. Bollards that are extended slightly too far will seem untraversable and areas such as grass might look very similar in features to pathways but should not be traversed.
While the randomly initialised network already learns to represent the main obstacles and traversable areas, it results in some noisy areas and artificial obstacles. Based on human prior domain knowledge, the network learns to refine the representation and is significantly more robust, learns to represent distinct obstacle boundaries and displays fewer artifacts. The approach learns that slopes are traversable, while stairs are not and extends obstacle boundaries only as far as necessary for safe traversal as seen in the respective cases in Table 2.
We conjecture that without pretraining, a lot of the expressive power of the network is employed to learn the very specific representation focused around the demonstration trajectories. If we instead pretrain the model to predict an existing cost map, the remainder of the learning process is able to generalise broader and better capture some of the corner cases described previously.
When performing path planning, a threshold has to be determined to define untraversable and unsafe terrain. To simplify this step we normalise the output by sending it through a sigmoid. After first trials with Rectified Linear Units (ReLU) as activation functions within the network, the sigmoid saturates early on and training slows down, we exchanged all activation functions with sigmoid units. Furthermore, we introduce early stopping to increase generalisation performance; since following the pretraining step, the model requires fewer iterations to converge.
5Conclusions and Ongoing Work
We develop an approach for incorporating human prior knowledge into cost function learning in the context of IRL. By utilising human priors, we can improve on prediction of demonstrator trajectories. Adding the pretraining step enables us to start from a significantly more desirable network initialisation; giving a richer representation for features at arbitrary position and enabling more effective generalisation. The approach improved classification performance for traversable terrain and results in more robust and distinct cost representations. Our evaluation furthermore depicts the advantages in specific corner cases of our environment given by slopes, bollards, underpasses and stairs.
Ongoing research looks into employing variations of Progressive Neural Networks  , which represent another opportunity to exploit human priors by switching to modelling the error/residual between the human given prior and the true cost function. Different variations of the approach can focus on directly reusing the learned features of the trained model or simply focus on approximating the difference between the manual cost function and the optimal function to describe human behaviour.
The focus shifts in context of the latter from learning all representations needed to approximate a function to learning the difference between the manual cost function and the one best suited to explain human behaviour. This approach benefits from expert domain knowledge such that it only needs to embody the variations that the expert did not consider.
The authors would like to acknowledge the support of this work by the EPSRC through grant number DFR01420, and a DTA Studentship.
- Watch this: scalable cost-function learning for path planning in urban environments .
Markus Wulfmeier, Dominic Zeng Wang, and Ingmar Posner. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2016.
- Guided cost learning: Deep inverse optimal control via policy optimization.
Chelsea Finn, Sergey Levine, and Pieter Abbeel. CoRR, abs/1603.00448, 2016.
- Inverse reinforcement learning with locally consistent reward functions.
Quoc Phong Nguyen, Bryan Kian Hsiang Low, and Patrick Jaillet. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett, editors, Advances in Neural Information Processing Systems 28, pages 1747–1755. Curran Associates, Inc., 2015.
- Mastering the game of go with deep neural networks and tree search.
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Nature, 529(7587):484–489, 2016.
- Maximum entropy inverse reinforcement learning.
Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. In AAAI, pages 1433–1438, 2008.
- Algorithms for inverse reinforcement learning.
Andrew Y Ng and Stuart J Russell. In Proceedings of the Seventeenth International Conference on Machine Learning, pages 663–670. Morgan Kaufmann Publishers Inc., 2000.
- Greedy layer-wise training of deep networks.
Yoshua Bengio, Pascal Lamblin, Dan Popovici, Hugo Larochelle, et al. In Advances in neural information processing systems, 2007.
- An analysis of single-layer networks in unsupervised feature learning.
Adam Coates, Honglak Lee, and Andrew Y Ng. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning, pages 1–9, 2010.
- Why does unsupervised pre-training help deep learning?
Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Journal of Machine Learning Research, 11(Feb):625–660, 2010.
- Maximum entropy deep inverse reinforcement learning.
Markus Wulfmeier, Peter Ondruska, and Ingmar Posner. In Neural Information Processing Systems Conference, Deep Reinforcement Learning Workshop, volume abs/1507.04888, Montreal, Canada, 2015.
- Activity Forecasting.
Kris M. Kitani, Brian D. Ziebart, James Andrew Bagnell, and Martial Hebert. In Andrew Fitzgibbon, Svetlana Lazebnik, Pietro Perona, Yoichi Sato, and Cordelia Schmid, editors, Computer Vision – ECCV 2012, number 7575 in Lecture Notes in Computer Science, pages 201–214. Springer Berlin Heidelberg, 2012.
- Progressive neural networks.
Andrei A. Rusu, Neil C. Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. CoRR, abs/1606.04671, 2016.