• No results found

Vehicle Classification using Artificial Neural Network and Decision Tree

N/A
N/A
Protected

Academic year: 2022

Share "Vehicle Classification using Artificial Neural Network and Decision Tree"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

23

Vehicle Classification using Artificial Neural Network and Decision Tree

Sanjivani Shantaiya

1

, Kesari Verma

2

, Kamal Mehta

3

1Dept. of Computer Science & Engg., DIMAT, Raipur

2Dept. of Computer Application. NIT, Raipur

3Dept. of Computer Science & Engg. Nirma University, Ahmedabad

1[email protected], 2[email protected], 3[email protected]

Abstract: Automatic Vehicle classification has expanded into a momentous topic of study due to its importance in autonomous navigation, traffic analysis, surveillance security systems, and transportation management. This paper presents classification of ground vehicles like bike and car using pattern recognition neural network and decision tree as well. The objective of this paper is to automate the classification of vehicles from images. The views of object are important for classification. Different angles are considered as important parameter during classification process.

Multiclass attribute has been used for classification process.

Keywords: Detection, classification, pattern recognition neural network, decision tree.

I.

I

NTRODUCTION

The field of automated traffic monitoring systems is nowadays of immense interest because to its implications in the prospects of security. Surveillance of vehicular traffic offers a context for the extraction of significant information such as scene motion and traffic statistics, object classification, vehicle identification, anomaly detection, as well as the analysis of interactions between vehicles [1]. A vehicle classification system is essential for effective transportation systems (e.g., traffic management and toll systems), parking optimization, law enforcement, autonomous navigation, etc

II.

M

OTIVATION

In today’s era of technology; most of the organization still follows conventional way of vehicle management manually and the feeding it into the software or in a file. Since the existing system is not efficient and exact; this motivates to set up vehicle classification system which is based on image based automated vehicle detection and classification of vehicles; that definitely gives improved and intelligent vehicle classification system. This research work classifies the vehicles automatically from image considering different views of vehicles and accordingly into multiple classes.

III.

P

REVIOUS

W

ORK

Various approaches to vehicle classification and detection have been reported in the computer vision literature. Despite the large amount of literature in vehicle detection, there has been relatively little done in the field of vehicle classification.

Most systems either detect (locate a vehicle against a

background) or classify vehicles into broad categories such as cars, buses and trucks [3, 5, 7, 8, 14, 16]. Wei et al. [14] use a 3-D parameterised model which corresponds to features of the vehicle’s topological structure, classified using a neural network. They present results showing that 91% of the vehicles are correctly identified into six different categories.

Jun-Wei Hsieh et al. [17] propose a novel traffic surveillance system

for detecting, tracking, and recognizing vehicles from different video sequences. This system includes an initialization stage to obtain the information of lane-dividing lines and lane width . In addition, the proposed system can well tackle the problem of vehicle occlusions caused by shadows, which often

lead to the failure of further vehicle counting and classification. This problem is solved by a novel line-based shadow algorithm that uses a set of lines to eliminate all unwanted shadows. An optimal classifier is then designed to robustly categorize vehicles into different classes. When recognizing a vehicle, the designed classifier can collect different evidences from its trajectories and the database to make an optimal decision for vehicle classification.

Gupte et al. [5] present an algorithm for detection and classification of vehicles in image sequences of traffic scenes.

The system classifies vehicles into two categories – cars and non-cars (e.g. buses, trucks, SUV’s). In a 20-minute sequence of highway traffic, 90% of the vehicles were correctly detected and tracked, and of these correctly tracked vehicles, 70% were correctly classified. Kato et al. [7] propose the development of a driver assistance system using a vision- based preceding (vehicles travelling in the same direction as the subject vehicle) vehicle recognition method, which is capable of recognising a wide selection of vehicle types against road environment back-grounds. The classification method they used is the multiclustered modified quadratic discriminant function. The system classifies vehicles into three different categories and has a success rate of 97.7%.

Dubuisson Jolly et al. [3] use a deformable template algorithm consisting of finding a template that best characterises the vehicle into one of five categories. Their algorithm was tested on 405 image sequences and had a recognition rate of 91.9%.

Similarly, Margrit Betke et al. [18] developed a real-time vision system that analyzes color videos taken from a forward-

(2)

24

looking video camera in a car driving on a highway. The system uses a combination of color, edge, and motion information to recognize and track the road boundaries, lane markings and other vehicles on the road. Cars are recognized by matching templates that are cropped from the input data online and by detecting highway scene features and evaluating how they relate to each other. Cars are also detected by temporal differencing and by tracking motion parameters that are typical for cars. The system recognizes and tracks road boundaries and lane markings using a recursive least-squares filter. Zhong Qin et al. [19] put forward the vehicle classification using image analyses. First of all, road background is set up according to the serial images, and the vehicle region are segmented using background divide, then its moment invariant features are calculated. The moment invariant features of vehicle will be the input of BP neural networks with three layers, and the vehicle type is classified according to the output of the BP neural networks.

IV.

P

ROPOSED

S

OLUTION

The task of vehicle classification is achieved by the following steps in given algorithm:-

Input: Vehicle Database VT ={V{1},V{2},V{3} ... V{n} } where Vehicle Parameters V{i} = (Area, Perimeter) i.e.

(a{i1},p{i1}, (a{i2},p{i2}, ,…, (a{im},p{im}) in which area and perimeter are the area and perimeter of the vehicle respectively.

Output: Multiple classes of Vehicles.

Extract image from the dataset For i=1: n (last image from the dataset) Do

{

Convert RGB image I[x, y] to Grayscale image Ig[x, y] having intensity value 0-255

Apply Function edgeDetection ( ) { Compute f x and f y

f x =∂

f y =∂

G(x, y) is the Gaussian function

Gx (x, y) is the derivate of G(x, y) with respect to x: Gx (x, y)

= G(x, y)

Gy(x, y) is the derivate of G(x, y) with respect to y: Gy(x, y)

= G(x, y)

Compute the gradient magnitude magn (i, j) = Apply non-maxima suppression.

Apply hysteresis thresholding/edge linking.

}

Apply morphological function based on structuring element Extract geometrical features Area() and Perimeter() of object For each Area () and Perimeter ()

(

Train system using classifiers.

Generate multiple classes using ANN classification and Decision tree considering different views of object

} }

Thus the image based vehicle classification starts with reading the acquired image, preprocessing it; extracting the textural as well as morphological features; selecting required feature to create knowledge base. Use the knowledge base to train the system using ANN and decision tree. Finally classify using unknown test images into multiple classes.

V.

I

MAGE

A

CQUISITION &

M

ATHEMATICAL

M

ORPHOLOGY

The scope and complexity of the recognition problem considered in this paper is exemplified by the database of cars and bikes images, illustrated in Figure 1, with sample images of different models and versions of the cars and bikes. In the experiments, 120 images of cars and bikes from different views (20 each of side view, left side & right side view of cars and bikes ) are used for registration (training) and 60 (10 each of side view, left side & right side view of cars and bikes ) for evaluation (testing) of the proposed system.

(3)

25

Fig.1.1 Sample images of cars with different views

Fig.1.2 Sample images of bikes with different views After inputting the image from database it is preprocessed for further enhancement. Thus the inputted image first gets converted into gray scale image. Then image is been resized in proper dimension. After then edges of gray scale image is been find out using canny edge detector. Later on morphological operations has been performed for further processing

A. Mathematical Morphology

The mathematical morphology is methodology for image processing and image analysis which is based on set theory and topology. Morphological image processing refers to a class of algorithms that transforms the geometric structure of an image. Morphology can be used on binary and gray scale images, and is useful in many areas of image processing, such as skeletonization, edge detection, restoration and texture analysis.

A. Basic Set Theory

The more common set operations that include in morphology include are:-

 Set Inclusion:-This is written as Y ,i.e Y is subset of set X.This is defined as : if y is an element of Y then y is also an element of X.

 Complement:-For any set X complement of X is written as .This is set of all elements which are not elements of X.

 Union:- The union of two sets X and Y, written X is defined as:

 Intersection:- The intersection of two sets X and Y, written X is defined as:

B. Structuring Elements and hit or miss Transformations

A structuring element B_x,centered at x, is a set of points which is used to extract structure in a set X. Structuring element may be square, disk or any other appropriate shape.

A point x belongs to hit or miss transform, denoted X⊗B,if and only if 〖B_x〗^1 is included in X and 〖B_x〗^2 is included in X^c , complement of X.

C. Erosion and dialation a. Erosion

The fundamental operation of mathematical morphology is erosion. All mathematical morphology depends on this notion [8]. The erosion of an input image A by a structuring element B is defined as follows:

AΘB = {x : B + x ⊆ A}

This means that in order to perform the erosion of A by B we translate B by x so that this lies inside A. The set of all points x satisfying this condition constitutes AΘB. The erosion of an image can also be found by intersecting all translates of the input image by the reflection of

the structuring element:

AΘB =∩{A + b : b∈−B}

b. Dilation

The dual operation to erosion is dilation. Dilation of an input image A by a structuring element B is defined as follows:

A ⊕ B = U {B + a: a ∈A}

This means that in order to perform the dilation of A by B we first translate B by all points of

A. The union of these translations constitutes A⊕ B.

D. Opening and Closing

(4)

26

a. Opening

A secondary operation of great importance in mathematical morphology is the opening operation. Opening of an input image A by a structuring element B is defined as follows:

A o B = (AΘB)⊕ B

An equivalent definition for opening is:

A o B =U{B + x : B + x ⊆ A}

This means that in order to open A by B we first translate B by x so that this lies inside A. The union of these translations constitutes A o B. For instance, the opening of a triangle A by a disk B (the origin coincides with the centre of the disk) is the triangle A with rounded corners. In general, opening by a disk rounds or eliminates all peaks extending into the image background.

b. Closing

The other important secondary operation is closing. Closing of an input image A by a

structuring element B is defined as follows:

A • B = (A ⊕ B)ΘB

For instance, closing a triangle A by a disk B (the origin is on the centre of the disk) yields

the same triangle A. In this case A • B = A and we say that A is B-close. In general, closing by a disk rounds or eliminates all cavities extending into the image foreground.

Fig.2 Gray scale image

Fig.3 Edge detected

Fig.4 Image after morphological operations

VI.

F

EATURE

E

XTRACTION

After preprocessing of image features has to be extracted.

Morphological features like area and perimeter has been extracted as they most promising and efficient features. Area and perimeter have been calculated using method called regionprops measures a set of properties for each connected component (object) in the binary image, BW. The image BW is a logical array; it can have any dimension.

Area: - Actual number of pixels in the region.

Perimeter:- The distance around the boundary of the region.

Regionprops computes the perimeter by calculating the distance between each adjoining pair

of pixels around the border of the region.

These features are extracted by considering different views of vehicles. The views that have been considered for cars and bikes are as follows:-

Side View:-Considering the complete side view of cars and bikes images

Right Side View: - Considering the right side view of cars and bikes images

Left Side View: - Considering the left side view of cars and bikes images

VII.

V

EHICLE

C

LASSIFICATION

U

SING

A

RTIFICIAL

N

EURAL

N

ETWORK A multilayer feedforward neural network is an interconnection of perceptrons in which data and calculations flow in a single direction, from the input data to the outputs. The number of layers in a neural network is the number of layers of perceptrons.

(5)

27

The input data you provide your network comes through the input units. This is used to provide the bias to the hidden nodes. Each hidden node calculates the weighted sum of its inputs and applies a thresholding function to determine the output of the hidden node. The weighted sum of the inputs for hidden node zh is calculated as:

The thresholding function applied at the hidden node is typically either a step function or a sigmoid function. For our purposes, we’ll stick with the sigmoid function. The general form of the sigmoid function is:

Here, we typically have K output nodes, for K classes. So, we’ll calculate the output of node yi as:-

In order to train the neural network, a set of training vehicle images was required, and the images were predefined. The Neural Network Toolbox of Matlab is used to train two different types of Artificial Neural Networks (ANNs) i.e.

patternnet. Fig. 5 shows the structure of the ANNs that used patternnet

Fig. 5 Structure of ANN using Patternnet

The hidden layer contains 10 neurons. ANNs based patternnet are feedforward networks that can be trained to classify inputs according to target classes. The training method trainlm was

used to train these networks. During training, the connection weights of the neural network were initialized with some random values. The training samples in the training set were input to the neural network classifier in random order and the connection weights were adjusted according to the error back- propagation learning rule. This process was repeated until the mean squares error (MSE) fell below a predefined tolerance level or the maximum number of iterations is achieved. When the network training was finished, the network was tested with test dataset (60 vehicle images), and the classification accuracies were calculated. The performance plot and confusion matrix plot is shown in fig.[6,7]

Fig.6 Performance plot

Fig.7 confusion matrix plot

0 5 10 15 20 25

10-2 10-1 100

Best Validation Performance is 0.082419 at epoch 22

Mean Squared Error (mse)

28 Epochs

Train Validation Test Best

1 2 3 4 5 6

1 2 3 4 5 6

14 16.7%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

7 8.3%

0 0.0%

6 7.1%

0 0.0%

0 0.0%

0 0.0%

0.0%

100%

0 0.0%

0 0.0%

13 15.5%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

16 19.0%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

6 7.1%

1 1.2%

8 9.5%

6.7%

93.3%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

13 15.5%

100%

0.0%

66.7%

33.3%

NaN%

NaN%

68.4%

31.6%

72.7%

27.3%

100%

0.0%

61.9%

38.1%

67.9%

32.1%

Target Class

Output Class

Training Confusion Matrix

1 2 3 4 5 6

1 2 3 4 5 6

3 16.7%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

3 16.7%

0 0.0%

1 5.6%

0 0.0%

0 0.0%

0 0.0%

0.0%

100%

0 0.0%

0 0.0%

3 16.7%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

NaN%

NaN%

0 0.0%

0 0.0%

0 0.0%

1 5.6%

0 0.0%

1 5.6%

0.0%

100%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

6 33.3%

100%

0.0%

50.0%

50.0%

NaN%

NaN%

75.0%

25.0%

0.0%

100%

NaN%

NaN%

85.7%

14.3%

66.7%

33.3%

Target Class

Output Class

Validation Confusion Matrix

1 2 3 4 5 6

1 2 3 4 5 6

3 16.7%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

3 16.7%

0 0.0%

0 0.0%

0 0.0%

0.0%

100%

0 0.0%

0 0.0%

4 22.2%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

4 22.2%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

1 5.6%

0 0.0%

2 11.1%

0.0%

100%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

1 5.6%

100%

0.0%

100%

0.0%

NaN%

NaN%

57.1%

42.9%

80.0%

20.0%

NaN%

NaN%

33.3%

66.7%

66.7%

33.3%

Target Class

Output Class

Test Confusion Matrix

1 2 3 4 5 6

1 2 3 4 5 6

20 16.7%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

10 8.3%

0 0.0%

10 8.3%

0 0.0%

0 0.0%

0 0.0%

0.0%

100%

0 0.0%

0 0.0%

20 16.7%

0 0.0%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

20 16.7%

0 0.0%

0 0.0%

100%

0.0%

0 0.0%

0 0.0%

0 0.0%

8 6.7%

1 0.8%

11 9.2%

5.0%

95.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

0 0.0%

20 16.7%

100%

0.0%

66.7%

33.3%

NaN%

NaN%

66.7%

33.3%

71.4%

28.6%

100%

0.0%

64.5%

35.5%

67.5%

32.5%

Target Class

Output Class

All Confusion Matrix

(6)

28

The performance goal was meet and the classification accuracies were 90.00% and above.

VIII.

V

EHICLE

C

LASSIFICATION

U

SING

D

ECISION

T

REE

Decision Tree is hierarchical like tree structure, where each internal node denotes a test on an attribute, each branch denotes an outcome of test, and each leaf node holds a class label. The topmost node in a tree is the root node. Given a tuple, X, for which the associated class label is unknown, the attribute values of the tuple are tested against decision tree. A path is traced from the root to a leaf node, which holds the class prediction for that tuple.

The gini index is defined as:

In order to define information gain precisely, we need to define a measure commonly used in information theory, called entropy, that characterizes the (im)purity of an arbitrary collection of examples. Given a set S, If the target attribute takes on c different values, then the entropy of S relative to this c-wise classification is defined as

where pi is the proportion of S belonging to class i.

Given entropy as a measure of the impurity in a collection of training examples, we can now define a measure of the effectiveness of an attribute in classifying the training data.

The measure we will use, called information gain, is simply the expected reduction in entropy caused by partitioning the examples according to this attribute. More precisely, the information gain, Gain (S, A) of an attribute A, relative to a collection of examples S, is defined as

where Values(A) is the set of all possible values for attribute A, and Sv is the subset of S for which attribute A has value v (i.e., Sv = {s Î S | A(s) = v}).

The classregtree function from the Statistical Toolbox of Matlab is used to generate a Classification and Regression Tree using the training dataset using two attributes Area and perimeter. Fig. 8 shows the structure of the tree that was generated after training showing six different classes.

Fig. 8 Decision tree showing six classes

(7)

29

IX.

C

ONCLUSION

An algorithm was developed to classify vehicles images based on morphological features. Acquired images were first preprocessed; then morphological features were extracted machine vision system. A pattern recognition neural network was used to classify the vehicle images. In the test dataset, the classification accuracies were 80.00% and above. Also decision tree was used to classify the dataset against two attributes. Performance analysis of decision tree is also 85.00% and above. Thus from both the classification approaches decision tree is found to be more accurate and efficient approach.

X.

F

UTURE

S

COPE

The present work can be extended for video processing where input will be a video having vehicles and then classification will be done on video based datasets. Some other features can also be extracted to increase accuracy. Also the classification can be done considering various angles of appearances of images so that the classification can be done accordingly.

XI.

R

EFERENCE

[1] Bouckaert, R.R.: Choosing between two learning algorithms based on calibrated tests. International Conference on Machine Learning (ICML-2003), Washington DC, 2003

[2] Canny, J.: A Computational Approach to Edge Detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAMI-8, (6): 679-698, 1986 [3] Dubuisson Jolly, MP., Lakshmanan, S., Jain, A.K.:

Vehicle Segmentation and Classification using Deformable Templates. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 18, No. 3, March 1996

[4] Gonzalez, R.C., Woods, R.E., Eddins, S.L.: Digital Image Processing using Matlab. Prentice Hall, 2004 [5] Gupte, S., Masoud, O., Martin, R.F.K.

Papanikolopoulos, N.P.: Detection and Classification of Vehicles. IEEE Transactions on Intelligent Transportation Systems, Vol. 3, No. 1, March 2002 [6] Japkowicz, N., Myers, C., Gluck, M.: A novelty

detection approach to classification. Proc. 14th International Joint Conference on Artificial Intelligence, Montreal, Canada, 1995

[7] Kato, T., Ninomiya, Y., Masaki, I.: Preceding vehicle recognition based on learning from sample images.

IEEE Transactions on Intelligent Transportation Systems, Vol. 3, No. 4, December 2002

[8] Lipton, A.J., Fujiyoshi, H., Patil, R.S.: Moving target classification and tracking from real-time video. IEEE Workshop Applications of Computer Vision, 1998, pp.

8-14

[9] Moya, M., Koch, M., Hostetler, L.: One-class classifier networks for target recognition applications. In Proceedings World Congress on Neural Networks, Portland, OR, International Neural Network Society, INNS, pp. 797–801, 1993

[10] Moya, M.R. & Hush, D.R., 1996: “Network Constraints and Multi-Objective O-timisation for One- Class Classification.” Neural Networks, Vol. 9, No. 3.

[11] Petrović, V., Cootes, T.: Analysis of features for rigid structure vehicle type recognition. BMVC2004, 2004 [12] Scholkopf, B., Platt, J.C., Shawe-Taylor, J., Smola,

A.J., Williamson, R.C.: Estimating the support of a high-dimensional distribution. Neural Computation, Vol. 13. (Also a Microsoft Research technical report, MSR-TR-99-87, 1999.) 2001

[13] Tax, D.M.J.: One-class classification. PhD Thesis, Delft University of Technology. ISBN: 90-75691-05-x, 2001

[14] Wei, W., Zhang, Q., Wang, M.: A method of vehicle classification using models and neural networks. IEEE Vehicular Technology Conference, IEEE, 2001 [15]. Yoshida, T., Mohottala, S., Kagesawa, M., Ikeuchi, K.:

Vehicle Classification Systems with Local-Feature Based Algorithm using CG Model Images. IEICE Trans., Vol. E00-A, No. 12, December 2002

[16]. Jun-Wei Hsieh, Shih-Hao Yu, Yung-Sheng Chen, and Wen-Fong Hu, Automatic Traffic Surveillance System for Vehicle Tracking and Classification. IEEE transactions on intelligent transportation systems, vol.

7, no. 2, June 2006

[17] Margrit Betke, Esin Haritaoglu, Larry S. Davis, Real- time multiple vehicle detection and tracking from a moving vehicle. Machine Vision and Applications (2000) 12: 69–83

[18] Zhong Qin and Guangzhou, Method of Vehicle Classification Based on Video. Proceedings of the 2008 IEEE/ASME International Conference on Advanced Intelligent Mechatronics July 2 - 5, 2008, Xi'an, China [19] Bhaskar N. Patel, Satish G. Prajapati and Dr. Kamaljit

I. Lakhtaria. Efficient Classification of Data Using Decision Tree. Bonfring International Journal of Data Mining, Vol. 2, No. 1, March 2012.

References

Related documents

Graph Visualization, Visual Clutter, Graph Drawing Techniques, Node-Link Diagram, Geographic

The present study aimed to assess the relationship between the concentration of plasma EBV-DNA and the number of CD8 + PD-1 + (programmed cell death-1,PD-1) and regulatory T

Shows the Physiochemical properties of Mahua Biodiesel comparisons with the ASTM biodiesel standard and commercially available diesel. Ambient temperature of the test laboratory

Objective Complex cardiac devices including implantable cardioverter defibrillator (ICD) and cardiac resynchronisation therapy (CRT) devices can safely be implanted as a day

The state of major agent fol- lows a linear backward stochastic differential equation (BSDE) and the states of minor agents are governed by linear forward stochastic

Dubsky, et al., Prediction of late distant recurrence after 5 years of endocrine treatment: a combined analysis of patients from the Austrian breast and colorectal

If you want to be prompted for credit card information during order entry, check the Order Processing system option "prompt for credit card during order entry?".. If you

We observed only two significant correlations with corrective leadership: (more) obeying the rules of the Church, and (less) self-directedness. Finally, we tested