## 4 Experimental Environment and Results
### Training the Model  
The recent trend of anomaly detection models such as skip-GAN [56] and AnomalyGAN (AnoGAN) [23] is to train the model on the normal dataset by separating it into train-test fashion, and then perform inference with both unseen normal and unseen abnormal samples. Ideally, normal sample inference images will have similar latent vectors and the reconstructed image will be similar to the input image. On the other hand, abnormal samples that the model has not been trained for are expected to fail in both cases. A higher loss value can be expected in such cases, which will be used for anomaly score calculation. In case of training, the proposed model has three loss functions for optimization which are contextual loss, latent vector loss, and adversarial loss. 1. Contextual Loss: To learn the distribution of the dataset, \(\mathcal{L}_{1}\) normalization is applied to the input \(x\) and the output \(\hat{x}\). This helps the generation of contextually similar images from the normal samples and is proven to produce less blurry images than \(\mathcal{L}_{2}\) normalization [54]. The loss formula is given below as: \[\mathcal{L}_{context}=E_{x\sim p_{x}}|x-\hat{x}|_{1}.\] (1)
2. Adversarial Loss: Taken from [28], this loss ensures that the generator \(G\) can reconstruct an image \(x\) as realistically as possible while the discriminator \(D\) can differentiate between the normal and fake images. The task is to minimize this objective for \(G\) and maximize it for \(D\) to achieve the min-max equilibrium \(\mathcal{L}_{1}\) where it is defined as: \[\mathcal{L}_{adv}=E_{x\sim p_{x}}[logD(x)]+E_{x\sim p_{x}}[log(1-D(\hat{x})].\] (2)
3. Latent Loss: This \(\mathcal{L}_{2}\) loss is used in obtaining the latent representations of the input \(x\) and the generated output \(\hat{x}\) as similar as possible. This ensures that the network can \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Group** & **NC** & **MCI** & **AD** & **Total** \\ \hline No. of subjects & 148 & 83 & 25 & 256 \\ Gender (M/F) & 82/66 & 45/38 & 15/10 & \\ No. of Images & 14,208 & 7968 & 2400 & 24,576 \\ Age, mean \(\pm\) SD & 75.9 \(\pm\) 4.5 & 74.8 \(\pm\) 7.1 & 76.5 \(\pm\) 6.7 & \\ CDR, mean \(\pm\) SD & 0.0 \(\pm\) 0.0 & 0.5 \(\pm\) 0.0 & 0.8 \(\pm\) 0.2 & \\ MMSE, mean \(\pm\) SD & 29.1 \(\pm\) 1.0 & 27.2 \(\pm\) 1.6 & 23.4 \(\pm\) 2.0 & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The clinical information and the demographic of the population (mean \(\pm\) standard deviation). \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Training**} & \multicolumn{2}{c}{**Testing**} & \multicolumn{2}{c}{**Total**} \\ \hline
**Cases** & **AD** & **MCI** & **NC** & **AD** & **MCI** & **NC** & \\ \hline AD-NC & & 11,366 & 2400 & & 2842 & 16,608 \\ MCI-NC & & 11,366 & & 2842 & 2842 & 17,050 \\ AD-MCI & 6374 & & 2400 & 1594 & & 10,368 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The information about the train-test split for three cases. In training the case, 80% of the normal class data is split and the proposed model is trained with it. The remaining 20% is mixed with the corresponding abnormal class. The number of abnormal class data is either the same as the normal class or the highest possible number of usable images. produce similar latent representations for sampling. Using the concatenated features \(z=f(x)\) and the fully connected layer of the discriminator \(\hat{z}=f(\hat{x})\). The loss becomes:  
\[\mathcal{L}_{latent}=E_{x\sim p_{x}}|f(x)-f(\hat{x})|_{2}. \tag{3}\]  
Thus, the total loss of the model becomes:  
\[\mathcal{L}_{total}=\mathcal{L}_{context}+\mathcal{L}_{adv}+\mathcal{L}_{ latent}. \tag{4}\]  
For training the proposed model \(f\), stochastic gradient descent (SGD) with lambda decay, and Nesterov momentum optimizer function with the initial learning rate \(10^{-2}\) is used. The model is trained until the convergence, which took 60 epochs.