Deep multi-scale video prediction beyond mean square error

Learning to predict future images from a video sequence involves the construction of an internal representation that models the image evolution accurately, and therefore, to some degree, its content and dynamics. This is why pixel-space video prediction may be viewed as a promising avenue for unsupervised feature learning. In addition, while optical flow has been a very studied problem in computer vision for a long time, future frame prediction is rarely approached. Still, many vision applications could benefit from the knowledge of the next frames of videos, that does not require the complexity of tracking every pixel trajectories. In this work, we train a convolutional network to generate future frames given an input sequence. To deal with the inherently blurry predictions obtained from the standard Mean Squared Error (MSE) loss function, we propose three different and complementary feature learning strategies: a multi-scale architecture, an adversarial training method, and an image gradient difference loss function. We compare our predictions to different published results based on recurrent neural networks on the UCF101 dataset


INTRODUCTION
Unsupervised feature learning of video representations is a promising direction of research because the resources are quasi-unlimited and the progress remaining to achieve in this area are quite important. In this paper, we address the problem of frame prediction. A significant difference with the more classical problem of image reconstruction (Vincent et al., 2008;Le, 2013) is that the ability of a model to predict future frames requires to build accurate, non trivial internal representations, even in the absence of other constraints (such as sparsity). Therefore, we postulate that the better the predictions of such system are, the better the feature representation should be. Indeed, the work of Srivastava et al. (2015) demonstrates that learning representations by predicting the next sequence of image features improves classification results on two action recognition datasets. In this work, however, we focus on predicting directly in pixel space and try to address the inherent problems related to this approach.
Top performing algorithms for action recognition exploit the temporal information in a supervised way, such as the 3D convolutional network of Tran et al. (2015), or the spatio-temporal convolutional model of Simonyan & Zisserman (2014), which can require months of training, and heavily labeled datasets. This could be reduced using unsupervised learning. The authors in (Wang & Gupta, 2015) compete with supervised learning performance on ImageNet, by using a siamese architecture (Bromley et al., 1993) to mine positive and negative examples from patch triplets of videos in an unsupervised fashion. Unsupervised learning from video is also exploited in the work of Vondrick et al. (2015), where a convolutional model is trained to predict sets of future possible actions, or in (Jayaraman & Grauman, 2015) which focuses on learning a feature space equivariant to ego-motion. Goroshin et al. (2015) trained a convolutional network to learn to linearize motion in the code space and tested it on the NORB dataset. Beside unsupervised learning, a video predictive system may find applications in robotics (Kosaka & Kak, 1992), video compression (Ascenso et al., 2005) and inpainting (Flynn et al., 2015) to name a few.
Recently, predicting future video sequences appeared in different settings: Ranzato et al. (2014) defined a recurrent network architecture inspired from language modeling, predicting the frames in a discrete space of patch clusters. Srivastava et al. (2015) adapted a LSTM model (Hochreiter & Schmidhuber, 1997) to future frame prediction. Oh et al. (2015) defined an action conditional autoencoder model to predict next frames of Atari-like games. In the two works dealing with natural images, a blur effect is observed in the predictions, due to different causes. In (Ranzato et al., 2014), the transformation back and forth between pixel and clustered spaces involves the averaging of 64 predictions of overlapping tilings of the image, in order to avoid a blockiness effect in the result. Short term results from Srivastava et al. (2015) are less blurry, however the 2 loss function inherently produces blurry results. Indeed, using the 2 loss comes from the assumption that the data is drawn from a Gaussian distribution, and works poorly with multimodal distributions.
In this work, we address the problem of lack of sharpness in the predictions. We assess different loss functions, show that generative adversarial training (Goodfellow et al., 2014;Denton et al., 2015) may be successfully employed for next frame prediction, and finally introduce a new loss based on the image gradients, designed to preserve the sharpness of the frames. Combining these two losses produces the most visually satisfying results.
Our paper is organised as follows: the model section describes the different model architectures: simple, multi-scale, adversarial, and presents our gradient difference loss function. The experimental section compares the proposed architectures and losses on video sequences from the Sports1m dataset of Karpathy et al. (2014) and UCF101 (Soomro et al., 2012). We further compare our results with (Srivastava et al., 2015) and (Ranzato et al., 2014). We measure the quality of image generation by computing similarity and sharpness measures.

MODELS
Let Y = {Y 1 , ..., Y n } be a sequence of frames to predict from input frames X = {X 1 , ..., X m } in a video sequence. Our approach is based on a convolutional network (LeCun et al., 1998), alternating convolutions and Rectified Linear Units (ReLU) (Nair & Hinton, 2010 Such a network G, displayed in Figure 1, can be trained to predict one or several concatenated frames Y from the concatenated frames X by minimizing a distance, for instance p with p = 1 or p = 2, between the predicted frame and the true frame: However, such a network has at least two major flaws: 1. Convolutions only account for short-range dependencies, limited by the size of their kernels. However, using pooling would only be part of the solution since the output has to be of the same resolution as the input. There are a number of ways to avoid the loss of resolution brought about by pooling/subsampling while preserving long-range dependencies. The simplest and oldest one is to have no pooling/subsampling but many convolution layers (Jain et al., 2007). Another method is to use connections that "skip" the pooling/unpooling pairs, to preserve the high frequency information (Long et al., 2015;Dosovitskiy et al., 2015;Ronneberger et al., 2015). Finally, we can combine multiple scales linearly as in the reconstruction process of a Laplacian pyramid (Denton et al., 2015). This is the approach we use in this paper.
2. Using an 2 loss, and to a lesser extent 1 , produces blurry predictions, increasingly worse when predicting further in the future. If the probability distribution for an output pixel has two equally likely modes v 1 and v 2 , the value v avg = (v 1 + v 2 )/2 minimizes the 2 loss over the data, even if v avg has very low probability. In the case of an 1 norm, this effect diminishes, but do not disappear, as the output value would be the median of the set of equally likely values.

MULTI-SCALE NETWORK
We tackle Problem 1 by making the model multi-scale. A multi-scale version of the model is defined as follows: Let s 1 , . . . , s N scales be the sizes of the inputs of our network. Typically, in our experiments, we set s 1 = 4 × 4, s 2 = 8 × 8, s 3 = 16 × 16 and s 4 = 32 × 32. Let u k be the upscaling operator toward size s k . Let X i k , Y i k denote the downscaled versions of X i and Y i of size s k , and G k be a network that learns to predict Y k − u k (Y k−1 ) from X k and a coarse guess of Y k . We recursively define the network G k , that makes a predictionŶ k of size s k , bŷ (2) Therefore, the network makes a series of predictions, starting from the lowest resolution, and uses the prediction of size s k as a starting point to make the prediction of size s k+1 . At the lowest scale s 1 , the network takes only X 1 as an input. This architecture is illustrated on Figure 2, and the specific details are given in Section 3. The set of trainable parameters is denoted W G and the minimization is performed via Stochastic Gradient Descent (SGD).

Figure 2: Multi-scale architecture
Despite the multi-scale architecture, the search of Y from X without making any assumption on the space of possible configurations still leads to blurry predictions, because of Problem 2. In order to further reduce this effect, the next two sections introduce an adversarial strategy and the image gradient difference loss.

ADVERSARIAL TRAINING
Generative adversarial networks were introduced by Goodfellow et al. (2014), where images patches are generated from random noise using two networks trained simultaneously. In that work, the authors propose to use a discriminative network D to estimate the probability that a sample comes from the dataset instead of being produced by a generative model G. The two models are simultaneously trained so that G learns to generate frames that are hard to classify by D, while D learns to discriminate the frames generated by G. Ideally, when G is trained, it should not be possible for D to perform better than chance.
We adapted this approach for the purpose of frame prediction, which constitutes to our knowledge the first application of adversarial training to video prediction. The generative model G is typically the one described in the previous section. The discriminative model D takes a sequence of frames, and is trained to predict the probability that the last frames of the sequence are generated by G. Note only the last frames are either real of generated by G, the rest of the sequence is always from the dataset. This allows the discriminative model to make use of temporal information, so that G learns to produce sequences that are temporally coherent with its input. Since G is conditioned on the input frames X, there is variability in the input of the generator even in the absence of noise, so noise is not a necessity anymore. We trained the network with and without adding noise and did not observe any difference. The results we present are obtained without random noise.
Our main intuition on why to use an adversarial loss is that it can, theoretically, address the Problem 2 mentioned in Section 2. Imagine a sequence of frames X = (X 1 , . . . , X m ) for which, in the dataset, the next frames can either be Y = (Y 1 , . . . , Y n ) or Y = (Y 1 , . . . , Y n ), with equal probability. As explained before, training the network with an 2 loss will result in predicting the average frames Y avg = (Y + Y )/2. However, the sequence (X, Y avg ), composed of the frames of X followed by the frames of Y avg , is not a likely sequence, and D can discriminate them easily. The only sequences the model D will not be able to classify as fake are (X, Y ) and (X, Y ).
The discriminative model D is a multi-scale convolutional network with a single scalar output. The training of the pair (G, D) consists of two alternated steps, described below. For the sake of clarity, we assume that we use pure SGD (minibatches of size 1), but there is no difficulty to generalize the algorithm to minibatches of size M by summing the losses over the samples.
Training D: Let (X, Y ) be a sample from the dataset. Note that X (respectively Y ) is a sequence of m (respectively n) frames. We train D to classify the input (X, Y ) into class 1 and the input (X, G(X)) into class 0. More precisely, for each scale k, we perform one SGD iteration of D k while keeping the weights of G fixed. It is trained with in the target 1 for the datapoint (X k , Y k ), and the target 0 for (X k , G k (X k )). Therefore, the loss function we use to train D is where L bce is the binary cross-entropy loss, defined as Training G: Let (X, Y ) be a different data sample. While keeping the weights of D fixed, we perform one SGD step on G to minimize the adversarial loss: Minimizing this loss means that the generative model G is making the discriminative model D as "confused" as possible, in the sense that D will not discriminate the prediction correctly. However, in practice, minimizing this loss alone can lead to instability. G can always generate samples that "confuse" D, without being close to Y . In turn, D will learn to discriminate these samples, leading G to generate other "confusing" samples, and so on. To address this problem, we train the generator with a combined loss composed of the of the adversarial loss and the L p loss . The generator G is therefore trained to minimize λ adv L G adv + λ p L p . There is therefore a tradeoff to adjust, by the mean of the λ adv and λ p parameters, between sharp predictions due to the adversarial principle, and similarity with the ground truth brought by the second term. This process is summarized in Algorithm 1, with minibatches of size M .

IMAGE GRADIENT DIFFERENCE LOSS (GDL)
Another strategy to sharpen the image prediction is to directly penalize the differences of image gradient predictions in the generative loss function. We define a new loss function, the Gradient Difference Loss (GDL), that can be combined with a p and/or adversarial loss function. The GDL function between the ground truth image Y , and the prediction G(X) =Ŷ is given by Algorithm 1: Training adversarial networks for next frame generation Set the learning rates ρ D and ρ G , and weights λ adv , λ p . while not converged do Update the discriminator D: where α is an integer greater or equal to 1, and |.| denotes the absolute value function. To the best of our knowledge, the closest related work to this idea is the work of Mahendran & Vedaldi (2015), using a total variation regularization to generate images from learned features. Our GDL is fundamentally different: In (Mahendran & Vedaldi, 2015), the total variation takes only the reconstructed frame in input, whereas our loss penalises gradient differences between the prediction and the true output. Second, we chose the simplest possible image gradient by considering the neighbor pixel intensities differences, rather than adopting a more sophisticated norm on a larger neighborhood, for the sake of keeping the training time low.

COMBINING LOSSES
In our experiments, we combine the losses previously defined with different weights. The final loss is:

EXPERIMENTS
We now provide a quantitative evaluation of the quality of our video predictions on UCF101 (Soomro et al., 2012) and Sports1m (Karpathy et al., 2014) video clips. We train and compare two configurations: (1) We use 4 input frames to predict one future frame. In order to generate further in the future, we apply the model recursively by using the newly generated frame as an input. (2) We use 8 input frames to produce 8 frames simultaneously. This second configuration represents a significantly harder problem and is presented in Appendix.

DATASETS
We use the Sports1m for the training, because most of UCF101 frames only have a very small portion of the image actually moving, while the rest is just a fixed background. We train our network by randomly selecting temporal sequences of patches of 32 × 32 pixels after making sure they show enough movement (quantified by the 2 difference between the frames). The data patches are first normalized so that their values are comprised between -1 and 1.

NETWORK ARCHITECTURE
We present results for several models. Unless otherwise stated, we employed mutliscale architectures. Our baseline models are using 1 and 2 losses. The GDL-1 (respectively GDL-2 ) model is using a combination of the GDL with α = 1 (respectively α = 2) and p = 1 (respectively p = 2) loss; the relative weights λ gdl and λ p are both 1. The adversarial (Adv) model uses the adversarial loss, with p = 2 weighted by λ adv = 0.05 and λ p = 1. Finally, the Adv+GDL model is a combination or the adversarial loss and the GDL, with the same parameters as for Adv with α = 1 and λ gdl = 1.
Generative model training: The generative model G architecture is presented in Table 1. It contains padded convolutions interlaced with ReLU non linearities. A Hyperbolic tangent (Tanh) is added at the end of the model to ensure that the output values are between -1 and 1. The learning rate ρ G starts at 0.04 and is reduced over time to 0.005. The minibatch size is set to 4, or 8 in the case of the adversarial training, to take advantage of GPU hardware capabilities. We train the network on small patches, and since it is fully convolutional, we can seamlessly apply it on larger images at test time.
Adversarial training: The discriminative model D, also presented in Table 1, uses standard non padded convolutions followed by fully connected layers and ReLU non linearities. For the largest scale s 4 , a 2 × 2 pooling is added after the convolutions. The network is trained by setting the learning rate ρ D to 0.02.

QUANTITATIVE EVALUATIONS
To evaluate the quality of the image predictions resulting from the different tested systems, we compute the Peak Signal to Noise Ratio (PSNR) between the true frame Y and the predictionŶ : where maxŶ is the maximum possible value of the image intensities. We also provide the Structural Similarity Index Measure (SSIM) of Wang et al. (2004). It ranges between -1 and 1, a larger score meaning a greater similarity between the two images.
To measure the loss of sharpness between the true frame and the prediction, we define the following sharpness measure based on the difference of gradients between two images Y andŶ :  As for the other measures, a larger score is better. These quantitative measures on 378 test videos from UCF101 1 are given in Table 2. As it is trivial to predict pixel values in static areas, especially on the UCF101 dataset where most of the images are still, we performed our evaluation in the moving areas as displayed in Figure 3. To this end, we use the EpicFlow method of Revaud et al. (2015), and compute the different quality measures only in the areas where the optical flow is higher than a fixed threshold 2 . Similarity and sharpness measures computed on the whole images are given in Appendix.
The numbers clearly indicate that all strategies perform better than the 2 predictions in terms of PSNR, SSIM and sharpness. The multi-scale model brings some improvement, but used with an 2 norm, it does not outperform simple frame copy in the moving areas. The 1 model improves the results, since it replaces the mean by the median value of individual pixel predictions. The GDL and adversarial predictions are leading to further gains, and finally the combination of the multi-scale, 1 norm, GDL and adversarial training achieves the best PSNR, SSIM and Sharpness difference measure.
It is interesting to note that while we showed that the 2 norm was a poor metric for training predictive models, the PSNR at test time is the worst for models trained optimising the 2 norm, although the PSNR is based on the 2 metric. We also include the baseline presented in Ranzato et al. (2014) -courtesy of Piotr Dollar -that extrapolates the pixels of the next frame by propagating the optical flow from the previous ones. Figure 4 shows results on test sequences from the Sport1m dataset, as movements are more visible in this dataset.

COMPARISON TO RANZATO ET AL. (2014)
In this section, we compare our results to (Ranzato et al., 2014). To obtain grayscale images, we make RGB predictions and extract the Y channel of our Adv+GDL model. Ranzato et al. (2014) images are generated by averaging 64 results obtained using different tiling to avoid a blockiness effect, however creating instead a blurriness effect. We compare the PSNR and SSIM values on the first predicted images of Figure 5.  We note that the results of Ranzato et al. appear slightly lighter than our results because of a normalization that does not take place in the original images, therefore the errors given here are not reflecting the full capacity of their approach. We tried to apply the blind deconvolution method of Krishnan et al. (2011) to improve Ranzato et al. and our different results. As expected, the obtained sharpness scores are higher, but the image similarity measures are deteriorated because often the contours of the predictions do not match exactly the targets. More importantly, Ranzato et al. results appear to be more static in moving areas. Visually, the optical flow result appears similar to the target, but a closer look at thin details reveals that lines, heads of people are bent or squeezed.

CONCLUSION
We provided a benchmark of several strategies for next frame prediction, by evaluating the quality of the prediction in terms of Peak Signal to Noise Ratio, Structural Similarity Index Measure and image sharpness. We display our results on small UCF video clips at http://cs.nyu.edu/ mathieu/iclr2016.html. The presented architectures and losses may be used as building blocks for more sophisticated prediction models, involving memory and recurrence. Unlike most optical flow algorithms, the model is fully differentiable, so it can be fine-tuned for another task if necessary. Future work will deal with the evaluation of the classification performances of the learned Figure 5: Comparison of results on the Basketball Dunk and Ice Dancing clips from UCF101 appearing in (Ranzato et al., 2014). We display 2 frame predictions for each method along with 2 zooms of each image. The PSNR and SSIM values are computed in the moving areas of the images (More than the 2/3 of the pixels in these examples). The values in parenthesis correspond to the second frame predictions measures.

Target
Prediction representations in a weakly supervised context, for instance on the UCF101 dataset. Another extension of this work could be the combination of the current system with optical flow predictions. Alternatively, we could replace optical flow predictions in applications that does not explicitly re-quire optical flow but rather next frame predictions. A simple example is causal (where the next frame is unknown) segmentation of video streams.

PREDICTING THE EIGHT NEXT FRAMES
In this section, we trained our different multi-scale models -architecture described in Table 3-with 8 input frames to predict 8 frames simultaneously. Image similarity measures are given between the ground truth and the predictions in Table 4. For the first and eighth predicted frames, the numbers clearly indicate that all strategies perform better than the 2 predictions in terms of PSNR and sharpness. The 1 model, by replacing the mean intensity by the median value in individual pixel predictions, allows us to improve results. The adversarial predictions are leading to further gains, and finaly the GDL allows the predictions to achieve the best PNSR and sharpness. We note that the size of the network employed in the simultaneous prediction configuration is smaller than in the unique frame prediction setting.  Figure 6 shows a generation result of eight frames simultaneously, using a large version of the GDL 1 model in which all the number of feature maps were multiplied by four. Compared to the recursive frame prediction as employed in the rest of the paper, predicting several input simultaneouly leads to better long term results but worst shorter term ones. The gap between the two performances could be reduced by the design of time multi-scale strategies.

COMPARISON TO THE LSTM APPROACH OF SRIVASTAVA ET AL. (2015)
Figure 7 shows a comparison with predictions based on LSTMs using sequences of patches from (Srivastava et al., 2015). The model ranking established on UCF101 in terms of sharpness and PSNR remains unchanged on the two sequences. When we employ the setting 8 inputs-8 output described in Table 3, we note that the LSTM first frame prediction is sharper than our models predictions, however when looking at a longer term future, our gradient difference loss leads to sharper results. Comparing visually the GDL 1 and GDL 2 , we notice that the predictions suffer from a chessboard effect in the 2 case. On the other hand, when employing the recursive strategy (4 inputs, 1 output), the adversarial training lead to much sharper predictions. It does not look like anything close to the ground truth on the long term, but it remains realistic. Figure 7: Comparison of different methods to predict 32 × 32 patches from UCF101. The LSTM lines are from (Srivastava et al., 2015). Baseline results with pure 1 and 2 losses are shown in Appendix.

Input
Ground truth

ADDITIONAL RESULTS ON THE UCF101 DATASET
We trained the model described in Table 1 with our different losses to predict 1 frame from the 4 previous ones. We provide in Table 5 similarity (PSNR and SSIM) and sharpness measures between the different tested models predictions and frame to predict. The evaluation is performed on the full images but is not really meaningful because predicting the future location of static pixels is most accurately done by copying the last input frame.