Edge detection based on single layer CNN simulator using RK64) Osama H. Abdelwahed 1, and M. El-Sayed Wahed 1 Mathematics Department, Faculty of Science, Suez Canal University, Egypt Department of Computer Science, Faculty of Computers and Informatics, Suez Canal University, Egypt Abstract We proposed RK64) as a new method to make an ecient single layer CNN simulator to improve the computation time and to detect the edges of an input image. Choosing an adaptive step size using RK64) has a good impact to get better results for edge detection and to obtain a faster algorithm. Experimental results and comparisons are introduced. Index Terms Cellular neural network; Image processing; Single layer CNN simulator; Edge detection; RK64) 1 Introduction Edge detection is used in several elds such as image processing. It is useful especially, in the areas of feature detection and feature extraction. Dierent techniques have been proposed to detect the edges of an input image. Chua and Yang presented Cellular Neural Network CNN ) in 1988 []. CNN has many advantages such as its capability for parallel processing and continuous time dynamics. The applications in image processing include edge detection, noise removal and image segmentation especially in the medical elds such as mass detection in mammograms. Dierent numerical integration methods have been proposed in designing a single layer CNN simulator for edge detection. V. Murugesh and K. Kyung [5] modied the single layer CNN simulator [4] using RK-Gill [1] and RK-Butcher [1, 7, 8]. But the problem in their work is that edge detection results need to be improved since the edges are not accurately determined. In addition, the computation time cost is a little high. So our proposed method is presented to improve the quality and the accuracy of the edge detection and to save the computation time needed for detecting the edges of an input image. There are two types of cellular neural networks. The rst type is a single layer cellular neural network in which there is only one single state variable in each cell. The second type is a multilayer cellular neural network in which there are several state variables in each cell of CNN. The concept of multilayer cellular neural network implies that the interactions among the state variables of the same layer should be occurred []. However, in our work, our proposed method is based on using a single layer cellular neural network which has several applications in image processing. One of the most eective methods for analyzing the convergence properties of cellular neural networks is the lyapunov's method. It is is only a function of the input function and output function of CNN. From the properties of the function which represent lyapunov's method, the properties of steady state variables of CNN can be easily derived. The lyapunov's method always converges to a local minimum where CNN produces the desired output. We proposed the numerical integration algorithm RK64) which improved the edge detection results and saved the CPU time or the computation time. Our proposed method is based on using the adaptive selection step size algorithm to minimize the simulation time for single layer CNN simulator. This paper is organized as follows: in section ) the CNN technique was explained. Section 3) presented single layer CNN simulator. In section 4) the numerical integration algorithms in the related work and our algorithm were presented. Results were discussed in section 5). In section 6) conclusion was presented. Cellular Neural Network CNN is a mechanism used to process its nearby elements in parallel as in neural networks. CNN can be represented in a regular matrix form as shown in Fig. 1). It is composed of M x N elements. The elements of CNN are called cells. Cells which have indirectly connections can be aected with each other due to the the properties of CNN []. 1
Figure 1: A two dimensional CNN with 4 x 4 cells Fig. 1) shows a D-CNN with size equal to four. Each cell ci, j) has interactions with its nearest neighbors. CNN can be modeled by means of three parameters: A, B, and Z. The parameters A and B specify the interaction among CNN cells and Z is the bias value. Any image of size M N pixels is typically CNN with size M N. Each pixel is corresponding to a cell in CNN. The r-neighborhood of a cell, n m i, j) with radius m is: n r i, j) = {ca, b} max i=1,m;j=1,n { a i, b j } r, 1) Since r is a number greater than 0. Frequently, The expression "3 3 neighborhood" is used for r = 1, " 5 5 neighborhood" is used for r =, "7 7 neighborhood" is used for r = 3, etc. According to [], CNN is represented by the following equation: C dx ij dt t) = 1 R x x ij t) + Ca,b) Ai; j; k, l)y ab t) + Ca,b) Bi; j; k, l)u ab t) + I ij ) Figure : The output function The output of the cell y ij is set by the current source I yx as illustrated in the following equation:
I yx = 1 R y f x ij ) 3) f x) = 1 x + 1 x 1 ) 4) The output function f is illustrated in Fig. ). The output voltage y ij = I yx R y has the following form: y ij = f x ij t)) = 1 x ij t) + 1 x ij t) 1 ) 5) C and R x represent the parameters of the circuit. τ takes values from 10 8 10 5 seconds. This parameter has impact on the behavior of CNN. To measure the time in units, we set τ = CR x = 1. Z ij = I ij /C represents the bias of the cell. The state equation can be abbreviated as in the following equation: C dx ij dt t) = x ijt) + Ca,b) Ai; j; k, l)y ab t) + Ca,b) Bi; j; k, l)u ab t) + Z ij 6) Equation 6) represents the general equation of the standard CNN dynamics. The output equation depends mainly on the state values, the input values and the bias value. So the system of dierential equations of CNN is controlled by the templates {Ai, j; k, l), Bi, j; k, l), Z ij }. A and B are represented as in the following form: A = B = a 1, 1 a 1,0 a 1,1 a 0, 1 a 0,0 a 0,1 a 1, 1 a 1,0 a 1,1 b 1, 1 b 1,0 b 1,1 b 0, 1 b 0,0 b 0,1 b 1, 1 b 1,0 b 1,1,, Z The concept of space-invariant templates are exploited in CNN. This means that Ai, j; i + 1, j) is the same for all i, j) coordinates. The values of the template A and the template B in addition to the bias value Z are nineteen parameters which dene CNN in the case of 1-neighborhood. 3 The proposed method Our presented method was based on the single layer CNN algorithm mentioned in [5]. We introduced the numerical integration method, RK64) in the single layer CNN algorithm for edge detection. Our method has decreased the CPU time or the computation time of this algorithm. This improvement was accomplished by choosing an adaptive step size when RK64) was applied. So when the step size was increased to some extent, this means that the computation time would be decreased. This point is one of the most essential parts in the proposed algorithm. So our contribution lies in increasing the value of the chosen step size gradually to some extent using RK64) to obtain shorter CPU time. In addition, the algorithm improved the edge detection results. Our results will be compared to those introduced in the literature [5]. Actually the idea of the algorithm in [5] is mentioned as follows: the centers of the templates A and B are passed to the input image pixel by pixel through CNN processor till the algorithm converges to the steady state values [5]. This means that the nal state is the approximated output image with some error tolerance. Three dierent values for the templates A, B and the bias value Z of CNN processor are applied according to the kind of the application. The application will be edge detection, averaging template, or connected component. Although 3
Figure 3: Flow chart of single layer CNN algorithm 4
our proposed algorithm essentially for edge detection only, but the other two templates, averaging template and connected component are used for comparison purposes as we will mention below. The ow chart of the single layer CNN algorithm[5] is shown in Fig. 3). The essential part in the ow chart will be the proposed numerical integration algorithm RK64) that will be discussed in section 4.). As we mentioned before that our purposed numerical integration algorithm has two important points: First, to make a faster algorithm for edge detection by decreasing the CPU time; Second, to improve the edge detection results. 4 The numerical integration methods CNN is represented by a system of dierential equations which is solved using numerical integration algorithms. Three numerical integration methods were used in the literature [5]. They were Euler, RK-Gill and RK-Butcher. Our proposed method RK64) used the adaptive step size formula [11] to minimize the local truncation error. Since by increasing the step size to some extent, the CPU time of the single layer simulator will be improved. These algorithms can be represented as shown in the following equation[5]: x ij n + 1)τ) x ij nτ) = ˆ τn+1 τ n f x nτ)) dnτ 7) In section 4.1), we will discuss the numerical integration algorithms mentioned in the literature [5]. In section 4., the proposed numerical integration algorithm RK64) will be mentioned in details. 4.1 The numerical integration algorithms used in the previous work 4.1.1 Euler method Euler's method is very simple to be used to solve a system of nonlinear dierential equations. It is a rst order method that uses local truncation error for each step and it uses a global truncation error at a given time. It is approximated according to Taylor series as in the following equation [3, 8, 9]: 4.1. RK-Gill method x ij n + 1)τ) = x ij nτ) + τf x ij nτ)) 8) The RK-Gill algorithm which was proposed by [1] requires four calculations per step as shown in the following equation: x ij n + 1) τ) = x ij nτ) + Where, 1 = x τf ij nτ)) ) = τf x ij nτ) + 1 kij 1 3 = τf x ij nτ) + 1 1 ) 1 + 4 = τf x ij nτ) 1 + 1 + 1 ) 1 1 ) ) k ij 3 ) 1 [ 1 6 + ) + + ) ] 3 + kij 4 9) 4.1.3 RK-Butcher The RK-Butcher algorithm [3, 8, 9] requires six calculations for each step as shown in the following equation : x ij n + 1) τ) = x ij nτ) + 1 9 [ ] 7 1 + 3kij 3 + 1kij 4 + 7kij 6 10) Where, 5
1 = τf x ij nτ)) = τf x ij nτ) + 1 ) 4 kij 1 3 = τf x ij nτ) + 1 8 kij 1 + 1 ) 8 kij 4 = τf x ij nτ) 1 ) kij + kij 3 5 = τf x ij nτ) + 3 16 kij 1 + 9 ) 16 kij 4 6 = τf x ij nτ) 3 7 kij 1 + 7 kij + 1 7 kij 3 1 7 kij 4 + 8 ) 7 kij 5 4. The proposed numerical integration algorithm RK64) RK64) is a numerical integration method used in single layer CNN simulator. The equations of RK64) [11] are : 1 = τf x ij nτ)) = x τf ij nτ)) + 4 7 kij 1 3 = x τf ij nτ)) + 1 18 kij 1 + 1 6 kij 4 = x τf ij nτ)) + 66 343 kij 1 77 137 kij + 1053 137 kij 3 5 = x τf ij nτ)) + 13339 4915 kij 1 4617 16384 kij + 547 5348 kij 3 + 9507 159744 kij 4 6 = x τf ij nτ)) 6935 571 kij 1 + 3085 48334 kij + 333633360 7364941 kij 3 + 97160 11844467 kij 4 + 17687360 61043453 kij 5 7 = x τf ij nτ)) + 611 1891 kij 1 4617 7564 kij + 6041007 13176488 kij 3 + 1708836 100117 kij 4 3584000 646161 kij 5 + 6597591 797456 kij 6 Therefore, we have the following equation which represent the solution for RK6): x ij n + 1) τ) = x ij nτ) + 131 1800 kij 1 + 111931 39080 kij 3 + 319333 16898 kij 4 + 6144 47735 kij 5 + 40843 15177600 kij 6 + 1891 500 kij 7 11) Also the solution of RK4) as follows: y ij n + 1) τ) = y ij nτ) + 69453 6100360 kij 1 + 8364733 535804360 kij 3 + 691081 1789061040 kij 4 175547648 10565085 kij 5 + 5 kij 6 + 1891 500 kij 7 1) Our contribution is based on applying the adaptive step size selection method in the single layer CNN simulator using RK64). According to [6], The step size h of rs) order RK methods was modied in terms of the error by stepeps) [10] by using the following equation: h n+1 = f h n tol error n ) 1 s+1, 13) Since f is a safety value and h n+1 = x n+1 x n is approximated according to the estimation of the local truncation error error n which is approximated using the equation[6]: error n xˆ n yˆ n 14) 6
Since xˆ n and yˆ n represents the approximated solutions of order rth and sth respectively. And tol represents the required tolerance. If error n+1 tol, this implies that y n+1 is acceptable otherwise, Equation 13) is recomputed by substituting error n error n+1. By substitutingr = 6 and s = 4, the value of the step size as follows: h n+1 = f h n tol error n ) 1 5, 15) So we use Rk64) to make an ecient single layer CNN simulator for edge detection and higher performance. 5 Experimental Results As we mentioned above that the simulation time used in the algorithm is the real CPU time. Our simulator was executed on a machine with processor core i5. The input image is a boat image. The edge detection results are shown in Fig. 4). The input image and output image are shown in Fig. 4a) and Fig. 4b) respectively. The performance measures are shown in Fig. 5). Using our proposed algorithm, from Fig. 5a), we notice that the simulation time due to simulating a small diamond image used to detect the edges of the input image is better than those used in the literature. a) Input image b) Output image Figure 4: Results of edge detection Another very important point is choosing an adaptive value for the step size. Our proposed method used RK64) to optimize the value of step size to some extent using the adaptive step size algorithm. In Fig. 5b) we notice that the value of step size for our proposed algorithm is higher than those used in the literature. If the value of step size is very small, the algorithm will take much time otherwise if the value of step size is very high, the algorithm might diverge. The results of gure 5b) obtained by simulating a small diamond image more than one hundred times. Actually, choosing a proper value of the step size helped in designing an ecient single layer CNN simulator which has some capabilities like improving the simulation time and enhancing the edge detection results. i.e. this means that the local truncation error for each step is decreasing when compared by the numerical integration algorithms which are used in the literature. So using RK64) in the single layer CNN simulator increased the eciency of the single layer CNN simulator because using the selection step size algorithm in RK64) enhanced the 7
quality of the edge detection results and minimized the local truncation error which implies a faster performance for the proposed simulator. a) CPU time for 4 dierent methods b) Maximum step size for 4 dierent methods: 1- Edge detection - Averaging template 3- Connected component Figure 5: Measures of performance Table 1) summarizes the results of CPU time and the corresponding maximum step size for the proposed method and the methods used in the literature. We notice that our proposed method has the maximum value of step size and this means that the corresponding CPU is absolutely has the minimum value. Also, table ) shows the maximum step size for both averaging and connected component templates. According to these results, our proposed numerical integration algorithm has shown faster CPU time i.e. shorter time for the single layer CNN simulator. Method CPU time Maximum step size Euler 5.5 RK-Gill 0 1 RK-Butcher 6 RK 64) 4 3.5 Table 1: Results of CPU time and maximum step size for edge detection Method Averaging template Connected component Euler.7 RK-Gill 1.5 1.8 RK-Butcher 3 RK 64).8 4. Table : Results of maximum step size for averaging template and connect component 6 Conclusion Using our proposed numerical integration algorithm RK64), we achieved better results than those presented in the literature. So our method improved the simulation time or CPU time for the single layer CNN simulator. This 8
contribution utilized the adaptive step size algorithm using RK64) which implied a faster single CNN simulator. There are further studies needed to improve the obtained results by choosing an ecient numerical integration algorithm which improves the CPU time and edge detection for the single layer CNN simulator. References [1] JC. Ban and CH. Chang. When are two multi-layer cellular neural networks the same? Neural Networks, March 016. [] L. O. Chua and L. Yang. Cellular neural networks: Theory and applications. IEEE Trans. Circuits and Systems, 1988. [3] N. Huang and CF. Ma. Modied conjugate gradient method for obtaining the minimum-norm solution of the generalized coupled sylvester-conjugate matrix equations. Applied Mathematical Modelling, 40):160175, January 016. [4] C.C. Lee and JP. de. Gyvez. Single-layer cnn simulator. In IEEE International Symposium on Circuits and Systems, 1994. [5] V. Murugesh and K. Kyung. An ecient edge detection using raster cnn simulator. In Proceedings of the 5th international conference on Convergence and hybrid information technology, pages 63464, 011. [6] TD. Papanikolaou and D. Tsoulis. Assessment of numerical integration methods in the context of low earth orbits and inter-satellite observation analysis. Acta Geodaetica et Geophysica, January 016. [7] G. C. Paul and S. Senthilkumar. Exploration on initial structures of extrasolar protoplanets via new explicit rkahem4,4) method. The Egyptian Journal of Remote Sensing and Space Science, 181):18, June 015. [8] G. C. Paul and S. Senthilkumar. Execution of novel explicit rkarms4,4) technique in determining initial congurations of extra-solar protoplanets formed by disk instability. NRIAG Journal of Astronomy and Geophysics, January 016. [9] S. Senthilkumar, M. Lee, and G. Jeong. A modied improved runge-kutta fth-order ve stage technique to study industrial robot arm. Int. J. Patt. Recogn. Artif. Intell, 76), September 013. [10] L. F. Shampine. Some practical runge-kutta formulas. Math. Comp., 46:135150, 1986. [11] CH. Tsitouras and S. N. Papakostas. Cheap error estimation for rungekutta methods. SIAM J. Sci. Comput., 06):067088, 1999. [1] W. Xu, D. Meng, Y. Chen, H. Qian, and Y. Xu. Dynamics modeling and analysis of a exible-base space robot for capturing large exible spacecraft. Multibody System Dynamics, Springer, 33):357401, 014. 9