Git Product home page Git Product logo

ihog's Introduction

iHOG: Inverting Histograms of Oriented Gradients

This software package contains tools to invert and visualize HOG features. It implements the Paired Dictionary Learning algorithm described in our paper "HOGgles: Visualizing Object Detection Features" [1].

Installation

Before you can use this tool, you must compile iHOG. Execute the 'compile' script in MATLAB to compile the HOG feature extraction code and sparse coding SPAMS toolbox:

$ cd /path/to/ihog
$ matlab
>> compile

If you run into trouble compiling the SPAMS code, you might try opening the file /path/to/ihog/spams/compile.m and adjusting the settings for your computer.

Remember to also adjust your path so MATLAB can find iHOG:

>> addpath(genpath('/path/to/ihog'))

If you want to use iHOG in your own project, you can simply drop the iHOG directory into the root of your project.

In order to use iHOG, you must have a learned paired dictionary. By default, iHOG will attempt to download a pretrained one from MIT for you on the first execution. If you wish to download it manually, simply do:

$ wget http://people.csail.mit.edu/vondrick/pd.mat

Inverting HOG

To invert a HOG point, use the 'invertHOG()' function:

>> feat = features(im, 8);
>> ihog = invertHOG(feat);
>> imagesc(ihog); axis image;

Computing the inverse should take no longer than a second for a typical sized image on a modern computer. (It may slower the first time you invoke it as it caches the paired dictionary from disk.)

Learning

We provide a prelearned dictionary in 'pd.mat', but you can learn your own if you wish. Simply call the 'learnpairdict()' function and pass it a directory of images:

>> pd = learnpairdict('/path/to/images/', 1000000, 1000, 5, 5);

The above learns a 5x5 HOG patch paired dictionary with 1000 elements and a training set size of one million window patches. Depending on the size of the problem, it may take minutes or hours to complete.

Bundled Libraries

The iHOG package contains source code from the SPAMS sparse coding toolbox (http://spams-devel.gforge.inria.fr/). We have modified their code to better support 64 bit machines.

In addition, we have included a select few files from the discriminatively trained deformable parts model (http://people.cs.uchicago.edu/~rbg/latent/). We use their HOG computation code and glyph visualization code.

Questions and Comments

If you have any feedback, please write to Carl Vondrick at [email protected].

References

If you use our software, please cite our conference paper:

[1] Carl Vondrick, Aditya Khosla, Tomasz Malisiewicz, Antonio Torralba. "HOGgles: Visualizing Object Detection Features" International Conference on Computer Vision (ICCV), Sydney, Australia, December 2013.

ihog's People

Contributors

adikhosla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ihog's Issues

some

when i run the demo there is a problem like this ,how can i solve this problem

Undefined function 'features' for input arguments of type 'double'.

Error in demo (line 2)
feat = features(im, 8);

compilation fails: cannot convert ‘const mwSize*’

gcc 8.3.0
GNU Octave, version 5.1.0

I wonder if there is a chance of it working in Octave? Compilation fails for me on something seemingly unrelated:

octave:1> compile
compiling features.cc
internal/features.cc: In function ‘mxArray* process(const mxArray*, const mxArray*, int, double)’:
internal/features.cc:47:44: error: cannot convert ‘const mwSize*’ {aka ‘const long int*’} to ‘const int*’ in initialization
   const int *dims = mxGetDimensions(mximage);
                                            ^
internal/features.cc:67:45: error: cannot convert ‘int*’ to ‘const mwSize*’ {aka ‘const long int*’}
   mxArray *mxfeat = mxCreateNumericArray(3, out, mxDOUBLE_CLASS, mxREAL);
                                             ^~~
In file included from /nix/store/p8nq32wkmicdmak782g5i90s7rvrkgc4-octave-5.1.0/include/octave-5.1.0/octave/mex.h:65,
                 from internal/features.cc:2:
/nix/store/p8nq32wkmicdmak782g5i90s7rvrkgc4-octave-5.1.0/include/octave-5.1.0/octave/mexproto.h:146:68: note:   initializing argument 2 of ‘mxArray* mxCreateNumericArray(mwSize, const mwSize*, mxClassID, mxComplexity)’
                                                      const mwSize *dims,
                                                      ~~~~~~~~~~~~~~^~~~
warning: mkoctfile: building exited with failure status
compiling spams
source: error sourcing file '/home/mix/repos/ihog/spams/compile.m'
error: called from
    compile at line 11 column 1
    run at line 71 column 7
    compile at line 11 column 1

error in /spams/compile.m

Thanks for your great work!
When i run the compile.m, mex completed successfully, but failed in compiling spams.
Errors :
Error using *
BLAS loading error:
dlopen:cannot load any more object witjh static TLS

Can you tell your versions of necessary tool? Such as matlab, gcc and so on.
My system is Linux.

Looking forward to getting your reply.

Cannot find "gomp" on Windows 10

I am using Windows 10 and MATLAB 2017a, the compiler message is:

compile
compiling features.cc
Building with 'Microsoft Visual C++ 2015 Professional'.
MEX completed successfully.
compiling spams
compilation of: -I./linalg/ -I./decomp/ -I./dictLearn/ dictLearn/mex/mexTrainDL.cpp
error: failed to compile: -I./linalg/ -I./decomp/ -I./dictLearn/ dictLearn/mex/mexTrainDL.cpp -outdir ./build/ -DUSE_BLAS_LIB -DNEW_MATLAB -largeArrayDims -DNDEBUG -DWINDOWS -DREMOVE_ PATH=%PATH%;C:\cygwin\bin\ COMPILER=g++-4 COMPFLAGS="-c -fexceptions" NAME_OBJECT=-o -lmwblas -lmwlapack -L"C:\cygwin\lib\gcc\i686-pc-cygwin\4.5.3" -L/ -lgomp OPTIMFLAGS="-O3 -mtune=core2 -fomit-frame-pointer -funsafe-loop-optimizations -fopenmp"
error: reason: MEX cannot find library 'gomp' specified with the -l option.
MEX looks for a file with one of the names:
gomp.lib
libgomp.lib
Please specify the path to this library with the -L option.

error: you might consider adjusting spams/compile.m settings
error: in particular, adjust path_to_compiler_libraries
error: we will continue to attempt to compile the rest of the system
error: since it might be ok that this failed to compile, but if the
error: full system does not work, please fix this error
compilation of: -I./linalg/ -I./decomp/ decomp/mex/mexLasso.cpp
error: failed to compile: -I./linalg/ -I./decomp/ decomp/mex/mexLasso.cpp -outdir ./build/ -DUSE_BLAS_LIB -DNEW_MATLAB -largeArrayDims -DNDEBUG -DWINDOWS -DREMOVE_ PATH=%PATH%;C:\cygwin\bin\ COMPILER=g++-4 COMPFLAGS="-c -fexceptions" NAME_OBJECT=-o -lmwblas -lmwlapack -L"C:\cygwin\lib\gcc\i686-pc-cygwin\4.5.3" -L/ -lgomp OPTIMFLAGS="-O3 -mtune=core2 -fomit-frame-pointer -funsafe-loop-optimizations -fopenmp"
error: reason: MEX cannot find library 'gomp' specified with the -l option.
MEX looks for a file with one of the names:
gomp.lib
libgomp.lib
Please specify the path to this library with the -L option.

error: you might consider adjusting spams/compile.m settings
error: in particular, adjust path_to_compiler_libraries
error: we will continue to attempt to compile the rest of the system
error: since it might be ok that this failed to compile, but if the
error: full system does not work, please fix this error

I don't know what is happening. The message says "MEX completed successfully", but then it reports tons of errors. So what is "spam"? What is "gomp"? Are they needed on Windows 10 to use ihog? Can I ignore them? Do I have to install cygwin to compile on Windows+Matlab?

I have problem with compiling.

Hi! I am trying to experiment this algorithm.
However, I have a problem with compile file
I think second option should be change -o into -O, but still do not contain 'features.m'.
Does it same file with features.cc??

compile
compiling features.cc
Usage:
MEX [option1 ... optionN] sourcefile1 [... sourcefileN]
[objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN]

Use the -help option for more information, or consult the MATLAB API Guide. 

C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Unrecognized switch: -o.

エラー mex (line 206)
正常に終了できません。

エラー compile (line 4)
mex -o internal/features.cc -o internal/features

something wrong with 'complie.m'

I have read the read.me then I tried to run 'complie.m' but failed.
The console showed information that:

Error: Could not find the compiler "g++-4" on the DOS path.
Use mex -setup to configure your environment properly.

I used matlab2013 and vs2010 for the complier. All of them are 32-bit.I can complie other files successfully.
So can you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.