# Adaptive Graph Cut Based Cloud Detection in Wireless Sensor Networks

Authors: Shuang Liu; Zhong Zhang
Journal: International Journal of Distributed Sensor Networks
 (2015)

---

## Abstract

We focus on the issue of cloud detection in wireless sensor networks (WSN) and propose a novel detection algorithm named adaptive graph cut (AGC) to tackle this issue. We first automatically label some pixels as “cloud” or “clear sky” with high confidence. Then, those labelled pixels serve as hard constraint seeds for the following graph cut algorithm. In addition, a novel transfer learning algorithm is proposed to transfer knowledge among sensor nodes, such that cloud images captured from different sensor nodes can adapt to different weather conditions. The experimental results show that the proposed algorithm not only achieves better results than other state-of-the-art cloud detection algorithms in WSN, but also achieves comparable results compared with the interactive segmentation algorithm.


---

## Body

## 1. Introduction

Cloud is one of the most important meteorological phenomena related to the hydrological cycle and the earth radiation balance. Most of existing cloud-related research requires the technology of ground-based cloud observation, such as ground-based cloud cover evaluation. The target of cloud cover evaluation is to estimate the proportion of cloud pixels accounted for all pixels in a ground-based cloud image. At present, cloud cover evaluation is still mainly conducted by professionally trained observers who manually estimate the coverage [1]. However, different observers may obtain discrepant observation results. Moreover, this work is complicated and time-consuming. Therefore, automatic ground-based cloud cover evaluation is highly desired in this area.Cloud detection, which classifies each pixel into cloud or clear sky element, is a fundamental task for cloud cover evaluation. In recent years, a lot of ground-based imaging devices have been developed for capturing cloud images, which provides hardware supporting for automatic cloud detection. The sky images can be obtained by these devices, such as whole sky imager (WSI) [2, 3], total sky imager (TSI) [4, 5], infrared cloud imager (ICI) [6], and all-sky imager (ASI) [7]. The traditional detection methods process the cloud images captured from only one image sensor. Meanwhile, recent advances in wireless communications and electronics have enabled connecting amount of image sensors as wireless sensor networks (WSN) where each image sensor is a sensor node [8, 9]. Cloud detection in WSN has two advantages over traditional cloud detection. First, each image sensor should allocate a computing device in traditional cloud detection, while all the image sensors in WSN share one computing device in the task manager node which is able to reduce costs. Second, cloud detection in WSN can obtain more complete cloud observation data than traditional cloud detection due to deploying sensor nodes at different locations. However, cloud detection in WSN is particularly challenging due to the severe illumination changes and vague boundaries between cloud and sky regions, as shown in Figure 1. Furthermore, in practical applications, we only have the ground-truth in one sensor node. If we train the model using the cloud images from one sensor node and test in other sensor nodes, the performance will degrade sharply, which is a transfer learning problem.Figure 1
The examples of ground-based cloud images.In this paper, we focus on the issue of cloud detection in WSN. A novel transfer learning algorithm is proposed so that the parameters of model adapt in different sensor nodes. We also propose a novel algorithm named adaptive graph cut (AGC) to detect cloud in the task manager node. First, we automatically label some pixels as “cloud” or “clear sky” with high confidence. Then, those labelled pixels serve as hard constraint seeds for the following graph cut algorithm. The experimental results show that the proposed algorithm not only achieves better results than state-of-the-art cloud detection algorithms, but also achieves comparable results compared with the interactive segmentation algorithm.


### 1.1. Related Work

To the best of our knowledge, our work is the first to study cloud detection in WSN, and therefore we only introduce the traditional cloud detection algorithms. The cloud observation consists of several fields, such as cloud classification [10, 11] and cloud detection [12]. Existing cloud classification techniques are generally based on the characteristics of structure [13] and texture in cloud images [14]. Recently, a lot of methods have been proposed for ground-based cloud detection. Due to the scattering difference between cloud particles and air molecules, most cloud detection algorithms treat color as the primary feature to distinguish cloud from clear sky [15]. Long et al. [5] proposed a threshold algorithm for cloud detection according to a certain radio of R over B intensity using a red-green-blue (RGB) image. Specifically, pixels with R/B greater than 0.6 are identified as cloud, otherwise as clear sky. Kreuter et al. [16] reported a different threshold of 0.77 on the R/B ratio for identifying cloud, which is illustrated to be a more suitable choice than previously mentioned value of 0.6. Other algorithms are proposed to classify the cloud based on other features, such as saturation [17], difference value [3], and the Euclidean geometric distance (EGD) [18]. This kind of methods can be referred to as the fixed threshold algorithm. However, fixed threshold methods are unsuitable for different sky conditions. To overcome this drawback, adaptive threshold algorithms based on the Otsu algorithm are investigated [1]. Moreover, neural network model [7] and MRF (Markov random fields) [15] are also applied for cloud detection. Although certain improvement can be achieved, their performance is still unsatisfactory for real world applications.Cloud is actually a special kind of object, and therefore it is natural to apply object segmentation techniques for cloud detection. Interactive object segmentation is a popular algorithm in this field. Among them, interactive graph cut has been widely applied and has achieved good performance [19, 20]. However, this model needs users to provide hard constraints for segmentation. Specifically, they manually label certain pixels as “object” or “background” seeds and then conduct the graph cut algorithm based on these seeds.The remainder of this paper is organized as follows: Section2 details the proposed algorithm; Section 3 presents the experimental results which show the super performance of our algorithm. Finally, we conclude the paper in Section 4.


## 1.1. Related Work

To the best of our knowledge, our work is the first to study cloud detection in WSN, and therefore we only introduce the traditional cloud detection algorithms. The cloud observation consists of several fields, such as cloud classification [10, 11] and cloud detection [12]. Existing cloud classification techniques are generally based on the characteristics of structure [13] and texture in cloud images [14]. Recently, a lot of methods have been proposed for ground-based cloud detection. Due to the scattering difference between cloud particles and air molecules, most cloud detection algorithms treat color as the primary feature to distinguish cloud from clear sky [15]. Long et al. [5] proposed a threshold algorithm for cloud detection according to a certain radio of R over B intensity using a red-green-blue (RGB) image. Specifically, pixels with R/B greater than 0.6 are identified as cloud, otherwise as clear sky. Kreuter et al. [16] reported a different threshold of 0.77 on the R/B ratio for identifying cloud, which is illustrated to be a more suitable choice than previously mentioned value of 0.6. Other algorithms are proposed to classify the cloud based on other features, such as saturation [17], difference value [3], and the Euclidean geometric distance (EGD) [18]. This kind of methods can be referred to as the fixed threshold algorithm. However, fixed threshold methods are unsuitable for different sky conditions. To overcome this drawback, adaptive threshold algorithms based on the Otsu algorithm are investigated [1]. Moreover, neural network model [7] and MRF (Markov random fields) [15] are also applied for cloud detection. Although certain improvement can be achieved, their performance is still unsatisfactory for real world applications.Cloud is actually a special kind of object, and therefore it is natural to apply object segmentation techniques for cloud detection. Interactive object segmentation is a popular algorithm in this field. Among them, interactive graph cut has been widely applied and has achieved good performance [19, 20]. However, this model needs users to provide hard constraints for segmentation. Specifically, they manually label certain pixels as “object” or “background” seeds and then conduct the graph cut algorithm based on these seeds.The remainder of this paper is organized as follows: Section2 details the proposed algorithm; Section 3 presents the experimental results which show the super performance of our algorithm. Finally, we conclude the paper in Section 4.


## 2. The Proposed Algorithm

When receiving a cloud imagexi from the ith sensor node, we first calculate the thresholds Thi and Tli using the transfer learning algorithm proposed in Section 2.1. Then, we detect clouds using the proposed AGC with the thresholds Thi and Tli.


### 2.1. Transfer Knowledge in WSN

LetXj={xnj,n=1,…,N} denote a set of cloud images captured from the jth sensor node, where the ground-truth of clouds is given and therefore the thresholds Thj and Tlj are known. The thresholds Thj and Tlj are used to calculate the hard constraint seeds for the cloud images. Let Xi={xmi,m=1,…,M} denote a set of cloud images captured from the ith sensor node, where the ground-truth of clouds is not given. Here, N and M are the number of cloud images in Xj and Xi, respectively. We expect to transfer knowledge from the jth sensor node to the ith sensor node so that the thresholds Thi and Tli can be inferred. This can be formulated as(1)Thi=wijThj,Tli=wijTlj,where wij is a weight parameter which indicates the difference of cloud image distributions captured from the ith and jth sensor nodes. Equation (1) shows the weight wij can compensate the distribution difference and help to transfer knowledge from one sensor node to another. When a cloud image contains more cloud, it has lower brightness. Hence, wij is estimated as (2)wij=qij,1M∑m=1M‍vmi≤1N∑n=1N‍vnj2-qij,1M∑m=1M‍vmi>1N∑n=1N‍vnj,where vmi and vnj are the sum of all the pixel brightness in the ith and jth cloud images, respectively. Equation (2) represents that if the average brightness of cloud image set Xi is lower than that of cloud image set Xj, the wij is equal to qij, otherwise (2-qij). Here,(3)qij=pdij=1σ2πe-dij2/2σ2,where σ is the standard deviation. Here, dij is the distance between Xi and Xj(4)dij=1N+M∑m=1M∑n=1N‍dmnij,where dmnij is the chi-square distance between cloud images xmi and xnj from the ith and jth sensor nodes, respectively. We extract local binary pattern (LBP) as the local feature and red-green-blue (RGB) color feature as the global feature for each cloud image. Thus, each cloud image is represented by a histogram h. The chi-square distance between two cloud images is formulated as(5)dmnij=∑k=1K‍hmik-hnjk2hmik+hnjk,where hmi and hnj are the histograms of cloud images xmi and xnj, respectively, K is the number of bins, and hmi(k) and hnj(k) are the values of hmi and hnj at kth bin.


### 2.2. Cloud Detection in the Task Manager Node

In the task manager node, we deal with cloud images transmitted from sensor nodes. Our goal is to extract the cloud pixels (foreground) from the clear sky pixels (background) precisely. The interactive graph cut is an effective algorithm for segmentation. However, one drawback is that interactive graph cut needs users to manually label hard constraints by assigning several pixels (seeds) to be part of foreground and that of background. In this paper, a novel cloud detection algorithm named adaptive graph cut (AGC) is proposed. The proposed method consists of two stages:(1) according to the characteristics of ground-based cloud images, we automatically label some pixels with high confidence as “cloud” or “clear sky” elements; (2) those labelled pixels serve as hard constraint seeds for the consecutive graph cut algorithm. The details of the proposed AGC algorithm are given below.


#### 2.2.1. Automatically Acquiring Hard Constraints

Since the ground-based cloud image is obtained from outdoor environment, the large illumination variations are inevitable. Moreover, vague boundaries between cloud and sky regions as the intrinsic characteristics of cloud image are ubiquitous. The above characteristics make cloud detection challenging. In this paper, we propose to automatically assign several pixels with high confidence as hard constraint seeds, which forms part of the foreground and background. As stated in Section1.1, color features are the primary characteristic for distinguishing cloud from clear sky. Based on this property, the hard constraint seeds are obtained as follows.(1)
A red-green-blue (RGB) cloud image is transformed into a single-channel feature image. Here, we useR/B as the feature image, which can increase the difference between cloud and clear sky and alleviate the illumination variations to some extent.(2)
According to (6), we can obtain hard constraint seeds with high confidence. Concretely, pixels with R/B value greater than Th are identified as cloud and the pixels with R/B less than Tl are identified as clear sky (6)i∈cloudpixels,RiBi>Th,i∈clearskypixels,RiBi<Tl.Here, i is the pixel of the cloud image and Th and Tl are the threshold parameters stated in Section 2.1.The strategy of automatically labeling hard constraint seeds is feasible in practice. Since the threshold ofTh is high enough, it can ensure pixels with the threshold larger than Th are cloud elements. Likewise, the threshold of Tl is low enough, so it also can ensure pixels with the threshold less than Tl are clear sky elements. We visualize hard constraint seeds to verify the reliability of automatically labelling seeds. Figure 2 shows the examples of automatically labeling hard constraint seeds in cloud images. The pixels with green are the seeds of cloud elements and pixels with red are the seeds of clear sky elements, from which we can see that these seeds belong to the truth class (cloud or clear sky).Figure 2
The examples of automatically labeling hard constraint seeds in the cloud images. The pixels with green are the seeds of cloud elements and the pixels with red are the seeds of clear sky elements.
(a)
(b)


#### 2.2.2. Graph Cut Algorithm

After obtaining the hard constraint seeds, we conduct the graph cut algorithm. LetG={V,E} be a weighted undirected graph, where V are the nodes (the pixels of the cloud image) and E denote the edges connecting two nodes. Each edge in the graph is assigned a nonnegative weight we (cost). There are also two special nodes named terminals: the foreground and background terminals. A cut is a subset of edges so that each node is assigned to either of the terminals. The cost of a cut is usually defined as the sum of the costs of the edges [19]: (7)C=∑e∈C‍we.The cost function that we use as the soft constraints for segmentation should include region and boundary properties. LetP denote all the pixels in the image and N denote the set of pairs (p,q) where p and q are the neighboring pixels in P. The cost function E(L) for each segmentation can be defined as (8)EL=λ·RL+BL,where (9)RL=∑p∈P‍RpLp,BL=∑(p,q)∈N‍B(p,q)·δLp,Lq,δLp,Lq=1,ifLp≠Lq0,otherwise.The coefficient λ≥0 in (8) specifies the relative importance between the region cost R(L) and the boundary cost B(L). The region cost R(L) measures the individual penalty for labeling the pixel p as the foreground or background. Each pixel has two cost weights Rp(1) and Rp(0) corresponding to the case of connecting with the foreground and background, respectively. The boundary cost B(L) reflects the penalties for the discontinuity between neighboring pixels {p,q}. B(p,q) should be large when the values of pixels p and q are similar and B(p,q) is close to zero when the two pixel values are very different.In this paper,R(L) and B(L) in (8) are given as the following steps.(1)
Assume that we getn foreground seeds and m background seeds denoted by {Fore}n and {Back}m, respectively.(2)
For each pixelp, calculate its color feature distance to each seed, denoted as D{Fore}np and D{Back}mp, respectively.(3)
Rp(1) and Rp(0) can be calculated as follows:(10)Rp1=min⁡DForekp,k=1,2,…,n,Rp(0)=min⁡DBackkp,k=1,2,…,m.(4)
The boundary costB(L) is a decreasing function of the distance between pixels p and q. For a cloud image, we use the function:(11)B{p,q}=exp⁡-fp-fq22σ2,where fp and fq denote the feature vectors, and their values are R/B. σ is a factor which is set to 0.3 in this paper.To obtain the values of all the parameters, we consider how to solve this segmentation problem. The min-cut/max-flow algorithm in [21] is applied for solving (8), and [19] proved that this min-cut algorithm would give a segmentation minimizing among all segmentations.


## 2.1. Transfer Knowledge in WSN

LetXj={xnj,n=1,…,N} denote a set of cloud images captured from the jth sensor node, where the ground-truth of clouds is given and therefore the thresholds Thj and Tlj are known. The thresholds Thj and Tlj are used to calculate the hard constraint seeds for the cloud images. Let Xi={xmi,m=1,…,M} denote a set of cloud images captured from the ith sensor node, where the ground-truth of clouds is not given. Here, N and M are the number of cloud images in Xj and Xi, respectively. We expect to transfer knowledge from the jth sensor node to the ith sensor node so that the thresholds Thi and Tli can be inferred. This can be formulated as(1)Thi=wijThj,Tli=wijTlj,where wij is a weight parameter which indicates the difference of cloud image distributions captured from the ith and jth sensor nodes. Equation (1) shows the weight wij can compensate the distribution difference and help to transfer knowledge from one sensor node to another. When a cloud image contains more cloud, it has lower brightness. Hence, wij is estimated as (2)wij=qij,1M∑m=1M‍vmi≤1N∑n=1N‍vnj2-qij,1M∑m=1M‍vmi>1N∑n=1N‍vnj,where vmi and vnj are the sum of all the pixel brightness in the ith and jth cloud images, respectively. Equation (2) represents that if the average brightness of cloud image set Xi is lower than that of cloud image set Xj, the wij is equal to qij, otherwise (2-qij). Here,(3)qij=pdij=1σ2πe-dij2/2σ2,where σ is the standard deviation. Here, dij is the distance between Xi and Xj(4)dij=1N+M∑m=1M∑n=1N‍dmnij,where dmnij is the chi-square distance between cloud images xmi and xnj from the ith and jth sensor nodes, respectively. We extract local binary pattern (LBP) as the local feature and red-green-blue (RGB) color feature as the global feature for each cloud image. Thus, each cloud image is represented by a histogram h. The chi-square distance between two cloud images is formulated as(5)dmnij=∑k=1K‍hmik-hnjk2hmik+hnjk,where hmi and hnj are the histograms of cloud images xmi and xnj, respectively, K is the number of bins, and hmi(k) and hnj(k) are the values of hmi and hnj at kth bin.


## 2.2. Cloud Detection in the Task Manager Node

In the task manager node, we deal with cloud images transmitted from sensor nodes. Our goal is to extract the cloud pixels (foreground) from the clear sky pixels (background) precisely. The interactive graph cut is an effective algorithm for segmentation. However, one drawback is that interactive graph cut needs users to manually label hard constraints by assigning several pixels (seeds) to be part of foreground and that of background. In this paper, a novel cloud detection algorithm named adaptive graph cut (AGC) is proposed. The proposed method consists of two stages:(1) according to the characteristics of ground-based cloud images, we automatically label some pixels with high confidence as “cloud” or “clear sky” elements; (2) those labelled pixels serve as hard constraint seeds for the consecutive graph cut algorithm. The details of the proposed AGC algorithm are given below.


### 2.2.1. Automatically Acquiring Hard Constraints

Since the ground-based cloud image is obtained from outdoor environment, the large illumination variations are inevitable. Moreover, vague boundaries between cloud and sky regions as the intrinsic characteristics of cloud image are ubiquitous. The above characteristics make cloud detection challenging. In this paper, we propose to automatically assign several pixels with high confidence as hard constraint seeds, which forms part of the foreground and background. As stated in Section1.1, color features are the primary characteristic for distinguishing cloud from clear sky. Based on this property, the hard constraint seeds are obtained as follows.(1)
A red-green-blue (RGB) cloud image is transformed into a single-channel feature image. Here, we useR/B as the feature image, which can increase the difference between cloud and clear sky and alleviate the illumination variations to some extent.(2)
According to (6), we can obtain hard constraint seeds with high confidence. Concretely, pixels with R/B value greater than Th are identified as cloud and the pixels with R/B less than Tl are identified as clear sky (6)i∈cloudpixels,RiBi>Th,i∈clearskypixels,RiBi<Tl.Here, i is the pixel of the cloud image and Th and Tl are the threshold parameters stated in Section 2.1.The strategy of automatically labeling hard constraint seeds is feasible in practice. Since the threshold ofTh is high enough, it can ensure pixels with the threshold larger than Th are cloud elements. Likewise, the threshold of Tl is low enough, so it also can ensure pixels with the threshold less than Tl are clear sky elements. We visualize hard constraint seeds to verify the reliability of automatically labelling seeds. Figure 2 shows the examples of automatically labeling hard constraint seeds in cloud images. The pixels with green are the seeds of cloud elements and pixels with red are the seeds of clear sky elements, from which we can see that these seeds belong to the truth class (cloud or clear sky).Figure 2
The examples of automatically labeling hard constraint seeds in the cloud images. The pixels with green are the seeds of cloud elements and the pixels with red are the seeds of clear sky elements.
(a)
(b)


### 2.2.2. Graph Cut Algorithm

After obtaining the hard constraint seeds, we conduct the graph cut algorithm. LetG={V,E} be a weighted undirected graph, where V are the nodes (the pixels of the cloud image) and E denote the edges connecting two nodes. Each edge in the graph is assigned a nonnegative weight we (cost). There are also two special nodes named terminals: the foreground and background terminals. A cut is a subset of edges so that each node is assigned to either of the terminals. The cost of a cut is usually defined as the sum of the costs of the edges [19]: (7)C=∑e∈C‍we.The cost function that we use as the soft constraints for segmentation should include region and boundary properties. LetP denote all the pixels in the image and N denote the set of pairs (p,q) where p and q are the neighboring pixels in P. The cost function E(L) for each segmentation can be defined as (8)EL=λ·RL+BL,where (9)RL=∑p∈P‍RpLp,BL=∑(p,q)∈N‍B(p,q)·δLp,Lq,δLp,Lq=1,ifLp≠Lq0,otherwise.The coefficient λ≥0 in (8) specifies the relative importance between the region cost R(L) and the boundary cost B(L). The region cost R(L) measures the individual penalty for labeling the pixel p as the foreground or background. Each pixel has two cost weights Rp(1) and Rp(0) corresponding to the case of connecting with the foreground and background, respectively. The boundary cost B(L) reflects the penalties for the discontinuity between neighboring pixels {p,q}. B(p,q) should be large when the values of pixels p and q are similar and B(p,q) is close to zero when the two pixel values are very different.In this paper,R(L) and B(L) in (8) are given as the following steps.(1)
Assume that we getn foreground seeds and m background seeds denoted by {Fore}n and {Back}m, respectively.(2)
For each pixelp, calculate its color feature distance to each seed, denoted as D{Fore}np and D{Back}mp, respectively.(3)
Rp(1) and Rp(0) can be calculated as follows:(10)Rp1=min⁡DForekp,k=1,2,…,n,Rp(0)=min⁡DBackkp,k=1,2,…,m.(4)
The boundary costB(L) is a decreasing function of the distance between pixels p and q. For a cloud image, we use the function:(11)B{p,q}=exp⁡-fp-fq22σ2,where fp and fq denote the feature vectors, and their values are R/B. σ is a factor which is set to 0.3 in this paper.To obtain the values of all the parameters, we consider how to solve this segmentation problem. The min-cut/max-flow algorithm in [21] is applied for solving (8), and [19] proved that this min-cut algorithm would give a segmentation minimizing among all segmentations.


## 2.2.1. Automatically Acquiring Hard Constraints

Since the ground-based cloud image is obtained from outdoor environment, the large illumination variations are inevitable. Moreover, vague boundaries between cloud and sky regions as the intrinsic characteristics of cloud image are ubiquitous. The above characteristics make cloud detection challenging. In this paper, we propose to automatically assign several pixels with high confidence as hard constraint seeds, which forms part of the foreground and background. As stated in Section1.1, color features are the primary characteristic for distinguishing cloud from clear sky. Based on this property, the hard constraint seeds are obtained as follows.(1)
A red-green-blue (RGB) cloud image is transformed into a single-channel feature image. Here, we useR/B as the feature image, which can increase the difference between cloud and clear sky and alleviate the illumination variations to some extent.(2)
According to (6), we can obtain hard constraint seeds with high confidence. Concretely, pixels with R/B value greater than Th are identified as cloud and the pixels with R/B less than Tl are identified as clear sky (6)i∈cloudpixels,RiBi>Th,i∈clearskypixels,RiBi<Tl.Here, i is the pixel of the cloud image and Th and Tl are the threshold parameters stated in Section 2.1.The strategy of automatically labeling hard constraint seeds is feasible in practice. Since the threshold ofTh is high enough, it can ensure pixels with the threshold larger than Th are cloud elements. Likewise, the threshold of Tl is low enough, so it also can ensure pixels with the threshold less than Tl are clear sky elements. We visualize hard constraint seeds to verify the reliability of automatically labelling seeds. Figure 2 shows the examples of automatically labeling hard constraint seeds in cloud images. The pixels with green are the seeds of cloud elements and pixels with red are the seeds of clear sky elements, from which we can see that these seeds belong to the truth class (cloud or clear sky).Figure 2
The examples of automatically labeling hard constraint seeds in the cloud images. The pixels with green are the seeds of cloud elements and the pixels with red are the seeds of clear sky elements.
(a)
(b)


## 2.2.2. Graph Cut Algorithm

After obtaining the hard constraint seeds, we conduct the graph cut algorithm. LetG={V,E} be a weighted undirected graph, where V are the nodes (the pixels of the cloud image) and E denote the edges connecting two nodes. Each edge in the graph is assigned a nonnegative weight we (cost). There are also two special nodes named terminals: the foreground and background terminals. A cut is a subset of edges so that each node is assigned to either of the terminals. The cost of a cut is usually defined as the sum of the costs of the edges [19]: (7)C=∑e∈C‍we.The cost function that we use as the soft constraints for segmentation should include region and boundary properties. LetP denote all the pixels in the image and N denote the set of pairs (p,q) where p and q are the neighboring pixels in P. The cost function E(L) for each segmentation can be defined as (8)EL=λ·RL+BL,where (9)RL=∑p∈P‍RpLp,BL=∑(p,q)∈N‍B(p,q)·δLp,Lq,δLp,Lq=1,ifLp≠Lq0,otherwise.The coefficient λ≥0 in (8) specifies the relative importance between the region cost R(L) and the boundary cost B(L). The region cost R(L) measures the individual penalty for labeling the pixel p as the foreground or background. Each pixel has two cost weights Rp(1) and Rp(0) corresponding to the case of connecting with the foreground and background, respectively. The boundary cost B(L) reflects the penalties for the discontinuity between neighboring pixels {p,q}. B(p,q) should be large when the values of pixels p and q are similar and B(p,q) is close to zero when the two pixel values are very different.In this paper,R(L) and B(L) in (8) are given as the following steps.(1)
Assume that we getn foreground seeds and m background seeds denoted by {Fore}n and {Back}m, respectively.(2)
For each pixelp, calculate its color feature distance to each seed, denoted as D{Fore}np and D{Back}mp, respectively.(3)
Rp(1) and Rp(0) can be calculated as follows:(10)Rp1=min⁡DForekp,k=1,2,…,n,Rp(0)=min⁡DBackkp,k=1,2,…,m.(4)
The boundary costB(L) is a decreasing function of the distance between pixels p and q. For a cloud image, we use the function:(11)B{p,q}=exp⁡-fp-fq22σ2,where fp and fq denote the feature vectors, and their values are R/B. σ is a factor which is set to 0.3 in this paper.To obtain the values of all the parameters, we consider how to solve this segmentation problem. The min-cut/max-flow algorithm in [21] is applied for solving (8), and [19] proved that this min-cut algorithm would give a segmentation minimizing among all segmentations.


## 3. Experimental Results

### 3.1. Database

One sensor node used to capture the ground-based cloud images is a digital camera equipped with a fisheye lens, which provides a field of view larger than180°. The camera is set to capture one cloud image per 15 seconds. More information about the camera can be found in [22]. In this paper, one database of such images captured from WSN is used. The square area of an all-sky image is considered and cropped as shown in Figure 1. Then each image is resized to 200∗200 pixels. A set of 500 images from different sensor nodes in WSN is constructed to evaluate the performance of our proposed method.


### 3.2. Methods in Comparison Study

In this paper, the proposed method is compared with three current cloud detection methods:(1) ratio threshold (Rad) [16]: we assign R/B=0.6 as the threshold. Specially, pixels with R/B>0.6 are classified as cloud, otherwise as clear sky; (2) difference threshold (Diff) [17]: we assign R-B=30 as the threshold. Concretely, pixels with R-B>30 are classified as cloud, otherwise as clear sky; (3) adaptive threshold (Adp) [1]: the threshold is calculated by the Otsu algorithm. In order to make the results comparable to others, we use R/B as feature image for all the experiments, and Th=0.9 and Tl=0.3, which ensure the hard constraint seed with high confidence, are given for only one sensor node.


### 3.3. Experimental Results and Analysis

To evaluate the effectiveness of the proposed algorithm for the cloud detection, we carry out a series of experiments on the database mentioned in Section3.1. Furthermore, meteorological experts manually segment the 500 cloud images into binary masks which are assigned as the ground-truth. Quantitative evaluations of all the above algorithms are performed as(12)NTcloud+NTskyN,where NTcloud and NTsky are the number of true cloud pixels and true clear sky pixels, respectively, and N is the total number of pixels in the ground-based image.Table1 shows the average detection accuracy of different algorithms in WSN, from which we can see that our algorithm obtains significant improvement on the performance. It is because our algorithm considers the difference of cloud image distributions from different sensor nodes and transfers knowledge in WSN. Based on the transfer learning algorithm stated in Section 2.1, our method assigns specific thresholds Th and Tl for each sensor node, while other methods use the same thresholds for all the sensor nodes. Thus, our method adapts to different weather conditions.Table 1
Average detection accuracy of different algorithms in WSN.
Rad
Diff
Adp
Ours
Precision (%)
67.23
68.43
72.67
83.26Table2 lists the detection performance by the four detection algorithms in one sensor node. We can see that our method achieves the highest detection accuracy. Figure 3 shows the results of some examples detected by the four algorithms. From the results, several conclusions can be drawn. First, the “Rad” and “Diff” algorithms are not adaptable for different sky conditions. Second, “Adp” algorithm cannot solve the conditions with nonuniform illumination. Third, the proposed algorithm obtains the best detection results in all weather conditions. In addition, we also compare the proposed algorithm with interactive graph cut which needs users to label hard constraint seeds manually. Figure 4 shows the detection results. We can see that the proposed algorithm achieves comparable detection results compared with the interactive graph cut, while our algorithm overcomes the shortcomings arising from manual labeling hard constraint seeds.Table 2
Average detection accuracy of different algorithms in one sensor node.
Rad
Diff
Adp
Ours
Precision (%)
76.53
75.46
80.32
85.79Figure 3
The experimental results of four different detection algorithms in one sensor node.Figure 4
(a) Original cloud image; (b) labeling hard constraint seeds automatically; (c) labeling hard constraint seeds manually; (d) the proposed AGC detection results; (e) interactive graph cut detection results.
(a)
(b)
(c)
(d)
(e)


## 3.1. Database

One sensor node used to capture the ground-based cloud images is a digital camera equipped with a fisheye lens, which provides a field of view larger than180°. The camera is set to capture one cloud image per 15 seconds. More information about the camera can be found in [22]. In this paper, one database of such images captured from WSN is used. The square area of an all-sky image is considered and cropped as shown in Figure 1. Then each image is resized to 200∗200 pixels. A set of 500 images from different sensor nodes in WSN is constructed to evaluate the performance of our proposed method.


## 3.2. Methods in Comparison Study

In this paper, the proposed method is compared with three current cloud detection methods:(1) ratio threshold (Rad) [16]: we assign R/B=0.6 as the threshold. Specially, pixels with R/B>0.6 are classified as cloud, otherwise as clear sky; (2) difference threshold (Diff) [17]: we assign R-B=30 as the threshold. Concretely, pixels with R-B>30 are classified as cloud, otherwise as clear sky; (3) adaptive threshold (Adp) [1]: the threshold is calculated by the Otsu algorithm. In order to make the results comparable to others, we use R/B as feature image for all the experiments, and Th=0.9 and Tl=0.3, which ensure the hard constraint seed with high confidence, are given for only one sensor node.


## 3.3. Experimental Results and Analysis

To evaluate the effectiveness of the proposed algorithm for the cloud detection, we carry out a series of experiments on the database mentioned in Section3.1. Furthermore, meteorological experts manually segment the 500 cloud images into binary masks which are assigned as the ground-truth. Quantitative evaluations of all the above algorithms are performed as(12)NTcloud+NTskyN,where NTcloud and NTsky are the number of true cloud pixels and true clear sky pixels, respectively, and N is the total number of pixels in the ground-based image.Table1 shows the average detection accuracy of different algorithms in WSN, from which we can see that our algorithm obtains significant improvement on the performance. It is because our algorithm considers the difference of cloud image distributions from different sensor nodes and transfers knowledge in WSN. Based on the transfer learning algorithm stated in Section 2.1, our method assigns specific thresholds Th and Tl for each sensor node, while other methods use the same thresholds for all the sensor nodes. Thus, our method adapts to different weather conditions.Table 1
Average detection accuracy of different algorithms in WSN.
Rad
Diff
Adp
Ours
Precision (%)
67.23
68.43
72.67
83.26Table2 lists the detection performance by the four detection algorithms in one sensor node. We can see that our method achieves the highest detection accuracy. Figure 3 shows the results of some examples detected by the four algorithms. From the results, several conclusions can be drawn. First, the “Rad” and “Diff” algorithms are not adaptable for different sky conditions. Second, “Adp” algorithm cannot solve the conditions with nonuniform illumination. Third, the proposed algorithm obtains the best detection results in all weather conditions. In addition, we also compare the proposed algorithm with interactive graph cut which needs users to label hard constraint seeds manually. Figure 4 shows the detection results. We can see that the proposed algorithm achieves comparable detection results compared with the interactive graph cut, while our algorithm overcomes the shortcomings arising from manual labeling hard constraint seeds.Table 2
Average detection accuracy of different algorithms in one sensor node.
Rad
Diff
Adp
Ours
Precision (%)
76.53
75.46
80.32
85.79Figure 3
The experimental results of four different detection algorithms in one sensor node.Figure 4
(a) Original cloud image; (b) labeling hard constraint seeds automatically; (c) labeling hard constraint seeds manually; (d) the proposed AGC detection results; (e) interactive graph cut detection results.
(a)
(b)
(c)
(d)
(e)


## 4. Conclusions

In this paper, we propose a novel transfer learning algorithm and a detection algorithm named adaptive graph cut (AGC) for segment ground-based cloud images in WSN. The transfer learning algorithm could compensate the difference of cloud image distributions captured from different sensor nodes. The AGC could automatically label pixels with high confidence as “cloud” or “clear sky,” and those labelled pixels serve as hard constraint seeds for the following graph cut algorithm. The experimental results show that the proposed algorithm not only achieves better results than state-of-the-art cloud detection algorithms in WSN, but also achieves comparable results compared with the interactive segmentation algorithm.



---

*Source: 947169-2015-10-11.xml*