Fast Calculation of Histogram of Oriented Gradient Feature by Removing Redundancy in Overlapping Block
Fast Calculation of Histogram of Oriented Gradient Feature by Removing Redundancy in Overlapping Block
Fast Calculation of Histogram of Oriented Gradient Feature by Removing Redundancy in Overlapping Block
1. INTRODUCTION
A robust and discriminative feature is strongly required for pedestrian detection be-
cause of a wide range of pedestrian’s appearance, illumination, and cluttered background.
Since histogram of oriented gradient (HOG) [1] feature has achieved great success on
pedestrian detection, it is widely used in many applications such as intelligent vehicles,
robots, and surveillance systems. In these applications, detection speed is essential as
well as detection accuracy [2]. However, its detection speed is relatively slow due to the
high computational complexity of HOG feature calculation. Especially trilinear interpo-
lation, one of the most effective techniques to improve detection accuracy in HOG fea-
ture calculation, degrades detection speed significantly. In order to accelerate detection
speed, therefore, we present a novel method to significantly reduce the number of re-
quired operations in HOG feature calculation. By replacing block-based operation with
cell-based one and by identifying key rules in trilinear interpolation, each cell in over-
lapping blocks is considered only once and redundant operations are totally removed.
Furthermore, the number of required operations is reduced up to 60.5% by sharing the
common operations in trilinear interpolation.
The rest of this paper is organized as follows. Section 2 introduces the related works
to pedestrian detection using HOG feature. Section 3 briefly overviews the algorithm of
Received November 16, 2013; revised January 9, 2014; accepted January 20, 21014.
Communicated by Chu-Song Chen.
1
Corresponding author.
*
This research was supported by Basic Science Research Program through the National Research Foundation
of Korea (NRF) funded by the Ministry of Education (NRF-2013R1A1A2063422).
1719
1720 SOOJIN KIM AND KYEONGSOON CHO
HOG feature calculation, and Section 4 describes the proposed algorithm to accelerate
the speed of HOG feature calculation. The experimental results are given in Section 5.
Finally, Section 6 concludes this paper.
2. RELATED WORK
In recent years, many researches have been conducted for pedestrian detection.
Symmetry, corners, texture, shadow, color, edges, and gradients can be used to represent
the characteristics of the pedestrian. Among the various types of feature, HOG feature
that is based on gradient information is widely used since it is considered to be the most
discriminative feature for pedestrian detection. The performances of 16 state-of-the-art
pedestrian detectors across six data sets are evaluated in [2]. They reported that nearly all
modern detectors employ some form of gradient histograms. In [3], a diverse set of pe-
destrian detectors is evaluated with identical test criteria and data sets. According to their
experiments, an approach using HOG feature clearly outperforms others. In order to im-
prove detection accuracy, several features are often combined with HOG feature. A
combination of several features with HOG feature outperforms any individual feature in
[4]. By combining HOG feature with local binary pattern (LBP) [5], the detection rate is
increased by 7% in [6]. However, the increase in detection accuracy has been paid for
with increased computational costs [7]. In many applications, including automotive
safety, surveillance, and robotics, fast detection time is as important as high detection
rate.
Many researches have been proposed to improve detection speed for pedestrian de-
tection. Several methods to simplify the computation of HOG feature extraction are pro-
posed in [8-10]. In order to reduce the amount of calculations, the interpolation tech-
nique is discarded in [8], a simplified linear interpolation technique is applied in [9], and
an approximated trilinear interpolation is applied in [10]. Consequently, detection rates
are significantly degraded. Even though trilinear interpolation is one of the most effec-
tive techniques to improve detection accuracy, it is not easy to apply trilinear interpola-
tion technique in its original form to provide real-time detection due to its high computa-
tional complexity. Nonetheless, trilinear interpolation technique cannot be discarded,
simplified or approximated in HOG feature calculation since high detection rate is also
important in many applications. Instead the method to accelerate the computation of tri-
linear interpolation is strongly required.
f(x, y) represents a pixel value for (x, y) position in an image I. Then the gradients are
used to calculate magnitude M and orientation θ by Eqs. (3) and (4). The third step is to
accumulate weighted votes for gradient magnitude into N orientation bins over p×p spa-
tial cells. When inter-bin distance (θdist) is 20° over 0~180°, N is determined as 9. In or-
der to avoid aliasing, block-based interpolation is applied to interpolate weighted votes
bilinearly between the neighboring bins in both orientation and position. The next step is
to normalize contrast within each block, and two representative normalization schemes
are presented in Eqs. (5) and (6). In these equations, Bk represents 36-dimensional vector
for a block, c represents each element in the vector, and ε is a small constant used to
avoid division by zero. The dimension of each block is determined by the number of
orientation bins in the block. Finally, the last step is to collect histogram vectors for all
overlapping blocks over detection window. When Sx=48, Sy=96, p=6, c=2, L=6, and N=9,
as shown in Fig. 1, the dimension of the final HOG feature for each detection window is
3,780 since the total number of 36-dimensional overlapping blocks in a window is 105.
Even though trilinear interpolation improves detection rate considerably, fast detec-
tion time is hardly achieved due to its high computational complexity. Since HOG fea-
ture is calculated by considering all overlapping blocks in detection window, the amount
of computations is further increased. Table 2 shows the number of required multiplica-
tions per detection window including interpolation and L2norm normalization. As
shown in the table, the number of required multiplications for trilinear interpolation is
much larger than linear interpolation. In order to accelerate detection speed, therefore,
most researches usually discard trilinear interpolation and often apply linear interpolation
instead.
4. PROPOSED ALGORITHM
Since interval of each overlapping block is one cell in each direction, most cells in
detection window have up to four types, depending on the position in overlapping block.
Therefore, we divide a cell into four regions (SC1~SC4) and define four cell types (type #
1~type #4) as shown in Fig. 6. For example, since cell_a in Fig. 6 is overlapped by four
blocks (block_a~block_d), cell_a is type #4 for block_a, type #3 for block_b, type #2 for
block_c, and type #1 for block_d. As shown in the figure, only Gaussian coefficient
among the operands in trilinear interpolation differs for each type (G1~G4 represent
Gaussian coefficients in region SB1~SB4). Therefore, we modified the equation of trilin-
ear interpolation to share the common operations for each cell type as shown in Table 3.
In this table, A~D represent weights for pixel position (Wx×Wy). Table 4 shows the
FAST HOG FEATURE CALCULATION BY REMOVING REDUNDANCY 1725
equations for A~D. Note that G1~G4 and A~D are pre-computed in the proposed algo-
rithm since they are already determined by p and c. The modified equations of trilinear
interpolation are applied in Fig. 7 where the proposed algorithm of HOG feature calcula-
tion is presented.
lation is reduced up to 60.5% (from 272,160 to 107,496). When the proposed algorithm
is applied with c=3, the number of required operations is further reduced up to 68%
(from 604,800 to 193,896).
Fig. 8 shows the examples of HOG feature calculation using the proposed algorithm.
When the current pixel is at (0, 0) in the 0th cell, only type #1 is considered since the 0th
cell belongs to only one block as shown in the figure. Since the pixel is in SC1 of type #1,
the operation of trilinear interpolation is required for two bins as shown in Eq. (7). When
the current pixel is at (4, 0) in the 79th cell, type #2 and type #4 are considered due to the
two overlapping blocks as shown in Fig. 8. In this case, the operation of trilinear inter-
polation is required for six bins since the pixel is in SC2 of type #2 and type #4. As
shown in Eqs. (8) and (9), a total of 18 multiplications are required for two cell types.
FAST HOG FEATURE CALCULATION BY REMOVING REDUNDANCY 1727
5. EXPERIEMTNAL RESULTS
In order to evaluate the actual processing time, we implemented our algorithm using
C/C++ programming language and OpenCV2.0 library [14]. Table 6 shows the compar-
ison results of CPU processing time per detection window. Five test images from Daim-
ler dataset and an Intel Core i7-2600@3.40GHz with 16GB RAM are used in the evalua-
tion. By comparing CPU processing time, we found that our algorithm reduces the pro-
cessing time up to 58.6% for these test images.
6. CONCLUSIONS
Since HOG feature is calculated by collecting histograms for all overlapping blocks
in detection window, most cells in the overlapping blocks are considered redundantly in
trilinear interpolation. Since trilinear interpolation requires the largest computational
efforts in HOG feature calculation, it significantly increases the entire processing time of
pedestrian detection. In this paper, therefore, we proposed a novel algorithm of fast HOG
feature calculation to remove the redundant operations totally in trilinear interpolation.
By identifying key rules and sharing common operations in trilinear interpolation, high
detection rate is still achieved but the number of required multiplications is reduced up to
60.5%. Since trilinear interpolation is applied without any loss of accuracy and the num-
ber of required operations in HOG feature calculation is significantly reduced, the pro-
posed algorithm can be applied to accelerate detection speed in many applications in
which both high detection speed and accuracy are crucial.
REFERENCES