## 2 Materials and Methods
### Proposed Method for AD Diagnosis  
Figure 2 presents the general deep-learning workflow, where the first step is to choose the datasets for training and validation. Then, the selection of the hyper-parameters for the neural network model follows. In the third step, the choice of the CNN model and framework is determined by the related parameters, including the loss rate, learning function, and optimizer. The fourth step is the training and validation phase of the model. The fifth step is the testing and prediction phase using new input datasets. The final step is the assessment of the performance of the model. Figure 1: **(A)** Magnetic resonance imaging (MRI) images (2D) from the KACD dataset with four of [PERSON]’s dementia’s stages. (**B**) The images highlight major regions of healthy brain (**left**) and an [PERSON]’s brain (**right**), as indicated in yellow. Figure 2: Deep-learning workflow. Figure 3 presents the proposed approach for the classification of the AD images. The AD dataset is pre-processed first using pre-processing techniques, including skull removal and spatial registration, then another processing phase, including histogram equalization, slicing, and image resizing, followed by low-pass alpha-trimmed filtering. Skull removal is used to remove bones from the image. Histogram equalization is the normalization process of the gray levels in the images from various subjects and maps the pixel intensity values to a wide range. In order to reduce the impact of orientation and spatial differences among scanner users, registration is performed. Registration improves the precision of the classification. The MNI152 brain template [40] was used by averaging 152 structural pictures into a single high-resolution image using non-linear registration. Slicing divides the image into multiple logical images. Resizing is carried out in order to get the desired image size (224 \(\times\) 224). Filtering improves the quality of the images by removing noise and artifacts. An alpha-trimmed filter was used to filter images from noise and artifacts. It first ranked the values of pixels in the neighbor window (5 \(\times\) 5 pixels) centered on the pixel under processing. It ranks the pixels from the smallest to the biggest, eliminates the extremities according to the dimension of the parameter 'd' (Equation (1)), and then calculates the average of the remaining pixels. The resultant average will be placed at the same location (x,y) as the central pixel under processing in a new image. The alpha-trimmed filter equation is  
\[\text{F(x,y)}=(1/(\text{mn}-\text{d}))\sum\text{gr(s,t)}, \tag{1}\]  
where  
F(x,y): F represents the filtered image, and x,y are the coordinate of the pixel processed. gr is the set of pixels left after excluding the d/2 extreme pixels. mn is the dimensions of the filter. d represents the number of pixels that will be excluded from the averaging. Figure 3: Proposed DL (PDL)-based classification approach. (s,t) represents the set of coordinates of the remaining pixels. In our implementation, the filter dimensions' mm is 5 \(\times\) 5, and d was set to 8. It means that we exclude 8 pixels out of 25, 4 from the beginning and 4 from the end of the ranked values of the pixels. Then, the pre-processed data are fed as input to the DLS model using CNN model that performs feature extraction and classification of the input data. Finally, the model is evaluated using performance metrics such as F1 score, area under curve (AUC), recall, and precision. Due to the small dataset, training big convolutional neural networks (CNNs) from the beginning proved difficult. Neural networks need a lot of data to train well, which may not be available. Instead of starting from scratch, using an existing model for a comparable job can save training time and improve outcomes [41]. CNN structure is presented in Figure 4.  
As stated in reference [4], transfer learning facilitates accelerated training and compensates for the limited data set.