International Journal of Engineering Trends and Technology (IJETT) – Volume 18 Number 4 – Dec 2014 Identifying the Defects in Glass Bottles Using Particle Swarm Optimization 1 Mrs. Anupama B S1, Mr. Prasanna K B2 Assistant Professor, Information Science and Engineering, Channabasaveshwara Institute of Technology, Tumkur, India, 2 Assistant Professor, Computer Science and Engineering, Channabasaveshwara Institute of Technology, Tumkur, India, Abstract— This paper aims at designing and developing a suitable tool for identifying defects in glass bottles through visual inspection based on segmentation algorithm. Defects are identified in three stages namely Image acquisition, Pre-processing and filtering and Segmentation. In the Image acquisition stage, samples of real time images are taken and are converted into monochrome images. In the Pre-processing and filtering stage, the image acquired is passed through median filters. The de-noised images are further sent to the third stage which is Segmentation. In this paper, Segmentation is done using Particle Swarm Optimization (PSO). The defects in the images are segmented and highlighted and the areas of defects are spotted out. The Particle Swarm segmentation has produced high Sensitivity, high Specificity, high Accuracy and produced effective results and hence this tool shall be useful for food processing industries for the Quality Inspection of the glass bottles. Keywords--- Defects in glass, Filtering, PSO Algorithm, and Segmentation. sources of food, and avoid predators by implementing an “information sharing” approach[1]. Quality is a very important factor in Glass industries which has to be considered during the production of glass bottles. During processing stages, there are possibilities of occurring cracks or breaks or bubbles or accommodation of any other external materials such as hair, dust etc. on the glass surface. Here the main defect under consideration is the accommodation of external materials on the surface of the glass bottles. II. INSPECTION OF GLASS BOTTLES Image Acquisition Pre-processing and filtering I. INTRODUCTION The PSO (Particle Swarm Optimization) is a computational method that optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality. Initially, Developing computer software simulations of birds flocking around food sources, then later realized how well their algorithms worked on optimization problems. A basic variant of the PSO algorithm works by having a population (called a swarm) of candidate solutions called particles. These particles are moved around in the search-space according to a few simple formulae. The movements of the particles are guided by their own best known position in the search-space as well as the entire swarm's best known position. When improved positions are being discovered these will then come to guide the movements of the swarm. The Term Digital Image Processing refers to the processing of a two dimensional picture by a digital Computer. In PSO, a set of randomly generated solutions (initial swarm) propagates in the design space towards the optimal solution over a number of iterations (moves) based on large amount of information about the design space that is assimilated and shared by all members of the swarm. PSO is inspired by the ability of flocks of birds, schools of fish, and herds of animals to adapt to their environment, find rich ISSN: 2231-5381 Segmentation using PSO Segmented Image Evaluation Figure 1: Inspection of glass bottles using image processing A. Image Acquisition The process of capturing image is called as Image acquisition. Real time images are captured using camera or sensor. With reference to the figure 1, After the Image acquisition process through camera/scanners, it is then subjected to the following stages [2]. B. Pre-processing and Filtering Pre-processing refers to the initial processing of raw image. Pre-processing is done to improve the image quality by removing the undesired distortions referred as noise. Noise is any undesirable signal. Noise is everywhere and thus we have to learn to live with it. Noise gets introduced into the data via any electrical system used for storage, transmission, and/or http://www.ijettjournal.org Page 162 International Journal of Engineering Trends and Technology (IJETT) – Volume 18 Number 4 – Dec 2014 processing. Filtering is perhaps the most fundamental operation of image processing and computer vision. Filtering is done using Progressive switched median filter (PSMF), Decision based Algorithm (DBA), Modified Decision Based Binary Algorithm (MBDA) etc. C. Segmentation present[] = present[] + v[] ---------(b) v [] is the particle velocity, present[] is the current particle (solution). P best [] and g best[] are defined as stated before. rand () is a random number between (0,1). c1, c2 are learning factors. Usually c1 = c2 = 2. Formally, algorithm for the procedure is as follows [3] The process of cutting adding and feature analysis of images is called as Image Segmentation. It aims at dividing an image in to regions that have a strong co-relation with objects or area of interest using the principal of matrix analysis. III. PROPOSED METHOD A. PSO Algorithm PSO learned from the scenario and used it to solve the optimization problems. In PSO, each single solution is a "bird" in the search space. We call it "particle". All of particles have fitness values which are evaluated by the fitness function to be optimized, and have velocities which direct the flying of the particles. The particles fly through the problem space by following the current optimum particles. The algorithm keeps track of three global variables: Target value or condition Global best (gBest) value indicating which particle's data is currently closest to the Target Stopping value indicating when the algorithm should stop if the Target isn't found Each particle consists of: Data representing a possible solution A Velocity value indicating how much the Data can be changed A personal best (pBest) value indicating the closest the particle's Data has ever come to the Target B. Image Segmentation using PSO PSO is initialized with a group of random particles (solutions) and then searches for optima by updating generations. In every iteration, each particle is updated by following two "best" values. The first one is the best solution (fitness) it has achieved so far. (The fitness value is also stored.) This value is called pbest. Another "best" value that is tracked by the particle swarm optimizer is the best value, obtained so far by any particle in the population. This best value is a global best and called gbest. When a particle takes part of the population as its topological neighbors, the best value is a local best and is called pbest. After finding the two best values, the particle updates its velocity and positions with following equation (a) and (b). Let S be the number of particles in the swarm, each having a position xi ∈ ℝn in the search-space and a velocity vi ∈ ℝn. Let pi be the best known position of particle i and let g be the best known position of the entire swarm. For each particle i = 1, ..., S do: Initialize the particle's position with a uniformly distributed random vector: xi ~ U(blo, bup), where blo and bup are the lower and upper boundaries of the search-space. Initialize the particle's best known position to its initial position: pi ← xi If (f(pi) < f(g)) update the swarm's best known position: g ← pi Initialize the particle's velocity: vi ~ U(-|bup-blo|, |bupblo|) Until a termination criterion is met (e.g. number of iterations performed, or a solution with adequate objective function value is found), repeat: For each particle i = 1, ..., S do: Pick random numbers: rp, rg ~ U(0,1) For each dimension d = 1, ..., n do: Update the particle's velocity: vi,d ← ω vi,d + φp rp (pi,d-xi,d) + φg rg (gd-xi,d) Update the particle's position: xi ← xi + vi If (f(xi) < f(pi)) do: Update the particle's best known position(pbest): pi ← xi If (f(pi) < f(g)) update the swarm's best known position: g ← pi Now g holds the best found solution. The parameters ω, φp, and φg are selected by the practitioner and control the behaviour and efficacy of the PSO method v[] = v[] + c1 * rand() * (pbest[] - present[]) + c2 * rand() * (gbest[] present[]) ----(a) ISSN: 2231-5381 http://www.ijettjournal.org Page 163 International Journal of Engineering Trends and Technology (IJETT) – Volume 18 Number 4 – Dec 2014 V. CONCLUSION The defects in the images are segmented and highlighted. Thus the areas of defects are spotted out. The PSO segmentation has produced high Sensitivity, Specificity and Accuracy. Thus the Proposed method has produced effective results and hence this tool can be used for food processing industries for the Quality inspection of the Glass bottles and thus the productivity can be increased. REFERENCES [1] “A Copmarison of Particle Swarm Optimization and the Genetic Algorithm”, by Rania Hassan, Babak Cohanim, Olivier de Weck [2] George Mathew, jainaGeorgejaya, Janardhana S, Sabareesan K J (2013).”Quality Analysis of food products through computer aided visual inspection: A review” Current Trends in Engineering and Technology.10.1109/ICCTET.2013.6675921 [3] Clerc, M. (2012). "Standard Particle Swarm Optimization". HAL open access archive. Figure 2: Proposed flowchart for Image segmentation using PSO In this PSO, the particles (pixels) from the denoised image are represented in binary form (particles). Particles thus obtained and the fitness evaluations of these particles are done. A Comparison with the parent image is being done and the areas if match with the defined original pixels are turned to black. If it does not match, next particle is taken and same process is repeated. Hence the defective portion of the image is spotted out as white area. IV. RESULT Figure 4: Segmentation of various glasses using PSO ISSN: 2231-5381 http://www.ijettjournal.org Page 164