Assignment title: Information
Image Classification
The image classification is the process to categorize images into one of several classes or categories.
In this project, there are seven categories (Piano, Kangaroo, Strawberry, Sunflower, Airplane, Face
and Leopard). Classification requires training for each image category. The image categories are
learned through a training process and an image is annotated in terms of the learned categories.
Figure 1 shows the overall process of the image classification. This image classification can be used
for automatic generation of keyword metadata and for efficient searching and leverage of archived
content.
RGB color extraction
123, 43, 223
42, 134, 56
21, 132, 12
3, 212, 142
213, 33,42
23, 134, 213
Figrue 1: Image Classification Mode
2. Data Set
In this project, the image data set consists of 320 training images and 285 test images. Table 1
shows the image data set in details.
Table 1: Data set
Piano Kangaroo Strawberry Sunflower Airplane Face Leopard
Training 50 50 20 50 50 50 50 320
Test 49 36 15 35 50 50 50 285
Total 99 86 35 85 100 100 100 605
Training
Image RGB color extraction Classifier construction
Classifier
1. In addition to the original images, the corresponding text files containing RGB color values are
also provided. For instance,
sunflower_training2.jpg sunflower_training2.txt
2. RGB Color Space
RGB color space is any additive color space based on the RGB color model. A particular RGB
color space is defined by the three chromaticities of the red, green, and blue components.
Possible pixel values of each color component between 0 and 255 (i.e., 256 (28
) different possible
values)
3. Color Histogram
A color histogram is a representation of the distribution of colors in an image. For digital images, a
color histogram represents the number of pixels that have colors in each of a fixed list of color ranges
(the set of all possible colors).
A histogram consists of frequencies and discrete intervals of the same size (bins). The total area of
the histogram is equal to the number of data. A histogram may also be normalized by dividing
frequencies by the total number of data. In this case, the total area of the normalized histogram is
equal to 1. In this project, the normalized color histogram will be used because it can handle the
images which differ in size.
• Typical number of bins in RGB color space
8 (=2*2*2),
64 (=22
*22
*22
),
512 (=23
*23
*23
),
...
For instance, an image (which category is "Strawberry") consists of 8 pixels as follows
123, 23, 34
23, 43, 223
12, 34, 56
231, 32, 112
123, 12, 42
23, 233, 44
223, 34, 23
33, 26, 29
1. Number of bins: 8
Bin # Color Range Frequency Normalized Frequency
1 (0<=red<27
) && (0<=green<27
) && (0<=blue<27
) 4 0.5
2 (0<=red<27
) && (0<=green<27
) && (27
<=blue<28
) 1 0.125
3 (0<=red<27
) && (27
<=green<28
) && (0<=blue<27
) 1 0.125
4 (0<=red<27
) && (27
<=green<28
) && (27
<=blue<28
) 0 0
5 (27
<=red<28
) && (0<=green<27
) && (0<=blue<27
) 2 0.25
6 (27
<=red<28
) && (0<=green<27
) && (27
<=blue<28
) 0 0
7 (27
<=red<28
) && (27
<=green<28
) && (0<=blue<27
) 0 0
8 (27
<=red<28
) && (27
<=green<28
) && (27
<=blue<28
) 0 0
v An ARFF file from the above normalized color histogram (8 bins) may look like
@relation NormalizedColorHistogram_8Bins
@attribute bin1 numeric
@attribute bin2 numeric
@attribute bin3 numeric
@attribute bin4 numeric
@attribute bin5 numeric
@attribute bin6 numeric
@attribute bin7 numeric
@attribute bin8 numeric
@attribute category {Piano, Kangaroo, Strawberry, Sunflower, Airplane, Face, Leopard}
@data
0.5, 0.125, 0.125, 0, 0.25, 0, 0, 0, Strawberry
...
64 bins can be generated like
where 26 = 64, 2*26 = 128, 3*26 =192 and 4*26 = 256
512 bins can be generated like
where 25 = 32, 2*25 = 64, 3*25 = 96, 4*25 = 128, 5*25 = 160, 6*25 = 192, 7*25 = 224 and 8*25 = 256
Bin # Color Range Frequency Normalized
Frequency
1 (0<=red<26
) && (0<=green<26
) && (0<=blue<26
)
2 (0<=red<26
) && (0<=green<26
) && (26
<=blue<2*26
)
3 (0<=red<26
) && (0<=green<26
) && (2*26
<=blue<3*26
)
4 (0<=red<26
) && (0<=green<26
) && (3*26
<=blue<4*26
)
5 (0<=red<26
) && (26
<= green<2*26
) && (0<=blue<26
)
6 (0<=red<26
) && (26
<= green<2*26
) && (26
<=blue<2*26
)
7 (0<=red<26
) && (26
<= green<2*26
) && (2*26
<=blue<3*26
)
8 (0<=red<26
) && (26
<= green<2*26
) && (3*26
<=blue<4*26
)
9 (0<=red<26
) && (2*26
<= green<3*26
) && (0<=blue<26
)
10 (0<=red<26
) && (2*26
<= green<3*26
) && (26
<=blue<2*26
)
11 (0<=red<26
) && (2*26
<= green<3*26
) && (2*26
<=blue<3*26
)
12 (0<=red<26
) && (2*26
<= green<3*26
) && (3*26
<=blue<4*26
)
13 (0<=red<26
) && (3*26
<= green<4*26
) && (0<=blue<26
)
14 (0<=red<26
) && (3*26
<= green<4*26
) && (26
<=blue<2*26
)
15 (0<=red<26
) && (3*26
<= green<4*26
) && (2*26
<=blue<3*26
)
16 (0<=red<26
) && (3*26
<= green<5*26
) && (3*26
<=blue<4*26
)
... ...
64 (3*26
<=red<4*26
) && (3*26
<= green<5*26
) && (3*26
<=blue<4*26
)
..........
Bin # Color Range Frequency Normalized
Frequency
1 (0<=red<25
) && (0<=green<25
) && (0<=blue<25
)
2 (0<=red<25
) && (0<=green<25
) && (26
<=blue<2*25
)
3 (0<=red<25
) && (0<=green<25
) && (2*25
<=blue<3*25
)
4 (0<=red<25
) && (0<=green<25
) && (3*26
<=blue<4*25
)
5 (0<=red<25
) && (0<=green<25
) && (4*25
<=blue<5*25
)
6 (0<=red<25
) && (0<=green<25
) && (5*26
<=blue<6*25
)
7 (0<=red<25
) && (0<=green<25
) && (6*25
<=blue<7*25
)
8 (0<=red<25
) && (0<=green<25
) && (7*25
<=blue<8*25
)
9 (0<=red<25
) && (25
<= green<2*25
) && (0<=blue<25
)
10 (0<=red<25
) && (25
<= green<2*25
) && (26
<=blue<2*25
)
11 (0<=red<25
) && (25
<= green<2*25
) && (2*25
<=blue<3*25
)
12 (0<=red<25
) && (25
<= green<2*25
) && (3*26
<=blue<4*25
)
13 (0<=red<25
) && (25
<= green<2*25
) && (4*25
<=blue<5*25
)
14 (0<=red<25
) && (25
<= green<2*25
) && (5*26
<=blue<6*25
)
15 (0<=red<25
) && (25
<= green<2*25
) && (6*25
<=blue<7*25
)
16 (0<=red<25
) && (25
<= green<2*25
) && (7*25
<=blue<8*25
)
... ...
512 (7*25
<=red<8*25
) && (7*25
<= green<8*25
) && (7*25
<=blue<8*25
)
Project Exercises
Part I. Construct training data files (ARFF files) using the training image data for three different
bin numbers (i.e., number_of_bins = 8, 64 and 512). The number of training data files should be
three.
Part II. Construct the five different classifier models using each training data file. The five
classification methods are as follows:
1) Naïve Bayes Classifier
2) C4.5 Classifier
3) k-Nearest-Neighbor Classifiers
4) Multilayer Neural Network
5) Support Vector Classifier
Part III. Construct test data files (ARFF files) using the test image data per each category for
three different bin numbers. The total number of test data files should be 21 (=7*3) in this case.
Part IV. Compare the prediction accuracies among five different classifiers for each category
Part V. Construct test data files (ARFF files) using all test image data for three different bin
numbers. The total number of test data files should be three in this case. (You can easily construct
this three test data files by combining the test data files constructed in Part III)
Part VI. Compare the prediction accuracies among five different classifiers for overall test data
Ø You CAN compute color histograms and construct ARFF files
a) Manually by using MS-Excel and/or any text editor (wordpad, textpad, etc)
b) Automatically by developing your own program with any programming language such as C,
C++, Java, etc. (Clean well structured C++ source code earns 5% bonus credit.)
Part VII. Project Submission.
§ File name should be xxxxxx_project.zip including
(where xxxxxx represents the your UIS UID)
1. A project report (PDF file observe CSC573 presentation standards) describing
1. A comprehensive description of each classifier.
2. Accuracy comparison for each category preformed in Part IV
3. Accuracy comparison for overall test image preformed in Part VI
4. Your conclusions based on your observations
v Documentation must be well written (grammar, spelling = 10%) and well organized
and presented (typesetting etc = 10%) to be understood easily.
v Graphs and tables are good tools for comparative analysis (no hand drawn graphs).
2. All ARFF files with detailed comments (10% of mark)