# Low Complexity Deep Learning Framework for Greek Orthodox Church Hymns Classification
## 2 Materials and Methods
### Data Processing
#### 2.2.2 Data Processing and Augmentation  
The initial dataset consists of 23 classes and 4820 performances. Various data processing augmentation techniques were employed to increase the number of inputs for the DL models. More specifically, the images are resized in a 64 \(\times\) 64 format for computational cost reduction purposes, while the pixel values are normalized.  
Figure 1: Boxplot for each hymn of our dataset.  
There are many data augmentation techniques for CV problems, such as random cropping, image rotation, image blurring with a Gaussian filter, etc. A recently introduced data augmentation method is the TriviaAugment (TA) algorithm [32]. TA works as follows. Let \(\mathcal{X}\) be an image from our dataset and \(\mathcal{T}\) be a set of augmentations. An augmentation is mathematically defined as a function  
\[f:\mathcal{D}\times\mathbb{Z}^{+}\rightarrow\mathcal{A} \tag{2}\]  
Here, \(\mathcal{D}\) refers to the image dataset, \(\mathcal{A}\) represents the set of the augmented images and a discrete strength parameter is defined in \(\mathbb{Z}^{+}\).  
TA takes as input an image \(\mathcal{X}\) and the set \(\mathcal{T}\). In the next step, TA samples uniformly at random an augmentation mapping from \(\mathcal{T}\) and applies it to the given image \(\mathcal{X}\), assigning a strength value \(s\) and returns the augmented image. The whole procedure is depicted in Algorithm 1.  
```
Dataset \(\mathcal{D}\) with M images while\(m\leq M\)do  Pick an image \(\mathcal{X}\in\mathcal{D}\)  Sample augmentation f from \(\mathcal{T}\)  Sample a strength value \(s\)  Return \(f(\mathcal{X},s)\) endwhile
```  
**Algorithm 1** TA algorithm  
Another popular data augmentation technique that is employed in our work is the MixUp augmentation [33]. Given two images from the available data selected randomly, MixUp generates a weighted combination of them. Mathematically, this process is formulated as follows: If \((\mathbf{x}_{1},y_{1})\) and \((\mathbf{x}_{2},y_{2})\) is the chosen image pair, the synthetic image is generated as  
Figure 2: Examples of four different Mel-spectrograms from our private dataset.  
\[\hat{\mathbf{x}} =w\mathbf{x}_{1}+(1-w)\mathbf{x}_{2} \tag{3}\] \[\hat{y} =wy_{1}+(1-w)y_{2}\]  
The weight coefficient \(w\sim\)Beta(a = 0.2) is independently sampled.  
Finally, a third data augmentation method, namely SpecAugment [34] is utilized. SpecAugment consists of three augmentation policies:  
* Time warping: From a uniform distribution with range \([-D,D]\), a starting point \(d_{0}\) and a displacement coefficient \(d\) are sampled. A linear warping function \(\mathcal{D}(t)\) is defined, such that the point \(d_{0}\) is mapped to the point \(d_{0}+d\). Time warping is defined in such a way that the warped features at time t are related to the original features by the following equation: \[\mathbf{x}_{warp}(\mathcal{D}(t))=\mathbf{x}_{orig}\] (4)
* Frequency masking: Given a uniform distribution with a range from 0 to \(\mathcal{F}\), a mask of size \(f\) is randomly chosen. Then, a value \(f_{0}\) is chosen from the interval \([0,f_{0}-f]\) and the consecutive log-Mel frequency channels \([f_{0},f_{0}+f)\) are masked.
* Time masking: Given a uniform distribution with a range from 0 to \(\mathcal{T}\), a mask size \(\tau\) is randomly chosen. Then, a value \(\tau_{0}\) is chosen from the interval \([0,\tau_{0}-\tau]\) and the consecutive time steps \([\tau_{0},\tau_{0}+\tau)\) are masked.  
The SpecAugment policy consists of applying these three augmentation methods a fixed number of times [34].  
After applying these three data augmentation techniques to our dataset, the number of samples increased to 19,280 images.