3.2.1. Adaptive Initialization Algorithm Based on Data Field

The dataset *R* is defined as *R* = {*R*1, *R*2, ··· , *RN*} in the data space Ω. The *i*th data point is defined as *Ri* = (*Ri*1, *Ri*2, ··· , *RiD*), *N* is the size of *R*. *D* is the dimension of a data point. Every data point in *R* interacts with the data points around it. In this way, a data field is formed according to the interaction of different data points. The interaction between different data points is measured by potential functions in the data field. Generally, the closer data points have stronger interaction and greater potential. In contrast, the further data points have weaker interaction and lower potential. The potential function is defined as:

$$\varphi\_{R\_{i1}R\_{i2}} = m\_{R\_i} e^{\frac{-\left\|\frac{R\_i - R\_s}{\sigma^2}\right\|^2}{\sigma^2}} \tag{10}$$

where *ϕRi*1*Ri*<sup>2</sup> is the potential of the data point *Ri* = (*Ri*1, *Ri*2) at the threshold *R*∗, *Ri*<sup>1</sup> is the grey value of the *i*th pixel in the underwater sonar image. *Ri*<sup>2</sup> is the average of the grey values of pixels in the neighborhood window. The neighborhood window centre is the *i*th pixel. *mRi* is the frequency corresponding to the *i*th pixel in the two-dimensional histogram of the underwater sonar image. *Ri* − *R*<sup>∗</sup> is the Euclidean distance and *σ* is the impact factor.

Furthermore, in the data field, the sum of the potential of all data points at the threshold *R*<sup>∗</sup> is defined as:

$$\varphi = \sum\_{i=1}^{N} m\_{R\_i} e^{\frac{-\left\|\vec{R\_i} - \vec{R\_\*}\right\|^2}{\sigma^2}} \tag{11}$$

where *N* is the number of total pixels in the underwater sonar images.

The influence radius of every data point is <sup>√</sup>3*<sup>σ</sup>* <sup>2</sup> in the data field [23]. Therefore, when calculating *<sup>ϕ</sup>*, the data points at work are in the region *<sup>O</sup>*, of which its centre is *<sup>R</sup>*<sup>∗</sup> and the radius is <sup>√</sup>3*<sup>σ</sup>* 2 . On this basis, *ϕ* is redefined as

$$\varphi = \sum\_{R\_i \in O} m\_{R\_i} e^{\frac{-\|R\_i - R\_\*\|^2}{\sigma^2}} \tag{12}$$

The impact factor *σ* is a significant parameter. It is closely related to *ϕ*. The relatively large *σ* means that *ϕ* is relatively close, which makes the initialization algorithm easy to fall into the local optimal solution during the iteration. In contrast, the relatively small *σ* means that *ϕ R*<sup>∗</sup> is relatively close to 0, which also affects the subsequent solution of optimal threshold. To accurately calculate the optimal threshold, *σ* is redesigned.

*Remote Sens.* **2019**, *11*, 396

According to the criterion:

$$P(\mu - 3\sigma \le K \le \mu + 3\sigma) = 0.997\tag{13}$$

where *K* is the possible grey levels in the underwater sonar image and *μ* = *<sup>L</sup>* <sup>2</sup> . *L* is grey levels in the underwater sonar image. *σ* is defined as:

$$
\sigma = \frac{6}{L} \tag{14}
$$

According to the principle of the data field [23], when the uncertainty is the smallest, the potential can perfectly reflect the distribution of data points in Ω. The uncertainty is usually described as the entropy. The optimal threshold is calculated by entropy. The size of the data field is *L* × *L*, the scope of *R*<sup>∗</sup> is 0 ≤ *R*∗<sup>1</sup> ≤ *L* − 1, 0 ≤ *R*∗<sup>2</sup> ≤ *L* − 1. Data points in the data field are divided into two classes: *A* = {(0, 0), ··· ,(*R*∗1, *R*∗2)} and *B* = {(*R*∗<sup>1</sup> + 1, *R*∗<sup>2</sup> + 1), ··· ,(*L* − 1, *L* − 1)}. The entropy of *A* and *B* are respectively expressed as follows:

$$H(A) = -\sum\_{i1=0}^{R\_{\ast 1}} \sum\_{i2=0}^{R\_{\ast 2}} \frac{\varphi\_{R\_{i1}R\_{i2}}}{\Psi\_A} \log \frac{\varphi\_{R\_{i1}R\_{i2}}}{\Psi\_A} \tag{15}$$

$$H(B) = -\sum\_{i1 = R\_{\ast 1} + 1}^{L - 1} \sum\_{i2 = R\_{\ast 2} + 1}^{L - 1} \frac{\varrho\_{R\_{i1} R\_{i2}}}{\Psi\_B} \log \frac{\varrho\_{R\_{i1} R\_{i2}}}{\Psi\_B} \tag{16}$$

where <sup>Ψ</sup>*<sup>A</sup>* <sup>=</sup> *<sup>R</sup>*∗<sup>1</sup> ∑ *i*1=0 *R*∗<sup>2</sup> ∑ *i*2=0 *<sup>ϕ</sup>Ri*1*Ri*<sup>2</sup> , <sup>Ψ</sup>*<sup>B</sup>* <sup>=</sup> *<sup>L</sup>*−<sup>1</sup> ∑ *<sup>i</sup>*1=*R*∗1+<sup>1</sup> *L*−1 ∑ *<sup>i</sup>*2=*R*∗2+<sup>1</sup> *ϕRi*1*Ri*<sup>2</sup> .

The sum of posterior entropy in the data field is defined as:

$$H(R\_\*) = H(A) + H(B) \tag{17}$$

When the maximum of *H*(*R*∗) is obtained, *R*<sup>∗</sup> is the optimal threshold.

AIA-DF is proposed in this paper according to Equations (12)–(17). The initialization algorithm adaptively calculates initial clustering centres in population space on the basis of the characteristics of the underwater sonar images. It improves the disadvantages that the initial cluster centers are randomly generated in the solution space and effectively avoids the prematurity of detection algorithm.

The influence region *O* of the optimal threshold is limited because of the influence radius. Besides, in the data field, the distribution of potentials has different characteristics in different underwater sonar images. Therefore, the optimal threshold is also different to some extent.

*U* = {(*R*∗1, *R*∗2)|0 ≤ *R*∗<sup>1</sup> ≤ *L* − 1, 0 ≤ *R*∗<sup>2</sup> ≤ *L* − 1 } is the initial scope of threshold *R*∗. When the optimal threshold is obtained, the grey value is randomly selected in region *O* for initializing the clustering centres. The update formula for *U* is given as:

$$
\mathcal{U}l(num+1) = \mathcal{U}l(num) - \mathcal{U}\*\tag{18}
$$

where *num* is the number of optimal thresholds currently obtained.

*U*\* is defined as::

$$ML\* = \left\{ \begin{array}{l} \left( \mathbb{R}(num+1)\_{\*1}, \left( \mathbb{R}(num+1)\_{\*2} \right)\_{\*2} \right)\_{\*2} \\\hline Rmum\_{\*1} - \frac{3\sigma}{\sqrt{2}} \le \mathbb{R}(num+1)\_{\*1} \le Ruum\_{\*1} + \frac{3\sigma}{\sqrt{2}} \\\ Rmum\_{\*2} - \frac{3\sigma}{\sqrt{2}} \le \mathbb{R}(num+1)\_{\*2} \le Ruum\_{\*2} + \frac{3\sigma}{\sqrt{2}} \end{array} \right\} \tag{19}$$

When the value of *<sup>R</sup>*(*num* <sup>+</sup> <sup>1</sup>)∗<sup>1</sup> and *<sup>R</sup>*(*num* <sup>+</sup> <sup>1</sup>)∗<sup>2</sup> are less than 0 or larger than *<sup>L</sup>* <sup>−</sup> 1, the update process of *U* is over. AIA-DF is described in Algorithm 2.

#### **Algorithm 2: the proposed AIA-DF**

Input: Denoising image;

Output: Initialized image;

Initialization: *s* (the radius of the neighbourhood window), *num* (the number of the optimal threshold), *U* (the set of optimal threshold potential solutions);

Procedure:

1: For every pixel in the input image, do:

2: Calculate the mean grey of its neighbourhood;

3: Establish the two-dimensional grey histogram of the input image;

4: Establish the data field according to the grey histogram;

5: repeat:

6: Calculate the entropy of *H*(*A*) using Equation (15);

7: Calculate the entropy of *H*(*B*) using Equation (16);


11: Update *num* using *num* = *num* + 1:

12: Until: the stopping criteria are met.
