Научная статья на тему 'Threshold image target segmentation technology based on intelligent algorithms'

Threshold image target segmentation technology based on intelligent algorithms Текст научной статьи по специальности «Компьютерные и информационные науки»

CC BY
132
21
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
PARTICLE SWARM OPTIMIZATION / THRESHOLDING / IMAGE SEGMENTATION / RELATIVE BASIS

Аннотация научной статьи по компьютерным и информационным наукам, автор научной работы — Cai Yanxia, Xu Yanyan, Zhang Tierui, Li Dandan

This paper briefly introduces the optimal threshold calculation model and particle swarm optimization (PSO) algorithm for image segmentation and improves the PSO algorithm. Then the standard PSO algorithm and improved PSO algorithm were used in MATLAB software to make simulation analysis on image segmentation. The results show that the improved PSO algorithm converges faster and has higher fitness value; after the calculation of the two algorithms, it is found that the improved PSO algorithm is better in the subjective perspective, and the image obtained by the improved PSO segmentation has higher regional consistency and takes shorter time in the perspective of quantitative objective data. In conclusion, the improved PSO algorithm is effective in image segmentation.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «Threshold image target segmentation technology based on intelligent algorithms»

SHORT COMMUNICATIONS

Threshold image target segmentation technology based on intelligent algorithms

Y.X. Cat1, Y.Y. Xu1, T.R. Zhang1, D.D. Li1 1Hengshui University, Hengshui, Hebei 053000, China

Abstract

This paper briefly introduces the optimal threshold calculation model and particle swarm optimization (PSO) algorithm for image segmentation and improves the PSO algorithm. Then the standard PSO algorithm and improved PSO algorithm were used in MATLAB software to make simulation analysis on image segmentation. The results show that the improved PSO algorithm converges faster and has higher fitness value; after the calculation of the two algorithms, it is found that the improved PSO algorithm is better in the subjective perspective, and the image obtained by the improved PSO segmentation has higher regional consistency and takes shorter time in the perspective of quantitative objective data. In conclusion, the improved PSO algorithm is effective in image segmentation.

Keywords: particle swarm optimization, thresholding, image segmentation, relative basis.

Citation: Cai YX, Xu YY, Zhang TR, Li DD. Threshold image target segmentation technology based on intelligent algorithms. Computer Optics 2020; 44(1): 137-141. DOI: 10.18287/2412-6179-CO-630.

Introduction

When processing image information, the human brain will only concentrate on an area in a larger proportion [1], but a larger area does not mean that the feature information contained is prominent, and the key features may be too small to be recognized by the naked eye [2]. The emergence of computers provides more efficient and accurate image processing methods, in which image segmentation technology [3] plays an important role. Generally speaking, image segmentation methods are divided into five categories: image segmentation methods which takes threshold, edge, region, clustering and shape as segmentation criteria [4]. The purpose of image segmentation is to separate the regions which contain important information from those which do not. The basic principle of image segmentation is that regions containing important information have similar characteristics. Threshold segmentation is to take the gray level of pixel as the feature and segment the gray level features of different regions by threshold. Yuan et al. [5] proposed an improved OTSU method based on weighted target variance to separate defects from background in rail images and found that the improved OTSU method could accurately segment various rail images. Liu et al. [6] proposed an image binarization method and found that the method had excellent image segmentation effect. Zhang et al. [7] proposed an improved two-dimensional fuzzy Fisher algorithm for image segmentation and found that the algorithm had the performance of fast image segmentation. This paper briefly introduces threshold image segmentation and improved particle swarm optimization (PSO and makes a simulation analysis on the segmentation of im-

ages from the Internet using the standard PSO algorithm and improved PSO algorithm on MATLAB software.

Image segmentation

Image segmentation is mathematically defined as [8]:

n

URi = i,

i=1

•f)R = 9, (1)

i=1

H (R) = true,

H(R URj) = false,

where I represents the entire image area, Ri represents the i-th region after being segmented, n represents the number of regions after image segmentation, H represents predicate expressing the same nature, and i, j e (1, 2, 3,..., n) and they were not equal to each other. The literal expression for the definition of equation (1) is: all segmentation regions are combined into the whole image without overlapping each other; regions with the same property can be merged into one region; adjacent regions with different properties can not be merged. The above definition is under the general situation and is adjusted according to the requirements in practical application.

The threshold image segmentation method is used in this study. If the threshold is too small, the unimportant "background" will be classified as "target", and if the threshold is too large, the important "target" will be classified as "background". However, different images have different gray distribution, so it is impossible to use a fixed threshold to segment the image once and for all.

Firstly, the average gray level of neighborhood is calculated [9]:

g ( y) =

( n-1)/2 (n-1)/2

E S f(x+i, y+j)

i =(1-n)/2 j=(1-n)/2

(2)

where g (x, y) stands for the neighborhood average gray level of pixel (x, y), n stands for the size of neighbourhood, an odder number, and f (x+i, y + j) stands for the gray level of pixel (x+i, y +j).

The plane projection of two-dimensional histogram [10] is shown in Fig. 1. The horizontal coordinate is gray level, the vertical coordinate is neighborhood average gray level, s is gray level threshold, and t is neighborhood average gray level threshold. The frequency of the pixels in the picture is more concentrated in area © and © near the diagonal line, while area © and © have noise and edge pixel, whose frequency can be ignored. Area © and © are the target and background of the image. The basic principle of the two-dimensional maximum entropy method used in this study is to search (s, t) within the limited scope to make the two-dimensional entropy of area © and © in the two-dimensional histogram of the segmented image. Its computational formula [11] is:

H (s, t) = Hl{s, t) + H 3(s, t),

" ' Pij^Pj

(3)

H1(s, t )=-EE—ln—,

i = 0 j=0 Pst Pst

H1(S't ) = -EE YpT

i=s+1 j=t+1 1 Fij 1 Fij

s t

pst=-EE p<j '

i=0 j=0

where H is the total entropy of an image, H1, H3 are the two-dimensional entropy of area © and ©, Pij is the probability of the occurrence of the vector group consisting of pixel gray level i and neighborhood average gray level j in the histogram, Pst stands for the probability of the occurrence of vector group within the set threshold, and L stands for the maximum gray level of the image. When H reaches the maximum value, the information amount in area © and © is the largest, the background and target in the image segmentation contain the most feature information amount, and at that moment (s, t) is the optimal threshold.

Improved PSO

PSO [12] was originally used to simulate the movement and foraging behavior of birds in nature, but it is applied to search for the optimal threshold in this study. Firstly, the PSO (solution set) and the dimension of search space are set according to the problem solved. Then, the individual optimal solution and global optimal solution are searched continuously according to the iteration formula of velocity and location [13]:

Vi+1 = a Vi +a1 ■x1 ■ (pbesti -Pi ) + + a2 ■ X2 ■ (gbesti - P ),

P+1 = Pi + Vi+1,

(4)

a = Omax -"

iter

■ iter,

where P, Vi stand for the position and velocity of particle i respectively, Pi+1, Vi+1 are the position and velocity of particle i after updating, pbesti, gbesti are the individual best solution and the global best solution respectively, a1, a2 are learning factors, a, amax, amin stand for the inertia weight, maximum inertia weight and minimum inertia weight, it-er, itermax stand for the number of evolutions and the maximum number of evolutions, and X1, X2 are random numbers, which is evenly distributed between 0 and 1. When the optimal solution is searched or the given maximum number of iterations is reached, the iteration stops.

®

Q> / ©

O s i

Fig. 1. Plane projection of two-dimensional histogram

In the standard PSO algorithm, the initial population is usually generated randomly. Although it is convenient, it will greatly increase the difficulty of searching the optimal solution if the initial population is unlucky and significantly deviates from the optimal solution. In this study, the relative basis [14] is used to generate the initial solution: (1) First, the initial particle swarm is generated randomly: X = (P„ V} and i = 1, 2, ..., N; (2) then the relative particle swarm of the initial particle swarm is calculated, and the formula is as follows:

OPi Umin + Umax Pi ,

OV = V ■ + V - P

^ * i * min 1 r max ■L i ?

^min ^max °.1(Umax Umin),

(5)

where OP, OVi stand for the position and velocity of the i-th relative particle in the relative particle swarm, ^mir^ Umax are the boundaries of the range of location values, and Vmm, Vmax are the boundaries of the range of velocity values.

(3) The fitness values of the initial particle swarm and relative particle swarm are calculated and ranked, and the best N particles are selected as the new initial particle swarm. The improvement of the iteration formula is:

The above evaluation of image segmentation effect is the subjective evaluation of human. When the segmentation effect of the two algorithms is relatively close, the human naked eye will be difficult to distinguish subtle

2

n

distinctive features. Unless the difference between the segmentation effect is large enough to be directly distinguished by the,

Vi+1 =rnVj + a1 ■x1 • (pbestj - Pi ) + + a2 • x2 • (pbestj-1 - Pi ),

P+1 = Pi + V+1,

(6)

® max ® m

M = fflma, --

iterm

- • iter,

where stands for the individual optimal solution of the last particle. Compared with equation (4), the improved iteration formula uses the individual optimal solution of

the former better particle as the global optimal solution of the latter particle.

The flow chart of the improved PSO algorithm is shown in Fig. 2. The steps are as follows.

Firstly, the initial particle swarm is randomly generated. Each particle in the particle swarm represents a potential solution. Then the relative particle swarm is obtained according to equation (5). According to the fitness value, the best N particles are selected from the initial particle swarm and relative particle swarm as the new initial particle swarm for subsequent iteration updating. Moreover, the parameters of the algorithm including particle swarm size, learning factor and the maximum number of iterations are set.

Fig. 2. The flow of the improved PSO algorithm

(2) The fitness value of particle swarm is calculated. The individual and global optimal solutions are selected from the particle swarm and sorted according to the fitness value, from good to bad. In this study, equation (3) is used as the fitness function, and the ultimate goal is to make the total entropy of the image maximum.

(3) The position and velocity of particle swarm are updated according to fitness and equation (6). Then whether the algorithm reaches the termination condition is determined, including the convergence of the fitness function to stability and the maximum number of iterations. If the termination condition is satisfied, the result will be output directly. If the termination condition is not satisfied, step 2 will be repeated to search for the optimal solution.

Simulation analysis

1. Experimental environment

The experiment is carried out on a laboratory server. The server configuration is Windows 7 system, I7 processor and 16G memory. The algorithm is programmed with MATLAB software [15].

2/ Experimental parameters

The parameters of standard PSO algorithm is set: the size of particle swarm is 50; learning factor ax = a2 = 2.0 , inertial weight a e [0.4,0.9], the maximum number of iterations is 200; the range of value of particle position is [0,255), the range of value of particle velocity is [0,4], and the size of pixel neighbourhood is 3.

The parameter setting of the improved PSO algorithm is the same as that of the standard PSO algorithm. Then two algorithms are used to segment the image from the

Internet. Each algorithm runs 50 times independently, and the average value is taken as the final result.

3. Experimental results

As shown in Fig. 3, the fitness of the two algorithms increases with the increase of number of iterations and converges to stability after several number of iterations, the standard PSO algorithm converges to stability after 40 times of iterations, and the fitness after stability is 11.875; the improved PSO algorithm converges to stability after 20 times of iterations, and the fitness after stability is 12.668. The comparison in Fig. 3 shows that the improved PSO algorithm can converge to stability faster, and the fitness after stabilization is greater, i.e., the improved PSO algorithm can find better optimal solutions than the standard PSO algorithm.

Fitness value 13 r

12 11 10

Standard PSO Improved PSO

Times of iterations

0 20 40 60 80 100 ... 180 200

Fig. 3. Iterative convergence curves of two algorithms

As shown in Fig. 4, 5 and 6, the segmentation effect of the improved PSO algorithm is better than that of the standard PSO algorithm intuitively. After segmentation,

the main contour of the bird in the picture can be seen, and some of its patterns can also be reflected. However, in the background segmentation, the standard PSO algorithm classifies the large area of the background into the main body, and the background even contacts the contour of the bird, which reduces the segmentation effect.

Fig. 4. The original image

l_^_

Fig. 5. The segmentation result of the standard PSO algorithm

M

4

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

Fig. 6. The segmentation result of the improved PSO algorithm

Table 1. Performance evaluation of two algorithms

Standard PSO algorithm Improved PSO algorithm

Optimal threshold 120 128

Regional consistency 0.912 0.976

Computing time/s 2.2 1.5

The above evaluation of image segmentation effect is the subjective evaluation of human. When the segmenta-

tion effect of the two algorithms is relatively close, the human naked eye, it is still necessary to quantitatively analyze the image. As shown in Table 1, the indexes used to evaluate the segmentation performance of the algorithm include optimal threshold, regional consistency and computing time. The regional consistency is the ratio of the difference between the average gray level and the sum of the average gray level of the two segmentation regions. The closer to 1, the better the segmentation effect. The standard PSO algorithm spends 2.2 seconds to calculate the optimal threshold, and the optimal threshold is 120; the regional consistency is 0.912 under this threshold. The improved PSO algorithm spends 1.5 seconds to calculate the optimal threshold, and the optical threshold is 128; the regional consistency is 0.976 under this threshold. Thus it is concluded that the improved PSO algorithm is better than the standard PSO algorithm in both regional consistency and computing time.

Conclusion

This paper briefly introduces the optimal threshold calculation model and PSO algorithm for image segmentation, improves the PSO algorithm, and performs simulation analysis on the segmentation of the image from the Internet using the standard PSO algorithm and improved PSO algorithm on MATLAB. The results are as follows: (1) The standard PSO algorithm converges to stability after 40 times of iterations, and the improved PSO algorithm converges to stability after 20 times of iterations, whose fitness after stability is higher than the standard PSO algorithm; (2) In the subjective judgement on the effect of image segmentation, both algorithms can effectively partition the contour of the subject, but the background partitioned by the standard PSO algorithm is in contact with the subject; (3) In the quantitative and objective analysis of image segmentation effect, the regional consistency of the standard PSO algorithm in segmenting image is 0.912, and it takes 2.2 seconds; the regional consistency of the improved PSO algorithm in segmenting image is 0.976, and it takes 1.5 seconds.

References

[1] Chen LC, Papandreou G, Kokkinos I, Murphy K, Yuille AL. DeepLab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs. IEEE Trans Pattern Anal Machine Intell 2018; 40(4): 834-848.

[2] Wang B, Chen L, Cheng J. New result on maximum entropy threshold image segmentation based on P system. Optik 2018; 163: 81-85. DOI: 10.1016/j.ijleo.2018.02.062.

[3] Yang ZL, Min HQ, Luo RH. Multi-threshold image segmentation algorithm based on improved quantum-behaved particle swarm optimization. Journal of South China University of Technology 2015; 43(5): 126-131 and 138.

[4] Zhu HJ, Zhuang ZH, Zhou JL, Zhang F, Wang XJ, Wu YH. Segmentation of liver cyst in ultrasound image based on adaptive threshold algorithm and particle swarm optimization. Multimedia Tools & Applications 2017; 76(6): 8951-8968.

[5] Yuan XC, Wu LS, Chen HW. Rail image segmentation based on Otsu threshold method. Optics & Precision Engineering 2016; 24(7): 1772-1781.

[6] Liu L, Yang N, Lan J, Li JJ. Image segmentation based on gray stretch and threshold algorithm. Optik 2015; 126(6): 626-629.

[7] Zhang C, Xie Y, Liu D, Wang L. Fast threshold image segmentation based on 2D fuzzy fisher and random local optimized QPSO. IEEE Trans Image Process 2017; 26(3): 1355-1362.

[8] Li YY, Jiao L, Shang R, Stolkin R. Dynamic-context cooperative quantum-behaved particle swarm optimization based on multilevel thresholding applied to medical image segmentation. Information Sciences 2015; 294: 408-422.

[9] Li Y, Bai X, Jiao L, Xue Y. Partitioned-cooperative quantum-behaved particle swarm optimization based on multilevel thresholding applied to medical image segmentation. Applied Soft Computing 2017; 56(C): 345-356.

[10] Shen L, Huang X, Fan C. Double-group particle swarm optimization and its application in remote sensing image segmentation. Sensors 2018; 18(5): 1393.

[11] Liu Y, Mu C, Kou WD, Liu J. Modified particle swarm optimization-based multilevel thresholding for image segmentation. Soft Computing 2015; 19(5): 1311-1327.

[12] Liu Y, Hu KY, Zhu YL, Chen HN. Color image segmentation using multilevel thresholding-hybrid particle swarm optimization. In Book: Wang W, ed. Proceedings of the second international conference on mechatronics and automatic control. Cham, Heidelberg, New York, Dordrecht, London: Springer; 2015: 661-668.

[13] Deng MH, Li ZC, Zhu SP. The agriculture vision image segmentation algorithm based on improved quantum-behaved particle swarm optimization. Applied Mechanics & Materials 2015; 713-715: 1947-1950.

[14] Gao H, Pun CM, Kwong S. An efficient image segmentation method based on a hybrid particle swarm algorithm with learning strategy. Information Sciences 2016; 369: 500-521.

[15] Zhao J, Wang X, Zhang H, Hu J, Jian XM. The neutro-sophic set and quantum-behaved particle swarm optimization algorithm of side scan sonar image segmentation. Acta Geodaetica et Cartographica Sinica 2016; 45(8): 935-942.

Authors' information

Yanxia Cai (b. 1985) graduated from Yanshan University, majoring in Design Art. She has gained the master's degree. Now she is a lecturer in Hengshui University. She is interested in visual communication design. E-mail: [email protected].

Yanyan Xu (b. 1986) graduated from Hebei University of Science and Technology. She has gained the master's degree of Artistic Design. Currently she is a lecturer in Hengshui University. Her main research direction is artistic design. E-mail: [email protected] .

Tierui Zhang (b. 1984) graduated from Donghua University and has gained the master's degree of Fashion Design and Engineering. Now she is a lecturer in Hengshui University. She is interested in visual communication design and teaching management. E-mail: [email protected] .

Dandan Li (b. 1986) graduated from Hebei University of Science and Technology and has gained the master's degree of Artistic Design. Now she is a lecturer in Hengshui University. Her main research directions are animation, design art and teaching management. E-mail: [email protected] .

Received September 11, 2019. The final version - November 18, 2019.

i Надоели баннеры? Вы всегда можете отключить рекламу.