Loss Switching Fusion with Similarity Search for Video Classification
Lei Wang Du Q. Huynh Moussa Reda Mansour



Single-lined Spectroscopic Binary Star Candidates from a Combination of the and Gaia DR2 surveys
    [
    December 30, 2023
================================================================================================




 IEEE 2019To appear in Proc. ICIP2019, September 22-25, 2019, Taipei, Taiwan


From video streaming to security and surveillance applications, video data play an important role in our daily living today. However, managing a large amount of video data and retrieving the most useful information

for the user remain a challenging task. 

In this paper, we propose a novel video classification system that would benefit the scene understanding task. We define our classification problem as classifying background and foreground motions using the same feature representation for outdoor scenes. This means that the feature representation needs to be robust enough and adaptable to different classification tasks.

We propose a lightweight Loss Switching Fusion Network () for the fusion of spatiotemporal descriptors and a similarity search scheme with soft voting to boost the classification performance. The proposed system has a variety of potential applications such as content-based video clustering, video filtering, etc. Evaluation results on two private industry datasets show that our system is robust in both classifying different background motions 

and detecting human motions from these background motions. 





video clustering, loss switching network, hashing. 




§ INTRODUCTION





Scene understanding <cit.> in noisy videos is a challenging task. Firstly, videos contain too much redundant information, which slows down the training process and makes the feature extraction much harder.

Secondly, 


some feature extraction techniques <cit.> ignore the relationship between spatial and temporal information as they extract such information separately, which leads to the loss of information. 

Thirdly, scene understanding needs to fuse both background and foreground motions to represent the information within a given video <cit.>, and this is a challenging research area that has not been fully explored.

Content-based video clustering and classification <cit.> can significantly increase the speed of tasks like searching and browsing for a particular video, and with the increasing need for security and retrieval, this kind of system is of vital importance to predict and avoid unwanted scenes or behaviours.

Compared to indoor scenes <cit.>, video classification in outdoor scenes <cit.> are much harder as there are many dynamic environment motions such as raining and tree waving that can affect the performance of classification. Although neural network techniques have achieved great success in many fields <cit.>, they require a lot of training data which are not easy to obtain from industry. Moreover, the industry data are far more complex than the benchmarks used in research due to the dynamic changes of data distributions over time. Compared to the neural network methods, feature engineering <cit.> enjoys the flexibility, computational efficiency, and does not rely on large sets of samples for training.




We propose a novel video classification system for background and foreground motion classification that combines the merits of both neural network and feature engineering for industry applications. We define our video classification problem as classifying videos based on dynamic environment motions such as tree waving, noise, and camera shaking, and detecting human motions from these dynamic environment motions using the same feature representation for outdoor scenes. 
This leads to a better scene understanding system as recomputing features for different tasks 
is time consuming and computationally expensive. We refer to dynamic environment motions and human motions as background and foreground motions respectively from hereon.






Our research contributions are:

    
  * We propose a novel video classification system for video clustering, focusing on background and foreground motion using the same feature representation.
    
  * We introduce a lightweight fusion network to fuse spatiotemporal features non-linearly, based on the concept of `loss switching'.
    
  * 
    We propose to use similarity search with soft voting for robust video classification. 






§ METHOD



Figure <ref> illustrates the basic work flow of our proposed approach. 



There are two training phases.
In phase 1, a lightweight Loss Switching Fusion Network () is trained using spatiotemporal descriptors randomly sampled from the videos as input. In phase 2, the pre-trained  and a feature pooling layer together output a lower-dimensional feature vector for representing each video. 
We then compute the Fisher scores to rank and select the most discriminative features to enhance the feature separability.
To efficiently store and retrieve these videos for later use, we adopt a Locality Sensitive Hashing  (LSH) <cit.> mechanism, which returns similar hashes for similar videos.



This process maps the training videos into several classes based on their feature distances. So in addition to video retrieval, the system also facilitates video classification.
In the testing phase, for each test video, we use similarity search to find the most similar feature representations so as to get their corresponding labels. After that, we count and compare the number of labels retrieved using `soft voting' to get the confidence values to assign label to each test video.  








 §.§ Spatiotemporal Features


Dense trajectories (DT) <cit.> and improved trajectories (iDT) <cit.> are the state-of-the-art handcrafted features that have achieved great success in human action recognition due to its robustness in mining motion trajectories. The DT features are 

normalized
trajectory-aligned descriptors 

comprising spatiotemporal HOG (ST-HOG), spatiotemporal HOF (ST-HOF), spatiotemporal MBH (ST-MBH) and spatiotemporal trajectories (ST-DT). 
Our proposed system uses these four spatiotemporal features as the base features to describe the videos. 
















 §.§ Loss Switching Fusion Network ()


Many methods such as Principal Component Analysis (PCA) and traditional autoencoder have been used for feature dimensionality reduction. While the PCA focuses on analyzing the covariance matrix of the features, the traditional autoencoder learns a transformation that minimizes the reconstruction error. Both methods ignore the fact that the feature data may form clusters and, by retaining this cluster information in the dimension reduction process, the lower dimensional features would be more useful for the downstream feature classification process. 



To retain the underlying cluster structure of the spatiotemporal features that describe each video, rather than just concatenating the features and passing the resultant long vectors to the PCA or autoencoder, we propose to fuse the spatiotemporal features nonlinearly by training a lightweight  shown in Figure <ref>. 

The inputs to the network are the four
normalized trajectory-aligned spatiotemporal descriptors described in Section <ref>.
Our  is composed of two small sub-networks: (i) a 5-layer autoencoder having weights symmetrically tied around the middle encoding layer; (ii) a multi-layer perceptron (MLP) classifier, which shares the encoder part of the autoencoder. 


There are two separate loss functions in :


  * The first loss function, denoted by L_1, is the MSE loss for the autoencoder to  minimize the reconstruction errors of features.














  * The second loss function, denoted by L_2, is the cross-entropy loss for measuring the classification performance.























In training phase 1 (see Fig. <ref>), 
the MSE loss L_1 and classification loss L_2 are used alternately in each pass of the gradient descent. The role of the MLP classifier is to steer the optimization so that the reduced-dimensional feature vectors produced in the encoding layer are more separated (or closer together) if they belong to different classes (or the same class). In training phase 2 and the testing phase, only the part up to the encoding layer is used.











 §.§ Feature Selection






After feature fusion, the feature dimension of each video is × 128, where  is the number of tracked motion points within a 15-frame subsequence <cit.>. Long and/or complex videos (containing many motion trajectory points) would have large  value. The average pooling layer of the system (Fig. <ref>) then reduces the feature 

down to 1 × 128 to get a holistic representation for each video. The next component of the pipeline takes care of the Fisher score <cit.> computation which ranks the feature importance to yield a discriminative feature that has a more compact representation. The Fisher score of the i^th feature component is given by: 

    f_i
        
        = ∑_c = 1^C n_c(μ_c^i - μ^i)^2/∑_c = 1^C n_c ( σ_c^i)^2



where μ_c^i and σ_c^j are, respectively, the mean and standard deviation of the c^th class for the i^th feature component, μ^i denotes the mean of the whole dataset corresponding to the i^th feature, and n_c is the size of the c^th class. We then rank f_i in descending order, and get the indexes of the feature components that have the top-q% highest Fisher scores. Based on our experiments and the trade-off between the computational cost and classification accuracy, we choose q = 50 so that the feature dimension is 1 × 64 after feature selection.  

In the testing phase after feature pooling, we select the feature components using the feature indexes obtained from the training stage for later processing described in Section <ref>.










 §.§ Similarity Search for Classification


LSH <cit.>  is defined based on the simple idea that, if two points are close together, then after a projection operation, these two points will remain close together. So LSH targets at mapping the 

features in such a way that similar features have a high probability to be mapped to similar index values. 























To quickly map a given feature vector to a hash value, the scalar projection given in <cit.> is commonly used as the hash function.


Let  be the 64D feature vector (representing a video) obtained from the feature selection process above, we use this scalar projection hash function, denoted by h, to map  to a hash value in ℝ. To generate more accurate video clusters, we adopt 



N different such hash functions. Let 
g( x) = [h_1( x), h_2( x), ⋯, h_N( x)] ∈ℝ^N. 

For a C-class classification problem, C clusters would be created and C such g functions would be used:

g_1, g_2, ⋯, g_C. By having multiple hash functions for multiple clusters, it helps to improve the accuracy of feature clustering if each query feature and its nearest neighbours fall in the same cluster in all the N scalar projections.






In the testing phase, given a query feature y computed by the feature selection stage for a test video, the system computes 
g_c( y), for c = 1,⋯,C. 

After that, 
it performs a linear search to find K nearest neighbours of the query feature in the ℝ^N space, 
where K is a value defined by the user.

We then use `soft voting' to count and compute the confidence value of assigning the query feature to each cluster. 














§ DATASETS AND EXPERIMENTAL SETTINGS




 §.§ Industry Datasets


We use two industry datasets to evaluate the clustering and classification performance of the proposed system:










∙ iCetanaPrivateDataset. 
This dataset  contains 2700 videos of various lengths. They were captured in outdoor environments so issues, such as tree waving, camera shaking, noise, illumination changes, and rain, are common. Some videos have human motion also. The outdoor scenes include car parks, train stations, bus stops, etc. 



∙ iCetanaEventDataset. This dataset is an extension of iCetanaPrivateDataset, with videos captured by multiple cameras located at different train stations, bus stops, moving lifts, restaurants, and supermarkets. It has 6668 videos. 



The average length of the videos in both datasets is ∼280 frames, with long videos up to 19645 frames. 
Both datasets have been manually labelled with 6 background motion class labels: tree waving, camera shaking, noisy video, rainy, illumination, and normal video. There are 3 foreground human motion class labels: general body movements, human-object interaction, and human-human interaction. Videos having both background and foreground motions have two class labels. In this paper, the 3 types of foreground motion are grouped together into one class.











 §.§ Experimental Settings

We evaluate the performance of our proposed system by 


  * testing how well the 6 background motion classes are classified. This is a multi-class classification problem;

  * testing how well the foreground motion is separated from those background motions. 
This is a binary classification problem.


To extract the trajectory-aligned descriptor from video, we use the codes from <cit.>. For the feature fusion part in training phase 1, 10^6 
trajectory-aligned descriptors were randomly sampled from iCetanaEventDataset along with their background motion class labels 
are passed to the network. The learning rates for training the autoencoder and MLP were set to 10^-3 and 10^-2 respectively. The network was trained using a MacBook Pro 2.9 GHz Intel Core i7 computer for up to 200 iterations (this was shown to be sufficient due to the large number of training samples). The whole training process took around half a day to finish. We also compare the performance of our fusion with PCA and autoencoder alone by truncating the features down to the same dimension (128D) as . For PCA, this leads to a loss of about 9% feature importance. For autoencoder alone, the learning rate was set to 10^-1 with a learning rate decay of 10^-1 after every 50 epochs and the number of iterations was also set to 200.





For both training and testing, we randomly choose N (number of hash functions for LSH) from the range [10, 50] and select K (number of nearest neighbouring videos for similarity search) from [50, 100]. The performance for each classification task is computed by averaging over different (N, K) pairs.










To compare with the state-of-the-art techniques, we modified the last prediction layer of I3D <cit.> (or C3D <cit.>) to have 6 background motion classes and passed the videos from the iCetanaEventDataset to fine-tune the last Inception-v1 module (or the last fully connected layer) and then tested the classification performance on iCetanaPrivateDataset.













§ RESULTS AND DISCUSSIONS




Video Clustering. 



We evaluate our video clustering performance using the reduced-dimensional features from  against those from the PCA and standard autoencoder.  Figure <ref> shows the comparison results. The visualization was produced using Uniform Manifold Approximation and Projection (UMAP) <cit.>. Comparing the results from using autoencoder alone, it is clear that, for both background and foreground motion classes,  produces more compact clusters for videos of the same motion class and more separated clusters for videos of different motion classes. While the results from PCA are better than those from using autoencoder alone, there is some intertwining among some motion classes.








Video Classification.

Table <ref> shows a comparison of our method with other state-of-the-art techniques. As shown in the table, our whole system achieves the best among all other techniques in both background and foreground motion classification. With , the performance is better than fine-tuning the deep learning models such as C3D and I3D. This improvement is gained from the loss switching mechanism which forces the learned representation to be more discriminative and compact. It should also be noted that  performs better than CCA <cit.>, which is the feature fusion technique using correlation analysis. With LSH, the classification performance increases by 4%.











































§ CONCLUSION



We have presented a lightweight video classification system that can robustly classify videos that have background and foreground motions. 

There are also additional types of background motions like snowing, thunder storm and fogging, we leave them for future work. We also introduce an  for the fusion of spatiotemporal descriptors and our method achieves the best clustering and classification results compared to existing techniques, including some complex deep learning models. 
Our future work will focus on exploring more powerful feature fusion pipelines suitable for mid-level and high-level feature fusion. 








IEEEbib


