## 3 Methodology
### Continuous Wavelet Transform  
The continuous wavelet transform (CWT) converts a signal from the time domain into the time-frequency domain. Unlike the Fourier Transform, which lacks time localization and performs poorly with non-stationary signals such as EEG, the CWT addresses these limitations by producing wavelet coefficients. These coefficients can be used to determine the amplitude or power of the signal's frequencies. Mathematically, the CWT involves convolving the signal of interest (in this case, the EEG signal) with a wavelet kernel over several frequencies [54]. In this project, the analytic Morse wavelet is used, with a symmetry parameter (gamma) equal to 3 and a time-bandwidth product of 60. This wavelet was chosen because it has been shown to produce excellent results with the current EEG dataset, as demonstrated in [17]. The CWT generates time-frequency plots known as scalograms (Figure 10), which can be utilized with convolutional neural networks (CNNs) such as GoogLeNet for further analysis. The time projections obtained from CSP filters are transformed by CWT to generate grayscale scalograms. The three scalograms corresponding to the first and second classes are taken as individual RGB channels, which are flattened to form two RGB scalograms, one for each class. These are passed into GoogLeNet for classification between the first and the second classes. The RGB conversion is necessary since GoogLeNet only accepts images with three color channels, and the information from three projections can be gathered into one object. The CSP-CWT procedure can be seen in Figure 11.  
Transfer learning is used with this pretrained network to reduce the computation cost and time. Only the last two layers (fully connected layer and softmax layer) are modified during the transfer learning. An 80:20 ratio is used for splitting the training set and test set from the scalogram image set. Images are resized to 244 \(\times\) 244 \(\times\) 3 since this is the required dimension of the input images when using GoogLeNet. During training, the weights of the first 10 layers are frozen. A mini-batch size of five is used with 10-30 epochs to train each class. The learning rate is set to 0.0003. Figure 9: CSP Filtering. This model, shown in Figure 12, is based on the baseline model but is extended in the classification step to transform the baseline model into a four-way classifier. However, since CSP is restricted to 4.5. ML Model 1 binary pairs/classification, the conventional way of using the SoftMax layer to perform four-way classification does not work. This results in the complicated procedure of using comparators to perform the four-way classification (See Figure 9 for the pipeline). The model is shown in Figure 13, where the inputs are taken from the pre-processed slice data in the form of 'One Vs. Others', with one pitted against a group of other actions for training. The amount of data for one action is set to be the same as the amount of data for the other group. The model is also to be tested in cases where the amount of data is not the same. Four pairs of such groups (FWvsOthers, GPvsOthers, RLvsOthers), and RVvsOthers) are collected for the training set and passed into the four ML networks, one for each pair. In the classification step, a group of datasets collected from FW, GP, RL, and RV are used to create the test set for the model (See Figure 14). The classification step is the same as the one in ML Model 2. Figure 11: Generation of RGB scalograms from the time projections to be used with GoogLeNet. Figure 10: An example of a scalogram. The frequency axis starts from 7 at the bottom and increases to 30 Hz at the top. The color of the scalogram shows the power of the corresponding frequencies. Figure 14: Creation of Training and Test Sets. Figure 12: Layers of GoogLeNet as displayed by the MATLAB network analyzer. The last 3 layers (shown in red) are the replaced layers for transfer learning.