## 3 Materials and Methods
### Research Methodology
#### 3.2.2 Methodological Framework  
This research aims to implement an RGB-CNN model as a promising method in nuclear medical image analysis to classify CAD images into infarction, ischemia and normal, and to provide an autonomous computer-aided system to nuclear medicine experts through the application of Grad-CAM. To explore the development of an explainable AI model in nuclear cardiology for CAD diagnosis utilizing SPECT MPI images, we applied Grad-CAM to an efficient and robust, fully trained CNN model. Grad-CAM has shown critical capabilities concerning the interpretability of neural networks since they are constantly characterized as black box models because of their complex internal functionality. An overview of the experiment can be found in Figure 2.  
The methodological flow includes the following parts: (i) loading the dataset; (ii) data pre-processing; (iii) CNN model design and evaluation; and (iv) Grad-CAM application. The steps are as follows:  
**Step 1: Loading dataset**  
The SPECT MPI images given by the nuclear expert (N.P.) were in RGB (red, green, and blue) format, and the corresponding patients underwent a stress and rest examination. Each instance was classified as infarction, ischemia, or normal, being assigned with 0, 1, and 2, respectively. The final dataset was stored locally in a PC memory. The employed SPECT image acquisition technology produced 22-27 64 \(\times\) 64 images that illustrated axial views of the myocardial region (slices). All the available slices per patient have been combined, generating a single image of 300 \(\times\) 300 size. **Step 2: Data preparation**  
* Data normalization: Data normalization is a common technique in ML classification tasks. This method rescales pixel values by transforming them to the range [0, 1]. This process contributes to the discard of outliers and the effective reduction of computation time. * Data shuffle: Before inserting into the algorithm, data has to be shuffled so that the extraction of patterns is as unbiased as possible. Therefore, the data shuffle technique was deployed to provide a random order of data insertion. * Data split: We split the dataset into three parts: validation, training, and testing. More specifically, 15% of the entire dataset was given to testing and the remaining 85% was split into 20% for validation and 80% for training. **Step 3: Training**  
* Data augmentation: Data augmentation is usually employed to increase the small number of datasets. It artificially generates various versions of the existing dataset, utilizing specific data augmentation techniques. In our case, we selected flipping and scaling strategies to achieve generalization and avoid overfitting [33]. Figure 2: Detailed explainability approach using Grad-CAM for CAD classification. * Define CNN architecture and activation functions: A detailed analysis was conducted to determine the best CNN architecture. During the experimentation, various values were applied for image size (pixels), batch size, number of nodes and layers for convolutional layers, and number of nodes for fully connected layers. The selection of the activation function is highly crucial since it corresponds to the type of classification problem. For example, the sigmoid function is proposed in binary classification problems, extracting values between 0 and 1 based on a default threshold that categorizes images. On the other hand, softmax is applied in multi-class classification problems, providing probabilities for each possible output, the sum of which is equal to 1 [33,34]
* Train CNN: In the training process, the gradient backward propagation technique was utilized to find the minimized error by adjusting the weights. In this process, CNN also extracted patterns from input images, which will be used in future classification tasks with unknown data. Furthermore, the loss function and the optimizer must be selected for training the CNN. **Step 4: Validation**  
In the validation step, the validation dataset evaluates CNN in known data.