Navneet Dalal’s HOG Descriptors

After fighting a bit with the code, I got it to compile.  The following is a list of the things I did:

  1. There were a lot of additional files in the src tree.  These files are automatically created by Autotools.  I removed *.in files, the file,, aclocal.m4…  In general I removed everything that was auto-generated.
  2. I ran `autoupdate`
  3. Modified the by hand a little.  There were some parenthesis that my Fedora 14 did not like.
  4. The code had some strangeness in the use of strlen, time
  5. The boost validation_error call changed slightly.
You can see the full list of changes at [1].  You can further access the code from [2]

  1. May 17:  I changed a bit the repo on github.  Now you can find the original code under the master branch.  You will find all my changes in the branch called joel:
  2. Jun 10: I updated to fedora 15 and the HOG code broke (no surprise).  I blame boost!!!.  In any case there is a new version of the code at


About joelgranados

I'm fascinated with how technology and science impact our reality and am drawn to leverage them in order to increase the potential of human activity.
This entry was posted in git, PhD. Bookmark the permalink.

11 Responses to Navneet Dalal’s HOG Descriptors

  1. Li says:

    I did the same probably the EXACT same time as you:)
    What I havn’t done is 1-3, just did usual ./configure ./make.
    I know nothing about boost so simply comments out validation_error, replacing with cout:)
    Regarding 4, you just need include , instead of , since they are re-declared within std namespace in c++ library. I don’t know how did he get it compiled without including these headers but must to do with the environments he used by then.

    Without having looked deep into his codes, I’ve got some questions hope you could help with:
    Amongst all the parameters, I understood the default detection window size is 64×128, used both for training and test once got trained model. But in the provided training sets the positive image size is 96×160 and in test sets the size is 70×134. In his phd thesis he mentioned to have 16 pixels margin on all 4 sides improving the performance and with less performance with less margin eg. 8 pixels. So I understand that 96 = 64 + 2*16, 160=128+2*16.

    But here comes my confusion: this 16 pixels margin should be included within 64×128 window or should be added in addition to 64×128 window? According to his thesis, it reads clearly the margin should be included; but the training set he provided indicates the latter is the case. So the next question is: how did he deal with these extra 32 pixels to still manage to generate 3780 feature vectors?

    Thanks in advance,


  2. joelgranados says:

    Hey Li

    Regarding 4, didn’t quite get what I have to include. Can you please repost what you meant. thx. A diff of what you did would be great. You can send it to my mail joel.granados at gmail dot com.

    I looked at Navneets Thesis once more and indeed it states that the margin should be included in the 64×128 window. I didn’t find a comment about the images being larger than the detection window. Though this does not mean that he actually used all of the image.
    You say that the training sets are 96×160 and the test sets are 70×134 (notice that I could not access the data at But I think the fact that the training images are within 16 pixel margin of the default detection window (64×128), is a coincidence. Notice that you can’t find that same relation with the test images.
    Moreover, if you build the code and execute `./app/dump_rhog –help` you will notice the following text: “–topleft top-left X,Y-coordinate of descriptor window(Default window is at image center )”; which suggests that one can pass the coordinate where the detection window “begins” within the image. The default being to center the detection window. I assume that navneet used the default behavior of this command. He just specified that the detection window was 64×128 and the code centered it.

    So, to sum up: I think the margin is included in the detection window.
    Hope it helps.

  3. saurabh says:

    how to run the code on windows xp ( in visual c++)??

    • joelgranados says:

      I ran my code in linux and don’t have lots of experience with visual C++. I guess would would have to make visual C++ work with autotools or abandon visual C++ altogether and do it with autotools directly. In any case, if you are using the updated versions of boost you have to change the code a bit. Take a look at the changes that I have made to the code (You can find them at Notice that I have some very ugly hacks that I used to make it work, so be sure to look for the commits that you need :)
      Hope it helps.

  4. Cathy Li says:

    Hi ,I can’t run this code in linux,I don’t know why. I have install boost,blitz and imlib2,but there still error about the blitz. I don’t know whether it has relationship about the version of the blitz libariry

    • joelgranados says:

      Hey Cathy

      What type of errors are you getting? What linux distribution are you using? It might be that this code is old and you need to use older version of the compiler tools. Are you getting a compilation error or a runtime error?

      • Cathy Li says:

        the ubuntu version is 12.4. the error is like this “/usr/local/include/blitz/vector.h:” they are all blitz libariry

      • joelgranados says:

        Hey Cathy

        Sorry but I did not fully understand your answer. Can you please expand?
        1) Is it a compile or a runtime error. I’m guessing its compiling error.
        2) You gave me just the name of a file, could you paste all the error message?
        3) Maybe you need to install another version of blitz?

  5. Cathy Li says:

    Sorry,I didn’t describe it clearly. It is compiling error.The version of blitz is 0.10,and in its file there are no tinyvec.h,vector.h and many files,so I find the lost files and put them in blitz files.But when I take the action ‘make’,there are many errors,like the following(I only list a few of them ):
    /usr/local/include/blitz/vector.h:162:45: error: ‘class blitz::Range’ has no member named ‘_bz_suggestLength’
    /usr/local/include/blitz/vecexpr.h:270:32: error: ‘TinyVectorIterConst’ was not declared in this scope
    /usr/local/include/blitz/vecwhere.h:37:7: error: provided for ‘template class blitz::_bz_VecWhere’
    /usr/local/include/blitz/ error: template argument 1 is invalid

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s