End-to-End Learning of Motion Representation for Video Understanding
Despite the recent success of end-to-end learned representations, hand-crafted optical flow features are still widely used in video analysis tasks. To fill this gap, we propose TVNet, a novel end-to-end trainable neural network, to learn optical-flow-like features from data. TVNet subsumes a specific optical flow solver, the TV-L1 method, and is initialized by unfolding its optimization iterations as neural layers. TVNet can therefore be used directly without any extra learning. Moreover, it can be naturally concatenated with other task-specific networks to formulate an end-to-end architecture, thus making our method more efficient than current multi-stage approaches by avoiding the need to pre-compute and store features on disk. Finally, the parameters of the TVNet can be further fine-tuned by end-to-end training. This enables TVNet to learn richer and task-specific patterns beyond exact optical flow. Extensive experiments on two action recognition benchmarks verify the effectiveness of the proposed approach. Our TVNet achieves better accuracies than all compared methods, while being competitive with the fastest counterpart in terms of features extraction time.READ FULL TEXT VIEW PDF
Most of the top performing action recognition methods use optical flow a...
In this paper, we propose a convolutional layer inspired by optical flow...
The video and action classification have extremely evolved by deep neura...
Currently, the most common motion representation for action recognition ...
This paper introduces a new method for inter-frame coding based on two
In this paper, we revive the use of old-fashioned handcrafted video
Superpixels provide an efficient low/mid-level representation of image d...
End-to-End Learning of Motion Representation for Video Understanding
Deep learning and especially Convolutional Neural Networks (CNNs) have revolutionized image-based tasks, e.g., image classification  and objective detection . However, the progress on video analysis is still far from satisfactory, reflecting the difficulty associated with learning representations for spatiotemporal data. We believe that the major obstacle is that the distinctive motion cues in videos demand some new network designs, which are yet to be found and tested.
While there have been some attempts  to learn features by convolution operations over both spatial and temporal dimensions, optical flow is still widely and effectively used for video analysis [28, 9, 10, 40, 15, 29]. The optical flow, as the name implies, captures the displacements of pixels between two consecutive frames 
. Thus, applying the optical flow to the video understanding tasks enables one to model the motion cues explicitly, conveniently, but inefficiently. It is often computationally expensive to estimate the optical flows. A currently successful example of applying optical flow to video understanding is the two-stream model, where a CNN is trained on the optical flow data to learn action patterns. Various extensions of the two-stream model have been proposed and achieved state-of-the-art results on serval tasks including action recognition [28, 9, 10, 40] and action detection [15, 29].
Despite the remarkable performance, current optical-flow-based approaches have notable drawbacks:
Training is a two-stage pipeline. In the first stage, the optical flow for every two consecutive frames is extracted via the optimization-based method (e.g. TV-L1 ). In the second stage, a CNN is trained on the extracted flow data. These two stages are separated and the information (e.g. gradients) from the second stage cannot be used to adjust the process of the first stage.
Optical flow extraction is expensive in space and time. The extracted optical flow has to be written to the disk for both the training and testing. For the UCF-101 dataset  which contains about 10 thousands videos, extracting optical flows for all data via the TV-L1 method takes one GPU-day, and storing them costs more than one TeraByte of storage for the original fields as floats (often a linear JPEG normalization is required to save storage cost ).
To tackle the above mentioned problems, we propose a novel neural network design for learning optical-flow like features in an end-to-end manner. This network, named TVNet, is obtained by imitating and unfolding the iterative optimization process of TV-L1 . In particular, we formulate the iterations in the TV-L1 method as customized layers of a neural network. As a result, our TVNet is well-grounded and can be directly used without additional training by any groundtruth optical flows.
Furthermore, our TVNet is end-to-end trainable, and can therefore be naturally connected with a tasks-specific network (e.g. action classification network) to form a “deeper” end-to-end trainable architecture. As a result, it is not necessary to pre-compute or store the optical-flow features anymore.
Finally, by performing the end-to-end learning, it is possible to fine-tune the weights of the TVNet that is initialized as a standard optical flow feature extractor. This allows us to discover richer and task-specific features (compared to the original optical flow) and thus to deliver better performance.
To verify the effectiveness of the proposed architecture, we perform experimental comparisons between the proposed TVNet and several competing methods on two action recognition benchmarks (HMDB51  and UCF101 ).
To sum up, this paper makes the following contributions:
We develop a novel neural network to learn motions from videos by unfolding the iterations of the TV-L1 method to customized neural layers. The network, dubbed TVNet, is well-initialized and end-to-end trainable.
Despite being initialized as a specific TV-L1 architecture, the proposed TVNet can be further fine-tuned to learn richer and more task-oriented features than the standard optical flow.
Video understanding, such as action recognition and action similarity detection, has attracted a lot of research attention in the past decades. Different from static image understanding, video understanding requires more reliable motion features to reflect the dynamic changes occurring in videos. Laptev et al.  proposed a spatio-temporal interest points (STIPs) method by extending Harris corner detectors to 3-dimensional space to capture motion. Similarly, the 3D extensions of SIFT and HOG have also been investigated  and , respectively. Wang et al.  proposed improved Dense Trajectories (iDT), where the descriptors were obtained by tracking densely sampled points and describing the volume around the tracklets by histograms of optical flow (HOF) and motion boundary histograms (MBH). Despite its stat-of-the-art performances, IDT is computationally expensive and becomes intractable on large-scale video dataset.
Motivated by the promising results of deep networks on image understanding tasks, there have also been a number of attempts to develop deep architectures to learn motion features for video understanding [20, 21, 28, 13, 17, 43, 14, 12]. The leading approaches fall into two broad categories. The first one is to learn appearance and motion jointly by extending 2D convolutional layers to 3D counterparts [36, 20], including recently proposed I3D  and P3D . However, modeling motion information through 3D convolutional filters is computationally expensive, and large-scale training videos are needed for desired performance . The other category of work is based on two-stream networks [33, 28, 40, 9, 10, 26]. This line of approaches trains two networks, one using the appearance (i.e., RGB) data and the other one using hand-crafted motion features such as optical flow to represent motion patterns. In contrast, in our method, the motion descriptor is learned with a trainable neural network rather than hand-crafted. As a consequence, our optical-flow-like motion features can be jointly learned and fine-tuned using a task-specific network. Additionally, we do not need to store and read the optical flow from disk, leading to significant computational gains.
A recent research topic is to estimate optical flow by CNNs [8, 35, 31, 18, 26, 4]. These approaches cast the optical flow estimation as an optimization problem with respect to the CNN parameters. A natural idea is to combine the flow CNN with the task-specific network to formulate an end-to-end model (see for example in ). Nevertheless, an obvious issue of applying the flow nets is that they require thousands of hundreds of groundtrue flow images to train the parameters of the flow network to produce meaningful optical flows (see ). For real applications, it is costly to obtain the labeled flow data. In contrast, our network is well initialized as a particular TV-L1 method and is able to achieve desired performance even in its initial form (without fine-tuning).
Recently, Ng et al.  proposed to train a single stream convolutional neural network to jointly estimate optical flow and recognize actions, which is most relevant to our work. To capture the motion feature, they formulated FlowNet  to learn the optical flow from synthetic ground truth data. Though the results are promising, the approach still lags behind the state of the arts in terms of accuracy compared to traditional approaches. This is due to the well known gap between synthetic and real videos. Contrastly, our network is formulated by unfolding the TV-L1 method that has been applied successfully to action recognition and we do not rely on the groundtruth of optical flow for training. Thus, our network combines the strengths of both TV-L1 and deep learning.
A video sequence can be written as a function of three arguments, , where index the spatial dimensions is for the time dimension. Denote by all the coordinates of the pixels in a frame. The function value corresponds to the pixel brightness at position in the -th video frame. A point may move from time to time across the video frames, and the optical flow is to track such displacement between adjacent frames. We denote by the displacement of the point from time to the next frame . We omit the superscript and/or argument from when no ambiguity is caused.
Among the existing approaches to estimating optical flows, the TV-L1 method  is especially appealing for its good balance between efficiency and accuracy. We review it in detail in this subsection to make the paper self-contained. The design of our TV-Net (cf. Section 4) is directly motivated by the optimization procedure of TV-L1.
The main formulation of TV-L1 is as follows,
where the first term accounts for the smoothness condition, while the second term corresponds to the famous brightness constancy assumption . In particular, the brightness of a point is assumed to remain the same after it shifts to a slightly different location in the next frame, i.e., . Accordingly, is defined in order to penalize the brightness difference in the second term. Since the function is highly non-linear with respect to , Zach et al.  approximate the brightness difference by the Taylor expansion at an initial displacement , leading to .
The above gives a first-order approximation to the original problem and linearizes it to an easier form. Furthermore, the authors introduce an auxiliary variable to enable a convex relaxation of the original problem
in which a very small can force and to be equal at the minimum. This objective is minimized by alternatively updating and . The details of the optimization process are presented in Algorithm 1, where the variables and
are the dual flow vector fields.
The core computation challenge in the algorithm is on the pixel-wise computations of the gradients (i.e., and ), divergence (i.e., ), and warping (i.e., and ). The details of the numerical estimations are provided as below.
Gradient-1. The gradient of the image is computed by central difference:
We can similarly compute along the index.
Gradient-2. The gradient of each component of the flow is computed via the forward difference:
where . Also, can be similarly computed by taking the difference on the index.
Divergence. The divergence of the dual variables is computed via the backward difference:
Another pixel-wise estimation is the brightness . It is often obtained by warping the frame along the initial flow field using the bicubic interpolation.
Multi-scale TV-L1. Since the Taylor expansion is applied to linearize the brightness difference, the initial flow field should be close to the real field to ensure a small approximation error. To achieve this, the approximation field is derived by a multi-scale scheme in a coarse-to-fine manner. To be specific, at the coarsest level, is initialized as the zero vectors and the corresponding output of Algorithm 1 is applied as the initialization of the next level111Figure 1 in the supplementary material demonstrates the framework with three-scale optimization..
This section presents the main contribution of this paper, i.e., the formulation of TVNet. The central idea is to imitate the iterative process in TV-L1 and meanwhile unfold the iterations into a layer-to-layer transformations, in the same spirit as the neural networks.
We now revisit Algorithm 1 and convert its key components to a neural network. First, the iterations in Algorithm 1 can be unfolded as a fixed-size feed-forward network if we fix the number of the iterations within the while-loop to be (see Figure 2). Second, each iteration (i.e. layer) is continuous and is almost everywhere smooth with respect to the input variables. Such property ensures that the gradients can be back-propagated through each layer, giving rise to an end-to-end trainable system.
Converting Algorithm 1 into a neural network involves efficiency and numerical stability considerations. To this end, we modify Algorithm 1 by replacing the computations of the gradients and divergence Eq. (3)-(5) with specific convolutions, performing warping with bilinear interpolation, and stabilizing the division calculations with a small threshold. We provide the details below.
Convolutional computation. The most tedious part in Algorithm 1 is the pixel-wise computation of Eq. (3)-(5). We propose to perform all these calculations with specific convolutional layers. We define the following kernels,
where defines the convolution operation. Eq. (6) only describes the kernels along the axis. We transpose them to obtain the kernels along the axis.
The divergence in Eq.(5) is computed by a backward difference, but the convolution is computed in a forward direction. To rewrite Eq.(5) in convolution form, we need to first shift the pixels of right (and shift
down) by one pixel and pad the first column of(and the first row of ) with zeros, leading to (and ). Then, Eq.(5) can be transformed to
The original TV-L1 method uses bicubic interpolation for the warping process. Here, for efficiency reasons, we adopt bilinear interpolation instead. Note that the bilinear interpolation has been applied successfully in previous works such as the spatial transformer network and the optical flow extraction method . We denote by the warping. Then, we compute
where and are respectively the horizontal and vertical flow values of at position . We follow the details in  and derive the partial gradients for Eq. (10) with respect to as the bilinear interpolation is continuous and piecewise smooth.
Numerical stabilization. We need to take care of the division in Algorithm 1, i.e., . The operation is ill-defined when the denominator is equal to zero. To avoid this issue, the original TV-L1 method checks whether the value of is bigger than a small constant; if not, the algorithm will set the denominator to be this small constant. Here, we utilize a soft non-zero transformation by rewriting the update of as where a small value is added to the denominator. This transformation is more efficient as we do not need to explicitly check the value of at each step.
Another division computation in Algorithm 1 is At first glance, this division is safe since the denominator is guaranteed to be larger than . However, as we will see later, its gradients contain division computations where the denominators can be zero. Thus, we apply the soft transformation by adding a small value to the denominator, namely,
The gradient of with respect to is in this form
where and are well-defined variables (the details are provided in the supplementary material). In practice, both and are often equal to zero within the still area of the image (e.g., the background). As such, the computation of the gradients would encounter a division by zero if the positive term was not added in Eq. (12).
Multi-scale version. The multi-scale TVNet is formulated by directly unfolding the multi-scale version of TV-L1. A higher scale takes as input the up-sampled output of its immediate lower scale. There are multiple warps at each scale and each warp consists of multiple iterations. Hence, the total number of iterations of the multi-scale TVNets are .
In the previous section, we have transformed the TV-L1 algorithm to a feed-forward network. However, such network is parameter-free and not learnable. To formulate a more expressive network, we relax certain variables in TV-L1 to be trainable parameters. Relaxing the variables render TVNet not equivalent to TV-L1 any more. However, it allows the network to learn more complex, task-specific feature extractors by end-to-end training.
The first variable we relax is the initialization optical field . In TV-L1, is set to be zero. However, from the optimization prospective, zero initialization is not necessarily the best choice; making trainable will enable us to automatically determine a better initialization for the optimization. We also propose to relax the convolutional filters in Eq. (7)-(9). The original convolutions are used to derive the (numerical) gradients and divergences. Allowing the convolutional filters to be trainable parameters will enable them to discover more complex patterns in a data-driven way. We will demonstrate the benefit of the trainable version compared to the original architecture in our experiments.
As discussed before, our TVNet can be concatenated to any task-specific networks (e.g., the BN-Inception net for action classification ) to perform end-to-end action recogntion without the need of explicitly extracting the optical flow data, as illustrated in Figure 2 (c). Because of the end-to-end structure, the parameters of TVNet can be fine-tuned by back-propagating gradients of the task-specific loss. Additionally, since the original TV-L1 method is developed to minimize the energy function in Eq. (1
), we can also use this function as an additional loss function to force it to produce meaningful optical-flow-like features. To this end, we formulate a multi-task loss as
Here is the action classification loss (e.g. the cross entropy), is defined in Eq. (1) where the exact computation other than the Tailor approximation is applied to compute , and is a hyper-parameter to trade-off these two losses. We set in all our experiments and find that it works well across all of them. Note that it is tractable to compute the gradients of as it has been translated to convolutions and the bilinear interpolation (see § 4.1).
This section performs experimental evaluations to verify the effectiveness of the proposed TVNet. We first carry out a complete comparison between TVNets of various structures with the TV-L1 method regarding the optimization efficiency. Then, we compare the performance of TVNets with state-of-the-art methods on the task of action recognition222We also provide additional experimental evaluations on action similarity labeling in the supplementary material..
The three hyper-parameters, , and determine the structure of the TVNet. For convenience, we denote the TVNet with particular values of the hyper-parameters as TVNet---. We denote the architecture as TVNet- for short when both and are fixed to be 1. For the TV-L1 method, the hyper-parameters are fixed as and
in all experiments unless otherwise specified. Our methods are implemented by the Tensorflow platform. Unless otherwise specified, all experiments were performed on 8 Tesla P40 GPUs.
Initialized as a particular TV-L1 method, the parameters of TVNet can be further finetuned as discussed in Section 4.2. Therefore, it is interesting to evaluate how much the training process can improve the final performance. For this purpose, we compare the estimation errors between TVNet and TV-L1 on the optical flow dataset, i.e., the MiddleBurry dataset .
|Methods||No training||Training||All Training|
Dataset. The MiddleBurry dataset  is a widely-used benchmark for evaluating different optical flow extraction methods. Here we only perform evaluation on the training set as we are merely concerned about the training efficiency of TVNets. For the training set, only 8 image pairs are provided with the ground-true optical flow.
Implementation details. The estimation errors are measured via the average End-Point Error (EPE) defined by
where and are the predicted and ground-true flow fields, respectively. For the training of TVNets, we adopt the EPE (Eq. (14)) as the loss function, and apply the batch gradient decent method with the learning rate and max-iteration being 0.05 and 3000, respectively. Several structures, i.e., TVNet-10, TVNet-30, TVNet-50, TVNet-3-10, TVNet-1-3-10, and their counterparts of TV-L1 are implemented to compare the difference between different network designs.
|TVNet-50 (no training)||55.6%||83.5%|
|TVNet-50 (no flow loss)||56.9%||84.5%|
Results. We have performed one-to-one comparisons between TVNets and TV-L1 on MiddleBurry in Table 1. Given the same architecture, TVNet without training achieves close performance to TV-L1. This is not surprising since TVNet and TV-L1 are almost the same except the way of interpolation (bilinear vs. bicubic). To further evaluate the effect of training , we conduct additional experiments and report the results in Table 1. Clearly, making trainable in TVNets can indeed reduce the End-Point Error. With training both and the convolution filters, all TVNets except TVNet-10 achieve lower errors than TV-L1-5-5-50, even though the number of iterations in TVNets (not more than 50) are much smaller than that of TV-L1-5-5-50 (up to 1250). Figure 3 displays the visualization of the optical flow between TV-L1-5-5-50 and TVNet-50. Another interesting observation is from the comparison between TVNet-30, TVNet-50, TVNet-3-10 and TVNet-1-3-10. It is observed TVNet-30 and TVNet-50 finally outperform TVNet-3-10 and TVNet-1-3-10 after training, implying that the flat structure (i.e. ) is somehow easier to train. For the remaining experiments below, we will only compare the performance between TVNet-50 and TV-L1-5-5-50, and denote TV-L1-5-5-50 as TV-L1 for similarity.
Dataset. Our experiments are conducted on two popular action recognition datasets, namely the UCF101  and the HMDB51  datasets. The UCF101 dataset contains 13320 videos of 101 action classes. The HMDB51 dataset consists of 6766 videos from 51 action categories.
Implementation details. As discussed before, our TVNets can be concatenated by a classification network to formulate an end-to-end model to perform action recognition. We apply the BN-Inception network  as the classification model in our experiments due to its effectiveness. The BN-Inception network is pretrained by the cross-modality skill introduced in  for initialization.
We sample a stack of 6 consecutive images from each video and extract 5 flow frames for every consecutive pair. The resulting stack of optical flows are fed to the BN-Inception network for prediction. To train the end-to-end model, we set the mini-batch size of the sampled stacks to 128 and the momentum to 0.9. The learning rate was initialized to 0.005. The maximum number of learning iterations for the UCF101 and the HMDB51 datasets was chosen as 18000 and 7000, respectively. We decreased the learning rates by a factor of 10 after the 10000th and 16000th iterations for the UCF101 experiment, and after 4000th and 6000th iterations for the HMDB51 case. We only implement TVNet-50 in this experiment. To prevent overfitting, we also carry out the corner cropping and scale jittering ; the learning rate for TVNets is further divided by 255.
For the testing, stacks of flow fields are extracted from the center and four corners of a video. We sample 25 stacks from each location (i.e., center and corners), followed by flipping them horizontally to enlarge the testing samples. All the sampled snippets (250 in total) are fed to BN-Inception  and their outputs are averaged for prediction.
Baselines. Beside the TV-L1 method, we carry out other three widely-used flow extraction baselines including DIS-Fast , DeepFlow  and FlowNet2.0 . For FlowNet2.0, we use the pretrained model by the KITTI dataset. For all baselines, we compute the optical flow beforehand and store the flow fields as JPEG images by linear compression. All methods share the same training setting and classification network for fair comparison.
|ST-ResNet + IDT ||70.3%||94.6%|
|C3D (3 nets) ||-||90.4%|
|Two-Stream Fusion ||65.4%||92.5%|
|Two-Stream (VGG16) ||58.5%||91.4%|
|Two-Stream Model ||59.4%||88.0%|
|Ours + IDT||72.6%||95.4%|
Computational efficiency comparisons. We have added thorough computational comparison between TVNet, TV-L1, DIS-Fast, Deepflow, and Flownet2.0 in Table 2. To do so, we randomly choose one testing video from the UCF101 dataset, and compute the optical flow for every two consecutive frames. The average running time (excluding I/O times) for TVNet-50, TV-L1, DIS-Fast, DeepFlow and FlowNet2.0 are summarized in Table 2. The results verify the advantages of TVNets regarding high number of Frames-per-Second (FPS), low optical flow error, end-to-end trainable property, and small number of model parameters. Flownet2.0 performs more accurately than TV-L1 on the optical flow datasets (e.g. MiddleBurry) as reported by . However, for the action datasets, TV-L1 and our TVNet obtain lower flow error than Flownet2.0 according to Table 2.
Classification accuracy comparisons. Table 3 presents action recognition accuracies of TVNet-50 compared with the four baselines and current best action representation methods. Clearly, TVNet-50 outperforms all compared methods on both datasets. Compared to TV-L1, the improvement of TVNet-50 on UCF101 is not big; however, our TVNet-50 is computationally advantageous over TV-L1 because it only employs one scale and one warp, while TV-L1 adopts five scales and five warps. Even when we freeze its parameters, TVNet-50 still achieves better results than DIS-Fast, DeepFlow and FlowNet2.0; as our TVNet is initialized as a special TV-L1, the initial structure is sufficient to perform promisingly. The TVNet is trained with the multi-task loss given by Eq. (13). To verify the effect of the flow loss term, i.e. , we train a new model only with the classification loss. Table 3 shows that such setting decreases the accuracy.
, are worse than ours. This is probably because TVNet has much fewer parameters than Flownet2.0, making the training more efficient and less prone to overfitting. For the UCF101 dataset, the TVNet outperforms C3D by more than . The C3D method applied 3-dimensional convolutions to learn spatiotemporal features. In contrast to this implicit modeling, in our model, the motion pattern is extracted by TVNet explicitly. We also visualize the outputs by TV-L1 and TVNets in Figure 4.
Comparison with other state-of-the-arts. To compare with state-of-the-art methods, we apply several practical tricks to our TVNet-50, as suggested by previous works [33, 40]. First, we perform the two-stream combination trick  by additionally training a spatial network on RGB images. We use the BN-Inception network as the spatial network and apply the same experimental setting as those in  for the training. At testing, we combine the predictions of the spatial and temporal networks with a fixed weight (i.e., 1:2). Second, to take the long-term temporal awareness into account, we perform the temporal pooling of 3 sampled segments for each video during training as suggested by .
Table 4 summarizes the classification accuracy of TVNets compared with the state-of-the-art approaches over all three splits of the UCF101 and the HMDB51 dataset. The improvements achieved by TVNets are quite substantial compared to the original two-stream method  (6.5% on UCF101 and 11.6% on HMDB51). Such significant gains are achieved as a result of employing better models (i.e., BN-Inception net) and also considering end-to-end motion mining.
The TSN method  is actually a two-stream model with TV-L1 inputs. TSN shares the same classification network and experimental setups as our TVNets. As shown in Table 3, our TVNets outperform TSN on both action datasets (e.g. 71.6% vs. 68.5% on HMDB51), verifying the effectiveness of TVNets for the two-stream models.
Combining CNN models with trajectory-based hand-crafted IDT features  can improve the final performances [38, 36, 5, 9]. Hence, we averaged the L2-normalized SVM scores of FV-encoded IDT features (i.e., HOG, HOF and MBH) with the L2-normalized video predictions (before the loss layer) of our methods. Table 4 summarizes the results and indicates that there is still room for improvement. Our 95.4% on the UCF101 and 72.6% on the HMDB51 remarkably outperform all the compared methods.
A recent state-of-the-art result is obtained by I3D , achieving 97.9% on UCF101 and 80.2% on HMDB51. However, the I3D method improves the performance by using a large amount of additional training data. It is unfair to compare their results with ours.
In this paper, we propose a novel end-to-end motion representation learning framework, named as TVNet. Particularly, we formulate the TV-L1 approach as a neural network, which takes as input stacked frames and outputs optical-flow-like motion features. Experimental results on two video understanding tasks demonstrate its superior performances over the existing motion representation learning approaches. In the future, we will explore more large-scale video understanding tasks to examine the benefits of the end-to-end motion learning method.
International Journal of Computer Vision, 92(1):1–31, 2011.
Proc. Conference on Computer Vision and Pattern Recognition (CVPR), pages 3034–3042, 2016.