Title: LEARNING WHAT YOU CAN DO BEFORE DOING ANYTHING

Abstract: Intelligent agents can learn to represent the action spaces of other agents simply by observing them act. Such representations help agents quickly learn to predict the effects of their own actions on the environment and to plan complex action sequences. In this work, we address the problem of learning an agent's action space purely from visual observation. We use stochastic video prediction to learn a latent variable that captures the scene's dynamics while being minimally sensitive to the scene's static content. We introduce a loss term that encourages the network to capture the composability of visual sequences and show that it leads to representations that disentangle the structure of actions. We call the full model with composable action representations Composable Learned Action Space Predictor (CLASP). We show the applicability of our method to synthetic settings and its potential to capture action spaces in complex, realistic visual settings. When used in a semi-supervised setting, our learned representations perform comparably to existing fully supervised methods on tasks such as action-conditioned video prediction and planning in the learned action space, while requiring orders of magnitude fewer action labels.

1. INTRODUCTION:

Agents behaving in real-world environments rely on perception to judge what actions they can take and what effect these actions will have. Purely perceptual learning may play an important role in how these action representations are acquired and used. In this work, we focus on the problem of learning an agent's action space from unlabeled visual observations. To see the usefulness of this strategy, consider an infant that is first learning to walk. From around 10 months of age, infants rapidly progress from crawling, to irregular gaits with frequent falling, and finally to reliable locomotion (Adolph et al. (2012) ). But before they first attempt to walk, infants have extensive sensory exposure to adults walking. Unsupervised learning from sensory experience of this type appears to play a critical role in how humans acquire representations of actions before they can reliably reproduce the corresponding behaviour (Ullman et al. (2012) ). Infants need to relate the set of motor primitives they can generate to the action spaces exploited by adults (Dominici et al. (2011)) , and a representation acquired by observation may allow an infant to more efficiently learn to produce natural, goal-directed walking behavior.

Reinforcement learning (RL) provides an alternative to the (passive) unsupervised learning approach as it implicitly discovers an agent's action space and the consequences of its actions. Recent breakthroughs in model-free and model-based RL suggest that end-to-end training can be used to learn mappings between sensory input and actions (Mnih et al. (2015) ; Lillicrap et al. (2016) ; Levine et al. (2016) ; Finn & Levine (2017) ; Schulman et al. (2015) ). However, these methods require active observations and the sensorimotor mappings learned in this way cannot be easily generalized to new agents with different control interfaces. Methods for sensorimotor learning from purely visual Without requiring labels, our model learns to represent the action in sequences like these identically. We train a representation z to capture the dynamics of the scene and its compositional structure: applying (z 1 and z 2 ) should have the same effect as applying the composed representation g(z 1 , z 2 ). These properties capture the fact that effector systems, such as a robot arm, use the same composable action space in many different states. b) The learned action space z recovered by our method (PCA visualization). Points are colored by the true action u: true actions can be easily decoded from z, validating that the structure of the action space has been captured.

data may facilitate learning where action information is not available, such as when using video data collected from the Internet. Such methods may also be useful for imitation learning, where ground truth actions are often hard or impossible to collect other than by visual observation (Finn et al. (2017) ; Pathak et al. (2018) ). More generally, learning from passive observations may make it easier to reuse action representations between systems with different effectors and goals. The representations learned by unsupervised methods are invariant to these choices because the model does not have access to motor commands or goals during training.

In this work, we evaluate the proposal that learning what you can do before doing anything can lead to action space representations that make subsequent learning more efficient. To this end, we develop a model that learns to represent an agent's action space given only unlabeled videos of the agent. The resulting representation enables direct planning in the latent space. Given a small number of action-labeled sequences we can execute the plan by learning a simple mapping from latent action representations to the agent's controls. This representation may be analogous to those in the parietal and premotor areas of cortex, which include populations of neurons that represent the structure of actions produced both by the self and by others (Rizzolatti et al. (1996) ; Romo et al. (2004) ) and that are critical for reliably producing flexible, voluntary motor control (see Kandel et al. (2012) , Chapter 38). In the brain, representations of this kind could plausibly be learned using specialized loss functions (Marblestone et al. ( 2016)) whose effect is to induce the prior needed to determine the structure of actions in observation data.

In contrast to most approaches to unsupervised learning of dynamics, which focus on learning the statistical structure of the environment, we focus on disentangling action information from the instantaneous state of the environment (Fig. 1 ). We base our work on recent stochastic video prediction methods (Babaeizadeh et al. (2018) ; Denton & Fergus (2018) ; Lee et al. (2018) ) and impose two properties on the latent representation. First, we train the representation to be minimal, i.e. containing minimal information about the current world state. This forces the representation to focus on dynamic properties of the sensory input. A similar objective has been used in previous work to constrain the capacity of video prediction models (Denton & Fergus (2018) ). Second, we train the representation to be composable by introducing a novel loss term that enforces that the cumulative effect of a sequence of actions can be computed from the individual actions' representations (Fig. 1 , left). Composability encourages disentangling: as a composed representation does not have access to the static content of the intermediate frames, a representation is composable only if the individual action representations are disentangled from the static content. Taken together, these two properties lead to a representation of sensory dynamics that captures the structure of the agent's actions.

We make the following three contributions. First, we introduce a method for unsupervised learning of an agent's action space by training the latent representation of a stochastic video prediction model for the desiderata of minimality and composability. Second, we show that our method learns a representation of actions that is independent of scene content and visual characteristics on (i) a simulated robot with one degree of freedom and (ii) the BAIR robot pushing dataset (Ebert et al. (2017) ). Finally, we demonstrate that the learned representation can be used for action-conditioned video prediction and planning in the learned action space, while requiring orders of magnitude fewer action-labeled videos than extant supervised methods.

2. RELATED WORK:

Learning structured and minimal representations. Several groups have recently shown how an adaptation of the variational autoencoder (VAE, Kingma & Welling (2014) ; Rezende et al. ( 2014)) can be used to learn representations that are minimal in the information-theoretic sense. Alemi et al. (2017) showed that the Information Bottleneck (IB) objective function (Tishby et al. (1999) ; Shwartz-Ziv & Tishby (2017) ) can be optimized with a variational approximation that takes the form of the VAE objective with an additional weighting hyperparameter. In parallel, Higgins et al. (2017) showed that a similar formulation can be used to produce disentangled representations. The connection between disentaglement and minimality of representations was further clarified by Burgess et al. (2018) . In this work, we apply the IB principle to temporal models to enforce minimality of the representation.

Several groups have proposed methods to learn disentangled representations of static content and pose from video (Denton & Birodkar (2017) ; Tulyakov et al. (2018) ). Jaegle et al. (2018) learn a motion representation by enforcing that the motion acts on video frames as a group-theoretic action.

In contrast, we seek a representation that disentangles the motion from the static pose. Thomas et al. (2017) attempt to learn a disentangled representation of controllable factors of variation.

While the goals of their work are similar to ours, their model relies on active learning and requires an embodied agent with access to the environment. In contrast, our model learns factors of variation purely from passive temporal visual observations, and thus can be applied even if access to the environment is costly or impossible.

Unsupervised learning with video data. Several recent works have exploited temporal information for representation learning. Srivastava et al. (2015) used the Long Short-Term Memory (LSTM, Hochreiter & Schmidhuber (1997) ) recurrent neural network architecture to predict future frames and showed that the learned representation was useful for action recognition. Vondrick et al. (2016) showed that architectures using convolutional neural networks (CNNs) can be used to predict actions and objects several seconds into the future. Recently, work such as Finn et al. (2016) ; Villegas et al. (2017) ; Denton & Birodkar (2017) has proposed various modifications to the convolutional LSTM architecture (Xingjian et al. (2015) ) for the task of video prediction and shown that the resulting representations are useful for a variety of tasks.

Others have explored applications of video prediction models to RL and control (Weber et al. (2017) ; Ha & Schmidhuber (2018) ; Wayne et al. (2018) ). Chiappa et al. (2017) and Oh et al. (2015) propose models that predict the consequences of actions taken by an agent given its control output. Similar models have been used to control a robotic arm (Agrawal et al. (2016) ; Finn & Levine (2017); Ebert et al. (2017) ). The focus of this work is on learning action-conditioned predictive models. In contrast, our focus is on the unsupervised discovery of the space of possible actions from video data.

Our model is inspired by methods for stochastic video prediction that, given a sequence of past frames, capture the multimodal distribution of future images (Goroshin et al. (2015) ; Henaff et al. (2017) ). We use the recently proposed recurrent latent variable models based on the variational autoencoder (Babaeizadeh et al. (2018) ; Denton & Fergus (2018) ; Lee et al. (2018) ). We develop these methods and propose a novel approach to unsupervised representation learning designed to capture an agent's action space.

Sensorimotor abstractions for behavior. There is a long history of work developing sensorimotor representations for applications in reinforcement learning and robotics. Previous work in this domain has primarily focused on introducing hand-crafted abstractions and hierarchies to make sensorimotor mappings more generalizable. Methods for aggregating low-level controls into higher- 2015)), and recent work that abstracts a learned policy away from low-level control and perception to ease simulation-to-real transfer (Clavera & Abbeel (2017) ; Müller et al. (2018) ).

Other work has learned to separate robot-instance specific controls from task-related skills through modular policies, but this work does not enforce any structure onto the intermediate representation and requires extensive interaction with the environment (Devin et al. (2017) ).

3. APPROACH:

In this section, we describe our architecture for learning an action representation that is minimal and composable. In Sec. 3.1, we describe a variational video prediction model similar to that of Denton & Fergus (2018) that provides us with a framework for learning a latent representation z t at time t of the change between the past and the current frames. No labeled actions are considered at this stage. In Sec. 3.2, we introduce an unsupervised method for imposing composability of the latent that allows us to recover a structured representation that defines CLASP. To verify that the learned representation corresponds to the executed control, we show that we can learn a bijective mapping between the latent representation and the control output executed at that time using a small number of labeled data points (Sec. 3.3). In the experimental section, we describe how the learned bijective mapping can be used for tasks such as action-conditioned video prediction (Sec. 4.2) and planning in the learned action space (Sec. 4.3).

3.1. VIDEO PREDICTION MODEL:

At the core of our method is a recurrent latent variable model for video prediction based on a temporal extension of the conditional VAE proposed by Chung et al. (2015) . We consider the generative model shown in Fig. 2 (left). At each timestep t, the model outputs a latent variable z t ∼ p(z) = N (0, I) associated with this timestep. Given a history of frames x 1:t-1 and latent samples z 2:t , the generative distribution over possible next frames is given by

x t ∼ p θ (x t |x 1:t-1 , z 2:t ) = N (µ θ (x 1:t-1 , z 2:t ), I).

In practice, we generate the next frame by taking the mean of the conditional distribution: xt = µ θ (x 1:t-1 , z 2:t ).

To optimize the log-likelihood of this generative model, we introduce an additional network approximating the posterior of the latent variable

z t ∼ q φ (z t |x t , x t-1 ) = N (µ φ (x t , x t-1 ), σ φ (x t , x t-1 )).

We can optimize the model using the variational lower bound of the log-likelihood in a formulation similar to the original VAE. However, as has been shown recently by Alemi et al. (2018) , the standard VAE formulation does not constrain the amount of information contained in the latent variable z. To overcome this, and to learn a minimal representation of z, we reformulate the standard VAE objective in terms of the Information Bottleneck (IB) (Shwartz-Ziv & Tishby (2017) ).

IB minimizes the mutual information, I, between the action representation, z t , and input frames, x t-1:t , while maximizing the ability to reconstruct the frame x t as measured by the mutual information between (z t , x t-1 ) and x t :

EQUATION

The two components of the objective are balanced with a Lagrange multiplier β z . When the value of β z is higher, the model learns representations that are more efficient, i.e. minimal in the informationtheoretic sense. We use this property to achieve our first objective of minimality of z.

The variational IB (Alemi et al. (2017) ) provides a variational approximation of the IB objective, that simply takes the form of the original VAE objective with an additional constant β z . Aggregating over a sequence of frames, the video prediction objective for our model is given by:

L pred θ,φ (x 1:T ) = T t=1 E q φ (z2:t|x1:t) log p θ (x t |x 1:t-1 , z 2:t ) -β z D KL (q φ (z t |x t-1:t )||p(z)) . (2)

The full derivation of the variational lower bound is given in the appendix of Denton & Fergus (2018) 2 . The full model for one prediction step is shown in the left part of Fig. 2 .

3.2. CLASP: LEARNING ACTION REPRESENTATIONS WITH COMPOSABILITY:

Given a history of frames, the latent variable z t represents the distribution over possible next frames. It can thus be viewed as a representation of possible changes between the previous and the current frame. We will associate the latent variable z t with the distribution of such changes. In video data of an agent executing actions in an environment, the main source of change is the agent itself. Our model is inspired by the observation that a natural way to represent z t in such settings is by the agents' actions at time t. In this section, we describe an objective that encourages the previously described model (Sec. 3.1) to learn action representations.

To encourage composability of action representations, we use the procedure illustrated in Fig. 2 (right).

We define an additional random variable

ν t ∼ q ζ (ν t |z t , z t-1 ) = N (µ ζ (z t , z t-1 ), σ ζ (z t , z t-1 ))

that is a representation of the trajectory z t-1:t . The process of composing latent samples into a single trajectory can be repeated several times in an iterative fashion, where the inference model q ζ observes a trajectory representation ν t-1 and the next latent z t to produce the composed trajectory representation ν t ∼ q ζ (ν t |ν t-1 , z t ). The inference model q ζ is parameterized with a multilayer perceptron, MLP comp .

We want ν to encode entire trajectories, but we also require it to have minimal information about individual latent samples. We can encourage these two properties by again using the IB objective:

EQUATION

We maximize this objective using the following procedure. Given a trajectory of T frames, we use MLP infer to retrieve the action representations z. Next, we generate a sequence of trajectory representations ν t , each of which is composed from C consecutive action representations z t-C:t . We obtain T C = T /C such representations. Finally, we use ν t to produce the corresponding frames

xt = p θ (x t |x t-C , ν t ) 3 .

The variational approximation to (3) that we use to impose composability takes the following form:

EQUATION

where the prior distribution over ν is given by the unit Gaussian ν ∼ p(ν) = N (0, I).

The objective above encourages the model to find a minimal representation for the trajectories ν. As the trajectories are composed from only the action representations z, this encourages z to assume a form suitable for efficient composition. This allows us to recover an action representation that is composable. Our overall training objective is the sum of the two objectives:

EQUATION

We call the full model with composable action representations Composable Learned Action Space Predictor (CLASP).

3.3. GROUNDING THE CONTROL MAPPING:

Our approach allows us to learn a latent representation z that is minimal and disentangled from the content of previous images. To use such a learned representation for control, we want to know which action u a certain sample z corresponds to, or vice versa. To determine this correspondence, we learn a simple bijective mapping from a small number of action-annotated frame sequences from the training data. We train the bijection using two lightweight multilayer perceptrons, ẑt = MLP lat (u t ) and ût = MLP act (z t ). Note that only the MLP lat and MLP act networks are trained in this step, as we do not propagate the gradients into the video prediction model. Because we do not have to re-train the video prediction model, this step requires far less data than models with full action supervision (Section 4.3).

We note that standard image-based representations of motion, e.g., optical flow, do not directly form a bijection with actions in most settings. For example, the flow field produced by a reacher (as in Fig. 5 ) rotating from 12 o'clock to 9 o'clock is markedly different from the flow produced by rotating from 3 o'clock to 12 o'clock, even though the actions producing the two flow fields are identical (a 90 degree counter-clockwise rotation in both cases). In contrast, our representation easily learns a bijection with the true action space.

4. EMPIRICAL EVALUATION:

For evaluation, we consider tasks that involve regression from the latent variable z to actions u and vice versa. By learning this bijection we show that our model finds a representation that directly corresponds to actions and is disentangled from the static scene content. We show that after CLASP is trained, it can be used for both action-conditioned video prediction and planning (see Fig. 4 ), and provide a procedure to plan in the learned representation. We also validate that our approach requires orders of magnitude fewer labels than supervised approaches, and that it is robust to certain visual characteristics of the agent or the environment. Please refer to Appendix B for the exact architectural parameters.

Datasets. We conduct experiments on a simple simulated reacher dataset and the real-world Berkeley AI Research (BAIR) robot pushing dataset from Ebert et al. (2017) . The reacher dataset consists of sequences of a robot reacher arm with one degree of freedom rotating counter-clockwise with random angular distances between consecutive images. We simulate it using OpenAI's Roboschool environment (Klimov & Schulman (2018) ). The actions u are encoded as relative angles between images, and constrained to the range u ∈ [0 Baselines. We compare to the original model of Denton & Fergus (2018) that does not use the proposed composability objective. To obtain an upper bound on our method's performance we also compare to fully supervised approaches that train with action annotations: our implementations are based on Oh et al. (2015) for the reacher dataset and the more complex Finn & Levine (2017) for the BAIR dataset. For planning, we also compare to a model based on the approach of Agrawal et al. ( 2016) that learns the forward and inverse dynamics with direct supervision.

Metrics. In case of the action-conditioned video prediction we use the absolute angular position (obtained using a simple edge detection algorithm, see Appendix D) for the reacher dataset and the change of end effector position (obtained via manual annotation) for the BAIR dataset. We choose these metrics as they capture the direct consequences of applied actions, as opposed to more commonly used visual appearance metrics like PSNR or SSIM. For visual servoing in the reacher environment we measure the angular distance to the goal state at the end of servoing.

4.1. LEARNED STRUCTURE OF THE ACTION REPRESENTATIONS:

First, we inspect the structure of the learned action space for our model. To do so, we train CLASP on the reacher dataset and visualize the learned representation. In Fig. 3 projections of samples, z, from the inference network, q, colored by the corresponding ground truth action, u. To find the two-dimensional subspace with maximal variability, we conducted Principal Component Analysis (PCA) on the means of the distributions generated by q. The first PCA dimension captures 99% of the variance, which is explained by the fact that the robot in consideration has one degree of freedom. While the baseline without composability training fails to learn a representation disentangled from the static content, our method correctly recovers the structure of possible actions of the robot.

4.2. ACTION-CONDITIONED VIDEO PREDICTION:

Table 1 : Action-conditioned video prediction results (mean ± standard deviation across predicted sequences). The "supervised" baseline is taken from Oh et al. (2015) for the reacher dataset and Finn & Levine (2017) We further verify that our model recovers a representation of actions and show that this allows us to use the model for two tasks. First, we show that it is possible to transplant the action representations z from a given sequence into one with a different initial state. We run the approximate inference network MLP infer on the donor sequence to get the corresponding action representation z. We then use this sequence of representations z together with a different conditioning image sequence to produce the recipient sequence. While the content of the scene changes, the executed actions should remain the same. Second, we show how our model can be used for action-conditioned video prediction. Given a ground truth sequence annotated with actions u, we infer the representations z directly from u using MLP lat . The inferred representations are fed into the generative model p θ and the resulting sequences are compared to the original sequence.

The quantitative results in Table 1 show that the model trained with the composability objective on the reacher dataset successfully performs the task, with performance similar to the fully supervised model. Denton & Fergus (2018) performs the task only slightly better than random guessing. This shows that it is infeasible to infer the latent z t learned by the baseline model given only the action u t , and confirms our intuition about this from Fig. 3 . The qualitative results in Fig. 5 (additional results in Figs. 12, 13 and 14 in the Appendix and on the website) further support this conclusion.

On the BAIR dataset, our model performs better than the baseline of Denton & Fergus (2018) , reducing the difference between the best unsupervised method and the supervised baseline by 30 %. This is reflected in qualitative results as frames generated by the baseline model often contain artifacts such as blurriness when the arm is moving or ghosting effects with two arms present in the scene (Figs. 13 and 14 in the Appendix, videos on the website). These results demonstrate the promise of our approach in settings involving more complex, real-world interactions. Similarly to the true action space u, we can use the learned action space z for planning. We demonstrate this on a visual servoing task. The objective of visual servoing is to move an agent from a start state to a goal state, given by images x 0 and x goal , respectively. We use a planning algorithm similar to that of Finn & Levine (2017) , but plan trajectories in the latent space z instead of true actions u. We use MLP act to retrieve the actions that correspond to a planned trajectory.

4.3. PLANNING IN THE LEARNED ACTION SPACE:

Our planning algorithm, based on Model Predictive Control (MPC), is described in Appendix C. The controller plans by sampling a number of action trajectories and iteratively refining them with the Cross Entropy Method (CEM, Rubinstein & Kroese ( 2004)). The state trajectories are estimated by using the learned predictive model. We select the trajectory whose final state is closest to the goal and execute its first action. The distance between the states is measured using the cosine distance between VGG16 representations (Simonyan & Zisserman (2015) ). Servoing terminates once the goal is reached or the maximum steps are executed. The baseline of Agrawal et al. (2016) uses a different procedure, as described in the original paper.

We show qualitative results of a servoing rollout in the reacher environmet in Fig. 6 (left) and quantitative results in Table 2 . The agent not only reaches the target but also plans accurate trajectories at each intermediate time step. The trajectory planned in the learned space can be correctly decoded into actions, u.

4.4. DATA EFFICIENCY:

To validate the benefits of learning from passive observations, we measure the data efficiency of CLASP in Fig. 6 (right). In this setup, we train the methods on a large dataset of passive observations and a varied number of observations labeled with actions (100, 1000, 10000 videos). The supervised baselines, which cannot leverage pre-training with passive observations perform poorly in the lowdata regime. In contrast, our model only needs a small number of action-labeled training sequences to achieve good performance, as it learns the structure of actions from passive observations. In the abundant data regime, our model still performs on par with both supervised baselines. We observed similar results for action-conditioned prediction experiments, summarized in Table 3 in the Appendix. These results suggest that our planning approach can be used when the action-labeled data are limited.

4.5. ROBUSTNESS TO VARYING VISUAL CHARACTERISTICS:

To test the robustness of our approach to different kinds of visual variability in the environment, we conduct experiments on two versions of the reacher dataset with additional variability. In the first, the background of each sequence is replaced with a randomly drawn CIFAR-10 image (Krizhevsky (2009) ). In the second, we vary the width and length of the reacher arm in each sequence. We test models trained on these datasets on sequences with variations not seen during training but drawn from the same distribution. The experimental setup is described in more detail in Appendix E. 4 in the appendix.

As shown in Table 2 , our model can reliably discover the agent's action space and perform visual servoing under increased visual variability. The transplantation sequences in Fig. 5 show that the action semantics are preserved across changes to the appearance of the environment that do not alter the dynamics. This is evidence that the learned representation captures the dynamics of the environment and is not sensitive to changes in visual characteristics that do not affect the agent's action space. In these two settings, CLASP also requires orders of magnitude less action-conditioned data than the supervised baselines (see Table 4 in the appendix). Our results, combined with the data efficiency result, suggest that our method is robust to visual changes and can be used for passive learning from videos that are obtained under different visual conditions, or even videos of different agents, such as videos obtained from the Internet, as long as the action space of the observed agents coincides with the target agent.

5. CONCLUSION:

We have shown a way of learning the structure of an agent's action space from visual observations alone by imposing the properties of minimality and composability on a latent variable for stochastic video prediction. This strategy offers a data-efficient alternative to approaches that rely on fully supervised action-conditioned methods. The resulting representation can be used for a range of tasks, such as action-conditioned video prediction and planning in the learned latent action space. The representation is insensitive to the static scene content and visual characteristics of the environment. It captures meaningful structure in synthetic settings and achieves promising results in realistic visual settings. 21.8 ± 12.9 2.6 ± 2.6 1.8 ± 1.5 CLASP (varied background) 1.5 ± 1.3 3.8 ± 3.5 3.0 ± 2.2 CLASP (varied agents)

2.0 ± 1.0 2.3 ± 3.4 2.8 ± 2.9

the final image of each trajectory. This is a perceptual distance, as in Johnson et al. (2016) . In the update step of the Cross Entropy Method (CEM) algorithm, we rank the trajectories based on their cost and fit a diagonal Gaussian distribution to the latents z that generated the M best sequences. We fit one Gaussian for each prediction time step k ∈ K. After sampling a new set of latents z n+1 from the fitted Gaussian distributions we repeat the procedure for a total of N iterations.

Finally, we pick the latent sequence corresponding to the best rollout of the last iteration and map its first latent sample to the output control action using the learned mapping: u * = MLP act (z * N,0 ). This action is then executed in the environment. The action at the next time step is chosen using the same procedure with the next observation as input. The algorithm terminates when the specified number of servoing steps T has been executed. 

D ANGLE DETECTION ALGORITHM:

We employ a simple, hand-engineered algorithm to quickly retrieve the absolute angle values from the images of the reacher environment. First we convert the input to a grayscale image and run a simple edge detector to obtain a binary image of the reacher arm. We smooth out noise by morphological opening. We compute the Euclidean distance to the image center for all remaining non-zero pixels and locate the reacher tip at the pixel closest to the known reacher arm length. This gives us the absolute reacher arm angle.

To evaluate the accuracy of our angle detection algorithm, we estimated the angle for all images of the simulated training dataset and compare it to ground truth. A histogram of the angle errors of our algorithm is displayed in Fig. 7 . All errors are below 10 degrees and the majority are smaller than 5 degrees. This suggests the output of this model is of a suitable quality to serve as surrogate ground truth. A second approach that used a neural network to regress the angle directly from the pixels achieved similar performance. We attribute the errors to the discretization effects at low image resolutions -it is impossible to achieve accuracy below a certain level due to the discretization.

E EXPERIMENTS WITH VARYING ENVIRONMENTS E.1 ROBUSTNESS TO CHANGING STATIC BACKGROUND:

We test the robustness of our method to different static backgrounds by replacing the uniform blue background with images from the CIFAR-10 training set (Krizhevsky (2009) ). For each sequence we sample a single background image that is constant over the course of the entire sequence. At test time we use background images that the model has not seen at training time, i.e. sampled from a held-out subset of the CIFAR-10 training set. As in previous experiments, we first train our model on pure visual observations without action-annotations. We then train the networks MLP lat and MLP act on a small set of action-annotated sequences to convergence. For the visual servoing we follow the same algorithm as in the previous experiments (see Appendix C).

Qualitative servoing results of our method on the dataset with varied backgrounds are shown in Fig. 9 and quantitative results in Figure 6 (right). The model accurately predicts the background image into the future and successfully discovers and controls the action space of the agent. The fact that the same bijective mapping between latents and actions works for all backgrounds suggests that the network is able to disentangle the static content of the scene and the dynamics attributed to the moving reacher arm. In addition, we show trajectory transplantation between different backgrounds in Fig. 8 (top), which further validates the claim that the learned latent represents the action consistently, independent of the background. 

E.2 LEARNING FROM AGENTS WITH DIFFERENT VISUAL APPEARANCE:

We test the ability of our method to learn from agents that differ in their visual appearance from the agent used at test time, but that share a common action space. We construct a dataset in which we vary parameters that determine the visual characteristics of the reacher arm, specifically its thickness and length (see Fig. 10, left) . In total our training dataset comprises 72 different configurations spanning a wide variety of visual appearances. We show a qualitative example of a servoing trajectory in Fig. 10 (right). We additionally evaluate the efficacy of training on the novel dataset by following the procedure employed in Section 4.4: we train the mapping between latent representation z and actions to convergence on action-annotated subsets of the training data of varying sizes. The servoing errors in Figure 6 (right) show that we achieve comparable performance independent of whether we train on the target agent we test on or on a set of agents with different and varied visual appearances. Our model is able to learn a latent representation that captures the action space shared between all the agents seen at training time. We can then learn the mapping between this abstract action space and the actions of the agent with the novel visual appearance from a small number of action-annotated sequences. In addition, we show trajectory transplantation between different agents in Fig. 8 (bottom) that further validates our claim that the learned latent represents the action consistently, independent of the agent. 3. Here, action representations z t are shown as a function of the absolute angle (α) of the reacher arm at time t -1 and the relative angle between the reacher at time t and t -1. We see that the encoding of action learned by the baseline is entangled with the absolute position of the reacher arm. While this representation can be used to predict the consequences of actions given the previous frame, it is impossible to establish a bijection between u t and z t as the correspondence depends on the previous frame x t-1 . Moreover, it is impossible to compose two samples of such a z without access to the intermediate frame. This representation is minimal, as it is a linear transformation (a rotation) of the known optimal representation u t (the ground truth actions). This suggests that composability plays an important role in learning a disentangled representation of actions.

:

Denton & Fergus (2018) use the objective with βz, but formulate this objective in terms of the original VAE.

To allow the generative model to distinguish between individual action representations z and trajectory representations ν, we concatenate them with a binary indicator set to 0 for z and 1 for ν. With the binary indicator, we can control whether the generative network interprets an input latent as the representation of a single action or a whole trajectory.

The original dataset provides two additional discrete actions: gripper closing and lifting. However, we found that, in this dataset, the spatial position in the horizontal plane explains most of the variance in the end effector position and therefore ignore the discrete actions in this work.

Figures and Tables:

Figure1: Using latent composition to recover actions from passive data. a) Two sequences starting from different initial states but changing according to the same actions. Without requiring labels, our model learns to represent the action in sequences like these identically. We train a representation z to capture the dynamics of the scene and its compositional structure: applying (z 1 and z 2 ) should have the same effect as applying the composed representation g(z 1 , z 2 ). These properties capture the fact that effector systems, such as a robot arm, use the same composable action space in many different states. b) The learned action space z recovered by our method (PCA visualization). Points are colored by the true action u: true actions can be easily decoded from z, validating that the structure of the action space has been captured.

Figure 2: Components of the proposed architecture. Left: The stochastic video prediction model, shown for one timestep. During training, we estimate the latent variable z t using the approximate inference network (MLP infer , CNN e ) from the current and previous image. At test time, we produce z t using the prior distribution p(z) ∼ N (0, I). Future frames are estimated by passing z t together with images x t-1 through the generative network (LSTM, CNN d ). Please refer to Appendices A and B for architectural details. Right: Composability training. Latent samples z are concatenated pairwise and passed through the composition network MLP comp that defines a distribution over ν in the trajectory space. A sampled value of ν is decoded into an image through the same generative network (LSTM and CNN d ) and matched to the final image in the composed sequence.

Figure 3: Visualization of the learned action space, z, on the reacher dataset. Each of the 1000 points depicts a value of z for a different frame pair from the dataset. We plot the projection of z onto the first two principal components of the data. Each point is colored by the value of the ground truth rotation, in radians, depicted in the two images used to infer z for that point. a) The latent space learned by the baseline model has no discernible correspondence to the ground truth actions. b) Our method learns a latent space with a clear correspondence to the ground truth actions. In the Appendix, Fig. 15 further investigates why the baseline fails to produce a disentangled representation.

Figure 4: Illustration of how the learned representation can be used for a) action-conditioned prediction by inferring the latent variable, z t , from the action, and b) visual servoing by solving the control problem in latent space through iterated rollouts and then mapping the latent variable to robot control actions, u t .

Figure 5: Transplantation of action representations z from one sequence to another. We infer action representations from the donor sequence and use them to create the recipient sequences from a different initial state. a) the reacher dataset. The previous frame is superimposed onto each frame to illustrate the movement. b) the BAIR dataset. The previous and the current position of the end effector are annotated in each frame (red and blue dots, respectively) to illustrate the movement. c) reacher with varying backgrounds. d) reacher with varying agent shape. The synchronization of movement in the sequences suggests that the learned action representation is disentangled from static content. Best viewed on a screen. Additional generated videos are available at: https: //daniilidis-group.github.io/learned_action_spaces/.

Figure 6: Visual servoing on the reacher task. Left: Planned and executed servoing trajectories. Each of the first five rows shows the trajectory re-planned at the corresponding timestep. The first image of each sequence is the current state of the system, and the images to the right of it show the model prediction with the lowest associated cost. The target state (the reacher pointing to the upper left) is shown superimposed over each image. Right: Data efficiency measured as final distance to the goal after servoing, shown depending on the number of videos used in training. Each point represents a model trained on a dataset with a restricted number of action-annotated training sequences. Full results are in Table4in the appendix.

Planning in the learned action space Require: Video prediction model xt:t+K = µ θ (x 1:t-1 , z 2:t+K ) Require: Start and goal images i 0 and i goal 1: for t = 1 . . . T do for K steps, obtain M future sequences τ = xt:t+K 5: Compute cosine distance between final and goal image: c(τ ) = cos(x t+K , i goal ) 6: Choose M best sequences, refit Gaussian distribution: µ n+1 , σ n+1 = fit(z n ) 7: Sample new latents from updated distribution: z n+1 ∼ N (µ n+1 , σ n+1 ) first latent of best sequence to action: u * = MLP act (z * N,0 ) 10: Execute u * and observe next image 11: end forTable 5: Hyperparameters for the visual servoing experiments. We sample an angle uniformly from the angle difference range to create each subsequent image in a sequence. , 40 • ]The parameters used for our visual servoing experiments are listed in Tab. 5.

Figure 7: Error histogram of the angle detection algorithm on the reacher training set. The output of this algorithm is used as a form of surrogate ground truth to evaluate model performance.

Figure 8: Trajectory transplantation with differing visual characteristics. The trajectory from the top sequence is transplanted to a different environment and initial state in each of the two bottom sequences. Our model achieves almost perfect accuracy, which validates that it has indeed learned a representation of actions disentangled from the static content, such as the background, agent's appearance, and the initial state. The previous frame is superimposed onto each frame to illustrate the movement. Top: dataset with varying backgrounds. Bottom: dataset with varying robots. Additional generated videos are available at: https://daniilidis-group.github.io/learned_ action_spaces/.

Figure 9: Servoing examples with randomly sampled static CIFAR-10 backgrounds. The figure layout follows the layout of Fig. 6 (left).

Figure 10: Learning from agents with varied visual appearance. Left: Sample agent configurations from the training set. We cover a variety of visual appearances (i.e. arm lengths and widths) but not the configuration used for testing. Right: Test time servoing example after pre-training on observations of agents with varied visual appearances. The figure layout follows the layout of Fig. 6 (left).

Figure15: Visualization of the structure of the learned latent space of the baseline model without composability training on the reacher dataset. The visualization is done in the same manner as in Fig.3. Here, action representations z t are shown as a function of the absolute angle (α) of the reacher arm at time t -1 and the relative angle between the reacher at time t and t -1. We see that the encoding of action learned by the baseline is entangled with the absolute position of the reacher arm. While this representation can be used to predict the consequences of actions given the previous frame, it is impossible to establish a bijection between u t and z t as the correspondence depends on the previous frame x t-1 . Moreover, it is impossible to compose two samples of such a z without access to the intermediate frame. This representation is minimal, as it is a linear transformation (a rotation) of the known optimal representation u t (the ground truth actions). This suggests that composability plays an important role in learning a disentangled representation of actions.

for BAIR.

Table content: <table><tr><td/><td>Reacher</td><td>BAIR</td></tr><tr><td>Method</td><td>Abs. Error [in deg]</td><td>Rel. Error [in px]</td></tr><tr><td>Start State</td><td colspan="2">90.1 ± 51.8 -</td></tr><tr><td>Random</td><td colspan="2">26.6 ± 21.5 -</td></tr><tr><td colspan="3">Denton &amp; Fergus 22.6 ± 17.7 3.6 ± 4.0</td></tr><tr><td>CLASP (Ours)</td><td>2.9 ± 2.1</td><td>3.0 ± 2.1</td></tr><tr><td>Supervised</td><td>2.6 ± 1.8</td><td>2.0 ± 1.3</td></tr></table>

Visual servoing performance measured as distance to the goal at the end of servoing (mean ± standard deviation).

Table content: <table><tr><td>Reacher</td><td/></tr><tr><td>Method</td><td>Distance [deg]</td></tr><tr><td>Start Position</td><td>97.8 ± 23.7</td></tr><tr><td>Random</td><td>27.0 ± 26.8</td></tr><tr><td>Denton &amp; Fergus (2018)</td><td>14.1 ± 10.7</td></tr><tr><td>CLASP (Ours)</td><td>1.6 ± 1.0</td></tr><tr><td>Agrawal et al. (2016)</td><td>2.0 ± 1.5</td></tr><tr><td>Oh et al. (2015)</td><td>1.8 ± 1.5</td></tr><tr><td colspan="2">CLASP (varied background) 3.0 ± 2.2</td></tr><tr><td>CLASP (varied agents)</td><td>2.8 ± 2.9</td></tr></table>

Average absolute angle error (mean ± standard deviation) for action-conditioned video prediction. Note that we could not detect angles on some sequences for the action-conditioned baseline ofOh et al. (2015) trained on only 100 sequences due to bad prediction quality.

Table content: <table><tr><td/><td>Reacher</td><td/><td/></tr><tr><td>Method</td><td colspan="2">Angle Error [deg]</td><td/></tr><tr><td>Training Sequences</td><td>100</td><td>1000</td><td>10 000</td></tr><tr><td>Start Position</td><td/><td>90.6 ± 52.0</td><td/></tr><tr><td>Random</td><td/><td>27.7 ± 22.2</td><td/></tr><tr><td colspan="4">Denton &amp; Fergus (2018) 27.6 ± 22.8 23.8 ± 18.6 23.6 ± 18.3</td></tr><tr><td>CLASP (Ours)</td><td>2.9 ± 2.0</td><td>2.9 ± 2.0</td><td>3.0 ± 2.0</td></tr><tr><td>Oh et al. (2015)</td><td>-</td><td>5.6 ± 4.5</td><td>2.7 ± 1.9</td></tr><tr><td colspan="4">Table 4: Visual servoing performance and data efficiency.</td></tr><tr><td/><td>Reacher</td><td/><td/></tr><tr><td>Method</td><td/><td colspan="2">Distance [deg]</td></tr><tr><td>Training Sequences</td><td>100</td><td>1000</td><td>10 000</td></tr><tr><td>Start Position</td><td/><td>97.8 ± 23.7</td><td/></tr><tr><td>Random</td><td/><td>27.0 ± 26.8</td><td/></tr><tr><td>Denton &amp; Fergus (2018)</td><td colspan="3">20.9 ± 13.0 15.5 ± 13.1 14.1 ± 10.7</td></tr><tr><td>CLASP (Ours)</td><td>2.0 ± 2.2</td><td>2.2 ± 1.8</td><td>1.6 ± 1.0</td></tr><tr><td>Agrawal et al. (2016)</td><td colspan="2">32.7 ± 21.7 3.6 ± 3.1</td><td>2.0 ± 1.5</td></tr><tr><td>Oh et al. (2015)</td><td/><td/><td/></tr></table>

Peer review (iclr2019):
 The authors propose a way to learn models that predict what will happen next in scenarios where action-labels are not available in abundance. The agents extend previous work by proposing a compositional latent-variable model. Results are shown on BAIR (robot pushing objects) and simulated reacher datasets. The results indicate that it is possible to learn a bijective mapping between the latent variables inferred from a pair of images and the action executed between the observations of the two images. I like the proposed model and the fact that it is possible to learn a bijection between the latent variables and actions is cute. I have following questions/comments: (a) The authors have to learn a predictive model from passive data (i.e. without having access to actions). Such models are useful, if for example an agent can observe other agents or internet videos and learn from them. In such scenarios, while it would be possible to learn “a” model using the proposed method, it is unclear how the bijective mapping would be learnt, which would enable the agent to actually use the model to perform a task that it is provided with. In the current setup, the source domain of passive learning and target domain from which action-labelled data is available are the same. In such setups, the scarcity of action-labelled data is not a real concern. When an agent acts, it trivially has access to its own actions. So collecting observation, action trajectories is a completely self-supervised process without requiring any external supervision. (b) How is the model of Agrawal 2016 used for visual serving? Does it used the forward model in the feature space of the inverse model or something else? (c) In the current method, a neural network is used for composition. How much worse would a model perform if we simply compose by adding the feature vectors instead of using a neural network. It seems like a reasonable baseline to me. Also, how critical is including binary indicator for v/z in the compositional model? Overall, I like the technical contribution of the paper. The authors have a very nice introduction on how humans learn from passive data. However, the experiments make a critical assumption that domains that are used for passive and action-based learning are exactly the same. In such scenarios, action-labeled data is abundantly available. I would love to see some results and/or hear the authors thoughts on how their method can be used to learn by observing a different agent/domain and transfer the model to act in the agent’s current domain. I am inclined to vote for accepting the paper if authors provide a convincing rebuttal.