2010 12th International Workshop on Cellular Nanoscale
Networks and their Applications (CNNA)

Image Processing Application Using CNN
with Dynamic Template
Makasakazu KAWAHARA

Takashi INOUE

Yoshifumi NISHIO

Dept. Electrical and Electronic Eng.,
Tokushima University
kawahara@ee.tokushima-u.ac.jp

Dept. Electrical and Electronic Eng.,
Tokushima University
takashi@ee.tokushima-u.ac.jp

Dept. Electrical and Electronic Eng.,
Tokushima University
nishio@ee.tokushima-u.ac.jp

Abstract— In this research, we propose an image processing
application using cellular neural networks (CNN) with dynamic
template (D-CNN). In D-CNN, the wiring weights of template
are dynamically changed at each update by learning. In thisstudy, we also focus on the number of converged value. Thus,
some converged values of each cell in the initial input image arechanged by effect of next input image in motion picture. Althoughinput image is only still image, we think that if multiple input
images are inputted to the D-CNN as motion picture, converged
values of each cell are continued to changed. We investigate theconverged value by changing input image. The results indicatethat D-CNN can be applied to the region segregated processing
for the motion picture.

I. I NTRODUCTION
Cellular neural networks (CNN) were proposed by Chua
and Yang in 1988 [1]. The idea of CNN was inspired from thearchitecture of the cellular automata and the neural networks.
Unlike the original neural networks, the CNN has local connectivity property. Wiring weights of the cells are establishedby parameters called the template. The performance of the
CNN is decided by the template. Also, the CNN has beensuccessfully used for various high-speed parallel signals processing applications such as image processing application [2][4], including medical image processing [5][6] and texture
segmentation [7]. Usually, the templates of all the cells in the
CNN are identical and those values do not change during theprocessing. This is good for implementation but restrict theperformance, namely the conventional CNN can not perform
image processing based on the local features of input images.
In the previous study, we have proposed cellular neuralnetworks with dynamic template (D-CNN) [8]. In D-CNN,
template is dynamically changed at each update by learning.
This learning method is inspired from the rank order learning.
Also, we have investigated the output characteristic of D-CNN
by using diffusion template. Usually, using diffusion template,values of cells using the conventional CNN converge to one
constant value. From the simulation results of the previous
study, we confirmed that the converged value of each cell is
divided to two or three values. Also, convergence process ismuch more rapid than that of the conventional CNN. However,
input image is only still image. We think that if multiple
input images are inputted to the D-CNN as motion picture,
converged values of each cell continue to change. Thus, we

978-1-4244-6678-8/10/$26.00 ©2010 IEEE

expect that another application using D-CNN is found fromthese multiple converged values.
In this study, we propose an image processing application
using CNN with dynamic template. We apply D-CNN tomotion picture processing through some investigations. Fromthe investigation of converged values by changing input images, we understand the output image. In this way, anotherimage is inputted to the D-CNN, the converged value of eachcell continues to change. According to our simulation, theconverged value of each cell is divided to more points than thecase of one input image. The results indicate that D-CNN canbe applied to the region segregated processing for the motion
picture.
In the Sec. 2, we review the basic of the standard CNN. In
the Sec. 3, we show the algorithm of the proposed D-CNN. In
the Sec. 4, simulation results using the proposed D-CNN are
shown. In the Sec. 5, we show image processing application
using this investigation result. The Section 6 concludes thearticle.
II. C ELLULAR N EURAL N ETWORKS [1]In this section, we explain the basic structure of the CNN.
The CNN has M by N processing unit circuits called cells.
Cells are arranged in a reticular pattern to M line N row.
We represent a cell C(i, j) using a variable i which denotes
vertical position and a variable j which denotes horizontal
position. The cell contains linear and nonlinear circuit elements. The CNN is an array of cells. Each cell is connected toonly its neighboring cells according to a template. Usually, thetemplate is the same for all cells except for boundary cells. The
CNN has the features of time continuity, spatial discreteness,
nonlinearity and parallel processing capability
State equation:
dvxij
dt

= −vxij +

i+r


j+r


A(i,j;k,l) vykl (t)k=i−r l=j−r
i+r


j+r


B(i,j;k,l) vukl (t) + I.

(1)

1(|vxij (t) + 1| − |vxij (t) − 1|).
2

(2)

+

k=i−r l=j−r

Output equation:vyij (t) =where vx , vy and vu represent a state, an output and an inputof cell, respectively. In the equation (1), A is the feedback
template and B is the control template. These and bias I
are collectively called general template. In this equation, thecontrol template depends on input value.

described as follows.
Update Method:
Assume that the template before update is given as Eq. (4).
T emplatenow :III. CNN WITH DYNAMIC TEMPLATE [8]In this section, we explain the algorithm of D-CNN. In our
research, we change input images when a certain calculation
times comes. In our D-CNN, the templates are updated atevery iterations by rank order learning. The learning steps in
our D-CNN are described as follows.

STEP 1: The state values and the output values of all the cells
in D-CNN are updated according to the discretized model of
Eqs. (1) and (2).

STEP 2: Calculate the comparison of the output value of eachcell with the one-step-past outputs of the cell and its neighborcells like Fig. 1. The comparison equation for the cell (i, j)
is described Eq. (3).

⎤
anow
anow
anow
11
12
13
⎦,
⎣ anow
anow
anow
Anow
21
22
23
(i,j) =
now
now
now
a31
a32
a33
⎤
⎡ now
now
b12
bnow
b11
13
now
⎦,
bnow
bnow
= ⎣ bnow
B(i,j)
21
22
23
now
now
now
b31
b32
b33
now
I(i,j)= I now .
⎡For example, we consider the case that the “winner” is (i, j)
and the “second” is (i − 1, j − 1). In that case, only anow
22 ,
now
now
bnow
,
a
and
b
in
Eq.
(4)
are
updated.
The
threshold22
11
11
value I is not updated in our learning method.
In our update algorithm, we change the learning rate in twoelements. The learning rates of the “winner” and the “second”
are shown as follows.
Learning rate:
N umber of calculation.
R1 = R10 1 −N umber of calculationmaxN umber of calculation.
R2 = R20 1 −N umber of calculationmax

Fig. 1. Comparison of output value of each cell with one-step-past outputsof the cell and its neighbor cells.

Comparison Equation:
past
now
Dif (i, j; k, l) = |vy,(i,j)− vy,(k,l)
|.

(4)

(5)
(6)

In this study, we decide N umber of calculationmax in
Eqs. (5) and (6) to be set to 10. Namely, the learning rates
of “winner” and “second” are changed until 10 calculations.
Then, after N umber of calculationmax becomes over 10,
the learning rates of “winner” and “second” become 0 andthe templates are not updated. By using the learning rate,
the elements of the template are updated according to thefollowing update equation.
Update Equation:(3)

STEP 3: Among the 9 calculated values of Dif (i, j; k, l), thecells with the smallest and the second smallest values aredefined as “winner” and “second”, respectively. In our update
algorithm, we change the learning rate in two elements. By
this step, we find the position of cells with the nearest and thesecond nearest values to the corresponding cell (i, j).
STEP 4: Update the elements of the template corresponding
to the positions of the “winner” and the “second”. Note thatin our proposed learning algorithm only two elements are
updated. The update method and the update function are

past
now
now
aupdatedwinner = awinner − R1 (vy,(i,j) − vy,(i,j) ).

(7)

past
now
now
aupdatedsecond = asecond − R2 (vy,(i,j) − vy,(i,j) ).

(8)

R1 and R2 decrease according to the Eqs. (5) and (6). The
initial learning rates are given as follows.
Initial Learning rate:
W inner: R10(0 ≤ R10 ≤ 0.1).

Second : R20 = R10 /4.

(9)
(10)

After the update using Eqs. (7) and (8), the updated templateis shown as follows. In Eq. (11), aupdated
and aupdated
are
11
22
updatedupdatedand b22are updated
the updated values. Also, b11

similarly.
T emplateupdated :
⎡

⎤
anow
anow
aupdated
12
13
11
⎦,
Aupdated= ⎣ anow
aupdated
anow
(i,j)
21
23
22
now
now
now
a31
a32
a33
⎤
⎡ updated now
b12
bnow
b11
13
updated⎦,B(i,j)= ⎣ bnow
bupdated
bnow
21
23
22
now
now
now
b31
b32
b33
updated= I now .
I(i,j)

(a)

(b)

(c)

(d)

(e)

(f)

(11)

STEP 5: The steps from 1 to 4 are repeated.
These learning steps inspired from the rank order learning.
IV. S IMULATION R ESULTS
In this section, we show the simulation results for multiple
input images using D-CNN. In the first step of this simulation,
an initial template is set to D-CNN. The elements of the initial
template are updated by using updated method in the previous
section. We choose the diffusion template [8] as an initial
template in this study as follows.
Initial Template:⎡⎤⎡
0.1 0.15 0.1
0 00.15 ⎦ , B = ⎣ 0 0
A = ⎣ 0.15 0
0.1 0.15 0.1
0 0
I = 0.

Fig. 2.
Simulation result. (a) Input image1. (b) Input image2 (after 10[τ ]). (c) Input image3 (after 10 [τ ]). (d) Output image before input image
is changed. (e) Output image1 after input image turn to Fig. 2(b). (f) Output
image2 after input image turn to Fig. 2(c).

⎤
0
0 ⎦,
0
(12)

Input image diffuses without limit by using the diffusion
template. Namely, all values of cells converge to one constantvalue.
In this simulation, we investigate two change patterns of
input images. First, we investigate convergence process when
the background of an image is bright. Figure 2 shows simulation results for two patterns of input images. The difference
between the first pattern and the second pattern is whether thesecond input image is Fig. 2(b) or (c). Namely, in the firstpattern, input image changes from Fig. 2(a) to Fig. 2(b) andin the second pattern, input image changes from Fig. 2(a) toFig. 2(c).
Figures 2(d)-(f) shows the simulation results for Fig. 2(a)(c). Figure 2(d) shows the output image between 0 [τ ] and10 [τ ]. In Fig. 2(d), all the cells have same converge value.
However, in Fig. 2(e) and (f), other converged value appear bychanging input image. Namely, we can say that the converged
value of the first input image changes by the next inputtedimage.
Second, we investigate convergence process when the background of an image is dark. Figure 3 shows simulation resultsfor 2 patterns of input images. Changing pattern of input image

(a)

(b)

(c)

(d)

(e)

(f)

Fig. 3. Simulation results. (a) Input image1 (initial input image). (b) Input
image2 (after 10 [τ ]). (c) Input image3 (after 10 [τ ]). (d) Output image before
input image is changed. (e) Output image1 after input image turn to Fig. 2(b).
(f) Output image2 after input image turn to Fig. 2(c).

is the same as in Fig. 2. In Fig. 3, we confirmed that theoutput image converges to one constant value whatever thevalue of changed area by changing input image. In Figs. 3(d)(f), converged value is same despite changing input images.
Namely, the converged value depends on whether the value of
background is over 0 or not.
Next, we investigate the behavior of the convergence processby changing input image.
A. Investigation of converged value
In this section, we investigate the converged value of eachcell in detail. In order to investigate the converged value, weinvestigate the output value of each cell in each step.

an inversed color. On the other hand, the changing point in
Fig. 2(b) changes darker.
In Fig. 4(b), we can see that if the background of image isnear to black, the changing points in Figs. 3(b) and (c) appear
with a black color. From simulation results, we should analyze
why the inversed color appears when the background of image
near to −1. For this analysis, we examine the elements of the
updated template in D-CNN.
B. Investigation of updated template
Next, we investigate updated template in Figs. 2 and 3 foranalysis. In this examination, we focus on the B template.
Because, in the state equation (1), B template is influenced
by the input value Vu .
First, the updated template for Fig. 2 is shown as follows.
U pdated T emplate in F ig. 2 :⎡⎤0.363 0.15
0.1
A = ⎣ 0.15 −0.016 0.15 ⎦ ,
0.1
0.15
0.1
⎡
⎤
−0.064 00−0.016 0 ⎦ ,
B=⎣ 0
0
0
0
I = 0.

(a)

From this updated template, we can see that the elements ofB template is negative in Fig. 2. If the next input is dark (plusvalue), the output is bright (negative value) because of thenegative B elements. While the input is bright (minus value),the output is dark (positive value). Therefore, the changed area
is detected as inversed color.
Next, the updated template for Fig. 3 is shown as follows.
U pdated T emplate in F ig. 3 :⎤⎡0.156 0.15 0.1
A = ⎣ 0.15 0.014 0.15 ⎦ ,0.1
0.15 0.1⎤⎡
0.056 000.0141 0 ⎦ ,
B=⎣ 0
0
0
0
I = 0.

(b)
Fig. 4. The changing process of vy . (a) The convergence process in Fig. 2.
(b) The convergence process in FIg. 3.

Figure 4 shows the convergence process in Figs. 2 and3. When the calculation time comes 10 [τ ], next image is
inputted. These graphs correspond to the output value of eachcell. In this investigation, we take C(i,j) =(183, 104) whichchange vu by changing input image.
From Fig. 4(a), we can see that if the background of image
is near to white, the changing point in Fig. 2(c) appears with

(13)

(14)

From this updated template, we can see that the elements ofB template is negative in Fig. 2. If the next input is dark (plusvalue), the output is bright (negative value) because of thenegative B elements. While the input is bright (minus value),the output is dark (positive value). Therefore, the changed area
is detected as inversed color.
From this updated template, we can see that the elementsof B template is positive in Fig. 3. We expected the exactly
opposite results to the previous one. However, the results aredifferent. For Fig. 3, the values of the output converge to 1
very quickly (see Fig. 4(b)) and new input cannot influence toinvert the color. Namely, the converged value of the changed
area dose not depend only on the color of the next input image,but also on the convergence speed for the initial image.

(a)

(b)

(a)

(b)

(c)

(d)

(c)

(d)

Fig. 5. Motion picture. (a) Input image 1 (from 0 to 10 [τ ]). (b) Input image
2 (from 10 to 20 [τ ]). (c) Input image 3 (from 20 to 30 [τ ]). (d) Input image
4 (after 30 [τ ]).

Fig. 6. Simulation results using conventional CNN for Fig. 5. (a) Output
image 1 ([τ ]=10). (b) Output image 2 ([τ ]=20). (c) Output image 3 ([τ ]=30).
(c) Output image 4 ([τ ]=40).

From the simulation results in this section, we feel that theregion segmentation where the object moves or not in motion
pictures is possible using D-CNN.

VI. C ONCLUSIONSIn this study, we have proposed an image processing application using cellular neural networks with dynamic template(D-CNN). In D-CNN, the template was changed by rank orderlearning. Also, we investigated the convergence for changing
output image and motion pictures. From the simulation results,
we confirmed a law of changing process of template of DCNN. Realizing more intelligent tasks depending on inputs
are our future research.

V. M OTION PICTURE PROCESSING
In this section, we try to apply D-CNN to motion picture
processing.
Figure 5 shows 4 input images as a motion picture. We canrecognize that the position of the doll gradually changed fromright to left through Figs. 5 (a) to (d) like a motion picture.
Also, the other object and the background do not change.
Figures 6 and 7 show the simulation results using theconventional CNN and D-CNN for learning rate R10 = 0.1,
respectively, in the input images of Fig. 5 using the initial
template of Eq. (12). In Fig. 6, the output images of theconventional CNN are not influenced by the change of the
input image, because the B template is set as 0. However, inFig. 7, the initial area filled with black and changing area is
detected. Furthermore, the final position of the moving object
is detected and the initial position of the moving object isfilled with black in Fig. 7(c).
From this simulation results, we can say that D-CNN iseffective for the motion picture processing. Also,the converged
value for a new image is different from that of the initial input
image.

R EFERENCES[1] L. O. Chua and L. Yang, “Cellular Neural Networks:Theory,” IEEE Trans.
Circuits Syst., vol. 32, pp. 1257-1272, Oct. 1988.
[2] F. Dirk and T. Ronald, “Coding of Binary Image Data using Cellular
Neural Networks and Iterative Annealing,” Proc. of ECCTD’03, vol. 1,
pp. 229-232, Sep. 2003.
[3] M. Namba and Z. Zhang, “Cellular Neural Network for Associative
Memory and Its Application to Braille Image Recognition,” Proc. of
IJCNN’06, pp. 4716-4721, Jul. 2006.
[4] H. Koeppl and L.O. Chua, “An Adaptive Cellular Nonlinear Network andits Application,” Proc. of NOLTA’07, pp. 15-18, Sep. 2007.
[5] R. Perfetti, E. Ricci, D. Casali, and G. Costantini “Cellular Neural Networks With Virtual Template Expantion for Retinal Vessel Segmentation,”
IEEE Trans. Circuits Syst. I, vol. 54, pp. 141-145, Feb. 2007.
[6] T. Szabó and P. Szolgay, “An Analogic Diffusion-Based Algorithm for
the Segmentation of CT Images,” Proc. of NOLTA’07, pp. 237-239, Sep.
2003.
[7] C.T. Lin, C.H. Huang and S.A. Chen, “CNN-Based Hybrid-Order Texture
Segregation as Early Vision Processing and its Implementation on CNNUM,” IEEE Trans. Circuits Syst. I, vol. 54, pp. 2277-2287, Oct. 2007.

(a)

(b)

(c)

(d)

Fig. 7. Simulation results using D-CNN for Fig. 5 (R10 =0.1). (a) Output
image 1 ([τ ]=10). (b) Output image 2 ([τ ]=20). (c) Output image 3 ([τ ]=30).
(c) Output image 4 ([τ ]=40).

[8] M. Kawahara, T. Inoue and Y. Nishio, “Cellular Neural Network with
Dynamic Template and its Output Characteristics,” Proc. of IJCNN’09,
pp. 1552-1558, Jun. 2009