HOG detectMultiScale Parameters Explained - PyImageSearch
HOG detectMultiScale Parameters Explained - PyImageSearch
HOG detectMultiScale Parameters Explained - PyImageSearch
Get Started Topics Books and Courses Student Success Stories Blog
HOG detectMultiScale
parameters explained
by Adrian Rosebrock on November 16, 2015
PyImageSearch
University
Course information:
35+ total classes • 39+
hours of on demand
video • Last updated:
April 2022
★★★★★
4.84 (128 Ratings) •
13,800+ Students
Enrolled
✓ 35+ courses on
1 Increase the number of false-positive detections (i.e., reporting that a location released every month,
in an image contains a person, but when in reality it does not). ensuring you can keep up
with state-of-the-art
2 Result in missing a detection entirely.
techniques
Jupyter Notebooks in
In the remainder of this blog post I am going to breakdown each of the Google Colab
detectMultiScale parameters to the Histogram of Oriented Gradients descriptor ✓ Run all code examples
and SVM detector. in your web browser —
works on Windows,
I’ll also explain the trade-o between speed and accuracy that we must make if we
macOS, and Linux (no
want our pedestrian detector to run in real-time. This tradeo is especially
dev environment
important if you want to run the pedestrian detector in real-time on resource
con guration required!)
constrained devices such as the Raspberry Pi.
✓ Access to centralized
tutorials on
PyImageSearch
✓ Easy one-click
models, etc.
JUMP RIGHT TO THE DOWNLOADS SECTION
✓ Access on mobile,
JOIN NOW
You can use the built-in Python help method on any OpenCV function to get a full
listing of parameters and returned values.
explained
Before we can explore the detectMultiScale parameters, let’s rst create a simple
Python script (based on our pedestrian detector from last week) that will allow us
Understanding a Real-Time Object
to easily experiment: Detection Network: You Only Look
Once (YOLOv1)
Since most of this script is based on last week’s post, I’ll do a more quick overview
of the code.
Lines 9-20 handle parsing our command line arguments The --image switch is the
path to our input image that we want to detect pedestrians in. The --win-stride is
the step size in the x and y direction of our sliding window. The --padding switch
controls the amount of pixels the ROI is padded with prior to HOG feature vector
extraction and SVM classi cation. To control the scale of the image pyramid
(allowing us to detect people in images at multiple scales), we can use the
--scale argument. And nally, --mean-shift can be speci ed if we want to apply
mean-shift grouping to the detected bounding boxes.
Now that we have our command line arguments parsed, we need to extract their
tuple and boolean values respectively on Lines 24-26. Using the eval function,
especially on command line arguments, is not good practice, but let’s tolerate it for
the sake of this example (and for the ease of allowing us to play with di erent
--win-stride and --padding values).
Lines 29 and 30 initialize the Histogram of Oriented Gradients detector and sets
the Support Vector Machine detector to be the default pedestrian detector
included with OpenCV.
From there, Lines 33 and 34 load our image and resize it to have a maximum width
of 400 pixels — the smaller our image is, the faster it will be to process and detect
people in it.
Lines 37-41 detect pedestrians in our image using the detectMultiScale function
and the parameters we supplied via command line arguments. We’ll start and stop
a timer on Line 37 and 41 allowing us to determine how long it takes a single image
to process for a given set of parameters.
Finally, Lines 44-49 draw the bounding box detections on our image and display
the output to our screen.
To get a default baseline in terms of object detection timing, just execute the
following command:
On my MacBook Pro, the detection process takes a total of 0.09s, implying that I
can process approximately 10 images per second:
Figure 2: On my system, it takes approximately 0.09s to process a single image using the default
parameters.
img (required)
This parameter is pretty obvious — it’s the image that we want to detect objects (in
this case, people) in. This is the only required argument to the detectMultiScale
hitThreshold (optional)
The hitThreshold parameter is optional and is not used by default in the
detectMultiScale function.
When I looked at the OpenCV documentation for this function and the only
description for the parameter is: “Threshold for the distance between features and
SVM classifying plane”.
Given the sparse documentation of the parameter (and the strange behavior of it
when I was playing around with it for pedestrian detection), I believe that this
parameter controls the maximum Euclidean distance between the input HOG
features and the classifying plane of the SVM. If the Euclidean distance exceeds
this threshold, the detection is rejected. However, if the distance is below this
threshold, the detection is accepted.
My personal opinion is that you shouldn’t bother playing around this parameter
unless you are seeing an extremely high rate of false-positive detections in your
image. In that case, it might be worth trying to set this parameter. Otherwise, just let
non-maxima suppression take care of any overlapping bounding boxes, as we did
in the previous lesson.
winStride (optional)
The winStride parameter is a 2-tuple that dictates the “step size” in both the x
and y location of the sliding window.
Both winStride and scale are extremely important parameters that need to be
set properly. These parameter have tremendous implications on not only the
accuracy of your detector, but also the speed in which your detector runs.
At each stop of the sliding window (and for each level of the image pyramid,
discussed in the scale section below), we (1) extract HOG features and (2) pass
these features on to our Linear SVM for classi cation. The process of feature
extraction and classi er decision is an expensive one, so we would prefer to
evaluate as little windows as possible if our intention is to run our Python script in
near real-time.
The smaller winStride is, the more windows need to be evaluated (which can
quickly turn into quite the computational burden):
Figure 4: Decreasing the winStride increases the amount of time it takes it process each each.
Here we can see that decreasing the winStride to (4, 4) has actually increased
our detection time substantially to 0.27s.
Similarly, the larger winStride is the less windows need to be evaluated (allowing
us to dramatically speed up our detector). However, if winStride gets too large,
then we can easily miss out on detections entirely:
Figure 5: Increasing the winStride can reduce our pedestrian detection time (0.09s down to
0.06s, respectively), but as you can see, we miss out on detecting the boy in the background.
I tend to start o using a winStride value of (4, 4) and increase the value until I
obtain a reasonable trade-o between speed and detection accuracy.
padding (optional)
The padding parameter is a tuple which indicates the number of pixels in both the
x and y direction in which the sliding window ROI is “padded” prior to HOG feature
extraction.
Typical values for padding include (8, 8), (16, 16), (24, 24), and (32, 32).
scale (optional)
An image pyramid is a multi-scale representation of an image:
At each layer of the image pyramid the image is downsized and (optionally)
smoothed via a Gaussian lter.
This scale parameter controls the factor in which our image is resized at each
layer of the image pyramid, ultimately in uencing the number of levels in the image
pyramid.
A smaller scale will increase the number of layers in the image pyramid and
increase the amount of time it takes to process your image:
The amount of time it takes to process our image has signi cantly jumped to 0.3s.
We also now have an issue of overlapping bounding boxes. However, that issue
can be easily remedied using non-maxima suppression.
Meanwhile a larger scale will decrease the number of layers in the pyramid as well
as decrease the amount of time it takes to detect objects in an image:
Figure 8: Increasing our scale allows us to process nearly 20 images per second — at the
expense of missing some detections.
Here we can see that we performed pedestrian detection in only 0.02s, implying
that we can process nearly 50 images per second. However, this comes at the
expense of missing some detections, as evidenced by the gure above.
Finally, if you decrease both winStride and scale at the same time, you’ll
dramatically increase the amount of time it takes to perform object detection:
We are able to detect both people in the image — but it’s taken almost half a
second to perform this detection, which is absolutely not suitable for real-time
applications.
Keep in mind that for each layer of the pyramid a sliding window with winStride
steps is moved across the entire layer. While it’s important to evaluate multiple
layers of the image pyramid, allowing us to nd objects in our image at di erent
scales, it also adds a signi cant computational burden since each layer also implies
a series of sliding windows, HOG feature extractions, and decisions by our SVM
must be performed.
Typical values for scale are normally in the range [1.01, 1.5]. If you intend on
running detectMultiScale in real-time, this value should be as large as possible
without signi cantly sacri cing detection accuracy.
Again, along with the winStride , the scale is the most important parameter for
you to tune in terms of detection speed.
nalThreshold (optional)
I honestly can’t even nd finalThreshold inside the OpenCV documentation
(speci cally for the Python bindings) and I have no idea what it does. I assume it
has some relation to the hitThreshold , allowing us to apply a “ nal threshold” to
the potential hits, weeding out potential false-positives, but again, that’s simply
speculation based on the argument name.
If anyone knows what this parameter controls, please leave a comment at the
bottom of this post.
useMeanShiftGrouping (optional)
The useMeanShiftGrouping parameter is a boolean indicating whether or not
mean-shift grouping should be performed to handle potential overlapping
bounding boxes. This value defaults to False and in my opinion, should never be
set to True — use non-maxima suppression instead; you’ll get much better
results.
When using HOG + Linear SVM object detectors you will undoubtably run into the
issue of multiple, overlapping bounding boxes where the detector has red
numerous times in regions surrounding the object we are trying to detect:
Instead, utilize non-maxima suppression (NMS). Not only is NMS faster, but it
obtains much more accurate nal detections:
Figure 12: Instead of applying mean-shift, utilize NMS instead. Your results will be much better.
2 Tune your scale and winStride parameters. These two arguments have
a tremendous impact on your object detector speed. Both scale and
winStride should be as large as possible, again, without sacri cing detector
accuracy.
3 If your detector still is not fast enough…you might want to look into re-
implementing your program in C/C++. Python is great and you can do a lot
with it. But sometimes you need the compiled binary speed of C or C++ — this
is especially true for resource constrained environments.
3:52
Course information:
35+ total classes • 39h 44m video • Last updated: April 2022
★★★★★ 4.84 (128 Ratings) • 13,800+ Students Enrolled
I strongly believe that if you had the right teacher you could master
computer vision and deep learning.
Do you think learning computer vision and deep learning has to be time-
consuming, overwhelming, and complicated? Or has to involve complex
mathematics and equations? Or requires a degree in computer science?
All you need to master computer vision and deep learning is for someone
to explain things to you in simple, intuitive terms. And that’s exactly what I
do. My mission is to change education and how complex Arti cial
Intelligence topics are taught.
If you're serious about learning computer vision, your next stop should be
PyImageSearch University, the most comprehensive computer vision,
deep learning, and OpenCV course online today. Here you’ll learn how to
successfully and con dently apply computer vision to your work, research,
and projects. Join me in computer vision mastery.
✓ Brand new courses released regularly, ensuring you can keep up with
state-of-the-art techniques
Summary
In this lesson we reviewed the parameters to the detectMultiScale function of
the HOG descriptor and SVM detector. Speci cally, we examined these parameter
values in context of pedestrian detection. We also discussed the speed and
accuracy tradeo s you must consider when utilizing HOG detectors.
If your goal is to apply HOG + Linear SVM in (near) real-time applications, you’ll rst
want to start by resizing your image to be as small as possible without sacri cing
detection accuracy: the smaller the image is, the less data there is to process. You
can always keep track of your resizing factor and multiply the returned bounding
boxes by this factor to obtain the bounding box sizes in relation to the original
image size.
Secondly, be sure to play with your scale and winStride parameters. This
values can dramatically a ect the detection accuracy (as well as false-positive rate)
of your detector.
Finally, if you still are not obtaining your desired frames per second (assuming you
are working on a real-time application), you might want to consider re-implementing
your program in C/C++. While Python is very fast (all things considered), there are
times you cannot beat the speed of a binary executable.
Anuj Pahuja
November 16, 2015 at 1:18 pm
Hi Adrian,
Thanks again for the informative blog post. I had to use HOGDescriptor in
OpenCV for one of my projects and it was a pain to use because of no clear
documentation. So this was much needed.
The ‘ nalThreshold’ parameter is mainly used to select the clusters that have
at least ‘ nalThreshold + 1’ rectangles This parameter is passed as an
argument to groupRectangles() or groupRectangles_meanShift()(when
meanShift is enabled) function which rejects the small clusters containing
less than or equal to ‘ nalThreshold’ rectangles, computes the average
rectangle size for the rest of the accepted clusters and adds those to the
output rectangle list.
2.
http://docs.opencv.org/2.4/modules/objdetect/doc/cascade_classi cation.
html#void%20groupRectangles%28vector%3CRect%3E&%20rectList,%20i
nt%20groupThreshold,%20double%20eps%29
Cheers,
Anuj
Adrian Rosebrock
November 16, 2015 at 1:52 pm
Nrupatunga
November 17, 2015 at 1:41 am
Dear Adrian,
Very informative post on HOG detectmultiscale parameters. In fact I
appreciate this post very much. I couldn’t nd such detailed post on the net
with such examples.
I am still working on the part of improving the detection rate. I have many
images where I still couldn’t detect the person in the image.
“Meanwhile a larger scale will decrease the number of layers in the pyramid
as well as decrease the amount of time it takes to detect objects in an
image:”
Adrian Rosebrock
November 17, 2015 at 6:12 am
Hey Nrupatunga, thanks for the comment and all the added details, I
appreciate it. If you ended up using mean shift grouping, I would
suggest applying non-maxima suppression instead, you’ll likely end
up getting even better results.
Another neat little trick you can do to create more training data is
“mirror” your training images. I’m not sure about your particular case,
but for pedestrian detection, you the horizontal mirror of an image is
still a person, thus you can use that as additional training data as well.
ngapweitham
November 18, 2015 at 11:21 pm
Thanks for the brilliant explanations. It is much easier to understand than the
document of opencv.
Adrian Rosebrock
November 19, 2015 at 6:19 am
Sebastian
November 19, 2015 at 5:26 pm
I’m trying to do HOG detection but in real time from video camera. I’m
working in a raspberry pi 2 board and the code works but the frame rate is
too slow.
Thanks
Adrian Rosebrock
November 20, 2015 at 6:28 am
Cam
May 5, 2016 at 2:29 am
Hi Sebastian,
could you help me please with the people detection in real time
please, I’ve been trying but it doesn’t work, can you give me some
ideas to the code, or send to me that part of the code, i really
apreciate that.
Thank you.
Adrian Rosebrock
May 5, 2016 at 6:43 am
Rish
February 7, 2017 at 5:38 am
Hey Adrian – the link leads to the same post. I’m really
trying hard to do real time detection. I’m hoping to
achieve 20fps (or 25fps if I can get really lucky). I’ve
implemented a tracking algorithm that helps quite a bit.
However, any tips to speed up the detectMultiScale
function as such would be really helpful.
Adrian Rosebrock
February 7, 2017 at 8:59 am
CodeNinja
December 30, 2017 at 10:36 am
Vivek
December 3, 2015 at 11:35 pm
Adrian,
if nLevel=16
scale = 1.05
Adrian Rosebrock
December 4, 2015 at 6:26 am
Vivek
December 4, 2015 at 7:57 am
Hi Adrian,
if you look at hog.cpp le, it will show how the nlevel is used.
our test in python shows that it does work the way it is de ned..
if you set nlevel too low say 4 and scale 1.01, you will see no small gures
will be detected.
Experiment by changing the nlevel and scale to it how it work.
Here is a code snippet from hog.cpp. I did not see any default value.. so the
loop will continue till the size of image becomes smaller than the window.
Adrian Rosebrock
December 4, 2015 at 8:25 am
Thanks for the clari cation! I’ll be sure to play with this parameter as
well. It seems like a nice way to compliment the scale.
Bob Estes
September 30, 2017 at 6:00 pm
Ulrich
March 14, 2016 at 12:25 pm
Hello Adrian,
Tanks a lot for this blog. I read it carefully and tried out your code with own
pictures and videos. It works great!
Do you have also a python HoG implementation which is rotation invariant? I
try to detect pedestriants which are not upright (due to moving/ tilted
camera).
Adrian Rosebrock
March 14, 2016 at 3:16 pm
Maya2
October 3, 2017 at 12:09 pm
Ulrich
March 15, 2016 at 9:05 am
Hello Adrian,
Thanks for your answer, this is a good idea and helps for many cases. But in
some special cases I do not know how the angle theta is, due to sliding
camera motion.
I guess an other posibility could be to train the SVM with tilted exaple
images. But therefor I think a quadratic window would be better than the
normaly used upright 128:64 window.
Do you have a blog how to expand a SVM or how to create a own SVM?
Is this possibly described in one of your books?
It would be great when you can give me some answers and hints regarding
my problem.
Adrian Rosebrock
March 15, 2016 at 4:31 pm
Anthony
April 20, 2016 at 5:07 am
Hi Adrian, I really need to thank you for all those amazing posts, it really is a
great job!
I’m doing real-time person detection with this Rpi and it’s working well. My
problem is that I can’t nd a way to count the number of person when
performing hog.detectMultiScale. The return values of this function gives us
the location and weights of detected people but not the exact number of
these people.
Adrian Rosebrock
April 20, 2016 at 6:01 pm
Anthony
April 22, 2016 at 10:11 am
Arpit Solanki
May 25, 2016 at 5:54 am
thank you for this great post. with your approach i observed that it has a lot
of false positives. one example of a false positive is that i tested it on a photo
with a man and dog (front view) and it detected both of them as person. can
you please help me solving this kind of issue?
Adrian Rosebrock
May 25, 2016 at 3:19 pm
Imran
September 19, 2016 at 3:45 am
Adrian Rosebrock
September 19, 2016 at 1:01 pm
Paulo
September 27, 2016 at 5:34 pm
Hi Adrian,
Adrian Rosebrock
September 28, 2016 at 10:41 am
Paulo
September 28, 2016 at 3:17 pm
Adrian Rosebrock
September 30, 2016 at 6:49 am
Paulo
October 4, 2016 at 11:01 pm
Thanks Adrian!
My camera is xed.
Thanks…
Adrian Rosebrock
October 6, 2016 at 6:59 am
Wanderson
September 27, 2016 at 11:53 pm
Dear Adrian,
I would like to make a newbie question. Whenever I see talk about HOG
detector, the classi er SVM is involved. The descriptor HOG should always
be linked to a classi er? Or I can detect foreground objects with blobs
analysis.
Thanks,
Wanderson
Adrian Rosebrock
September 28, 2016 at 10:38 am
You typically see SVMs, in particular Linear SVMs, because they are
very fast. You could certainly use a di erent classi er if you wished.
James Brown
October 24, 2016 at 2:29 am
Hello, Adrian.
Your post is really amazing.
I have a question about HOG.
Is it possible to extract the human feature by removing background on
selected rectangular area?
I am researching the human body recognition project and I really hope you
guide me.
Thank you very much.
You are super!
Adrian Rosebrock
October 24, 2016 at 8:26 am
You would actually train a custom object detector using the HOG +
Linear SVM method. OpenCV actually ships with a pre-trained
human detector that you can try out.
John Beale
October 24, 2016 at 2:34 pm
Thank you for this great blog. In your examples showing the foreground
woman and background child, the green bounding box cuts through the
woman’s forehead, so I’m assuming the HOG detector found her legs and
torso, but missed her head(?) In other cases, the box is well centered and
completely contains all the pixels showing the human gure, but includes
considerable extra background also. Is this algorithm intrinsically that “fuzzy”
about the precise outline, or can it be tuned to more closely match the
actual boundaries of the person? Thanks again!
Adrian Rosebrock
November 1, 2016 at 9:47 am
The algorithm itself isn’t “fuzzy”, it’s simply the step size of the sliding
window and the size of the image pyramid. I would suggest reading
this post on the HOG + Linear SVM detector to better understand
how the detector works.
Yonatan
January 3, 2017 at 6:23 am
Saeed
February 16, 2017 at 3:05 pm
Hi Adrian,
I read “perform pedestrian detection” and current posts and there is one
point that I cannot understand.
Your sliding window’s size is xed to be 128×64 and all the features are
obtained from this window in any scale. However, when the targets are
detected the boxes have di erent sizes. I believe all the boxes should be
128×64 but they are not. Could you please describe what causes this?
Adrian Rosebrock
February 20, 2017 at 8:05 am
You can have di erent sized bounding boxes in scale space due to
image pyramids. Image pyramids allow you to detect object at
varying scales of the image, but as you’ll notice each bounding box
as the same aspect ratio.
leo
February 20, 2017 at 8:39 pm
Hi, can explain me please, [ -i ] and [ –images ], I’m new in this area
please help me
Adrian Rosebrock
February 22, 2017 at 1:42 pm
Hi Leo — I would highly suggest that you spend some time reading
up on command line arguments and how they work.
Ashutosh
February 24, 2017 at 12:24 am
Dear Adrian,
http://docs.opencv.org/2.4/modules/gpu/doc/object_detection.html#gpu-
hogdescriptor-detectmultiscale
Thanks in advance.
Adrian Rosebrock
February 24, 2017 at 11:25 am
Rob
March 19, 2017 at 12:34 pm
Hi Adrian,
if I want to use HOG + SVM as Tra c Sign detector, how should I do it?
Should I train a detector for each sign, or should i build a general detector
for all signs and then to distinguish the signs with another method? I want to
do it in realtime, do more detectors increase the calculation e ort
proportionally?
Thanks in advance.
Adrian Rosebrock
March 21, 2017 at 7:31 am
You would want to train a detector for each sign. More detectors will
increase the amount of time it takes to classify a given image, but the
bene t is that your detections will be more accurate. Please see the
PyImageSearch Gurus course for an example of building a tra c
sign detector.
Rob
March 28, 2017 at 8:02 am
Adrian Rosebrock
March 28, 2017 at 12:49 pm
Rob
March 29, 2017 at 12:04 pm
Adrian Rosebrock
March 31, 2017 at 1:58 pm
Nashwan
March 28, 2017 at 2:01 pm
Hi Adrian;
when i run this code tell me this error
Adrian Rosebrock
March 31, 2017 at 2:08 pm
mukesh
April 4, 2017 at 4:47 pm
hi Adrian,
i tried
(rects, weights) = hog.detectMultiScale(image, winStride=winStride,
padding=padding, scale=args[“scale”], useMeanshiftGrouping=meanShift)
Adrian Rosebrock
April 5, 2017 at 11:54 am
If you did not obtain any bounding boxes then the parameters to
.detectMultiScale need some tuning. Your image might also
contain poses that are not suitable for the pre-trained pedestrian
detector provided with OpenCV.
ramdan
May 8, 2017 at 4:13 am
Hi Adrian
Adrian Rosebrock
May 8, 2017 at 12:17 pm
I detail the steps to train a HOG + Linear SVM detector here. I then
demonstrate how to implement the HOG + Linear SVM detector
inside the PyImageSearch Gurus course.
Sunil
June 12, 2017 at 7:50 am
Nice e ort put into the article Adrian. Is there any relation between minimum
and maximum size possible to detect with the parameters of the hog/svm
detector of open cv ?
Adrian Rosebrock
June 13, 2017 at 11:01 am
I’m not sure what you mean by minimum/maximum size. Are you
referring to the object you’re trying to detect? The HOG window?
Keep in mind that we use image pyramids to nd objects at varying
scales in an image. You might need to upscale your image before
applying the image pyramid + sliding window to detect very small
objects in the background.
Sunil
June 14, 2017 at 3:03 am
Adrian Rosebrock
June 16, 2017 at 11:33 am
alberto
June 12, 2017 at 11:59 am
Hello,
Thanks,
Alberto
Claude
June 25, 2017 at 2:58 pm
Hi Alberto,
hog = cv2.HOGDescriptor(
IMAGE_SIZE, BLOCK_SIZE, BLOCK_STRIDE, CELL_SIZE, NR_BINS)
svm = cv2.ml.SVM_load(“trained_svm2.yml”)
hog.setSVMDetector(svm.getSupportVectors())
Mauro
July 2, 2017 at 11:28 am
Best Regards
Mauro
Adrian Rosebrock
July 5, 2017 at 6:27 am
I would suggest looping over the weights and rects together and
discarding any weight scores that are too low (you’ll likely have to
de ne what “too small” is yourself).
ziyi
October 18, 2017 at 1:32 am
Hi, i am running the hog descriptor on the exact same image as in your
example, with default params and default people descriptor,
Adrian Rosebrock
October 19, 2017 at 4:55 pm
It sounds like you may have compiled and installed OpenCV without
optimization libraries such as BLAS. How did you install OpenCV on
your system? Did you follow one of my tutorials here on
PyImageSearch?
Irum Zahra
December 11, 2017 at 1:30 pm
Hi Adrian !! This tutorial is so helpful. You are doing a wonderful job. But I
have a question. Can you guide me how can I increase the distance from
which it can detect pedestrians? What perimeters should I change? I want to
detect pedestrians from 30 feet.
Tjado
December 12, 2017 at 10:44 am
Why?
Roberto O
February 13, 2018 at 3:03 am
Hi Adrian, rst of all, thanks for sharing your expertise and knowledge with
everyone. In my own experience, learning about computer vision and
opencv can be quite a challenge and very frustrating when you can’t nd
useful information about some topic. Once again: Thanks a lot!
Adrian Rosebrock
February 13, 2018 at 9:30 am
Hey Roberto — thanks for the comment, I’m glad you’re nding the
PyImageSearch blog helpful!
Are you using the OpenCV HOG pedestrian detector covered in this
post? Or are you using your own model?
Keep in mind that the window stride and scale are important not only
for speed, but for obtaining the actual detections as well. You may
need to sacri ce speed for accuracy.
GabriellaK
February 26, 2018 at 4:12 pm
Adrian Rosebrock
February 27, 2018 at 11:36 am
Jason
March 12, 2018 at 10:20 pm
Hi all,
I’ve learned a lot from these posts and I’ve spent some time trying to write
my own implementations of SVM and HOG to gain a better understanding of
the concepts. Some parts failed, some works but slow, and some actually
ends up being better than the reference I’m using. So I’d like to share with
you the “better” part: a vectorized implementation of HOG features
extraction using only numpy+scipy.
Adrian Rosebrock
March 14, 2018 at 12:52 pm
Hey Adrian,
Best Regards,
David
Adrian Rosebrock
May 9, 2018 at 9:29 am
Congrats on training your own model David, that’s great. However, I’m
not sure why your detector would be falsely reporting a detection in
the middle of the image each and every time. That may be an issue
with your training data but unfortunately I’m not sure what the root
cause is.
Alex
May 20, 2018 at 5:09 pm
Hi Adrian,
I`ve tried it with mp4 video, but it doesn’t works, what should I change to
detect people on video?? maybe I should make something with
imutils.resize()??
Adrian Rosebrock
May 22, 2018 at 6:07 am
Hey Alex — could you be a bit more speci c when you say “it doesn’t
work”? That speci cally does not work? Are people not detected?
Does the code throw an error?
Alex
May 22, 2018 at 4:24 pm
Adrian Rosebrock
May 23, 2018 at 7:14 am
kritesh
August 10, 2018 at 9:37 am
here, the code working well when the person is vertical ,while person
sleeping or horizontal this doesn’t work shows zero detection……..
what is perfect algo. satis es both cases
Adrian Rosebrock
August 15, 2018 at 9:24 am
Vikran
August 13, 2018 at 8:22 am
Hi Adrian,
I am trying to detect the object using tensor ow API by training the models
and once the object is detected, i am trying to blur that particular detected
part. Can we able to pass the detected object as input to
cv2.CascadeClassi er?.
Adrian Rosebrock
August 15, 2018 at 8:52 am
Hey Vikran — I’m a bit confused by your comment. If you’re using the
TensorFlow Object Detection API to detect an object why would you
want to further classify it? You already have the detected object
bounding box and labels.
roja
December 12, 2018 at 2:23 am
hi Adrian,
I have some code that is working well ,if i resize the image …..if i dont resize
the image it is not working properly…..is it necessary to resize the image
before giving it to HOG ?
Adrian Rosebrock
December 13, 2018 at 9:07 am
Yes, you must resize the image prior to passing it into HOG. HOG
requires a xed image/ROI dimensions, otherwise your output feature
vector dimensions could be di erent (depending on your
implementation).
silver
March 22, 2019 at 4:20 pm
Is there any way to improve accuracy when the size of person is very small
in the image? It is working very well with a clear and reasonable size of a
person, however, my image has low quality and the size of person is very
tiny.
Levi
June 20, 2019 at 7:48 am
is there a way to combine hog with the last layers of YOLO network to
perform object detection
Adrian Rosebrock
June 26, 2019 at 1:55 pm
No, and there’s not really a reason to do that either. Use one or the
other.
Comment section
Hey, Adrian Rosebrock here, author and creator of PyImageSearch. While I love
hearing from readers, a couple years ago I made the tough decision to no longer
o er 1:1 help over blog post comments.
At the time I was receiving 200+ emails per day and another 100+ blog post
comments. I simply did not have the time to moderate and respond to them all,
and the sheer volume of requests was taking a toll on me.
Instead, my goal is to do the most good for the computer vision, deep learning,
and OpenCV community at large by focusing my time on authoring high-quality
blog posts, tutorials, and books/courses.
If you need help learning computer vision and deep learning, I suggest you
refer to my full catalog of books and courses — they have helped tens of
thousands of developers, students, and researchers just like yourself learn
Computer Vision, Deep Learning, and OpenCV.
Similar articles
RASPBERRY PI TUTORIALS
Building a Pokedex in Python:
OpenVINO, OpenCV, and OpenCV and Perspective
Movidius NCS on the Warping (Step 5 of 6)
Raspberry Pi