AN OPTIONAL THRESHOLD WITH SVM CLOUD DETECTION ALGORITHM AND DSP IMPLEMENTATION

This paper presents a method which combines the traditional threshold method and SVM method, to detect the cloud of Landsat-8 images. The proposed method is implemented using DSP for real-time cloud detection. The DSP platform connects with emulator and personal computer. The threshold method is firstly utilized to obtain a coarse cloud detection result, and then the SVM classifier is used to obtain high accuracy of cloud detection. More than 200 cloudy images from Lansat-8 were experimented to test the proposed method. Comparing the proposed method with SVM method, it is demonstrated that the cloud detection accuracy of each image using the proposed algorithm is higher than those of SVM algorithm. The results of the experiment demonstrate that the implementation of the proposed method on DSP can effectively realize the real-time cloud detection accurately.


INTRODUCTION
With the recent rapid developments of optical remote sensor, obtaining high resolution remote sensing images is an easy task now.The amounts of remote sensing images increase explosively every day, and these data have been widely used in meteorological observation and forecast, agriculture engineering, environmental protection, natural disasters monitoring, resource exploration and military reconnaissance.However, the cloud covers more than 50% of the surface of the Earth, thus the images captured by satellite mostly covered with cloud.The object information on the earth will lost because of the cloud.Hence cloud detection is an important preprocessing for many subsequent manipulations, such as object recognition, image retrieval, and image classification.It is a meaningful a challenging work.On the other hand, onboard real-time cloud detection can reduce the cost of satellite resources such as storage capacity and downlink bandwidth. 1  A lot of cloud detection methods have been proposed, and most of these methods can be summarized in two major categories.The first category is based on the difference of spectral characteristics of clear and cloudy area.At the day time, the reflectivity of cloud area in the visible light band is greater than of clear area.At the same time, cloud top temperature is usually lower than the surface temperature, and the infrared thermal radiation field to outer space in the cloud areas is less than the cloud-free areas.Based on the facts mentioned above, a lot of cloud detection methods using remote sensing information have been developed.As early as 1994, based on the difference of clouds' spectral characteristics in the infrared and visible light, Yu Fan investigated the infrared-visible light spectra in two-dimensional feature space for about a hundred of cloud samples, and presented a method to determine the various types of clouds and the corresponding distribution of clusters using satellite cloud pictures.However, using this method to identify the multi-layer thin cirrus clouds is not satisfactory.The second category is based on the texture features of cloud.The mathematical methods include the pattern recognition, the clustering algorithm, maximum likelihood estimation method, neural network method and so on.Using these methods to identify the clouds and low clouds which have more complex shapes, the results are not satisfactory.The method using spectral characteristics which required a large amount of user interactions is not suitable for onboard real-time cloud detection.Hence, the method based on the texture features of cloud is adopted.This paper proposed a novel optional cloud detection algorithm.This algorithm has two steps: the first step, apply the improved minimum cross entropy method to process initially cloud detection test image, and then obtain a rough test results.The calculate speed of the threshold method can detect cloud sub-block quickly and easily.But the detection precision of threshold value method is not good; the preliminary test results which are under a lot of cushion face blocks have been mistaken for clouds.Thus, we need to do more sophisticated detection from the rightness rough cloud detection results.The second step is using the SVM classifier to do more sophisticated detection and obtain a more accurate cloud detection results.This algorithm used in this study greatly reduces the misjudgment and improves the detection accuracy.

AN OPTIONAL THRESHOLD WITH SVM CLOUD DETECTION ALGORITHM
There are three methods to detect cloud by using textural information: directly using textures; using textures to assist detection; and detecting using spectral images and then classifying by combining with textures in terms of certain hardly distinguished parts． This paper uses the third method.The image windows size directly affects the result of the cloud detection of support vector machine.When the image block is larger, the results will have more mistakes.When the block is smaller, the testing results of the cloud will be better.However, if the image block is too small, the speed of cloud detection will slow down.This paper combines the minimum cross entropy and the SVM to improve the cloud detection algorithm.
The process of the cloud detection algorithm proposed in this paper is shown as Figure 1.Using the threshold method to detect cloud will cost a little time, but the result is not good.And support vector machine (SVM) method will obtain a high accuracy of cloud detection, but the time consumption is higher.This paper firstly utilizes the threshold method to get a coarse result, and then uses the SVM method to obtain a more accurate result.By using this scheme, it not only improves calculating speed, but also gets a higher accuracy of detection.
Figure 1.Flowchart of the proposed cloud detection algorithm

Detection based on threshold method
The cloud regions generally have higher gray values than the non-cloud regions, because the reflectivity of cloud is usually lager than that of non-cloud regions.This is the basic theory of spectrum threshold method, which was applied to distinguish where 1 refers to those pixels lying in candidate cloud regions, and 0 refers to those pixels lying in non-cloud regions.The threshold T is within the range of [0,255].
The threshold method in this paper is minimum cross entropy thresholding method.The cross entropy was proposed by Kullback under the name of directed divergence.The cross entropy measures the information theoretic distance between two distributions are the set of gray levels.i h is the frequency of gray level, and is the probability of occurrence of gray level i .Suppose T is an assumed threshold, the image divide into two regions namely the object and the background with the threshold T. We assume that gray values in [0-T] constitute the object region, while those in [(T+1)-L] constitute the background.The cross entropy of a segmented image with threshold T is defined as: where The coarse cloud detection result is aim to obtain all cloud regions, and a few of non-cloud regions is allowed.The detection result using method of Otsu may lose too much cloud pixels.An optimal threshold method is proposed to address this problem, which is defined by Where T is the global threshold calculated by the minimum cross entropy threshold method; down

Optimization of SVM parameters
The

Hardware and platform
The whole experiment platform of cloud detection is shown in Figure 6.The DSP platform connects emulator through JTAG (Joint Test Action Group) interface (IEEE 1149.1) while the emulator connects PC through USB interface.The algorithm program of cloud detection was developed in CCS (Code Composer Studio) develop environment which is provide by Texas instruments in PC.This program would be downloaded to DSP platform through emulator after the writing process and compilation process were completed.Then the program of cloud detection is executed by DSP to complete cloud detection process.And the execution result would be stored in SDRAM of DSP platform.In order to see the detection result clearly and directly, the image data sorted in SDRAM could be uploaded to PC through emulator and displayed in the CCS develop environment in real time (see Figure 6).This platform is convenient to develop and debug in real time.TMS320DM642 adopts advanced Harvard structure (Figure 8).
The main characteristic of the Harvard structure is that the program memory and data memory are independent, which means they have independent buses.So it is possible to address the data memory and program memory at the same time.The advanced Harvard structure has cross connection between the data memory and program memory.Thus the transmission of data can be carried out between the program memory and data memory; and the CPU can perform the order of reading and writing operation in the same cycle.This feature would improve the data processing ability greatly.Another feature of the DPS is pipelined technology.The pipelined stage of TMS320DM642 is 3, which are fetch, decode and execute (see Figure 9).Ordinary CPU executes an instruction these three stages step by step.Pipelined DSP refers to overlapping operations by transferring data or instructions into a conceptual pipe with all stages of the pipe processing simultaneously.By using the pipeline mechanism, it is insurable that the DSP multiplication, addition and multiplication accumulator can be completed in a single cycle.It is important to improve the DSP operation speed, especially when we need to design a sequential algorithm of multiply accumulate operations.   1 The specification of TMS320DM642 When the system starts to work, FPGA will send a control signal to FIFO (First-in First-out memory) to get image data from interface.FIFO provides two independent ports with separate control, and I/O pins that permit independent, which realizes synchronous access for reading or writing.The use of FIFO is to store image data efficiently and avoid the conflict in data bus.
In the process of data processing, a large amount of data needs to transmit between CPU and storage.In order to increase the image data processing speed, EDMA (Enhanced Direct Memory Access) transmission mode of the DM642 chip was used sufficiently.The biggest advantage of EDMA is that it can directly access storage when CPU is processing data.The work flow of the EDMA is shown as Figure 10.The EDMA waits a trigger signal which is generated by FPGA after being initialized and configured.Once a trigger signal sends to EDMA, it would start to transmit data.Then the EDMA will be waiting for the next trigger signal after the transmission has been done.The inputting image in FIFO then will transfer to Synchronous dynamic random access memory (SDRAM) through EDMA, and CPU of DM642 will carry on image processing algorithm by accessing the data of SDRAM.At last, The processed image in SDRAM transfers to FIFO.

Comparisons
In order to illustrate the performance of cloud detection method, the quantitative method is adopted to verify the experimental results described above.We use the following two formulas to test cloud detection accuracy and detection error.As can be seen from table 2, the results of two detection algorithms have the accuracy over 84%.However, the accuracy of each image in the proposed algorithm is higher than that of SVM algorithm.
The detection error is obtained by using Eq.7 is as shown as

CONCLUSION
This paper presents a real-time onboard cloud detection method on basis of DSP.The proposed method combines traditional threshold method with the SVM method.The results show that the proposed method of this paper can detect cloud more accurately and more quickly.Moreover, in most case, the cloud region and non-cloud region can be classified efficiently and accurately using the proposed method.But the false detection and missed detection are still existed.The false detection is mainly caused by snow, which is because that the spectral feature and the texture feature of snow are strikingly similar to those of cloud.The missed cloud detection mainly results from cloud edges.The cloud edges change sharply and have more details which were more like the feature of the non-cloud region.
the cloud and land (Desbois, 1981).Assuming   , xy is one pixel of the image,   , f x y represents the gray value of   , xy .The cloud detection result R is defined by

Figure 2 .
Figure 2. Statistics of gray value of cloudy images.(a) Parts of collected cloud image from Landsat-8.(b) Histogram of the cloud pixels.(c) Corresponding cumulative histogram of (b).
SVM classification is utilized to get a finer cloud detection result.At the first, we let the Radial Basis Function (RBF) has the kernel width parameter C and  in a certain range of values.Then, the training set is set as original dataset, and the k-fold cross validation method is used to get the accuracy rate of the training set under the given parameter C and  .Finally, the group of parameters C and  which verify the classification accuracy of training highest is adopted as the best parameters.The k-fold cross validation method is described as follow: the original sample is randomly partitioned into k equal size subsamples.Among the k subsamples, a single subsample is retained as the validation data to test the model, and the remaining k -1 subsamples are used as training data.The cross-validation process is repeated k times, with each of the k subsamples used once as the validation data.The k results can then be averaged (or otherwise combined) to produce a single estimation.The advantage of this method repeated random sub-sampling (see below) is that all observations are used for both training and validation, and each observation is used for validation exactly once.To train the SVM, a training set should be established.300 cloud sub-images and 600 non-cloud sub-images were selected from the landsat-8 satellite images as the training set, and the size of each sub-image is 64×64.Both the parameter C and  range from 2 ^10 ~2 ^10  .At first, we get a coarse selection of parameters, and then train the SVM again to get final selection of parameters from the coarse result.Finally, the best parameter calculated is that C=0.01 and 7 the coarse cloud detection result was sent to the SVM classification to get final cloud detection result.As seen in the binary coarse cloud detection result, some non-cloud regions which have high intensity are included.In the second detection stage, these non-cloud regions are removed to achieve better results utilizing SVM classification.SVM detection comparisons.(a) Result before optimization.(b) Result after the optimization.

Figure 6 .
Figure 6.(a) The whole experiment platform of cloud detection.(b) DSP platform.(c)Emulator 3.1.1DSP platform：In order to realize the cloud detection from satellite image, a real-time onboard system based on DSP was presented in Figure 7.The core compute unit of system is TMS320DM642, which has the characteristics of modular、 flexible design and scalability and maintainability.TMS320DM642 adopts advanced Harvard structure (Figure8).The main characteristic of the Harvard structure is that the program memory and data memory are independent, which means they have independent buses.So it is possible to address the data memory and program memory at the same time.The advanced Harvard structure has cross connection between the data memory and program memory.Thus the transmission of data can be carried out between the program memory and data memory; and the CPU can perform the order of reading and writing operation in the same cycle.This feature would improve the data processing ability greatly.Another feature of the DPS is pipelined technology.The pipelined stage of TMS320DM642 is 3, which are fetch, decode and execute (see Figure9).Ordinary CPU executes an instruction these three stages step by step.Pipelined DSP refers to overlapping operations by transferring data or instructions into a conceptual pipe with all stages of the pipe processing simultaneously.By using the pipeline mechanism, it is insurable that the DSP multiplication, addition and multiplication accumulator can be completed in a single cycle.It is important to improve the DSP operation speed, especially when we need to design a sequential algorithm of multiply accumulate operations.

Figure 7 .
Figure 7. Cloud detection hardware system

Figure 10 .
Figure 10.Work flow of EDMA 3.1.2Emulator ： Real-time system needs the real-time debugger.Real-time debugger must get the information from target CPU and control the program running on target CPU without stopping the program running on the target CPU.The TDS560USB PLUS emulator manufactured by Wintech Digital Systems Technology Corp is utilized to build a real-time communication channel between the debugger and the target CPU.There are two kinds of interfaces of TDS560USB PLUS emulator, JTAG interface for connecting DSP platform and USB interface for connecting PC.It fully plugs and plays compatibly.There are many features of the emulator: 1) high speed of real-time data exchanging (HS-RTDX) bandwidth is over 2Mb/s; 2) code download speed is up to 512K/s; 3) wide dynamic operating voltage is 1.0 to 5.0 volts 3.2 Data set A series of experiments have been done to demonstrate the effectiveness of proposed cloud detection algorithm.The data is acquired from the LandSat-8.The data in B4 band (wavelength: 0.63-0.68m  ), B3 band (wavelength: 0.52-0.60m  ) and B2 band (wavelength: 0.45-0.52m  ) were chosen to do the experiments.The training samples are trained on PC with Intel Quad-Core CPU i5-3450 at 3.1 GHz and 4-GB RAM.The proposed cloud detection algorithm executed as demonstrated above.In order to evaluate the effectiveness of proposed cloud detection algorithm, our method were compared with other cloud detection methods.3.3 The result of cloud detection 3.3.1 Coarse cloud detection result ： The coarse cloud detection step is shown as figure 11.The true color image firstly was transformed to gray scale image, and then gray value is adopted as image feature.Gray value is a key parameter to distinguish the cloud and cloud-free pixels roughly.Then we utilized the proposed threshold method to get a coarse cloud detection result.

Figure
Figure 11.Procedure of coarse cloud detection

Figure 14 .
Figure 14.Detection comparisons.(a) Input image.(b) Binary result of SVM.(c) Detection result of SVM.(d) Binary result of proposed method (e) Result of proposed method Using the formula above to calculate the accuracy of each figure in the experiments, the results of each algorithm are shown as Table 2

Table 1 .
The chip can reach 5760 MIPS (Million Instruction per Second) when it works at the frequency of 720MHz.It is capable to handle huge data at a real time.The whole system is controlled by Field Programmable Gate Array (FPGA), which provides interrupt and control signals to arrange the input and output of the image data.The program of FPGA can be reconfigured through JTAG interface to extend the function easily and flexibly.This feature improves the adaptability and flexibility of the whole system.

Table 3
Detection error