Sie sind auf Seite 1von 5

D. Jin and S. Lin (Eds.): Advances in CSIE, Vol. 2, AISC 169, pp. 547551.

springerlink.com Springer-Verlag Berlin Heidelberg 2012


Method for Image Shape Recognition
with Neural Network
Wenpeng Lu
School of Science,
Shandong Polytechnic University
Jinan, Shandong, China, 250353
lwp@spu.edu.cn
Abstract. Shape recognition is important for image retrieval. The selection of
shape features and recognition model would directly affect the effectiveness of
shape recognition. In the paper, seven invariant moments, circularity degree,
rectangle degree, sphericity degree, concavity degree and flat degree are
selected as description features. With the shape features, image shape is
recognized with BP neural network. Evaluation is performed over a manual
dataset. Experimental result show that the method is a preferred strategy to
recognize image shape.
Keywords: shape recognition, neural network, BP, shape feature.
1 Introduction
Content-based image retrieval (CBIR) is one of the hotspots of the current multimedia
retrieval technology. CBIR directly analyze image content, such as color, shape,
texture, et al, and describe images with reasonable features, which makes the retrieval
more efficiently and more adaptively with human[1]. Image shape is one of most
important visual features. Therefore, shape-based image retrieval is an important
aspect in content-based image retrieval, which extracts shape feature of the image and
retrieve relevant images by computing the similarity of shape feature[2]. The paper
has proposed a method for image shape recognition with neural network, which
extracts a series of shape features, train a BP neural network on a sample dataset and
recognize image shape with it.
In the paper, the method for image shape recognition with neural network is
described in detail. The rest of the paper is organized as follow. Section 2 introduces
the model of BP neural network. The extracted features of the image are described in
Section 3. Experiments are introduced in Section 4. As last, we give the conclusion
and future work.
2 Model of BP Neural Network
2.1 Structure of BP Neural Network
The structure of three-layer BP Neural Network is shown as Fig.1[3]. Its input vector
is
1 2
{ , ,..., ,..., }
T
i n
X x x x x = ,
0
1 x = is used to import threshold of hidden layer;
548 W. Lu
output vector of hidden layer is
1 2
{ , ,..., ,..., }
T
i n
Y y y y y = ,
0
1 y = is used to
import threshold of output layer; output vector of output layer is
1 2
{ , ,..., ,..., }
T
k l
O o o o o = ; expected output vector is
1 2
{ , ,..., ,..., }
T
k l
d d d d d = .
x
0
x
1
x
i
x
n
...
...
y
0
y
1
y
j
y
m
... ...
w
1
... ...
w
k
w
t
O
1
O
k
O
l

Fig. 1. Structure of BP Neural Network
The weight matrix from input layer to hidden layer is represented with V .
1 2
{ , ,..., ,..., }
j m
V V V V V = , in which
j
V is weight vector of j-th neuron. The
weight matrix from hidden layer to output layer is represented with W .
1 2
{ , ,..., ,..., }
k i
W W W W W = , in which
k
W is weight vector of k-th neuron. The
relation among different layers is as follow.
For output layer, the relations are shown as Eq.(1) and Eq.(2).
( ), 1, 2,...,
k k
o f net k l = = .
(1)
0
, 1, 2,...,
m
k jk i
j
net w y k l
=
= =

.
(2)
For hidden layer, the relation are shown as Eq.(3) and Eq.(4).


Method for Image Shape Recognition with Neural Network 549
( ), 1, 2,...,
k k
o f net k l = = .
(3)
0
, 1, 2,...,
m
k jk i
j
net w y k l
=
= =

.
(4)
In Eq.(1) and Eq.(3), the transfer function ( ) f x is single polarity Sigmoid function
as Eq.(5).
1
( )
1
x
f x
e

=
+
.
(5)
2.2 Basic Idea of BP Neural Network
The learning process of BP neural network algorithm is composed with forward
propagation of input signal and backward propagation of error. In forward
propagation, input samples are introduced from input layer and are transferred to
output layer after being processed by each hidden layer. If the actual output is
inconsistent with expected output, the back propagation of error would begin. In
backward propagation, error would be transferred to input layer through hidden
layers. The error would be apportioned to all of neurons, which would correct weight
of each neuron.
The forward propagation and backward propagation would be repeated, which
would adjust the weight of each neuron. This is the process of learning and training of
BP neural network. The process would loop until that output error is reduced to an
acceptable level or the preset number of learning is achieved.
3 Features of Image Shape
In the paper, twelve features of image shape is extracted, which include seven
invariant moments, circularity degree, rectangle degree, sphericity degree, concavity
degree and flat degree [4].
3.1 Invariant Moments
Invariant moments describe geometrical characteristic of a shape, which would not
alter for size, rotation and translation of images. According to the research of Hu.m.K,
we can obtain seven invariant moments[5-7].
3.2 Circularity Degree
Circularity degree also is referred as shape factor, which is defined as the ratio of
square of the perimeter and the area.
550 W. Lu
3.3 Rectangle Degree
Rectangle degree also is referred as rectangle fitting factor, which is defined as the ratio
of the area of the shape and the area of minimum enclosing rectangle of the shape.
3.4 Sphericity Degree
Sphericity degree is defined as the ratio of the radius of internally tangent circle of the
shape and the radius of circumcircle of the shape.
3.5 Concavity Degree
Concavity degree also is defined with Eq.(6).
0
1
r
s
y
s
= .
(6)
In which,
0
s is the area of approximation polygon of the shape and
r
s is the area of
minimum external convex.
3.6 Flat Degree
Flat degree is defined as the ratio of long axis and short axis, which reflects the degree
of narrow and flat. For example, flat degree of square is 1, flat degree of rectangle is
its aspect ratio.
4 Experiment
In the paper, based on the twelve shape features, we propose to utilize BP neural
network to recognize image shape, which is provided in Matlab. Seven invariant
moments, circularity degree, rectangle degree, sphericity degree, concavity degree
and flat degree are sent to neural network as its input vector. The transfer function of
hidden layer is logarithm Sigmoid function. The transfer function of output layer is
Purelin function. Trainlm function is selected to train neural network on sample
dataset[8, 9].
We have manually built an experimental dataset respectively for triangle,
parallelogram, ellipse and arch. For each kind of shape, there are 80 images as
training samples and 60 image for testing samples.
Precision and Recall is used to evaluate the effectiveness of the method.
Precision is computed as the percentage of correct answers given by the neural
network, as Eq.(7).
# correct answers provided
# answers provided
P = .
(7)
Recall is computed as the ratio of correct answers given by neural network over the
total number of answers to be given, as Eq.(8).
Method for Image Shape Recognition with Neural Network 551
# correct answers provided
# total answers to provide
R = .
(8)
The detailed experimental result is shown in Table.1.
Table 1. Detailed experimental result
Precision Recall
Triangle 85% 83.33%
Parallelogram 81.67% 78.33%
Ellipse 80% 85%
Arch 76.67% 75%
5 Conclusions and Future Work
The paper proposes a method for image shape recognition with neural network, in
which seven invariant moments, circularity degree, rectangle degree, sphericity
degree, concavity degree and flat degree are selected as shape features and BP neural
network are utilized to recognize image shape.
In the paper, the quantity and quality of training samples have great impact on
neural network. In order to get better effectiveness, it is necessary to strengthen the
construction of sample database, which is a time-consuming work. In the field of
pattern recognition, neural network has shown some advantages. But, with the increase
of pattern categories, the effectiveness of neural network would decline sharply. The
recognition of complex shape needs the further development of neural network.
References
1. Ying, L., Dengsheng, Z., Guojun, L., Wei-Ying, M.: A survey of content-based image
retrieval with high-level semantics. Pattern Recognition 40, 262282 (2007)
2. Bayramoglu, N., Aydin Alatan, A.: Shape Index SIFT: Range Image Recognition Using
Local Features. In: International Conference on Pattern Recognition, ICPR 2010, pp. 352
355. IEEE Press, New York (2010)
3. Haykin, S. (ed.): Neural Networks and Learning Machines. Prentice Hall, New Jersey
(2009)
4. Gonzalez, R.C., Woods, R.E., Eddins, S.L. (eds.): Digital Image Processing Using
MATLAB. Press of Electrical Industry, Beijing (2009)
5. Hu, M.K.: Visual Pattern Recognition by Moment Invariants. IRE Transaction of
Information Theory IT-8 (1962)
6. Flusser, J.: On the Independence of Rotation Moment Invariants. Pattern Recognition 33,
14051410 (2000)
7. Flusser, J., Suk, T.: Rotation Moment Invariants for Recognition of Symmetric Objects.
IEEE Transactions on Image Processing 15, 37843790 (2006)
8. Zhou, K., Kang, Y. (eds.): Neural Network Model and Simulation Program Design in
Matlab. Press of Tsinghua University, Beijing (2005)
9. Zhu, K., Wang, Z. (eds.): Master Neural Networks in Matlab. Publishing House of
Electronics Industry, Beijing (2010)

Das könnte Ihnen auch gefallen