# Gaze Tracking Using an Unmodified Web Camera and Convolutional Neural Network
## 3 Materials and Methods
### Network Architecture of the Tested Models  
This section presents a description of three designed models, each of which takes a different set of input images. Each of the designed network architectures has fixed elements implemented: the output layer activation functions used, the hidden layer activation functions, the weight initialization strategy, and the loss function. The presented architectures are already refined models, which are the final ones that emerged after multiple tests of different parameters.  
The output of each network is a vector of 20 values. Every value represents a probability that the input images are registered when a person looked at a given area in the 5 by 4 grid of 20 areas.  
Every network consists of three kinds of components:  
* Convolutional layer (Convolution): The layer's input is an image with some number of channels, and the layer creates another image with the number of layers equal to the number of filters. The number and the size of filters used to convert the image are two parameters of such layer;
* Pooling Layer (Subsampling): The layer's input is an image, and the output is the image reduced in both dimensions. Only Max Pooling layers were used, which reduced the image by representing the area of a given size by one pixel, which is the brightest. There is only one parameter for this layer--the size of the reduction. Only two sizes, 2 \(\times\) 2 and 3 \(\times\) 3, were used;
* Fully connected layer (FC): It is a classic neural network's layer that consists of some number of neurons, and every neuron received a weighted combination of all input values.  
ADAM optimizer [45] was used to train the CNN network with the initial value of the learning rate set to a value equal to 0.00015. The Rectified Linear Unit (ReLU) [46] was used as the hidden layer activation function. Xavier initialization [47] was used as the initialization strategy for weights, while the output layer used an activation function in the form of a normalized Softmax exponential function (see Equation (1)):  
\[\sigma(y_{i})=\frac{e^{y_{i}}}{\sum_{j=1}^{K}e^{y_{j}}} \tag{1}\]  
Figure 4: An example of an extra element incorrectly detected as an eye by the classifier.  
Figure 3: An example of blink eye images for the point (1 and 3).  
where \(y_{i}\) represents the output from the network, and \(K=20\) is the number of classes.  
Negative Log-Likelihood (NLL) was taken as the loss function, which works well with the Softmax activation function for solving multi-class neural network learning and image classification problems considering a set of pixels as input. Equation (2) represents the mathematical formula for the NLL function:  
\[l(\theta)=-\sum_{n=1}^{M}(Ylog(\sigma(\theta^{T}X))+(1-Y)log(1-\sigma(\theta^{ T}X)) \tag{2}\]  
where \(\theta\) is the parameter of the function, \(Y\) denotes the output values, \(X\) represents the features of the image, and \(M\) is the number of samples.  
An identical naming convention for the neural network layers was adopted for each experiment. The LRE symbol designation refers to layers using the right eye images, the LLE symbol refers to layers describing the left eye, and LF refers to layers pertaining to face images. The _Convolution_ layers always have information about the size of the filter, and the numbers of filters are provided in the text or tables. The _Subsampling_ layers have information about the reduction size. The number of neurons for each _Full Connected_ layer is explained in the corresponding text. The FC symbol indicates fully connected layers where, for example, FC-RE refers to the fully connected layer for the right eye.