Deep Visual Waterline Detection within Inland Marine Environment

by   Jing Huang, et al.
Wuhan University of Technology

Waterline usually plays as an important visual cue for maritime applications. However, the visual complexity of inland waterline presents a significant challenge for the development of highly efficient computer vision algorithms tailored for waterline detection in a complicated inland water environment. This paper attempts to find a solution to guarantee the effectiveness of waterline detection for inland maritime applications with general digital camera sensor. To this end, a general deep-learning-based paradigm applicable in variable inland waters, named DeepWL, is proposed, which concerns the efficiency of waterline detection simultaneously. Specifically, there are two novel deep network models, named WLdetectNet and WLgenerateNet respectively, cooperating in the paradigm that afford a continuous waterline image-map estimation from a single captured video stream. Experimental results demonstrate the effectiveness and superiority of the proposed approach via qualitative and quantitative assessment on the concerned performances. Moreover, due to its own generality, the proposed approach has the potential to be applied to the waterline detection tasks of other water areas such as coastal waters.


page 1

page 6


Algae Detection Using Computer Vision and Deep Learning

A disconcerting ramification of water pollution caused by burgeoning pop...

Mapping Areas using Computer Vision Algorithms and Drones

The goal of this paper is to implement a system, titled as Drone Map Cre...

Active Control of Camera Parameters for Object Detection Algorithms

Camera parameters not only play an important role in determining the vis...

Multi-Target Deep Learning for Algal Detection and Classification

Water quality has a direct impact on industry, agriculture, and public h...

Generation of Multimodal Justification Using Visual Word Constraint Model for Explainable Computer-Aided Diagnosis

The ambiguity of the decision-making process has been pointed out as the...

Fast image-based obstacle detection from unmanned surface vehicles

Obstacle detection plays an important role in unmanned surface vehicles ...

1 Introduction

With the development of computer vision techniques, many waterline detection approaches by virtue of general digital camera have been proposed. Most of them aim at the detection of coastal waterline in sea areas, e.g. [1-4], and there are also a few work focusing on inland waterline, e.g. [5]. When applied in inland waters, the detection effects of these approaches tend to be vulnerable to the variations of environmental factors (e.g., weather conditions like fog, snow or rain, illumination conditions like shadow, reflection or water glint, the shapes of waterlines, as well as the viewpoints of cameras). The reason is that the erratic environmental factors usually engender more visual complexity on inland waterline. For example, the visual information of the background surrounding inland waterline might become more confusing due to the change of illumination. Correspondingly, the stability of existing approaches is prone to be disturbed in such changeable and complicated inland water scenarios.

Existing vision-based waterline detection approaches generally share a pipeline that consists of two relevant processes, i.e., waterline-relevant feature representation and discriminative strategy (or algorithm) for final identification respectively. Nevertheless, current proposals for the two relevant processes in these vision-based approaches tend to overwhelm the stability of the approaches themselves, due to their deficiencies in the robustness against variable inland water environments: i) The current proposals for representing waterline-relevant features are hand-crafted that largely depend on specific prior knowledge or statistical assumptions, e.g., [2,3,6,7], whereas the applied prior knowledge or assumptions cannot hold in all cases; ii) The currently used discriminative strategies (or algorithms) to finalize waterline identification mostly work in particular water conditions, which have little consideration for coping with the visual versatility of waterline caused by the variations of environmental factors, such as [5,8].

Fig. 1: The diagram of DeepWL for waterline detection.

To meet the challenging task, this paper aims to guarantee the effectiveness of waterline detection for inland maritime applications, such as unmanned surface vehicles (USVs) mounted with camera sensor patrolling in variable inland water environments. Specifically, we make an attempt to improve the robustness and stability of waterline detection for diverse cases by proposing a general deep-learning-based paradigm for inland marine applications, named DeepWL, which concerns the efficiency of waterline detection simultaneously. As illustrated in Fig.1

, the proposed paradigm consists of two cooperative deep neural network models. One, termed WLdetectNet, is customized as the primary network (i.e., a learning model) for our deep visual waterline detection by exploiting convolutional neural networks (CNNs [9]). The other one, named WLgenerateNet, is built upon generative adversarial networks (GANs) [10] that serves as the auxiliary network (i.e., another learning model) of WLdetectNet.

As the mainstay of this paradigm, the WLdetectNet is modeled as an end-to-end deep convolutional neural network to directly achieve the identification of candidate waterlines in each captured image, rather than separating waterline-relevant feature representation from its related discriminative strategy (or algorithm), and without resorting to image preprocessing. To improve the accuracy of waterline detection, we innovatively devise two significant schemes for the materialization of WLdetectNet by following the same architectural principles with many modern deep CNNs (e.g., [11], [12]), which are actually dedicated to the improvement of the representational capability of this deep learning model for varied waterlines. At the same time, owing to its architectural characteristics benefiting from the two specialized schemes, WLdetectNet lays stress on the efficiency of waterline detection as well. What is more, to improve the robustness of WLdetectNet for variable inland water environments, another deep neural network, i.e., WLgenerateNet, is built to assist the improvement of the generalization ability of WLdetectNet in diverse cases by exploiting the classical generative adversarial networks, such as [13] and [14]. In brief, the overall design for the proposed paradigm is inspired by the current great successes of deep learning techniques in computer vision applications.

In addition, we define relevant metrics specialized for the quantitative evaluation of visual waterline detection approach on related performances, and conduct empirical investigations on the effectiveness and superiority of the proposed approach via qualitative and quantitative assessment. Compared with other alternative approaches, the proposed approach achieves better robustness and stability in the presence of environmental noises in variable inland water.

2 Methodology

As illustrated in Fig.1, the paradigm comprises two collaborative deep neural networks, i.e., WLdetectNet and WLgenerateNet. Thus, in this section, we first highlight the architectural details of the two significant deep networks, and then describe their training methods. Finally, based on the proposed paradigm, we present an algorithm to achieve waterline detection.

2.1 The main network WLdetectNet

In this paradigm, we specify the vision-based waterline detection as an end-to-end binary classification model, which integrates the waterline-relevant feature representation and its subsequent waterline discriminator in a customized deep convolutional neural network, i.e., WLdetectNet. To improve the accuracy of waterline detection, we deliberately devise the following two specialized schemes to construct the deep model.

1) Building a perceptive block as the receptive field of WLdetectNet: Given the visual complexity of waterline in varied inland water environments, we intentionally build a block to specialize in perceiving the contextual information relevant to waterline segments, and make use of the perceptive block as the receptive field of WLdetectNet, i.e., as the first layer of the deep main network in our paradigm DeepWL. As shown in Fig.1, the premeditated block, termed WLpeephole, is designated to be an image region of size , which consists of two different size fields (i.e., and , besides ). Specifically, in order to more conveniently and precisely distinguish various segments relevant to waterline, i.e., waterline segments, we take advantage of two different scale squares with a same central point, called observing field () and recognizing field () respectively, and further mandate the candidate segments of waterline to emerge only in the smaller square (i.e., recognizing field). Correspondingly, the area between observing field and recognizing field, namely the area observing field surrounding recognizing field, may be filled with various contextual information associated with a waterline segment, e.g., water streak, plants or buildings in waterfront.

Intuitively, the special design on the block can draw visual attention to the waterline within a receptive field. In practice, by feeding an image patch in accordance with the block-based design into our deep network WLdetectNet, we can get hold of the more discriminative waterline feature that avails final accurate decision-making on whether this image patch contains waterline or not. The reason is that the block based on the design carries better characteristics for making distinctions between waterline and non-waterline by paying attention to necessary contexts associated with waterline in such a receptive field. And the disparity information mingled in a block facilitates WLdetectNet to bolster the ability of the deep network regarding waterline-relevant feature representation. Besides, in our waterline detection algorithm (Algorithm 1), the perceptive block WLpeephole actually behaves as a peephole that successively diagnoses each region across an image captured by USVs to tell whether the current diagnosed region (i.e., current receptive field of WLdetectNet) contains waterline or not.

2) Deepening WLdetectNet to improve its own representational capability

: It is generally believed that improving their own representational capability of learning models is a predominant means to bolster the specific performance of tasks based on machine learning, such as accuracy on prediction [15,16]. Inspired by the great success of extending the depth of CNNs, e.g., [17,18,19,20], in this paper, we innovatively constitute a rather deep architecture for WLdetectNet to guarantee its robust representational capability, thus improving the accuracy of the main network for waterline detection. A complete description of its architectural specification is presented in Table


. It is worth mentioning that, similar to many modern variants of CNNs, some critical architectural principles are adopted in the construction of the deep network. For example, to extend the depth of WLdetectNet, we repeatedly exploit several structural modules in the residual branch of WLdetectNet like ResNet [17]. Then, to facilitate training such a deep network, we similarly take advantage of the shortcut path to back-propagate gradients. Meanwhile, in order to alleviate the information loss in such a deep network as much as possible to ensure the effectiveness and efficiency of this deep network in diverse cases, within each of the repeated structural modules, we attempt to successively make use of pointwise group convolution (i.e., PGconv), channel shuffle operation (i.e., Shuffle), depthwise convolution (i.e., Dwconv), point convolution (i.e., Pconv), global average pooling (i.e., GAP), fully connected operations (i.e., FC, with a Relu and Sigmoid activation, respectively) and channel-wise scaling operation (i.e., Scale) to enrich and equalize the information flow in the main network of our proposed paradigm. Especially, the reasonable utilization of PGconv and Dwconv in our architectural design of WLdetectNet benefits reducing the number of network parameters and computational complexity, which are crucial for guaranteeing the efficiency of the deep network. Actually, despite being deepened, WLdetectNet has little extra computational cost, about 3.12 MFLOPs that is very suitable for computationally limited applications. In addition, the channel operation Shuffle adopted in our architectural design also contributes to ensure the robust representational capability of WLdetectNet by equalizing information flow in such a deep network.

Layers Output Size Repeated Operations

An image (captured by USVs)
3x64x64 Sampling based on WLpeephole (i.e., by 64x64) as the first layer

Input layer
64x64x64 1

l3x3, 64conv, stride 1

64x64x64 8 l1x1, 32PGconv, stride 1, group 4
Shuffle, group 4
3x3, 32Dwconv, stride 1
1x1, 64Pconv, stride 1, group 4

128x64x64 1 l1x1, 64PGconv, stride 1, group 4
Shuffle, group 4
3x3, 64Dwconv, stride 1
1x1, 128Pconv, stride 1, group 4
1x1, 128conv, stride 1 (shortcut
Module-3 128x64x64 3 l1x1, 64PGconv, stride 1, group 4
Shuffle, group 4
3x3, 64Dwconv, stride 1
1x1, 128Pconv, stride 1, group 4
Module-4 256x64x64 1 l1x1, 128PGconv, stride 1, group 4
Shuffle, group 4
3x3, 128Dwconv, stride 1
1x1, 256Pconv, stride 1, group 4
1x1, 256conv, stride 1 (shortcut

256x64x64 3 l1x1, 128PGconv, stride 1, group 4
Shuffle, group 4
3x3, 128Dwconv, stride 1
1x1, 256Pconv, stride 1, group 4

Output layer
2x1x1 64x64, 2Convolution,stride 1

1D Softmax
TABLE I: The deep architecture of WLdetectNet

As shown in Table I, WLdetectNet uses individual image region perceived in accordance with WLpeephole as its input (i.e., the first layer of the deep network), and at its last layer outputs a scalar value indicating the category of the corresponding region, namely waterline or non-waterline. Moreover, apart from its input and output, the overall architecture of WLdetectNet is a linear stack of five repeatable structural modules, which totally consists of 72 convolutional layers. Because of following the common architectural principles with modern deep CNNs, WLdetectNet is easy to be constructed and trained.

2.2 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, 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.

Similar to classic GANs, 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.

In the WLgenerateNet, we utilize a 100-dimensional random noise as its input, then convert into a 64x64 pixel image by generator G(z). Meanwhile, discriminator D(x) is applied to determine whether the currently generated image belongs to waterline. Just in the case that the result of D(x) is true, the WLgenerateNet outputs generated images. Finally, through an iterative process of G(z) and D(x) contesting with each other, we can gain our desired labeled data on waterline.

2.3 Training methods of two deep networks

As illustrated above, the proposed paradigm DeepWL comprises two specially designed deep neural networks, i.e., WLdetectNet and WLgenerateNet. Here, we focus on their training methods, in which the WLdetectNet is trained in a supervised learning fashion while the WLgenerateNet is trained in an unsupervised learning fashion.

1) Training WLdetectNet by supervised learning: The WLdetectNet acts as the mainstay of DeepWL. According to its design schemes described previously, WLdetectNet aims to capture discriminative information relevant to waterline segments for final waterline detection. Thereby, in order to guarantee its accuracy and generalization ability, a large amount of training data is required, except for those significant designs regarding its architecture. However, no public dataset on waterline is available at present. Moreover, as mentioned before, it is also very difficult to collect such a large dataset, due to the labor and economic costs. To effectively carry out the training of WLdetectNet, we opt to build our own dataset on waterline segments in a simple and economical manner, which involves the following two processes.

Manually gathering original data satisfying the structural layout of WLpeephole. We first gather 2,000 image patches containing diverse waterline segments by manually cropping from surveillance videos associated with inland waterline, then resize them to be consistent with the structural layout of WLpeephole, especially compelling their waterline segments to display only in a smaller scope same with the recognizing field of WLpeephole. In practice, these gathered image patches come from varied scenarios including dissimilar weather conditions and different illumination conditions, so that the diversity of these samples is helpful for enhancing the perceptive ability of WLpeephole to detect various waterline segments, thus improving the generalization ability of WLdetectNet.

Automatically generating artificial data on waterline segments for data augmentation. Due to labor and economical costs, it has been proved to not be an easy thing that hunting for plentiful labeled data on waterline segments. Thus, aside from manually gathering more such samples that are representative of distinct waterline segments, we also attempt to augment the labeled data we already have by means of WLgenerateNet. Specifically, we make advantage of WLgenerateNet to automatically generate more artificial data on waterline segments (almost 8,000 image patches at present) from existing manual dataset (i.e., 2,000 image patches). In fact, our approach to data augmentation by GANs on images is great for combating overfitting that is one of the primary problems with machine learning models in general, since we can further enlarge these data on demand.

Through the above two processes of manually gathering and automatically generating, around 10,000 image patches on waterline segments have constituted the positive samples of our training set. Furthermore, the training set also contains about 12,000 negative samples that are freely cropped from various non-waterline images. Importantly, the training set is a scalable and generalizable dataset, since it can further generalize and augment its sample data according to the needs of practical applications by the two processes mentioned above.

Then, based on the built dataset, we conduct the training for WLdetectNet by minimizing an energy function, which can be formally expressed as:


where N is the number of training samples, refers to all parameters of the deep learning model WLdetectNet, denotes the training sample, denotes the output of WLdetectNet over whose architecture is described in Table I, and represents the ground-truth label of sample

where scalar-valued 1 for waterline and 0 for non-waterline. Our optimization goal for this energy function is to chase the sweet spot where the cross entropy loss of WLdetectNet is low when its parameters are tuned by stochastic gradient descent (SGD) algorithm with a batch size of 60. Moreover, to avoid gradient explosions, our training procedure for WLdetectNet is divided into two stages: we first employ the samples gathered manually and 3,000 negative cases to train WLdetectNet for 30 epochs, then apply the data generated by WLgenerateNet and 9,000 negative cases to fine-tune WLdetectNet for 50 epochs. Finally, a binary classification deep network to detect waterline segments based on WLpeephole is obtained.

2) Training WLgenerateNet by unsupervised learning: As an auxiliary facility in DeepWL, WLgenerateNet aims to support the generalization ability of another deep learning model WLdetectNet by rendering more training data as much as possible for WLdetectNet. Similar to other classic GANs, its learning objective corresponds to a minmax two-player game, which is formulated as:


where the generator G(z) is responsible for learning to map data from the noise distribution to the distribution over data , while the discriminator D(x)

answers for estimating the probability of a sample from the data distribution

rather from G(z).

2.4 Our waterline detection algorithm based on DeepWL

As stated before, WLdetectNet performs as the mainstay of the paradigm DeepWL for our vision-based waterline detection, whereas its receptive field is constrained to a same region as WLpeephole whose size is fixed in practical applications. Thereby, our proposed paradigm DeepWL is more applicable for distinguishing segments relevant to waterline, i.e., determining if there is a waterline segment in the detected image region.

Given that the size of an image captured from USVs may be arbitrary, we present a waterline detection algorithm based on DeepWL, which pursues waterline image-map estimation from single video stream captured on board. The algorithm is summarized in Algorithm 1, which results in a corresponding waterline estimation image-map (see Fig.1). In the algorithm, we formulate the task on waterline image-map estimation as a sequence of repetitive subtasks on distinguishing waterline segment in every handled video frame, wherein each subtask is conducted by taking advantage of DeepWL that implicitly consists of two stages: estimating potential waterline segment via WLpeephole and marking associated waterline segment via a specific strategy. Indeed, a waterline usually can be deemed to the combination of a spectrum of line segments.

  Single video stream , sampling rate , scale of WLpeephole , stride of WLpeephole moving in every image , WLdetectNet and its learned parameters .
  A sequence of waterline estimation image-maps

1: Sample online according to sampling rate , which can eventually derive a corresponding sequence of images .
2: Take the currently derived frame by sampling as an image to be detected.
3: Initialize the placement of WLpeephole within to be at the upper left corner of .
4: Fetch the image region (denoted as ) corresponding to WLpeephole as the current receptive field of WLdetectNet .
5: Apply WLdetectNet to estimate if there is a waterline segment in , i.e., derive the value of .
6: If the label of corresponds to waterline, mark according to a strategy: mark the central pixel of , else not.
7: Move WLpeephole (vertically or horizontally) to a new placement within , according to stride .
8: Iterate steps 4 to 7 until WLpeephole moving to the lower right corner of .
9: Connect all marked pixels within as an estimated waterline, then output to be current waterline estimation image-map .
10: Iterate steps 2 to 9 until .

Algorithm 1 Waterline Detection Algorithm

Thus, the performance of the algorithm depends to a large extent on the main network of our paradigm DeepWL, whose effectiveness and efficiency are put forward in this paper by the aforementioned two significant schemes relevant to WLdetectNet with the assistance of WLgenerateNet. Furthermore, in order to accelerate waterline image-map estimation from single video stream, we do not resort to handling every frame of single video stream in the algorithm. Meanwhile, in case of needing to present more fine-grained marking effect of waterline in every estimation image-map, we can also opt a more considerate marking strategy to the algorithm. Notwithstanding in Algorithm 1 we employ a relatively simple marking strategy to rapidly approximate potential waterlines, it is actually enough for demands within inland waters.

3 Experiments and evaluation

To demonstrate the effectiveness and superiority of the proposed deep waterline detection approach, related experimental assessment and results are presented.

3.1 Experimental settings

The proposed waterline detection approach (Algorithm 1) has been deployed in our own USV customized to patrol within inland water, which is equipped with a visual perception subsystem for assisting navigation. All experimental data (optical images) were acquired by a general digital camera mounted in its visual perception subsystem with auto focus and exposure mode, when it was travelling in the East Lake, one of the largest urban lakes in China. Importantly, these obtained data, whose resolutions are 1080x1440, came from varied waterfront scenarios under different weather and illumination conditions, such as sunset with weak illumination, sunny weather with strong illumination, and foggy weather.

3.2 Evaluation metrics

To enable the quantitative assessment of performances on different waterline detection algorithms (or systems), relevant evaluation metrics are indispensable. Since there is no specialized metric to evaluate vision-based waterline detection, we establish several necessary statistical indicators to measure the performances of concern to us, by referring to the evaluation methods for classification models.

Effectiveness. To verify the performance of a waterline detection algorithm, its effectiveness in a waterline estimation image-map needs to be proved first. We adopt precision-recall metrics to characterize the detection effectiveness, which calculate how close the estimated results compare with the ground truth. Formally, precision and recall are defined as follows:


where card. refers to the cardinal of a finite set, denotes each pixel that lies within an estimated waterline, denotes each anchor marked manually in original image, all of which are connected to be a ground-truth waterline, and eventually the ground truth by hand results in a finite set consisting of a sequence of relevant pixels in original image. Besides, dist(, ) refers to the distance of image coordinate between and , and represents a threshold on visual distance, which is specifically set according to practical scenarios.

Robustness. Environmental variations, such as weather, illumination and water condition, often interfere with the effect of waterline detection. For instance, in some scenarios, waterline detection obtains ideal recall, whereas its precision demonstrates the opposite. The reason is that many pixels irrelevant to waterline have been mistakenly detected as the ground truth. Thus, we need to test the robustness of waterline detection against environmental noises so that the capacity of resisting environmental disturbances to a certain waterline detection approach can be better analyzed. To this end, we define FP-irrelevance metrics to quantify the robustness of waterline detection against environmental noises in an estimated image-map, wherein FP counts the number of all false positives, i.e., how many irrelevant pixels caused by noises are selected in an image-map, and irrelevance measures the overall deviation trend of pixel-level distances between those irrelevant pixels and the ground truth, which actually characterizes the statistical distribution on the distances of irrelevant pixels related to the ground truth in an estimated image-map. Formally, FP and irrelevance are defined as follows:


where min{*} denotes the minimum of all elements in a finite set {*}, SK

refers to the asymmetry coefficient of the skewness distribution on the pixel-level distance between the wrongly estimated waterline and the ground truth, and the set

in Eq. (5) actually represents a finite set consisting of all irrelevant pixels in an estimated image-map. Besides, , , , and dist are similar to the ones in Equations (3) and (4).

As far as an evaluated waterline detection approach is concerned, in the case of same FP, if the distance distribution presents positive skewness and higher irrelevance is obtained, we consider those wrongly estimated pixels to be more convergent to ground truth, and further its robustness is deemed to be better. In other words, in this case, the evaluated approach enables the impact from environmental disturbances on waterline detection effect to be shrunk as far as possible into the area around ground truth, where its estimation error gets smaller. Correspondingly, its capability to withstand environmental noises manifests more robust.

Stability. For continuous waterline detection based on video, we often need to inspect the impact of environmental variations on a sequence of estimated image-maps when facing the same visual scenario. Thereby, a related metric called stability is defined to quantify the stability of an evaluated approach under changeable environments. Specifically, the stability involves measuring the stability over four different metrics (precision, recall, FP and irrelevance, respectively) on multiple estimated image-maps, when a waterline detection approach is evaluated for a specific scenario against different environmental noises. Formally, stability over a metric is defined as follows:


where denotes the metric precision, recall, FP or irrelevance, denotes the mean of a specific metric p over all assessed samples (i.e., estimated image-maps for the same scenario), and

refer to the medium and standard deviation of those samples relevant to

, respectively.

In essence, stability characterizes four distribution conditions on their corresponding metrics by sampling diverse estimated image-maps that represent respective results from those facing same visual scenario with varied environmental noises. Given a metric , if

tends to be zero, the results about the specified metric over all samples are more convergent to normal distribution, which means that evaluated approach has more stability on this metric against environmental variations. On the contrary, the results with respect to the metric are prone to be fragile for environmental noises.

3.3 Results and analysis on our deep waterline detection approach

The scale of WLpeephole includes the size of observing field (denoted as r) and the size of recognizing field (denoted as s), which are two significant impact factors of our detection algorithm (Algorithm 1). To validate the effectiveness of the proposed approach to waterline detection, we conduct a group of experiments from the perspective of investigating the two impact factors on the resulting accuracy. Specifically, we carry out our algorithm repeatedly on the same optical image (presented in Fig. 2) in the case of 10 different (r, s) pairs. Notably, since both higher precision and higher recall are usually expected for practical waterline detection tasks, here we employ F1-score to evaluate the effectiveness of our approach on a single optical image. In practice, F1-score depends on precision-recall metrics, which is generally formulated as below:


Then, ten relevant F1-scores are calculated, as shown in Table II. Among them, Fig. 2(a-b) illustrates the visual result in the case of (48, 24) and (60, 30) for (r, s) pair, respectively.

scales r=H/36 r=H/22.5 r=H/18
r s F1 r s F1 r s F1
s=r/3 30 10 0.685 48 16 0.841 60 20 0.915
s=r/2 30 15 0.712 48 24 0.865 60 30 0.943
s=2r/3 30 20 0.706 48 32 0.858 60 40 0.929
TABLE II: Quantitative comparisons on F1-score by setting ten different scales of WLpeephole respectively (here, H denotes the height of an image, =10 pixels)

Fig. 2: Visual comparisons on detection results by performing Algorithm 1 on a single image with two different scales of WLpeephole (here, blue line shows the estimated waterline, and red line acts as the subline for marking manually the ground truth): (a) r=30 and s=10, (b) r=60 and s=30

From Table II, we observe that our waterline detection algorithm is effective in practical inland water scenario, even though the scale of WLpeephole impacts on its resulting accuracy more or less. Among of the ten displayed F1-scores, the one (i.e., 0.943) is highest when (r, s) pair is set to (60, 30), which actually represents the best detection effect that has been attained in this group of experiments, just as shown in Fig.2(b). The reason is that, in this case, more contextual information relevant to waterline and more sufficient information about waterline itself have been fed into our waterline discriminator WLdetectNet, which benefit from our having chosen bigger and more appropriate receptive field as far as possible by the current (r, s) pair. Instead, Fig.2(a) shows the worst visual result that corresponds to the case of (30, 10) in Table II, in which F1-score presents the lowest (i.e., 0.685). However, too big receptive field also decays the detection effect. For example, when (r, s) pair is set to (90, 45), its F1-score gets just 0.835. It is because that our marking strategy to approximate potential waterlines in Algorithm 1 is simplistic, so that fine-grained marking effect in an estimated image-map is difficult to achieve in the case of setting such big scale of WLpeephole. Subsequently, the accuracy of detection suffers more frustration. As a result, we suggest that the (r, s) pair in Algorithm 1 can be empirically set to (60, 30), which is usually a good choice for practical applications based on our waterline detection algorithm, especially for detecting a 1080x1440 image.

3.4 Comparison to other alternative approaches

To verify the superiority of the proposed waterline detection approach, we carry out experimental comparison between relevant alternative approach and ours.

Current vision-based waterline detection primarily resorts to non-deep-learning methods. Specifically, they generally apply a non-deep-learning paradigm to focus on waterline-relevant feature representation or final discriminative strategy (algorithm). Among them, edge detection is such a classic method that has been extensively applied in applications based on waterline detection. Thus, in this subsection, we compare the representative method with ours on their robustness and stability in the presence of environmental noises.

a) Visual comparison

As very common environmental noises to waterline detection within inland water, four environmental interference factors are paid attention to in our experiments, which are linear objects, water ripples, shadow and fog. Here, we are primarily concerned about their impacts on the detection results.

Figure 3 shows the visual results by Canny edge detector and ours against our concerned environmental noises on waterline detection. In the first row of Fig.3, all elements in black depict the estimated waterlines by Canny edge detector. And, the second row of Fig.3 presents our results, in which blue line indicates the estimated waterlines by our approach.

Fig. 3: Visual comparison of results between edge detection method (upper) and ours (bottom) with different environmental interference variables: (a) linear objects, e.g., rails of the USV, (b) water ripples, (c) shadow, (d) fog. (In our results, blue line shows the estimated waterline, and red line acts as the subline for marking manually the ground truth)

From Fig.3, it is observed that our results are obviously better than the compared approach in terms of handling environmental noises. For example, at the top of Fig.3(a-c), rails of our USV, parts of water ripples and shadow are wrongly detected as waterlines, and at the top of Fig.3(d), real waterline are not completely detected due to low visibility. In contrast, our estimated waterlines at the bottom of Fig.3(a-d) are basically concentrated in the vicinity of ground truth. Therefore, in terms of resisting environmental disturbance, our approach is intuitively superior to the alternative approach.

b) Quantitative assessment on robustness

Then, according to Eq.(3-6), we have calculated the precision-recall metrics and FP-irrelevance metrics respectively corresponding to the visual results presented in Fig.3. The quantitative comparisons on these evaluated metrics are shown in Table III.

Metrics Environmental interference factors
rail ripple shadow fog
precision(%) 11.5/96.5 29.2/95.4 21.2/96.1 93.3/90.6

97.6/98.2 95.2/97.1 83.7/98.6 41.9/84.5

54K/40 32K/36 33K/38 16/43

-1.119/0.092 -1.413/0.068 -1.216/0.073 0.059/0.081
TABLE III: Quantitative comparisons of assessed metrics corresponding to the results by edge detection method (left of /) and ours (right of /) under different noises

Usually, for a robust waterline detection approach, both high precision and high recall are desired in any water environments. From Table III, we see that the edge detection method (Canny edge detector) attains same desirable recalls as ours when rail, ripple or shadow is emerging, whereas its corresponding precisions are much lesser than ours. Besides, under foggy weather conditions, despite both of the two compared methods obtain high precision, the recall of edge detection method is only half of ours. Obviously, for the same scenarios, the effectiveness of edge detection method is more sensitive to environmental noises than ours. The reason is that a large number of pixels irrelevant to waterline are also selected by edge detection method, while correct pixels are annotated in an estimated image-map. For instance, there are 54,182 false positives (FP) also marked as black pixels in the upper image of Fig.3(a). Moreover, although the number of irrelevant pixels is rather small (only 16 false positives) owing to low illumination caused by fog, many true positives are still missed in the result by edge detection method that induces unsatisfactory recall (just 41.9%). Then, the measured irrelevances shown in Table III indicate that most of irrelevance metrics on edge detection method are negative, which means those irrelevant pixels (false positives) selected by this method scatter around real waterline. On the contrary, our irrelevance metrics are positive, implying that our false positives as a whole are more approximate to the ground truth.

Actually, in practical waterline detection tasks, edge detection method, as well as many other alternative approaches such as waterline detection based on image segmentation, generally employs necessary image preprocessing (e.g., image denoising) to eliminate those irrelevant pixels induced by environmental noises and guarantee high precision and high recall at the same time. However, these approaches relying on image preprocessing influence the efficiency of waterline detection tasks more or less due to extra computational costs. Instead, our approach can straightforwardly distinguish candidate waterline segments from raw images, since the proposed approach adopts an end-to-end paradigm based on deep learning, in which there is no preprocessing procedure. Therefore, as far as a single estimated image-map is concerned, our approach has better capacity of resisting environmental disturbance in the absence of image preprocessing, which is also demonstrated by the visual comparisons presented in Fig.3.

c) Quantitative assessment on stability

To evaluate the stability of waterline detection approach on video data, especially at the moments when environmental factors (e.g., weather or illumination conditions) emerge variations in a visual surveillance scenario, we further conduct related experimental comparisons between edge detection approach and ours. Here, we take foggy condition bringing about illumination variation as an example, and test its impacts on the stabilities of the two approaches during the procedure that time-sequence images are successively dealt with. Correspondingly, we sample 150 image frames from eight hours of video, which cover varied foggy conditions in the same monitoring scenario. Then, based on the

precision-recall metrics and FP-irrelevance metrics associated with each of these samples that are achieved respectively in terms of Eq. (3-6), we calculate the stability over the previous four metrics according to Eq. (7), as shown in Table IV.

Stability over Canny edge detector Ours
precision -1.767 -1.153

-3.198 0.991

1.052 -1.124

-0.313 0.196
TABLE IV: Quantitative comparisons on stability for edge detection method (with image preprocessing) and ours under varied foggy conditions

In the experiment about stability assessment, to achieve more impartial effect, we practically employ classic Canny edge detector with necessary image preprocessing as an evaluated edge detection method to compare with ours. From Table IV, we can see that the measurements of our approach regarding stability over our concerned metrics are closer to zero than Canny edge detector with image preprocessing, except for the metric FP due to more irrelevant pixels caused by our approach. It indicates that our measuring results over these samples with respect to most of our concerned metrics, e.g., precision, recall and irrelevance, are more convergent to normal distribution. Therefore, our approach has more stability on the corresponding metrics against environmental variations.

4 Conclusion

To respond to the challenge from highly dynamic inland water environments, maritime applications require an onboard vision-based waterline detection algorithm with more robustness and more stability to accomplish specific missions. In this paper, we proposed a novel visual detection approach to identifying inland waterlines with general digital camera by the use of deep learning techniques, which aimed to guarantee the effectiveness of waterline detection within variable inland water environments. Meanwhile, to evaluate our concerned performances, we defined quantitative metrics and conducted empirical investigations. Experimental results in real-life scenarios demonstrated that our approach performed more favorably than the compared approach, and achieved better robustness and stability in the presence of visual noises in dynamic inland waters. In addition, due to the generality of our proposed approach, it is also suitable for the waterline detection tasks of other water areas, such as coastal waters.


  • [1] S. Wiehle and S. Lehner, “Automated waterline detection in the wadden sea using high-resolution terrasar-x images,” Journal of Sensors, vol. 2015, 2015.
  • [2] I. Lipschutz, E. Gershikov, and B. Milgrom, “New methods for horizon line detection in infrared and visible sea images,” Int. J. Comput. Eng. Res, vol. 3, no. 3, pp. 1197–1215, 2013.
  • [3] Y. Yan, B. Shin, X. Mou, W. Mou, and H. Wang, “Efficient horizon detection on complex sea for sea surveillance,” International Journal of Electrical, Electronics and Data Communication, vol. 3, no. 12, pp. 49–52, 2015.
  • [4] T. Ma, J. Ma, and W. Fu, “Sea-sky line extraction with linear fitting based on line segment detection,” in 2016 9th International Symposium on Computational Intelligence and Design (ISCID), vol. 1.   IEEE, 2016, pp. 46–49.
  • [5] W. Zhan, C. Xiao, H. Yuan, and Y. Wen, “Effective waterline detection for unmanned surface vehicles in inland water,” in 2017 Seventh International Conference on Image Processing Theory, Tools and Applications (IPTA).   IEEE, 2017, pp. 1–6.
  • [6] H. Wang, Z. Wei, S. Wang, C. S. Ow, K. T. Ho, and B. Feng, “A vision-based obstacle detection system for unmanned surface vehicle,” in 2011 IEEE 5th International Conference on Robotics, Automation and Mechatronics (RAM).   IEEE, 2011, pp. 364–369.
  • [7] A. Niedermeier, E. Romaneessen, and S. Lehner, “Detection of coastlines in sar images using wavelet methods,” IEEE Transactions on Geoscience and Remote Sensing, vol. 38, no. 5, pp. 2270–2281, 2000.
  • [8] Y. Wei and Y. Zhang, “Effective waterline detection of unmanned surface vehicles based on optical images,” Sensors, vol. 16, no. 10, p. 1590, 2016.
  • [9]

    A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenet classification with deep convolutional neural networks,” in

    Advances in neural information processing systems, 2012, pp. 1097–1105.
  • [10] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, “Generative adversarial nets,” in Advances in neural information processing systems, 2014, pp. 2672–2680.
  • [11] L. Wu, Y. Wang, L. Shao, and M. Wang, “3-d personvlad: Learning deep global representations for video-based person reidentification,” IEEE transactions on neural networks and learning systems, 2019.
  • [12] L. Wu, Y. Wang, X. Li, and J. Gao, “Deep attention-based spatially recursive networks for fine-grained visual recognition,” IEEE transactions on cybernetics, vol. 49, no. 5, pp. 1791–1802, 2018.
  • [13] L. Wu, Y. Wang, and L. Shao, “Cycle-consistent deep generative hashing for cross-modal retrieval,” IEEE Transactions on Image Processing, vol. 28, no. 4, pp. 1602–1612, 2018.
  • [14] L. Wu, Y. Wang, H. Yin, M. Wang, L. Shao, and B. C. Lovell, “Few-shot deep adversarial learning for video-based person re-identification,” arXiv preprint arXiv:1903.12395, 2019.
  • [15] Y. Wang, W. Zhang, L. Wu, X. Lin, M. Fang, and S. Pan, “Iterative views agreement: An iterative low-rank based structured optimization method to multi-view spectral clustering,” arXiv preprint arXiv:1608.05560, 2016.
  • [16]

    Y. Wang, L. Wu, X. Lin, and J. Gao, “Multiview spectral clustering via structured low-rank matrix factorization,”

    IEEE transactions on neural networks and learning systems, vol. 29, no. 10, pp. 4833–4843, 2018.
  • [17] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in

    Proceedings of the IEEE conference on computer vision and pattern recognition

    , 2016, pp. 770–778.
  • [18] J. Huang, W. Jiang, L. Li, Y. Wen, and G. Zhou, “Deeptransmap: a considerably deep transmission estimation network for single image dehazing,” Multimedia Tools and Applications, pp. 1–23, 2018.
  • [19] Y. Wang, X. Lin, L. Wu, and W. Zhang, “Effective multi-query expansions: Collaborative deep networks for robust landmark retrieval,” IEEE Transactions on Image Processing, vol. 26, no. 3, pp. 1393–1404, 2017.
  • [20] L. Wu, Y. Wang, and S. Pan, “Exploiting attribute correlations: A novel trace lasso-based weakly supervised dictionary learning method,” IEEE transactions on cybernetics, vol. 47, no. 12, pp. 4497–4508, 2016.