A New Method Based on Two-Stage Detection Mechanism for Detecting Ships in High-Resolution SAR Images

. Ship detection in synthetic aperture radar (SAR) remote sensing images, being a fundamental but challenging problem in the field of satellite image analysis, plays an important role for a wide range of applications and is receiving significant attention in recent years. Aiming at the requirements of ship detection in high-resolution SAR images, the accuracy, the intelligent level, a better real-time operation and processing efficiency, The characteristics of ocean background and ship target in high-resolution SAR images were analyzed, we put forward a ship detection algorithm in high-resolution SAR images. The algorithm consists of two detection stages: The first step designs a pre-training classifier based on improved spectral residual visual model to obtain the visual salient regions containing ship targets quickly, then achieve the purpose of probably detection of ships. In the second stage, considering the Bayesian theory of binary hypothesis detection, a local maximum posterior probability (MAP) classifier is designed for the classification of pixels. After the parameter estimation and judgment criterion, the classification of pixels are carried out in the target areas to achieve the classification of two types of pixels in the salient regions. In the paper, several types of satellite image data, such as TerraSAR-X (TS-X), Radarsat-2, are used to evaluate the performance of detection methods. Comparing with classical CFAR detection algorithms, experimental results show that the algorithm can achieve a better effect of suppressing false alarms, which caused by the speckle noise and ocean clutter background inhomogeneity. At the same time, the detection speed is increased by 25% to 45%.


Introduction
Synthetic aperture radar (SAR) is known as a kind of advanced active microwave sensors, with its all-weather, all-day, multi-polarization, multi-band advantage, has been increasingly paid attention to by all countries seeking to detection technology in remote sensing. Compared with optical and infrared sensors, SAR is not affected by lighting, climate and other conditions, the imaging patterns are rich, SAR can satisfy the different requirements of ships detection [1]. Target monitoring based on SAR has developed into a common detection technology in remote sensing images. Currently, the spaceborne SAR has gradually become the first choice of ships monitoring because of its all-day, all-weather work capacity and wide-area detection capability [2].
As the basis of its classification and identification, ship detection in SAR images is always an important aspect of SAR application [3]. The principle of ship target detection in SAR images is to segment and extract objects from the input image based on the difference between the scattering characteristics of target areas and background areas. At present, a large number of ship target detection algorithms for SAR images have been developed. However, with the successful launch of TerraSAR-X (TS-X), Radarsat-2, Mark three and other next-generation SAR sensors, SAR is gradually evolving towards higher resolution, larger width, and more multipolar directions. Traditional detection system in lowresolution SAR images can not interpret and analysis complex features of high-resolution SAR images timely and effectively. Common as traditional CFAR detection method in complex ocean can not meet the real-time detection requirements due to the high false alarm rate [4,5]. For high-resolution SAR images showing characteristics different from the low-resolution SAR images, ship target detection method is now widely used statistical models based on distributed targets [6], such as CFAR detection algorithm and its improved algorithm, including CA-CFAR, SO-CFAR, GO-CFAR, OS-CFAR, etc. However, these detection algorithms have a strong pertinence, the current research lacks detection models and detection algorithms with versatility and robustness.
At present, the main problems in the field of ship target detection in SAR images are: Firstly, as the size of the images grows, the processing speed of the algorithm based on point-by-point calculation in images becomes slow, and it is difficult to achieve the requirement of realtime processing [7,8]. What's more, there is a contradiction between the large information amount of SAR image and the limited computer processing power, there is an urgent need to find a fast detection method [9].
Finally, the quality of SAR images is getting closer to the same kind optical images, and the characteristics of the image is more prominent. Therefore, more and more learning methods can be used to classify the SAR images with different characteristics [9,10].
To solve above questions, we proposes a ship detection algorithm in high-resolution SAR images based on two-stage detection mechanism.

Detective Theory Based on Improved SR Visual Attention Model
Although the research of computer vision has made great progress in recent years, a series of achievements have been obtained. However, the ability of human eye to process and analyze information on the realistic scene is still more efficient. Consequently, scholars continue to study human visual perception system, and try to put forward the mathematical model to simulate human visual perception system. Currently, commonly used visual model [11]: ITTI model and AIM model and spectral residual model.
Considering the computational complexity of the first two visual models is high, it is not conducive to the construction of real-time application system, especially when it is applied to high-resolution SAR images, it is difficult for the models to get saliency maps quickly.
In general, it is necessary to adopt a global search method to obtain a better real-time detection algorithm. This method also reduces the search cost of local traversal [12]. In [13], a method extracting visual salient regions based on image frequency domain is proposed, which is spectral residual (SR). Compared with other visual models, the SR method is a global pattern of visual salient regional extraction, the processing of the model is based on the frequency domain, and is implemented by fast Fourier transform, which has the advantages of simple and fast calculation. The basic idea of the method is that: the logarithmic amplitude spectrum of most natural images has approximately identical shape, Therefore, in the spectrum of an image, the parts that are different from the identical shape is the spectral residual parts that contain the target information.
Assuming I(x) is an image, the spectrum of the image is decomposed into two parts: amplitude spectrum A(f) and phase spectrum P(f).
A low-pass filter and the logarithmic amplitude spectrum of the image are convolved to calculate, and the amplitude spectrum is smoothed. and subtracts the logarithmic amplitude spectrum of the original image, and the spectral residual value is obtained.
Combining the spectral residual and phase spectrum that have been obtained, we can get the saliency map of original image. The spectral residual is calculated as: (5) Among them, FFT and FFT -1 represent the fast Fourier transform of the image and its inverse transform; h n (f) is a low-pass filter in the frequency domain, such as a mean filter; g(x) is a low-pass filter in the time domain, a Gaussian smoothing filter can be used; A(f), P(f), L(f) are the amplitude spectrum, the phase spectrum, and logarithmic amplitude spectrum of original image, respectively; R(f) is the spectral residual; S(x) is the saliency map.
We can see that, when calculating spectral residuals, the phase spectrum of original image is a key factor. Relative to the logarithmic amplitude spectrum, the phase spectrum is a real contribution to the saliency map, based on this, the SR method is improved. The new visual attention calculation model is: Where: BP(f) refers to band-pass filter; P N (f) is the phase spectrum of original image; R N (f) is the spectral residual.
In this paper, in the selection of the filter BP(f), a Gaussian filter with center frequency (f 0 ) and cutoff frequency (∆f) is selected.
is the saliency map. The calculation of improved spectral residual model mainly includes two steps: normalization of the original spectrum and bandpass filtering in the frequency domain.
Compared with the previous SR method, the improved SR method does not need to do calculation of logarithmic amplitude spectrum and low-pass filtering, also does not need to do the exponential operation in the frequency domain and the Gaussian filtering in the time domain, thus this can greatly improve the computational speed. The improved method consists of two control parameters f0 and ∆f, the parameters can be adjusted according to the characteristics of targets, so this visual model has a certain adaptability. Finally, the original SR model and the improved SR model are compared and analyzed through the experiment. . Thus, the similarity of the two salience maps is further illustrated, and it is found that the gray scale difference near the coordinates of the ships is more prominent. Therefore, it can be concluded that the new spectrum calculation model increases the signal-to-noise ratio of targets to a certain extent.
In general, the gray value of targets in SAR images are higher than the gray value of the pixels of background in their adjacent area. Therefore, the potential area of the ship targets is generally included in visual salient regions that have been obtained in the previous step, the method of extracting this salient regions can greatly reduce the amount of data in the subsequent local traversal detection, but also to a certain extent, improve the practical performance of the detection algorithm [14].

Design of Algorithm for Detecting Ships in SAR Images
This paper analyzes the characteristics of the clutter in background and target in high-resolution SAR images, and we consider the visual attention detection theory, A ship target detection algorithm in SAR images is proposed. The first step designs a pre-training classifier based on improved spectral residual visual model to obtain the visual salient regions that contain ships quickly, then achieve the purpose of probably detection of ship targets; In the second stage, considering the binary hypothesis tests in Bayesian theory, a local maximum posterior probability (MAP) classifier is designed for the classification of pixels, After the parameter estimation and judgment criterion, the classification of pixels are carried out in the target areas to achieve the classification of two types of pixels in the salient regions. The flow chart is shown in Fig. 3.

Extraction of Region of Interest Based on Improved Visual Model
In most cases, ships are sparsely distributed on the sea.  When dealing with SAR images, the general detection algorithms usually spend much time in sea areas, which reduce the efficiency of detection. Thus we consider the idea of visual attention mechanism in frequency domain of image: frequent information in the image does not have visual saliency, compared to these frequent information, ships and other new information can catch more attention of human eye [15,16]. Thus, visual saliency detection is used for ship detection to achieve rapid extraction of visual salient regions in the image. The first stage of the algorithm is the extraction of the region of interest under the visual attention mechanism, and the saliency map is obtained and processed by the improved SR method. In the process, we mainly carry out two steps: one is the extraction of the region of interest; and the other is the binarization of saliency map.
Thus, we perform two threshold segmentation operations. Firstly, the visual salient regions are segmented by T0, in order to screen out the significant areas that contain potential ships. 0 ( , ) , The pixel belong to the region of interest x i j T  (10) The second threshold segmentation is done by setting two thresholds T 1 , T 2 , (T 1 <T 2 ), pixels in the saliency map are segmented, so as to complete the approximation of gray scale histogram in target areas and background areas more accurately.

Ship Detection Based on Local MAP Classifier
From the perspective of classification, the problem of ships detection is a classification of two categories of targets. In order to achieve further work on the detection of ship targets in visual salient regions of image, this paper designs a local MAP classifier.

Local MAP Classifier
According to Bayesian theory, the object detection is actually a binary hypothesis test of the data vector x, so as to detect whether the target exists. Data samples are divided into two categories, The categories of samples are ω 1 and ω 0 , Assume that P(ω i ) is the prior probability that the input pixel belongs to ω i. Therefore, what we can get from the Bayesian criterion for binary hypothesis test is that: Where: P(ω 1 |x) and P(ω 0 |x) refer to the posterior probability of the detected pixel belongs to the target and the background, respectively; P(x|ω i ) is the conditional probability under given class ω i ; P(x) refers to the probability of acquiring the pixel. According to the Bayesian criterion and the MAP criterion, our classifier can be defined as: When the target exists, the condition is met: The criterion of the Local MAP classifier is: In order to be able to use the Local MAP classifier for target detection, The conditional probability of the input pixels in a given category (P(x|ω i )), and the prior probability of the corresponding category of the input pixels (P(ω i )) must be obtained.

Parameter Estimation of The Classifier
Calculate the conditional probability of the input pixels in the given two categories P(x|ω i ), that is, the probability density function of the target areas and the background. In high-resolution SAR images, ship targets present the morphological characteristics of distributed targets, the salient regions of the saliency map also present a distributed characteristic, The more significant the pixels are, generally, the more likely the target pixels are. Thus, a larger division threshold T0 is set to split the saliency map. Then extract pixels larger than the division threshold (The segmentation threshold for this step is T 2 ) in the region, and obtain the probability distribution of their gray histogram, finally fit distribution of ships. Correspondingly, we extract the pixels that is smaller than the threshold T 1 , and the histogram of their gray value is used as the approximation of the background probability density. In general, the local CFAR detection methods require to calculate the distribution of all local regions in background areas. In this paper, the use of this global approach is better approached the actual distribution of the target and background areas, but also reduces the amount of calculation. Under normal circumstances, methods complete the target detection based on the difference of target and background, we need to calculate the distribution of the background to obtain an adaptive division threshold. In this paper, we use a sliding window to obtain the prior probability of the input pixels belongs to ωi, so as to complete local adaptive detection. The prior probabilities P(ω i ) are defined as: Where: x t is the gray value of the detected pixel currently, and x 1 , x 2 ,...,x N are the pixels that belongs to background areas in the sliding window; / c a G  , G is the maximum gray scale of the image; 0<a≤1, a is an empirical parameter for adjusting the prior probability.
Combining with the prior probabilities and conditional probabilities, the algorithm performs secondary detection on the potential target areas.

Experimental Analysis
This section carries out the target detection experiment on the basis of visual saliency and local classifier theory. Considering TS-X image is a typical high-resolution SAR image, several representative TS-X images are selected. Compared with classical detection algorithms, the advantages and disadvantages of this algorithm are analyzed.

Evaluation Index of Detection Results
In order to verify whether the algorithm is valid to SAR images with a wide range of complex ocean conditions, strong speckle noise, A TS-X image was selected as the experimental data, whose pixels is 5517×3712. the imaging area is Strait of Gibraltar, the sampling rate of this image is 1.25 meters, the polarization mode is HH polarization, the distribution of sea in this area is complex and there are a lot of ships and strong speckle noise. Where contains a certain area of non-uniform ocean background. In this area, the comparative analysis of optical remote sensing satellite data in this region, combining with GPS and AIS data analysis, we collect and sort out the geographical information of the Strait of Gibraltar, and determine the number and location of ships in SAR image data, and improve the objectivity of evaluation in experimental results. For better evaluation of detection algorithms, define the quality factor [17]:

Experimental Results and Evaluation Analysis
In order to analyze the detection performance of the algorithm, the classical two-parameter CFAR detection algorithm and the CFAR detection algorithm based on the local K distribution are selected respectively.
The simulation experiment data used in this paper is shown in Figure 4 (a), which contains a large number of non-uniform sea background and different sizes of ship targets, and there is still a certain area of land area. Figure  4  Firstly, a saliency map is calculated using the improved spectral residual method. Figure 5 (a) is a saliency map of the experimental image, for the detected image in the experiment, the variance parameter of Gaussian filter is set to 0.25. It can be seen from the figure that the saliency map retains the obvious target of visual cognition, and also eliminates the big land areas. Through the two threshold segmentation operations in the saliency map, the potential region extraction of the ship target is completed, and the fitting of the histogram in the background and the target areas is completed, the simulation results are shown in Figure 5. In this paper, when completing the global approximation extraction operation in the background and target areas, two thresholds are used to segment the signal to achieve more accurate approximation. When the saliency map is divided by the thresholds, the thresholds are adjusted according to the image. For the experimental image, the first threshold T0 is set to 28, to complete potential target areas extraction from the original image. The second threshold combination contains two thresholds, The larger threshold T 1 is set to 50, and the smaller threshold T 2 is set to 65. The approximate background area is obtained by segmenting the image by threshold value T 1 , and similarly, the approximate target region is obtained by segmenting the image by threshold value T 2 . distribution, the Rayleigh distribution are used to fit the distribution of target areas and background, and the conditional probability density is obtained in the local MAP classifier. Then, a sliding window is used to calculate the prior probability of potential ship regions. The design of the sliding window need to consider the pixel count, size and distribution of ship targets in SAR images, For the experimental image in this paper, the size of the window is set to 180×180, the window slides in steps of 90 pixels, the empirical parameter c takes 4×10-6. Fig. 7 shows the final results by local classifier detection. The two-parameter CFAR algorithm is based on the assumption that the sea clutter obeys the Gaussian distribution. At present, a large number of studies have confirmed that: To some extent, the Gaussian distribution can effectively simulate the background variation of marine clutter, and its sliding window technology has a good adaptability to the local variation of marine clutter background. The CFAR ship detection algorithm based on the logarithmic normal distribution is a CFAR detection algorithm which assumes that the sea clutter obeys the logarithmic normal distribution. The radar imaging mechanism explains the good fitting effect of the logarithmic normal distribution used for the statistical model of sea clutter. These two algorithms are representative, are used in the existing mature detection system relatively.
Experiments were performed by using experimental image, table 1 shows the comparison of these three different algorithms, They are the two-parameter CFAR algorithm and the CFAR algorithm based on logarithmic normal distribution and the algorithm proposed in this paper. the false alarm rate of the two-parameter CFAR detection algorithm is 10 -4 , the false alarm rate of CFAR detection algorithm based on logarithmic normal distribution is set to 10 -6 . It can be seen from the table: two-parameter CFAR detection algorithm missed some ship targets, and existed seven false alarm targets, the algorithm runs for a longer time. The advantages of the two-parameter CFAR algorithm are the relatively simple parameters estimation for Gaussian distribution. However, The fitting degree of Gaussian distribution to sea clutter is not high when the sea surface is complex, Moreover, although the parameters are simple to estimate, but it also take a lot of time; The CFAR ship detection algorithm based on logarithmic normal distribution detected all the real ships, but there are five false alarm targets, and ran the longest time. Although the fitting degree of logarithmic normal distribution to the sea clutter is improved, the time spending on the parameters estimation and the calculation of the probability distribution function is relatively long. Compared with the above two methods, The experimental results show that the proposed algorithm is very fast and effective. The reason is that, in visual attention calculation, the frequency of the land is higher relative to ship targets. Therefore, this paper does not need to pretreat the land and sea segmentation, but use the visual model gets regions of interest in image directly, Then through a MAP classifier, this has a higher detection efficiency and a lower false alarm rate than the target detection on the original image. Figure 8 shows the details of ship detection results. (a) is the partial slices of ship detection results based on local logarithmic normal distribution, and (b) is the result of partial slices of the algorithm presented in this paper. The results of the local log-normal algorithm are ambiguous in the edge of ships, and there are more "small false alarms", so it is difficult to describe the ship contour accurately in the morphological bridging operation. The pixels in detail slices generated by our algorithm are relatively concentrated, it is conducive to maintaining the shape of ships.
a. The detail slices of Log-normal CFAR detection results b. The detail slices of the detection results in the paper Fig 8. Comparison of detection results

Conclusions
This paper analyzed the statistical characteristics of sea clutter and the basic theory of targets classification under different sea conditions, The performance of common detection classifiers was simulated and analyzed in the uniform clutter environment and interference target environment. The paper focuses on the problem of their poor performance when the classical CFAR detection algorithms are applied to high-resolution SAR images with complex background, A new method based on twostage detection mechanism for detecting ship targets in high-resolution SAR images is presented in the paper. In the end, a number of detection experiments were performed in TS-X images with a complex background, The results show that the proposed algorithm has a good balance between the false alarm rate and the leakage alarm rate in the detection, and has a great advantage in the detection of ship targets in SAR image. The next phase of research is: (1) If there are many smaller islands and land areas in the detection scenario, pretreatment of land removal is required. In summary, the elimination of land areas is another important focus of research; (2) When carrying out the calculation of visual vision saliency in the frequency domain, it is necessary to further improve the parameter setting of the band-pass filter according to the image characteristics of the ships, to find the filter with relatively strong applicability; (3) In the next stage, we will learn from the ideas of biological awareness, machine learning, and design and improve the performance of ship detection algorithm.