Empty glass bottle inspection method based on fuzzy support vector machine neural network and machine vision

Huanjun LIU

Front. Electr. Electron. Eng. ›› 2010, Vol. 5 ›› Issue (4) : 430 -440.

PDF (389KB)
Front. Electr. Electron. Eng. ›› 2010, Vol. 5 ›› Issue (4) : 430 -440. DOI: 10.1007/s11460-010-0114-y
RESEARCH ARTICLE
RESEARCH ARTICLE

Empty glass bottle inspection method based on fuzzy support vector machine neural network and machine vision

Author information +
History +
PDF (389KB)

Abstract

This paper develops a computerized empty glass bottle inspection method. Wavelet transform and morphologic methods were employed to extract features of the bottle body and the finish from images. Fuzzy support vector machine neural network was adopted as classifiers for the extracted features. Experimental results indicated that the accuracy rate can reach up to 97% by using the method developed to inspect empty glass bottles.

Keywords

machine vision / support vector machine (SVM) / neural network (NN) / morphologic method / wavelet transform

Cite this article

Download citation ▾
Huanjun LIU. Empty glass bottle inspection method based on fuzzy support vector machine neural network and machine vision. Front. Electr. Electron. Eng., 2010, 5(4): 430-440 DOI:10.1007/s11460-010-0114-y

登录浏览全文

4963

注册一个新账户 忘记密码

Introduction

Large numbers and various shapes of glass bottles are used as containers for food and drink. For example, in China over 31 million tons of beer were produced in 2008 with the majority of beer products packed in glass bottles. To ensure the quality of the final products, it is necessary to check the empty glass bottles for cleanness and breakage before the products are canned. In many cases, this kind of work is performed manually. However, manual inspection is not only expensive and time-consuming, but it is also very difficult to guarantee the quality.

Machine vision inspection system has been successfully applied in the field of integrated circuits, fruit and food quality inspection, etc. [1-4]. It also offers certain solutions for bottle inspection, but this method can only be used to inspect the bottle finish. The method described in Ref. [5] gives much attention to cracks in the upper portion of glass bottles. The captured image is corrected by adaptive gray correction and then translated into a binary image. The binary image is judged according to conditions. However, the crack problem is only one of the defects. The inspection precision of other defects is not desirable using this method. Reference [6] proposes a method to inspect defects for empty water bottles. The defects are detected based on the variations of intensity of the images within the image segment. In this method, the decision (if the bottles are defective) is made solely dependent on pixel intensity, which is heavily influenced by noise.

Empty bottle inspection is one of the typical machine vision inspection problems. The difficulties in this inspection lie in its diversity, uncertainty and noise. The properties of body defects are diversified in position, shape and optic performance. Therefore, the features of defects in the captured image are uncertain and hardly distinguished. There are noises in bottle images. And some shadows exist in the bottle image since one cannot expect to get the same bottle optic performance. Because of the influence of environmental factors like ambient light, noises would exist in bottle images. All these difficulties make bottle inspection one of the difficult problems in intelligent inspection. For these reasons, we have developed a new machine vision method that can be used to inspect the bottle body and the finish. The system takes image photos of empty glass bottles by a digital camera, extracts and analyzes the features of the images to determine the clearness and breakage of the empty bottles using a fuzzy support vector machine neural network.

Illumination system

A plate light emitting diode (LED) light is used when the camera takes a picture of the glass bottle body. The empty bottle is placed between the light and the camera, constituting the transmission-illumination relationship, shown in Fig. 1. In this case, breakages and stains on the bottle body can be clearly displayed, which is beneficial to the next step of bottle inspection. Two cameras capture images of the bottle body respectively from the back and face to avoid omitting defects.

In addition, to obtain a clear image of the bottle finish, an LED light in an umbrella shape is used, shown in Fig. 2. The breakages or stains of the bottle finish can be detected by comparison of the intensity of brightness, in which the areas of breakages or stains are darker.

Features of bottle

Marking and locating regions of interest

Since not all the information on the images of the bottles is used for further processing, it is necessary to mark the region of interest (ROI) manually in advance to reduce the processing cost. Because the defects could be everywhere, the shape of ROI is decided mainly according to the shape of the bottle. In Fig. 3, the regions of interest are marked with a dotted line. The computer only processes the image data within the region of interest.

Features of bottle body

Possible defective region identification

The body defect in the captured image is in the dark region. To label these regions, watershed transform is used. Watershed transform is a popular segmentation method coming from the field of mathematical morphology [7]. The intuitive description of this transform is quite simple: if the image is considered as a topographic relief, where the height of each point is directly related to its gray level and rain is considered gradually falling on the terrain, and then the watersheds are the lines that separate the “lakes” (actually called catchment basins) that form. Generally, watershed transform is computed on the gradient of the original image, so that the catchment basin boundaries are located at high gradient points. However, the traditional watershed transform generally leads to over-segmentation due to noise and other local irregularities of the gradient. To avoid this problem, this paper introduces some prior information to improve watershed transform.

The gradient of the image is calculated by morphology. The morphologic gradient can depend less on edge directionality [8].

The morphologic gradient of the image is computed by dilation and erosion [9]:
gi=(fibi)-(fibi),
where fibi is the gray-scale dilation of fi by bi, and fibi is the erosion.

The edge is a set of points lying on the boundary between two regions. Though the edge cannot fully describe the boundary, it can show the information of the defect region and background. Therefore, the edge is used to modify the gradient of the image. According to the characteristics of the defective region, the Sobel edge detection is selected. Modified gradient is described as follows.
gd(x,y)={gi(x,y)+C,if there is edge point in NB(x,y),gi(x,y),else,
where NB(x, y) is the 3×3 neighborhood of the point (x, y), and C is the constant.

The defective region of the bottle wall is the dark region, so the gray level of these regions is relatively low. Hence, the regional minima of the image should be in the object region. Regional minima are connected components of pixels with the same intensity value, tm, whose external boundary pixels all have a value greater than tm. This paper uses the regional minima as the markers.

The images of the bottle wall are segmented by the modified watershed transform, and the results are like Fig. 4.

The modified watershed transform can segment the possible defective regions, and reduce over-segmentation.

Features

The defective region is in dark, so the average gray level of the whole bottle body and the identified regions are calculated. If the mean gray level in some regions is below the whole bottle body’s, these regions may be defective.

Some features are extracted in these regions:

1) Feature 1:

The area of possible defective regions is denoted as Fb (1):
Fb(1)=Nd,
where Nd is the number of possible defective regions.

If there are more possible defective regions with low mean gray level, the body might not be good.

2) Feature 2:
Fb(2)=n=1NdAn,
where An is the area of the possible defective region.

This feature indicates the area of all possible defective regions. If this feature is big, the bottle body may be defective.

3) Feature 3:
Fb(3)=Am,
where Am is the maximum area in all possible defective regions.

4) Feature 4:
Fb(4)=G¯m,
where G¯m is the mean gray level in a region, of which the area is the maximum in all possible defective regions.

The gray level of the defective region is low. If the mean gray level of a region is low, this region may be a defective one.

Feature 4 and the two following features show the characteristics of a possible defective region, of which the area is the largest. This region is one of the most possible defective regions. The size of the defective region is not too small; thus, if Feature 4 of a region is large, this region may be a defective one.

5) Feature 5:
Fb(5)=j=G¯m-1G¯m+1Pm(j),
where Pm(j) is the probability density function of the gray level j in a region, of which the area is the maximum.

The gray level of the pixel in defective region is not different. Therefore, if this feature of a region is bigger, this region may be the defective one.

6) Feature 6:
Fb(6)=Ag,
where Ag is the area of a region, in which the mean gray level is the maximum in all possible defective regions.

When the mean gray level of a region is the maximum, it is another possible defective region. This feature and the two following features show the characteristics of this region. Also, they have the same meaning as Features 3-5.

7) Feature 7:
Fb(7)=G¯g,
where G¯g is the mean gray level in a region, in which the mean gray level is the maximum.

8) Feature 8:
Fb(8)=j=G¯g-1G¯g+1Pg(j),
where Pg(j) is the probability density function of gray level j in a region, where the mean gray level is the maximum.

Features of bottle finish

Scanning methods

While extracting features of the bottle finish, in view of the bottle finish shape, the circular law is used to carry out scanning. In scanning, the bottle finish center is taken as the center of a circle; each point is scanned by changing the radius and central angle. Because the round size of a real glass bottle finish ring varies in reality, the round width of the ring in the finish image can be also varied. Hence, the scope of the ring’s radius is given in advance. The ring’s radius of the normal bottle finish lies within this range. The scanning point is obtained by
{x=xC+rcosθ,y=yC-rsinθ,
where (xC, yC) is the center of the bottle finish, the scope of the r is (r1, r2), and θ ranges from 0° to 359°.

In scanning, the average gray level of the central angle θ is calculated by
L(θ)=r1r2g(x,y)r2-r1,
where g(x, y) is the gray level of (x, y), and (x, y) is decided by Eq. (11).

L(θ) of the bottle finish is shown in Fig. 5.

Features

When the quality of the bottle finish meets the standard, its image should be a ring with a consistent width and a smooth gray level. L(θ) will thus make little changes in different central angles. Otherwise, L(θ) would have significant changes. There are jagged noises and other information in the curve of L(θ). The multilevel approximation coefficients of one-dimensional (1D) wavelet transform [10] are used to reduce the noise. The Daubechies wavelet is chosen. The multilevel approximations of L(θ) are shown in Fig. 6.

Level 3 approximation coefficients not only keep the essential information but also reduce the noise. Therefore, they are chosen as the base of the features. These features are expressed as follows:
Ff(i)={CA(i),if CA(i) is an extreme,0,others,
where CA(i) are the level 3 approximation coefficients.

Classifier based on fuzzy support vector machine neural network

Bottle defects are diversified, so the bottle inspection is a small-sized sample problem. Also, the defects in the image are hardly described. To solve these problems, we propose a fuzzy support vector machine neural network.

Support vector machines (SVMs) are proposed initially in the field of machine learning, to classify problems on (typically large) sets of data having an unknown dependency on (possibly many) variables. SVMs are based on structural risk minimization methods, and produce a decision surface as the optimal hyperplane that separates the two classes with maximal margin [7,11]. SVMs have been used as one of the highest performance classifying systems because of their ability to generalize well. For SVM, some parameters, for example, kernel functions, need to be chosen. It is a difficult task to choose the parameters related to the model of the object. In practice, the SVMs obtained from the learning are insufficient to completely classify all unknown samples. Also, SVMs cannot ensure to provide the global optimal classification performance over all samples.

Neural networks (NNs) have been exploited in many applications and a few learning algorithms have been developed. One of the main applications employed is data classification. Studies have reported that SVMs are generally able to deliver higher classification accuracy than other data classification algorithms [12,13]. Nevertheless, NNs can adjust the parameters more easily than SVMs.

Fuzzy theory uses fuzzy sets instead of normal sets. It can process the fuzzy information. Fuzzy theory simulates the way of human thinking. Its fault tolerance is good. A fuzzy support vector machine neural network is used in this study as the classifier. It combines fuzzy theory with SVMs. We use an optimization method adopted from a genetic crossbred algorithm to select the primary parameters. Since SVM resembles NN in structure, back propagation (BP) learning method is adopted to optimize the parameters of the fuzzy support vector machine neural networks.

Fuzzy support vector machine (FSVM)

FSVM consists of fuzzy layer and SVMs. The structure is shown in Fig. 7.

Fuzzification is the function of the fuzzy layer. The features are inputted into the fuzzy layer, and translated into fuzzy outputs. This layer uses Gaussian function as the membership function. The function is as follows:
μi(xi)=e-(xi-aibi)2.

Then, SVMs are used as the classifier for fuzzy outputs.

Research shows that the use of the hybrid kernel yields a better performance than those with a single common kernel [14]. Hence, the hybrid kernel is applied in this study. The kernel function adopted in this paper is as follows:
K(x,xi)=k1(x·xi)d+k2e-r|x-xi|2.

Genetic algorithms (GAs) constitute the global optimization techniques known to be successful in many domains. Thus, a GA based selection of components for FSVM is proposed in this study. This method is employed to first optimize FSVM. The accuracy of classification and the risk of classifier are often used to evaluate the performance of classification. But the traditional GA only performs optimization process according to one goal. This paper adopts a crossbred genetic algorithm, which simulates crossbreeding in biology. There are two different fitness functions, with which the individuals are selected for breeding. So this algorithm suits the optimization of FSVMs.

The flow chart of this algorithm is shown in Fig. 8.

By this method, chromosomes are encoded as the real number. The structure of chromosomes is as follows:
(GFa1,GFb1,,GFam,GFbm,KP1,KP2,,KPn),
where GFak and GFbk, k=1,2,…,m, are the parameters of Gaussian functions in the fuzzy layer, KPk, k=1,2,…,n, are parameters of the kernel function.

The initial population is randomly crafted in different regions. There are two fitness functions, with which the individuals are selected for breeding. The two fitness functions are produced according to the accuracy of classification and the risk of the classifier. One fitness function is given by
Fitk1=11-Ck,
where Ck, k=1,2,,n, is the accuracy of classification. This accuracy is obtained by u-fold cross-validation. In u-fold cross-validation, the training sets are first divided into u subsets of equal size. Sequentially, one subset is tested using the classifier trained on the remaining u–1 subsets.

The risk can be estimated by Vapnik and Chervonenkis (VC) dimension, which is hard to calculate directly. Therefore, RT is employed to denote the leave-one-out bound [11].
RT=Nsvl,
where l is the number of training data set, and Nsv denotes the number of support vectors.

Another fitness function is given by
Fitk2=5RTk.

In reproduction, one half is selected according to fitness function Fitk1, and the other half is selected according to fitness function Fitk2. The elitist selection (10%) and roulette wheel selection operators are employed for reproduction.

The crossover operator is as follows. For two chromosomes Ai=(a1,a2,,an) and Bi=(b1,b2,,bn), the chromosomes after crossover are Ai=(a1,a2,,an) and Bi=(b1,b2,,bn), where
ai=βiai+(1-βi)bi,
bi=βibi+(1-βi)ai,
where βi is a random number in [0, 1].

The mutation operator is given by
ai={ai+f(t,aimax-ai),rad=0,ai-f(t,ai-aimin),rad=1,
where rad is a random number, and
f(t,y)=y(1-r(1-tT)2),
where t is the number of current generation, T is the maximum generation, r is a random number in [0,1].

The probabilities of crossover and mutation are decided adaptively, that is to say, these probabilities relate to the situation of evolution.

The probability of crossover is calculated by
PC={fmax-fbfmax-f¯,fb>f¯,0.8,fbf¯,
where f is the hybrid fitness, which is given by
f=0.6Fitk1+0.4Fitk2,
and fb is the bigger f of the two chromosomes, fmax is the maximal f in the population, f¯ is the mean f of the population.

The probability of mutation is
PM={0.5(fmax-f)fmax-f¯,f>f¯,0.5,ff¯,
where f is the hybrid fitness of the chromosomes to be mutated, and is calculated by Eq. (25), fmax and f¯ are the same as Eq. (24).

The procedure would not be terminated until both the changes of average fitness 1 and average fitness 2 between two neighboring populations are less than the thresholds.

Fuzzy neural networks

The best parameters cannot be obtained only by GA. Therefore, the NNs learning methods were used in our study to optimize the parameters on the bases of the result of crossbred genetic algorithm. Since SVM is reported to be similar to NN [15,16], it is logical to consider FSVM as the fuzzy neural network. The structure of fuzzy neural networks is shown in Fig. 9.

Layer 1 is the fuzzy layer, of which the function is to transform input vectors to fuzzy variables. The relations of the input with the output are as follows:
μi(xi)=e-(xi-aibi)2,
Ii(1)=xi,
Oi(1)=μi(Ii(1)),
where i=1, 2,…,n, n is the number of input vectors.

Layer 2 is the middle layer.
Ii(2)=Oi(1),
Oi(2)=Ii(2)

Layer 3 is the kernel function layer; the relations between the input and the output are as follows:
I(3)=O(2),
Oj(3)=Kj(I(3),xj),
Kj(x,xj)=k1j(x·xj)dj+k2je-rj|x-xj|2,
where j=1, 2,…,k, k is the number of the support vectors in the FSVM, K(x,x) is the kernel function.

Layer 4 is the output layer; the relations between the input and the output are as follows:
I(4)=j=1kOj(3)·Wj,
Y=O(4)=I(4).

The learning algorithm of networks is adopted in a gradient descent way. The initial parameters are given according to the FSVM trained. Therefore, xj are the support vectors, Wj are αj which are the Lagrange multipliers corresponding to support vectors in FSVM, and ai and bi are the same as the fuzzy layer in FSVM. The detailed learning algorithm is introduced in the Appendix.

Procedures of inspection methods

Procedure of bottle body inspection

The procedure of bottle body inspection methods in this paper are summarized as follows.

Step 1 The regions of interest are marked as Fig. 4.

Step 2 The possible defective regions in the bottle body images are segmented by the modified watershed transform.

Step 3 The eight features of bottle body are extracted by Eqs. (3)-(10) in these possible defective regions.

Step 4 The FSVM is constructed, and the parameters are optimized by the crossbred genetic algorithm.

Step 5 This FSVM is taken as the NN, and the initial parameters of the NNs are decided by this FSVM.

Step 6 This NN is learned by gradient descent methods.

Step 7 Finally, this NN is used to classify the features, and the inspection results of the bottle body are obtained.

Procedure of bottle finish inspection

Step 1 The regions of interest are marked as Fig. 3.

Step 2 The circular law is performed to scan, the curve L(θ) is obtained by Eq. (12);

Step 3 The features of the bottle finish are calculated according to Eq. (13).

Steps 4-6 They are the same as the bottle body inspection.

Step 7 The features of the bottle finish are classified by the fuzzy support vector machine neural network.

Experiments

Experiments were conducted to examine this method. A prototype equipped with an annular conveyor was developed according to Sect. 2. 500 images of each bottle finish and bottle body have been captured separately using this prototype. The bottle inspection method developed in this study was programmed by C language on a P4 2.6.

First, the images of the bottle finish and bottle body were compared to the real empty bottles to identify the empty bottles. Then the features from the 300 images were extracted according to the rules described in Sect. 3, which would be used as a base for learning the fuzzy support vector machine neural networks. After the fuzzy support vector machine neural networks were trained, they started to judge the features extracted from the other images. In crossbred genetic algorithm, the initial population is randomly crafted in ten regions. The number of the population is 20. The terminated threshold is 0.5. In training fuzzy neural networks, the learning rate is 0.01. In comparison with the fuzzy support vector machine neural network, the SVM and NNs were also applied. The RBF kernel function was selected for the SVM. The function is as follows:
KRBF(x,xi)=e-r|x-xi|2.

According to experience, r is set as 0.5. The number of neurons in the hidden layer of neural networks is the number of neurons in the input layer adding one. The BP method is applied to train neural networks, and the learning rate is 0.4. The means were calculated based on the experiments repeated ten times and shown in Tables 1 and 2.

Experiment results indicated that the fuzzy support vector machine neural network is superior to the support vector machine and the neural network.

Conclusion

This study offers an intelligent inspection method to examine empty glass bottles. Clear images of the bottle finish and bottle body were obtained through a specially-designed machine vision system. The regions of interest in the image were marked and located. The possible defective regions of the bottle body were labeled by morphologic methods, and the features were summarized after comparing with the real glass bottle defects. The bottle finish features were extracted by the method based on 1D wavelet transform, which can reduce the noise and features number. Then these features were classified by fuzzy support vector machine neural networks. The fuzzy support vector machine neural networks combined the fuzzy theory with the SVMs, and utilized an optimization method based on a genetic crossbred algorithm to choose the parameters primarily. Then the BP learning method is adopted to optimize the parameters of the fuzzy support vector machine neural networks. As a result, the classifier possesses not only good generalization ability but also strong anti-noise ability. The performance of the fuzzy support vector machine neural networks is better than SVM and BP NN, and it is adaptable to the bottle inspection, often with a problem of uncertainty and noise. Experiments have been performed on the prototype to prove whether the methods can work effectively. The results showed that the method developed in this study was able to detect defective glass bottles with an accuracy rate up to 97%.

References

[1]

Aleixos N. Blasco J, Molto E, Navarron F. Assessment of citrus fruit quality using a real-time machine vision system. In: Proceedings of the 15th International Conference on Pattern Recognition. 2000, 1: 482–485

[2]

Du C J, Sun D W. Comparison of three methods for classification of pizza topping using different colour space transformations. Journal of Food Engineering, 2005, 68(3): 277–287

[3]

Shankar N G, Zhong Z W. Defect detection on semiconductor wafer surfaces. Microelectronic Engineering, 2005, 77(3-4): 337–346

[4]

Jiang B C, Tasi S L, Wang C C. Machine vision-based gray relational theory applied to IC marking inspection. IEEE Transactions on Semiconductor Manufacturing, 2002, 15(4): 531–539

[5]

Ma H M, Su G D, Wang J Y, Ni Z. A glass bottle defect detection system without touching. In: Proceedings of the First International Conference on Machine Learning and Cybernetics. 2002, 2: 628–632

[6]

Shafait F, Imran S M, Klette-Matzat S. Fault detection and localization in empty water bottles through machine vision. In: Proceedings of E-Tech 2004. 2004, 30–34

[7]

Vapnik V N. Statistical Learning Theory. New York: John Wiley & Sons Inc, 1998

[8]

Otsu N. A threshold selection method from gray-level histograms. IEEE Transactions on Systems, Man, and Cybernetics, 1979, 9(1): 62–66

[9]

Gonzale R C, Woods R E. Digital Image Processing. 2nd ed. Upper Saddle River: Prentice Hall, 2002

[10]

Mallet S. A Wavelet Tour of Signal Processing. 2nd ed. New York: Academic Press, 1999

[11]

Vapnik V, Levin E, Le Cun Y. Measuring the VC-dimension of a learning machine. Neural Computation, 1994, 6(5): 851–876

[12]

Dumais S, Platt J, Heckerman D, Sahami M. Inductive learning algorithms and representations for text categorization. In: Proceedings of the Seventh International Conference on Information and Knowledge Management. 1998, 148–155

[13]

Hsu C W, Lin C J. A comparison of methods for multiclass support vector machines. IEEE Transactions on Neural Networks, 2002, 13(2): 415–425

[14]

Tan Y, Wang J. A support vector machine with a hybrid kernel and minimal Vapnik-Chervonenkis dimension. IEEE Transactions on Knowledge and Data Engineering, 2004, 16(4): 385–395

[15]

Smola A J, Schölkopf B, Müller K R. The connection between regularization operators and support vector kernels. Neural Networks, 1998, 11(4): 637–649

[16]

András P. The equivalence of support vector machine and regularization neural networks. Neural Processing Letters, 2002, 15(2): 97–104

RIGHTS & PERMISSIONS

Higher Education Press and Springer-Verlag Berlin Heidelberg

AI Summary AI Mindmap
PDF (389KB)

1947

Accesses

0

Citation

Detail

Sections
Recommended

AI思维导图

/