# Biomedical Image Classification via Dynamically Early Stopped Artificial Neural Network
## 4 Numerical Experiments
### Image Classification on CIFAR-100 Dataset  
We present the results for three different CNNs for 100-classes classification on the CIFAR-100 dataset: ResNet18 [28], VGG16 [29] and MobileNet [30]. The numerical experiments have been performed on an Intel i9-9900 KF coupled with an NVIDIA RTX 2080 Ti. The code has been developed starting from an established framework to train several CNNs on the CIFAR-100 dataset ([[https://github.com/weiaicunzai/pytorch-cifar100](https://github.com/weiaicunzai/pytorch-cifar100)]([https://github.com/weiaicunzai/pytorch-cifar100](https://github.com/weiaicunzai/pytorch-cifar100)), accessed on 1 October 2022) and has been made public for the sake of reproducibility ([[https://github.com/mive93/pytorch-cifar100](https://github.com/mive93/pytorch-cifar100)]([https://github.com/mive93/pytorch-cifar100](https://github.com/mive93/pytorch-cifar100)), accessed on 1 October 2022). In the considered framework, the CIFAR-100 dataset was divided into training and test sets. We used 10% of the training set to create the validation set. The optimizer employed for the reference training of the CNNs is the SG with momentum; it uses a starting LR of 0.1 and schedules its annealing at epochs [60, 120, 160], multiplying it by 0.2 in those so-called milestones.  
The performance of the optimization method employed for the CNNs reference training has been compared with the performance of two different versions of Algorithm 1 (with an SG with momentum at lines 7-8). In particular, we consider the possibility of either reducing the LR while the MBS is such that \(n_{k+1}=n_{0}\) or decreasing the LR and increasing the MBS. Both versions of Algorithm 1 have been implemented by setting \(maxepochs=200\), \(\eta_{0}=0.1\), \(n_{0}=2\), \(c_{1}=0.2\), \(n_{k+1}=\max\{max_{memory}=1000,\;c_{2}*n_{k}\}\), where \(max_{memory}\in\mathbb{N}\) is the maximum number of samples that can be stored in the GPU, and \(c_{2}=2\). Moreover, in order to understand how the patience values affect the performance, we consider three different values for \(p\)--8, 15 and 20--and two different values for \(\gamma\)--2 and 4. Finally, \(\overline{p}\) has been fixed either equal to 6 if both the LR is reduced and the MBS is increased or equal to 3 if only the LR is decreased but the MBS is not changed along the iterations. In the results, the name of the different considered algorithms for the training reports:  
* LR if only the LR is changed along the iterative process or LRBS if both the hyperparameters are variable;
* \(p\) followed by its value;
* \(\gamma\) followed by its value.  
For example, LRBS_\(p20\_{-}\gamma 2\) points out that the selection rules for the LR and the MBS are both dynamic and the values for \(p\) and \(\gamma\) are 20 and 2, respectively.  
All the tests have been performed five times, and the average accuracy on the test set and the number of epochs are reported, knowing that the standard deviation on the accuracy is at most equal to 0.0145. As usual, the best result obtained with the check on the VS is verified on the test set.  
Figure 1 shows the results of all the experiments carried out on the MobileNet CNN. In this case, the reference training achieves an accuracy of 65.39% in 200 epochs. From the chart, it can be seen that all the trainings that follow the methodology proposed in this paper achieve similar results in terms of accuracy while needing less than half the epochs of the original one. Moreover, some configurations outperform the original, such as, e.g., the LRBS version with patience equal to 15 or 20. Table 1 reports all the results for the three CNNs for the LRBS configurations. From the last two columns of Table 1, it is possible to conclude that the accuracy results obtained by the proposed method are in line with those of the original version, sometimes slightly lower and sometimes higher. What is truly remarkable is the number of epochs required to obtain such a performance, which is at least halved compared to the original method.