{'fraction_non_alphanumeric': 0.03760940523989716, 'fraction_numerical': 0.01981570813715012, 'mean_word_length': 4.844024307900067, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Deep Quantization: Encoding Convolutional Activations with Deep Generative Model

Deep convolutional neural networks (CNNs) have proven highly effective for visual recognition, where learning a universal representation from activations of convolutional layer plays a fundamental problem. In this paper, we present Fisher Vector encoding with Variational Auto-Encoder (FV-VAE), a novel deep architecture that quantizes the local activations of convolutional layer in a deep generative model, by training them in an end-to-end manner. To incorporate FV encoding strategy into deep generative models, we introduce Variational Auto-Encoder model, which steers a variational inference and learning in a neural network which can be straightforwardly optimized using standard stochastic gradient method. Different from the FV characterized by conventional generative models (e.g., Gaussian Mixture Model) which parsimoniously fit a discrete mixture model to data distribution, the proposed FV-VAE is more flexible to represent the natural property of data for better generalization. Extensive experiments are conducted on three public datasets, i.e., UCF101, ActivityNet, and CUB-200-2011 in the context of video action recognition and fine-grained image classification, respectively. Superior results are reported when compared to state-of-the-art representations. Most remarkably, our proposed FV-VAE achieves to-date the best published accuracy of 94.2% on UCF101.


Introduction
The recent advances in deep convolutional neural networks (CNNs) have demonstrated high capability in visual recognition. For instance, an ensemble of residual nets [8] achieves 3.57% in terms of top-5 error on the ImageNet dataset [26]. More importantly, when utilizing the activations of either a fully-connected layer or a convolutional layer in a pre-trained CNN as a universal visual representation and applying this representation to other visual recognition tasks (e.g., scene understanding, and semantic segmen- tation), CNNs also manifest impressive performances. The improvements are expected when CNNs are further finetuned with only amount of task-specific training data.
The activations of different layers in CNN are generally grouped into two dimensions: global activations and convolutional activations. The former directly take activations of the fully-connected layer as visual representations, which are holistic over the entire image as shown in the upper row of Figure 1. The latter, in contrast, create visual representations by encoding a set of regional and local activations from a convolutional layer to a vectorial representation using quantization strategies, e.g., FV [24] is one of the most successful quantization approaches, as illustrated in the middle row of Figure 1. While superior results by aggregating convolutional activations are reported in most recent studies [3,45], convolutional activations are first extracted as local descriptors followed by another separate quantization step. Thus such descriptors may not be optimally compatible with the encoding process, making the quantization sub-optimal. Furthermore, as discussed in [14], the generative model behind of FV, i.e., Gaussian Mixture Model (GMM), cannot always represent the natural clustering of the descriptors and its inflexible Gaussian observation model limits its generalization ability.
We show in this paper that these two limitations can be mitigated by designing a deep architecture for representation learning that combines convolutional activations extraction and quantization into a one-stage learning. Specifically, we present a novel Fisher Vector encoding with Variational Auto-Encoder (FV-VAE) framework to encode convolutional activations with deep generative model (i.e., Variational Auto Encoder), as shown in the bottom row of Figure 1. The pipeline of the proposed deep architecture generally consists of two components: a sub-network with a stack of convolution layers to produce convolutional activations followed by a VAE structure aggregating the regional convolutional descriptors to a FV. VAE consists of hierarchies of conditional stochastic variables and is a highly expressive model by optimizing a variational approximation (an inference/recognition model) to the intractable posterior for the generative distribution. Compared to traditional GMM model which has the form of a mixture of fixed Gaussian components, the inference model here can be regarded as an alternative to predict specific Gaussian components to different inputs by a single neural network, making it more flexible. It is also worth noting that a classification loss is additionally considered to preserve the semantic information in the training stage. The entire architecture is trainable in an end-to-end fashion. Furthermore, in the feature extraction stage, we theoretically prove that the FV of input descriptors can be directly computed by accumulating the gradient vector of reconstruction loss in VAE through back-propagation.
The main contribution of this work is the proposal of FV-VAE architecture to encode convolutional descriptors with Variational Auto-Encoder. We theoretically formulate the computation of FV in VAE and substantiate an implementation of FV-VAE for visual representation learning.

Related Work
In the literature, visual representation generation from a pre-trained CNN model has proceeded along two dimensions: global activations and convolutional activations. The first is to extract visual representation from global activations in a CNN directly, e.g., the outputs from fullyconnected layer in AlexNet [20] / VGG [30] or pool5 layer in GoogleNet [33] / ResNet [8]. In practice, this scheme often starts by pre-training CNN model on a large dataset (e.g., ImageNet) and then fine-tuning the CNN architecture with a small amount of task-specific data to better characterize the intrinsic information in target scenario. The visual representation learnt in this direction has been exploited in a broad range of computer vision tasks including fine-grained image classification [1,19], video action recognition [16,29] and visual captioning [37,39].
Another alternative scheme is to utilize the activations from convolutional layers in CNN as regional and local descriptors. Compared to global activations, convolutional activations from CNN are embedded with rich spatial information, making them more transferable to different domains and more robust to translation and rotation, which have shown the effectiveness in several technological advances, e.g., Spatial Pyramid Pooling (SPP) [7], Fast R-CNN [6] and Fully Convolutional Networks (FCNs) [23].
Recently, many works attempt to produce visual representation by encoding convolutional activations with different quantization strategies. For example, Fisher Vector [24] is computed on the output of the last convolutional layer of VGG networks for describing texture in [3]. Similar in spirit, Xu et al. utilize VLAD [12] to encode convolutional descriptors of video frame for multimedia event detection [45]. In [28] and [44], Sharma et al. and Xu et al. dynamically pool convolutional descriptors with attention models for action recognition and image captioning, respectively. Furthermore, convolutional descriptors of one convolutional layer are pooled with the guidance of the activations of the successive convolutional layer in [22]. In [5] and [21], convolutional descriptors from two CNNs are multiplied using the outer product and pooled to obtain the bilinear vector. In summary, our work belongs to the second dimension and aims to compute FV on convolutional activations with deep generative models. We exploit Variational Auto-Encoder for this purpose, which optimizes an inference model to the intractable posterior. The high flexibility of the inference model and efficiency of the structure optimization makes VAE more advanced than traditional GMM. Our work in this paper contributes by studying not only encoding convolutional activations in a deep architecture, but also theoretically figuring out the computation of FV based on VAE architecture.

Fisher Vector Meets VAE
In this section, we first recall the Fisher Vector theory, followed by presenting how to estimate the probability density function in FV through VAE. The optimization of VAE is then elaborated and how to compute the FV of the input descriptors will be introduced finally.

Fisher Vector Theory
Suppose we have two sets of local descriptors X = {x t } Tx t=1 and Y = {y t } Ty t=1 with T x and T y descriptors, respectively. Let x t , y t ∈ R d denote the d-dimensional features of each descriptor. In order to measure the similarity between the two sets, kernel method is employed by mapping them into a hyperspace. Specifically, assuming that the generation process of descriptors in R d can be modeled by a probability density function u θ with M parameters θ = [θ 1 , ..., θ M ] , Fisher Kernel (FK) [ Formally, G X θ is well-known as Fisher Vector (FV). The dimension of FV is equal to the number of generative parameters θ, which is often much higher than that of the descriptor, making FV of higher descriptive capability.

Probability Estimation through VAE
Next, we will discuss how to estimate the probability density function u θ in FV. In general, u θ is chosen to be Gaussian Mixture Model (GMM) [27,41] as one can approximate any distribution with arbitrary precision by GMM, in which θ is composed of mixture weight, mean and covariance of Gaussian components. The need of a large number of mixture components and inefficient optimization of Expectation Maximization algorithm, however, makes the parameter learning computationally expensive Sample xt in the minibatch. 6: Encoder: µ z t ← f φ (xt).

12:
Fuse the three loss:

13:
Back-propagate the gradients. 14: until maximum iteration reached. and difficult to be applied to large-scale complex data. Inspired by the idea of deep generative models [18,25] which enable the flexible and efficient inference learning in a neural network, we develop a Variational Auto-Encoder (VAE) to generate the probability function u θ .
Following the notations in Section 3.1 and assuming that all the descriptors in the set are independent, the loglikelihood of the set can be calculated by the sum over loglikelihoods of individual descriptor and written as To model the probability of x t generated from parameters θ, an unobserved continuous random variable z t is involved with prior distribution p θ (z) and each x t is generated from the conditional distribution p θ (x|z). As such, each log-likelihood log p θ (x t ) can be measured as where LB(θ, φ; x t ) is the variational lower bound on the likelihood of descriptor x t and can be written as where q φ (z|x) is a recognition model which is an approximation to the intractable posterior p θ (z|x). In our proposed FV-VAE method, we use this lower bound LB(θ, φ; x t ) as an approximation of the log-likelihood. Through this approximation, the generative model can be divided into two parts: encoder q φ (z|x) and decoder p θ (x|z), predicting hidden and visible probability, respectively.  Figure 3. Visual representation learning framework for image and video recognition. Spatial Pyramid Pooling (SPP) is performed on the last pooling layer of CNN to aggregate the local descriptors of video frame, which applies four different max pooling operations and obtain (6 × 6), (3 × 3), (2 × 2) and (1 × 1) outputs for each convolutional filter, resulting a total of 50 descriptors. For image, an input with a higher resolution of (448 × 448) is fed into the CNN and the activations of the last convolutional layer conv5 4+relu in VGG 19 are extracted, leading to dense local descriptors of 28 × 28 for VGG 19. In training stage, FV-VAE architecture is learnt by minimizing the overall loss. In extraction epoch, the learnt FV-VAE is to encode the set of local descriptors into a vectorial FV representation.

VAE Optimization
The inference model parameter φ and generative model parameter θ are straightforward to be optimized using stochastic gradient descend method. More specifically, let the prior distribution be the standard normal distribution p θ (z) = N (z; 0, I), and both the conditional distribution p θ (x|z) and posterior approximation q φ (z|x) be multivariate Gaussian distribution N (x t ; µ xt , σ 2 xt I) and N (z t ; µ zt , σ 2 zt I), respectively. The one-step Monte Carlo is exploited to estimate the latent variable z t . Hence, the lower bound in Eq. (6) can be rewritten as where z t is generated from N (µ zt , σ 2 zt I) and it is equivalent to z t = µ zt + σ zt , ∼ N (0, I). Figure 2(a) illustrates an overview of our VAE training process and Algorithm 1 further details the optimization steps. It is also worth noting that different from the training of standard VAE method which estimates σ x and σ z in another parallel encoder-decoder structure, we simply learn the two covariance by gradient descent technique and share them across all the descriptors, making the number of parameters learnt in VAE significantly reduced in our case. In addition to the basic reconstruction loss and regularization loss, we further take classification loss into account in our VAE training to incorporate semantic information, which has been shown effective in semi-supervised generative model learning [17]. The overall loss function is then given by We fix λ 1 = λ 2 = 1 in Eq. (8) and will investigate the effect of tradeoff parameter λ 3 in our experiments. During the training, the gradients are calculated and back-propagate to the lower layers so that lower layers can adjust their parameters to minimize the loss.

FV Extraction
After the optimization of model parameters [θ * , φ * ], Figure 2(b) demonstrates how to extract Fisher Vector based on the learnt VAE architecture.
By replacing the log-likelihood with its approximation, i.e., lower bound LB(θ, φ; x t ), we can obtain FV in Eq. (3): which is the normalized gradient vector of reconstruction loss, and can be computed directly though the back propagation operation. It is worth noticing that when extracting FV representation, we withdraw the sampling operation and use µ zt as z t directly to avoid stochastic factors.

Visual Representation Learning
By utilizing FV-VAE as a deep architecture for quantization, a general visual representation learning framework is devised for image and video recognition, respectively, as illustrated in Figure 3. The basic idea is to construct a set of convolutional descriptors for image or video frames, followed by encoding them into a vectorial FV representation using FV-VAE architecture. Both the training epoch and FV extraction epoch are shown in Figure 3 and the entire framework is trainable in an end-to-end manner.
We exploit different strategies of aggregation to construct the set of convolutional descriptors for video frames and image, respectively, due to the different property in between. A video consists of a sequence of frames with large intra-class variations caused by, e.g., camera motion, illumination conditions and so on, making the scale of an identical object varying in different frames. Following [45], we employ Spatial Pyramid Pooling (SPP) [7] on the last pooling layer to extract scale-invariant local descriptors for video frames. Instead, we feed a higher resolution (e.g., 448 × 448) input into the CNN to fully utilize image information and extract the activations of the last convolutional layer (e.g., conv 5 4 +relu in VGG 19), resulting in dense local descriptors (e.g., 28 × 28) for image as in [21].
In our implementation, Multi-Layer Perceptron (MLP) is employed as encoder and decoder in FV-VAE and one layer decoder is developed to reduce the dimension of FV representation. As such, the functions in Algorithm 1 can be specified as where {W θ , b θ } are the encoder parameters θ. The gradient vector of L rec is calculated as where "f latten" represents to flatten a matrix to a vector, and denotes element-wise multiplication to filter the activated elements. Considering it is difficult to obtain an analytic solution of FIM in this case, we make an approximation by replacing the expectation with the average on the whole training set: and which is the output FV representation in our framework.
To improve the convergence speed and better regularize the visual representation learning for video, we train this framework by inputting one single video frame rather than multiple ones, which is randomly sampled from videos. In the FV extraction stage, the video-level representation can Table 1. Methodology comparison of different quantization.
Quantization indicator descriptor FV [24] Gaussian observation model gradient with respect to GMM parameters VLAD [12] clustering center difference to the assigned center BP [21] local feature coordinate representation FV-VAE VAE hidden variable gradient of reconstruction loss be easily obtained by averaging FVs of all the frames sampled from the video since FV in Eq. (13) is linear additive.

Experiments
We evaluate the learnt visual representation by FV-VAE architecture on three popular datasets, i.e., UCF101 [31], ActivityNet [2] and CUB-200-2011 [40]. The UCF101 dataset is one of the most popular video action recognition benchmarks. It consists of 13,320 videos from 101 action categories. The action categories are divided into five groups: human-object interaction, body-motion only, human-human interaction, playing musical instruments and sports. Three training/test splits are provided by the dataset organisers and each split in UCF101 includes about 9.5K training and 3.7K test videos. The ActivityNet dataset is a large-scale video benchmark for human activity understanding. The latest released version of the dataset (v1.3) is exploited, which contains 19,994 videos from 200 activity categories. The 19,994 videos are divided into 10,024, 4,926, 5,044 videos for training, validation and test set, respectively. Note that the labels of test set are not publicly available and the performances on ActivityNet dataset are all reported on validation set. Furthermore, we also validate the representation on CUB-200-2011 dataset, which is widely adopted for fine-grained image classification and consists of 11,788 images from 200 bird species. We follow the official split on this dataset with 5,994 training and 5,794 test images.

Compared Approaches
To empirically verify the merit of visual representation learnt by FV-VAE, we compare the following quantization methods: Global Activations (GA) directly utilizes the outputs of fully-connected/pooling layer as visual representation. Fisher Vector (FV) [24] produces the visual representation by concatenating the gradients with respect to the parameters of GMM, which is trained on local descriptors. Vector of Locally Aggregated Descriptors (VLAD) [12] is to accumulate, for each clustering center learnt with Kmeans, the differences between the clustering center and the descriptors assigned to it, and then concatenates the accumulated vector of each center as quantized representation.
Bilinear Pooling (BP) [21] pools local descriptors in a pairwise manner by outer product. In our case, one local descriptor pairs with itself. To better illustrate the difference between the compared approaches, we details the methodology in Table 1. In particular, we decouple the quantization process into two parts: indicator and descriptor. Indicator refers to observations/distributions estimated on the whole set of local descriptors and descriptor is to represent the set with respect to the indicator.

Experimental Settings
Convolutional activations. On video action recognition task, we extract two widely adopted convolutional activations, i.e., activations of pool5 layer in VGG 19 [30] and res5c layer in ResNet 152 [8]. Given a 224 × 224 video frame as input, the outputs of the two layers are both 7 × 7 and the dimension of each activation is 512 and 2,048, respectively. For each video, 25 frames are uniformly sampled for representation extraction. On image classification problem, we feed 448×448 image into VGG 19 and the activations of conv 5 4 +relu layer are exploited, which produce 28 × 28 convolutional descriptors.
VAE optimization. To make the training process of VAE stable, we first exploit L2 normalization on each convolutional activation to make the input to VAE in a common scale. Following [9,38], dropout is then employed to randomly drop out units input to the encoder but the autoencoder is optimized to reconstruct a complete "repaired" input. The dropout rate is fixed to 0.5. Furthermore, we utilize AdaDelta [47] optimization method implemented in Caffe [13] to normalize the gradient of each parameters for balancing their converge speed. The base learning rate is set to 1 and the size of mini-batch is 128 images/frames. The optimization will be complete after 5,000 batches.
Quantization settings. For our FV-VAE, given the local descriptor with dimension C (C ∈ {512, 2048}), we design a two-layer encoder (C → C → 255) to reduce the dimension to 255, coupled with a single layer decoder (255 → C). The dimension of the final quantized representation is 256 × C. For FV and VLAD, we follow the settings in [3] and [45]. Specifically, 128 Gaussian components for FV and 256 clustering centers for VLAD are exploited. As such, the dimension of representations encoded by FV and VLAD will also be 256 × C. The two quantization approaches are implemented by VLFeat [36].
Classifier training. After representation learning by all the methods in our experiments, we apply signed squareroot step (sign(x) |x|) and L2 normalization (x/ x 2 ) as in [3,21,24,45], and then train a one-vs-all linear SVM with a fixed hyperparameter C svm = 100.

Performance Comparison
Comparison with different quantization methods. We first examine our FV-VAE and compare with other quantization methods. In addition to the four mentioned quantization methods, we also include three runs: Concatenation, AVE and FV-VAE − . Concatenation is to flatten the activations of pool5 layer and concatenate into a super vector, whose dimension is 25088 (7 × 7 × 512). The representation in AVE is produced by average fusing the 49 512-dimensional convolutional activations in pool5 layer. A slightly different setting of our FV-VAE is named as FV-VAE − , in which the classification loss in Eq.(8) is excluded or λ 3 is set to 0.
The performances and comparisons with default VGG 19 network on UCF101 (split 1) are summarized in Table 2. Overall, the results indicate that our FV-VAE leads to a performance boost against others. In particular, the accuracy of FV-VAE can achieve 83.45%, which makes the relative improvement over the best competitor BP by 2.5%. Meanwhile, the dimension of representation learnt by FV-VAE is only half of that of BP. There is a performance gap among three runs GA, Concatenation and AVE. Though three runs all directly originate from pool5 layer, they are fundamentally different in the way of generating frame representation. The representation of GA is as a result of flatting all kernel maps in pool5 to the neurons in a fully-connected layer, while Concatenation and AVE is by directly concatenating convolutional descriptors or average fusing them in pool5 layer. As indicated by our results, Concatenation can lead to better performance than GA and AVE. VLAD outperforms FV on UCF101, but the performance is still lower than BP. Compared to FV which produces representation with respect to a number of Gaussian mixture components, FV-VAE will learn which Gaussian distribution is needed for the input specific descriptor by an inference neural network, making FV-VAE more flexible. Therefore, FV-VAE performs significantly better than FV. More importantly, FV-VAE is trainable in an end-to-end fashion. By additionally incorporating semantic information, FV-VAE leads to apparent improvement against FV-VAE − . Furthermore, by reducing the dimension of latent variable to 7, the visual representations produced by FV-  [42]; IDT: Improved Dense Trajectory [41]. Method Accuracy Two-stream ConvNet [29] 88.1% C3D (3 nets) [34] 85.2% Factorized ST-ConvNet [32] 88.1% Two-stream + LSTM [46] 88.6% Two-stream fusion [4] 92.5% Long-term temporal ConvNet [35] 91.7% Key-volume mining CNN [50] 93.1% TSN (3 modalities) [43] 94.2% IDT [41] 85.9% C3D + IDT [34] 90.4% TDD + IDT [42] 91.5% Long-term temporal ConvNet + IDT [35] 92.7%  Table 6, in two protocols of where the object bounding boxes are provided or not. Comparison with different networks. Next, we turn to measure the performance comparison on UCF101 split1 of our FV-VAE with local activations from different networks, including pool5 layer in VGG 19 and fine-tuned VGG 19 using video frames respectively, and res5c layer in ResNet 152. Compared to pool5 in VGG 19, FV-VAE on the outputs of res5c layer in ResNet 152 with a deeper CNN exhibits better performance. An interesting observation is that GA and FV-VAE − performs better on the outputs of pool5 layer in fine-tuned VGG 19 than that in VGG 19, while reverse trend is indicated by using FV-VAE. We speculate that this may be the result of overfitting in fine-tuning with UCF101, which in particular affects the descriptive ability of convolutional layers. This result also indicates the advantage of exploring semantic information in FV-VAE training based on the outputs of a general network than a fine-tuned one.  [21] 84.1% [11] 82.0% [19] 75.7% [1] 73.9% [48] 85.1% [21] 82.8% [19] 76.4% [48] 73.0% [3] Comparison with the state-of-the-art. We compare with several state-of-the-art techniques on three splits of UCF101, ActivityNet validation set and CUB-200-2011. The performance comparisons are summarized in Table 4, 5 and 6, respectively. It is worth noting that most recent works on UCF101 employ and fuse two or multiple modalities. For fair comparison, two basic and widely adopted modalities, i.e., video frame and optical flow "image," are considered as inputs to our visual representation framework and late fusion is used to combine classifier scores on the two modalities. As shown in Table 4, FV-VAE on activations from pool5 layer in VGG 19 with image and optical flow inputs can achieve 93.7%, which makes the relative improvement over two-stream networks [29], [46] and [4] by 6.3%, 5.7% and 1.3%, respectively. When exploiting the outputs of res5c layer in ResNet 152 on image inputs as instead, the accuracy will be further improved to 94.2%. By combining with IDT which are hand-crafted features, our final performance will boost up to 95.2%, which is to-date the best published performance on UCF101.
The results across different evaluation metrics consistently indicate that visual representation produced by our FV-VAE leads to a performance boost against baselines on ActivityNet validation set, as shown in Table 5. More specifically, FV-VAE on the outputs of pool5 in VGG 19 and res5c in ResNet 152 outperforms GA from VGG 19 and ResNet 152 by 10.0% and 9.8% in terms of mAP, respectively. Furthermore, the representation learnt by FV-VAE only on visual appearance of video frame also exhibits better performance than GA representation from C3D and IDT motion features which additionally explore temporal information in videos. Fine-tuning VGG 19 on CUB-200-2011 for FV-VAE generally performs better than original VGG 19 on both protocols of where the object bounding boxes are given or not, as shown in Table 6. Overall, the representation learnt by FV-VAE leads to a performance boost against some baselines, e.g., [19] which extracts representation on local regions learnt by co-segmentation and [1] which combines the representations from three networks fed by warped bird head, warped body and entire image, respectively. It is not surprise that FV-VAE yields inferior performance to the other baselines, as the representation learnt by our FV-VAE is for general purpose while contributions of different regions in particular for fine-grained classification are taken into account in these methods. For instance, a saliency weight is learnt and assigned to each local region in [49], and a spatial transformer is trained to reduce the effect of translation and rotation as preprocess in [11]. More importantly, the importance estimation of each local region can be easily integrated into our framework as spatial attention.

Experimental Analysis
The effect of representation dimension. Figure 4(a) compares the accuracy of learnt representations with different dimensions by changing the number of latent variable in FV-VAE, the number of centroids in VLAD and mixture components in FV. Overall, visual representation learnt by FV-VAE consistently outperforms others at each dimension from 2 12 to 2 17 . In general, higher dimensional representations provide better accuracy, except that the accuracy of representation learnt by FV will decrease when the dimension is higher than 2 15 , which may caused by overfitting. The result basically indicates the advantage of predicting Gaussian parameters by a neural network in our FV-VAE.
The effect of tradeoff parameter λ 3 . A common problem with combination of multiple loss is the need to set the tradeoff parameters in between. Figure 4(b) shows the accuracy of FV-VAE with respect to different λ 3 in Eq. (8), which reflects the contribution of leveraging semantic information. As expected, the accuracy curves are all like the "∧" shapes when λ 3 varies from 10 0 to 10 5 .
Feature compression. Figure 4(c) compares the performance obtained by applying different representation compression methods: (1) Random Maclaurin (RM) [15], (2) PCA dimension reduction and (3) reducing the number of latent variable in VAE. Compared to RM and PCA which separately learn a transformation for feature compression, we can reduce the dimension of the learnt FV in VAE framework by decreasing the number of latent variable. As indicated by our results, reducing the number of latent variable always achieves the best accuracy, which again confirms the high flexibility of VAE.

Conclusion
We have presented Fisher Vector with Variational Auto-Encoder (FV-VAE) architecture which aims to quantize the convolutional activations in a deep generative model. Particularly, we theoretically formulate the computation of FV in VAE architecture. To verify our claim, a general visual representation learning framework is devised by integrating our FV-VAE architecture and an implementation of FV-VAE is also substantiated for image and video recognition. Experiments conducted on on three public datasets, i.e., UCF101, ActivityNet, and CUB-200-2011 in the context of video action recognition and fine-grained image classification validate our proposal and analysis. Performance improvements are clearly observed when comparing to other quantization techniques.
Our future works are as follows. First, a deeper autoencoder architecture will be explored in our FV-VAE architecture. Second, attention mechanism will be explicitly incorporated into our FV-VAE for further enhancing visual recognition. Third, Generative Adversarial Networks (GAN) will be investigated to better learn a generative model and integrated into representation learning.

Skijet ---UCF101
Sharpening Knives ---ActivityNet Figure 5. Feature visualization from the viewpoint of spatial and temporal attention for one video example in UCF101 and ActivityNet dataset respectively (Top row: sampled frames from the video, middle row: the curve of frame-level values, bottom row: region-level values in each frame). The sum of the absolute value of each element in the FV of one regional descriptor represents spatial attention of this region and then the sum of the value of each region in one frame is considered as temporal attention of that frame. We can see that it is able to concentrate attention to regions of interest, e.g., jet boat in the first video and sharpener in the second one, which highly infer the action "Skijet" and "Sharpening Knives" happening in the video. Moreover, it is also capable of predicting the contributions of different temporal frames. For example, frames with motion of "a man is riding a jet boat" in the first video or "a man is sharpening a knife" in the second video contribute more to the recognition.

Black-Footed Albatross
Groove-Billed Ani Brewer Blackbird The sum of the absolute value of each element in the FV of one regional descriptor represents spatial attention of this region. We can see that most of the high-value regions are beak, neck and wing of birds, where the parts highly indicate the category that a bird belongs to.

B. Feature Visualization
Recall that FV of each regional descriptor is the gradient vector of reconstruction loss, as discussed in Section 3.4. The absolute value of each element in the vector in fact reflects its degree of being reconstructed and thus the sum of the absolute value of each element (region-level value) represents the importance of this region to recognition. The importance map can be regarded as spatial attention. Furthermore, the sum of the value of each region in one video frame (frame-level value) then manifests its score in the whole video sequence, which can be considered as temporal attention. Figure 5 illustrates both region-level and frame-level values on one video example from "Skijet" and "Sharpening Knives" category in UCF101 [31] test set and ActivityNet [2] validation set, respectively. The video is represented by sampled frames in the top row. The curve of frame-level score is given in the middle row. The scores of temporal frames with clear motion of "a man is riding a jet boat" in the first video or "a man is sharpening a knife" in the second video are high, indicating that these frames contribute more to the recognition. In the bottom row, the regions of high values are around the object jet boat or sharpener, which is the key evidence of "Skijet" or "Sharpening Knives" category, respectively. Similar in spirit, Figure 6 visualizes region-level values of a few exemplary images in CUB-200-2011 [40] test set. The image examples are from three bird species, i.e., "Black-Footed Albatross," "Groove-Billed Ani" and "Brewer Blackbird." We can easily observe that most of the high-value regions are beak, neck and wing of birds, where the parts are found to be more helpful to differenti-ate one variety of bird from the other. In contrast, the regions around background (e.g., sea, grass, branches, rocks) receive low values.