# An Tutorial of Projects for CSM16 Visual Information Systems

AI and Robotics

Oct 29, 2013 (4 years and 7 months ago)

87 views

1

An Tutorial of Projects for CSM16 Visual Information Systems

By Li Chen

20/02/2004

This tutorial introduces steps of designing and developing part of the projects in
detail.
Some particular algorithms/methods
should be treated as samples, be aware
that wh
at have been described here are not the
only solution
s

and you can develop
.
The general information can refer to the formal documents of proposal
for the projects of this module.

Project1: Develop a system which applies Gaussian Model to realize i
mage
classification, content
-
based and semantic
-
based retrieval

1

Training stage

1.1

Analysis of data

You have to decide which type of image data used in the projects firstly, and then predefine
their labels/categories.

1.2

Choose training samples

An example:

There

are six images (training samples), which are separated into two categories
:

1.3

Extract primitive features

Primitive features can be colour or texture. Here I will give an example of colour histogram
extracted fr
om RGB image. The related codes as following.

function RGBHist = Colour_Feature(rgbimage)

% Extract the colour histogram features

RGBHist = [];

%extract Red

[counts,x] = imhist(rgbimage(:,:,1));

totalpixels = sum(counts);

for j = 1: size(x)

RGBHist =
[RGBHist counts(j)/totalpixels];

end

%extract Green

[counts,x] = imhist(rgbimage(:,:,2));

totalpixels = sum(counts);

for j = 1: size(x)

RGBHist = [RGBHist counts(j)/totalpixels];

end

2

%extract Blue

[counts,x] = imhist(rgbimage(:,:,3));

totalpixels = sum
(counts);

for j = 1: size(x)

RGBHist = [RGBHist counts(j)/totalpixels];

end

RGBHist = RGBHist';

1.4

Calculate parameters in Gaussian classification functions

The Gaussian probability density function for the category

is in the foll
owing format:

where

---

the mean of vector of class

---

the i
-
th class covariance matrix

x is the feature vector.

and

are calculated from training samples belonging to the category

,where
is the number of training patterns from the class
.

The covariance matrix as

The following is an example for the procedure of calculating parameters of Gaussian probability
density of the class

:

Assume:

After extracting primitive features from images,

Features_image1=
, Features_image2=
, Features_image3=

,

3

(
Forget the formula how to
solve it, and maybe you can check your mathematic books

and find the solution.
Anyway, you also do not need know the calculation details but use the function of
pinv(x) to calculate inverse of x
)

2.
Testing stage

2.1 Theoretical inference

To simplify the problem here, we suppose

are scale factors or constants, so

2.2 Classify an unknown sample

An e
xample:

After training stage, we have one Gaussian function for category
:

and the other
Gaussian
function for category
:
. From the above theoretical inference, we get the
posterior probability:

and
.

If
>
, assign x

to
; otherwise assign x to
.

3. Content based image retrieval

I recommend you to try the simplest function to calculate the distance between the query example and
data in your image database. Rank them accordin
g to values of distance.

Reference
s
:

[1]

B. S. Manjunath, J. R. Ohm, V. V. Vasudevan and A. Yamada, “Color and texture descriptors”,
IEEE Transactions on circuits and systems for video technology
, VOL.11, NO.6, June 2001,
pp.703
-
715.

[2]

Schalkoff, Robert J..
-

Pa
ttern recognition: statistical, structural and neural approaches / Robert.
-

New York; Chichester: Wiley, 1992. (Chapter

2
)

4

Project2: Develop a system, which uses multiple classifier combination method
to realize image classification.

1.

assifiers

Individual classifiers can be constructed based on different feature spaces (colour, texture) [4] and
different classification algorithm (K
-
Nearest Neighbours, Neural Net works, Gaussian
classification, etc.)

The introduction of Neural Networks c
an refer to the documents by Mr. Jifeng Wang, which will
go with the tutorial.

The details about classifiers based on Gaussian model can refer to the project 1.

I will introduce K
-

Nearest Neighbours Algorithm

1.1 An example of K
-

Nearest Neighbours Algori
thm

Given a training set of patterns
, where

is feature
vector, and

is class label for
. Assume 2
-

class classification problem.

Circle mean
,

and square mean
. Crossed symbol is input vector x. K should be related to the
size of N of the training set. We suppose K = 4. Draw a circle with the centre of x, which
concludes K=4 training samples. There are 3 samples from
, and 1 sample from
, so assign x
to
.

2.

Combination strategies

Fixed rules on combining classifiers are discussed in theoretical and in practical in [5]. Xu,
et. Al [3]

summarised possible solutions to fuse individual classifiers are divided into three
categories according to the levels of information available from various classifiers. I will
give two different algorithms for examples.

2.1 An example of simplest majori
ty voting algorithm

Assume 3 classifiers and all of them will output labels for unknown images. If two of them agree
with each other, we take their result as the final decision. For example, classifier 1 says this image
is A, classifier 2 says it is B, and

classifier 3 says it is A. A is the final decision. At some
situations, if three classifiers output different labels, you have to decide which one is right using
some rules.

2.2 The Borda count method algorithm

5

The example can refer to Note
s

from
Dr. Tang

s lecture
.

Assume we have 4 categories {A, B, C, D} and 3 classifiers. Each classifier outputs a rank list.
When an unknown image x is inputted into the system, we have the following output information:

Rank value

Classifier 1

Classifier 2

Classifier 3

4

C

A

B

3

B

B

A

2

D

D

C

1

A

C

D

Rank values mean scores to assign for different ranked levels.

The score of x belonging to the category A equals as following:

The score of x belonging to the category B equals as following:

The score of x belonging to the category C equals as following:

The score of x belonging to the category D equals as following:

The final decision is B because it obtains the highest value.

Reference
s
:

[3]

L. Xu, A. Kryzak, C. V. Suen, “Methods of Combining Multiple Classifiers and Their
Applications to Handwriting Recognition”, IEEE Transactions on Systems, Man Cybernet, 22(3),
1992, pp. 418
-
435.

[4]

B. S. Manjunath, J. R. Ohm, V. V. Vasudevan and A
descriptors”,
IEEE Transactions on circuits and systems for video technology
, VOL.11, NO.6,
June 2001, pp.703
-
715.

[5]

J. Kitt ler, M. Hatef, R. Duin and J. Matas, “On Combining Classifiers”, IEEE Transactions on
Pattern Analysis an
d Machine Intelligence, 20(3), 1998, pp. 226
-
239.

[6]

R. Duin, “The Combining Classifier: to Train or Not to Train”, in: R. Kasturi, D.
Laurendeau, C. Suen (eds.),
ICPR16, Proceedings 16th International Conference on Pattern