Está en la página 1de 6

ASIAN JOURNAL OF ENGINEERING, SCIENCES & TECHNOLOGY, VOL.

4, ISSUE 1 MARCH 2014

Unconcealed Gun Detection using Haar-like and


HOG Features - A Comparative Approach
Sorath Asnani, Syed Danial Waseem, Ali Asghar Manjotho

Abstract Due to its wide variety of applications, object it has other objects as well. For example, the image of gun
detection has been the center of attention for researchers in the
may contain a person holding that gun, a person to which the
field of digital image processing and computer vision. When
trained with the sample training dataset, various object
gun is being pointed, the environmental background and so
classifiers can detect and classify the objects with prominent on. So it is not suggested to provide whole image to a
accuracy and precision. The major step in any of the object classifier. Rather, it is more beneficial to extract some
classification algorithm is feature selection. Performance of the features from the object of interest in an image.
classifier depends on robustness of the feature vector selected.
This paper presents unconcealed gun detection method by Feature is simply a piece of information related to the object
using Boosted Cascade Classifier. The classifier was trained in an image. A feature may typically be the shape, edge,
with two of the widely known feature types: Haar-like features color, size or texture of object. The more strong the feature
and Histogram of Oriented Gradients (HOG) features. The set, the more accurate is the classifier. So the most important
paper also presents a comparative study between the two of the step in training a classifier is to decide the feature set and to
feature types under the consideration of unconcealed gun
detection. The classifier was trained with the dataset of 11,257
select a robust feature extraction technique.
number of images using both the types of features separately
There are various feature extraction algorithms used in
and tested with dataset of 700 number of images. Using the
Haar-like features the classifier attained the accuracy of practice today for the purpose of classification, few of them
42.14% with the precision of 45.73%. While using the HOG are: SIFT (Scale Invariant Feature Transform) [1], SURF
features, the classifier gained the accuracy of 88.57% with the (Speeded-up Robust Features) [2], FAST (Fusing Points and
precision of 95.30%. The evaluation metrics clearly depicts the Lines for High Performance Tracking) [3], MSER
superiority of HOG features over the Haar-like features in (Maximally Stable External Regions) [4], BRISK (Binary
unconcealed gun detection. Robust Invariant Scalable Key-points) [5], HOG (Histogram
of Oriented Gradients) [6], Haar wavelets [7], LBP (Local
Binary Patterns) [8] and many others.
Keywords Object Detection, Cascade Classifier, Haar-like
features, HOG features The biggest problem in object detection is to find the most
appropriate feature type for the particular application.
Literature survey reveals that Haar and HOG feature types
I. INTRODUCTION are the most powerful features from all the above mentioned
Unconcealed weapon detection is a modern research area in features. But at the same time we cannot ignore the
the field of Computer Vision. It is an application of smart importance of other features in forming the basis for the
surveillance which provides a guaranteed, cost efficient and development of these very famous feature types.
accurate security system. Weapon detection is not a new
field for research because much work has been done on This paper provides a comparative study between the two
concealed weapon detection. The interesting point is that well-known feature types i.e. HOG and Haar-like features
Unconcealed Weapon Detection is a relatively new field of for the purpose of unconcealed weapon detection.
research.
The HOG features, introduced by Dalal and Triggs in [6],
To detect any object, a classifier is trained. A classifier is are well known for their high detection accuracy whereas the
nothing but a computer program which is capable to identify Haar-like features, proposed by Viola and Jones in [7] are
an object of interest among all other objects. A classifier famous for their fast training speed. This paper proposes a
needs some input to process so that it can be trained practical approach to validate the above properties of both
accordingly. Input to the classifier is in the form of training the feature types in case of unconcealed gun detection.
images. An image not only contains the object of interest but
The rest of the paper is ordered as follows: Section II
Department of Computer Systems Engineering
Mehran University of Engineering and Technology, Jamshoro, Sindh,
outlines the previous work, Section III provides the details
Pakistan.
sorath.asnani@hotmail.com, engr.syeddanialwaseem@outlook.com,
ali.manjotho@faculty.muet.edu.pk

34
ASIAN JOURNAL OF ENGINEERING, SCIENCES & TECHNOLOGY, VOL. 4, ISSUE 1 MARCH 2014

of the feature types used in this paper, Section IV describes III. FEATURE SELECTION
the classifier training for gun detection, Section V discusses
Feature selection and the training algorithm are the two key
the training and testing corpus, Section VI describes the
steps of creating an efficient classifier. In this section we
methodology carried out for training the classifier,
explain the working mechanism of Haar-like and HOG
Experimental results are demonstrated in Section VII,
features one by one.
Section VIII summarizes and concludes the proposed
system. Finally the future work and references are provided.
A. HAAR LIKE FEATURES
II. RELATED WORK The Haar-like features, introduced by Viola-Jones in [7],
have been used widely for face detection. Haar-like feature
This section examines the related work of HOG and Haar-
takes its name from the Haar Wavelets. Haar-like feature is a
like features.
rectangular feature. Each rectangle is made up of alternative
The Haar-like features are being used extensively for face white and black blocks. The Haar-feature is computed by
detection. These features have proved to be successful for subtracting the sum of white and black regions with each
face detection as in [7]. The famous HOG features have been other. First, calculate the sum of all the white rectangular
used successfully in Human and Pedestrian Detection in [9]. regions and the sum of black regions separately. Then
The research not only stops there. But the researchers are subtract the sums from each other. Indisputably the
striving hard to compare both the feature types for many estimation of the subtraction is the estimation of the Haar
other applications. characteristic.
A Pedestrian detection method based on both the feature Haar-like features can be classified as two, three and four
types i.e. HOG and Haar-like features, is proposed in [10]. rectangle features, as shown in figure 1.
The combined approach was suggested to take advantage of
both features i.e. to obtain the greater detection precision by
HOG and to greatly reduce the training time by the use of
Haar-like features.
Liang et al. [11] proposed a multi kernel approach for
(a) (b) (c)
Vehicle detection based on HOG and Haar-like features. The
experimental results in [11] shows that vehicle detection Figure 1: Haar-like features (a) Two-Rectangle features, (b) Three-
system is 88% accurate using HOG features, by using only Rectangle features, and (c) Four-Rectangle features
Haar-like features its accuracy decreases to 86% and when
both the features are combined, the overall accuracy
increases up to 91%, which is a significant achievement of Figure 2 shows the Haar-like features extracted from the
the final trained classifier. training dataset.

Krerngkamjornkit et al. [12] enhanced the work of Viola and


Jones framework. They experimented on Human body
detection and tracking. Their research work reveals that the
actual Viola and Jones face detector is 70% accurate which
was increased to 84% in [12] by reducing the drawbacks of
Viola and Jones framework.
Figure 2: Haar-like feature extraction
The investigation of using Haar-like features is provided in
[13]. An improvement on Viola Jones algorithm was
proposed in [14]. An improved approach of feature selection B. HOG FEATURES
for Viola-Jones framework in proposed in [15].
HOG Features were introduced by Dalal and Triggs in [6].
The MATLAB documentation on Training a Cascade Object HOG refers to Histogram of Oriented Gradients. The name
Detector [16] reveals the significance of HOG features. It is itself is defining it i.e. these features are actually the
clearly mentioned that the HOG features can be used to histograms of the gradient orientations of the pixels. The
detect any type of object and they are being extensively used directional change in the intensity or color of a picture is
for creating custom classifiers. This is the major reason for known as Image Gradient. To extract information from
using the HOG features for the purpose of detecting images, the image gradients are used. HOG is suitable where
unconcealed guns. On the other hand, the greater the classification is required on the basis of shape. HOG uses
achievement of the Haar-like features in detecting the faces, overall appearance and shape of an object because it works
humans, pedestrians, vehicles and stop signs; has directed on the basis of edges and direction of pixels in an image.
our attention to use this feature type for gun detection. The overall silhouette of an object is captured by the HOG
features. In our case, to detect unconcealed guns, we need to

35
ASIAN JOURNAL OF ENGINEERING, SCIENCES & TECHNOLOGY, VOL. 4, ISSUE 1 MARCH 2014

focus on its shape, which is the main reason for using HOG known as Cascade Classifier. The boosted cascade
features. classifier works on the concept of sliding window. A small
rectangular window is slid over the entire image during each
Now, we briefly discuss the working mechanism of HOG
stage. At each stage, the sliding window is moved from left
feature extraction. Image is a collection of pixels. The
to right and from top to bottom of an image. If the region
cluster of adjacent pixels forms a spatial region known as
covered by the window does not contain object of interest, it
Cell. Adjacent cells are combined into a larger region
is marked as negative and is discarded from the process. On
called Block. The blocks are adjusted by 50% overlap
the other hand, if the object of interest is found at any stage,
with one another. Horizontal and Vertical gradients are
it is moved to the subsequent stages. The final detection
calculated for each cell, known as a Gradient Vector. The
result is provided by the last stage.
gradient vector of each cell inside a block is consolidated
which structures the final feature vector. The gradients of The more the number of stages and the number of training
cell are the local histograms computed over the pixels of the images, the more efficient is the classifier.
cell. Different experiments show that the best results are
obtained by having 8x8 pixels per cell, and 2x2 cells per
block as shown in figure 3. V. TRAINING AND TEST CORPUS
We have created two separate classifiers, one is based on the
HOG features and the other is based on the HAAR-like
features. In order to train a classifier, an image corpus is
required containing both the Positive as well as Negative
images. The Positive images contain the objects of interest
while the Negative images are those which do not contain
the desired object.
The Cascade Classifier requires extensive number of images
for training. It does not work well for the scale and rotation
invariant images. To train it accurately, the training dataset
must contain the images from all the directions in which one
Figure 3: Block and Cell Organization
is interested to detect. Taking this point into consideration,
we have set our camera at particular distance and at a fixed
angle for collecting the dataset. It is about 7 ft. above the
We have computed the HOG features from the training
ground and at the angle of 65 degrees in the z-axis. All
image dataset using MATLAB functions. The HOG features
images are captured at the specified parameters. The images
are shown in figure 4.
are captured under different lightening conditions. The
dimension of all the images is 640 x 480.
The training corpus comprises of 11,257 images among
them 5000 are Positive images and 6257 are Negative
images. The testing corpus contains 350 Positive and 350
Negative images i.e. 700 images in total.

(a) (b) (c) The test dataset contains the best cases (i.e. images which
contain clearer view of the gun and less occlusion) as well as
Figure 4: HOG features. (a) Input image, (b) HOG features using cell size the worst case (i.e. images in which the gun is not clearly
8x8, (c) HOG features by using cell size 32x32.
visible). The images are taken under different lightning
conditions.
It can be seen through the above figure, that the HOG Tables 1 and 2 show the Training and Testing Corpus,
features capture the overall structure of an object. HOG respectively.
features depends upon the cell and block size. They must be
kept so that the shape is clearly visible with in HOG feature
set. Table 1: Training Corpus Table 2: Testing Corpus

IV. CASCADE CLASSIFIER


This section briefly describes the basic working principle of
the Cascade Classifier.
The cascade classifier comprises of various stages and each
stage involves week learners. The output of one stage is
provided as the input to the next stage. Thats why it is

36
ASIAN JOURNAL OF ENGINEERING, SCIENCES & TECHNOLOGY, VOL. 4, ISSUE 1 MARCH 2014

The Training and Testing dataset is same for both the In the same way, the Haar-like features are also extracted
classifiers. from all the images to create the Haar feature based
classifier.
Figures 5 and 6 show some sample Positive and Negative
Images from the image corpus, respectively. iv. Training the Cascade Classifier
Finally the extracted features are provided to the cascade
classifier for training. Along with these features, the
negative images are also provided to the classifier, so that
the final classification model can distinguish among the guns
and other objects. The output of the classifier is the .xml file
which contains all the information regarding the trained
classifier. While training the classifier, the True positive rate
is set to 99.5% and the False Alarm Rate is kept 0.5%.

Figure 5: Positive Images

Figure 7: Training the Cascade Classifier

v. Testing the Trained Classifier


The performance of the trained model is then tested by
providing the test images to the classifier.
Figure 6: Negative Images

VII. EXPERIMENTAL RESULTS


VI. METHODOLOGY
This section demonstrates the test consequences of both the
In this section we discuss the methodology used to train the trained classifiers.
classifiers. First of all the image dataset is collected as
shown in the above section. In the MATLABs working Figures 8 and 9 depict the experimental results of the HOG
directory, separate directories are created for Positive and and HAAR based classifier respectively.
Negative Training dataset.
Following steps are carried out to train the classifier:
i. Image Preprocessing
In this step, all the training images are converted into gray-
scale images. Then the images are sharpened and blurred to
get the variety of training images and in this way, we can
extend our image dataset.
Figure 8: Experimental Results of HOG based Classifier
ii. ROI Selection
The gray images are processed further to get the trained
classifier. The complete image is not provided for feature
extraction but we select some particular Region of Interest
(ROI) from within the image to extract the features of that
particular region. The ROI includes the gun in the image.
iii. Feature Extraction
After ROI selection, we extract the HOG features. The
overall silhouette of an object is captured by the HOG
features. The ROIs must contain the unconcealed gun, by Figure 9: Experimental Results of Haar based Classifier
extracting the HOG features the shape of the gun is taken for
further processing.

37
ASIAN JOURNAL OF ENGINEERING, SCIENCES & TECHNOLOGY, VOL. 4, ISSUE 1 MARCH 2014

The results in figure 8 and 9 are very muchh surprising. Both


the detectors are completely different from
m each other. The
results of HOG based classifier seems morre accurate while
in the HAAR based classifier, no doubt thhe gun is detected
but it is mistakenly detecting many otherr objects as well.
Now let us compare both the classifier on the basis of
training time as shown in table 3.

Table 3: Training Time Durationn

Figure 10: Evaluation Metrics of


o both Classifiers

Figure 11 shows the comparison off Precision and Accuracy


of both classifiers. It is quite cleaar that the Precision and
The HAAR feature based classifier took eextremely greater Accuracy of the HAAR based classiifier is almost half that of
training time than the HOG based classifierr. There is a much the HOG based classifier.
greater difference in 2.5 hours and 4.4 dayys. Inspite of that
much training time duration, the perform mance of HAAR
based classifier is not satisfactory.
Now let us compare the classifiers on the baasis of Evaluation
Metrics. The comparison results are shownn in table 4. It is
clearly revealed that the accuracy and preecision of HAAR
based classifier is almost half that of the HOG based
classifier.

Table 4: Comparison on the basis of Evaluattion Metrics

Evaluation Metrics HOG Based HAAR Based


Classifier Classifier
True Positive Rate 81.14% 884.28% Figure 11: Precision and Accuracy
y of both Classifiers
False Positive Rate 4% 1100%
True Negative Rate 96% 00% VIII. CONCLU
USION
False Negative Rate 18.86% 115.71% This paper has proposed a security y system focused around
Unconcealed Gun Detection. To deetect any object the two
Precision 95.30% 445.73%
main issues are: i) feature selectioon and ii) classification.
Accuracy 88.57% 442.14% There are a number of feature typess available, each type has
its own importance and application ns. Every feature will not
suit for every application. So the moost challenging task is to
Figure 10 shows the graphical view of thhe comparison of identify the feature type which best suits the application. For
Evaluation Metrics for both the classifiers. For the classifier that purpose we studied various featture types and found that
to work correctly, true positive rate musst be as high as HOG and HAAR-like features hav ve greatly contributed in
possible and the false positive rate musst be as low as the field of Pattern Recognition. Most
M of the recent object
possible. But for the HAAR based claassifier the false recognition algorithms extensively use
u both of these feature
positive rate is much greater, which is the m
main reason for its types.
failure. HOG and Haar-like features work particularly
p well for face
recognition. But for the case of Weapon Detection, the
performance of both of these featu
ures is unknown. In this

38
ASIAN JOURNAL OF ENGINEERING, SCIENCES & TECHNOLOGY, VOL. 4, ISSUE 1 MARCH 2014

paper we have provided a comparative study of both the Conference on Computer Vision and Pattern Recognition,
feature types for the Unconcealed Weapon Detection. Vol. 1 (June 2005), pp. 886893.
According to the experimental results of section VI, it is [7] Viola, P., and Jones, M., "Rapid Object Detection using a
quite evidence that HOG feature type is the most suitable Boosted Cascade of Simple Features", Proceedings of the
and robust feature type for the purpose of unconcealed 2001 IEEE Computer Society Conference, Volume 1, 15
weapon detection in image processing. April 2001, pp. 511518.
We compared both the classifiers on various parameters like [8] Ojala, T., Pietikainen, M., and Maenpaa, T.,
training time duration, accuracy, precision, true positive rate, "Multiresolution Gray-scale and Rotation Invariant Texture
false positive rate, true negative rate and false positive rate. Classification With Local Binary Patterns", IEEE
From every aspect, the HOG based classifier is much better Transactions on Pattern Analysis and Machine Intelligence,
than the HAAR based classifier. Volume 24, No. 7 July 2002, pp. 971987.
HOG based classifier is trained in 2.5 hours whereas HAAR [9] Jia, X. H., Zhang, J. Y., Fast Human Detection by
based classifier took approximately 4.4 days for training the Boosting Histograms of Oriented Gradients, 4th
classifier. The precision and accuracy of HAAR based International Conference on Image and Graphics, pp. 683-
classifier is almost the half of the HOG based classifier. 688, 2007.
Keeping in view the above discussion and the results, we [10] Xin, Y., Su Li, S., A Combined Pedestrian Detection
therefore conclude that Haar-like features do not work well Method based on Haar-like Features and HOG Features, 3rd
for the Gun detection instead the most suitable technique is International Workshop on Intelligent Systems and
the HOG feature extraction. Applications (ISA), pp. 1-4, 2011.
[11] Liang, P., Teodoro, G., Ling, H., Blasch, E., Chen, G.,
Bai, L., Multiple Kernel Learning for Vehicle Detection in
FUTURE WORK
Wide Area Motion Imagery, 15th International Conference
The future work is: on Information Fusion (FUSION), pp. 1629-1636, July
2012.
- To make the HOG based classifier more accurate
- To include multiple gun types for detection. [12] Kremgkamjornkit, R., Simic, M., Enhancement of
- To implement the Gun Detector to improve the Human Body Detection and Tracking Algorithm based on
existing security systems. Viola and Jones Framework, 11th International Conference
on Telecommunication in Modern Satellite, Cable and
broadcasting Services (TELSIKS), vol. 1, pp. 115-118, 2013.
REFERENCES [13] Peleshko, D., Soroka, K., Research of Usage of Haar-
[1] Lowe, G. D., Distinctive Image Features from Scale like Features and AdaBoost Algorithm in Viola-Jones
Invariant key points, International Journal of Computer Method of Object Detection, 12th International Conference
Vision, vol. 60, no. 2, pp. 91-110, 2004. on the Experience of Designing and Application of CAD
Systems in Microelectronics (CADSM), pp. 284-286, 2013.
[2] Herbert, B., Ess, A., Tuytelaars, T., and L. Van Gool,
SURF: "Speeded Up Robust Features", Computer Vision [14] Li, Q., Niaz, U., Merialdo, B., An Improved Algorithm
and Image Understanding (CVIU), Vol. 110, No. 3, pp. 346- on Viola-Jones Object Detector, 10th International
359, 2008. Workshop on Content-based Multimedia Indexing (CBMI),
pp. 1-6, 2012.
[3] Rosten, E., and Drummond, T.; "Fusing Points and Lines
for High Performance Tracking", Proceedings of the IEEE [15] Lang, R. S., Luerssen, H. M., Powers, W. M.,
International Conference on Computer Vision, Vol. 2 Evolutionary Feature Preselection for Viola-Jones
(October 2005): pp. 15081511. Classifier Training, Spring Conference on Engineering and
Technology (S-CET), pp. 1-4, 2012.
[4] Nister, D., and Stewenius, H., "Linear Time Maximally
Stable Extremal Regions", Lecture Notes in Computer [16] mathworks.com, Train a Cascade Object Detector,
Science. 10th European Conference on Computer Vision, http://www.mathworks.com/help/vision/ug/train-a-cascade-
Marseille, France: 2008, no. 5303, pp. 183196. object-detector.html, Accessed: [09 Nov, 2014].
[5] Leutenegger, S., Chli, M., and Siegwart, R., "BRISK:
Binary Robust Invariant Scalable Keypoints", Proceedings
of the IEEE International Conference, ICCV 2011, pp. 2548-
2555.
[6] Dalal, N. and Triggs, B., "Histograms of Oriented
Gradients for Human Detection", IEEE Computer Society

39

También podría gustarte