## 2 Methodology
### The Morphological Processing Layer  
Although each tongue in the image is a relatively large and complete object, there are still inevitable noises around or inside the segmented regions. Furthermore, information like the shape and texture of a tongue provided by the training data is complicated, which to some extent influences the prediction of the pixels, especially for ones on the contours or between the border of the lips and tongue. Therefore, it is difficult to obtain a smooth and noise-free mask in one step. Taking the difficulties as well as the efficiency into consideration, we propose a morphological processing layer (MPL) to refine the coarse mask image produced by the network using specifically designed filters. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Layer**} & \multirow{2}{*}{**Type**} & \multirow{2}{*}{**Kernel Size**} & **Number of** & **Input** & **Activation** \\  & & & **Kernels** & **Dimensions** & **Function** \\ \hline
1 & Convolution2D & \(3\times 3\) & 64 & \(576\times 768\) & ReLU \\
2 & Convolution2D & \(3\times 3\) & 64 & \(576\times 768\) & ReLU \\
3 & Maxpooling & \(2\times 2\) & - & \(576\times 768\) & - \\ \hline
4 & Convolution2D & \(3\times 3\) & 128 & \(288\times 384\) & ReLU \\
5 & Convolution2D & \(3\times 3\) & 128 & \(288\times 384\) & ReLU \\
6 & Maxpooling & \(2\times 2\) & - & \(288\times 384\) & - \\ \hline
7 & Convolution2D & \(3\times 3\) & 256 & \(144\times 192\) & ReLU \\
8 & Convolution2D & \(3\times 3\) & 256 & \(144\times 192\) & ReLU \\
9 & Maxpooling & \(2\times 2\) & - & \(144\times 392\) & - \\
10 & Dropout & \(2\times 2\) & - & - & - \\ \hline
11 & Convolution2D & \(3\times 3\) & 512 & \(72\times 96\) & ReLU \\
12 & Convolution2D & \(3\times 3\) & 512 & \(72\times 96\) & ReLU \\
13 & Maxpooling & \(2\times 2\) & - & \(72\times 96\) & - \\
14 & Dropout & \(2\times 2\) & - & - & - \\ \hline
15 & Convolution2D & \(3\times 3\) & 1024 & \(36\times 48\) & ReLU \\
16 & Convolution2D & \(3\times 3\) & 1024 & \(36\times 48\) & ReLU \\ \hline
17 & Up-convolution2D & \(2\times 2\) & 512 & \(36\times 48\) & - \\
18 & Convolution2D & \(3\times 3\) & 512 & \(72\times 96\) & ReLU \\
19 & Convolution2D & \(3\times 3\) & 512 & \(72\times 96\) & ReLU \\ \hline
20 & Up-convolution2D & \(2\times 2\) & 256 & \(72\times 96\) & - \\
21 & Convolution2D & \(3\times 3\) & 256 & \(144\times 192\) & ReLU \\
22 & Convolution2D & \(3\times 3\) & 256 & \(144\times 192\) & ReLU \\ \hline
23 & Up-convolution2D & \(2\times 2\) & 128 & \(144\times 192\) & - \\
24 & Convolution2D & \(3\times 3\) & 128 & \(288\times 384\) & ReLU \\
25 & Convolution2D & \(3\times 3\) & 128 & \(288\times 384\) & ReLU \\ \hline
26 & Up-convolution2D & \(2\times 2\) & 64 & \(288\times\) & - \\
27 & Convolution2D & \(3\times 3\) & 64 & \(576\times 768\) & ReLU \\
28 & Convolution2D & \(3\times 3\) & 64 & \(576\times 768\) & ReLU \\
29 & Convolution2D & \(1\times 1\) & 1 & \(576\times 768\) & ReLU \\
30 & Morphological processing & - & 1 & \(576\times 768\) & - \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Parameter settings of each layer. We formulate the refinement into a problem that can be described in Figure 6a and define the tongue region in Definition, where a binary mask \(M\) is generated from a grey-scale mask image \(G\) filtered by threshold \(\tau\):  
\[M(x,y)= \begin{cases}1,&G(x,y)\geqslant\tau,\\ 0,&G(x,y)<\tau.\end{cases}  \tag{1}\]  
where the threshold \(\tau\) is calculated according to [PERSON]'s method [26]. **Definition 1**. : _A connected component \(C\) is a set of pixels whose foreground pixel \(p\) has a connectivity of 8-connected neighborhoods with an arbitrary pixel \(q\) in \(C\)._  
**Definition 2**. : _The segmented tongue region \(T\) is the largest connected component in the binary mask image \(M\)._  
According to Definition 2, a tongue region and is located at the center and is the largest connected component in Figure 6a. Apparently, there is noise at or close to the corners.