---
abstract: |
    Emotions play an important role in people’s life. Understanding and recognising is not only important for interpersonal communication, but also has promising applications in Human-Computer Interaction, automobile safety and medical research.

    This project focuses on extending the emotion recognition database, and training the CNN + RNN emotion recognition neural networks with emotion category representation and valence & arousal representation. The combined models are constructed by training the two representations simultaneously. The comparison and analysis between the three types of model are discussed. The inner-relationship between two emotion representations and the interpretability of the neural networks are investigated. The findings suggest that categorical emotion recognition performance can benefit from training with a combined model. And the mapping of emotion category and valence & arousal values can explain this phenomenon.
bibliography:
- 'egbib.bib'
date: September 2018
---

\
<span style="font-variant:small-caps;">Imperial College London</span>\
<span style="font-variant:small-caps;">Department of Computing</span>\

------------------------------------------------------------------------

\
[ **[Interpretable Deep Neural Networks for Dimensional and Categorical Emotion Recognition in-the-wild]{}**]{}\

------------------------------------------------------------------------

\

*Author:*\
[Yicheng Xia]{}

 

*Supervisor:*\
[Dimitrios Kollias]{}

\
Submitted in partial fulfillment of the requirements for the MSc degree in [Computing Science]{} of Imperial College London\
date

Acknowledgments {#acknowledgments .unnumbered}
===============

I would like to express my great gratitude to my supervisor Dimitrios Kollias for his supervision and helping me throughout this project.

In addition, I would like to thank my family and friends for their love and support.

Introduction
============

Emotions play an important role in every human being’s life. Besides language or action [@goudelis2013exploring], all interpersonal communication inherently includes emotions. This interpersonal interaction would be greatly enhanced if we could understand emotions more deeply.

Furthermore, since the interactions between human beings and machines are increasingly frequent, machine’s understanding of humans emotions benefits the development of Human-Computer Interaction (HCI) technologies.

Apart from HCI, automatic Emotion Recognition also has huge potential for applications such as automobile safety, counter-terrorism, psychiatry, medical research [@kollias13; @tagaris1; @tagaris2] and education study [@7292443].

Different approaches have been attempted to discover human emotions.

George Caridakis et al. [@10.1007/978-0-387-74161-1_41] proposed a multimodel approach for recognition of emotions using facial expressions, body movement, gestures and speech.

Michel F. Valster and Maja Pantic proposed a fully automatic method which allows not only the recognition of 22 facial muscle actions i.e. action units (AUs), but also temporal characteristics. Temporal characteristics include neutral, onset, offset and etc [@6020812].

In this project, Deep Neural Networks are used to achieve emotion recognition. A Convolutional Neural Network (CNN) is a biologically-based trainable architecture that can learn invariant features. It has been proved that CNNs show good performance in image recognition. Recurrent Neural Networks (RNN) are able to reveal the temporal behaviour for time sequence samples, for instance, texts and videos.

By feeding the images containing emotions into the CNN-RNN structure, the image features will be first extracted before RNNs extract temporal features. Fully connected layers are used to make predictions after CNN-RNN architecture.

Two different emotion representations are used in this project, i.e. categorical and dimensional. Categorical representation is to classify affect into seven basic emotions, which are happiness, sadness, anger, surprise, fear, disgust and neutral. While, dimensional representation utilizes two continuous values, namely Valence and Arousal, to characterise affect.

Three types of CNN-RNN Deep Neural Networks were implemented and fine-tuned to perform the best emotion recognition. The three models are trained on categorical labels, dimensional labels and both respectively. We want to investigate that, by training with two types of labels simultaneously, would the overall performance be increased compared to the single-function models? Also, we want to reveal the inner relationship of two affect representation through this experiment. Extensive experiments have been made to fine-tune the architectures and to find the best performance.

Before training the Neural Networks, efforts were made on extending the existing dimensional affect label video database to the one with the categorical emotions. In addition, data preprocessing and organisation were carried out to build relative datasets in order to train and evaluate the models.

In conclusion, the aim of the project is to extend a database to one with both emotion category and valence & arousal annotations. After that, categorical-only, valence-arousal-only and combined models will be trained based on different architectures. The comparison of the performances achieved on different models will be examined, and the inner-relationship of the categorical and dimensional emotion representation will be investigated.

Background Research
===================

This chapter introduces the idea of two emotion theories and two Neural Network architectures investigated in the project. Related work in emotion recognition research are also described.

Section \[Emotion Theories\] discusses the different emotions theory for emotion recognition study. Two representations, emotion categories and valence & arousal are especially introduced. These two emotion theories are used in this project. Section \[Deep Neural Networks\] goes through the idea of the Convolutional Neural Networks and Recurrent Neural Networks. Section \[Related Work and Challenges\] demonstrates the related work in emotion recognition study, and some famous emotion recognition competitions. Section 2.4 describes techniques to interpret what neural networks learned.

Emotion Theories {#Emotion Theories}
----------------

In psychology, there are several ways to describe emotions. For instance, there are categorical approaches, dimensional approaches and appraisal-based approaches. In this project, the categorical method and dimensional method will be utilised to examine affect.

### Basic and Compound Categories

Ekman and his colleagues conducted a lot of experiments and drew the conclusion that there exist seven basic emotions, namely, happiness, sadness, anger, surprise, fear, disgust and neutral. [@FoaEdnaB.1973Eith]

The affect can also be classified into multiple basic categories, therefore leading to various compound or complex emotions. Du, Shichuan, and Aleix M. Martinez propose that compound emotions are those that can be constructed by more than one basic component classes to generate new emotions. Their research suggests that emotions are better represented using a series of basic and compound categories rather than only seven basic components [@du2015compound]. 15 compound emotions are defined in their study, which are happily surprised, happily disgusted, sadly fearful, sadly angry, sadly surprised, sadly disgusted, fearfully angry, fearfully surprised, fearfully disgusted, angrily surprised, angrily disgusted, disgustedly surprised, appalled, hatred and awed.

Figure \[fig:bc\] shows the seven basic emotions (A to G: neutral, happy, sad, fearful, angry, surprised and disgusted) and 15 compound emotions. For example, emotion H is happily surprised and P is fearfully disgusted [@du2015compound].

### Valence and Arousal Approach

For dimensional methods, psychologists believe that emotions are correlated to each other in a systematic manner, instead of categorically independent from one another. Through this methodology, the emotion variability can be represented by two dimensions, i.e. Valence (V) and Arousal (A).

The valence dimension (V) stands for how positive or negative the affect is. It ranges from unhappy feelings to happy feelings.

The arousal dimension (A) stands for how excited the emotion it. Its range is from boredom to excitement.

Since the psychological research shows that the valence and arousal are interconnected, duplicate configurations and inter-dependencies within the value exist. [@doi:10.1093/cercor/bhk024]

Compound emotions can be handled easily in the valence and arousal approach. Because the affect transition can be captured on the dimensions and expression can be accurately and authentically indicated on continuous scales. This is one advantage of the valence and arousal method.

Figure  \[fig:logo\] is a representation of the 2D valence -arousal emotion space.

### Other Emotion Models

Another famous method to recognise affects is through the activation of muscles on the face. The Facial Action Coding System (FACS) is built based on facial Action Units (AU), which define the activation and contraction of facial muscles. FACS provides the rules for emotion detections of AUs [@ekman1997face].

### Emotion Representation Relationship Study

There are researches to discover the relationship of different emotion representations. Stephan Hamann [@HAMANN2012458] attempted to map the discrete and dimensional emotions by using neuroimaging technology, to identify brain regions that associated with two types of representations. Sven Buechel and Udo Hahn [@buechel2018emotion] presents a neural network to transform valence & arousal representation to basic emotions for lexicon construction.

Deep Neural Networks {#Deep Neural Networks}
--------------------

In this project, a variety of neural networks will be exploited and combined to reach the high performance on the dataset and interpretability will be investigated.

### Convolutional Neural Networks

Convolutional Neural Networks (CNN) are biologically inspired trainable architectures that can learn invariant features. With the implementation of multiple stages, a CNN is able to learn multi-level hierarchies of features. Each stage in a CNN consists of a convolutional layer and a feature pooling layer, followed by the fully-connected layer to carry out the classification. The input and output of one stage are sets of arrays, namely feature maps [@5537907]. Figure \[fig:convnet\] is a typical architecture of convolutional neural network.

#### Convolutional Layer {#convolutional-layer .unnumbered}

The convolutional layer is composed of a set of filters, which can learn the features. During the forward pass process, the filters are convolved across the input volume and dot products are calculated between the entries of the filter and the input volume at all positions. Each filter recognises a specific feature at input volume spatially. The filters will be learned when they see some type of visual or spatial features.

The whole set of filters in one convolutional layer will together produce a feature map as the output, which represents the features extracted from the input. [@cs231n]

Figure \[fig:convo\] shows the convolution process in convolutional layer.

#### Pooling Layer {#pooling-layer .unnumbered}

The function of pooling layer is to decrease the spatial size of the feature maps in order to reduce the number of parameters and computation in the entire neural network. Therefore, the overfitting can be controlled. A pooling layer is usually inserted between a series of convolutional layers.

Max operation is the most common sampling operation to spatially resize the feature maps. For example, a pooling layer with filters of size 2x2 and the stride of 2 will pick up the maximum number over 4 numbers. [@cs231n]

The Max Pooling operation is shown in Figure  \[fig:maxpool\].

#### Fully-connected Layer {#fully-connected-layer .unnumbered}

The fully-connected layer is a regular neural network. It enables the entire neural network to classify the inputs into categories.

### Recurrent Neural Networks

The Recurrent Neural Network (RNN) extends the functions of a regular neural network. It is able to handle a sequence input by having a recurrent hidden stage. The hidden state’s activation does not only rely on the input but also the stage of previous time. This can implemented in Equation \[equ:recurrent\].

$${h_t} = g(W{x_t} + U{h_{t-1}})
\label{equ:recurrent}$$

where $h_t$ is the recurrent hidden stage, $h_{t-1}$ is the hidden stage of the previous time step, $W$ and $U$ are weight matrix, $g$ is the activation function. [@DBLP:journals/corr/ChungGCB14]

#### Long Short-term Memory Unit {#long-short-term-memory-unit .unnumbered}

The facts have been observed that it is hard to train recurrent neural networks in order to capture long-term dependencies. The reason is that the gradients are prone to either vanish or explode, which prevents the gradient-minimisation algorithms to find the optimal parameters. [@DBLP:journals/corr/ChungGCB14]

One popular solution to this problem is to design a more complicated activation function using gate units. Long Short-term Memory unit (LSTM) is one of the attempts.

Different from the regular recurrent neural networks, the LSTM unit does not easily overwrite the recurrent unit state at each time-step. Instead, by introducing three gate units, i.e. input gate, output gate and forgetting gate, LSTM unit can decide whether to reserve the current memory or not. The input gate unit is capable of deciding the degree to which the new memory is added to the memory cell. The output gate unit can determine the degree to which the memory is exposed to outside. And the forget gate unit enables the network to judge the degree to which the current memory is forgotten. The introduction of the gate units can discover the long-term dependencies which are hidden by the short-term dependencies in easy recurrent unit [@DBLP:journals/corr/ChungGCB14]. A graphic representation of LSTM can be seen in Figure  \[fig:LSTM\].

Related Work and Challenges {#Related Work and Challenges}
---------------------------

There are several significant challenges (competitions) that promote the development of emotion recognition. Various approaches were attempted in those challenges.

EmotiW focuses on the categorical emotion recognition in-the-wild [@Dhall:2017:IGE:3136755.3143004]. In 2017, baseline experiments achieved 38.81% in the validation set. And the winner won the challenge with 83.9% validation accuracies using individual facial emotion CNNs and global image based CNNs [@Tan:2017:GER:3136755.3143008].

Tan et al. [@Tan:2017:GER:3136755.3143008] proposed that individual emotion CNNs extract faces from images before the training. And they used a large-margin softmax loss for discriminative learning with both aligned and non-aligned faces. For the global images based CNNs, they trained the networks with VGC19, BN-Inception and ResNet101 architectures to extract global features for the purpose of recognising group emotion.

AVEC concentrates on dimensional emotion recognition under controlled environment [@nott45489]. The baseline for this challenge is 0.375 and 0.466 Concordance Correlation Coefficient (CCC) for arousal and valence [@ringeval2017avec]. The winner won with 0.68 and 0.76 for the two dimensions using a Multi-modal Learning method [@Chen:2017:MML:3133944.3133949].

Chen et al. [@Chen:2017:MML:3133944.3133949] investigated that the fusion of acoustic, visual and textual modalities and multi-task learning arousal and valence simultaneously can significantly improve the recognition performance. The temporal LSTM-RNN architecture was used in their research.

AffWild [@kollias1; @kollias2; @kollias3; @kollias4; @kollias5; @kollias15] pays attention to dimensional emotion recognition in-the-wild. The baseline architecture using a CNN-M network and obtained CCC of 0.15 and 0.10 for valence & arousal respectively. And the winning architecture FATAUVA-Net improved the CCC to 0.396 and 0.282.

The main idea of FATAUVA-Net architecture is by exploiting Action Units as the mid-level representation for valence and arousal estimation. And the Action Units detection is based on facial attribute recognition.

One track of the EmotioNet challenge is to research the basic and compound emotion recognition. Last year the winner NTechLab achieved a 94.1% accuracy compared to baseline 91% [@DBLP:journals/corr/Benitez-QuirozS17].

Interpretability
----------------

As Machine Learning is being widely applied in the real world, the interpretability and understandability of models are becoming increasingly important [@KrakovnaViktoriya2016BIMF; @kollias10; @simou2008image; @kollia2011query; @kollias11; @simou2007fire; @kollias12; @glimm2013using; @horrocks2011answering]. Debugging Machine Learning methods could be challenging [@43146; @kollias6], as machines could make errors that humans would not [@DBLP:journals/corr/PapernotMGJCS16]. This prevents us adopting models in applications which require high accuracy and trust.

Maithra Raghu et al. [@raghu2017svcca] proposed the technique Singular Vector Canonical Correlation Analysis (SVCCA) to compare representations in different layers and networks. SVCCA discovers the deep representation that layers learned by analysing neuron’s activation vector. This allows the comparison of representation between different architectures and the insight into the learning process.

Laurens van der Maaten et al. [@maaten2008visualizing] present a technique t-Stochastic Neighbor Embedding to compare the similarity of the features that neural network extract. This technique visualise the similarity of datapoints by reducing the high-dimensional representation into 2 dimensions. Hence the interpretation of the data can be observed.

Activation Maximisation is proposed by Dumitru Erhan et al. [@erhan2009visualizing]. The idea of it is to generate data that can maximumly activate specific neurons. Activation Maximisation allows the research to visualise the interpretation of the features that neural networks learned.

Karen Simonyan et al. [@simonyan2013deep] addresses the idea to compute the saliency map of the classes for Convolutional Neural Networks. The saliency map allows researchers to observe which part of the images that the classification prediction relies on in 2 dimensional possibility heat maps.

Methodology
===========

This chapter describes the approaches to prepare the data for the aim to this project. The design of the architectures and corresponding parameters are also explained in this chapter.

Section 3.1 shows the plan to annotate the database and prepare the training, validation and testing sets. Section 3.2 explains the reason to use Convolutional plus Recurrent Neural Networks and illustrates the three models to build. Section 3.3 introduces the pre-trained CNN networks used in the project. Two objective functions chosen for training the different networks are introduced in section 3.4. Section 3.5 demonstrates both the software and hardware working environment for this project.

Data Preparation
----------------

Because there is no video database with both emotion category labels and valence & arousal labels, the database used in this project is created by extending an existing emotion recognition database with valence & arousal annotation to one with category emotion. Time was spent on annotating the videos with emotion categories frame by frame.

Data will be processed before fed into neural networks. Videos will need to be captured frame by frame, and faces will be cropped out for training use. Matching the frame and corresponding tables will be developed. Images will be normalized and split into training, validation and testing sets respectively.

CNN + RNN Deep Neural Networks
------------------------------

Convolutional Neural Networks have been widely applied to image recognition and analysis. It has been proved that CNNs can effectively extract spatial features from images. Furthermore, Recurrent Neural Networks exhibit the ability to capture the temporal behaviours from time sequence data. Therefore, to recognise emotion in both categorical and dimensional representation from continuous video frames, CNN plus RNN architectures are used in this project [@kollias7; @kollias14].

Image data is fed into CNN to extract spatial information. The extracted features are then fed into RNN for temporal information learning. Fully connected layers are stacked on the top of RNN to give dimensional estimation or classification.

Extensive experiments were carried out based on the three models illustrated in Figure \[fig:archi\]. In the first model, we only fed the categorical representation into the CNN-RNN architecture. The second model was only trained on dimensional emotion representation labels. Therefore, the first two models should be able to predict the basic emotion categories or valence & arousal respectively.

Especially, to see if training the model with both categorical and dimensional labels could improve the performance, we built the third combined model. Two emotion representations were fed into the combined model at the same time. The model could learn two representations simultaneously. We want to investigate if this method could lead to a higher performance in two emotion representation recognition.

Pre-trained CNN architectures are utilised in this project, including VGG-16, VGG-19 and Xception networks.

The pre-trained CNNs are frozen during training. Only the rest of the models are trained and fine-tuned, e.g. hidden layers of RNN and fully connected layers. This operation could increase the flexibility of the architecture, because the further fine-tuning can be implemented by adding new emotion frames or video.

Pre-trained Architectures
-------------------------

Pre-trained models are the architectures that have been trained and hence contains optimal weights and biases for the specific dataset.

Training a complicated CNN architecture completely from scratch needs a huge amount of training data, as well as computational power. Using the proved pre-trained models can save training time and features learned from the previous dataset can be transferred to ours.

The models have been experimented with various pre-trained CNN architectures. They are all pre-trained on ImageNet database.

### VGG-16 and VGG-19

The VGG very deep convolutional networks were developed in 2014 at Oxford [@DBLP:journals/corr/SimonyanZ14a]. The idea of it is stacking series of 3 x 3 convolutional layers and increasing the depth of Neural Network. It is proved to have great performance on large-scale image recognition.

However, one disadvantage of VGG is, it takes a long time to train. This is due to its very deep architecture.

The configuration of VGG-16 and VGG-19 used in this project is illustrated in Table  \[table:vgg\]. “16” and “19” means the number of weight layers in the architecture.

  -- --
     
     
     
     
     
     
     
     
     
     
     
     
  -- --

  : Configuration of VGG-16 and VGG-19 architecture[]{data-label="table:vgg"}

### Xception

Xception is an extension of the Inception network. The key idea of the Inception network is combining convolutional layers parallelly. Therefore, each layer is able to concatenate the results from different kernels simultaneously and then feed the result into the next layer as one single output. A demonstration of the Inception Module is shown in Figure \[fig:inception\].

Xception replaces the Inception modules with depthwise separable convolutions, which gives a small improvement in image classification accuracy. The replacement of depthwise separable layers and the demonstration of Xception are illustrated in Figure \[fig:xception\].

Objective Function
------------------

Two types of affect representation are experimented with in this project. The way to evaluate the prediction depends on the representation. Different objective functions are utilised in the neural network training. Categorical cross-entropy and Concordance Correlation Coefficient (CCC) are applied for different output [@kollias5].

### Categorical Cross-Entropy

Cross-entropy function is utilised together with the Softmax classifier as the loss function for the categorical emotion representation. The two functions are defined as follows:

$$Softmax\ Classifier: f_j(z) = \frac{e^{z_j}}{\sum\nolimits_{k}^{} e^{z_k}}$$

$$cross-entropy\ loss: L_i = -log(\frac{e^{f_{yi}}}{\sum\nolimits_{j}^{} e^{f_{j}}})$$

where $z_j$ is the output of the fully connected layer for each class.

A Softmax classifier can interpret the scores from the outputs as the unnormalized log probabilities.

In backpropagation, the equation to calculate the gradient is elegant when using Softmax classifier and Cross-entropy loss. The computational resource is saved.

### Concordance Correlation Coefficient (CCC)

The loss function chosen for Valence & Arousal was based on the Concordance Correlation Coefficient, which is defined as follows:

$$\rho_c = \frac{2s_{xy}}{s_x^2 + s_y^2 + (\bar{x} - \bar{y}) ^ 2}$$

where $\bar{x}$ and $\bar{y}$ are the mean value of the predicted values and the ground truth values. $s_x$ and $s_y$ are the variances respectively. $s_{xy}$ is the respective covariance value.

Concordance Correlation Coefficient measures the agreement between ground truth and prediction, which illustrates a better perception of whether prediction matching the annotation. Consequently, the loss was defined as $1 - \rho_c$.

Software and Hardware Environment
---------------------------------

This project is implemented in the Python language. Libraries including menpo, NumPy, OpenCV and matplotlib are used to process the image data and carry out visualization.

TensorFlow and Keras are utilised to train the model and evaluate the corresponding performance.

Training was accomplished on CSG GPGPU Cluster with Nvidia GeForce GTX Titan X and GTX 1080 Ti.

Experiment
==========

This chapter describes the implemented experiments and work for this project in detail.

Section 4.1 explains how the database is extended. Section 4.2 describes the methods to process the annotated data into training materials. Section 4.3 clarifies how images are resized and normalised before training. Experimented Deep Neural Networks are summarised in section 4.4. Section 4.5 illustrates the optimal hyperparameters investigated on different architectures.

Annotation
----------

For data annotation, three weeks were spent on extending the existing valence & arousal dataset with categorical emotion representation.

All videos were first converted to 30 fps (frame per second) for the unity for future cropping process. An Active Unit HTML5 annotation tool was adapted to categorical emotion representation annotation. Original User Interface was modified to make it more intuitive and convenient for categorical emotion usage.

Figure \[fig:tool\] illustrates the annotation tool.

All the annotation was applied to frames of video in the following process:

1.  The whole video is watched from beginning to end, hence, the context of video and the atmosphere of the circumstance could be perceived. The possibility of the wrong annotation due to the misleading and complicated facial expression was strongly avoided.

2.  The video is then watched again from beginning to end. The different emotions happened in the video are marked down.

3.  Each emotion is annotated separately throughout the video to achieve a high-quality representation.

4.  During annotation, the precise positioning tool is used to annotate the video frame by frame.

All videos were reviewed at least three times according to the annotation process. Four videos in the dataset have more than one character. Each character in the video had their emotions annotated independently.

Dataset Processing
------------------

The Menpo project [@menpo14] was used to extract the faces in all frames of video. ffld2 detector was utilised to detect faces from the frame [@10.1007/978-3-319-10593-2_47]. For videos with more than one character, a software was written to classify different faces based on the coordinates of the faces in the frame. Images were then reviewed and corrected manually. 265,663 faces were cropped from the videos.

After cropping the faces out of the frames, matching processes were developed to build the new dataset. The provided valence & arousal annotations has several formats. A software was developed to translate them into one unifying schematic. This makes it possible to feed the data and labels to the Neural Network.

The cropped faces were then matched with the annotation timestamps by a binary search based nearest neighbour method. For each frame time face instance, the nearest neighbour is searched and corresponding valence & arousal values are allocated to the face.

After further matching the frame with the emotion categories, faces without a categorical emotion representation label were removed from the dataset for category-only models and combined models. 107,640 frames have an emotion category in the database.

Because all frames have a pair of valence and arousal values, if we train the valence & arousal only models on all the frames, and train category-only and combined models on images only having the emotion categories, the size of the database could influence performance. Especially, when we compare the valence & arousal performance between dimensional-only models and combined models, it can be the size of the database that impacts the performance, rather than the architecture.

Therefore, all the three models were trained on the images in the dataset that have both categorical emotion and valence & arousal labels. The models to predict categorical emotions, valence & arousal and both of them, would be trained on the single dataset. The variable of the database size is eliminated.

![A representation of the frame in dataset: Fear, Valence: -0.68, Arousal: 0.72[]{data-label="fig:sam_fear"}](figures/experiment/happy.jpg){width="\textwidth"}

![A representation of the frame in dataset: Fear, Valence: -0.68, Arousal: 0.72[]{data-label="fig:sam_fear"}](figures/experiment/fear.jpg){width="\textwidth"}

In total, now the dataset has 55 videos and is with 107,640 frames. All frames have both dimensional emotion prediction of arousal and valence, as well as categorical annotation such as happy and sad. Figure  \[fig:sam\_happy\] and Figure  \[fig:sam\_fear\] illustrate two typical samples and corresponding labels in the dataset.

All videos with corresponding frames were split into three datasets, i.e. training, validation and testing. The videos were randomly selected and put into each dataset first, followed by manual adjustment to try and ensure that all three datasets have every label kind, although this could not be guaranteed. Figure \[fig:data\_all\] - Figure \[fig:data9\] provide histograms for the annotated values of categorical emotions and valence and arousal in the database and various sets. It can be observed that there are limited negative arousal values in the dataset.

It is also worth noting from them that:

1.  The database for emotion categories are highly imbalanced. Neutral and sadness account for more than 80%. The effect of the imbalance and solution to address it will be discussed in analysis and future work.

2.  The level of representation of the validation and testing set for valence and arousal values is not as good as the emotion categories. Because there are only 55 videos in the database, and we split the videos both video-based and person-independent to achieve an impartial evaluation, it is extremely hard to ensure that all the sets’ label distributions are similar. What’s more, when splitting the videos, there are two types of labels need to take into account. Emotion category and valence & arousal values are both correlated and independent to some extent. When one labels completeness and level of representation is fulfilled, the other one would not be as good. The effect of this issue and solutions will also be addressed in analysis and future work.

3.  The sets have been re-split and evaluated several times, however, this is the best distribution achieved due to the constraints.

Data Pre-processing
-------------------

Before being fed to the end-to-end Deep Neural Network, all frame images were resized to 72 x 72 x 3 pixel resolution. Images intensity values were normalised to a range of \[-1, 1\].

![Categorical Emotion Distribution in Database[]{data-label="fig:data3_all"}](figures/experiment/all_distr_V.png){width="\textwidth"}

![Categorical Emotion Distribution in Database[]{data-label="fig:data3_all"}](figures/experiment/all_distr_A.png){width="\textwidth"}

![Categorical Emotion Distribution in Database[]{data-label="fig:data3_all"}](figures/experiment/all_distr_cate.png){width="\textwidth"}

![Categorical Emotion Distribution in Training Set[]{data-label="fig:data3"}](figures/experiment/train_V.png){width="\textwidth"}

![Categorical Emotion Distribution in Training Set[]{data-label="fig:data3"}](figures/experiment/train_A.png){width="\textwidth"}

![Categorical Emotion Distribution in Training Set[]{data-label="fig:data3"}](figures/experiment/train_cate.png){width="\textwidth"}

![Categorical Emotion Distribution in Validation Set[]{data-label="fig:data6"}](figures/experiment/validation_V.png){width="\textwidth"}

![Categorical Emotion Distribution in Validation Set[]{data-label="fig:data6"}](figures/experiment/validation_A.png){width="\textwidth"}

![Categorical Emotion Distribution in Validation Set[]{data-label="fig:data6"}](figures/experiment/validation_cate.png){width="\textwidth"}

![Categorical Emotion Distribution in Testing Set[]{data-label="fig:data9"}](figures/experiment/test_V.png){width="\textwidth"}

![Categorical Emotion Distribution in Testing Set[]{data-label="fig:data9"}](figures/experiment/test_A.png){width="\textwidth"}

![Categorical Emotion Distribution in Testing Set[]{data-label="fig:data9"}](figures/experiment/test_cate.png){width="\textwidth"}

Deep Neural Networks {#deep-neural-networks}
--------------------

There are different pre-trained CNN architectures utilised in this project. In addition, different fully connected layers are tested for three types of models.

### Category-Only Models

  -- -- --
        
        
  -- -- --

  : Different 1 fully connected layer architectures attempted for category-only models[]{data-label="table:cate1"}

[|c|c|c|]{} block1 & VGG-16 or Xception or VGG-19 conv&pooling parts &\
block2 &

  ----------------
   LSTM RNN layer
   dropout layer
  ----------------

  : Different 2 fully connected layers architectures attempted for category-only models[]{data-label="table:cate2"}

& Unit: 128\
block3 &

  -----------------------
   fully connected layer
       dropout layer
  -----------------------

  : Different 2 fully connected layers architectures attempted for category-only models[]{data-label="table:cate2"}

&

  -----------------
   Unit: 64 or 128
  -----------------

  : Different 2 fully connected layers architectures attempted for category-only models[]{data-label="table:cate2"}

\
block4 &

  --------------------------------------------
   fully connected layer + SoftMax activation
  --------------------------------------------

  : Different 2 fully connected layers architectures attempted for category-only models[]{data-label="table:cate2"}

& Unit: 7\

For the category-only models, VGG-16, Xception and VGG-19 have been selected as CNN part. LSTM were used as RNN networks. The hidden unit chosen for LSTM is 128. The activation function of the last fully connected layers is SoftMax, used with the categorical-crossentropy loss function. A representation of these architectures is summarised in Table \[table:cate1\].

Furthermore, the same architectures with a different number of fully connected layers and hidden units are experimented. The architectures achieved the best performance for VGG-16 is one more fully connected layers with 64 hidden units. And for VGG-16 and Xception, the additional fully connected layer is the one with 128 units. The configurations of those 2 fully connected layers architectures are summarised in Table \[table:cate2\].

### Dimensional-Only Models

For the valence & arousal architectures, the chosen architectures are similar to the category-only models. VGG-16, Xception and VGG-19 plus LSTM architecture are implemented. The difference is the hidden unit for the last fully connected layer is 2 for the purpose of valance and arousal prediction. And the corresponding activation function for the last layer is a linear function.

### Combined Models

For the implementation of combined models, a single-input multi-output model is utilised. The sequences of images are fed as input, and the two outputs are emotion category and valence & arousal values respectively. The predictions are based on the shared CNN + RNN layers. VGG-16, Xception and VGG-19 are concatenated with LSTM as the shared CNN + RNN architecture. Different fully connected layers are used for affect category and dimensional representation separately.

For VGG-16 based combined models, 7 units fully connect layer for categorical prediction and 2 units for dimensional are applied. Furthermore, 3 fully connected layers for each output are tested e.g. 128 unit fully connected layer + 128 unit fully connected layer + 7 unit fully connected layer for category and 128 unit fully connected layer + 128 unit fully connected layer + 2 unit fully connected layer for dimensional output.

For Xception based combined architectures, 128 unit fully connected layer + 7 unit fully connected layer and 128 unit fully connected layer + 2 unit fully connected layer are used for categories and dimensions respectively at first. Three fully connected layers are also tried for this pre-trained network. The three fully connected layers are the same as the ones shown in the last paragraph.

In the VGG-19 based combined models, 7 unit fully connected layer and 128 unit fully connected layer + 7 unit fully connected layer are attempted for emotion categories. 2 unit fully connected layer and 128 unit fully connected layer + 2 unit fully connected layer are implemented for valence and arousal prediction. Table \[table:combined\] is a summary of the combined models’ architectures.

[|c|c|c|]{} block1 &

  -------------------------
   shared CNN + RNN layers
        dropout layer
  -------------------------

  : Summary of the combined model architectures[]{data-label="table:combined"}

&\
block2 - 1 &

  ------------------------
   fully connected layers
       dropout layer
  ------------------------

  : Summary of the combined model architectures[]{data-label="table:combined"}

&

  -------
   Unit:
    7/2
  -------

  : Summary of the combined model architectures[]{data-label="table:combined"}

\
block2 - 2 &

  ------------------------
   fully connected layers
       dropout layer
  ------------------------

  : Summary of the combined model architectures[]{data-label="table:combined"}

&

  -----------
     Unit:
   128 + 7/2
  -----------

  : Summary of the combined model architectures[]{data-label="table:combined"}

\
block2 - 3 &

  ------------------------
   fully connected layers
       dropout layer
  ------------------------

  : Summary of the combined model architectures[]{data-label="table:combined"}

&

  -----------------
        Unit:
   128 + 128 + 7/2
  -----------------

  : Summary of the combined model architectures[]{data-label="table:combined"}

\

Hyperparameters
---------------

Apart from the pre-trained neural networks and fully connected layer, extensive experiments have been developed by choosing different hyperparameters, including:

1.  batch size for the neural network to update

2.  the value of the learning rate

3.  the value of the learning rate decay

4.  the value of the dropout possibility

The sequence length of frames is tested with the value 60 and 80. The best result has been obtained when sequence length is 60.

Batch size was chosen in the range 1 to 4. The best performance achieved with batch size 2.

Dropout possibility was tested in the range 0.5 to 0.8, and the optimal found was 0.5.

Learning rate was selected from 0.1 to 0.000001. The best performance achieved is based on the various architectures. In category-only models and combined models, best results have been achieved with learning rate 0.00001. In the valence and arousal models, 0.0001 have been found to reach the best evaluation values.

Similarly, the best learning rate decay varies on different architectures. In category-only architectures and valance & arousal architectures, the best results were observed when the value of learning rate decay is 0.0001. In the combined models, the value of decay performs the best result is 0.00001.

Another parameter to mention is the loss weight in combined models. Since the combined models are multi-output architectures, two loss functions mentioned in Methodology are both applied in the neural networks. Weights are needed to assign to each function. The loss of categorical output is much larger than the loss of dimensional output due to the different definitions. 0.33 for categorical cross-entropy and 1.00 for CCC was found to achieve the best overall performance.

In conclusion, extensive experiments were implemented to achieve the best performances. All the results performed by the architectures mentioned with the optimal parameters will be displayed and discussed in the next chapter.

Result & Analysis
=================

This chapter demonstrates all the results obtained from the designed architectures described in the last chapter. Comparisons and analysis are given in this chapter.

Section 5.1 and section 5.2 present the performance obtained by category-only models and valence & arousal-only models on the validation set. Section 5.3 describes the evaluation of the combined models on the validation set. Comparisons to single-functional models are stated in this section. Section 5.4 discovers the inner-relationship of two types of affect representations. Analysis of the impact of the inner-relationship is presented in section 5.5. Section 5.6 discusses the two techniques utilised to discover the interpretability of the neural networks.

The evaluation presented in this chapter is performed on validation set. The evaluation on training set and testing set are attached in Appendix. “FC” in the tables is the abbreviation of fully connected layer.

Categorical-Only Models
-----------------------

  -------------------- --------- ------- ------ ------- ------ ---------- --------- ----------
                        Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust    Total
     VGG16+LSTM+1FC      0.08     0.00    0.77   0.00    0.00     0.00      0.00       0.35
   **VGG16+LSTM+2FC**    0.29     0.00    0.86   0.02    0.05     0.00      0.09     **0.47**
     Xcep+LSTM+1FC       0.24     0.00    0.50   0.00    0.00     0.00      0.00       0.32
     Xcep+LSTM+2FC       0.42     0.00    0.44   0.00    0.00     0.00      0.00       0.34
     VGG19+LSTM+1FC      0.02     0.00    1.00   0.00    0.00     0.00      0.00       0.51
     VGG19+LSTM+2FC      0.26     0.00    0.24   0.00    0.00     0.00      0.00       0.19
  -------------------- --------- ------- ------ ------- ------ ---------- --------- ----------

  : Accuracies obtained on validation set by various CNN-RNN architectures for categorical-only models[]{data-label="table:cate_res"}

The accuracies of seven basic emotions obtained on validation set by different attempted architectures are summarised in Table \[table:cate\_res\].

The best accuracy performance was achieved by VGG19 + LSTM + 1 fully connected layers. However, the VGG16 + LSTM + 2 fully connected layers were selected as the best architecture. This is because this model achieved second highest overall accuracy, which is 47%. Although the overall accuracy 47% is slightly lower than VGG19’s 51%, it can predict more emotions than VGG19 model. The average accuracy obtained by six architectures was 0.37.

It can be observed that, emotions like happiness, angry, fear, surprise and disgust could not be well recognised by the model. This is most likely because of the imbalanced dataset trained on. Emotion neutral and sadness account for more than 80% of the whole dataset.

The combined model is expected to alleviate this problem. Several solutions to solve this problem will be discussed in future work.

Valence & Arousal-Only Models
-----------------------------

Table \[table:va\] illustrates the Concordance Correlation Coefficient and mean square errors of predicted Valence & Arousal values. The best performance is achieved by VGG-19 + LSTM + 2 fully connected layers, which has 128 units and 2 units respectively.

The best CCC accomplished is 0.16 for valence and 0.17 for arousal in this VGG-19 architecture.

  --------------------- ---------- ---------- ---------- ----------
                         Valence    Arousal    Valence    Arousal
     VGG16+LSTM+1FC        0.04       0.02       0.40       0.14
     VGG16+LSTM+2FC        0.09       0.09       0.32       0.11
      Xcep+LSTM+1FC       -0.03      -0.13       0.31       0.12
      Xcep+LSTM+2FC       -0.01      -0.03       0.30       0.10
     VGG19+LSTM+1FC        0.11       0.14       0.32       0.11
   **VGG19+LSTM +2FC**   **0.16**   **0.17**   **0.31**   **0.09**
  --------------------- ---------- ---------- ---------- ----------

  : CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in dimensional-only models on validation set[]{data-label="table:va"}

Combined Models
---------------

Because the combined models are multi-output neural networks. The input images share the CNN and RNN part and have different fully connected layers to make the respective decision. The performance for different output are given separately. Comparisons are made to the categorical-only model and valence & arousal-only model individually.

Categorical Predictions Evaluation {#categorical-predictions-evaluation .unnumbered}
----------------------------------

  -------------------- --------- ------- ------ ------- ------ ---------- --------- ----------
                        Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust    Total
     VGG16+LSTM+1FC      0.30     0.00    0.90   0.01    0.01     0.00      0.00       0.54
     VGG16+LSTM+3FC      0.32     0.00    0.97   0.00    0.00     0.00      0.00       0.57
     Xcep+LSTM+2FC       0.09     0.00    0.81   0.00    0.00     0.00      0.00       0.43
     Xcep+LSTM+3FC       0.23     0.00    0.89   0.00    0.00     0.00      0.00       0.51
   **VGG19+LSTM+1FC**    0.39     0.00    0.93   0.15    0.25     0.00      0.00     **0.59**
     VGG19+LSTM+2FC      0.36     0.00    0.84   0.11    0.18     0.00      0.00       0.53
  -------------------- --------- ------- ------ ------- ------ ---------- --------- ----------

  : Accuracies obtained on validation set by various CNN-RNN architectures for combined models[]{data-label="table:combined_cate"}

The category accuracy results which combined models obtained are summarised in Table \[table:combined\_cate\]. A significant increase in overall accuracy can be observed. The average accuracy for all the combined models is 0.53, which is higher than the best result shown in the category only model (0.51).

The best accuracy achieved is 0.59, increased by 25% compared to the category-only model. This accuracy is performed on the combined model which has the shared VGG-19 + LSTM, and 1 fully connected layer (7 units). Table  \[table:compare\_cate\] shows the comparison of the best accuracies obtained on the validation set by combined model and category-only model.

It is worth noticing that, even trained and validated on the same very imbalanced dataset, the neural networks shows the ability to learn the minority emotions in some combined models. Emotion angry and fear’s accuracy is improved to 0.15 and 0.25 from around 0.00.

  ------------------------ --------- ------- ------ ------- ------ ---------- --------- ----------
                            Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust    Total
   **Best category-only**    0.29     0.00    0.86   0.02    0.05     0.00      0.09     **0.47**
     **Best combined**       0.39     0.00    0.93   0.15    0.25     0.00      0.00     **0.59**
  ------------------------ --------- ------- ------ ------- ------ ---------- --------- ----------

  : Comparison of the best accuracies obtained on validation set by combined model and category-only model[]{data-label="table:compare_cate"}

             precision   recall   f1-score
  ---------- ----------- -------- ----------
  Neutral    0.57        0.39     0.46
  Happy      0.00        0.00     0.00
  Sad        0.64        0.93     0.76
  Angry      0.15        0.15     0.15
  Fear       0.26        0.25     0.26
  Surprise   0.00        0.00     0.00
  Disgust    0.00        0.00     0.00
  average    0.49        0.59     0.52

  : Precision, accuracy, and f1-score of the VGG-19 combined architecture, which produces the best performance.[]{data-label="table:combined_cate_report"}

The training history of the combined model obtaining the best accuracy is plotted in Figure \[fig:acc\_hist\]. Both training and validation accuracy increase gradually. The models that achieved best validation loss were saved.

Detailed metrics including precision, recall and f1-score for the combined architecture that achieved the best performance can be found in Table \[table:combined\_cate\_report\].

In summary, by constructing a combined model training both categorical and dimension labels together, the performance in categorical classification can be significantly improved. In addition, the effect of the imbalanced dataset is alleviated.

Dimensional Prediction Evaluation {#dimensional-prediction-evaluation .unnumbered}
---------------------------------

  -------------------- ---------- ---------- ---------- ----------
                        Valence    Arousal    Valence    Arousal
     VGG16+LSTM+1FC       0.13       0.04       0.38       0.19
     VGG16+LSTM+3FC       0.07       0.13       0.36       0.10
     Xcep+LSTM+2FC       -0.03       0.00       0.34       0.11
     Xcep+LSTM+3FC        0.02       0.01       0.32       0.11
     VGG19+LSTM+1FC       0.14       0.20       0.33       0.12
   **VGG19+LSTM+2FC**   **0.14**   **0.20**   **0.33**   **0.10**
  -------------------- ---------- ---------- ---------- ----------

  : CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in combined models on validation set[]{data-label="table:combined_va"}

Table \[table:combined\_va\] summarises the evaluation of CCC and MSE values when using combined models on validation set. It can be seen that the best results have been achieved by VGG-19 + LSTM + 2 fully connected layers (128 units and 2 units).

Compared to the CCC values obtained in the dimensional-only models, there is no significant change that can be observed. Table \[table:compare\_va\] summarised the comparison of best CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in the combined models and dimensional-only models on the validation set. It can be seen that the best CCCs achieved in dimensional representation only models are 0.16 and 0.17, compared to 0.14 and 0.20 in the combined models. The total MSE in the combined model increases by 0.03, whilst the total CCC decreases by 0.01.

  ------------------------------ ---------- ---------- ---------- ----------
                                  Valence    Arousal    Valence    Arousal
   **Best in Dimensional-only**   **0.16**   **0.17**   **0.31**   **0.09**
       **Best in Combined**       **0.14**   **0.20**   **0.33**   **0.10**
  ------------------------------ ---------- ---------- ---------- ----------

  : Comparison of best CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in combined models and dimensional-only models on validation set[]{data-label="table:compare_va"}

Figure \[fig:mse\_hit\] plots the training history in the architecture with the best performance. It can be observed that even in the architecture achieving best results, the loss on the validation set did not markedly decrease. The is mainly because the validation set is not representative enough. Sets have been split and optimised several times to achieve a high level of representation. However, due to the fact that there are 2 types of labels to be considered and there are only 55 videos, the labels of 2 representations are both independent and correlated, the space to adjust is relatively small. This issue will be discussed in future work and several solutions will be provided.

Another two observations can be made on all three models:

1.  Within all three types of architectures, the best performances have been achieved by the VGG-19 based CNN + RNN architectures. We infer from this that by increasing the depth of Convolutional layers, more useful image features can be extracted and benefit emotion recognition.

2.  No evident increase can be obtained when simply increasing the layer of fully connected layers within each pre-trained networks.

In summary, by building the combined model and training the emotion category labels and dimensional valence and arousal values simultaneously, the results obtained for categorical prediction outperform the accuracies shown by the category-only model. Especially, the emotions which are minorities in the database start to be recognised and recalls are increased.

However, the CCC evaluations of valence and arousal do not demonstrate a marked increase in this method. The discussion and analysis of these phenomena are developed in the next section.

Inner-Relationship of Emotion Category and Dimensional Representation Analysis
------------------------------------------------------------------------------

In order to discover the reason for the increase in classification performance by training two affect labels together, and the relatively insignificant change in valence & arousal evaluations, efforts were made on the analysis of the distribution of categorical emotions on valence and arousal space. Inner-relationship of two types of emotion representation is expected to be discovered, to explain the phenomenon displayed in the combined model.

The distribution of the seven basic emotions on valence and arousal space are plotted in Figure \[fig:happiness\] to Figure \[fig:neutral\]. This is achieved by matching the two types of labels by the same video frame.

It can be observed in Figure \[fig:happiness\] that Happiness category shows a strong relationship with Valence and Arousal. All most all the Happiness labels are located in first quadrant, where valence and arousal are larger than 0.

Figure \[fig:fear\] shows that Fear illustrates a common characteristic of Happiness. The difference is most of Fears are located in the second quadrant, which means fear is a negative emotion.

The feature could be found in Figure \[fig:sadness\] that most of the sadness has a negative valance value. However, a small number of sadnesses are in the first quadrant. This means some sadness is classified as a positive emotion. This circumstance happens when the character in the video show emotions like “being moved”. This distribution implies that a complex emotion annotation or labels combining both Valence & Arousal could be a more accurate representation of some emotions.

Similarly, both Disgust and Angry cluster in the second quadrant. A small part of each emotion shows up in the valence-positive area, which inferred that small portion of Disgust and Angry could be positive in some situations. A more precise representation to characterize these kinds of emotions could be investigated in the future, and may lead to a more accurate emotion recognition.

Particularly, Surprise demonstrates an equivalent possibility appearing in both positive and negative valence region. This makes sense because some Surprise in the database are more related to Fear, while some others are involved with Happiness, e.g. surprised by receiving an unexpected gift.

In Figure \[fig:neutral\], there is no specific pattern could be observed from distribution for Neutral. This is due to the fact that neutral is the most common emotion. Also, Neutral usually initiates the rest of six emotions, the various emotions initiated by neutral have an impact on neutral’s valence & arousal values. This leads to a wide distribution of neutral.

In conclusion, Happy and Fear shows a one-to-one-region mapping characteristic to the region of valence and arousal. Sadness, Disgust, Angry and Surprise demonstrates the one-to-two-region relationship when mapping to valence and arousal dimensions. In contrast, one specific valence and arousal pair can be mapped to at least 5 or 6 emotions. This feature is illustrated in Figure \[fig:all\_emo\], where all emotions label distributions are plotted on one space.

This mapping difference might explain the performance increase of emotion category predictions in the combined model and no change in dimensional emotion evaluation in the combined models.

Inner-Relationship’s Impact Analysis
------------------------------------

When we train the combined architectures with two annotations, the shared CNN and RNN part are expected to learn the features from both emotion representation. Therefore, when predicting the emotion in images, the features extracted by the CNN and RNN part are supposed to have extra information compared to single-function models.

For emotion category predictions, as described in the last section, a specific emotion can be mapped to one or two regions on the valence and arousal dimension. Hence, the extra information for the fully connected layer contains the features that map to one or two specific ranges of valence and arousal. This definite range is a clear signal for the neural network, and can benefit the neural network to make the prediction for emotion categories.

For example, when feeding an image which is supposed to be classified as angry to the category-only model, the neural network could make the prediction that the possibility of the image to be happy and angry are equal. In this situation, the possibility that the model can make the right prediction is 50%. When feeding the same image to a combined model, the extra valence and arousal information will be extracted. In this case, the extra information can be interpreted as the valence and arousal are more likely to be negative. And the fully connected layer will receive this information, and predict the image to angry because of the distribution of angry. Because, compared to happy, angry is more likely to have a negative valence. Hence, the accuracy is improved.

On the contrary, the valence & arousal output cannot benefit from this extra information extracted. As shown in Figure \[fig:all\_emo\], one pair of valence and arousal coordinates have the possibility to be all emotions. This extra information will be that this image can be more than five emotions. The message is not a clear signal, and does not have useful value for valence and arousal fully connected layers. It cannot help the layers to better predict the valence and arousal values. Even though the extra feature ideally implies only one emotion, as can be observed in Figure \[fig:happiness\] to Figure \[fig:neutral\], one specific emotion can still spread in a range of areas. This information is still too general for the valence & arousal fully connected layers to find to specific correct value.

In summary, the one-to-one and one-two mapping of the emotions to valence & arousal ranges can help the combined model provide clearer features and make a better prediction. However, the one-to-many mapping of the valence & arousal range to emotions cannot give the model specific information and the neural network cannot provide a better result.

Interpretability Analysis
-------------------------

Two techniques, t-Distributed Stochastic Neighbor Embedding and Activation Maximisation are carried out to discover the interpretability of the emotion recognition neural network.

### t-Distributed Stochastic Neighbor Embedding {#t-distributed-stochastic-neighbor-embedding .unnumbered}

t-Distributed Stochastic Neighbor Embedding [@maaten2008visualizing] is a machine learning technique that allows visualisation high-dimensional datapoints by reducing the dimensions to a two or three low dimensional map. t-Distributed Stochastic is an alteration of the original Stochastic Neighbor Embedding, which is easier to optimise and gives remarkably better visualisations [@vanDerMaaten2008].

The idea of the Stochastic Neighbor Embedding is to convert the high-dimensional Euclidean distances between each datapoint into the conditional probabilities which can represent similarities. The definition of the similarity of datapoint $x_j$ to datapoint $x_i$ is the conditional probability $p_{j\mid i}$, which $x_i$ would pick $x_j$ as its neighbor if neighbors were picked in proportion to their probability density under a Gaussian centred at $x_i$ [@vanDerMaaten2008]:

$$p_{j\mid i} = \frac{\exp(-\lVert\mathbf{x}_i - \mathbf{x}_j\rVert^2 / 2\sigma_i^2)}{\sum_{k \neq i} \exp(-\lVert\mathbf{x}_i - \mathbf{x}_k\rVert^2 / 2\sigma_i^2)}$$

where $\sigma_i$ is the variance of the Gaussian which is centred on datapoint $x_i$.

Therefore, the closer the datapoints are, the $p_{j\mid i}$ is higher. And for the distantly separated datapoints, the $p_{j\mid i}$ will be close to zero.

t-Distributed Stochastic Neighbor Embedding optimised SNE by using a symmetrized SNE cost function with simpler gradients, and utilising the Student-t distribution instead of the Gaussian to compute the conditional probability between datapoints. These modifications enable a more successful visualisation on large datasets with less computational power. This technique can be used to illustrate how neural networks extract features in high-dimensional vectors, and visualise the similarity of the input data in 2-dimensional vectors.

t-SNE are used to explore how the neural network models interpret the emotions. Facial expression images were randomly selected from the database. t-SNE-Visualization [@tsne-visualization] package helps visualising the result. Facial images in database were fed into the CNN. High-dimensional features were extracted by convolutional layers and max pooling layers. t-SNE algorithm uses the high-dimensional features to embed the images into two dimensions. t-SNE calculates the conditional possibility that two features are similar, and visualise the distance between two features in 2 dimensions. Facial expressions being adjacent to each other in Figure \[fig:tsne1\] means that they are also close in the neural network representation space, hence, the neural network regards them as being alike.

It can be seen in Figure \[fig:tsne1\] that, the deep neural networks not only sees the images from the same person alike, but also sees the images with similar facial expressions or emotions as being similar. For example, happiness is closer to happiness and angry is closer to angry on the grid. In other words, t-SNE arranges images that have similar emotion features nearby after the embedding process.

To further explore how the neural networks interpret the emotion and facial features in high dimensions, only one face was randomly selected from each video in the database. Feature extraction and t-SNE algorithm is applied to visualise the how neural network interpret facial features.

In Figure \[fig:tsne2\] we can see that, even only fed one face from each video, the embedded 2 dimensions can still illustrate the pattern that similar facial expression are closer.

Different pictures were randomly selected to test the interpretability of the architectures. More examples can be found in Figure \[fig:tsne\_merge\].

The result of t-SNE also implies that, there might exist a high-dimensional emotion representation E, which emotion categories and valence & arousal are its respective mapping into one dimension and two dimensions. Mathematically, the mapping can be defined as:

$$emotion cateogry = f(E)$$

$$valance \& arousal = g(E)$$

The relationship of categorical representation and dimensional representation could be investigated through discovering this high-dimensional emotion representation.

### Activation Maximisation {#activation-maximisation .unnumbered}

Another technique attempted to discover the interpretability of the neural networks and what exactly neural networks learned is Activation Maximisation.

The Activation Maximisation was proposed by Dumitru Erhan et al. [@erhan2009visualizing]. The idea is to generate images that can maximumly activate the neurons for the layer. This allows the researcher to understand what data can activate particular layers, for example, CNN filters or categorical fully connected layers. Therefore, the researcher can better understand the function that is learned by the deep neural network.

To generate the Activation Maximisation images, the algorithm updates the synthesized photo by calculating the gradients to maximise the activation. Mathematically,

$$\frac{\partial Activation Maximisation Loss}{\partial Input Data}$$

determines how to update the generated image.

Figure \[fig:imagenet\] visualises images that can maximumly activate the last fully connected layers for some categories in VGG16 trained on ImageNet database. It can be observed that some category features are humanly understandable.

Keras-vis [@raghakotkerasvis] toolkit is utilised to visualise the images that can activate the fully connected layers for seven emotions.

Figure  \[fig:maxact\] illustrates the images that can maximumly activate the last fully connected layers for categorical emotion recognition model. Although no specific features that the neural networks learned are particularly human-understandable, some categories such as neutral and sadness that can be better recognised in evaluation show more learned features. This technique can be applied to other models in the future to investigate the interpretability and reliability of emotion recognition models.

Conclusion and Future Work
==========================

This chapter summarises the contributions developed in this project. Several methods are provided for future work.

Contribution
------------

55 videos with 59 characters have been annotated with emotion categories. 107,640 frames of facial expressions with both emotion categories and valence & arousal values have been made into the database for emotion recognition learning.

Different pre-trained CNN models and architectures have been attempted in building categorical-only models, dimensional-only models and combined models. Extensive experiments were carried out to optimise the performance and hyper-parameters.

The best classification accuracy increased by 25% in the combined model compared to training with only emotion categories. While there is no obvious difference for performance of dimensional representation in different models.

The inner-relationship of emotion categories and valence & arousal expression have been analysed. It is inferred that the extra information from mapping is the reason to explain the increased performance for categorical emotion prediction.

Two techniques, t-SNE and Activation Maximisation have been carried out to explore the interpretability of emotion recognition neural networks. Visualisations were used to interpret what the networks actually learned.

Future work
-----------

One limitation of this project is the database used is relatively small, and the emotions categories and valence & arousal values are imbalanced. Emotion neutral and sadness occupies more than 80% and the database. Negative arousal values are limited.

This leads to many problems, including:

1.  It is hard to adjust the training, validation and testing set to have the very close annotation distributions.

2.  The predictions of different emotion categories vary a lot.

3.  The evaluation of valence and arousal values on the validation set is not as good as on the training set. The model did not generalise well on the validation set.

Several methods can solve this problem. First, more videos could be included in the future. Especially for videos with emotion happiness, anger, fear, surprise and disgust. Also, more videos having negative arousals could be added.

Another way to alleviate those problems is to carry out data augmentation. For emotions and dimensional values that are under-represented, we can add duplicates to the databases. Many methods [@kollias8; @kollias9] can generate duplicates of samples, for example, shifting, distorting, rotating and zooming in/out.

Generating synthetic samples is another good attempt to balance the database. Instead of adding duplicates, it is to generate artificial samples using more complicated algorithms. Generative Adversarial Networks can be utilised in the future for this project.

### Generative Adversarial Networks

The Generative Adversarial Networks are deep neural network architectures that consist of two adversarial models, which is generative and discriminative respectively. The generator takes in random noise [@raftopoulos2018beneficial] and gives ’fake’ output. The discriminator will be fed with both real dataset and generated output from the generative model. The generator aims to produce output as ’real’ as the true dataset. Meanwhile, the goal of the discriminator is to decide if its input belongs to the actual training dataset or not [@goodfellow2014generative] [@nicholson_gibson].

A graph of the principle of Generative Adversarial Networks can be seen in Figure  \[fig:gan\].

The generative model can be utilised to generate images to fulfil the data augmentation. Also, the prediction of the emotion category from the discriminative model can be researched. Jost Tobias Springenberg reported that by applying semi-supervised learning using GANs, image classification result is competitive and the generated images are of high visual fidelity [@DBLP:journals/corr/Springenberg15].

Ethics Checklist
================

[ |p[13.2cm]{}|p[0.6cm]{}|p[0.6cm]{}| ]{} & **Yes & **No\
****

\

Does your project involve Human Embryonic Stem Cells? & &\

Does your project involve the use of human embryos? & &\

Does your project involve the use of human foetal tissues / cells? & &\

\

Does your project involve human participants? & &\

\

Does your project involve human cells or tissues? (Other than from “Human Embryos/Foetuses” i.e. Section 1)? & &\

\

Does your project involve personal data collection and/or processing? & &\

Does it involve the collection and/or processing of sensitive personal data (e.g. health, sexual lifestyle, ethnicity, political opinion, religious or philosophical conviction)? & &\

Does it involve processing of genetic information? & &\

Does it involve tracking or observation of participants? It should be noted that this issue is not limited to surveillance or localization data. It also applies to Wan data such as IP address, MACs, cookies etc. & &\

Does your project involve further processing of previously collected personal data (secondary use)? For example Does your project involve merging existing data sets? & &\

\

Does your project involve animals? & &\

\

Does your project involve developing countries? & &\

If your project involves low and/or lower-middle income countries, are any benefit-sharing actions planned? & &\

Could the situation in the country put the individuals taking part in the project at risk? & &\

\

Does your project involve the use of elements that may cause harm to the environment, animals or plants? & &\

Does your project deal with endangered fauna and/or flora /protected areas? & &\

Does your project involve the use of elements that may cause harm to humans, including project staff? & &\

Does your project involve other harmful materials or equipment, e.g. high-powered laser systems? & &\

\

Does your project have the potential for military applications? & &\

Does your project have an exclusive civilian application focus? & &\

Will your project use or produce goods or information that will require export licenses in accordance with legislation on dual use items? & &\

Does your project affect current standards in military ethics – e.g., global ban on weapons of mass destruction, issues of proportionality, discrimination of combatants and accountability in drone and autonomous robotics developments, incendiary or laser weapons? & &\

\

Does your project have the potential for malevolent/criminal/terrorist abuse? & &\

Does your project involve information on/or the use of biological-, chemical-, nuclear/radiological-security sensitive materials and explosives, and means of their delivery? & &\

Does your project involve the development of technologies or the creation of information that could have severe negative impacts on human rights standards (e.g. privacy, stigmatization, discrimination), if misapplied? & &\

Does your project have the potential for terrorist or criminal abuse e.g. infrastructural vulnerability studies, cybersecurity related project? & &\

\

Will your project use or produce software for which there are copyright licensing implications? & &\

Will your project use or produce goods or information for which there are data protection, or other legal implications? & &\

\

Are there any other ethics issues that should be taken into consideration? & &\

Ethical and Professional Considerations
=======================================

This project is about emotion recognition. It does not involve human embryos/cells and animals. Developing countries are not involved. It does not include elements that may cause harm to the environment. It has not been found that this project has the potential for dual use/military application and misuse issues.

Areas that may have ethical issues are the video data collection and the involved human beings. For the videos researched in this project, the collection has been conducted under the scrutiny and approval of the Imperial College Ethical Committee (ICREC). Most of the videos were under Creative Commons License (CCL). For some videos which were not under Creative Commons License (CCL), producer or the person who is in the video have been contacted. Permissions to use the video for this research have been granted. There are not other legal and ethical issues.

Evaluation
==========

Evaluation of the Models on Training Set
----------------------------------------

### Category-only Models {#category-only-models-1 .unnumbered}

  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------
                    Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust   Total
   VGG16+LSTM+1FC    0.52     0.00    0.98   0.00    0.00     0.00      0.00     0.52
   VGG16+LSTM+2FC    0.90     0.00    0.97   0.55    0.56     0.00      0.71     0.78
   Xcep+LSTM+1FC     0.44     0.00    0.77   0.01    0.00     0.00      0.00     0.42
   Xcep+LSTM+2FC     0.58     0.00    0.70   0.06    0.00     0.00      0.00     0.44
   VGG19+LSTM+1FC    0.43     0.00    0.97   0.01    0.00     0.00      0.00     0.49
   VGG19+LSTM+2FC    0.78     0.00    0.78   0.00    0.00     0.00      0.00     0.53
  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------

  : Accuracies obtained on training set by various CNN-RNN architectures for categorical-only models[]{data-label="table:cate_res_train"}

### Dimension-only Models {#dimension-only-models .unnumbered}

  ----------------- --------- --------- --------- ---------
                     Valence   Arousal   Valence   Arousal
   VGG16+LSTM+1FC     0.86      0.76      0.07      0.04
   VGG16+LSTM+2FC     0.83      0.66      0.08      0.05
    Xcep+LSTM+1FC     0.03      0.05      0.31      0.11
    Xcep+LSTM+2FC     0.01      0.01      0.29      0.10
   VGG19+LSTM+1FC     0.73      0.60      0.11      0.06
   VGG19+LSTM +2FC    0.87      0.72      0.07      0.04
  ----------------- --------- --------- --------- ---------

  : CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in dimensional-only models on training set[]{data-label="table:va_train"}

### Combined Models Emotion Category Output {#combined-models-emotion-category-output .unnumbered}

  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------
                    Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust   Total
   VGG16+LSTM+1FC    0.89     0.00    0.97   0.64    0.57     0.33      0.67     0.80
   VGG16+LSTM+3FC    0.91     0.00    0.99   0.50    0.41     0.00      0.23     0.75
   Xcep+LSTM+2FC     0.59     0.00    0.81   0.02    0.01     0.00      0.00     0.48
   Xcep+LSTM+3FC     0.28     0.00    0.79   0.02    0.01     0.00      0.00     0.38
   VGG19+LSTM+1FC    0.91     0.00    0.97   0.68    0.80     0.65      0.71     0.84
   VGG19+LSTM+2FC    0.94     0.01    0.98   0.61    0.78     0.14      0.73     0.82
  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------

  : Accuracies obtained on training set by various CNN-RNN architectures for combined models[]{data-label="table:combined_cate_train"}

### Combined Models Valence & Arousal Output {#combined-models-valence-arousal-output .unnumbered}

  ---------------- --------- --------- --------- ---------
                    Valence   Arousal   Valence   Arousal
   VGG16+LSTM+1FC    0.78      0.68      0.11      0.05
   VGG16+LSTM+3FC    0.74      0.57      0.11      0.06
   Xcep+LSTM+2FC     0.11      0.11      0.27      0.09
   Xcep+LSTM+3FC     0.07      0.07      0.27      0.09
   VGG19+LSTM+1FC    0.83      0.71      0.09      0.05
   VGG19+LSTM+2FC    0.80      0.67      0.10      0.05
  ---------------- --------- --------- --------- ---------

  : CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in combined models on training set[]{data-label="table:combined_va_train"}

Evaluation of the Models on Testing Set
---------------------------------------

### Category-only Models {#category-only-models-2 .unnumbered}

  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------
                    Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust   Total
   VGG16+LSTM+1FC    0.05     0.00    0.96   0.00    0.00     0.00      0.00     0.27
   VGG16+LSTM+2FC    0.24     0.00    0.77   0.07    0.00     0.00      0.15     0.32
   Xcep+LSTM+1FC     0.07     0.00    0.52   0.00    0.00     0.00      0.00     0.17
   Xcep+LSTM+2FC     0.41     0.00    0.76   0.00    0.00     0.00      0.00     0.37
   VGG19+LSTM+1FC    0.09     0.00    1.00   0.00    0.00     0.00      0.00     0.30
   VGG19+LSTM+2FC    0.72     0.00    0.87   0.00    0.00     0.00      0.00     0.52
  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------

  : Accuracies obtained on testing set by various CNN-RNN architectures for categorical-only models[]{data-label="table:cate_res_test"}

### Dimension-only Models {#dimension-only-models-1 .unnumbered}

  ----------------- --------- --------- --------- ---------
                     Valence   Arousal   Valence   Arousal
   VGG16+LSTM+1FC     0.04      0.03      0.46      0.18
   VGG16+LSTM+2FC     0.01      -0.09     0.43      0.15
    Xcep+LSTM+1FC     0.02      0.06      0.29      0.10
    Xcep+LSTM+2FC     0.00      0.01      0.32      0.10
   VGG19+LSTM+1FC     -0.05     -0.01     0.58      0.20
   VGG19+LSTM +2FC    -0.05     0.01      0.43      0.13
  ----------------- --------- --------- --------- ---------

  : CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in dimensional-only models on testing set[]{data-label="table:va_test"}

### Combined Models Emotion Category Output {#combined-models-emotion-category-output-1 .unnumbered}

  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------
                    Neutral   Happy   Sad    Angry   Fear   Surprise   Disgust   Total
   VGG16+LSTM+1FC    0.18     0.00    0.62   0.01    0.00     0.00      0.06     0.24
   VGG16+LSTM+3FC    0.12     0.00    0.81   0.00    0.00     0.00      0.00     0.26
   Xcep+LSTM+2FC     0.14     0.00    0.84   0.00    0.00     0.00      0.00     0.28
   Xcep+LSTM+3FC     0.15     0.00    0.72   0.00    0.00     0.00      0.00     0.25
   VGG19+LSTM+1FC    0.13     0.00    0.86   0.02    0.00     0.00      0.06     0.29
   VGG19+LSTM+2FC    0.09     0.00    0.74   0.19    0.13     0.00      0.05     0.25
  ---------------- --------- ------- ------ ------- ------ ---------- --------- -------

  : Accuracies obtained on testing set by various CNN-RNN architectures for combined models[]{data-label="table:combined_cate_test"}

### Combined Models Valence & Arousal Output {#combined-models-valence-arousal-output-1 .unnumbered}

  ---------------- --------- --------- --------- ---------
                    Valence   Arousal   Valence   Arousal
   VGG16+LSTM+1FC    -0.03     0.02      0.63      0.27
   VGG16+LSTM+3FC    -0.06     -0.15     0.55      0.20
   Xcep+LSTM+2FC     0.02      0.07      0.36      0.12
   Xcep+LSTM+3FC     -0.05     0.03      0.39      0.12
   VGG19+LSTM+1FC    -0.05     0.05      0.54      0.26
   VGG19+LSTM+2FC    -0.12     -0.02     0.59      0.18
  ---------------- --------- --------- --------- ---------

  : CCC and MSE evaluation of valence & arousal predictions reached by the CNN-RNN architectures in combined models on testing set[]{data-label="table:combined_va_test"}
