Efficient Image Segmentation using GPU Computing

- In applications such as pattern recognition, the whole image cannot be processed directly as it is inefficient and unpractical. Hence several image segmentation algorithms were proposed to segment an image. Image segmentation is a part of image processing, which classify digital image into multiple segments according to the feature of image for example pixel values. This is useful in pattern recognition and computer vision. Pattern recognition is a process of recognition of patterns and regularities in data and is used in medical diagnosis. Computer vision is a field of understanding images to produce numerical or symbolic information. This field theme is to duplicate the abilities of human vision by understanding and electronically perceiving an image. Level Set Method (LSM) had been used widely for image segmentation. Partitioning the input image into multiple segments efficiently using LSM is the main purpose of this paper. The paper implements an image segmentation algorithm. First it preprocess input color image (size can be upto 2MB). It deals with converting of input image into gray-scale image and then noise removal using Gaussian filter. This is followed by segmentation, which is implemented using LSM with edge, region and 2D histogram information. LSM enables to easily handle complex shapes and topological changes such as merging and splitting. But LSM is computationally expansive. This computational complexity of LSM based image segmentation approach is significantly reduced by the use of extremely parallelizable method called Lattice Boltzmann Method (LBM), with a body force to solve the Level Set Equation (LSE). Nvidia GPU (GeForce GTX) is used to take full advantage of LBM parallelism nature. CUDA C programming is used to implement algorithm on GPU. An Image


I. INTRODUCTION
Image segmentation is a process, in which digital image is partitioned into multiple segments. Segmentation of images have wide applications, it is used in computer vision, pattern recognition [2]. Segmentation is required in medical diagnosis like to locate tumors. Segmentation is also used for face detection, iris recognition, wood quality inspection, food pack checks. So image segmentation has wide varieties of application.
There are several methods for segmentation of images. This project implemented level set based approach for segmentation of image using GPU. The level set technique is generally used for tracking shapes and dynamic interfaces. This technique was initially developed to model fluid boundaries, for example front of flames. Now for image segmentation in pattern recognition and computer vision this level set method (LSM) had been used widely [1] [3].
The LSM main advantage is it can handle topological changes automatically, for instance merging and splitting. It has the ability to extract complex contours. The LSM is an active contour model which uses geometric representation [5].
The LSM works by evolving the Zero-level of the level set function (LSF) in the image domain until the interested regions boundaries are reached. The level set equation (LSE) governs the active curve evolution [6]. It is a partial differential equation expressed as In the above equation (1) is the level set function, V is the speed function. This speed function draws and drives the active contour in the direction of the region borders. The II term in the right hand side represents the curvature. It is used for smoothing the contour. And it is non-linear, computationally expansive. and are user controlling parameters.
There are two approaches to stop the evolving curve on the boundaries of the desired objects. The first approach practices an edge indicator depending on the gradient of the image like in active contour models [5] [7]. The methods based on this approach are effective when detecting object's boundaries defined by edges. But it is ineffective when objects in image are with no edges and sensitive to noise. The second approach uses certain region attributes to stop the evolving curve [8]. The methods belonging to this approach are effective when detecting objects without edges, robust to noise. But have some difficulties when the boundaries between the background and object are only defined by high gradient.
This project implemented a two phase level set method which can allow the realization of a binary segmentation, and can be easily expanded to the multi-phase case. The method uses both region information and edge information in order to effectively detect both objects defined by edges and without edges. The sensitivity to noise introduced by local information that is edge information, is handled by the 2D gray-scale histogram based constraint.
To solve the LSE, lattice Boltzmann method (LBM) is used [9]. The LBM is simple, highly parallelizable and explicit in nature. It is second order accuracy both in space and time. It can lever the problem of time consuming better because the non-linear term in the LSE is implicitly computed. Initially to simulate equations for incompressible fluid LBM was designed [10] [11]. The evolution equation of LBM is In the above equation (2) f i is the Particle Distribution function and is the Bhatnager Gross Krook (BGK) collision model [12] with a body force F.
In the above equation (3) represents the relaxation time and the local equilibrium Particle Distribution, it can be expressed as shown below while modeling typical diffusion phenomenon, In the above equation (4) is the macroscopic fluid density. By applying the Chapman Enskog expansion [12], the following diffusion equation can be recovered from LBM, By substituting by the signed distance function in equation (5), the LSE can be recovered. The D2Q5 LBM lattice structure model was used while solving LSE. The body force F acts as the link with image statistics for the LBM solver.

A. Preprocessing
Image may contain noise, so before applying segmentation noise is removed from it. Here Gaussian blur filter is used to remove the noise. The image is converted into gray scale image.
Gaussian blur or Gaussian smoothing is the outcome of blurring an image by Gaussian function. To decrease image noise and to decrease detail it is used in graphics software. The pictorial outcome of this blurring technique is smooth blur resembling that of viewing the image through a glowing screen. Gaussian smoothing is used as a preprocessing stage in computer vision algorithms in order to enhance image structures at different scales. The two dimension Gaussian function equation is (6) Where x is the distance from the origin (Horizontal axis), y is the distance from the origin (vertical axis), and is the standard deviation of the Gaussian distribution. The standard deviation of the Gaussian determines the amount of smoothing. The proposed idea is implemented using CUDA C to run on GPU. The output of preprocessing is a gray scale image as shown in figure 1.1

B. Segmentation
The level set method was initially proposed to track moving interfaces. It can be used to efficiently address the problem of curve or surface propagation in an implicit manner. The main idea is to represent the evolving contour using a signed function whose zero correspond to the actual contour. Then, according to the motion equation of the contour, one can easily derive a similar flow for the implicit surface that when applied to the zero level will reflect the propagation of the contour. The level set method has many advantages, it is implicit, it is parameter free and provides a direct way to estimate the geometric properties of the evolving structure. It can be used to define an optimization framework for addressing many applications of computer vision and medical image analysis.

C. Lattice Boltzmann Solver
Let consider the above defined LSE. The gradient projection method [5][6] allows to replace δ( ) by |∇ |, and as φ is a signed distance function (SDF) , so |∇ | = 1. Thus this LSE can be rewritten as ) which is similar to Eq. (5) with the body force expressed as Where λ is a controlling parameter used to adjust the impact of F on the active contour motion. Thus the level set equation Eq. (10) is solved using the following lattice Boltzmann evolution equation Without the necessity of explicitly compute the curvature since it is implicitly handled by the LBM.

D. Level Set Method
Level set methods are a powerful tool for performing contour evolution. Define some function (i, j, t) (the level-set function), where (i, j) are coordinates in the image plane and t is an artificial "time." At any given time, the level set function simultaneously defines an edge contour and a segmentation of the image. The edge contour is taken to be the zero level set {(i, j) such that (i, j, t)= 0}, and the segmentation is given by the two regions { >= 0} and { < 0}. The level set function will be evolved according to some partial differential equation, and hopefully will reach a steady state that gives a useful segmentation of the image. The segmentation algorithms used in the proposed system Level set method algorithm. This algorithms work well for images with edges, without edges, noise images and medical images. The output of segmentation is as shown in figure 1.2.

III. EXPERIMENTAL ANALYSIS AND RESULTS
The execution time for few images without using GPU and with using GPU is tabulated in the table below.  Types of execution are Execution with GPU and execution without using GPU. The system showed good results when tested on large size images, improving segmentation speed by 85%.

IV. CONCLUSION
The paper has implemented efficient image segmentation algorithm. This algorithm is implemented using an edge, region and 2D histogram information based level set model. The use of the lattice Boltzmann method to solve the level set equation enabled the algorithm to be highly parallelizable and fast when implemented using an NVIDIA (GeForce Titan GTX) graphics processing units. Experimental analysis is done on various sizes of images. The system showed good results when tested on large size images, improving segmentation speed by 85%. Future work will be to use the method for GPU cluster accelerated real-time volume images segmentation.

ACKNOWLEDGEMENT
The proposed algorithm is implemented using NVIDIA GPU (GeForce Titan GTX). The Titan GTX used for this research was donated by the NVIDIA Corporation. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Tesla K40 GPU used for this research.