# Deep Visual Waterline Detection for Inland Marine Unmanned Surface Vehicles
## 3 Methodology
### The Auxiliary Network WLgenerateNet  
To guarantee the stability of our waterline detection approach under varied inland water environments (i.e., its robustness), in the proposed paradigm DeepWL, we intentionally arrange another deep network named WLgenerateNet as an auxiliary network to assist the main network WLdetectNet in improving its generalization ability. Moreover, the accuracy and efficiency of WLdetectNet continue to be maintained. Specifically, we construct the WLgenerateNet by following the design principles of GANs [19], and then utilize it to build on demand a large amount of waterline samples relevant to various scenarios for training WLdetectNet, thus generalizing the representational capability of the WLdetectNet and enabling the main network of our paradigm to be effectively applicable for waterline detection in diverse scenarios. That is motivated by a fact in machine learning: more data samples help to improve the generalization ability of a model (e.g., CNNs) and mitigate its problem of overfitting, thus improving the robustness of the model. However, it is actually not easy to collect such a large amount of labeled data on various waterlines. Therefore, in our waterline detection approach, we ingeniously draw lessons from the spirit of GANs that they can enable the automatic generation of desired data. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Layers** & **Output Size** & **Repeated** & **Operations** \\ \hline \multirow{4}{*}{An image (captured by USVs)} & \multirow{4}{*}{\(3\times 64\times 64\)} & \multirow{4}{*}{
\begin{tabular}{c} Sampling based on WLpeephole \\ (i.e., by 64 \(\times\) 64) \\ as the first layer \\ \end{tabular} } \\ \hline Input layer & 64 \(\times\) 64 \(\times\) 64 & 1 & \(3\times 3\), 64 conv, stride 1 \\ \hline \multirow{4}{*}{Module-1} & \multirow{4}{*}{64 \(\times\) 64 \(\times\) 64} & \multirow{4}{*}{8} & \(1\times 1\), 32 PGconv, stride 1, group 4 \\  & & & Shuffle, group 4 \\  & & & 3 \(\times\) 3, 32 Dwconv, stride 1 \\  & & & 1 \(\times\) 1, 64 Pconv, stride 1, group 4 \\  & & & GAP, FC, FC \\ \hline \multirow{4}{*}{Module-2} & \multirow{4}{*}{\(128\times 64\times 64\)} & \multirow{4}{*}{1} & \(1\times 1\), 64 PGconv, stride 1, group 4 \\  & & & Shuffle, group 4 \\  & & & 3 \(\times\) 3, 64 Dwconv, stride 1 \\  & & & 1 \(\times\) 1, 128 Pconv, stride 1, group 4 \\  & & & GAP, FC, FC \\  & & & 1 \(\times\) 1, 128 conv, stride 1 (shortcut path) \\ \hline \multirow{4}{*}{Module-3} & \multirow{4}{*}{\(128\times 64\times 64\)} & \multirow{4}{*}{3} & \(1\times 1\), 64 PGconv, stride 1, group 4 \\  & & & Shuffle, group 4 \\  & & & 3 \(\times\) 3, 64 Dwconv, stride 1 \\  & & & 1 \(\times\) 1, 128 Pconv, stride 1, group 4 \\  & & & GAP, FC, FC \\ \hline \multirow{4}{*}{Module-4} & \multirow{4}{*}{\(256\times 64\times 64\)} & \multirow{4}{*}{1} & \(1\times 1\), 128 PGconv, stride 1, group 4 \\  & & & Shuffle, group 4 \\  & & & 3 \(\times\) 3, 128 Dwconv, stride 1 \\  & & & 1 \(\times\) 1, 256 Pconv, stride 1, group 4 \\  & & & GAP, FC, FC \\  & & & 1 \(\times\) 1, 256 conv, stride 1 (shortcut path) \\ \hline \multirow{4}{*}{Module-5} & \multirow{4}{*}{\(256\times 64\times 64\)} & \multirow{4}{*}{3} & \(1\times 1\), 128 PGconv, stride 1, group 4 \\  & & & Shuffle, group 4 \\  & & & 3 \(\times\) 3, 128 Dwconv, stride 1 \\  & & & 1 \(\times\) 1, 256 Pconv, stride 1, group 4 \\  & & & GAP, FC, FC \\ \hline \multirow{4}{*}{Output layer} & \multirow{4}{*}{\(2\times 1\times 1\)} & \multirow{4}{*}{\(64\times 64\), 2 Convolution, stride 1} \\  & & & Softmax \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The deep architecture of WLdetectNet. Similar to classic GANs such as DCGAN [22], the WLgenerateNet consists of two convolutional neural networks contesting with each other in a zero-sum game framework, where the two adversarial networks are a generator \(G(z)\) for generating waterline samples and a discriminator \(D(x)\) for discriminating waterline samples, respectively. Table 2 illustrates its architecture.