Prediction and Realization of DO in Sewage Treatment Based on Machine Vision and BP Netural Network

Dissolved Oxygen (DO) is one of the most important parameters describing biochemical process in wastewater treatment. It is usually measured with dissolved oxygen meters, and currently galvanic and polarographic electrodes are the predominant methods. Expensive, membrane surface inactivation, and especially need of cleaning and calibrating very frequently are common disadvantages of electrode-type measuring sensors. In our work, a novel method for Prediction and Realization dissolved oxygen based-on Machine Vision and BP Netural Network was researched. Pictures of the water-body surface in aeration basins are captured and transformed into HSI space data. These data plus the correspondent measured DO values are processed with a neural network. Using the well-trained neural network, a satisfied result for classifying dissolved oxygen according to the water-body pictures has been realized


Introduction
Dissolved Oxygen (DO) is defined as the measure of water quality indicating free oxygen dissolved in water. The quantity of dissolved oxygen in water is typically expressed in parts per million (ppm) or milligrams perliter (mg/l). Since oxygen is soluble in water, the amount of dissolved oxygen in water is in the state of dynamic equilibrium [1].
The most common application for dissolved oxygen measurement occurs in waste water treatment. Biochemical breakdown of sewage is achieved by bacterial attack in the presence of oxygen. This process typically takes place in an aeration basin of a waste water treatment plant, and is accomplished by aerating or bubbling air (or pure oxygen) through the waste water. Maintaining the proper concentration of dissolved oxygen in the aeration basin is necessary to keep microorganisms alive and allow break down of organic waste. These microorganisms turn organic wastes into inorganic byproducts, specifically, carbondioxide, water and sludge. When the measured dissolved oxygen decreases below a desired concentration, the plant control system automatically adds air to the aeration basin to provide life-sustaining oxygen for the microorganisms, and to facilitate thorough mixing of the organic waste. Without enough dissolved oxygen concentration, beneficial microorganisms will die while troublesome filamentous microbes proliferate, causing sludge settling problems. Conversely, aeration is the largest single operating expense, and oxygen levels greater than the required optimum concentrations are wasteful and inefficient.
There are many different dissolved oxygen sensor technologies, each with its advantages and disadvantages [2]. Most continuous measurement dissolved oxygen sensors in today's marketplace use galvanic (spontaneous voltage) or electrolytic (applied voltage) measuring cells. In either case, the system measuresan electric current between two electrodes, which isproportional to the dissolved oxygen in the process. The most boring disadvantage of oxygen sensor technologies in common is the obligatory routine maintenance of DO sensors [3]. The sensor should be cleaned, and/or the electrodes should be replaced in a short time period, and then re-calibrated carefully. Otherwise, the sensor's sensibility and measuring accuracy will be declined greatly.
For coping with this problem, a data fusion and artificial intelligence method was presented in the literature [4]. It uses several easy measured parameters, such as electrical current, PH, temperature, etc, to predict indirectly dissolved oxygen value using an artificial neural network method. In our work, a vision based method for classifying DO was researched  [5]. It uses the color information of water-body in the aeration basin as the analysis base, imitating an experienced operator's ocular sense. HSIspace data are extracted from the waterbody images. These data plus the measured DO values are processed with an artificial neural network. Using the well-trained neural network, a satisfied result for classifying dissolved oxygen according to the water-body pictures has been realized. The article is structured as follows. Section I is an introduction. Section II presents the technological background and methodology. Section III describes the image processing and colour feature extraction of water-body. Section IV gives out the DO classification method and result. Section V ends with the conclusion.

Background and Methodology
Image processing is a potential approach to develop an online system to aerate classification in sewage treatment based on the visual color properties of water which stimulates human eyes to distinguish the varieties. BP neural network (ANN) technology is a kind of nonlinear science developed from 1980's, which tries to simulate some basic attributes of people, such as self-adapting,self-organizing and fault tolerance. ANN has been used in many fields, such as mode identification and system simulation.Integrating water color feature of ANN, the paper hoped that artificial neural network model could perform the research of Aerating Classification well. For all these, the paper drew the following research plan ( Figure 1). Therein ,Water photos are collected in xijiao swage of TangShan in July 26, 2012,and DO were measured in situ simultaneous.

Figure1. The Frame of Research Plan
The methodology of classifying dissolved oxygen using image processing and BP neural network is shown schematically in Fig. 1. At the beginning, a lot of images of the wastewater-body were captured and every correspondent measured DO values were recorded. Then the images were processed with MATLAB and their colour features were extracted from these images. The colour feature values and the DO classification results according to the measured dissolved oxygen values were taken as the data for training the neural network. After the training of the neural network being well done, the coefficients of the neural network were determined. Finally, at the on-line step, the colour feature of a new image of the wastewaterbody is fed to the neural network and the classification of dissolved oxygen is estimated accordingly.

Image processing and color feature extraction 3.1 Pre-processing of Water Image
The water image needs several steps of pre-processingbefore the color feature extraction for BP neural network as input, which include image digital, interception of research There images of water takenby digital camerawere preprocessed on Matlabs (6.5). First, the research region were selected (200dpi, (200× 200)) ,then image median filter is designed to remove the noise of the image and keep the details of the image,and it can process 200×200 image successfully. In the phase of segmenting a image, use the best threshold method (BTM) to segment images.

Color Feature Extraction of Water Image
A color space is a tool to visualize, create and specify the color.Following a specific application, the color may be specified in different ways. For humans the color is a perception of brightness, hue and saturation. For computers color is an excitation of three phosphors (blue, red, and green), and for a printing press color is a reflectance and absorbance of cyan, magenta, yellow and black inks on the paper. So, a color space is the representation of three attributes used to describe a color. A color space is also a mathematical representation of our perception.
Even though RGB color space can be used for pixel classification, it has disadvantages of illumination dependence. It means that if the illumination of image changes, the water pixel classification rules can not perform well. Furthermore, it is not possible to separate a pixel's value into intensity and chrominance. The chrominance can be used in modeling color of water rather than modeling its intensity. This gives more robust representation for water pixels. So it is needed to transform RGB color space to one of the color spaces where the separation between intensity and chrominance is more discriminate. Because of the conversion between RGB and HSI color spaces, we use HSI color space to model water pixels. The conversion from RGB to HSI color space is formulated as follows: (1) Where H is hue, S and I are chrominance and intensity. The computation was performed by a program developed using MATLAB 6.5. Mean values of R,G and B of water research regions and H,S and I through color space transformation was given in

Establish of BP Neural Network for Aerating Classification
As the color feature parameters comprising H , S and I were achieved by Matlab, and in the study of the relativity between variety and color feature are explored, indicates it is feasibleto

Model of BP Neural Network for Aerating Classification
(1) Normalization Processing for ANN The values of the three characteristic variables are not at thesame quantitative level and the ranges of their values are also dif-ferent. These differences influence the representation of each classof stitching defects. To produce the most efficient training, the dataare preprocessed before training and need to be processed in uniformmeasurement. Another reason for preprocessing the data isthat when the input variables of a sigmoid function are in the rangeof [0, 1], the distances of the outputs are very different, which isuseful for classification and recognition.The data preprocessing isexpressed as follows: Where the symbol "Y" is the relative characteristic value, "X" is the absolute characteristic value, "Xmin" and "Xmax" are the minimum and the maximum values of "X".
(2) Modular Structure of BP Neural Network Theoretical research has proved that if an ANN includes biases,at least a S-style cryptic layer and a linear output layer, it can approach any rational function.In this paper the model used hyperbolic tangent S-style transfer function between the input layer and hidden layer, and the hidden layer and output layer adopted linear transfer function.
A feedforward neural network was developed,wbich was made up of input layer，hidden layer and output layer．The back propagation algorithm was used to learn and train the neural network．The ANN model structure used was shown in Figure 4, in which and denote the mass matrices between the input layer and hidden layer，and the hidden layer and output layer,respect i rely; and denote the threshold value of the neurons of hidden layer and output layer respeelively. The following three parameters was chosen as the input nodes of the neural networks prediction model：hue(H),Chrominanc(S) and intensity(I).And the classification of aerating as shown in Fig.4 was adopted as outputs.
After the input and output nodes were fixed on,the hidden nodes need to be fixed on by dynamic construction method.That is, adequate nodes were employed in the beginning,and then the void nodes will be removed until the number of hidden nodes can not be minified. At last,eight was adopted as the optimal number of hidden nodes.Consequently,the structure of neural networks prediction model of Aerating Classification 3 x 8 x 3，as shown in Figure 4.

Results and Its Analysis 4.2.1 Model Training
The next code segment is used to train each module, where newff is a Matlab neural network toolbox function to create afeed-forward back-propagation network with the specified parameters.
net=newff (  It can he seen that the training constringency is preferable for the reason that the target error can be rapidly achieved after training 28 epochs．The error curve of training network was shown in Fig.5Therefore, the relationship between color feature and aerating classification can be set up.At the same time,the mass matrices, and ,and the threshold value vectors, and ,can be obtained correspondinglyand were kept as the neural network parameters,which were shown in Table 2 and Table 3． 1

Results and discussion
The verifying results were showed in Table 2 after testifyingsamples were inputted to the having been trained ANN model.  As can be seen from Table 3, the prediction errors of the twenty groups was two, in other words the predicting accuracy of the model is better than 90% according to the experiment. It can be concluded that image processing technique combining with artificial neural network method is one of effective means for the prediction of aerating classification.

Conclusions
The color feature of water image in swage treatment used to aerating classification can be obtained by analyzing the water image using image processing technique. The color feature of HSI color space can be described by the color transformation from RGB color space.
The color feature of HSI color space were employed as input factors, and the non-linear mapping model was built based on there lationship between color feature and aerating classification of three BP neural networks. The neural network model shows a high accuracy of predicting the aerating classification in swage treatment.