## 3 Methods
### Training of the 3D CNN Architecture  
Both classification and segmentation CNNs were trained end-to-end on the datasets of brain scans in MRI. An example of the typical content of such volumetric medical image is shown in Figure 5.  
In this paper, we select the cross-entropy as the classification loss function and the Dice loss as the segmentation loss function. The cross-entropy \(CE\) can be written as:  
\[CE=-\frac{1}{N}(\sum_{n=1}^{N}y_{n}\ln H(x_{n})+(1-y_{n})\ln(1-H(x_{n}))) \tag{6}\]  
\begin{table}
\begin{tabular}{l l l} \hline \hline \(\mathbf{A_{n}}\) & \(\mathbf{B_{n}}\) & \(\mathbf{C_{n}}\) \\ \hline \multicolumn{3}{c}{Input (3D multi-channel MRI)} \\ \hline
3D-conv3-32 & 3D-conv3-32 & 3D-conv3-32 \\ \hline \multicolumn{3}{c}{Max pooling} \\ \hline
3D-conv3-64 & 3D-conv3-64 & 3D-DSC-64 \\ \hline \multicolumn{3}{c}{Max pooling} \\ \hline
3D-conv3-128 \(\times n\) & 3D-DSC-128 \(\times n\) & 3D-DSC-128 \(\times n\) \\ \hline \multicolumn{3}{c}{Max pooling} \\ \hline
3D-conv3-256 \(\times n\) & 3D-DSC-256 \(\times n\) & 3D-DSC-256 \(\times n\) \\ \hline \multicolumn{3}{c}{Max pooling} \\ \hline
3D-conv3-512 \(\times n\) & 3D-DSC-512 \(\times n\) & 3D-DSC-512 \(\times n\) \\ \hline \multicolumn{3}{c}{Global Average Pooling} \\ \hline \multicolumn{3}{c}{3D-conv1-2} \\ \hline \multicolumn{3}{c}{Softmax} \\ \hline \hline \end{tabular}
\end{table}
Table 2: Architecture overview (shown in columns). \(A_{n}\) are the networks with normal 3D convolution; \(B_{n}\) and \(C_{n}\) are the networks with 3D-DSC; and \(n\) represents the number of the additional convolution layers. The 3D convolutional kernel parameters are expressed as “3D-conv\(\langle\)kernel size\(\rangle\)/3D-DSC-\(\langle\)number of output channel\(\rangle\)”. The leaky ReLU activation layer and batch normalization layer are not shown here for brevity.  
Figure 5: Slices from brain MRI volumes. This data are part of the ADHD200 consortium (the images above) [26] and BRATS 2017 challenge (the images below) [27].  
where \(N\) is the number of samples, \(x_{n}\) and \(y_{n}\) are the input and corresponding label of the \(n\)th sample, \(H(\cdot)\) is the function learned by the network and \(H(x_{n})\) represents the output of the neural network given the input \(x_{n}\). The Dice loss \(D\) for binary classes is defined as follows:  
\[D=\frac{2\sum_{i}^{N}p_{i}q_{i}}{\sum_{i}^{N}p_{i}^{2}+\sum_{i}^{N}q_{i}^{2}} \tag{7}\]  
where the sums run over the \(N\) voxels, of the predicted segmentation volume \(p_{i}\in P\) and the ground truth volume \(q_{i}\in Q\).  
We employed a similar training strategy during classification and segmentation. It is worth noting that adaptive optimization methods have better performance in the early stage of training, but are outperformed by Stochastic Gradient Descent (SGD) at later stages. To minimize the effect of random initialization, we firstly trained the model with random initialization and the Adam [28] optimizer. Then, we refined the model with the SGD optimizer. The learning rate was initially set to 0.00001 and decreased by a factor of 10 when the validation error stopped decreasing. The early-stopping strategy was used with patience of 50. We denote the mean difference between the training loss and the validation loss within the last 50 epochs as the Overfitting Distance (OD), which can be used to evaluate the ability of the network to cope with overfitting. The OD can be written as:  
\[OD=\frac{1}{N}\sum_{i=1}^{N}|T_{i}-V_{i}| \tag{8}\]  
where \(N\) is the training epoch numbers, \(T_{i}\) is training loss and \(V_{i}\) is validation loss. In our experiments, we employed 5 fold cross-validation to evaluate the proposed method.