A TWO LAYER CNN IN IMAGE PROCESSING APPLICATIONS
Zonghuang Yang, Yoshifumi Nishio and Akio Ushida
Dept. of Electrical and Electronic Engineering, Tokushima University, Tokushima 770-8506, Japanyangzh@ee.tokushima-u.ac.jp

Abstract— In this paper, a two-layer cellular neural network model is proposed, in which two new templates coupling between the two layers are introduced.
This CNN array behaves more eﬃcient for image process applications. As examples, several simulations inimage processing applications such as object separation and center detection etc. are carried out, andtheir templates are given. In particular, their working
mechanisms are described in detail.
I. INTRODUCTION
Since cellular neural networks (CNNs) were invented
by Chua and Yang in 1988 [1], they have been successfully used for various high-speed parallel signals
processing applications such as image processing, pattern recognition as well as computer vision [1]-[5]. Under certain conditions, the working mechanism of thisstructure arrays acts as the way to model physicalstructure or nonlinear phenomena: because its locallyinterconnected structure closely resembles the featureof human retina and active substrate or medium [2][6].
It has been used in modeling pattern formations as wellas many other spectacular dynamic phenomena [6][7].
Up to the present, owing to the eﬀorts of all researchers that have been done in this area, many templates for special purposes and applications have beendeveloped. But many image processing tasks, such as
skeletonizing, thinning and separating object etc., canonly be completed by iteratively using diﬀerent templates or time variant templates [3]-[5]. All of them
are based on complex multi-layer, sometimes even nonuniform architectures. Here, it is necessary to notice
the fact that this multi-layer CNN means that it consists of several single layer CNNs, each single layer
CNN is iteratively used to perform a part of task, andonly after it entries into steady state or reaches at somestates, the next single layer CNN begins to perform thenext part of task, such as the process continues iteratively until the novel task is completed. Therefore,
they are tedious and belong to serial processing, result
in decreasing run-speed. On the other hand, as it has
been well known, in the traditional neural networks,
if the multi-layer structure neural networks are taken
into consideration, they have displayed more widely
applications in very diﬀerent ﬁelds such as non-linearly

separation, optimization and pattern recognition etc.
This mechanism is also valid to cellular neural networks. In order to improve its applications, a cellular neural network model with two layers structure is
proposed in this paper. Several simulations for image
processing applications are given and described in detail. All of them show that the two-layer CNN has
more eﬃcient for image processing.
II. TWO LAYER CNN ARCHITECTURE
The dynamical system equations associated with single layer CNNs have been given in reference [1]. Here,
we extend them to two-layer CNNs by introducing two
new templates C12 and C21 . For image processing purpose, an architecture composed of a two-dimensional
M by N array of cells are only taken into consideration. Each cell in the array is denoted by c(i, j). It
has two state variables x1 (i, j) and x2 (i, j), where (i, j)
stands for the position of cell in the array, 1 ≤ i ≤ M
and 1 ≤ j ≤ N . The state equations of each cell are
given by two ﬁrst-order diﬀerential equations Eq.(1),and the state output equations are given by Eq.(2),which is a piecewise-linear nonlinear function.
 dx1,ij
= −x

dt

 1,ij + I1
+
A (i, j; k, l)y1,klC(k,l)∈Nr (i,j) 1+
B (i, j; k, l)u1,klC(k,l)∈Nr (i,j) 1
+C(k,l)∈Nr (i,j) C12 (i, j; k, l)y2,kl(1)
dx2,ij=−x
 2,ij + I2
 dt


+
A (i, j; k, l)y2,klC(k,l)∈Nr (i,j) 2
+
B (i, j; k, l)u2,kl
C(k,l)∈Nr (i,j) 2+C(k,l)∈Nr (i,j) C21 (i, j; k, l)y1,kl

y1,ij = 0.5(|x1 + 1| − |x1 − 1|)y2,ij = 0.5(|x2 + 1| − |x2 − 1|).

(2)

We deﬁne that the ﬁrst layer of the two layer CNN iscomposed of all of x1 (i, j), and the second layer of all ofx2 (i, j). u, x , and y refer to the input, state, and output variables of the cell, A(i, j; k, l), B(i, j; k, l), and I
are feedback template, control template and bias current, index 1 and 2 stand for ﬁrst layer and second layerof two-layer CNN array, respectively. C12 (i, j; k, l) isused to represent the transferring template from second layer output to ﬁrst layer input, and C21 (i, j; k, l)

u1

−1
ẋ1 

B1

First layer

I1

y1

f (·)

x1
A1

C21

C12
x2

f (·)
y2
Second layer

A2
 ẋ2
−1

(a)initial state(b)transient result(c)steady output(d)initial state(e)transient result(f)steady output

I2

B2

u2

Figure 1: Block diagram of the two layer CNN

Figure 2: An example for solving compound task.

is the reverse. They also contain the weight of the local coupling between cells in a neighborhood Nr (i, j)
as the same as templates A(i, j; k, l) and B(i, j; k, l),where r is coupling radius. In generally, the r takes 1
or 2.
The processing of the two layer CNN is shown by
block diagram in Fig.1. As we can see, the two layers of the CNN constitute a closed-loop system. They
share out the tasks and cooperate with each other toperform some image processing applications that cannot be performed in single layer CNN. Comparing thisCNN with the multi-layer CNN proposed in some literatures [1][3]-[5], one of their diﬀerences is that theformer is parallel processing (i.e. the two layers execute at the same time), the later is serial processing. Moreover, when one of the templates C12 andC21 is zero, the CNN becomes an open-loop systemand seems to be consisted of two single layer CNNs
with cascade, one layer output is considered as anotherlayer input. From this point, the developed templates
in single layer CNNs seem to be valid to the two layer
CNNs, but some compound tasks can be achieved.

is extracting the target objects by using pointers in theinitial state in one layer, and the other one is erasing
the extracted objects from the original image at thesame time in another layer. This task can be realized
in single step and described as the following.
The original static binary image Fig.2(d) is fed toboth layer inputs of the CNN. The ﬁrst layer is used to
extract objects under separation by using two pointers in the initial state Fig.2(a) with recall templates[5]. Its output is transferred to second layer as its input and operated with second layer initial state withlogic diﬀerence by using logic diﬀerence templates [15].
Thus, the extracted objects are obtained in the ﬁrst
layer output, and the rest rectangle object remains inthe second layer output. They are shown as Fig.2(c)and (f). Figure 2(b) and (e) are the ﬁrst and second
layer transient results, respectively. In this example,
we choose zero-ﬁxed boundary condition. The templates are
0.5 0.5 0.5
0 0 0
A1 =  0.5 2 0.5  , B1 =  0 4 0  , C12 = 0,
0.5 0.5 0.5
0 0 0




0 0 0
0 0 0
A2 =  0 2 0  , B2 = 0, C21 =  0 −1 0  ,
0 0 0
0 0 0

III. SOME TEMPLATES USED FOR
IMAGE PROCESSINGAPPLICATIONSImage processing is one of important applications of
the CNN. As well known, many templates used forthis purpose have been developed based on signal layer
CNN. In this section, we will give some examples toshow that the two layer CNNs have more eﬃcient forimage processing. Their working mechanism will be
described in detail.
.1. Object Separation
In this section, we use the two-layer CNN to solve a
compound task – object separation. For example, referring to Fig.2(d), there are three objects, round, rectangle and triangle, respectively. If we want to separate
round and triangle objects from the rectangle object,then this task can be divided into two operations, one

I1 = 0.25, I2 = −1.

(3).2. Centerline Extraction
In single layer CNN, the algorithm of the centerline
extraction uses 2 steps or 2 single layer CNNs. The
two CNNs are used continuously and circularly to peeloﬀ pixels from the object in two directions until only
the centerline of object remains. This is a very complicated process. In contrast, by using the two layer
CNNs, this task can be solved simply by one step. The
algorithm will be described in detail in the following.
The two layers of the CNN are used respectively tocontinuously peel oﬀ the most left side and right side
pixels of the object at same time until its centerline isdx1 /dt
dx2 /dt
(a)

1
-2

-1

0
-1

1

2

x1,ij
x2,ij

g1 and g2

Figure 3: The dynamic routes of the cell are shifted
up and down by g1 and g2 . The stable and unstableequilibrium points are denoted by solid dot and circle,
respectively.
left. For this purpose, we feed the object image to theinitial states of the CNN both layers as shown Fig.6(a)and (g), and adopt the following templates:




0 0 0
0 0 0
B = 0,
A1= 0.5 2 −0.5 , C12= 0 2.8 −1 , 1
I1 = −2,
0 0 0
0 0 0




0 0 0
0 0 0
B = 0,
A2= −0.5 2 0.5 , C21= −1 2.8 0 , 2
(4)
I2 = −2,
0 0 0
0 0 0
Thus, the cell state equations can be rewritten as thefollowing forms:
ẋ1;ij = −f1 (x1;i,j ) + g1;i,j(5)
ẋ2;ij = −f2 (x2;i,j ) + g2;i,j
where
f1 (x1;i,j ) = x1;i,j − (|x1;i,j + 1| − |x1;i,j − 1|),f2 (x2;i,j ) = x2;i,j − (|x2;i,j + 1| − |x2;i,j − 1|), (6)g1;i,j= 0.5y1;i,j−1−0.5y1;i,j+1+2.8y2;i,j−y2;i.j+1−2,
g2;i,j= 0.5y2;i,j+1−0.5y2;i,j−1−y1;i,j−1+2.8y1;i,j−2.
Their dynamic routes can be demonstrated in Fig.3.
To analyze the stable equilibrium point of a cell, here
we specify a landscape or a local map of the cell bylisting all those neighborhood states including the cell
itself. Each cell has two states x1 and x2 . In the
3×3 pattern matrix, the landscape has 29 ×29 possiblecombinations in binary image. In this simulation, at
beginning the two states are the same, so the landscapecan be divided into seven possible cases. All of them
are listed in Fig.4, in which a black square denotesa cell having values 1, a white square denotes the -1
value cells, and a crossed square stands for those which’don’t care’ with the center cell because of some of
the template coeﬃcients corresponding those positions
being zero.
For the case of Fig.4(a), we have
g1;i,j = 0.5y1;i,j−1 −0.5y1;i,j+1 +2.8y2;i,j −y2;i.j+1 −2

(b)

(c)

(d)

(e)

(f)

(g)

Figure 4: All possible landscapes of a cell.
Table 1: The Landscape and Stable Epuilibrium
Point of a cell in the First Layer:
Landscapecase (a)case (b)case (c)case (d)case (e)case (f)case (g)

g1,ij
−3.8
−6.8
−1.2
−0.2
2.8
1.8
−2.8

initial state
-1
-1
1
1
1
1
-1

stable output
-1
-1
-1
1
1
1
-1

= 0.5×(−1)+0.5×(−1) +2.8×(−1)−(−1)−2= −3.8.
From its dynamic route Fig.3, we can deduce that thestate x1 of the cell has a stable equilibrium withinx1 < −1 and outputs −1 (white), in other words,
y1 = −1. Similarly, for the other cases from Fig.4(b)to (g), their stable equilibrium points can be obtained
and listed in Tab.1. As we can see, only in the case (c),the output of the center cell state x1 is changed from 1(black) to -1 (white) and steadied at -1 (white). In theother cases, they hold unchanged. Therefore, the ﬁrst
layer of the CNN performs peeling oﬀ the most left side
pixels of the object as shown in Fig.6(b). By similar
analysis method, we can obtain that the second layer
perform peering oﬀ the most right side pixels of the object at the same time as shown in Fig.6(h). After themost left side pixels in ﬁrst layer and the most rightside pixels in second layer are peeling oﬀ from the object, the middle results are shown as Fig.6(c) and (i),respectively. As the ﬁrst layer output is transferred tothe second layer and second layer output to ﬁrst layer,with the same analysis method, we can derive that theﬁrst layer begin to peer oﬀ the most right side pixelsof the object as shown Fig.6(d), and the second layer
to peel oﬀ the most left side pixels Fig.6(j). Figures
6.(e) and (k) show another transient results. So far
the two layer CNN has completed a cycle. Such as
this cycle continues until the object centerline is remained, while this two layer CNN enters this steadystate. This dynamic process can be observed from thegraph of the sum of state errors varying with the integration iterates Fig.7. As we can see, with appearing
a peak, it means that a column pixel of the object ispeeled oﬀ. After the object is peeled into centerline,
the sum of state errors decay to zero, the system enters

(a)

(b)

(c)

(d)

(e)

(f)

(g)

(h)

(i)

(j)

(k)

(l)

Figure 5: An example for extracting the centerline of object. From(a) to (f) are the output of the ﬁrst layer withthe time progressing, and from (g) to (l) are the output of second layer. Finally, the two layer CNN steadies at(f) and (l) states.
believe that a wide development of their applications
will come alone with the possibility for dealing withthe multi-layer CNN equations.
References[1] L.O. Chua and L. Yang, “Cellular neural networks: theory and applications,” IEEE Trans.
Circuits & Syst., vol.35 pp.1257–1290, Oct. 1988.
Figure 6: The sum of state errors via time for centerline extraction[2] L.O. Chua and T. Roska, “The CNN paradigm,”
IEEE Trans. Circuits & Syst., vol.40, pp.147–156,
Mar. 1993.

steady state. The two layer stable outputs are shownas Fig.6(f) and (l), respectively. In this simulation, thezero-ﬁxed boundary condition is adopted.
From the above two examples, we conclude thatthe two layer CNN can perform some compound tasks
which are need to be performed with two or more steps
by using single layer CNNs, and the developed templates in single layer CNN are also valid to the twolayer CNNs. Furthermore, the two layers of the CNN
can share out the tasks and cooperate with each other.
They belong to parallel processing.

[3] P.L. Ventianer, F. werblin, T. Roska and L.O.
Chua, “Analogic CNN algorithms for some image
compression and restoratin tasks,” IEEE Trans.
Circuits & Syst., vol.42, pp.278–284, Mar. 1995.

IV. CONCLUSIONSIn this paper, the proposed a two layer cellular neuralnetwork model in this paper has been introduced tocomplete some image processing applications such as
object separation and centerline extraction. Thereby,
we conﬁrm the powerfulness of the two-layer CNN
structure for parallel information processing. In particular, it is obvious that a multi-layer CNN structure
is very suitable to complete those important and complex image processing applications such as the skeletonizing and thinning of object, which have to be carried out by repeatedly and circularly using the single
layer CNN to perform. In spite of the complexity increasing with the CNN layers increasing, it makes us[4] H. Harrer and J. A. Nossek, “Skeletonization: A
new application for discrete-time cellular neuralnetworks using time-variant templates,” in proc.
IEEE Int. Symp. Circuits & Syst., 1992, pp.28972900.
[5] T. Roska, L. Kek, L. Nemes, A. Zarandy, and P.
Szolgay, “Analogical and neural computing laboratory,” Computer and Automation Institute of
the Hungarian Academy of Sciences, Version 7.3,
1999.
[6] L.O. Chua, Martin Hasler, George S. Mochytz,
and Jacques Neirynck, “Autonomous cellular neural networks: a uniﬁed paradigm for patternformation and active wave propagation,” IEEE
Trans. Circuits & Syst., vol.42 pp.559-577, 1995.
[7] M.J. Ogorzalek, Z. Galias, A.M. Dabrowski, andW.R. Dabrowki, “Chaotic waves and spatiotemporal patterns in large arrays of doublycoupled chua’s circuits,” IEEE Trans. Circuits &Syst., vol.42 pp.706-714, 1995.