# Improvement of Damage Segmentation Based on Pixel-Level Data Balance Using VGG-Unet
## 3 Methodology
### Structure of VGG-Unet
#### 3.1.2 Layers  
The essence of deep learning is to extract the features of the detected object. The most important step to carry out this process is convolution, by Convolutional layers. Convolutional layers are adopted in both down- and up-sampling blocks. A set of kernels with learnable weight to perform the convolution operation are used in the layer, as shown in Figure 2. Each kernel slides on the input array with a specific step size defined as stride and the convolution implemented by this process. The multiplications are done between the element from kernel and the element from subarray of input to get a receptive field. Then the multiplied values are summed with bias added to get a value in the output array. To maintain the output size is equal to the input size, adopt zero-padding (Pad) for the input array. The output size of a convolutional layer depends on the size of input, Pad numbers, kernel size, and stride, which can be calculated as the example in Figure 2.  
Figure 1: Overall architecture of VGG-Unet.  
Figure 2: Example of Convolutional layer.  
Another key aspect in VGG-Unet is Maxpooling layer, which reduces the spatial size of the input array and often defined as downsampling. It uses a subarray to get the max values. Figure 3 shows the example of MaxPooling layer with a stride of two. Hence, once the input array goes pass the Maxpooling layer, the width and height become half. Once the array go through Maxpooling layer, the memory becomes a quarter of the original one. This can release more memory for more calculation and the training efficiency is significantly improved.  
The largest difference between CNN and FCN is up-sampling blocks, which replaces the position of the neural layer in CNN. Up-sampling blocks are adopted to make the feature array back to pixels in three channels, which is called image visualization. Upsampling layer is widely used in the up-sampling blocks. It increases the width and height from the input array. Any element in the input array would be repeated in two directions, shown as Figure 4. Every time after upsampling, resolution would become \(2\times 2\) of the  
\begin{table}
\begin{tabular}{l l l l l l} \hline \hline
**Layer** & **Type** & **Pad** & **Kernel Size** & **Stride** & **Output Size** & **Note** \\ \hline
1 & Input & - & - & - & \(224\times 224\times 3\) \\  
axPooling & 0 & \(2\times 2\) & 2 & \(7\times 7\times 512\) \\
20 & Upsampling & - & - & - & \(14\times 14\times 512\) \\
21 & Concatenate & - & - & - & \(14\times 14\times 1024\) \\
22 & Conv + BN & 1 & \(3\times 3\times 512\) & 2 & \(14\times 14\times 512\) \\
23 & Upsampling & - & - & - & \(28\times 28\times 256\) \\
24 & Concatenate & - & - & - & \(28\times 512\) \\
25 & Conv + BN & 1 & \(3\times 3\times 256\) & 2 & \(28\times 28\times 256\) \\
26 & Conv + BN & 1 & \(3\times 3\times 128\) & 2 & \(28\times 28\times 128\) \\
27 & Upsampling & - & - & - & \(56\times 56\times 128\) \\
28 & Concatenate & - & - & - & \(56\times 56\times 256\) \\
29 & Conv + BN & 1 & \(3\times 3\times 128\) & 2 & \(56\times 56\times 128\) \\
30 & Conv + BN & 1 & \(3\times 3\times 64\) & 2 & \(56\times 56\times 64\) \\
31 & Upsampling & - & - & - & \(112\times 112\times 64\) \\
32 & Concatenate & - & - & - & \(112\times 112\times 128\) \\
33 & Conv + BN & 1 & \(3\times 3\times 64\) & 2 & \(112\times 112\times 64\) \\
34 & Upsampling & - & - & - & \(224\times 224\times 64\) \\
35 & Conv + BN & 1 & \(3\times 3\times 3\) & 2 & \(224\times 224\times 3\) \\
36 & Output & - & - & - & \(224\times 224\times 3\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: The detailed configuration and specifications of VGG-Unet.