# Patient-Tailored Dementia Diagnosis with CNN-Based Brain MRI Classification
## 2 Materials and Methods
### CNN-Based Models for Diagnostic Support of Dementia
#### 2.2.4 Analysis of the Training and Validation  
The metrics chosen to evaluate the models' performance during training and validation included accuracy and loss. These values were calculated for each epoch.  
All CNN-based models demonstrated high accuracy, with the independently developed ones achieving values of over 90% and the TL-based models exceeding 95%, as depicted in Figure 2. These high rates indicate that all the models were well suited for the classification task and input data, yielding generally correct predictions, both during training and validation.  
The accuracy curves exhibited an exponential-like growth. In some cases, the value of validation accuracy exceeded training accuracy. This was due to the data preparation process, as the training batch underwent augmentation while the validation batch remained as it was originally. The epochs at which the highest accuracy values were achieved are marked with a green dot.  
A clear difference was observed between the independently developed and TL-based models. The first group reached peak accuracy much later than the second. Furthermore, models with more layers and deeper structures exhibited smoother and less erratic accuracy curves.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **No. of Layers with Parameters (Depth)** & **General Characteristics** \\ \hline \multirow{3}{*}{ResNet50-based} & \multirow{3}{*}{107} & Total params: 26,079,747 (99.49 MB) \\  & & Trainable params: 23,328,643 (88.99 MB) \\  & & Non-trainable params: 2,751,104 (10.49 MB) \\  & & Total params: 23,353,515 (89.09 MB) \\ Xception-based & 81 & Trainable params: 17,350,043 (66.19 MB) \\  & & Non-trainable params: 6,003,472 (22.90 MB) \\  & & Total params: 4,541,251 (17.32 MB) \\ MobileNet-based & 55 & Trainable params: 4,249,987 (16.21 MB) \\  & & Non-trainable params: 291,264 (1.11 MB) \\  & & Total params: 15,437,251 (58.89 MB) \\ VGG16-based & 16 & Trainable params: 13,701,507 (52.27 MB) \\  & & Non-trainable params: 1,735,744 (6.62 MB) \\ \hline \hline \end{tabular}
\end{table}
Table 3: Overview of the structure and characteristics of the TL-based models.  
The loss curves plotted using loss function values over subsequent epochs during training and validation showed a logarithmic-like decrease, as shown in Figure 3. Independently developed models achieved loss values of around 0.3, and TL-based models reached values below 0.2. Such low values suggest that all models made more correct predictions than incorrect ones and did not overfit the data.  
Notably, the curves did not increase again after stabilizing, indicating that the models retained their generalization ability. Models with more layers and complex, deeper structures exhibited smoother and less erratic loss curves.  
The epochs at which the lowest loss values were achieved are marked with a green dot. A notable difference was observed between the independently developed models and TI-based ones; the former reached their lowest loss values much later than the latter.  
Figure 2: Selected plots depicting accuracy values achieved by the CNN-based models during training and validation: (**a**) Accuracy values achieved by Custom CNN 128 model; (**b**) Accuracy values achieved by Custom CNN 1024 model; (**c**) Accuracy values achieved by ResNet50-based model; (**d**) Accuracy values achieved by VGG16-based model.