## 3 Experiment Setup
### CNN-AM Training  
To perform CNN-AM training, an important preliminary step is normalization of the images, performed during the transformation of ECG signals into images. This step is important due to the extensive variation in pixel intensity and color distribution in the images, which are factors that can result in challenges during the training phase, such as slow convergence and model instability. In addition to promoting stability during training, normalization reduces the sensitivity of multimodal convolutional layers to small fluctuations in pixel values, improving the model's ability to generalize to data not seen during training. The normalization adopted in this study includes two distinct steps. Initially, various resolutions and pixel densities were explored, and, regardless of the time series sample size, the resulting images should maintain a square shape with custom dimensions. Among the resolutions commonly found in the literature, such as 64 \(\times\) 64, 224 \(\times\) 224 and 227 \(\times\) 227 pixels, we chose to adopt the approach of [39], derived from the AlexNet network, which uses images of 224 \(\times\) 224 pixels and 300 dpi. This size was chosen because it offers a resolution that does not hide crucial details between the classes while avoiding excessive robustness and high hardware requirements. The next step involved calculating the mean and standard deviation (std) of each channel for the images (three for RGB and one for grayscale). The reason for using the mean and std of the images for normalization was to adjust the scale of the pixel values of the images so that they are close to a normal (Gaussian) distribution with a mean of zero and a standard deviation of one, forcing the pixel values into a narrower range, which may provide more stable gradient propagation and faster convergence during training [55; 56]. The identification of these normalization parameters was performed with images from the training database, and, with the parameters identified, the images in both the training and test databases were normalized. All components of the proposed CNN-AM were implemented in Python 3.9.15 using the PyTorch 1.12 and CUDA 11.6 libraries. The hardware setup included an Intel Core i7 12 th-generation processor with 14 cores, operating at 4.7 GHz with 32 GB of RAMand 4800 MHz, and a NVIDIA GeForce RTX 3070 Ti GPU with 8 GB of GDDR6 memory. Additionally, a Google Colab Pro+ environment was implemented. During the experiments, an Intel Xeon 12-core 2.2 GHz processor with 83 GB of RAM and a 40 GB NVIDIA A100 GPU was used for configuration. During the training phase, the minimized cost function was based on the hinge loss, which was introduced by [57] and adapted by [58] for multiclass classification as follows:  
\[Hinge\ Loss=max\big{(}0,1-\hat{y}_{y}+\max_{i\
eq y}(\hat{y}_{i})\big{)} \tag{13}\]  
where \(y\in 0,1,2\) is the desired output for the 3-class case, \(\hat{y}\in\mathbb{R}^{3}\) is the expected output per class, \(\hat{y}_{y}\) refers to elements that are of class y and \(\max_{i\
eq y}(\hat{y}_{i})\) refers to the maximum value of the elements of \(\hat{y}\) that are not of class y. The hinge loss is commonly used in binary classification problems, especially in linear machine learning contexts, such as in support vector machines (SVMs). The main idea is to penalize incorrect model predictions, where the penalty increases as the distance between the correct prediction and the model prediction increases. The loss is zero when the model prediction is correct and positive when the model prediction is incorrect. For our case, which is a multiclass problem (three classes), the MulticlassHingeLoss function from the TorchMetrics library, which is the hinge loss function adapted for the case of multiple classes, was used.