TELKOM NIKA , Vol.12, No .4, Dece mbe r  2014, pp. 89 0~8 9 6   ISSN: 1693-6 930,  accredited  A  by DIKTI, De cree No: 58/DIK T I/Kep/2013   DOI :  10.12928/TELKOMNIKA.v12i4.437    890      Re cei v ed Se ptem ber 12, 2014; Revi se d Octob e r 27  2014; Accept ed No vem b e r  15, 2014   Prediction and Realization of DO in Sewage Treatment  Based on Machine Vision and BP Netural Network      Liu Liping*, Li Zhigang, Sunjinsheng ,  Liangna   Schoo l of Information En gi ne erin g, Hebe U n ited U n ivers i ty, T angshan, C O  06300 0C hin a   Ph./F ax:+ 86-0 315 25 972 25   *Co rre sp ondi ng autho r, e-mail: Liulp @ h euu.ed u.cn       A b st r a ct   Dissolv ed Oxy gen (DO) is on e of the most imp o rtant par a m eters  descri b ing b i och e m ic a l  process   in w a stew ater treatment. It is usua lly  me asur ed w i th  diss olv ed oxy gen  meters, and c u rre ntly galv a n i c a n d   pol arogr ap hic  electro des ar e  the pred o m i n ant metho d s. Expens ive,  me mbr a n e  surfac e inactiv a tio n , and   espec ial l y ne e d  of clean in g and ca libr a tin g  very fr equentl y  are common  disadv anta g e s  of electrode- type   me asuri ng se n s ors. In our w o rk, a novel  met hod for  Pre d icti on an d Re ali z a t ion diss olve oxyge n  bas ed- on  Machi ne V i sio n  a n d  BP N e tu ral N e tw ork w a s rese arche d Pictures  of the  w a ter-body  su rface i n   aerati o n   basi n s ar e c a p t ured  an d tran sforme into  H S I space   d a ta. T hese  d a ta p l us the  corres p ond ent  measur e d   DO valu es are  process ed w i th  a ne ural  netw o rk. Using  th w e ll-train ed n e u ral n e tw ork, a satisfied res u lt  for  classifyin g diss olve d oxyg en a ccordi ng to the  w a ter-body pic t ures has be en  reali z e d .     Ke y w ords : dis s olve d oxyg en,  mach in e visio n , BP neural  n e tw ork, sew age treatment       1. Introduc tion  Dissolve d O xygen (DO )   is d e fined  a s  the  mea s u r e of  wate quality indi ca ting fre e   oxygen disso l ved in wate r. The qu antity of dissol ved  oxygen in wa ter is typically expresse d in   parts pe r milli on (ppm ) or  milligram s  p e r liter  (mg/l) . S i nce  oxygen i s  solubl e in  water, the a m o unt  of dissolved o xygen in wate r is in  the stat e of dynamic  equilib rium [1 ].  The most co mmon appli c ation for dissolved oxyge n  measure m ent occurs in waste   water treatm ent. Biochem ical b r ea kdo w n of sewag e  is a c hieve d  by bacte ri al attack i n  the   pre s en ce  of  oxygen. Thi s  pro c e s s typically ta kes  pl ace i n  an  ae ration b a si of a wa ste  water   treatment  pla n t, and i s  a c compli sh ed  b y  aeratin g o r  bubbli ng  air  (or pu re  oxygen) th ro ugh t he  wa ste wate r.  Maintainin g the prope r co nce n trati on  o f  dissolved o xygen in the  aeratio n ba si n is   necessa ry to  ke ep mi cro o rga n isms al ive and   allo b r ea k do wn of  organi c wa ste.  Th ese   microorgani sms turn o r g anic  waste s  into inorga nic byprodu cts, spe c ificall y , carbon dio x ide,  water an sludge.  Whe n  the me asu r ed  dissolve d oxygen  d e crea se s b e l ow a  de sired   con c e n tration ,  the plant co ntrol  sy stem  automatically add s air to  t he ae ration b a sin to p r ovi d e   life-su staini ng  oxygen fo r t he mi croorga nism s, an d t o  facilitate   th orou gh  mixing of the  orga nic  wa ste. Witho u t enough di ssolved oxyge n  con c ent rati on, benefici a l  microo rg ani sms will die while   trouble s o m e filamentou s microbe pro liferate, cau s i ng slud ge se ttling proble m s.  Conve r sely,   aeratio n i s  th e large s sin g le o perating  expen se,  an d oxygen  lev e ls  gre a ter th an the  requi red   optimum con c entration s are wa steful an d inefficient.   There a r e   many differe nt dissolve d  oxygen  se nso r  te ch nol ogie s , ea ch  with  its  advantag es a nd disadvant age s [2]. Most continuo us measurement   dissol ved ox ygen se nsors in   today’s m a rketplace u s e  galvani c (spontan eou s voltage) or elec trolytic (applie volta ge)  measuri ng cells. In eith er case, the system  m easure s a n  e l ectri c  curre n t betwee n   two  electrode s,  whi c h ispro p o rtional to th e dissol ved  oxygen in the pro c e s s. The mo st bori ng  disa dvantag e  of oxygen  sensor te ch nol ogie s  in  co m m on i s  the  o b ligatory  routi ne mai n tena nce  of DO  se nsors [3]. The  se n s or shoul d be  clea ned,   and /or the  elect r ode s shoul be repla c e d  i n  a  sho r t time  p e riod,  an d t hen  re -calibrated  ca re full y.  Otherwise,  the se nsor’ s  sen s ibility and   measuri ng accuracy will be declined greatly.    For  copi ng  with this  pro b lem, a data  fusion  and  artificial intell igen ce meth od wa p r es e n t ed  in  th e  lite r a t ur e [4 ]. It u s es   s e ve ra l ea s y  me as ur e d  pa r a me te rs , su c h  as  e l ec tric a l   curre n t, PH,  temperature,  etc, to p r edi ct indi re ctly dissolved  oxygen value  u s ing  an  artificial   neural  netwo rk m e thod. In   our work, a  vision   ba se d m e thod fo cla s sifying  DO  was  re se arche d   Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 930       Predi ction an d Reali z ation  of DO in Sewage Tr eatm ent Based on  Machi ne Visi on … (Liu Li p i ng)  891 [5]. It use s  t he  colo r info rmation  of  water-body i n   the ae ration   basi n  a s  th e  analy s is ba se,  imitating an experien c e d  o perato r s  ocul ar se ns e. HSIspa ce data a r e extra c ted from the wate r- body imag es.  These data  plus the m e a s ured  DO val ues a r e p r o c essed  with a n  artificial n e u ral  netwo rk.  Usi ng the  well -traine d  ne ura l  netwo rk,  a  sat i sf ie d r e sult  f o cla s sif y ing di ss ol v ed  oxygen acco rding to the water-body pi cture s  ha s bee n reali z ed.   The arti cle is stru cture d  a s  follows. Secti on I is an i n trodu ction.  Section II pre s ent s the  technologi cal  background and methodology. Sect ion III describes the image  processi ng and  colo ur fe ature extra c tion  of wate r-b od y. Section  IV gives  out th e DO  cl assifi cation  metho d  and   result. Sectio n V ends with  the con c lu sio n      2. Backg rou nd and Meth odolog y   Image processing i s  a  potential  approa ch  to  develop a n  online  sy stem to  aerate  cla ssifi cation  in  se wage t r eatme n t  based  on  the visual  col o pro p e r ties of  water whi c h   stimulate s  hu man eyes to  distingui sh the vari etie s. BP neural ne twork (ANN) techn o logy is a  kind of nonli n ear scie nce d e velope d fro m  1980’ s, wh ich trie s to simulate so me  basi c  attribut es   of  people, such as self-a dapting, self-o rgani zin g  an d fault tolera nce. ANN h a s  be en u s ed  in  many  field s , such   a s   mo de identificatio n and system  si mulation.Inte grating   water colo featu r e  o f   ANN, the p a per h ope d that artificial  neural  net wo rk m odel  co uld pe rform  the re sea r ch  of  Aerating  Cla s sificatio n  well . For all th ese ,  the pape r d r ew the foll owi ng research  plan  (Figu r 1).  Therein ,Wat er photo s  are  collecte d  in xijiao  swa ge  of TangShan  in July 26, 2012,and DO were  measured in  situ simulta n e ous.           F i gure 1 . T he Frame of Rese a r ch Plan       The meth od ology of cla ssifying  dissolved  oxyge n  usi ng ima ge processin g  and BP   neural n e two r k i s   sho w n   schemati c ally  in Fig.  1. A t  the begi nni ng, a lot  of image s of th wa stewater-b ody we re cap t ured a nd ev ery co rr espo ndent me asu r ed  DO value s  we re  re cord ed.  Then the ima ges  were pro c e s sed with  MATLAB and   their colo ur f eature s  were  extracted fro m   these im age s. The colou r  feature val ues a nd th e  DO cl as sif i c a t i on re sult s ac cor d ing t o  t h e   measured di ssolved oxyge n  values  we re taken  as  th e data for trai ning the ne ural netwo rk. After  the trai ning  o f  the ne ural n e twork bein g  well  do ne, t he  coeffici ent s of  the  neu ral net work were  determi ned.  Finally, at th e on -line  ste p , the  colo ur  feature  of a  new imag e o f  the waste w ater- body is fed  to the neural  netwo rk a n d  the cla s sification of di ssolved oxyge n  is e s timated  accordingly.       3. Image processing a nd color fea t ur e  extra ction   3.1 Pre-pro c essing of  Water Image    The wate i m age nee ds  seve ral ste p s of  pre-proce s sing befo r e the  colo r feature   extraction fo r BP neural n e twork a s  inp u t, which i n cl ude ima ge di gital, intercep tion of re sea r ch   Evaluation Warning : The document was created with Spire.PDF for Python.
                          ISSN: 16 93-6 930   TELKOM NIKA   Vol. 12, No. 4, Dece mb er 201 4: 890  – 896   892 regio n , image  de-noi sin g  a nd image  seg m entation.  Th ere, the imag e digital has  been p r o c e s sed   by image in p u t device ( the  digital came ra, sojob s  th at use r s ne e d  to do a r interception  of  resea r ch regi on, image de -noisi ng and i m age segm e n tation.   There ima g e s  of  wate r t a ke nby digit a l camerawe re p r ep ro ce ssed  on  Matl abs (6.5 ).  First, the  re search  re gion  we re  sel e ct ed (200 dpi, (200 × 2 00)) , t hen ima ge  median  filter is  desi gne d to  remove the  no ise  of the im a ge a nd  ke ep t he d e tails of t he ima ge,an d  it ca n p r o c e s s   200 ×20 0  ima ge succe s sfu lly. In the phase  of  seg m enting a ima ge, use the  best threshol d   method (BT M ) to segm ent image s.      3.2 Color Fe ature Ex tra c tion of Wa ter  Image  A color  spa c e is a tool to  visualize, creat e and  spe c ify the colo r.Followin g  a spe c ific  appli c ation, the col o r may  be sp ecifie d in different  wa ys. For hum a n s the colo r is a pe rceptio n of  brightn e ss, h ue a nd  satu ration. Fo co mputers  col o r is an  excita tion of three  pho sph o rs  (b lue,  red, and g r e en), and for a printing p r ess color i s  a reflectan c e and ab sorban ce of cyan,  magenta, yell ow an d bla ck inks  on the  pape r. So,  a colo r spa c e i s  the represe n tation of three   attributes  use d  to descri b e  a colo r. A color  spa c e i s   also a m a the m atical rep r e s entatio n of our  perceptio n.  Even thoug RGB  colo sp ace  ca n b e  u s ed  for  pixel  cla ssifi cation,  it has di sadv antage of illuminatio n depe nde nce. It means t hat if the  illumination of i m age  cha n g e s, the water pixel  cla ssifi cation  rule s ca n not perform  well . Furtherm o re, it is not p o ssible to se parate a pixe l's  value into intensity and ch romin a n c e. The ch romin a n c e ca n be used in modelin g colo r of water  rathe r  than m odelin g its int ensity. This  g i ves mo re  rob u st re present ation for  wate r pixels. So it  is   need ed to tra n sform RGB  colo r space to one of t he colo spa c es whe r the se paratio between   intensity  an d chromin a n c e is  mo re discri m inat e. Be ca use  of the  co nversi on  bet wee n  RGB a nd  HSI  colo r spa c e s we use HSI  colo r spa c to  mo del water pixels. The  conve r si on  from RGB   to  HSI colo r sp a c e is fo rmulat ed as follo ws:     (1)                                                                                                                           (2)                                                                                                           (3)     (4)         Whe r H i s  hue, S an d I are  ch ro minan ce a n d  intensity. T he computati on was  perfo rmed  by  a p r og ram  d e velope d u s i ng MATLAB   6.5. Mean  va lues of  R,G  and B  of  wat e r   resea r ch regi ons a nd H,S and I throug h  color  spa c e t r an sform a tion  was give n in table 1 :      Table1.  The  test sam p le   Index  DO  5036   4.8  155.741   154.3571  151.3306  62.5562   0.0193   151.7806   5037   4.8  155.1651  153.4655   150.8566   63.4016  0.0164  152.3842   5038   4.85  159.25   158.25   155.5   49.7767  0.0138  157.6667   … …  …  …  …  …  …  …  5119   2.55  152.8489  151.6211   147.843   53.0012  0.0199  149.9324       4. Establish of BP Neural  Net w o r k for Aera ting Cla ssifica tion     As the colo r feature p a ra m e ters  com p ri sing H , S and I were a c hiev ed by Matlab, and in   the stu d y of t he  relativity b e twee n va riet y and  col o r fe ature  are expl ored,  indi cate s it i s  fe asi b le to   ] B G , 180 B G 0 ) 3 arctan( 90 [ 360 1 F H 3 B G R I ] B) , , min( [ 1 S I G R B G G R B 2 F Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 930       Predi ction an d Reali z ation  of DO in Sewage Tr eatm ent Based on  Machi ne Visi on … (Liu Li p i ng)  893 use A NN in  monitori ng of  dissolved ox ygen in wat e r for aerating  cla ssifi cation.    Practice  pro v es  that ,the artificial ne ural n e t work is  suita b le to simulat e  su ch compli cated relation ship       4.1 Model of  BP Neur al Net w o r k for  Aerating  Clas sification    (1)  Normali z a t ion Processi ng for ANN  The valu es  of the three  cha r acte ri stic va riabl e s  a r e n o t at thesame  q uantitative level an d   the rang es of  their values  are al so dif-f e rent. The s differen c e s  in fluence the repre s e n tation  o f   each cla s sof stitchin g defe c ts. To produ ce the mo st efficient traini ng,  the dataa re preprocesse d   before traini ng and ne e d  to be pro c e s sed in  u n iformme asurement. Another rea s on  for  prep ro ce ssin g the data ist hat whe n  the  input vari abl es of a si gm oid functio n  a r e in the rang eof  [0 , 1 ], th e  d i s t a n c e s  o f  th e  ou tp u t s ar e  ver y  d i ffe re n t, w h ic h isu s e f u l  fo r c l a s s i fic a tion  and  recognitio n .T he data prep roce ssing i s ex pre s sed a s  follows:     (5)     Whe r e the  sy mbol “Y ” is th e relativ e   cha r acte ri stic  val ue, “X” i s  the  absolut e cha r acteri stic  valu e,  “Xmin” a nd “Xmax” are th e minimum a nd the maxim u m values of  “X”.     (2) Mo dula r  Structu r e of BP Neural Net w ork  Theo retical re sea r ch ha s p r oved that if a n  A NN i n cl ud es bi ases,at l east a S - style  crypti layer a nd a  linear outp u t layer, it ca approa ch   an y rational fu n c tion.In this  pape r the  m odel  use d  hyperbo lic tangent S-style transfe func tion b e tween the input  layer and hi dden laye r, and  the hidde n la yer and outp u t  layer adopte d  linear tran sfer functio n A feedforwa rd  neu ral  n e twork was develo ped, wbi c wa s mad e  u p  of in put  layer hi dde n layer an d o u tput layer The ba ck pro pagatio n algo rithm was u s ed to lea r n a n d   train th e n eural net work The  A N mo del stru cture use d  wa s sh own   in Figu re  4,  in  whi c h     and  denote  the ma ss m a trice s   betwee n  the i nput la yer an d hi dd en laye r a n d  the  hidde n   layer a nd  out put layer, re spect i  rely;  a nd  denote  th e threshold v a lue  of the  n euro n s of  hidde n layer  and outp u t layer re spe e lively.          F i gure 2. T he structure of BP neur al net w o rk       min max min X X X X Y 1 2 1 2 1 2 1 2 Evaluation Warning : The document was created with Spire.PDF for Python.
                          ISSN: 16 93-6 930   TELKOM NIKA   Vol. 12, No. 4, Dece mb er 201 4: 890  – 896   894 The followi ng  three pa ram e ters  wa s ch ose n  as the i nput nod es o f  the neural n e tworks  predi ction m odel hue (H),Chro mina nc(S) and inten s ity(I).And  the classificatio n  of aerating  as  sho w n in Fig. 4 wa s ado pte d  as outp u ts.   After the inpu t and output node s were fi xed  on,the hi dden n ode s n eed to be fixed on by  dynamic con s tru c tion  met hod.That i s adeq uate  n o des were  e m ployed i n  t he b eginni ng ,and   then the voi d  nod es  will  b e  re moved  u n til the nu mb er of  hidd en  node can  n o t be mi nified . At  last,eight  wa s ad opted  a s  the optimal   numbe r of  hi dden  nod es. C on se quently ,the stru ctu r e  o f   neural networks p r edi ction  model of Aerating Cla s sification 3 x 8 x 3 as  sho w n  in Figure 4.       4.2 Resul t s a nd Its Analy s is  4.2.1 Model Training    The n e xt co d e  segme n t is used to  train  ea ch m odul e, wh ere  ne wff is  a M a tlab n eura l   netwo rk toolb o x function  to create  afee d-forwa r d ba ck-p rop agatio network with  the spe c ifi e d   para m eters.   net=n ewff(th resh old,[8,3],{' t ansig','l og sig' },'trainlm' ) ;   net.trainParam.epochs=1000;   net.trainParam.goal=0.1;   net=init(net);   net=train(net,P,T);        F i gure 3. Artific i al n eura l  net w o rk error curve       It can he  see n  that the trai ning  con s trin gen cy is p r ef erabl e for the  rea s on th at the targ et   error  can b e  rapidly achiev ed after trai ning 28 ep ochs The e r ror  curve of traini ng network was  sho w n in Fi g.5The refore, the relatio n shi p  betwe en co lor feature an d aerat ing cl assificatio n  can  be set up.At  the sam e   tim e ,the  ma ss matric es,  and   ,and  the th re shol d valu e v e ctors, and  ,can b e  o b tained corre s po ndin g lyan d were kept a s  the neu ral n e twork pa ram e ters, w hi ch  were sh own in Table 2 an d  Table 3           1 2 1 2 Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 930       Predi ction an d Reali z ation  of DO in Sewage Tr eatm ent Based on  Machi ne Visi on … (Liu Li p i ng)  895 Table2. Ma ss values bet we en input an d hidde n layers, and thre shol d value of hid den layer  Mass v a lue s     Thres hold v a lue     Hue H  Chro mina nc(S Inten s it y ( I)  0.6518  -7.6573   8.2532   0.8182   0.2436  -0.6510   2.6207   4.0872   -6.2405  -0.6751   0.8410   -5.367   -3.9012  -3.8356   3.8281   4.6958   0.4494  1.5544   -5.8424   2.8022   0.0992  -2.3539   -0.8121   4.6878   -6.2933  1.6178   -0.7029   -1.4721   -2.9985  -3.2261   -4.8568   -4.7064       4.2.2 Resul t s  and discuss ion  The verifying  result s we re  showed in T able  2 after testifyingsamp l es we re inp u tted to   the having be en traine d ANN model.       Table 3. The  results of validation of the m odel   H S  H.(act ual)   M.(act ual)   L.(ac t ual )   H.  M.  L.  0.311335  0.0172   0.614487   0.292836  0.0157   0.620588   0.308533  0.0187   0.59174   0.322089  0.0092   0.607516   0.399052  0.0149   0.614892   0.238413  0.0838   0.446399   0.234573  0.0419   0.525496   0.315992  0.0166   0.525293   0.200985  0.0771   0.492889   0.181888  0.0166   0.570262   0.339193  0.0164   0.612217   0.380631  0.0154   0.643307   0.315996  0.0303   0.568026   0.437966  0.0249   0.531571   0.485452  0.0259   0.548281   0.255985  0.0297   0.514312   0.268197  0.0249   0.644771   0.281333  0.0297   0.535976   0.248457  0.0206   0.550715   0.236011  0.016   0.626797       As can b e  seen from Ta ble 3,  the  predictio n erro rs of t he t w en ty group wa s two, i n   other  wo rd s the p r edi cti ng a c curacy  of the m o d e l is  better  than 90%  a c cordi ng to   the   experim ent. It can be con c l uded that ima ge pro c e s sin g  techni que combinin g with  artificial neu ral  netwo rk m e th od is on e of effective mean s for  the predi ction of aerating cla s sificati on.       5. Conclusio n s     The colo r fe ature of wate r image in swage tr eatm e n t  used to aerating cla s sification ca be o b tained   by analy z ing  the water i m a ge u s in g ima ge p r o c e ssi n g  techniq ue.  The  colo r fe a t ure  of HSI color  space ca n be  descr i bed by  the colo r tran sform a tion fro m  RGB col o spa c e.   The col o r fea t ure of HSI color spa c e were empl oyed  as input fact ors, an d the non-li nea mappin g  mo del was buil t  based o n   there l a tion ship bet wee n  colo r fe ature and  ae rati ng  cla ssifi cation  of three BP  n eural  net works. The  neu ral  netwo rk mo d e l sh ows a  hi gh a c curacy  of  predi cting the  aerating  cla s sificatio n  in swag e treatme nt.      Referen ces   [1]  Yang  Xia o min g , Li Mi ngh ua n, Yang  Pu,  et al. Diss o lve d  Oxyg en  Pre d ictio n  Mod e and  its Erro r   Revision. C ontr o l Eng i ne eri ng  of Chin a . 200 4; 11(2): 127- 12 9.  [2]  S. Maqu iné  d e  Souz a, Y. Gr andv alet, T .  Deno eu x.  M onit o rin g  of  a s l ud ge  de w a t e ri ng  equ ipme nt b y   imag e classific a tion.  W a vel e t Appl icatio ns in  Industria l Proc essin g  II . 2004; 5607: 3 4 -45.   1 1 Evaluation Warning : The document was created with Spire.PDF for Python.
                          ISSN: 16 93-6 930   TELKOM NIKA   Vol. 12, No. 4, Dece mb er 201 4: 890  – 896   896 [3]  F e i Ni, Z huan g F u , QiXin  Cao, et al.   Image pr ocess i ng meth od fo r e y es l o cati o n  base d  on   segmentation tex t ure. Sens ors  and Actuators .  2008; 1 43(2):  439- 451.   [4]  Veere ndra S i n gh, Veer en dra  Si ng h. Appl ic ation  of imag e  proce ssi ng  an d radi al b a sis  neur aln e t w ork   techni qu es for ore sortin g an d  ore classific a ti on.  Miner als E ngi neer in g . 20 10; 18(1 5 ): 141 2-14 20.   [5]  W K . W ong, CW M. Yuen. Stitchin g defect d e tect ion  and cl assificati on us i ng  w a v e l e t transform and BP   neur al net w o rk .  Expert Systems w i th Appl ic ations . 20 09; 3 6 (2): 384 5-3 8 5 6 [6]  J. Qiao, N. W a ng, MO. Ngadi , et al. Predicti ng me ch an ical  properti es of fried ch icken  n ugg ets usin g   imag e proc ess i ng  an d ne ura l  net w o rk tec h n i qu es.  Jour nal  of F ood E ngi n eeri ng.  2 011; 79(3);  1 0 6 5 - 107 0.  [7]  Yong Z e ng, D a -Ch eng  Li u, Ju-Xua n Li,  Xi ang-Y u  Ho u. Groupi ng H eur istics on V ehic l e Sch edu li n g   Probl em.  Base d o n  C han ge a b le E x pe ndit u r e  Co efficie n t M ode l.  T E LKOMNIKA Indo nesi an J ourn a of  Electrical E ngi neer ing . 2 013;  11(1): 39 9-4 0 Evaluation Warning : The document was created with Spire.PDF for Python.