61 農業機械學刊 第 8 卷 第 3 期 1999 年 9 月 類神經網路與貝氏分類法應用於 影像分割之比較研究 張仁明 1 ,林達德 2 1. 國立台灣大學農業機械工程學研究所碩士 2. 國立台灣大學農業機械工程學系教授,本文通訊作者 摘 要 影像分割為進行影像分析的重要前處理步驟,此步驟的成效對於後續影像分 析的結果通常有顯著之影響。貝氏分類法與類神經網路則為監督式學習自動影像 分割方法中較為被廣泛應用者。本研究之主要目的為以類神經網路與貝氏分類法 建立適用於不同背景與照明條件下的影像分割方法,同時進行兩種方法的比較分 析及闡明其適用性。我們首先以物件導向程式建立了應用貝氏分類法與類神經網 路的影像分割軟體元件,再以二維資料進行分析,利用空間座標的表示法分別比 較兩種方法在可線性分離、非凸集、以及相互包含等三種資料類型的分類效果。 在彩色影像的影像分割應用方面,則以蔬菜種苗影像為對象,依據影像元素色彩 資訊的空間分佈情形,探討兩種方法的分類效果。實驗結果顯示,對於照明良好 與背景單純的彩色影像,貝氏分類法與類神經網路的影像分割效果接近,平均分 類誤差均小於 1%。但對於複雜背景之影像則以類神經網路的影像分割效果較佳, 同時類神經網路對於學習過程中取樣均勻程度的要求較具有強健性。 關鍵詞:影像處理、影像分割、類神經網路、貝氏分類法 COMPARATIVE STUDIES ON IMAGE SEGMENTATION USING NEURAL NETWORK AND BAYESIAN CLASSIFICATION METHOD Jen-Ming Chang 1 , Ta-Te Lin 2 1. Former graduate student, Dept. of Agricultural Machinery Engineering, National Taiwan University. 2. Professor, Dept. of Agricultural Machinery Engineering, National Taiwan University, Corresponding Author. ABSTRACT Image segmentation is an important preprocesing procedure for image analysis. The result of image segmentation significantly affects the accuracy of subsequent image analysis. The Bayesian and neural network classification methods are widely used for automatic and supervised image segmentation. The objectives of this
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
61農業機械學刊 第 8卷 第 3期 1999年 9月
類神經網路與貝氏分類法應用於影像分割之比較研究
張仁明 1,林達德 2
1.國立台灣大學農業機械工程學研究所碩士
2.國立台灣大學農業機械工程學系教授,本文通訊作者
摘 要
影像分割為進行影像分析的重要前處理步驟,此步驟的成效對於後續影像分
析的結果通常有顯著之影響。貝氏分類法與類神經網路則為監督式學習自動影像
分割方法中較為被廣泛應用者。本研究之主要目的為以類神經網路與貝氏分類法
建立適用於不同背景與照明條件下的影像分割方法,同時進行兩種方法的比較分
析及闡明其適用性。我們首先以物件導向程式建立了應用貝氏分類法與類神經網
路的影像分割軟體元件,再以二維資料進行分析,利用空間座標的表示法分別比
較兩種方法在可線性分離、非凸集、以及相互包含等三種資料類型的分類效果。
在彩色影像的影像分割應用方面,則以蔬菜種苗影像為對象,依據影像元素色彩
資訊的空間分佈情形,探討兩種方法的分類效果。實驗結果顯示,對於照明良好
與背景單純的彩色影像,貝氏分類法與類神經網路的影像分割效果接近,平均分
類誤差均小於 1%。但對於複雜背景之影像則以類神經網路的影像分割效果較佳,
同時類神經網路對於學習過程中取樣均勻程度的要求較具有強健性。
關鍵詞:影像處理、影像分割、類神經網路、貝氏分類法
COMPARATIVE STUDIES ON IMAGE SEGMENTATIONUSING NEURAL NETWORK AND BAYESIAN
CLASSIFICATION METHODJen-Ming Chang1, Ta-Te Lin2
1. Former graduate student, Dept. of Agricultural MachineryEngineering, National Taiwan University.
2. Professor, Dept. of Agricultural Machinery Engineering, NationalTaiwan University, Corresponding Author.
ABSTRACT
Image segmentation is an important preprocesing procedure for image analysis.The result of image segmentation significantly affects the accuracy of subsequentimage analysis. The Bayesian and neural network classification methods are widelyused for automatic and supervised image segmentation. The objectives of this
62 農業機械學刊 第8卷 第3期 1999年9月
research were to establish image segmentation methods for various background andlighting conditions based on Bayesian and neural network methods, and to comparethe efficacy and feasibility of applying these two methods under different conditions.Software components employing object oriented programming language for colorimage segmentation was initially built and tested with 2-dimensional data sets. Thesedata sets were represented with 2-dimensional plots corresponding to linearlyseparable, non-convex, and mutually included classification patterns. The data setswere classified with both the Bayesian and neural network methods, and the resultswere compared and discussed. Finally, color images of selected vegetable seedlingsunder different background and lighting conditions were tested. The results wascompared along with the spatial distribution of pixels in RGB color coordinates. Theexperimental results indicated that under good lighting and uncomplicatedbackground conditions, the use of Bayesian and neural network methods were notsignificantly different. The average errors of image segmentation were all below 1%.However, for images with complex background, image segmentation using neuralnetwork showed better result than the Bayesian method. In terms of the samplingrequirement during the learning phase, the neural network method showed betterrobustness.
Fig.1 Neural network structure used for imagesegmentation, where the network inputs arethe RGB values of each pixel and the out-puts are the classification results of the fore-ground object and background
66 農業機械學刊 第8卷 第3期 1999年9月
的輸出值,最後亦必須加以轉化為真實數值。可
應用於倒傳遞類神經網路為傳遞函式的數學函式
有很多種,在本研究中是選用下列之 Sigmoid 函
數為傳遞函式:
f x = 11+e x (5)
一個倒傳遞網路在被使用後,最常碰到的問
題就是如何使其收斂加快與收斂穩定。在收斂加
快上,可以用加大網路學習速率參數來達成。但
伴隨而來的問題就是會在訓練後期造成不斷的震
盪,而無法達到所要的結果。因此方法必須要加
以修正。在本研究中進行影像分割時所使用的方
法為,初期使用較大的學習速率,而學習速率隨
其訓練的次數而遞減,如此可使網路快速收斂,
且在需要極精密計算的後期因學習速率的縮小而
減少震盪,使得後期收斂穩定且快速(不需花費
震盪所需的時間),故可以使網路的收斂在整個
過程中皆為穩定與快速。同時也因使用此動態調
整學習速率,使本研究可以在實驗中不斷的學習
(已訓練後的網路,可不定時的再進行訓練),
如此不會因為一個小雜訊或一次不正確的訓練造
成整個網路原本正確的值發生大的變動。
四、試驗方法與步驟
為了比較貝氏分類法與類神經網路對於影像
分割的處理結果與限制,我們做了以下的試驗以
探討:(1)此兩種影像分割方法的極限、變因與結
果。(2)照明與背景對影像分割結果的影響。
在進行了許多前置實驗後,我們發現要立即
對照明與背景複雜之影像進行實驗並加以比較並
不恰當,主要原因為對於這兩種方法的影響變因
交互影響不利於解析。因此,我們設計了一個新
的實驗方法,先以較簡單的二維資料之分類問題
為起始點,探討與闡明有關此兩種方法的影響因
子,然後再以實際的彩色影像討論進行一般影像
分割的變因與結果。
首先,假設我們要分離的資料形式為二維,
即每個樣本有兩個基本資料(或特性),此樣本
即可視為分佈於二維平面的資料點,其基本資料
即以空間座標(x, y)代表之,因此我們可以很容易
地以平面圖形的方式來展現樣本的分類狀態。對
於所要處理的樣本資料,我們分別以貝氏分類法
及類神經網路將其分類為兩群,進行測試時,其
測試條件為:(1)貝氏分類法內部運算採用倍精準
型態,(2)類神經網路使用如前述之三層架構(一
個隱藏層),其中輸入層為 2個節點,隱藏層為
5 個節點,輸出層為 2 個節點,(3)類神經網路不
採用慣性項(momentum term),(4)傳遞函式採
用前述之(5)式,(5)測試分離的影像與訓練的影像
為相同影樣,(6)訓練樣本點為隨機抽樣。為了使
測試條件能夠盡量保持一致以利實驗結果的比
較,在此實驗中我們將訓練次數固定為 5,000次,
而學習速率固定為 0.5。在進行其他實際影像的
背景分割處理時,則仍採用學習速率隨其訓練次
數增加而遞減的法則。
在二維資料之分類試驗中,我們將樣本點依
不同的狀況繪出其空間分佈如圖 2所示,各圖中
黑色與白色分別代表兩種不同的類別,在圖形中
可以利用空間座標明確地表示各種不同測試狀況
的類別分佈情形。在圖 2中大致可以將樣本類別
的分佈歸為以下三類:(1)兩類別間界線明確且線
性可分如圖 2(A),(2)兩類別為非凸集(nonconvex
set)之關係,即非線性可分離,如圖 2(B, C, D),
(3)兩類別為相互包含之情形,如圖 2(E, F)。而實
圖 2 以貝氏分類法與類神經網路對二維資料進行分類之六種形式樣本空間分佈圖
Fig.2 Six patterns of data used for the comparisonof Bayesian and neural network classifica-tion methods
67類神經網路與貝氏分類法應用於影像分割之比較研究
驗與進行分類計算之流程圖如圖 3所示。
對彩色影像的影像分割,則是以甘藍或莧菜
種苗影像為對象進行實驗。我們首先以人工的方
式進行屬於葉片區域及背景的影像分割,建立標
準影像以利於與應用貝氏分類法或類神經網路所
得之結果進行比較。對於此標準影像,我們進一
步可以將影像元素依其 RBG 座標值繪製立體圖
形以觀察屬於種苗本身與背景兩類別影像元素的
圖 3 二維資料以貝氏分類法與類神經網路進行分類之流程圖
Fig.3 Flow chart of the 2-dimensional data classification procedure using Bayesian and neural net-work classification methods
Fig.4 Typical color cabbage seedlings images andpixels distributions corresponding to threepatterns of foreground object and back-ground classification. (A) Linearly separablepattern, (B) Non-convex set pattern, (C) Mut-ually included pattern
圖 5 單純背景之甘藍種苗彩色影像與其前景及背景影像元素在 RGB色彩空間之分佈圖
Fig.5 Color image of cabbage seedlings with un-complicated background and its 3-dimen-sional distribution of seedling and back-ground pixels in RGB coordinates
Fig.6 Results of the 2-dimensional data classification using Bayesian and neural network me-thods. (A)~(F) are plots of different patterns as described in Fig.2 (G) is the results corre-sponding to (E) but with uneven sampling
Fig.7 Image segmentation of cabbage and ama-ranth seedlings with complex background.(A) Original image. (B) Distribution of pixelscorresponding to seedling and backgroundin RGB coordinates. (C) Result from Bayes-ian method. (D) Result from neural networkclassification
71類神經網路與貝氏分類法應用於影像分割之比較研究
表 1 均勻打光單純背景下彩色種苗影像的影像分割實驗結果
Table 1 Results of image segmentation experiments for color seedling images of even lighting anduncomplicated background
Fig.8 Image segmentation of cabbage seedlingswith complex background and consideringamaranth seedling as background. (A) Orig-inal image. (B) Distribution of pixels corre-sponding to seedling and background inRGB coordinates. (C) Result from Bayesianmethod. (D) Result from neural network clas-sification
73類神經網路與貝氏分類法應用於影像分割之比較研究
適用範圍:由前述的實驗可得知,在較為單純
的照明與背景條件下,貝氏分類法的影像分割
效果較類神經網路為佳,並且在訓練時不會有
不收斂的問題發生,使用上較為單純,因此對
於單純背景或是不很複雜的影像,使用貝氏分
類法的結果一般而言會較使用類神經網路為
好。但當背景是由數個類別構成時,貝氏分類
法的影像分割效果是否良好則較無法預估,取
樣的不均、類別分佈的差異都很可能使得其結
果不同,因此對於複雜的影像分割情形較保險
的選擇為使用類神經網路,但並不一定類神經
網路的結果一定優於貝氏分類法。另外一個有
關適用範圍的重要因素為,是否可以不斷地更
新並保留原先的精確度,對於此點則類神經網
路是優於貝氏分類法。
六、結論
在本研究中我們以類神經網路與貝氏分類法
建立了進行彩色影像分割的軟體元件,同時比較
了兩種方法在影像分割應用上的限制與優劣。主
要的研究結論有以下幾項:
以影像的色彩資訊為類神經網路或貝氏分類法
的輸入,經過監督式學習或訓練的過程,在後
續的回想過程可以自動地進行影像分割,達到
背景分離或前景物件自動辨識之目的。
對於應用類神經網路或貝氏分類法進行影像分
割的適用條件,本研究中提供了以二維圖示的
方法進行比較分析,使採用此兩種方法進行影
像分割之影響因子及選擇上的應有考慮得以釐
清。
在訓練過程中,各類別中取樣點是否均勻,對
於貝氏分類法的影像分割結果有較大之影響,
而類神經網路在影像分割的應用上,對於取樣
點的均勻程度則較具有強健性。
本研究中所得到的實驗結果顯示,通常貝氏分
類法較適用於正確的照明與背景單純的條件下
的影像分割,而類神經網路則較適用於背景複
雜或具有非線性分類要求之影像分割處理上。
進行影像分割前,若能對應用對象或影像的分
類資料分佈狀態能有預先的瞭解或基本之資
訊,將有助於在使用類神經網路或貝氏分類法
時有較佳的選擇。
七、參考文獻
1. 張維哲。1992。人工神經網路。台北:全欣資
訊圖書股份有限公司。
2. 張仁明。1999。自然光照下彩色種苗影像的背
景分離與特徵抽取。碩士論文。台北:國立
台灣大學農業機械工程學研究所。
3. 葉怡成。1993。類神經網路模式應用與實作。
第四版。台北:儒林圖書公司。
4. 鄭聖夫、林達德。1997。甘藍種苗之生長量測
與模式分析:(一)自動量測系統的建立。農業
機械學刊 6(4): 69-83。
5. Duda, R. O. and E. H. Peter. 1973. Pattern
Classification and Scene Analysis. 2nd ed., New
York: John Wiley & Sons.
6. Gose, E., R. Johnsonbaugh and S. Jost. 1996.
Pattern Recognition and Image Analysis. Upper
Saddle River, NJ: Prentice Hall, Inc.
7. Kolmogorov, A. N. 1957. On the representation of
continuous functions of many variables by
superposition of continuous functions of one
variable and addition. Dokl. Akad. Nauk USSR 114:
953-956.
8. Lippmann, R. P. 1987. An introduction to
computing with neural nets. IEEE ASSP
Magazine. 4: 4-22.
9. Otsu, N. 1979. A threshold selection method for
gray level histogram. IEEE Transactions on
Systems, Man and Cybernetics SMC-9 (1),
(January).
10. Panigrahi, S., M. K. Misra, C. Bern and S. Marley.
1995. Background segmentation and dimensional
measurement of corn germplasm. Transactions of
the ASAE 38(1): 291-297.
11. Pla, F., F. Juste, F. Ferri and M. Vicens. 1993.
Colour segmentation based on a light reflection
74 農業機械學刊 第8卷 第3期 1999年9月
model to locate citrus fruits for robotic harvesting.
Computer and Electronics in Agriculture 9: 53-70.
12. Shearer, S. A. and R. G. Holmes. 1990. Plant
identification using color co-occurrence matrices.
Transactions of the ASAE 33(6):2037-2044.
13. Simonton, W. and D. Graham. 1996. Bayesian and
fuzzy logic classification for plant structure
analysis. Applied Engineering in Agriculture 12
(1): 89-97.
14. Tian, L., D. C. Slaughter and R. F. Norris. 1997.
Outdoor field machine vision identification of
tomato seedlings for automated weed control.
Transactions of the ASAE 40(6): 1761-1768.
15. Timmermans, A. J. M. and A. A. Hulzebosch. 1996.
Computer vision system for on-line sorting pot
plant using an artificial neural network classifier.