├── bin └── .gitignore ├── cachedir ├── VOC2007 │ └── .gitignore ├── dp-dpm │ └── .gitignore └── pyra_cache │ └── .gitignore ├── data ├── caffe_nets │ └── .gitignore ├── imreadx.m ├── merge_pos_neg.m └── scripts │ └── fetch_imagenet_model.sh ├── .gitignore ├── 000034.jpg ├── 000061.jpg ├── 000084.jpg ├── vis ├── greenmap.mat ├── foldHOG.m ├── HOGpicture.m └── visualizeHOG.m ├── docs ├── release4-notes.pdf └── autorights │ ├── autorights-notice.txt │ ├── autorights-notice-one.txt │ ├── autorights-notice-f.txt │ └── autorights-notice-fr.txt ├── external ├── minConf │ ├── minFunc │ │ ├── lbfgsHvFunc2.m │ │ ├── isLegal.m │ │ ├── lbfgsUpdate.m │ │ ├── autoGrad.m │ │ ├── lbfgs.m │ │ └── dampedUpdate.m │ ├── minConf │ │ ├── boundProject.m │ │ ├── projectSimplex.m │ │ └── linearProject.m │ └── myProcessOptions.m ├── boost │ ├── preprocessor.hpp │ └── preprocessor │ │ ├── facilities │ │ ├── empty.hpp │ │ ├── identity.hpp │ │ ├── expand.hpp │ │ ├── is_1.hpp │ │ ├── is_empty_or_1.hpp │ │ └── apply.hpp │ │ ├── punctuation │ │ ├── comma.hpp │ │ ├── paren.hpp │ │ └── comma_if.hpp │ │ ├── detail │ │ ├── null.hpp │ │ ├── is_unary.hpp │ │ ├── is_binary.hpp │ │ ├── is_nullary.hpp │ │ └── split.hpp │ │ ├── if.hpp │ │ ├── dec.hpp │ │ ├── for.hpp │ │ ├── inc.hpp │ │ ├── max.hpp │ │ ├── min.hpp │ │ ├── slot.hpp │ │ ├── enum.hpp │ │ ├── while.hpp │ │ ├── comma.hpp │ │ ├── empty.hpp │ │ ├── limits.hpp │ │ ├── expand.hpp │ │ ├── expr_if.hpp │ │ ├── iterate.hpp │ │ ├── repeat.hpp │ │ ├── assert_msg.hpp │ │ ├── comma_if.hpp │ │ ├── identity.hpp │ │ ├── repeat_2nd.hpp │ │ ├── repeat_3rd.hpp │ │ ├── tuple.hpp │ │ ├── enum_params.hpp │ │ ├── enum_shifted.hpp │ │ ├── repeat_from_to.hpp │ │ ├── debug.hpp │ │ ├── repeat_from_to_2nd.hpp │ │ ├── repeat_from_to_3rd.hpp │ │ ├── enum_shifted_params.hpp │ │ ├── selection.hpp │ │ ├── seq │ │ ├── push_back.hpp │ │ ├── push_front.hpp │ │ ├── to_tuple.hpp │ │ ├── pop_front.hpp │ │ ├── to_array.hpp │ │ ├── subseq.hpp │ │ ├── insert.hpp │ │ ├── pop_back.hpp │ │ ├── remove.hpp │ │ ├── replace.hpp │ │ ├── rest_n.hpp │ │ └── first_n.hpp │ │ ├── comparison.hpp │ │ ├── enum_params_with_defaults.hpp │ │ ├── enum_params_with_a_default.hpp │ │ ├── iteration │ │ ├── self.hpp │ │ ├── detail │ │ │ └── self.hpp │ │ └── local.hpp │ │ ├── repetition │ │ ├── enum_params_with_defaults.hpp │ │ ├── enum_params_with_a_default.hpp │ │ ├── deduce_r.hpp │ │ ├── deduce_z.hpp │ │ └── enum_params.hpp │ │ ├── arithmetic.hpp │ │ ├── iteration.hpp │ │ ├── config │ │ └── limits.hpp │ │ ├── logical │ │ ├── not.hpp │ │ ├── or.hpp │ │ ├── and.hpp │ │ ├── nor.hpp │ │ ├── xor.hpp │ │ ├── compl.hpp │ │ ├── bitor.hpp │ │ ├── bitand.hpp │ │ ├── bitnor.hpp │ │ └── bitxor.hpp │ │ ├── punctuation.hpp │ │ ├── control │ │ ├── deduce_d.hpp │ │ ├── if.hpp │ │ ├── expr_if.hpp │ │ ├── expr_iif.hpp │ │ └── iif.hpp │ │ ├── facilities.hpp │ │ ├── control.hpp │ │ ├── cat.hpp │ │ ├── logical.hpp │ │ ├── slot │ │ ├── counter.hpp │ │ └── slot.hpp │ │ ├── comparison │ │ ├── equal.hpp │ │ ├── greater.hpp │ │ ├── greater_equal.hpp │ │ └── less_equal.hpp │ │ ├── stringize.hpp │ │ ├── array │ │ ├── data.hpp │ │ ├── size.hpp │ │ ├── elem.hpp │ │ ├── reverse.hpp │ │ ├── push_back.hpp │ │ └── push_front.hpp │ │ ├── wstringize.hpp │ │ ├── array.hpp │ │ ├── list │ │ ├── to_tuple.hpp │ │ ├── fold_right.hpp │ │ ├── at.hpp │ │ ├── append.hpp │ │ ├── reverse.hpp │ │ ├── enum.hpp │ │ └── cat.hpp │ │ ├── list.hpp │ │ ├── selection │ │ ├── max.hpp │ │ └── min.hpp │ │ ├── arithmetic │ │ ├── div.hpp │ │ └── mod.hpp │ │ ├── debug │ │ ├── assert.hpp │ │ └── error.hpp │ │ └── library.hpp └── README ├── Makefile ├── .gitmodules ├── get_feat_cache_dir.m ├── utils ├── bootstrap │ ├── VOChash_lookup_bootstrap.m │ ├── VOCap_bootstrap.m │ └── VOChash_init_bootstrap.m ├── xVOChash_lookup.m ├── xVOCap.m ├── xVOChash_init.m ├── procid.m ├── tic_toc_print.m ├── rndtest.m ├── auc_ap_2007.m ├── model_attach_weights.m ├── boxoverlap.m ├── five2four.m └── report_cmp.m ├── model ├── model_cnn_init.m ├── model_add_nonterminal.m ├── model_add_symbol.m ├── model_types.m ├── block_types.m ├── getopts.m ├── model_get_block.m └── model_sort.m ├── features ├── cnn_feat_pyramid.m ├── color.m ├── getpadding.m ├── flipfeat.m ├── loc_feat.m └── precompute_feat_pyramids.m ├── train ├── no_mirror_sharing │ └── README.txt ├── seed_rand.m ├── split.m └── subarray.m ├── sample_voc_config_override.m ├── fv_cache ├── fv_obj_func.m └── obj_func.h ├── gdetect ├── loss_func.m ├── imgdetect.m ├── write_zero_fv.m └── post_pad.cc ├── LICENSE ├── COPYING.DPMv5 ├── startup.m ├── test ├── nms_iou.m └── clipboxes.m └── process.m /bin/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cachedir/VOC2007/.gitignore: -------------------------------------------------------------------------------- 1 | VOC* 2 | -------------------------------------------------------------------------------- /cachedir/dp-dpm/.gitignore: -------------------------------------------------------------------------------- 1 | 20* 2 | -------------------------------------------------------------------------------- /cachedir/pyra_cache/.gitignore: -------------------------------------------------------------------------------- 1 | VOC* 2 | -------------------------------------------------------------------------------- /data/caffe_nets/.gitignore: -------------------------------------------------------------------------------- 1 | *.caffemodel 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.mex* 2 | learn 3 | svm_mex601 4 | .nfs* 5 | -------------------------------------------------------------------------------- /000034.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbgirshick/dp-dpm/HEAD/000034.jpg -------------------------------------------------------------------------------- /000061.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbgirshick/dp-dpm/HEAD/000061.jpg -------------------------------------------------------------------------------- /000084.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbgirshick/dp-dpm/HEAD/000084.jpg -------------------------------------------------------------------------------- /vis/greenmap.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbgirshick/dp-dpm/HEAD/vis/greenmap.mat -------------------------------------------------------------------------------- /docs/release4-notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbgirshick/dp-dpm/HEAD/docs/release4-notes.pdf -------------------------------------------------------------------------------- /external/minConf/minFunc/lbfgsHvFunc2.m: -------------------------------------------------------------------------------- 1 | function Hv = lbfgsHvFunc2(v,Hdiag,N,M) 2 | Hv = v/Hdiag - N*(M\(N'*v)); -------------------------------------------------------------------------------- /external/minConf/minFunc/isLegal.m: -------------------------------------------------------------------------------- 1 | function [legal] = isLegal(v) 2 | legal = sum(any(imag(v(:))))==0 & sum(isnan(v(:)))==0 & sum(isinf(v(:)))==0; -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | matlab -nodesktop -nodisplay -nojvm -r "disp('building...'); compile; disp('done!'); quit;" 3 | 4 | clean: 5 | rm -rf bin/*.mex* 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "DeepPyramid"] 2 | path = DeepPyramid 3 | url = https://github.com/rbgirshick/DeepPyramid.git 4 | [submodule "caffe"] 5 | path = caffe 6 | url = https://github.com/BVLC/caffe.git 7 | -------------------------------------------------------------------------------- /get_feat_cache_dir.m: -------------------------------------------------------------------------------- 1 | function FEAT_CACHE_DIR = get_feat_cache_dir() 2 | 3 | FEAT_CACHE_DIR = 'cachedir/pyra_cache/VOC2007'; 4 | if exist(FEAT_CACHE_DIR) == 0 5 | unix(['mkdir -p ' FEAT_CACHE_DIR]); 6 | end 7 | -------------------------------------------------------------------------------- /utils/bootstrap/VOChash_lookup_bootstrap.m: -------------------------------------------------------------------------------- 1 | function ind = VOChash_lookup(hash,s) 2 | 3 | hsize=numel(hash.key); 4 | h=mod(str2double(s([3:4 6:11 13:end])),hsize)+1; 5 | ind=hash.val{h}(strmatch(s,hash.key{h},'exact')); 6 | -------------------------------------------------------------------------------- /utils/xVOChash_lookup.m: -------------------------------------------------------------------------------- 1 | function ind = xVOChash_lookup(hash,s) 2 | % From the PASCAL VOC 2011 devkit 3 | 4 | hsize=numel(hash.key); 5 | h=mod(str2double(s([4 6:end])),hsize)+1; 6 | ind=hash.val{h}(strmatch(s,hash.key{h},'exact')); 7 | -------------------------------------------------------------------------------- /external/minConf/minConf/boundProject.m: -------------------------------------------------------------------------------- 1 | function [x] = boundProject(x,LB,UB) 2 | % function [x] = boundProject(x,LB,UB) 3 | % Computes projection of x onto constraints LB <= x <= UB 4 | 5 | x(x < LB) = LB(x < LB); 6 | if nargin > 2 7 | x(x > UB) = UB(x > UB); 8 | end -------------------------------------------------------------------------------- /utils/bootstrap/VOCap_bootstrap.m: -------------------------------------------------------------------------------- 1 | function ap = VOCap(rec,prec) 2 | 3 | mrec=[0 ; rec ; 1]; 4 | mpre=[0 ; prec ; 0]; 5 | for i=numel(mpre)-1:-1:1 6 | mpre(i)=max(mpre(i),mpre(i+1)); 7 | end 8 | i=find(mrec(2:end)~=mrec(1:end-1))+1; 9 | ap=sum((mrec(i)-mrec(i-1)).*mpre(i)); 10 | 11 | -------------------------------------------------------------------------------- /utils/xVOCap.m: -------------------------------------------------------------------------------- 1 | function ap = xVOCap(rec,prec) 2 | % From the PASCAL VOC 2011 devkit 3 | 4 | mrec=[0 ; rec ; 1]; 5 | mpre=[0 ; prec ; 0]; 6 | for i=numel(mpre)-1:-1:1 7 | mpre(i)=max(mpre(i),mpre(i+1)); 8 | end 9 | i=find(mrec(2:end)~=mrec(1:end-1))+1; 10 | ap=sum((mrec(i)-mrec(i-1)).*mpre(i)); 11 | -------------------------------------------------------------------------------- /utils/bootstrap/VOChash_init_bootstrap.m: -------------------------------------------------------------------------------- 1 | function hash = VOChash_init(strs) 2 | 3 | hsize=4999; 4 | hash.key=cell(hsize,1); 5 | hash.val=cell(hsize,1); 6 | 7 | for i=1:numel(strs) 8 | s=strs{i}; 9 | h=mod(str2double(s([3:4 6:11 13:end])),hsize)+1; 10 | j=numel(hash.key{h})+1; 11 | hash.key{h}{j}=strs{i}; 12 | hash.val{h}(j)=i; 13 | end 14 | 15 | -------------------------------------------------------------------------------- /utils/xVOChash_init.m: -------------------------------------------------------------------------------- 1 | function hash = xVOChash_init(strs) 2 | % From the PASCAL VOC 2011 devkit 3 | 4 | hsize=4999; 5 | hash.key=cell(hsize,1); 6 | hash.val=cell(hsize,1); 7 | 8 | for i=1:numel(strs) 9 | s=strs{i}; 10 | h=mod(str2double(s([4 6:end])),hsize)+1; 11 | j=numel(hash.key{h})+1; 12 | hash.key{h}{j}=strs{i}; 13 | hash.val{h}(j)=i; 14 | end 15 | 16 | -------------------------------------------------------------------------------- /external/minConf/minConf/projectSimplex.m: -------------------------------------------------------------------------------- 1 | function [w] = projectSimplex(v) 2 | % Computest the minimum L2-distance projection of vector v onto the probability simplex 3 | nVars = length(v); 4 | mu = sort(v,'descend'); 5 | sm = 0; 6 | for j = 1:nVars 7 | sm = sm+mu(j); 8 | if mu(j) - (1/j)*(sm-1) > 0 9 | row = j; 10 | sm_row = sm; 11 | end 12 | end 13 | theta = (1/row)*(sm_row-1); 14 | w = max(v-theta,0); -------------------------------------------------------------------------------- /docs/autorights/autorights-notice.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------- 2 | Copyright (C) 3 | 4 | This file is part of the code 5 | (http://people.cs.uchicago.edu/~rbg/latent/) 6 | and is available under the terms of an MIT-like license 7 | provided in COPYING. Please retain this notice and 8 | COPYING if you use this file (or a portion of it) in 9 | your project. 10 | ------------------------------------------------------- 11 | 12 | -------------------------------------------------------------------------------- /docs/autorights/autorights-notice-one.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------- 2 | Copyright (C) 3 | 4 | This file is part of the code 5 | (http://people.cs.uchicago.edu/~rbg/latent/) 6 | and is available under the terms of an MIT-like license 7 | provided in COPYING. Please retain this notice and 8 | COPYING if you use this file (or a portion of it) in 9 | your project. 10 | ------------------------------------------------------- 11 | 12 | -------------------------------------------------------------------------------- /model/model_cnn_init.m: -------------------------------------------------------------------------------- 1 | function m = model_cnn_init(m, use_gpu, use_caffe) 2 | 3 | if ~exist('use_gpu', 'var') || isempty(use_gpu) 4 | use_gpu = true; 5 | end 6 | 7 | if ~exist('use_caffe', 'var') || isempty(use_caffe) 8 | use_caffe = true; 9 | end 10 | 11 | if use_caffe 12 | m.cnn.init_key = ... 13 | caffe('init', m.cnn.definition_file, m.cnn.binary_file, 'test'); 14 | if use_gpu 15 | caffe('set_mode_gpu'); 16 | else 17 | caffe('set_mode_cpu'); 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /docs/autorights/autorights-notice-f.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------- 2 | Copyright (C) 3 | Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 4 | 5 | This file is part of the code 6 | (http://people.cs.uchicago.edu/~rbg/latent/) 7 | and is available under the terms of an MIT-like license 8 | provided in COPYING. Please retain this notice and 9 | COPYING if you use this file (or a portion of it) in 10 | your project. 11 | ------------------------------------------------------- 12 | 13 | -------------------------------------------------------------------------------- /external/boost/preprocessor.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org/libs/preprocessor for documentation. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_HPP 15 | # define BOOST_PREPROCESSOR_HPP 16 | # 17 | # include 18 | # 19 | # endif 20 | -------------------------------------------------------------------------------- /external/minConf/minConf/linearProject.m: -------------------------------------------------------------------------------- 1 | function [z] = linearInequalityProject(x,A,b,Aeq,beq,LB,UB) 2 | % Computes Projection of x onto the constraint Ax + b >= 0: 3 | % min_z ||z - x||_2 4 | % s.t. Az + b > 0, Aeqz = Beq, z >= LB, z <= UB 5 | 6 | % z'z - 2z'x + x'x 7 | 8 | if nargin < 5 9 | Aeq = []; 10 | beq = []; 11 | end 12 | if nargin < 6 13 | LB = []; 14 | end 15 | if nargin < 7 16 | UB = []; 17 | end 18 | 19 | p = length(x); 20 | H = eye(p); 21 | f = -x; 22 | 23 | options.LargeScale = 'off'; 24 | options.Display = 'none'; 25 | z = quadprog(H,f,-A,b,Aeq,beq,LB,UB,x,options); -------------------------------------------------------------------------------- /docs/autorights/autorights-notice-fr.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------- 2 | Copyright (C) 3 | Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 4 | Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 5 | 6 | This file is part of the code 7 | (http://people.cs.uchicago.edu/~rbg/latent/) 8 | and is available under the terms of an MIT-like license 9 | provided in COPYING. Please retain this notice and 10 | COPYING if you use this file (or a portion of it) in 11 | your project. 12 | ------------------------------------------------------- 13 | 14 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities/empty.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP 15 | # define BOOST_PREPROCESSOR_FACILITIES_EMPTY_HPP 16 | # 17 | # /* BOOST_PP_EMPTY */ 18 | # 19 | # define BOOST_PP_EMPTY() 20 | # 21 | # endif 22 | -------------------------------------------------------------------------------- /external/boost/preprocessor/punctuation/comma.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_PUNCTUATION_COMMA_HPP 15 | # define BOOST_PREPROCESSOR_PUNCTUATION_COMMA_HPP 16 | # 17 | # /* BOOST_PP_COMMA */ 18 | # 19 | # define BOOST_PP_COMMA() , 20 | # 21 | # endif 22 | -------------------------------------------------------------------------------- /utils/procid.m: -------------------------------------------------------------------------------- 1 | function s = procid() 2 | % Returns a string identifying the process. 3 | 4 | % AUTORIGHTS 5 | % ------------------------------------------------------- 6 | % Copyright (C) 2009-2012 Ross Girshick 7 | % 8 | % This file is part of the voc-releaseX code 9 | % (http://people.cs.uchicago.edu/~rbg/latent/) 10 | % and is available under the terms of an MIT-like license 11 | % provided in COPYING. Please retain this notice and 12 | % COPYING if you use this file (or a portion of it) in 13 | % your project. 14 | % ------------------------------------------------------- 15 | 16 | d = pwd(); 17 | i = strfind(d, '/'); 18 | d = d(i(end)+1:end); 19 | s = d; 20 | -------------------------------------------------------------------------------- /external/minConf/minFunc/lbfgsUpdate.m: -------------------------------------------------------------------------------- 1 | function [old_dirs,old_stps,Hdiag] = lbfgsUpdate(y,s,corrections,debug,old_dirs,old_stps,Hdiag) 2 | ys = y'*s; 3 | if ys > 1e-10 4 | numCorrections = size(old_dirs,2); 5 | if numCorrections < corrections 6 | % Full Update 7 | old_dirs(:,numCorrections+1) = s; 8 | old_stps(:,numCorrections+1) = y; 9 | else 10 | % Limited-Memory Update 11 | old_dirs = [old_dirs(:,2:corrections) s]; 12 | old_stps = [old_stps(:,2:corrections) y]; 13 | end 14 | 15 | % Update scale of initial Hessian approximation 16 | Hdiag = ys/(y'*y); 17 | else 18 | if debug 19 | fprintf('Skipping Update\n'); 20 | end 21 | end -------------------------------------------------------------------------------- /features/cnn_feat_pyramid.m: -------------------------------------------------------------------------------- 1 | function pyra = cnn_feat_pyramid(im, model, padx, pady, image_id) 2 | 3 | if ~exist('padx', 'var') || isempty(padx) || ... 4 | ~exist('pady', 'var') || isempty(pady) 5 | [padx, pady] = getpadding(model); 6 | end 7 | 8 | if exist('image_id', 'var') || ~isempty(image_id) 9 | cache_dir = get_feat_cache_dir(); 10 | cache_opts.cache_file = [cache_dir '/' image_id '.mat']; 11 | cache_opts.write_on_miss = true; 12 | end 13 | cache_opts.debug = false; 14 | pyra = deep_pyramid_cache_wrapper(im, model.cnn, cache_opts); 15 | pyra = deep_pyramid_add_padding(pyra, padx, pady, false); 16 | 17 | feat_scale = 1/50; 18 | for i = 1:pyra.num_levels 19 | pyra.feat{i} = feat_scale * pyra.feat{i}; 20 | end 21 | -------------------------------------------------------------------------------- /train/no_mirror_sharing/README.txt: -------------------------------------------------------------------------------- 1 | If you are experimenting with features that cannot be analytically 2 | flipped, you may find these functions useful. 3 | 4 | Our standard DPMs have 2*n components, where components n and n+1 5 | (where n is odd) are mirror images of each other. This is enforced 6 | during training by tying their parameters (this involves analytically 7 | "flipped" the HOG filters and deformation models). 8 | 9 | This directory contains functions that allow you to train models where 10 | these parameters are not shared. The models are still initialized so 11 | that components n and n+1 are mirror images of each other. BUT their 12 | parameters are not tied in any way. Therefore they will diverge during 13 | training. 14 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities/identity.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP 15 | # define BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP 16 | # 17 | # include 18 | # 19 | # /* BOOST_PP_IDENTITY */ 20 | # 21 | # define BOOST_PP_IDENTITY(item) item BOOST_PP_EMPTY 22 | # 23 | # endif 24 | -------------------------------------------------------------------------------- /external/minConf/minFunc/autoGrad.m: -------------------------------------------------------------------------------- 1 | function [f,g] = autoGrad(x,useComplex,funObj,varargin) % [f,g] = autoGrad(x,useComplex,funObj,varargin) % % Numerically compute gradient of objective function from function values p = length(x); mu = 1e-150; if useComplex % Use Complex Differentials diff = zeros(p,1); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; diff(j,1) = funObj(x + mu*i*e_j,varargin{:}); end f = mean(real(diff)); g = imag(diff)/mu; else % Use Finite Differencing f = funObj(x,varargin{:}); mu = 2*sqrt(1e-12)*(1+norm(x))/norm(p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; diff(j,1) = funObj(x + mu*e_j,varargin{:}); end g = (diff-f)/mu; end if 0 % DEBUG CODE [fReal gReal] = funObj(x,varargin{:}); [fReal f] [gReal g] pause; end -------------------------------------------------------------------------------- /external/boost/preprocessor/detail/null.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DETAIL_NULL_HPP 13 | # define BOOST_PREPROCESSOR_DETAIL_NULL_HPP 14 | # 15 | # /* empty file */ 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/if.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_IF_HPP 13 | # define BOOST_PREPROCESSOR_IF_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/minConf/myProcessOptions.m: -------------------------------------------------------------------------------- 1 | function [varargout] = myProcessOptions(options,varargin) 2 | % Similar to processOptions, but case insensitive and 3 | % using a struct instead of a variable length list 4 | 5 | options = toUpper(options); 6 | 7 | for i = 1:2:length(varargin) 8 | if isfield(options,upper(varargin{i})) 9 | v = getfield(options,upper(varargin{i})); 10 | if isempty(v) 11 | varargout{(i+1)/2}=varargin{i+1}; 12 | else 13 | varargout{(i+1)/2}=v; 14 | end 15 | else 16 | varargout{(i+1)/2}=varargin{i+1}; 17 | end 18 | end 19 | 20 | end 21 | 22 | function [o] = toUpper(o) 23 | if ~isempty(o) 24 | fn = fieldnames(o); 25 | for i = 1:length(fn) 26 | o = setfield(o,upper(fn{i}),getfield(o,fn{i})); 27 | end 28 | end 29 | end -------------------------------------------------------------------------------- /external/boost/preprocessor/dec.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DEC_HPP 13 | # define BOOST_PREPROCESSOR_DEC_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/for.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_FOR_HPP 13 | # define BOOST_PREPROCESSOR_FOR_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/inc.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_INC_HPP 13 | # define BOOST_PREPROCESSOR_INC_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/max.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_MAX_HPP 13 | # define BOOST_PREPROCESSOR_MAX_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/min.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_MIN_HPP 13 | # define BOOST_PREPROCESSOR_MIN_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/slot.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SLOT_HPP 13 | # define BOOST_PREPROCESSOR_SLOT_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/enum.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ENUM_HPP 13 | # define BOOST_PREPROCESSOR_ENUM_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/while.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_WHILE_HPP 13 | # define BOOST_PREPROCESSOR_WHILE_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /data/imreadx.m: -------------------------------------------------------------------------------- 1 | function im = imreadx(ex) 2 | % Read a training example image. 3 | % im = imreadx(ex) 4 | % 5 | % Return value 6 | % im The image specified by the example ex 7 | % 8 | % Argument 9 | % ex An example returned by pascal_data.m 10 | 11 | % AUTORIGHTS 12 | % ------------------------------------------------------- 13 | % Copyright (C) 2009-2012 Ross Girshick 14 | % 15 | % This file is part of the voc-releaseX code 16 | % (http://people.cs.uchicago.edu/~rbg/latent/) 17 | % and is available under the terms of an MIT-like license 18 | % provided in COPYING. Please retain this notice and 19 | % COPYING if you use this file (or a portion of it) in 20 | % your project. 21 | % ------------------------------------------------------- 22 | 23 | im = color(imread(ex.im)); 24 | if ex.flip 25 | im = im(:,end:-1:1,:); 26 | end 27 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comma.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_COMMA_HPP 13 | # define BOOST_PREPROCESSOR_COMMA_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/empty.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_EMPTY_HPP 13 | # define BOOST_PREPROCESSOR_EMPTY_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/limits.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LIMITS_HPP 13 | # define BOOST_PREPROCESSOR_LIMITS_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/expand.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_EXPAND_HPP 13 | # define BOOST_PREPROCESSOR_EXPAND_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/expr_if.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_EXPR_IF_HPP 13 | # define BOOST_PREPROCESSOR_EXPR_IF_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/iterate.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ITERATE_HPP 13 | # define BOOST_PREPROCESSOR_ITERATE_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repeat.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPEAT_HPP 13 | # define BOOST_PREPROCESSOR_REPEAT_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /model/model_add_nonterminal.m: -------------------------------------------------------------------------------- 1 | function [m, N] = model_add_nonterminal(m) 2 | % Add a nonterminal symbol to the grammar model. 3 | % [m, N] = model_add_nonterminal(m) 4 | % 5 | % Return values 6 | % m Updated object model 7 | % N Nonterminal symbol 8 | % 9 | % Argument 10 | % m Object model 11 | 12 | % AUTORIGHTS 13 | % ------------------------------------------------------- 14 | % Copyright (C) 2009-2012 Ross Girshick 15 | % 16 | % This file is part of the voc-releaseX code 17 | % (http://people.cs.uchicago.edu/~rbg/latent/) 18 | % and is available under the terms of an MIT-like license 19 | % provided in COPYING. Please retain this notice and 20 | % COPYING if you use this file (or a portion of it) in 21 | % your project. 22 | % ------------------------------------------------------- 23 | 24 | [m, N] = model_add_symbol(m, 'N'); 25 | -------------------------------------------------------------------------------- /sample_voc_config_override.m: -------------------------------------------------------------------------------- 1 | function conf = sample_voc_config_override() 2 | % Sample config override file 3 | % 4 | % To use this execute: 5 | % >> global VOC_CONFIG_OVERRIDE; 6 | % >> VOC_CONFIG_OVERRIDE = @sample_voc_config_override; 7 | 8 | % AUTORIGHTS 9 | % ------------------------------------------------------- 10 | % Copyright (C) 2011-2012 Ross Girshick 11 | % 12 | % This file is part of the voc-releaseX code 13 | % (http://people.cs.uchicago.edu/~rbg/latent/) 14 | % and is available under the terms of an MIT-like license 15 | % provided in COPYING. Please retain this notice and 16 | % COPYING if you use this file (or a portion of it) in 17 | % your project. 18 | % ------------------------------------------------------- 19 | 20 | conf.custom_key = 'custom value'; 21 | conf.project = 'sample project'; 22 | conf.training.C = 99; 23 | -------------------------------------------------------------------------------- /train/seed_rand.m: -------------------------------------------------------------------------------- 1 | function seed_rand() 2 | % Initialize random number generator to a fixed seed 3 | % This ensures that results are reproducible 4 | 5 | % AUTORIGHTS 6 | % ------------------------------------------------------- 7 | % Copyright (C) 2011-2012 Ross Girshick 8 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 9 | % 10 | % This file is part of the voc-releaseX code 11 | % (http://people.cs.uchicago.edu/~rbg/latent/) 12 | % and is available under the terms of an MIT-like license 13 | % provided in COPYING. Please retain this notice and 14 | % COPYING if you use this file (or a portion of it) in 15 | % your project. 16 | % ------------------------------------------------------- 17 | 18 | % Try to make different versions of matlab happy 19 | try 20 | rng(3, 'twister') 21 | catch 22 | rand('twister',3); 23 | end 24 | -------------------------------------------------------------------------------- /utils/tic_toc_print.m: -------------------------------------------------------------------------------- 1 | function tic_toc_print(fmt, varargin) 2 | % Print only after 1 second has passed since the last print. 3 | % Arguments are the same as for fprintf. 4 | 5 | % AUTORIGHTS 6 | % ------------------------------------------------------- 7 | % Copyright (C) 2009-2012 Ross Girshick 8 | % 9 | % This file is part of the voc-releaseX code 10 | % (http://people.cs.uchicago.edu/~rbg/latent/) 11 | % and is available under the terms of an MIT-like license 12 | % provided in COPYING. Please retain this notice and 13 | % COPYING if you use this file (or a portion of it) in 14 | % your project. 15 | % ------------------------------------------------------- 16 | 17 | persistent th; 18 | 19 | if isempty(th) 20 | th = tic(); 21 | end 22 | 23 | if toc(th) > 1 24 | fprintf(fmt, varargin{:}); 25 | drawnow; 26 | th = tic(); 27 | end 28 | -------------------------------------------------------------------------------- /external/boost/preprocessor/assert_msg.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ASSERT_MSG_HPP 13 | # define BOOST_PREPROCESSOR_ASSERT_MSG_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comma_if.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_COMMA_IF_HPP 13 | # define BOOST_PREPROCESSOR_COMMA_IF_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/identity.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_IDENTITY_HPP 13 | # define BOOST_PREPROCESSOR_IDENTITY_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repeat_2nd.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPEAT_2ND_HPP 13 | # define BOOST_PREPROCESSOR_REPEAT_2ND_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repeat_3rd.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPEAT_3RD_HPP 13 | # define BOOST_PREPROCESSOR_REPEAT_3RD_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/tuple.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_TUPLE_HPP 15 | # define BOOST_PREPROCESSOR_TUPLE_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # 24 | # endif 25 | -------------------------------------------------------------------------------- /external/boost/preprocessor/enum_params.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ENUM_PARAMS_HPP 13 | # define BOOST_PREPROCESSOR_ENUM_PARAMS_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/enum_shifted.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ENUM_SHIFTED_HPP 13 | # define BOOST_PREPROCESSOR_ENUM_SHIFTED_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repeat_from_to.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPEAT_FROM_TO_HPP 13 | # define BOOST_PREPROCESSOR_REPEAT_FROM_TO_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /features/color.m: -------------------------------------------------------------------------------- 1 | function im = color(input) 2 | % Convert input image to color. 3 | % im = color(input) 4 | 5 | % AUTORIGHTS 6 | % ------------------------------------------------------- 7 | % Copyright (C) 2011-2012 Ross Girshick 8 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 9 | % Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 10 | % 11 | % This file is part of the voc-releaseX code 12 | % (http://people.cs.uchicago.edu/~rbg/latent/) 13 | % and is available under the terms of an MIT-like license 14 | % provided in COPYING. Please retain this notice and 15 | % COPYING if you use this file (or a portion of it) in 16 | % your project. 17 | % ------------------------------------------------------- 18 | 19 | if size(input, 3) == 1 20 | im(:,:,1) = input; 21 | im(:,:,2) = input; 22 | im(:,:,3) = input; 23 | else 24 | im = input; 25 | end 26 | -------------------------------------------------------------------------------- /external/boost/preprocessor/debug.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DEBUG_HPP 13 | # define BOOST_PREPROCESSOR_DEBUG_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # endif 19 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repeat_from_to_2nd.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPEAT_FROM_TO_2ND_HPP 13 | # define BOOST_PREPROCESSOR_REPEAT_FROM_TO_2ND_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repeat_from_to_3rd.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPEAT_FROM_TO_3RD_HPP 13 | # define BOOST_PREPROCESSOR_REPEAT_FROM_TO_3RD_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/enum_shifted_params.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ENUM_SHIFTED_PARAMS_HPP 13 | # define BOOST_PREPROCESSOR_ENUM_SHIFTED_PARAMS_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/selection.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SELECTION_HPP 13 | # define BOOST_PREPROCESSOR_SELECTION_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # endif 19 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/push_back.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_PUSH_BACK_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_PUSH_BACK_HPP 14 | # 15 | # /* BOOST_PP_SEQ_PUSH_BACK */ 16 | # 17 | # define BOOST_PP_SEQ_PUSH_BACK(seq, elem) seq(elem) 18 | # 19 | # endif 20 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/push_front.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_PUSH_FRONT_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_PUSH_FRONT_HPP 14 | # 15 | # /* BOOST_PP_SEQ_PUSH_FRONT */ 16 | # 17 | # define BOOST_PP_SEQ_PUSH_FRONT(seq, elem) (elem)seq 18 | # 19 | # endif 20 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comparison.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_COMPARISON_HPP 15 | # define BOOST_PREPROCESSOR_COMPARISON_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # 24 | # endif 25 | -------------------------------------------------------------------------------- /external/boost/preprocessor/enum_params_with_defaults.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_DEFAULTS_HPP 13 | # define BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_DEFAULTS_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/enum_params_with_a_default.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_A_DEFAULT_HPP 13 | # define BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_A_DEFAULT_HPP 14 | # 15 | # include 16 | # 17 | # endif 18 | -------------------------------------------------------------------------------- /external/boost/preprocessor/iteration/self.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ITERATION_SELF_HPP 13 | # define BOOST_PREPROCESSOR_ITERATION_SELF_HPP 14 | # 15 | # /* BOOST_PP_INCLUDE_SELF */ 16 | # 17 | # define BOOST_PP_INCLUDE_SELF() 18 | # 19 | # endif 20 | -------------------------------------------------------------------------------- /utils/rndtest.m: -------------------------------------------------------------------------------- 1 | function [p, ptt] = rndtest(X, Y, B) 2 | % Randomized (permutation) paired sample test 3 | 4 | % AUTORIGHTS 5 | % ------------------------------------------------------- 6 | % Copyright (C) 2009-2012 Ross Girshick 7 | % 8 | % This file is part of the voc-releaseX code 9 | % (http://people.cs.uchicago.edu/~rbg/latent/) 10 | % and is available under the terms of an MIT-like license 11 | % provided in COPYING. Please retain this notice and 12 | % COPYING if you use this file (or a portion of it) in 13 | % your project. 14 | % ------------------------------------------------------- 15 | 16 | if nargin < 3 17 | B = 100000; 18 | end 19 | 20 | Z0 = X - Y; 21 | t0 = mean(Z0); 22 | T = length(Z0); 23 | 24 | t = mean(repmat(Z0, [1 B]) .* ((rand(T,B) < 0.5) * 2 - 1)); 25 | 26 | p = 1/B * sum(abs(t0) <= abs(t)); 27 | 28 | % For comparison: 29 | % p-value from matlab's parametric t-test function 30 | [~, ptt] = ttest(X, Y); 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repetition/enum_params_with_defaults.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_WITH_DEFAULTS_HPP 15 | # define BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_WITH_DEFAULTS_HPP 16 | # 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS */ 21 | # 22 | # define BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(count, param, def) BOOST_PP_ENUM_BINARY_PARAMS(count, param, = def) 23 | # 24 | # endif 25 | -------------------------------------------------------------------------------- /data/merge_pos_neg.m: -------------------------------------------------------------------------------- 1 | function [all_neg, pos_end] = merge_pos_neg(pos, neg) 2 | % neg fields 3 | % im 4 | % flip 5 | % dataid 6 | % +boxes 7 | % pos fields 8 | % im 9 | % flip 10 | % +dataid 11 | % boxes 12 | % -x1 13 | % -y1 14 | % -x2 15 | % -y2 16 | % -trunc 17 | % -dataids 18 | % -sizes 19 | 20 | %pos = rmfield(pos, 'x1'); 21 | %pos = rmfield(pos, 'x2'); 22 | %pos = rmfield(pos, 'y1'); 23 | %pos = rmfield(pos, 'y2'); 24 | %pos = rmfield(pos, 'trunc'); 25 | pos = rmfield(pos, 'sizes'); 26 | pos = rmfield(pos, 'dataids'); 27 | 28 | % remove flipped examples (they are not currently cached) 29 | is_flipped = find([pos(:).flip] == true); 30 | pos(is_flipped) = []; 31 | 32 | neg(1).boxes = []; 33 | 34 | last_neg_dataid = max([neg(:).dataid]); 35 | for i = 1:length(pos) 36 | pos(i).dataid = last_neg_dataid + i; 37 | end 38 | 39 | all_neg = cat(2, pos, neg); 40 | pos_end = length(pos); 41 | -------------------------------------------------------------------------------- /external/boost/preprocessor/arithmetic.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_ARITHMETIC_HPP 15 | # define BOOST_PREPROCESSOR_ARITHMETIC_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # include 24 | # 25 | # endif 26 | -------------------------------------------------------------------------------- /vis/foldHOG.m: -------------------------------------------------------------------------------- 1 | function f = foldHOG(w) 2 | % Condense HOG features into one orientation histogram. 3 | % f = foldHOG(w) 4 | % 5 | % Used for displaying features and filters 6 | 7 | % AUTORIGHTS 8 | % ------------------------------------------------------- 9 | % Copyright (C) 2011-2012 Ross Girshick 10 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 11 | % Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 12 | % 13 | % This file is part of the voc-releaseX code 14 | % (http://people.cs.uchicago.edu/~rbg/latent/) 15 | % and is available under the terms of an MIT-like license 16 | % provided in COPYING. Please retain this notice and 17 | % COPYING if you use this file (or a portion of it) in 18 | % your project. 19 | % ------------------------------------------------------- 20 | 21 | % Return the contrast insensitive orientations 22 | f = w(:,:,19:27); 23 | 24 | % f=max(w(:,:,1:9),0)+max(w(:,:,10:18),0)+max(w(:,:,19:27),0); 25 | -------------------------------------------------------------------------------- /external/boost/preprocessor/iteration.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ITERATION_HPP 13 | # define BOOST_PREPROCESSOR_ITERATION_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # 19 | # endif 20 | -------------------------------------------------------------------------------- /external/boost/preprocessor/iteration/detail/self.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # if !defined(BOOST_PP_INDIRECT_SELF) 13 | # error BOOST_PP_ERROR: no indirect file to include 14 | # endif 15 | # 16 | # define BOOST_PP_IS_SELFISH 1 17 | # 18 | # include BOOST_PP_INDIRECT_SELF 19 | # 20 | # undef BOOST_PP_IS_SELFISH 21 | # undef BOOST_PP_INDIRECT_SELF 22 | -------------------------------------------------------------------------------- /external/boost/preprocessor/punctuation/paren.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_PUNCTUATION_PAREN_HPP 13 | # define BOOST_PREPROCESSOR_PUNCTUATION_PAREN_HPP 14 | # 15 | # /* BOOST_PP_LPAREN */ 16 | # 17 | # define BOOST_PP_LPAREN() ( 18 | # 19 | # /* BOOST_PP_RPAREN */ 20 | # 21 | # define BOOST_PP_RPAREN() ) 22 | # 23 | # endif 24 | -------------------------------------------------------------------------------- /data/scripts/fetch_imagenet_model.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../caffe_nets/" && pwd )" 4 | cd $DIR 5 | 6 | FILE=CaffeNet.v2.caffemodel 7 | URL=https://dl.dropboxusercontent.com/s/t1z4jxj991x968x/CaffeNet.v2.caffemodel 8 | CHECKSUM=6e47b642e2f261090c8fecdc05a57546 9 | 10 | if [ -f $FILE ]; then 11 | echo "File already exists. Checking md5..." 12 | os=`uname -s` 13 | if [ "$os" = "Linux" ]; then 14 | checksum=`md5sum $FILE | awk '{ print $1 }'` 15 | elif [ "$os" = "Darwin" ]; then 16 | checksum=`cat $FILE | md5` 17 | fi 18 | if [ "$checksum" = "$CHECKSUM" ]; then 19 | echo "Checksum is correct. No need to download." 20 | exit 0 21 | else 22 | echo "Checksum is incorrect. Need to download again." 23 | fi 24 | fi 25 | 26 | echo "Downloading pretrained ImageNet model (233M)..." 27 | 28 | wget $URL -O $FILE 29 | 30 | echo "Done. Please run this command again to verify that checksum = $CHECKSUM." 31 | -------------------------------------------------------------------------------- /model/model_add_symbol.m: -------------------------------------------------------------------------------- 1 | function [m, S] = model_add_symbol(m, type) 2 | % Add a symbol to the grammar model. 3 | % [m, i] = model_add_symbol(m, type) 4 | % 5 | % Return values 6 | % m Updated object model 7 | % S Symbol 8 | % 9 | % Arguments 10 | % m Object model 11 | % type 'N'onterminal or 'T'erminal 12 | 13 | % AUTORIGHTS 14 | % ------------------------------------------------------- 15 | % Copyright (C) 2009-2012 Ross Girshick 16 | % 17 | % This file is part of the voc-releaseX code 18 | % (http://people.cs.uchicago.edu/~rbg/latent/) 19 | % and is available under the terms of an MIT-like license 20 | % provided in COPYING. Please retain this notice and 21 | % COPYING if you use this file (or a portion of it) in 22 | % your project. 23 | % ------------------------------------------------------- 24 | 25 | % new symbol for terminal associated with filter f 26 | S = m.numsymbols + 1; 27 | m.numsymbols = S; 28 | m.symbols(S).type = type; 29 | -------------------------------------------------------------------------------- /external/boost/preprocessor/config/limits.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_CONFIG_LIMITS_HPP 15 | # define BOOST_PREPROCESSOR_CONFIG_LIMITS_HPP 16 | # 17 | # define BOOST_PP_LIMIT_MAG 256 18 | # define BOOST_PP_LIMIT_TUPLE 25 19 | # define BOOST_PP_LIMIT_DIM 3 20 | # define BOOST_PP_LIMIT_REPEAT 256 21 | # define BOOST_PP_LIMIT_WHILE 256 22 | # define BOOST_PP_LIMIT_FOR 256 23 | # define BOOST_PP_LIMIT_ITERATION 256 24 | # define BOOST_PP_LIMIT_ITERATION_DIM 3 25 | # define BOOST_PP_LIMIT_SEQ 256 26 | # define BOOST_PP_LIMIT_SLOT_SIG 10 27 | # define BOOST_PP_LIMIT_SLOT_COUNT 5 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities/expand.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_FACILITIES_EXPAND_HPP 15 | # define BOOST_PREPROCESSOR_FACILITIES_EXPAND_HPP 16 | # 17 | # include 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC() 20 | # define BOOST_PP_EXPAND(x) BOOST_PP_EXPAND_I(x) 21 | # else 22 | # define BOOST_PP_EXPAND(x) BOOST_PP_EXPAND_OO((x)) 23 | # define BOOST_PP_EXPAND_OO(par) BOOST_PP_EXPAND_I ## par 24 | # endif 25 | # 26 | # define BOOST_PP_EXPAND_I(x) x 27 | # 28 | # endif 29 | -------------------------------------------------------------------------------- /features/getpadding.m: -------------------------------------------------------------------------------- 1 | function [padx, pady] = getpadding(model) 2 | % Amount to pad each level of the feature pyramid. 3 | % [padx, pady] = getpadding(model) 4 | % 5 | % We pad the feature maps to detect partially visible objects. 6 | % 7 | % Return values 8 | % padx Amount to pad in the x direction 9 | % pady Amount to pad in the y direction 10 | % 11 | % Argument 12 | % model Model being used for detection 13 | 14 | % AUTORIGHTS 15 | % ------------------------------------------------------- 16 | % Copyright (C) 2009-2012 Ross Girshick 17 | % 18 | % This file is part of the voc-releaseX code 19 | % (http://people.cs.uchicago.edu/~rbg/latent/) 20 | % and is available under the terms of an MIT-like license 21 | % provided in COPYING. Please retain this notice and 22 | % COPYING if you use this file (or a portion of it) in 23 | % your project. 24 | % ------------------------------------------------------- 25 | 26 | % Use the dimensions of the max over detection windows 27 | padx = 10; 28 | pady = 10; 29 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repetition/enum_params_with_a_default.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_WITH_A_DEFAULT_HPP 15 | # define BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_WITH_A_DEFAULT_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT */ 22 | # 23 | # define BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(count, param, def) BOOST_PP_ENUM_BINARY_PARAMS(count, param, = def BOOST_PP_INTERCEPT) 24 | # 25 | # endif 26 | -------------------------------------------------------------------------------- /fv_cache/fv_obj_func.m: -------------------------------------------------------------------------------- 1 | function [v, g] = fv_obj_func(w, num_threads) 2 | % Get the object function value and gradient at w. 3 | % [v, g] = fv_obj_func(w, num_threads) 4 | % 5 | % Return values 6 | % v Objective function value f(w) 7 | % g Objective function gradient \nabla f(w) 8 | % 9 | % Arguments 10 | % w Gradient and function evaluation point 11 | % num_threads Number of worker threads to use for computing the gradient 12 | 13 | % AUTORIGHTS 14 | % ------------------------------------------------------- 15 | % Copyright (C) 2011-2012 Ross Girshick 16 | % 17 | % This file is part of the voc-releaseX code 18 | % (http://people.cs.uchicago.edu/~rbg/latent/) 19 | % and is available under the terms of an MIT-like license 20 | % provided in COPYING. Please retain this notice and 21 | % COPYING if you use this file (or a portion of it) in 22 | % your project. 23 | % ------------------------------------------------------- 24 | 25 | [v, g] = fv_cache('gradient', w, num_threads); 26 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/not.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LOGICAL_NOT_HPP 15 | # define BOOST_PREPROCESSOR_LOGICAL_NOT_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_NOT */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_NOT(x) BOOST_PP_COMPL(BOOST_PP_BOOL(x)) 25 | # else 26 | # define BOOST_PP_NOT(x) BOOST_PP_NOT_I(x) 27 | # define BOOST_PP_NOT_I(x) BOOST_PP_COMPL(BOOST_PP_BOOL(x)) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/punctuation.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_PUNCTUATION_HPP 13 | # define BOOST_PREPROCESSOR_PUNCTUATION_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # endif 21 | -------------------------------------------------------------------------------- /external/boost/preprocessor/control/deduce_d.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_CONTROL_DEDUCE_D_HPP 13 | # define BOOST_PREPROCESSOR_CONTROL_DEDUCE_D_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_DEDUCE_D */ 19 | # 20 | # define BOOST_PP_DEDUCE_D() BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256) 21 | # 22 | # endif 23 | -------------------------------------------------------------------------------- /model/model_types.m: -------------------------------------------------------------------------------- 1 | % AUTORIGHTS 2 | % ------------------------------------------------------- 3 | % Copyright (C) 2009-2012 Ross Girshick 4 | % 5 | % This file is part of the voc-releaseX code 6 | % (http://people.cs.uchicago.edu/~rbg/latent/) 7 | % and is available under the terms of an MIT-like license 8 | % provided in COPYING. Please retain this notice and 9 | % COPYING if you use this file (or a portion of it) in 10 | % your project. 11 | % ------------------------------------------------------- 12 | 13 | % Model types: 14 | % MixStar Mixture of star models with latent orientation 15 | % Grammar General grammar model (no specific structure) 16 | classdef (Sealed) model_types 17 | properties (Constant) 18 | MixStar = 'M'; 19 | Grammar = 'G'; 20 | end 21 | methods (Access = private) 22 | function out = model_types 23 | end 24 | end 25 | end 26 | 27 | % Note: Enumerations are only available in matlab >= 2010b 28 | % 29 | %classdef model_types 30 | % enumeration 31 | % MixStar, Grammar 32 | % end 33 | %end 34 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repetition/deduce_r.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPETITION_DEDUCE_R_HPP 13 | # define BOOST_PREPROCESSOR_REPETITION_DEDUCE_R_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_DEDUCE_R */ 19 | # 20 | # define BOOST_PP_DEDUCE_R() BOOST_PP_AUTO_REC(BOOST_PP_FOR_P, 256) 21 | # 22 | # endif 23 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repetition/deduce_z.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_REPETITION_DEDUCE_Z_HPP 13 | # define BOOST_PREPROCESSOR_REPETITION_DEDUCE_Z_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_DEDUCE_Z */ 19 | # 20 | # define BOOST_PP_DEDUCE_Z() BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4) 21 | # 22 | # endif 23 | -------------------------------------------------------------------------------- /gdetect/loss_func.m: -------------------------------------------------------------------------------- 1 | function losses = loss_func(o) 2 | % Compute the loss associated with the intersection over union 3 | % overlap between a ground-truth bounding box and any other 4 | % windows. 5 | % losses = loss_func(o) 6 | % 7 | % Return value 8 | % losses Loss for each element in the input 9 | % 10 | % Argument 11 | % o Vector of overlap values 12 | 13 | % AUTORIGHTS 14 | % ------------------------------------------------------- 15 | % Copyright (C) 2011-2012 Ross Girshick 16 | % 17 | % This file is part of the voc-releaseX code 18 | % (http://people.cs.uchicago.edu/~rbg/latent/) 19 | % and is available under the terms of an MIT-like license 20 | % provided in COPYING. Please retain this notice and 21 | % COPYING if you use this file (or a portion of it) in 22 | % your project. 23 | % ------------------------------------------------------- 24 | 25 | % The PASCAL VOC detection task loss 26 | % Loss is 0 for IoU >= 0.5 27 | % Loss is 1 for IoU < 0.5 28 | losses = zeros(size(o)); 29 | I = find(o < 0.5); 30 | losses(I) = 1.0; 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/control/if.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_CONTROL_IF_HPP 15 | # define BOOST_PREPROCESSOR_CONTROL_IF_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_IF */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_IF(cond, t, f) BOOST_PP_IIF(BOOST_PP_BOOL(cond), t, f) 25 | # else 26 | # define BOOST_PP_IF(cond, t, f) BOOST_PP_IF_I(cond, t, f) 27 | # define BOOST_PP_IF_I(cond, t, f) BOOST_PP_IIF(BOOST_PP_BOOL(cond), t, f) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/or.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LOGICAL_OR_HPP 15 | # define BOOST_PREPROCESSOR_LOGICAL_OR_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_OR */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_OR(p, q) BOOST_PP_BITOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 25 | # else 26 | # define BOOST_PP_OR(p, q) BOOST_PP_OR_I(p, q) 27 | # define BOOST_PP_OR_I(p, q) BOOST_PP_BITOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities/is_1.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2003. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_FACILITIES_IS_1_HPP 13 | # define BOOST_PREPROCESSOR_FACILITIES_IS_1_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_IS_1 */ 19 | # 20 | # define BOOST_PP_IS_1(x) BOOST_PP_IS_EMPTY(BOOST_PP_CAT(BOOST_PP_IS_1_HELPER_, x)) 21 | # define BOOST_PP_IS_1_HELPER_1 22 | # 23 | # endif 24 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/and.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LOGICAL_AND_HPP 15 | # define BOOST_PREPROCESSOR_LOGICAL_AND_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_AND */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_AND(p, q) BOOST_PP_BITAND(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 25 | # else 26 | # define BOOST_PP_AND(p, q) BOOST_PP_AND_I(p, q) 27 | # define BOOST_PP_AND_I(p, q) BOOST_PP_BITAND(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/nor.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LOGICAL_NOR_HPP 15 | # define BOOST_PREPROCESSOR_LOGICAL_NOR_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_NOR */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_NOR(p, q) BOOST_PP_BITNOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 25 | # else 26 | # define BOOST_PP_NOR(p, q) BOOST_PP_NOR_I(p, q) 27 | # define BOOST_PP_NOR_I(p, q) BOOST_PP_BITNOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/xor.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LOGICAL_XOR_HPP 15 | # define BOOST_PREPROCESSOR_LOGICAL_XOR_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_XOR */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_XOR(p, q) BOOST_PP_BITXOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 25 | # else 26 | # define BOOST_PP_XOR(p, q) BOOST_PP_XOR_I(p, q) 27 | # define BOOST_PP_XOR_I(p, q) BOOST_PP_BITXOR(BOOST_PP_BOOL(p), BOOST_PP_BOOL(q)) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_FACILITIES_HPP 13 | # define BOOST_PREPROCESSOR_FACILITIES_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # 21 | # endif 22 | -------------------------------------------------------------------------------- /utils/auc_ap_2007.m: -------------------------------------------------------------------------------- 1 | function auc_ap_2007(path, suffix) 2 | % Load precision and recall from [path cls suffix] and recompute 3 | % AP scores using the >= 2010 area under curve method. Useful for 4 | % getting less noisy results on the 2007 test set. 5 | 6 | % AUTORIGHTS 7 | % ------------------------------------------------------- 8 | % Copyright (C) 2009-2012 Ross Girshick 9 | % 10 | % This file is part of the voc-releaseX code 11 | % (http://people.cs.uchicago.edu/~rbg/latent/) 12 | % and is available under the terms of an MIT-like license 13 | % provided in COPYING. Please retain this notice and 14 | % COPYING if you use this file (or a portion of it) in 15 | % your project. 16 | % ------------------------------------------------------- 17 | 18 | conf = voc_config(); 19 | VOCopts = conf.pascal.VOCopts; 20 | 21 | ncls = length(VOCopts.classes); 22 | ap = zeros(1, ncls); 23 | for i = 1:ncls 24 | cls = VOCopts.classes{i}; 25 | a = load([path cls suffix]); 26 | ap(i) = xVOCap(a.recall, a.prec); 27 | end 28 | fprintf('\n'); 29 | fprintf('%.1f & ', [ap mean(ap)]*100); 30 | fprintf('\n'); 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/control.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_CONTROL_HPP 13 | # define BOOST_PREPROCESSOR_CONTROL_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # include 21 | # 22 | # endif 23 | -------------------------------------------------------------------------------- /gdetect/imgdetect.m: -------------------------------------------------------------------------------- 1 | function [ds, bs, trees] = imgdetect(im, model, thresh, image_id) 2 | % Wrapper around gdetect.m that computes detections in an image. 3 | % [ds, bs, trees] = imgdetect(im, model, thresh) 4 | % 5 | % Return values (see gdetect.m) 6 | % 7 | % Arguments 8 | % im Input image 9 | % model Model to use for detection 10 | % thresh Detection threshold (scores must be > thresh) 11 | 12 | % AUTORIGHTS 13 | % ------------------------------------------------------- 14 | % Copyright (C) 2009-2012 Ross Girshick 15 | % 16 | % This file is part of the voc-releaseX code 17 | % (http://people.cs.uchicago.edu/~rbg/latent/) 18 | % and is available under the terms of an MIT-like license 19 | % provided in COPYING. Please retain this notice and 20 | % COPYING if you use this file (or a portion of it) in 21 | % your project. 22 | % ------------------------------------------------------- 23 | 24 | if ~exist('image_id', 'var') 25 | image_id = []; 26 | end 27 | 28 | im = color(im); 29 | pyra = cnn_feat_pyramid(im, model, [], [], image_id); 30 | [ds, bs, trees] = gdetect(pyra, model, thresh); 31 | -------------------------------------------------------------------------------- /external/minConf/minFunc/lbfgs.m: -------------------------------------------------------------------------------- 1 | function [d] = lbfgs(g,s,y,Hdiag) 2 | % BFGS Search Direction 3 | % 4 | % This function returns the (L-BFGS) approximate inverse Hessian, 5 | % multiplied by the gradient 6 | % 7 | % If you pass in all previous directions/sizes, it will be the same as full BFGS 8 | % If you truncate to the k most recent directions/sizes, it will be L-BFGS 9 | % 10 | % s - previous search directions (p by k) 11 | % y - previous step sizes (p by k) 12 | % g - gradient (p by 1) 13 | % Hdiag - value of initial Hessian diagonal elements (scalar) 14 | 15 | [p,k] = size(s); 16 | 17 | for i = 1:k 18 | ro(i,1) = 1/(y(:,i)'*s(:,i)); 19 | end 20 | 21 | q = zeros(p,k+1); 22 | r = zeros(p,k+1); 23 | al =zeros(k,1); 24 | be =zeros(k,1); 25 | 26 | q(:,k+1) = g; 27 | 28 | for i = k:-1:1 29 | al(i) = ro(i)*s(:,i)'*q(:,i+1); 30 | q(:,i) = q(:,i+1)-al(i)*y(:,i); 31 | end 32 | 33 | % Multiply by Initial Hessian 34 | r(:,1) = Hdiag*q(:,1); 35 | 36 | for i = 1:k 37 | be(i) = ro(i)*y(:,i)'*r(:,i); 38 | r(:,i+1) = r(:,i) + s(:,i)*(al(i)-be(i)); 39 | end 40 | d=r(:,k+1); -------------------------------------------------------------------------------- /external/boost/preprocessor/control/expr_if.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_CONTROL_EXPR_IF_HPP 15 | # define BOOST_PREPROCESSOR_CONTROL_EXPR_IF_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_EXPR_IF */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_EXPR_IF(cond, expr) BOOST_PP_EXPR_IIF(BOOST_PP_BOOL(cond), expr) 25 | # else 26 | # define BOOST_PP_EXPR_IF(cond, expr) BOOST_PP_EXPR_IF_I(cond, expr) 27 | # define BOOST_PP_EXPR_IF_I(cond, expr) BOOST_PP_EXPR_IIF(BOOST_PP_BOOL(cond), expr) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/cat.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_CAT_HPP 15 | # define BOOST_PREPROCESSOR_CAT_HPP 16 | # 17 | # include 18 | # 19 | # /* BOOST_PP_CAT */ 20 | # 21 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 22 | # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) 23 | # else 24 | # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_OO((a, b)) 25 | # define BOOST_PP_CAT_OO(par) BOOST_PP_CAT_I ## par 26 | # endif 27 | # 28 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 29 | # define BOOST_PP_CAT_I(a, b) a ## b 30 | # else 31 | # define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(a ## b) 32 | # define BOOST_PP_CAT_II(res) res 33 | # endif 34 | # 35 | # endif 36 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LOGICAL_HPP 15 | # define BOOST_PREPROCESSOR_LOGICAL_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # include 24 | # include 25 | # include 26 | # include 27 | # include 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015 Ross Girshick 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /utils/model_attach_weights.m: -------------------------------------------------------------------------------- 1 | function model = model_attach_weights(model) 2 | 3 | % AUTORIGHTS 4 | % ------------------------------------------------------- 5 | % Copyright (C) 2009-2012 Ross Girshick 6 | % 7 | % This file is part of the voc-releaseX code 8 | % (http://people.cs.uchicago.edu/~rbg/latent/) 9 | % and is available under the terms of an MIT-like license 10 | % provided in COPYING. Please retain this notice and 11 | % COPYING if you use this file (or a portion of it) in 12 | % your project. 13 | % ------------------------------------------------------- 14 | 15 | for i = 1:model.numfilters 16 | w = model_get_block(model, model.filters(i)); 17 | model.filters(i).w = w; 18 | end 19 | 20 | for i = 1:length(model.rules) 21 | if isempty(model.rules{i}), continue; end 22 | 23 | for j = 1:length(model.rules{i}) 24 | fns = fieldnames(model.rules{i}(j)); 25 | for k = 1:length(fns) 26 | f = fns{k}; 27 | if isfield(model.rules{i}(j).(f), 'blocklabel') 28 | w = model_get_block(model, model.rules{i}(j).(f)); 29 | model.rules{i}(j).(f).w = w; 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /external/boost/preprocessor/slot/counter.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2005. * 4 | # * Distributed under the Boost Software License, Version 1.0. (See * 5 | # * accompanying file LICENSE_1_0.txt or copy at * 6 | # * http://www.boost.org/LICENSE_1_0.txt) * 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SLOT_COUNTER_HPP 13 | # define BOOST_PREPROCESSOR_SLOT_COUNTER_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_COUNTER */ 18 | # 19 | # define BOOST_PP_COUNTER 0 20 | # 21 | # /* BOOST_PP_UPDATE_COUNTER */ 22 | # 23 | # define BOOST_PP_UPDATE_COUNTER() 24 | # 25 | # endif 26 | -------------------------------------------------------------------------------- /external/README: -------------------------------------------------------------------------------- 1 | External code 2 | ------------- 3 | 4 | 1) minConf by Mark Schmidt 5 | 6 | Used as an L-BFGS optimization blackbox for solving convex slave problems. 7 | Our convex slave problems are not smooth, but L-BFGS seems to work well 8 | with the subgradients of our objective. Box contraints are used to prevent 9 | quadratic deformation parameters from becomes too small (or negative). 10 | 11 | Downloaded: http://www.di.ens.fr/~mschmidt/Software/minConf.html 12 | on Jan 23, 2012. 13 | 14 | Modifications: no changes to source; removed some unneeded files. 15 | 16 | 17 | 2) LIBSVM by Chih-Chung Chang and Chih-Jen Lin 18 | 19 | Download: http://www.csie.ntu.edu.tw/~cjlin/libsvm/ 20 | on May 2, 2012. 21 | 22 | Modifications: 23 | - removed unneeded directories and files. 24 | - matlab/svmpredict.c: remove mexPrintf of accuracy 25 | - matlab/svmtrain.c: print_string_matlab now executes a drawNow to 26 | flush the print buffer 27 | 28 | 29 | 3) Boost Preprocessor Library 30 | 31 | Used for metaprogramming. One convolution routine binary is generated 32 | for each feature dimension with the inner most loop unrolled the 33 | appropriate number of times. 34 | -------------------------------------------------------------------------------- /external/boost/preprocessor/punctuation/comma_if.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_PUNCTUATION_COMMA_IF_HPP 15 | # define BOOST_PREPROCESSOR_PUNCTUATION_COMMA_IF_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # 22 | # /* BOOST_PP_COMMA_IF */ 23 | # 24 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 25 | # define BOOST_PP_COMMA_IF(cond) BOOST_PP_IF(cond, BOOST_PP_COMMA, BOOST_PP_EMPTY)() 26 | # else 27 | # define BOOST_PP_COMMA_IF(cond) BOOST_PP_COMMA_IF_I(cond) 28 | # define BOOST_PP_COMMA_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_COMMA, BOOST_PP_EMPTY)() 29 | # endif 30 | # 31 | # endif 32 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comparison/equal.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_COMPARISON_EQUAL_HPP 15 | # define BOOST_PREPROCESSOR_COMPARISON_EQUAL_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_EQUAL */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_EQUAL(x, y) BOOST_PP_COMPL(BOOST_PP_NOT_EQUAL(x, y)) 25 | # else 26 | # define BOOST_PP_EQUAL(x, y) BOOST_PP_EQUAL_I(x, y) 27 | # define BOOST_PP_EQUAL_I(x, y) BOOST_PP_COMPL(BOOST_PP_NOT_EQUAL(x, y)) 28 | # endif 29 | # 30 | # /* BOOST_PP_EQUAL_D */ 31 | # 32 | # define BOOST_PP_EQUAL_D(d, x, y) BOOST_PP_EQUAL(x, y) 33 | # 34 | # endif 35 | -------------------------------------------------------------------------------- /model/block_types.m: -------------------------------------------------------------------------------- 1 | % AUTORIGHTS 2 | % ------------------------------------------------------- 3 | % Copyright (C) 2009-2012 Ross Girshick 4 | % 5 | % This file is part of the voc-releaseX code 6 | % (http://people.cs.uchicago.edu/~rbg/latent/) 7 | % and is available under the terms of an MIT-like license 8 | % provided in COPYING. Please retain this notice and 9 | % COPYING if you use this file (or a portion of it) in 10 | % your project. 11 | % ------------------------------------------------------- 12 | 13 | % Symbols for the various types of parameter blocks in a model 14 | classdef (Sealed) block_types 15 | properties (Constant) 16 | Other = 'O'; 17 | Filter = 'F'; 18 | PCAFilter = 'P'; 19 | SepQuadDef = 'D'; 20 | end 21 | methods (Access = private) 22 | function out = block_types 23 | end 24 | end 25 | end 26 | 27 | % Note: Enumerations are only available in matlab >= 2010b 28 | % 29 | %classdef block_types 30 | % enumeration 31 | % Filter, % HOG filter 32 | % PCAFilter, % HOG PCA filter (used by cascade) 33 | % SepQuadDef, % Separable Quadratic Deformation 34 | % Other % Other: offets, ... 35 | % end 36 | %end 37 | -------------------------------------------------------------------------------- /external/boost/preprocessor/stringize.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_STRINGIZE_HPP 15 | # define BOOST_PREPROCESSOR_STRINGIZE_HPP 16 | # 17 | # include 18 | # 19 | # /* BOOST_PP_STRINGIZE */ 20 | # 21 | # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 22 | # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text)) 23 | # define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_I arg 24 | # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 25 | # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text)) 26 | # define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I ## par 27 | # else 28 | # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text) 29 | # endif 30 | # 31 | # define BOOST_PP_STRINGIZE_I(text) #text 32 | # 33 | # endif 34 | -------------------------------------------------------------------------------- /external/minConf/minFunc/dampedUpdate.m: -------------------------------------------------------------------------------- 1 | function [old_dirs,old_stps,Hdiag,Bcompact] = lbfgsUpdate(y,s,corrections,debug,old_dirs,old_stps,Hdiag) 2 | 3 | %B0 = eye(length(y))/Hdiag; 4 | S = old_dirs(:,2:end); 5 | Y = old_stps(:,2:end); 6 | k = size(Y,2); 7 | L = zeros(k); 8 | for j = 1:k 9 | for i = j+1:k 10 | L(i,j) = S(:,i)'*Y(:,j); 11 | end 12 | end 13 | D = diag(diag(S'*Y)); 14 | N = [S/Hdiag Y]; 15 | M = [S'*S/Hdiag L;L' -D]; 16 | 17 | ys = y'*s; 18 | Bs = s/Hdiag - N*(M\(N'*s)); % Product B*s 19 | sBs = s'*Bs; 20 | 21 | eta = .02; 22 | if ys < eta*sBs 23 | if debug 24 | fprintf('Damped Update\n'); 25 | end 26 | theta = min(max(0,((1-eta)*sBs)/(sBs - ys)),1); 27 | y = theta*y + (1-theta)*Bs; 28 | end 29 | 30 | 31 | numCorrections = size(old_dirs,2); 32 | if numCorrections < corrections 33 | % Full Update 34 | old_dirs(:,numCorrections+1) = s; 35 | old_stps(:,numCorrections+1) = y; 36 | else 37 | % Limited-Memory Update 38 | old_dirs = [old_dirs(:,2:corrections) s]; 39 | old_stps = [old_stps(:,2:corrections) y]; 40 | end 41 | 42 | % Update scale of initial Hessian approximation 43 | Hdiag = (y'*s)/(y'*y); -------------------------------------------------------------------------------- /features/flipfeat.m: -------------------------------------------------------------------------------- 1 | function f = flipfeat(f) 2 | % Horizontally flip HOG features (or filters). 3 | % f = flipfeat(f) 4 | % 5 | % Used for learning models with mirrored filters. 6 | % 7 | % Return value 8 | % f Output, flipped features 9 | % 10 | % Arguments 11 | % f Input features 12 | 13 | % AUTORIGHTS 14 | % ------------------------------------------------------- 15 | % Copyright (C) 2009-2012 Ross Girshick 16 | % 17 | % This file is part of the voc-releaseX code 18 | % (http://people.cs.uchicago.edu/~rbg/latent/) 19 | % and is available under the terms of an MIT-like license 20 | % provided in COPYING. Please retain this notice and 21 | % COPYING if you use this file (or a portion of it) in 22 | % your project. 23 | % ------------------------------------------------------- 24 | 25 | % flip permutation 26 | p = [10 9 8 7 6 5 4 3 2 ... % 1st set of contrast sensitive features 27 | 1 18 17 16 15 14 13 12 11 ... % 2nd set of contrast sensitive features 28 | 19 27 26 25 24 23 22 21 20 ... % Contrast insensitive features 29 | 30 31 28 29 ... % Gradient/texture energy features 30 | 32]; % Boundary truncation feature 31 | f = f(:,end:-1:1,p); 32 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/to_tuple.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_TO_TUPLE_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_TO_TUPLE_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_SEQ_TO_TUPLE */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_SEQ_TO_TUPLE(seq) (BOOST_PP_SEQ_ENUM(seq)) 22 | # else 23 | # define BOOST_PP_SEQ_TO_TUPLE(seq) BOOST_PP_SEQ_TO_TUPLE_I(seq) 24 | # define BOOST_PP_SEQ_TO_TUPLE_I(seq) (BOOST_PP_SEQ_ENUM(seq)) 25 | # endif 26 | # 27 | # endif 28 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/pop_front.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_POP_FRONT_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_POP_FRONT_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_SEQ_POP_FRONT */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_SEQ_POP_FRONT(seq) BOOST_PP_SEQ_TAIL(seq) 22 | # else 23 | # define BOOST_PP_SEQ_POP_FRONT(seq) BOOST_PP_SEQ_POP_FRONT_I(seq) 24 | # define BOOST_PP_SEQ_POP_FRONT_I(seq) BOOST_PP_SEQ_TAIL(seq) 25 | # endif 26 | # 27 | # endif 28 | -------------------------------------------------------------------------------- /external/boost/preprocessor/iteration/local.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ITERATION_LOCAL_HPP 13 | # define BOOST_PREPROCESSOR_ITERATION_LOCAL_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # 19 | # /* BOOST_PP_LOCAL_ITERATE */ 20 | # 21 | # define BOOST_PP_LOCAL_ITERATE() 22 | # 23 | # define BOOST_PP_LOCAL_C(n) (BOOST_PP_LOCAL_S) <= n && (BOOST_PP_LOCAL_F) >= n 24 | # define BOOST_PP_LOCAL_R(n) (BOOST_PP_LOCAL_F) <= n && (BOOST_PP_LOCAL_S) >= n 25 | # 26 | # endif 27 | -------------------------------------------------------------------------------- /utils/boxoverlap.m: -------------------------------------------------------------------------------- 1 | function o = boxoverlap(a, b) 2 | % Compute the symmetric intersection over union overlap between a set of 3 | % bounding boxes in a and a single bounding box in b. 4 | % 5 | % a a matrix where each row specifies a bounding box 6 | % b a single bounding box 7 | 8 | % AUTORIGHTS 9 | % ------------------------------------------------------- 10 | % Copyright (C) 2011-2012 Ross Girshick 11 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 12 | % 13 | % This file is part of the voc-releaseX code 14 | % (http://people.cs.uchicago.edu/~rbg/latent/) 15 | % and is available under the terms of an MIT-like license 16 | % provided in COPYING. Please retain this notice and 17 | % COPYING if you use this file (or a portion of it) in 18 | % your project. 19 | % ------------------------------------------------------- 20 | 21 | x1 = max(a(:,1), b(1)); 22 | y1 = max(a(:,2), b(2)); 23 | x2 = min(a(:,3), b(3)); 24 | y2 = min(a(:,4), b(4)); 25 | 26 | w = x2-x1+1; 27 | h = y2-y1+1; 28 | inter = w.*h; 29 | aarea = (a(:,3)-a(:,1)+1) .* (a(:,4)-a(:,2)+1); 30 | barea = (b(3)-b(1)+1) * (b(4)-b(2)+1); 31 | % intersection over union overlap 32 | o = inter ./ (aarea+barea-inter); 33 | % set invalid entries to 0 overlap 34 | o(w <= 0) = 0; 35 | o(h <= 0) = 0; 36 | -------------------------------------------------------------------------------- /COPYING.DPMv5: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011, 2012 Ross Girshick, Pedro Felzenszwalb 2 | Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 3 | Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /startup.m: -------------------------------------------------------------------------------- 1 | % AUTORIGHTS 2 | % ------------------------------------------------------- 3 | % Copyright (C) 2011-2012 Ross Girshick 4 | % 5 | % This file is part of the voc-releaseX code 6 | % (http://people.cs.uchicago.edu/~rbg/latent/) 7 | % and is available under the terms of an MIT-like license 8 | % provided in COPYING. Please retain this notice and 9 | % COPYING if you use this file (or a portion of it) in 10 | % your project. 11 | % ------------------------------------------------------- 12 | 13 | % Prepares your matlab workspace for using voc-release5. 14 | global G_STARTUP; 15 | 16 | if isempty(G_STARTUP) 17 | G_STARTUP = true; 18 | 19 | % Avoiding addpath(genpath('.')) because .git includes 20 | % a VERY large number of subdirectories, which makes 21 | % startup slow 22 | incl = {'bbox_pred', 'fv_cache', ... 23 | 'bin', 'gdetect', 'utils', ... 24 | 'model', 'features', 'vis', ... 25 | 'data', 'train', 'test', ... 26 | 'external', 'caffe/matlab/caffe', ... 27 | 'train/no_mirror_sharing', 'DeepPyramid'}; 28 | for i = 1:length(incl) 29 | addpath(incl{i}); 30 | end 31 | conf = voc_config(); 32 | fprintf('%s is set up\n', conf.version); 33 | clear conf i incl; 34 | end 35 | 36 | addpath(genpath('external/minConf')); 37 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array/data.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_DATA_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_DATA_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_ARRAY_DATA */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_ARRAY_DATA(array) BOOST_PP_TUPLE_ELEM(2, 1, array) 22 | # else 23 | # define BOOST_PP_ARRAY_DATA(array) BOOST_PP_ARRAY_DATA_I(array) 24 | # define BOOST_PP_ARRAY_DATA_I(array) BOOST_PP_ARRAY_DATA_II array 25 | # define BOOST_PP_ARRAY_DATA_II(size, data) data 26 | # endif 27 | # 28 | # endif 29 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array/size.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_SIZE_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_SIZE_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_ARRAY_SIZE */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_ARRAY_SIZE(array) BOOST_PP_TUPLE_ELEM(2, 0, array) 22 | # else 23 | # define BOOST_PP_ARRAY_SIZE(array) BOOST_PP_ARRAY_SIZE_I(array) 24 | # define BOOST_PP_ARRAY_SIZE_I(array) BOOST_PP_ARRAY_SIZE_II array 25 | # define BOOST_PP_ARRAY_SIZE_II(size, data) size 26 | # endif 27 | # 28 | # endif 29 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities/is_empty_or_1.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2003. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_OR_1_HPP 13 | # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_OR_1_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_IS_EMPTY_OR_1 */ 21 | # 22 | # define BOOST_PP_IS_EMPTY_OR_1(x) \ 23 | BOOST_PP_IIF( \ 24 | BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()), \ 25 | 1 BOOST_PP_EMPTY, \ 26 | BOOST_PP_IS_1 \ 27 | )(x) \ 28 | /**/ 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/wstringize.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_WSTRINGIZE_HPP 13 | # define BOOST_PREPROCESSOR_WSTRINGIZE_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_WSTRINGIZE */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_WSTRINGIZE(text) BOOST_PP_WSTRINGIZE_I(text) 21 | # else 22 | # define BOOST_PP_WSTRINGIZE(text) BOOST_PP_WSTRINGIZE_OO((text)) 23 | # define BOOST_PP_WSTRINGIZE_OO(par) BOOST_PP_WSTRINGIZE_I ## par 24 | # endif 25 | # 26 | # define BOOST_PP_WSTRINGIZE_I(text) BOOST_PP_WSTRINGIZE_II(#text) 27 | # define BOOST_PP_WSTRINGIZE_II(str) L ## str 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comparison/greater.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_COMPARISON_GREATER_HPP 15 | # define BOOST_PREPROCESSOR_COMPARISON_GREATER_HPP 16 | # 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_GREATER */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_GREATER(x, y) BOOST_PP_LESS(y, x) 24 | # else 25 | # define BOOST_PP_GREATER(x, y) BOOST_PP_GREATER_I(x, y) 26 | # define BOOST_PP_GREATER_I(x, y) BOOST_PP_LESS(y, x) 27 | # endif 28 | # 29 | # /* BOOST_PP_GREATER_D */ 30 | # 31 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 32 | # define BOOST_PP_GREATER_D(d, x, y) BOOST_PP_LESS_D(d, y, x) 33 | # else 34 | # define BOOST_PP_GREATER_D(d, x, y) BOOST_PP_GREATER_D_I(d, x, y) 35 | # define BOOST_PP_GREATER_D_I(d, x, y) BOOST_PP_LESS_D(d, y, x) 36 | # endif 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/to_array.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_TO_ARRAY_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_TO_ARRAY_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # 19 | # /* BOOST_PP_SEQ_TO_ARRAY */ 20 | # 21 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 22 | # define BOOST_PP_SEQ_TO_ARRAY(seq) (BOOST_PP_SEQ_SIZE(seq), (BOOST_PP_SEQ_ENUM(seq))) 23 | # else 24 | # define BOOST_PP_SEQ_TO_ARRAY(seq) BOOST_PP_SEQ_TO_ARRAY_I(seq) 25 | # define BOOST_PP_SEQ_TO_ARRAY_I(seq) (BOOST_PP_SEQ_SIZE(seq), (BOOST_PP_SEQ_ENUM(seq))) 26 | # endif 27 | # 28 | # endif 29 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # include 24 | # include 25 | # include 26 | # 27 | # endif 28 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/subseq.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_SUBSEQ_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_SUBSEQ_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # 19 | # /* BOOST_PP_SEQ_SUBSEQ */ 20 | # 21 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 22 | # define BOOST_PP_SEQ_SUBSEQ(seq, i, len) BOOST_PP_SEQ_FIRST_N(len, BOOST_PP_SEQ_REST_N(i, seq)) 23 | # else 24 | # define BOOST_PP_SEQ_SUBSEQ(seq, i, len) BOOST_PP_SEQ_SUBSEQ_I(seq, i, len) 25 | # define BOOST_PP_SEQ_SUBSEQ_I(seq, i, len) BOOST_PP_SEQ_FIRST_N(len, BOOST_PP_SEQ_REST_N(i, seq)) 26 | # endif 27 | # 28 | # endif 29 | -------------------------------------------------------------------------------- /vis/HOGpicture.m: -------------------------------------------------------------------------------- 1 | function im = HOGpicture(w, bs) 2 | % Make picture of positive HOG weights. 3 | % im = HOGpicture(w, bs) 4 | 5 | % AUTORIGHTS 6 | % ------------------------------------------------------- 7 | % Copyright (C) 2011-2012 Ross Girshick 8 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 9 | % Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 10 | % 11 | % This file is part of the voc-releaseX code 12 | % (http://people.cs.uchicago.edu/~rbg/latent/) 13 | % and is available under the terms of an MIT-like license 14 | % provided in COPYING. Please retain this notice and 15 | % COPYING if you use this file (or a portion of it) in 16 | % your project. 17 | % ------------------------------------------------------- 18 | 19 | % construct a "glyph" for each orientaion 20 | bim1 = zeros(bs, bs); 21 | bim1(:,round(bs/2):round(bs/2)+1) = 1; 22 | bim = zeros([size(bim1) 9]); 23 | bim(:,:,1) = bim1; 24 | for i = 2:9, 25 | bim(:,:,i) = imrotate(bim1, -(i-1)*20, 'crop'); 26 | end 27 | 28 | % make pictures of positive weights bs adding up weighted glyphs 29 | s = size(w); 30 | w(w < 0) = 0; 31 | im = zeros(bs*s(1), bs*s(2)); 32 | for i = 1:s(1), 33 | iis = (i-1)*bs+1:i*bs; 34 | for j = 1:s(2), 35 | jjs = (j-1)*bs+1:j*bs; 36 | for k = 1:9, 37 | im(iis,jjs) = im(iis,jjs) + bim(:,:,k) * w(i,j,k); 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /external/boost/preprocessor/control/expr_iif.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_CONTROL_EXPR_IIF_HPP 13 | # define BOOST_PREPROCESSOR_CONTROL_EXPR_IIF_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_EXPR_IIF */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_EXPR_IIF(bit, expr) BOOST_PP_EXPR_IIF_I(bit, expr) 21 | # else 22 | # define BOOST_PP_EXPR_IIF(bit, expr) BOOST_PP_EXPR_IIF_OO((bit, expr)) 23 | # define BOOST_PP_EXPR_IIF_OO(par) BOOST_PP_EXPR_IIF_I ## par 24 | # endif 25 | # 26 | # define BOOST_PP_EXPR_IIF_I(bit, expr) BOOST_PP_EXPR_IIF_ ## bit(expr) 27 | # 28 | # define BOOST_PP_EXPR_IIF_0(expr) 29 | # define BOOST_PP_EXPR_IIF_1(expr) expr 30 | # 31 | # endif 32 | -------------------------------------------------------------------------------- /external/boost/preprocessor/detail/is_unary.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DETAIL_IS_UNARY_HPP 13 | # define BOOST_PREPROCESSOR_DETAIL_IS_UNARY_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_IS_UNARY */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_IS_UNARY(x) BOOST_PP_CHECK(x, BOOST_PP_IS_UNARY_CHECK) 22 | # else 23 | # define BOOST_PP_IS_UNARY(x) BOOST_PP_IS_UNARY_I(x) 24 | # define BOOST_PP_IS_UNARY_I(x) BOOST_PP_CHECK(x, BOOST_PP_IS_UNARY_CHECK) 25 | # endif 26 | # 27 | # define BOOST_PP_IS_UNARY_CHECK(a) 1 28 | # define BOOST_PP_CHECK_RESULT_BOOST_PP_IS_UNARY_CHECK 0, BOOST_PP_NIL 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/insert.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_INSERT_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_INSERT_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # 19 | # /* BOOST_PP_SEQ_INSERT */ 20 | # 21 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 22 | # define BOOST_PP_SEQ_INSERT(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(i, seq) 23 | # else 24 | # define BOOST_PP_SEQ_INSERT(seq, i, elem) BOOST_PP_SEQ_INSERT_I(seq, i, elem) 25 | # define BOOST_PP_SEQ_INSERT_I(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(i, seq) 26 | # endif 27 | # 28 | # endif 29 | -------------------------------------------------------------------------------- /model/getopts.m: -------------------------------------------------------------------------------- 1 | function map = getopts(in, valid_keys) 2 | % Convert a cell array of alternating (key, value) pairs into a map. 3 | % map = getopts(in, valid_keys) 4 | % 5 | % Return value 6 | % map Map of (key, value) pairs from input in 7 | % 8 | % Arguments 9 | % in Cell array of alternating (key, value) pairs 10 | % valid_keys Valid keys that can be extracted from in 11 | 12 | % AUTORIGHTS 13 | % ------------------------------------------------------- 14 | % Copyright (C) 2009-2012 Ross Girshick 15 | % 16 | % This file is part of the voc-releaseX code 17 | % (http://people.cs.uchicago.edu/~rbg/latent/) 18 | % and is available under the terms of an MIT-like license 19 | % provided in COPYING. Please retain this notice and 20 | % COPYING if you use this file (or a portion of it) in 21 | % your project. 22 | % ------------------------------------------------------- 23 | 24 | map = containers.Map(); 25 | 26 | %for i = 1:2:length(defaults) 27 | % map(defaults{i}) = defaults{i+1}; 28 | %end 29 | 30 | if ~isempty(valid_keys) 31 | valid_keys = containers.Map(valid_keys, ... 32 | num2cell(ones(length(valid_keys), 1))); 33 | end 34 | 35 | for i = 1:2:length(in) 36 | key = in{i}; 37 | val = in{i+1}; 38 | if ~isempty(valid_keys) && ~valid_keys.isKey(key) 39 | error('invalid key: %s', key); 40 | end 41 | map(key) = val; 42 | end 43 | -------------------------------------------------------------------------------- /external/boost/preprocessor/detail/is_binary.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DETAIL_IS_BINARY_HPP 13 | # define BOOST_PREPROCESSOR_DETAIL_IS_BINARY_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_IS_BINARY */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_IS_BINARY(x) BOOST_PP_CHECK(x, BOOST_PP_IS_BINARY_CHECK) 22 | # else 23 | # define BOOST_PP_IS_BINARY(x) BOOST_PP_IS_BINARY_I(x) 24 | # define BOOST_PP_IS_BINARY_I(x) BOOST_PP_CHECK(x, BOOST_PP_IS_BINARY_CHECK) 25 | # endif 26 | # 27 | # define BOOST_PP_IS_BINARY_CHECK(a, b) 1 28 | # define BOOST_PP_CHECK_RESULT_BOOST_PP_IS_BINARY_CHECK 0, BOOST_PP_NIL 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/detail/is_nullary.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DETAIL_IS_NULLARY_HPP 13 | # define BOOST_PREPROCESSOR_DETAIL_IS_NULLARY_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_IS_NULLARY */ 19 | # 20 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 21 | # define BOOST_PP_IS_NULLARY(x) BOOST_PP_CHECK(x, BOOST_PP_IS_NULLARY_CHECK) 22 | # else 23 | # define BOOST_PP_IS_NULLARY(x) BOOST_PP_IS_NULLARY_I(x) 24 | # define BOOST_PP_IS_NULLARY_I(x) BOOST_PP_CHECK(x, BOOST_PP_IS_NULLARY_CHECK) 25 | # endif 26 | # 27 | # define BOOST_PP_IS_NULLARY_CHECK() 1 28 | # define BOOST_PP_CHECK_RESULT_BOOST_PP_IS_NULLARY_CHECK 0, BOOST_PP_NIL 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/to_tuple.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_TO_TUPLE_HPP 15 | # define BOOST_PREPROCESSOR_LIST_TO_TUPLE_HPP 16 | # 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_LIST_TO_TUPLE */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_LIST_TO_TUPLE(list) (BOOST_PP_LIST_ENUM(list)) 24 | # else 25 | # define BOOST_PP_LIST_TO_TUPLE(list) BOOST_PP_LIST_TO_TUPLE_I(list) 26 | # define BOOST_PP_LIST_TO_TUPLE_I(list) (BOOST_PP_LIST_ENUM(list)) 27 | # endif 28 | # 29 | # /* BOOST_PP_LIST_TO_TUPLE_R */ 30 | # 31 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 32 | # define BOOST_PP_LIST_TO_TUPLE_R(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) 33 | # else 34 | # define BOOST_PP_LIST_TO_TUPLE_R(r, list) BOOST_PP_LIST_TO_TUPLE_R_I(r, list) 35 | # define BOOST_PP_LIST_TO_TUPLE_R_I(r, list) (BOOST_PP_LIST_ENUM_R(r, list)) 36 | # endif 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/pop_back.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_POP_BACK_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_POP_BACK_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_SEQ_POP_BACK */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_SEQ_POP_BACK(seq) BOOST_PP_SEQ_FIRST_N(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), seq) 24 | # else 25 | # define BOOST_PP_SEQ_POP_BACK(seq) BOOST_PP_SEQ_POP_BACK_I(seq) 26 | # define BOOST_PP_SEQ_POP_BACK_I(seq) BOOST_PP_SEQ_FIRST_N(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), seq) 27 | # endif 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_HPP 15 | # define BOOST_PREPROCESSOR_LIST_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # include 24 | # include 25 | # include 26 | # include 27 | # include 28 | # include 29 | # include 30 | # include 31 | # include 32 | # include 33 | # include 34 | # 35 | # endif 36 | -------------------------------------------------------------------------------- /train/split.m: -------------------------------------------------------------------------------- 1 | function spos = split(pos, n) 2 | % Split examples based on aspect ratio. 3 | % spos = split(pos, n) 4 | % 5 | % Produces aspect ratio clusters for training mixture models 6 | % 7 | % Return value 8 | % spos Cell i holds the indices from pos for the i-th cluster 9 | % 10 | % Arguments 11 | % pos Positive examples from pascal_data.m 12 | % n Number of aspect ratio clusters 13 | 14 | % AUTORIGHTS 15 | % ------------------------------------------------------- 16 | % Copyright (C) 2011-2012 Ross Girshick 17 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 18 | % 19 | % This file is part of the voc-releaseX code 20 | % (http://people.cs.uchicago.edu/~rbg/latent/) 21 | % and is available under the terms of an MIT-like license 22 | % provided in COPYING. Please retain this notice and 23 | % COPYING if you use this file (or a portion of it) in 24 | % your project. 25 | % ------------------------------------------------------- 26 | 27 | h = [pos(:).y2]' - [pos(:).y1]' + 1; 28 | w = [pos(:).x2]' - [pos(:).x1]' + 1; 29 | aspects = h ./ w; 30 | aspects = sort(aspects); 31 | 32 | for i = 1:n+1 33 | j = ceil((i-1)*length(aspects)/n)+1; 34 | if j > length(pos) 35 | b(i) = inf; 36 | else 37 | b(i) = aspects(j); 38 | end 39 | end 40 | 41 | aspects = h ./ w; 42 | for i = 1:n 43 | I = find((aspects >= b(i)) .* (aspects < b(i+1))); 44 | spos{i} = pos(I); 45 | end 46 | -------------------------------------------------------------------------------- /vis/visualizeHOG.m: -------------------------------------------------------------------------------- 1 | function im = visualizeHOG(w, buff, bs) 2 | % Visualize HOG features/weights. 3 | % visualizeHOG(w) 4 | 5 | % AUTORIGHTS 6 | % ------------------------------------------------------- 7 | % Copyright (C) 2011-2012 Ross Girshick 8 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 9 | % Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 10 | % 11 | % This file is part of the voc-releaseX code 12 | % (http://people.cs.uchicago.edu/~rbg/latent/) 13 | % and is available under the terms of an MIT-like license 14 | % provided in COPYING. Please retain this notice and 15 | % COPYING if you use this file (or a portion of it) in 16 | % your project. 17 | % ------------------------------------------------------- 18 | 19 | % Make pictures of positive and negative weights 20 | if ~exist('bs', 'var') || isempty(bs) 21 | bs = 20; 22 | end 23 | w = w(:,:,1:9); 24 | scale = max(max(w(:)),max(-w(:))); 25 | pos = HOGpicture(w, bs) * 255/scale; 26 | neg = HOGpicture(-w, bs) * 255/scale; 27 | 28 | % Put pictures together and draw 29 | if ~exist('buff', 'var') || isempty(buff) 30 | buff = 10; 31 | end 32 | pos = padarray(pos, [buff buff], 128, 'both'); 33 | if min(w(:)) < 0 34 | neg = padarray(neg, [buff buff], 128, 'both'); 35 | im = uint8([pos; neg]); 36 | else 37 | im = uint8(pos); 38 | end 39 | if nargout == 0 40 | imagesc(im); 41 | colormap gray; 42 | axis equal; 43 | axis off; 44 | end 45 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/remove.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_REMOVE_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_REMOVE_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_SEQ_REMOVE */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_SEQ_REMOVE(seq, i) BOOST_PP_SEQ_FIRST_N(i, seq) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq) 24 | # else 25 | # define BOOST_PP_SEQ_REMOVE(seq, i) BOOST_PP_SEQ_REMOVE_I(seq, i) 26 | # define BOOST_PP_SEQ_REMOVE_I(seq, i) BOOST_PP_SEQ_FIRST_N(i, seq) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq) 27 | # endif 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comparison/greater_equal.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_COMPARISON_GREATER_EQUAL_HPP 15 | # define BOOST_PREPROCESSOR_COMPARISON_GREATER_EQUAL_HPP 16 | # 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_GREATER_EQUAL */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_GREATER_EQUAL(x, y) BOOST_PP_LESS_EQUAL(y, x) 24 | # else 25 | # define BOOST_PP_GREATER_EQUAL(x, y) BOOST_PP_GREATER_EQUAL_I(x, y) 26 | # define BOOST_PP_GREATER_EQUAL_I(x, y) BOOST_PP_LESS_EQUAL(y, x) 27 | # endif 28 | # 29 | # /* BOOST_PP_GREATER_EQUAL_D */ 30 | # 31 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 32 | # define BOOST_PP_GREATER_EQUAL_D(d, x, y) BOOST_PP_LESS_EQUAL_D(d, y, x) 33 | # else 34 | # define BOOST_PP_GREATER_EQUAL_D(d, x, y) BOOST_PP_GREATER_EQUAL_D_I(d, x, y) 35 | # define BOOST_PP_GREATER_EQUAL_D_I(d, x, y) BOOST_PP_LESS_EQUAL_D(d, y, x) 36 | # endif 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /external/boost/preprocessor/selection/max.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_SELECTION_MAX_HPP 15 | # define BOOST_PREPROCESSOR_SELECTION_MAX_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_MAX */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_MAX(x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL(x, y), y, x) 25 | # else 26 | # define BOOST_PP_MAX(x, y) BOOST_PP_MAX_I(x, y) 27 | # define BOOST_PP_MAX_I(x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL(x, y), y, x) 28 | # endif 29 | # 30 | # /* BOOST_PP_MAX_D */ 31 | # 32 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 33 | # define BOOST_PP_MAX_D(d, x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL_D(d, x, y), y, x) 34 | # else 35 | # define BOOST_PP_MAX_D(d, x, y) BOOST_PP_MAX_D_I(d, x, y) 36 | # define BOOST_PP_MAX_D_I(d, x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL_D(d, x, y), y, x) 37 | # endif 38 | # 39 | # endif 40 | -------------------------------------------------------------------------------- /external/boost/preprocessor/selection/min.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_SELECTION_MIN_HPP 15 | # define BOOST_PREPROCESSOR_SELECTION_MIN_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_MIN */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_MIN(x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL(y, x), y, x) 25 | # else 26 | # define BOOST_PP_MIN(x, y) BOOST_PP_MIN_I(x, y) 27 | # define BOOST_PP_MIN_I(x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL(y, x), y, x) 28 | # endif 29 | # 30 | # /* BOOST_PP_MIN_D */ 31 | # 32 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 33 | # define BOOST_PP_MIN_D(d, x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL_D(d, y, x), y, x) 34 | # else 35 | # define BOOST_PP_MIN_D(d, x, y) BOOST_PP_MIN_D_I(d, x, y) 36 | # define BOOST_PP_MIN_D_I(d, x, y) BOOST_PP_IIF(BOOST_PP_LESS_EQUAL_D(d, y, x), y, x) 37 | # endif 38 | # 39 | # endif 40 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array/elem.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_ELEM_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_ELEM_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_ARRAY_ELEM */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_ARRAY_ELEM(i, array) BOOST_PP_TUPLE_ELEM(BOOST_PP_ARRAY_SIZE(array), i, BOOST_PP_ARRAY_DATA(array)) 24 | # else 25 | # define BOOST_PP_ARRAY_ELEM(i, array) BOOST_PP_ARRAY_ELEM_I(i, array) 26 | # define BOOST_PP_ARRAY_ELEM_I(i, array) BOOST_PP_TUPLE_ELEM(BOOST_PP_ARRAY_SIZE(array), i, BOOST_PP_ARRAY_DATA(array)) 27 | # endif 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /model/model_get_block.m: -------------------------------------------------------------------------------- 1 | function w = model_get_block(m, obj) 2 | % Get parameters from a block. 3 | % w = model_get_block(m, obj) 4 | % 5 | % Return value 6 | % w Parameters (shaped) 7 | % 8 | % Arguments 9 | % m Object model 10 | % obj A struct with a blocklabel field 11 | 12 | % AUTORIGHTS 13 | % ------------------------------------------------------- 14 | % Copyright (C) 2009-2012 Ross Girshick 15 | % 16 | % This file is part of the voc-releaseX code 17 | % (http://people.cs.uchicago.edu/~rbg/latent/) 18 | % and is available under the terms of an MIT-like license 19 | % provided in COPYING. Please retain this notice and 20 | % COPYING if you use this file (or a portion of it) in 21 | % your project. 22 | % ------------------------------------------------------- 23 | 24 | % Backwards compatibility 25 | %if ~isfield(m, 'blocks') 26 | % w = obj.w; 27 | % return; 28 | %end 29 | 30 | bl = obj.blocklabel; 31 | shape = m.blocks(bl).shape; 32 | type = m.blocks(bl).type; 33 | w = reshape(m.blocks(bl).w, shape); 34 | 35 | % Flip (if needed) according to block type 36 | switch(type) 37 | case block_types.Filter 38 | if obj.flip 39 | w = flipfeat(w); 40 | end 41 | case block_types.PCAFilter 42 | if obj.flip 43 | w = reshape(m.blocks(bl).w_flipped, shape); 44 | end 45 | case block_types.SepQuadDef 46 | if obj.flip 47 | w(2) = -w(2); 48 | end 49 | %case block_types.Other 50 | end 51 | -------------------------------------------------------------------------------- /external/boost/preprocessor/arithmetic/div.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_ARITHMETIC_DIV_HPP 15 | # define BOOST_PREPROCESSOR_ARITHMETIC_DIV_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_DIV */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_DIV(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y)) 25 | # else 26 | # define BOOST_PP_DIV(x, y) BOOST_PP_DIV_I(x, y) 27 | # define BOOST_PP_DIV_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y)) 28 | # endif 29 | # 30 | # /* BOOST_PP_DIV_D */ 31 | # 32 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 33 | # define BOOST_PP_DIV_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y)) 34 | # else 35 | # define BOOST_PP_DIV_D(d, x, y) BOOST_PP_DIV_D_I(d, x, y) 36 | # define BOOST_PP_DIV_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y)) 37 | # endif 38 | # 39 | # endif 40 | -------------------------------------------------------------------------------- /external/boost/preprocessor/arithmetic/mod.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_ARITHMETIC_MOD_HPP 15 | # define BOOST_PREPROCESSOR_ARITHMETIC_MOD_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_MOD */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_MOD(x, y) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_DIV_BASE(x, y)) 25 | # else 26 | # define BOOST_PP_MOD(x, y) BOOST_PP_MOD_I(x, y) 27 | # define BOOST_PP_MOD_I(x, y) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_DIV_BASE(x, y)) 28 | # endif 29 | # 30 | # /* BOOST_PP_MOD_D */ 31 | # 32 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 33 | # define BOOST_PP_MOD_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_DIV_BASE_D(d, x, y)) 34 | # else 35 | # define BOOST_PP_MOD_D(d, x, y) BOOST_PP_MOD_D_I(d, x, y) 36 | # define BOOST_PP_MOD_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_DIV_BASE_D(d, x, y)) 37 | # endif 38 | # 39 | # endif 40 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/replace.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_REPLACE_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_REPLACE_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_SEQ_REPLACE */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq) 24 | # else 25 | # define BOOST_PP_SEQ_REPLACE(seq, i, elem) BOOST_PP_SEQ_REPLACE_I(seq, i, elem) 26 | # define BOOST_PP_SEQ_REPLACE_I(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(BOOST_PP_INC(i), seq) 27 | # endif 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /external/boost/preprocessor/comparison/less_equal.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_COMPARISON_LESS_EQUAL_HPP 15 | # define BOOST_PREPROCESSOR_COMPARISON_LESS_EQUAL_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_LESS_EQUAL */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_LESS_EQUAL(x, y) BOOST_PP_NOT(BOOST_PP_SUB(x, y)) 25 | # else 26 | # define BOOST_PP_LESS_EQUAL(x, y) BOOST_PP_LESS_EQUAL_I(x, y) 27 | # define BOOST_PP_LESS_EQUAL_I(x, y) BOOST_PP_NOT(BOOST_PP_SUB(x, y)) 28 | # endif 29 | # 30 | # /* BOOST_PP_LESS_EQUAL_D */ 31 | # 32 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 33 | # define BOOST_PP_LESS_EQUAL_D(d, x, y) BOOST_PP_NOT(BOOST_PP_SUB_D(d, x, y)) 34 | # else 35 | # define BOOST_PP_LESS_EQUAL_D(d, x, y) BOOST_PP_LESS_EQUAL_D_I(d, x, y) 36 | # define BOOST_PP_LESS_EQUAL_D_I(d, x, y) BOOST_PP_NOT(BOOST_PP_SUB_D(d, x, y)) 37 | # endif 38 | # 39 | # endif 40 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/compl.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LOGICAL_COMPL_HPP 13 | # define BOOST_PREPROCESSOR_LOGICAL_COMPL_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_COMPL */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_COMPL(x) BOOST_PP_COMPL_I(x) 21 | # else 22 | # define BOOST_PP_COMPL(x) BOOST_PP_COMPL_OO((x)) 23 | # define BOOST_PP_COMPL_OO(par) BOOST_PP_COMPL_I ## par 24 | # endif 25 | # 26 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 27 | # define BOOST_PP_COMPL_I(x) BOOST_PP_COMPL_ ## x 28 | # else 29 | # define BOOST_PP_COMPL_I(x) BOOST_PP_COMPL_ID(BOOST_PP_COMPL_ ## x) 30 | # define BOOST_PP_COMPL_ID(id) id 31 | # endif 32 | # 33 | # define BOOST_PP_COMPL_0 1 34 | # define BOOST_PP_COMPL_1 0 35 | # 36 | # endif 37 | -------------------------------------------------------------------------------- /features/loc_feat.m: -------------------------------------------------------------------------------- 1 | function f = loc_feat(model, num_levels) 2 | % Location and scale features. 3 | % f = loc_feat(model, num_levels) 4 | % 5 | % Compute a feature indicating if level i is in the first octave of 6 | % the feature pyramid, the second octave, or above. This could be 7 | % generalized to a "location feature" instead of just a scale feature. 8 | % 9 | % Return value 10 | % f = [f_1, ..., f_i, ..., f_num_levels], 11 | % where f_i is the 3x1 vector = 12 | % [1; 0; 0] if 1 <= i <= model.interval 13 | % [0; 1; 0] if model.interval+1 <= i <= 2*model.interval 14 | % [0; 0; 1] if 2*model.interval+1 <= i <= num_levels 15 | % 16 | % Arguments 17 | % model Model used for detection 18 | % num_levels Number of levels in the feature pyramid 19 | 20 | % AUTORIGHTS 21 | % ------------------------------------------------------- 22 | % Copyright (C) 2009-2012 Ross Girshick 23 | % 24 | % This file is part of the voc-releaseX code 25 | % (http://people.cs.uchicago.edu/~rbg/latent/) 26 | % and is available under the terms of an MIT-like license 27 | % provided in COPYING. Please retain this notice and 28 | % COPYING if you use this file (or a portion of it) in 29 | % your project. 30 | % ------------------------------------------------------- 31 | 32 | f = zeros(3, num_levels); 33 | 34 | b = 1; 35 | e = min(num_levels, model.interval); 36 | f(1, b:e) = 1; 37 | 38 | b = e+1; 39 | e = min(num_levels, 2*e); 40 | f(2, b:e) = 1; 41 | 42 | b = e+1; 43 | f(3, b:end) = 1; 44 | -------------------------------------------------------------------------------- /external/boost/preprocessor/control/iif.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_CONTROL_IIF_HPP 13 | # define BOOST_PREPROCESSOR_CONTROL_IIF_HPP 14 | # 15 | # include 16 | # 17 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 18 | # define BOOST_PP_IIF(bit, t, f) BOOST_PP_IIF_I(bit, t, f) 19 | # else 20 | # define BOOST_PP_IIF(bit, t, f) BOOST_PP_IIF_OO((bit, t, f)) 21 | # define BOOST_PP_IIF_OO(par) BOOST_PP_IIF_I ## par 22 | # endif 23 | # 24 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 25 | # define BOOST_PP_IIF_I(bit, t, f) BOOST_PP_IIF_ ## bit(t, f) 26 | # else 27 | # define BOOST_PP_IIF_I(bit, t, f) BOOST_PP_IIF_II(BOOST_PP_IIF_ ## bit(t, f)) 28 | # define BOOST_PP_IIF_II(id) id 29 | # endif 30 | # 31 | # define BOOST_PP_IIF_0(t, f) f 32 | # define BOOST_PP_IIF_1(t, f) t 33 | # 34 | # endif 35 | -------------------------------------------------------------------------------- /features/precompute_feat_pyramids.m: -------------------------------------------------------------------------------- 1 | function precompute_feat_pyramids() 2 | 3 | conf = voc_config(); 4 | VOCopts = conf.pascal.VOCopts; 5 | 6 | ids = textread(sprintf(VOCopts.imgsetpath, 'trainval'), '%s'); 7 | num_in_trainval = length(ids); 8 | ids = cat(1, ids, textread(sprintf(VOCopts.imgsetpath, 'test'), '%s')); 9 | 10 | model = model_create('dummy', []); 11 | model = model_cnn_init(model); 12 | cache_dir = get_feat_cache_dir(); 13 | 14 | for i = 1:length(ids) 15 | fprintf('%d/%d\n', i, length(ids)); 16 | 17 | cache_file = [cache_dir '/' ids{i} '.mat']; 18 | if ~exist(cache_file, 'file') 19 | im = imread(sprintf(VOCopts.imgpath, ids{i})); 20 | th = tic(); 21 | pyra = deep_pyramid(im, model.cnn); 22 | fprintf(' [pyra: %.3fs]\n', toc(th)); 23 | th = tic(); 24 | save(cache_file, 'pyra'); 25 | fprintf(' [saving: %.3fs]\n', toc(th)); 26 | else 27 | fprintf(' [already exists]\n'); 28 | end 29 | 30 | if i <= num_in_trainval 31 | cache_file = [cache_dir '/' ids{i} '_flipped.mat']; 32 | if ~exist(cache_file, 'file') 33 | im = imread(sprintf(VOCopts.imgpath, ids{i})); 34 | im = im(:, end:-1:1, :); 35 | th = tic(); 36 | pyra = deep_pyramid(im, model.cnn); 37 | fprintf(' [pyra (flipped): %.3fs]\n', toc(th)); 38 | th = tic(); 39 | save(cache_file, 'pyra'); 40 | fprintf(' [saving (flipped): %.3fs]\n', toc(th)); 41 | else 42 | fprintf(' [already exists (flipped)]\n'); 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /external/boost/preprocessor/slot/slot.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SLOT_SLOT_HPP 13 | # define BOOST_PREPROCESSOR_SLOT_SLOT_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_ASSIGN_SLOT */ 19 | # 20 | # define BOOST_PP_ASSIGN_SLOT(i) BOOST_PP_CAT(BOOST_PP_ASSIGN_SLOT_, i) 21 | # 22 | # define BOOST_PP_ASSIGN_SLOT_1 23 | # define BOOST_PP_ASSIGN_SLOT_2 24 | # define BOOST_PP_ASSIGN_SLOT_3 25 | # define BOOST_PP_ASSIGN_SLOT_4 26 | # define BOOST_PP_ASSIGN_SLOT_5 27 | # 28 | # /* BOOST_PP_SLOT */ 29 | # 30 | # define BOOST_PP_SLOT(i) BOOST_PP_CAT(BOOST_PP_SLOT_, i)() 31 | # 32 | # endif 33 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array/reverse.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_REVERSE_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_REVERSE_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_ARRAY_REVERSE */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_ARRAY_REVERSE(array) (BOOST_PP_ARRAY_SIZE(array), BOOST_PP_TUPLE_REVERSE(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array))) 24 | # else 25 | # define BOOST_PP_ARRAY_REVERSE(array) BOOST_PP_ARRAY_REVERSE_I(array) 26 | # define BOOST_PP_ARRAY_REVERSE_I(array) (BOOST_PP_ARRAY_SIZE(array), BOOST_PP_TUPLE_REVERSE(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array))) 27 | # endif 28 | # 29 | # endif 30 | -------------------------------------------------------------------------------- /utils/five2four.m: -------------------------------------------------------------------------------- 1 | function m = five2four(m) 2 | % m = five2four(m) 3 | % 4 | % Convert a model from the release5 format to the release4 format. 5 | % NOTE: The release5 model run in the release5 code will be slightly 6 | % different than the converted model run in the release4 code. Don't 7 | % expect their performance to be exactly the same. 8 | 9 | % AUTORIGHTS 10 | % ------------------------------------------------------- 11 | % Copyright (C) 2009-2012 Ross Girshick 12 | % 13 | % This file is part of the voc-releaseX code 14 | % (http://people.cs.uchicago.edu/~rbg/latent/) 15 | % and is available under the terms of an MIT-like license 16 | % provided in COPYING. Please retain this notice and 17 | % COPYING if you use this file (or a portion of it) in 18 | % your project. 19 | % ------------------------------------------------------- 20 | 21 | fprintf(['\n\n' ... 22 | 'This will convert a model trained with voc-release5\n' ... 23 | 'to the voc-release4 format. Note that detection results\n' ... 24 | 'when run in release4 will be slightly different than\n' ... 25 | 'when run in release5.\n\n']); 26 | input('OK? Press return to continue.'); 27 | 28 | m = model_attach_weights(m); 29 | 30 | for i = 1:m.numsymbols 31 | m.symbols(i).i = i; 32 | end 33 | 34 | for i = 1:length(m.rules) 35 | for j = 1:length(m.rules{i}) 36 | if isfield(m.rules{i}(j), 'offset') 37 | m.rules{i}(j).offset.w = ... 38 | m.rules{i}(j).offset.w * m.features.bias; 39 | end 40 | end 41 | end 42 | 43 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/fold_right.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_FOLD_RIGHT_HPP 15 | # define BOOST_PREPROCESSOR_LIST_FOLD_RIGHT_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # 22 | # if 0 23 | # define BOOST_PP_LIST_FOLD_RIGHT(op, state, list) 24 | # endif 25 | # 26 | # define BOOST_PP_LIST_FOLD_RIGHT BOOST_PP_CAT(BOOST_PP_LIST_FOLD_RIGHT_, BOOST_PP_AUTO_REC(BOOST_PP_WHILE_P, 256)) 27 | # 28 | # define BOOST_PP_LIST_FOLD_RIGHT_257(o, s, l) BOOST_PP_ERROR(0x0004) 29 | # 30 | # define BOOST_PP_LIST_FOLD_RIGHT_D(d, o, s, l) BOOST_PP_LIST_FOLD_RIGHT_ ## d(o, s, l) 31 | # define BOOST_PP_LIST_FOLD_RIGHT_2ND BOOST_PP_LIST_FOLD_RIGHT 32 | # define BOOST_PP_LIST_FOLD_RIGHT_2ND_D BOOST_PP_LIST_FOLD_RIGHT_D 33 | # 34 | # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 35 | # include 36 | # else 37 | # include 38 | # endif 39 | # 40 | # endif 41 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/rest_n.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_REST_N_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_REST_N_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_SEQ_REST_N */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), (nil) seq BOOST_PP_EMPTY))() 25 | # else 26 | # define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_SEQ_REST_N_I(n, seq) 27 | # define BOOST_PP_SEQ_REST_N_I(n, seq) BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), (nil) seq BOOST_PP_EMPTY))() 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/seq/first_n.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_SEQ_FIRST_N_HPP 13 | # define BOOST_PREPROCESSOR_SEQ_FIRST_N_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_SEQ_FIRST_N */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_SEQ_FIRST_N(n, seq) BOOST_PP_IF(n, BOOST_PP_TUPLE_ELEM, BOOST_PP_TUPLE_EAT_3)(2, 0, BOOST_PP_SEQ_SPLIT(n, seq (nil))) 25 | # else 26 | # define BOOST_PP_SEQ_FIRST_N(n, seq) BOOST_PP_SEQ_FIRST_N_I(n, seq) 27 | # define BOOST_PP_SEQ_FIRST_N_I(n, seq) BOOST_PP_IF(n, BOOST_PP_TUPLE_ELEM, BOOST_PP_TUPLE_EAT_3)(2, 0, BOOST_PP_SEQ_SPLIT(n, seq (nil))) 28 | # endif 29 | # 30 | # endif 31 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/at.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_AT_HPP 15 | # define BOOST_PREPROCESSOR_LIST_AT_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_LIST_AT */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_LIST_AT(list, index) BOOST_PP_LIST_FIRST(BOOST_PP_LIST_REST_N(index, list)) 25 | # else 26 | # define BOOST_PP_LIST_AT(list, index) BOOST_PP_LIST_AT_I(list, index) 27 | # define BOOST_PP_LIST_AT_I(list, index) BOOST_PP_LIST_FIRST(BOOST_PP_LIST_REST_N(index, list)) 28 | # endif 29 | # 30 | # /* BOOST_PP_LIST_AT_D */ 31 | # 32 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 33 | # define BOOST_PP_LIST_AT_D(d, list, index) BOOST_PP_LIST_FIRST(BOOST_PP_LIST_REST_N_D(d, index, list)) 34 | # else 35 | # define BOOST_PP_LIST_AT_D(d, list, index) BOOST_PP_LIST_AT_D_I(d, list, index) 36 | # define BOOST_PP_LIST_AT_D_I(d, list, index) BOOST_PP_LIST_FIRST(BOOST_PP_LIST_REST_N_D(d, index, list)) 37 | # endif 38 | # 39 | # endif 40 | -------------------------------------------------------------------------------- /utils/report_cmp.m: -------------------------------------------------------------------------------- 1 | function report_cmp(dir1, suffix1, dir2, suffix2) 2 | % Compare two different result sets. 3 | 4 | % AUTORIGHTS 5 | % ------------------------------------------------------- 6 | % Copyright (C) 2009-2012 Ross Girshick 7 | % 8 | % This file is part of the voc-releaseX code 9 | % (http://people.cs.uchicago.edu/~rbg/latent/) 10 | % and is available under the terms of an MIT-like license 11 | % provided in COPYING. Please retain this notice and 12 | % COPYING if you use this file (or a portion of it) in 13 | % your project. 14 | % ------------------------------------------------------- 15 | 16 | conf = voc_config(); 17 | 18 | count1 = 0; 19 | count2 = 0; 20 | for i=1:length(conf.pascal.VOCopts.classes) 21 | cls = conf.pascal.VOCopts.classes{i}; 22 | try 23 | load([dir1 cls suffix1]); 24 | ap1 = ap; 25 | load([dir2 cls suffix2]); 26 | ap2 = ap; 27 | fprintf('%12s %.3f -> %.3f\tdiff = %6.3f\n', cls, ap1, ap2, ap2-ap1); 28 | score1(i) = ap1; 29 | score2(i) = ap2; 30 | catch 31 | score1(i) = 0; 32 | score2(i) = 0; 33 | fprintf('%12s -\n', cls); 34 | end 35 | end 36 | count1 = sum(score1 > 0); 37 | count2 = sum(score2 > 0); 38 | a1 = sum(score1)/count1; 39 | a2 = sum(score2)/count2; 40 | fprintf('%s\n', repmat('-', [1 12])); 41 | fprintf('%12s %.3f -> %.3f\tdiff = %6.3f\n', 'mAP', a1, a2, a2-a1); 42 | 43 | % remove missing data points 44 | score1(score1 == 0) = []; 45 | score2(score2 == 0) = []; 46 | p = rndtest(score1', score2'); 47 | fprintf('\nRandomized paired t-test: p value = %.4f\n', p); 48 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/append.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_APPEND_HPP 15 | # define BOOST_PREPROCESSOR_LIST_APPEND_HPP 16 | # 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_LIST_APPEND */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_LIST_APPEND(a, b) BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_APPEND_O, b, a) 24 | # else 25 | # define BOOST_PP_LIST_APPEND(a, b) BOOST_PP_LIST_APPEND_I(a, b) 26 | # define BOOST_PP_LIST_APPEND_I(a, b) BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_APPEND_O, b, a) 27 | # endif 28 | # 29 | # define BOOST_PP_LIST_APPEND_O(d, s, x) (x, s) 30 | # 31 | # /* BOOST_PP_LIST_APPEND_D */ 32 | # 33 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 34 | # define BOOST_PP_LIST_APPEND_D(d, a, b) BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_APPEND_O, b, a) 35 | # else 36 | # define BOOST_PP_LIST_APPEND_D(d, a, b) BOOST_PP_LIST_APPEND_D_I(d, a, b) 37 | # define BOOST_PP_LIST_APPEND_D_I(d, a, b) BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_APPEND_O, b, a) 38 | # endif 39 | # 40 | # endif 41 | -------------------------------------------------------------------------------- /gdetect/write_zero_fv.m: -------------------------------------------------------------------------------- 1 | function write_zero_fv(from_pos, key) 2 | % Write a zero vector to the feature vector cache. 3 | % write_zero_fv(from_pos, key) 4 | % 5 | % Arguments 6 | % from_pos True if the zero vector is to be used as the background output 7 | % feature vector for a foreground example 8 | % False if the zero vector is to be used as the belief feature 9 | % vector for a background example 10 | % key Feature vector cache key (see fv_cache.h and gdetect_write.m) 11 | 12 | % AUTORIGHTS 13 | % ------------------------------------------------------- 14 | % Copyright (C) 2011-2012 Ross Girshick 15 | % 16 | % This file is part of the voc-releaseX code 17 | % (http://people.cs.uchicago.edu/~rbg/latent/) 18 | % and is available under the terms of an MIT-like license 19 | % provided in COPYING. Please retain this notice and 20 | % COPYING if you use this file (or a portion of it) in 21 | % your project. 22 | % ------------------------------------------------------- 23 | 24 | if from_pos 25 | % The zero vector is being used as the feature vector associated with the 26 | % background output for a foreground example 27 | loss = 1; 28 | is_mined = 0; 29 | is_belief = 0; 30 | else 31 | % The zero vector is being used as the feature vector associated with the 32 | % belief for a background example 33 | loss = 0; 34 | is_mined = 1; 35 | is_belief = 1; 36 | end 37 | 38 | byte_size = fv_cache('add', int32(key), int32([]), single([]), ... 39 | int32(is_belief), int32(is_mined), loss); 40 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/bitor.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LOGICAL_BITOR_HPP 13 | # define BOOST_PREPROCESSOR_LOGICAL_BITOR_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_BITOR */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_BITOR(x, y) BOOST_PP_BITOR_I(x, y) 21 | # else 22 | # define BOOST_PP_BITOR(x, y) BOOST_PP_BITOR_OO((x, y)) 23 | # define BOOST_PP_BITOR_OO(par) BOOST_PP_BITOR_I ## par 24 | # endif 25 | # 26 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 27 | # define BOOST_PP_BITOR_I(x, y) BOOST_PP_BITOR_ ## x ## y 28 | # else 29 | # define BOOST_PP_BITOR_I(x, y) BOOST_PP_BITOR_ID(BOOST_PP_BITOR_ ## x ## y) 30 | # define BOOST_PP_BITOR_ID(id) id 31 | # endif 32 | # 33 | # define BOOST_PP_BITOR_00 0 34 | # define BOOST_PP_BITOR_01 1 35 | # define BOOST_PP_BITOR_10 1 36 | # define BOOST_PP_BITOR_11 1 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /test/nms_iou.m: -------------------------------------------------------------------------------- 1 | function pick = nms(boxes, overlap) 2 | % top = nms(boxes, overlap) 3 | % Non-maximum suppression. (FAST VERSION) 4 | % Greedily select high-scoring detections and skip detections 5 | % that are significantly covered by a previously selected 6 | % detection. 7 | % 8 | % NOTE: This is adapted from Pedro Felzenszwalb's version (nms.m), 9 | % but an inner loop has been eliminated to significantly speed it 10 | % up in the case of a large number of boxes 11 | 12 | % Copyright (C) 2011-12 by Tomasz Malisiewicz 13 | % All rights reserved. 14 | % 15 | % This file is part of the Exemplar-SVM library and is made 16 | % available under the terms of the MIT license (see COPYING file). 17 | % Project homepage: https://github.com/quantombone/exemplarsvm 18 | 19 | 20 | if isempty(boxes) 21 | pick = []; 22 | return; 23 | end 24 | 25 | x1 = boxes(:,1); 26 | y1 = boxes(:,2); 27 | x2 = boxes(:,3); 28 | y2 = boxes(:,4); 29 | s = boxes(:,end); 30 | 31 | area = (x2-x1+1) .* (y2-y1+1); 32 | [vals, I] = sort(s); 33 | 34 | pick = s*0; 35 | counter = 1; 36 | while ~isempty(I) 37 | last = length(I); 38 | i = I(last); 39 | pick(counter) = i; 40 | counter = counter + 1; 41 | 42 | xx1 = max(x1(i), x1(I(1:last-1))); 43 | yy1 = max(y1(i), y1(I(1:last-1))); 44 | xx2 = min(x2(i), x2(I(1:last-1))); 45 | yy2 = min(y2(i), y2(I(1:last-1))); 46 | 47 | w = max(0.0, xx2-xx1+1); 48 | h = max(0.0, yy2-yy1+1); 49 | 50 | inter = w.*h; 51 | o = inter ./ (area(i) + area(I(1:last-1)) - inter); 52 | 53 | I = I(find(o<=overlap)); 54 | end 55 | 56 | pick = pick(1:(counter-1)); 57 | -------------------------------------------------------------------------------- /external/boost/preprocessor/debug/assert.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_DEBUG_ASSERT_HPP 15 | # define BOOST_PREPROCESSOR_DEBUG_ASSERT_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # 23 | # /* BOOST_PP_ASSERT */ 24 | # 25 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 26 | # define BOOST_PP_ASSERT BOOST_PP_ASSERT_D 27 | # else 28 | # define BOOST_PP_ASSERT(cond) BOOST_PP_ASSERT_D(cond) 29 | # endif 30 | # 31 | # define BOOST_PP_ASSERT_D(cond) BOOST_PP_IIF(BOOST_PP_NOT(cond), BOOST_PP_ASSERT_ERROR, BOOST_PP_TUPLE_EAT_1)(...) 32 | # define BOOST_PP_ASSERT_ERROR(x, y, z) 33 | # 34 | # /* BOOST_PP_ASSERT_MSG */ 35 | # 36 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 37 | # define BOOST_PP_ASSERT_MSG BOOST_PP_ASSERT_MSG_D 38 | # else 39 | # define BOOST_PP_ASSERT_MSG(cond, msg) BOOST_PP_ASSERT_MSG_D(cond, msg) 40 | # endif 41 | # 42 | # define BOOST_PP_ASSERT_MSG_D(cond, msg) BOOST_PP_EXPR_IIF(BOOST_PP_NOT(cond), msg) 43 | # 44 | # endif 45 | -------------------------------------------------------------------------------- /gdetect/post_pad.cc: -------------------------------------------------------------------------------- 1 | // AUTORIGHTS 2 | // ------------------------------------------------------- 3 | // Copyright (C) 2011-2012 Ross Girshick 4 | // 5 | // This file is part of the voc-releaseX code 6 | // (http://people.cs.uchicago.edu/~rbg/latent/) 7 | // and is available under the terms of an MIT-like license 8 | // provided in COPYING. Please retain this notice and 9 | // COPYING if you use this file (or a portion of it) in 10 | // your project. 11 | // ------------------------------------------------------- 12 | 13 | #include "mex.h" 14 | #include 15 | 16 | using namespace std; 17 | 18 | // matlab entry point 19 | // B = post_pad(A, pady, padx, val) 20 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { 21 | const double pady = mxGetScalar(prhs[1]); 22 | const double padx = mxGetScalar(prhs[2]); 23 | const double val = mxGetScalar(prhs[3]); 24 | const mwSize *A_dims = mxGetDimensions(prhs[0]); 25 | const mwSize B_dims[] = { A_dims[0] + pady, A_dims[1] + padx }; 26 | mxArray *mx_B = mxCreateNumericArray(2, B_dims, mxDOUBLE_CLASS, mxREAL); 27 | double *B = (double *)mxGetPr(mx_B); 28 | const double *A = (double *)mxGetPr(prhs[0]); 29 | 30 | // Fill each column 31 | for (int x = 0; x < A_dims[1]; x++) { 32 | double *B_col = B + x*B_dims[0]; 33 | const double *A_col = A + x*A_dims[0]; 34 | copy(A_col, A_col+A_dims[0], B_col); 35 | 36 | if (pady > 0) 37 | fill(B_col+A_dims[0], B_col+B_dims[0], val); 38 | } 39 | 40 | fill(B + A_dims[1]*B_dims[0], B+B_dims[0]*B_dims[1], val); 41 | 42 | plhs[0] = mx_B; 43 | } 44 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/bitand.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LOGICAL_BITAND_HPP 13 | # define BOOST_PREPROCESSOR_LOGICAL_BITAND_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_BITAND */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_BITAND(x, y) BOOST_PP_BITAND_I(x, y) 21 | # else 22 | # define BOOST_PP_BITAND(x, y) BOOST_PP_BITAND_OO((x, y)) 23 | # define BOOST_PP_BITAND_OO(par) BOOST_PP_BITAND_I ## par 24 | # endif 25 | # 26 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 27 | # define BOOST_PP_BITAND_I(x, y) BOOST_PP_BITAND_ ## x ## y 28 | # else 29 | # define BOOST_PP_BITAND_I(x, y) BOOST_PP_BITAND_ID(BOOST_PP_BITAND_ ## x ## y) 30 | # define BOOST_PP_BITAND_ID(res) res 31 | # endif 32 | # 33 | # define BOOST_PP_BITAND_00 0 34 | # define BOOST_PP_BITAND_01 0 35 | # define BOOST_PP_BITAND_10 0 36 | # define BOOST_PP_BITAND_11 1 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/bitnor.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LOGICAL_BITNOR_HPP 13 | # define BOOST_PREPROCESSOR_LOGICAL_BITNOR_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_BITNOR */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_BITNOR(x, y) BOOST_PP_BITNOR_I(x, y) 21 | # else 22 | # define BOOST_PP_BITNOR(x, y) BOOST_PP_BITNOR_OO((x, y)) 23 | # define BOOST_PP_BITNOR_OO(par) BOOST_PP_BITNOR_I ## par 24 | # endif 25 | # 26 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 27 | # define BOOST_PP_BITNOR_I(x, y) BOOST_PP_BITNOR_ ## x ## y 28 | # else 29 | # define BOOST_PP_BITNOR_I(x, y) BOOST_PP_BITNOR_ID(BOOST_PP_BITNOR_ ## x ## y) 30 | # define BOOST_PP_BITNOR_ID(id) id 31 | # endif 32 | # 33 | # define BOOST_PP_BITNOR_00 1 34 | # define BOOST_PP_BITNOR_01 0 35 | # define BOOST_PP_BITNOR_10 0 36 | # define BOOST_PP_BITNOR_11 0 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /external/boost/preprocessor/logical/bitxor.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LOGICAL_BITXOR_HPP 13 | # define BOOST_PREPROCESSOR_LOGICAL_BITXOR_HPP 14 | # 15 | # include 16 | # 17 | # /* BOOST_PP_BITXOR */ 18 | # 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 20 | # define BOOST_PP_BITXOR(x, y) BOOST_PP_BITXOR_I(x, y) 21 | # else 22 | # define BOOST_PP_BITXOR(x, y) BOOST_PP_BITXOR_OO((x, y)) 23 | # define BOOST_PP_BITXOR_OO(par) BOOST_PP_BITXOR_I ## par 24 | # endif 25 | # 26 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 27 | # define BOOST_PP_BITXOR_I(x, y) BOOST_PP_BITXOR_ ## x ## y 28 | # else 29 | # define BOOST_PP_BITXOR_I(x, y) BOOST_PP_BITXOR_ID(BOOST_PP_BITXOR_ ## x ## y) 30 | # define BOOST_PP_BITXOR_ID(id) id 31 | # endif 32 | # 33 | # define BOOST_PP_BITXOR_00 0 34 | # define BOOST_PP_BITXOR_01 1 35 | # define BOOST_PP_BITXOR_10 1 36 | # define BOOST_PP_BITXOR_11 0 37 | # 38 | # endif 39 | -------------------------------------------------------------------------------- /train/subarray.m: -------------------------------------------------------------------------------- 1 | function B = subarray(A, i1, i2, j1, j2, pad) 2 | % Extract a subarray from an array. 3 | % B = subarray(A, i1, i2, j1, j2, pad) 4 | % 5 | % Return value 6 | % B Output subarray of A 7 | % 8 | % Arguments 9 | % A Input array 10 | % i1 Start row (inclusive) 11 | % i2 End row (incl.) 12 | % j1 Start column (incl.) 13 | % j2 End column (incl.) 14 | % pad true => pad with boundary values 15 | % false => pad with zeros 16 | 17 | % AUTORIGHTS 18 | % ------------------------------------------------------- 19 | % Copyright (C) 2011-2012 Ross Girshick 20 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 21 | % Copyright (C) 2007 Pedro Felzenszwalb, Deva Ramanan 22 | % 23 | % This file is part of the voc-releaseX code 24 | % (http://people.cs.uchicago.edu/~rbg/latent/) 25 | % and is available under the terms of an MIT-like license 26 | % provided in COPYING. Please retain this notice and 27 | % COPYING if you use this file (or a portion of it) in 28 | % your project. 29 | % ------------------------------------------------------- 30 | 31 | dim = size(A); 32 | 33 | i1c = max(i1, 1); 34 | i2c = min(i2, dim(1)); 35 | j1c = max(j1, 1); 36 | j2c = min(j2, dim(2)); 37 | 38 | B = A(i1c:i2c, j1c:j2c, :); 39 | 40 | ipad1 = i1c - i1; 41 | jpad1 = j1c - j1; 42 | ipad2 = i2 - i2c; 43 | jpad2 = j2 - j2c; 44 | 45 | if pad 46 | B = padarray(B, [ipad1 jpad1], 'replicate', 'pre'); 47 | B = padarray(B, [ipad2 jpad2], 'replicate', 'post'); 48 | else 49 | B = padarray(B, [ipad1 jpad1], 0, 'pre'); 50 | B = padarray(B, [ipad2 jpad2], 0, 'post'); 51 | end 52 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/reverse.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_REVERSE_HPP 15 | # define BOOST_PREPROCESSOR_LIST_REVERSE_HPP 16 | # 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_LIST_REVERSE */ 21 | # 22 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_LIST_REVERSE(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) 24 | # else 25 | # define BOOST_PP_LIST_REVERSE(list) BOOST_PP_LIST_REVERSE_I(list) 26 | # define BOOST_PP_LIST_REVERSE_I(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) 27 | # endif 28 | # 29 | # define BOOST_PP_LIST_REVERSE_O(d, s, x) (x, s) 30 | # 31 | # /* BOOST_PP_LIST_REVERSE_D */ 32 | # 33 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 34 | # define BOOST_PP_LIST_REVERSE_D(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) 35 | # else 36 | # define BOOST_PP_LIST_REVERSE_D(d, list) BOOST_PP_LIST_REVERSE_D_I(d, list) 37 | # define BOOST_PP_LIST_REVERSE_D_I(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) 38 | # endif 39 | # 40 | # endif 41 | -------------------------------------------------------------------------------- /model/model_sort.m: -------------------------------------------------------------------------------- 1 | function [L, V] = model_sort(m, i, L, V) 2 | % Topological sort of the nonterminal symbols in m's grammar. 3 | % [L, V] = model_sort(m, i, L, V) 4 | % 5 | % Return values 6 | % L Symbols visited in post order 7 | % V (internal use) Symbol visitation status 8 | % 9 | % Arguments 10 | % m Object model 11 | % i (internal use) Current symbol 12 | % L (internal use) Symbols visited thus far in post order 13 | % V (internal use) Symbol visitation status thus far 14 | 15 | % AUTORIGHTS 16 | % ------------------------------------------------------- 17 | % Copyright (C) 2009-2012 Ross Girshick 18 | % 19 | % This file is part of the voc-releaseX code 20 | % (http://people.cs.uchicago.edu/~rbg/latent/) 21 | % and is available under the terms of an MIT-like license 22 | % provided in COPYING. Please retain this notice and 23 | % COPYING if you use this file (or a portion of it) in 24 | % your project. 25 | % ------------------------------------------------------- 26 | 27 | % initialize depth-first search at start symbol 28 | if nargin < 2 29 | i = m.start; 30 | L = []; 31 | V = zeros(m.numsymbols, 1); 32 | end 33 | 34 | % check for cycle containing symbol i 35 | if V(i) == 1 36 | error('Cycle detected in grammar!'); 37 | end 38 | 39 | % mark symbol i as pre-visit 40 | V(i) = 1; 41 | for r = 1:length(m.rules{i}) 42 | for s = m.rules{i}(r).rhs 43 | % recurse if s is a nonterminal and not already visited 44 | if m.symbols(s).type == 'N' && V(s) < 2 45 | [L, V] = model_sort(m, s, L, V); 46 | end 47 | end 48 | end 49 | % mark symbol i as post-visit 50 | V(i) = 2; 51 | L = [L i]; 52 | -------------------------------------------------------------------------------- /external/boost/preprocessor/library.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_LIBRARY_HPP 13 | # define BOOST_PREPROCESSOR_LIBRARY_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # include 21 | # include 22 | # include 23 | # include 24 | # include 25 | # include 26 | # include 27 | # include 28 | # include 29 | # include 30 | # include 31 | # include 32 | # include 33 | # 34 | # endif 35 | -------------------------------------------------------------------------------- /external/boost/preprocessor/facilities/apply.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_FACILITIES_APPLY_HPP 13 | # define BOOST_PREPROCESSOR_FACILITIES_APPLY_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # 20 | # /* BOOST_PP_APPLY */ 21 | # 22 | # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 23 | # define BOOST_PP_APPLY(x) BOOST_PP_APPLY_I(x) 24 | # define BOOST_PP_APPLY_I(x) BOOST_PP_EXPR_IIF(BOOST_PP_IS_UNARY(x), BOOST_PP_TUPLE_REM_1 x) 25 | # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC() 26 | # define BOOST_PP_APPLY(x) BOOST_PP_APPLY_I(x) 27 | # define BOOST_PP_APPLY_I(x) BOOST_PP_APPLY_ ## x 28 | # define BOOST_PP_APPLY_(x) x 29 | # define BOOST_PP_APPLY_BOOST_PP_NIL 30 | # else 31 | # define BOOST_PP_APPLY(x) BOOST_PP_EXPR_IIF(BOOST_PP_IS_UNARY(x), BOOST_PP_TUPLE_REM_1 x) 32 | # endif 33 | # 34 | # endif 35 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/enum.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_ENUM_HPP 15 | # define BOOST_PREPROCESSOR_LIST_ENUM_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_LIST_ENUM */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_LIST_ENUM(list) BOOST_PP_LIST_FOR_EACH_I(BOOST_PP_LIST_ENUM_O, BOOST_PP_NIL, list) 25 | # else 26 | # define BOOST_PP_LIST_ENUM(list) BOOST_PP_LIST_ENUM_I(list) 27 | # define BOOST_PP_LIST_ENUM_I(list) BOOST_PP_LIST_FOR_EACH_I(BOOST_PP_LIST_ENUM_O, BOOST_PP_NIL, list) 28 | # endif 29 | # 30 | # define BOOST_PP_LIST_ENUM_O(r, _, i, elem) BOOST_PP_COMMA_IF(i) elem 31 | # 32 | # /* BOOST_PP_LIST_ENUM_R */ 33 | # 34 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 35 | # define BOOST_PP_LIST_ENUM_R(r, list) BOOST_PP_LIST_FOR_EACH_I_R(r, BOOST_PP_LIST_ENUM_O, BOOST_PP_NIL, list) 36 | # else 37 | # define BOOST_PP_LIST_ENUM_R(r, list) BOOST_PP_LIST_ENUM_R_I(r, list) 38 | # define BOOST_PP_LIST_ENUM_R_I(r, list) BOOST_PP_LIST_FOR_EACH_I_R(r, BOOST_PP_LIST_ENUM_O, BOOST_PP_NIL, list) 39 | # endif 40 | # 41 | # endif 42 | -------------------------------------------------------------------------------- /process.m: -------------------------------------------------------------------------------- 1 | function [ds, bs] = process(im, model, thresh) 2 | % Detect objects that score above a threshold. 3 | % [ds, bs] = process(im, model, thresh) 4 | % 5 | % If the threshold is not included we use the one in the model. 6 | % This should lead to high-recall but low precision. 7 | % 8 | % Return values 9 | % ds Clipped detection windows 10 | % bs Boxes for all placed filters 11 | % 12 | % Arguments 13 | % im Image 14 | % model Object model 15 | % thresh Detection threshold 16 | 17 | % AUTORIGHTS 18 | % ------------------------------------------------------- 19 | % Copyright (C) 2011-2012 Ross Girshick 20 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 21 | % 22 | % This file is part of the voc-releaseX code 23 | % (http://people.cs.uchicago.edu/~rbg/latent/) 24 | % and is available under the terms of an MIT-like license 25 | % provided in COPYING. Please retain this notice and 26 | % COPYING if you use this file (or a portion of it) in 27 | % your project. 28 | % ------------------------------------------------------- 29 | 30 | if nargin < 3 31 | thresh = model.thresh 32 | end 33 | 34 | tic; 35 | [ds, bs] = imgdetect(im, model, thresh); 36 | toc; 37 | 38 | if ~isempty(ds) 39 | if model.type == model_types.MixStar 40 | if isfield(model, 'bboxpred') 41 | bboxpred = model.bboxpred; 42 | [ds, bs] = clipboxes(im, ds, bs); 43 | [ds, bs] = bboxpred_get(bboxpred, ds, reduceboxes(model, bs)); 44 | else 45 | warning('no bounding box predictor found'); 46 | end 47 | end 48 | [ds, bs] = clipboxes(im, ds, bs); 49 | I = nms(ds, 0.5); 50 | ds = ds(I,:); 51 | bs = bs(I,:); 52 | end 53 | -------------------------------------------------------------------------------- /external/boost/preprocessor/detail/split.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # ifndef BOOST_PREPROCESSOR_DETAIL_SPLIT_HPP 11 | # define BOOST_PREPROCESSOR_DETAIL_SPLIT_HPP 12 | # 13 | # include 14 | # 15 | # /* BOOST_PP_SPLIT */ 16 | # 17 | # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() 18 | # define BOOST_PP_SPLIT(n, im) BOOST_PP_SPLIT_I((n, im)) 19 | # define BOOST_PP_SPLIT_I(par) BOOST_PP_SPLIT_II ## par 20 | # define BOOST_PP_SPLIT_II(n, a, b) BOOST_PP_SPLIT_ ## n(a, b) 21 | # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() 22 | # define BOOST_PP_SPLIT(n, im) BOOST_PP_SPLIT_I(n((im))) 23 | # define BOOST_PP_SPLIT_I(n) BOOST_PP_SPLIT_ID(BOOST_PP_SPLIT_II_ ## n) 24 | # define BOOST_PP_SPLIT_II_0(s) BOOST_PP_SPLIT_ID(BOOST_PP_SPLIT_0 s) 25 | # define BOOST_PP_SPLIT_II_1(s) BOOST_PP_SPLIT_ID(BOOST_PP_SPLIT_1 s) 26 | # define BOOST_PP_SPLIT_ID(id) id 27 | # else 28 | # define BOOST_PP_SPLIT(n, im) BOOST_PP_SPLIT_I(n)(im) 29 | # define BOOST_PP_SPLIT_I(n) BOOST_PP_SPLIT_ ## n 30 | # endif 31 | # 32 | # define BOOST_PP_SPLIT_0(a, b) a 33 | # define BOOST_PP_SPLIT_1(a, b) b 34 | # 35 | # endif 36 | -------------------------------------------------------------------------------- /external/boost/preprocessor/debug/error.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_DEBUG_ERROR_HPP 13 | # define BOOST_PREPROCESSOR_DEBUG_ERROR_HPP 14 | # 15 | # include 16 | # include 17 | # 18 | # /* BOOST_PP_ERROR */ 19 | # 20 | # if BOOST_PP_CONFIG_ERRORS 21 | # define BOOST_PP_ERROR(code) BOOST_PP_CAT(BOOST_PP_ERROR_, code) 22 | # endif 23 | # 24 | # define BOOST_PP_ERROR_0x0000 BOOST_PP_ERROR(0x0000, BOOST_PP_INDEX_OUT_OF_BOUNDS) 25 | # define BOOST_PP_ERROR_0x0001 BOOST_PP_ERROR(0x0001, BOOST_PP_WHILE_OVERFLOW) 26 | # define BOOST_PP_ERROR_0x0002 BOOST_PP_ERROR(0x0002, BOOST_PP_FOR_OVERFLOW) 27 | # define BOOST_PP_ERROR_0x0003 BOOST_PP_ERROR(0x0003, BOOST_PP_REPEAT_OVERFLOW) 28 | # define BOOST_PP_ERROR_0x0004 BOOST_PP_ERROR(0x0004, BOOST_PP_LIST_FOLD_OVERFLOW) 29 | # define BOOST_PP_ERROR_0x0005 BOOST_PP_ERROR(0x0005, BOOST_PP_SEQ_FOLD_OVERFLOW) 30 | # define BOOST_PP_ERROR_0x0006 BOOST_PP_ERROR(0x0006, BOOST_PP_ARITHMETIC_OVERFLOW) 31 | # define BOOST_PP_ERROR_0x0007 BOOST_PP_ERROR(0x0007, BOOST_PP_DIVISION_BY_ZERO) 32 | # 33 | # endif 34 | -------------------------------------------------------------------------------- /external/boost/preprocessor/repetition/enum_params.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_HPP 15 | # define BOOST_PREPROCESSOR_REPETITION_ENUM_PARAMS_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # 21 | # /* BOOST_PP_ENUM_PARAMS */ 22 | # 23 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 24 | # define BOOST_PP_ENUM_PARAMS(count, param) BOOST_PP_REPEAT(count, BOOST_PP_ENUM_PARAMS_M, param) 25 | # else 26 | # define BOOST_PP_ENUM_PARAMS(count, param) BOOST_PP_ENUM_PARAMS_I(count, param) 27 | # define BOOST_PP_ENUM_PARAMS_I(count, param) BOOST_PP_REPEAT(count, BOOST_PP_ENUM_PARAMS_M, param) 28 | # endif 29 | # 30 | # define BOOST_PP_ENUM_PARAMS_M(z, n, param) BOOST_PP_COMMA_IF(n) param ## n 31 | # 32 | # /* BOOST_PP_ENUM_PARAMS_Z */ 33 | # 34 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 35 | # define BOOST_PP_ENUM_PARAMS_Z(z, count, param) BOOST_PP_REPEAT_ ## z(count, BOOST_PP_ENUM_PARAMS_M, param) 36 | # else 37 | # define BOOST_PP_ENUM_PARAMS_Z(z, count, param) BOOST_PP_ENUM_PARAMS_Z_I(z, count, param) 38 | # define BOOST_PP_ENUM_PARAMS_Z_I(z, count, param) BOOST_PP_REPEAT_ ## z(count, BOOST_PP_ENUM_PARAMS_M, param) 39 | # endif 40 | # 41 | # endif 42 | -------------------------------------------------------------------------------- /fv_cache/obj_func.h: -------------------------------------------------------------------------------- 1 | // AUTORIGHTS 2 | // ------------------------------------------------------- 3 | // Copyright (C) 2011-2012 Ross Girshick 4 | // 5 | // This file is part of the voc-releaseX code 6 | // (http://people.cs.uchicago.edu/~rbg/latent/) 7 | // and is available under the terms of an MIT-like license 8 | // provided in COPYING. Please retain this notice and 9 | // COPYING if you use this file (or a portion of it) in 10 | // your project. 11 | // ------------------------------------------------------- 12 | 13 | #ifndef OBJ_FUNC_H 14 | #define OBJ_FUNC_H 15 | 16 | #include "model.h" 17 | #include "fv_cache.h" 18 | #include 19 | 20 | ///** ----------------------------------------------------------------- 21 | // ** Optimize the model parameters on the cache with stochastic 22 | // ** subgradient descent 23 | // **/ 24 | //void sgd(double losses[3], ex_cache &E, model &M, 25 | // string log_dir, string log_tag); 26 | 27 | /** ----------------------------------------------------------------- 28 | ** Compute the objective function value 29 | **/ 30 | void obj_val(double out[3], ex_cache &E, model &M); 31 | 32 | 33 | /** ----------------------------------------------------------------- 34 | ** Compute the LSVM function value and gradient at M.w over the 35 | ** cache 36 | **/ 37 | void gradient(double *obj_val, double *grad, int dim, ex_cache &E, 38 | const model &M, int num_threads); 39 | 40 | 41 | /** ----------------------------------------------------------------- 42 | ** Update various (objective function specific) bits of information 43 | ** about each feature vector 44 | **/ 45 | void compute_info(const ex_cache &E, fv_cache &F, const model &M); 46 | 47 | #endif // OBJ_FUNC_H 48 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array/push_back.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_PUSH_BACK_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_PUSH_BACK_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # include 21 | # 22 | # /* BOOST_PP_ARRAY_PUSH_BACK */ 23 | # 24 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 25 | # define BOOST_PP_ARRAY_PUSH_BACK(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) 26 | # else 27 | # define BOOST_PP_ARRAY_PUSH_BACK(array, elem) BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) 28 | # define BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) 29 | # endif 30 | # 31 | # define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_TUPLE_REM(size) data BOOST_PP_COMMA_IF(size) elem)) 32 | # 33 | # endif 34 | -------------------------------------------------------------------------------- /external/boost/preprocessor/list/cat.hpp: -------------------------------------------------------------------------------- 1 | # /* Copyright (C) 2001 2 | # * Housemarque Oy 3 | # * http://www.housemarque.com 4 | # * 5 | # * Distributed under the Boost Software License, Version 1.0. (See 6 | # * accompanying file LICENSE_1_0.txt or copy at 7 | # * http://www.boost.org/LICENSE_1_0.txt) 8 | # */ 9 | # 10 | # /* Revised by Paul Mensonides (2002) */ 11 | # 12 | # /* See http://www.boost.org for most recent version. */ 13 | # 14 | # ifndef BOOST_PREPROCESSOR_LIST_CAT_HPP 15 | # define BOOST_PREPROCESSOR_LIST_CAT_HPP 16 | # 17 | # include 18 | # include 19 | # include 20 | # include 21 | # 22 | # /* BOOST_PP_LIST_CAT */ 23 | # 24 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 25 | # define BOOST_PP_LIST_CAT(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_CAT_O, BOOST_PP_LIST_FIRST(list), BOOST_PP_LIST_REST(list)) 26 | # else 27 | # define BOOST_PP_LIST_CAT(list) BOOST_PP_LIST_CAT_I(list) 28 | # define BOOST_PP_LIST_CAT_I(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_CAT_O, BOOST_PP_LIST_FIRST(list), BOOST_PP_LIST_REST(list)) 29 | # endif 30 | # 31 | # define BOOST_PP_LIST_CAT_O(d, s, x) BOOST_PP_CAT(s, x) 32 | # 33 | # /* BOOST_PP_LIST_CAT_D */ 34 | # 35 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 36 | # define BOOST_PP_LIST_CAT_D(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_CAT_O, BOOST_PP_LIST_FIRST(list), BOOST_PP_LIST_REST(list)) 37 | # else 38 | # define BOOST_PP_LIST_CAT_D(d, list) BOOST_PP_LIST_CAT_D_I(d, list) 39 | # define BOOST_PP_LIST_CAT_D_I(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_CAT_O, BOOST_PP_LIST_FIRST(list), BOOST_PP_LIST_REST(list)) 40 | # endif 41 | # 42 | # endif 43 | -------------------------------------------------------------------------------- /external/boost/preprocessor/array/push_front.hpp: -------------------------------------------------------------------------------- 1 | # /* ************************************************************************** 2 | # * * 3 | # * (C) Copyright Paul Mensonides 2002. 4 | # * Distributed under the Boost Software License, Version 1.0. (See 5 | # * accompanying file LICENSE_1_0.txt or copy at 6 | # * http://www.boost.org/LICENSE_1_0.txt) 7 | # * * 8 | # ************************************************************************** */ 9 | # 10 | # /* See http://www.boost.org for most recent version. */ 11 | # 12 | # ifndef BOOST_PREPROCESSOR_ARRAY_PUSH_FRONT_HPP 13 | # define BOOST_PREPROCESSOR_ARRAY_PUSH_FRONT_HPP 14 | # 15 | # include 16 | # include 17 | # include 18 | # include 19 | # include 20 | # include 21 | # 22 | # /* BOOST_PP_ARRAY_PUSH_FRONT */ 23 | # 24 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() 25 | # define BOOST_PP_ARRAY_PUSH_FRONT(array, elem) BOOST_PP_ARRAY_PUSH_FRONT_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) 26 | # else 27 | # define BOOST_PP_ARRAY_PUSH_FRONT(array, elem) BOOST_PP_ARRAY_PUSH_FRONT_D(array, elem) 28 | # define BOOST_PP_ARRAY_PUSH_FRONT_D(array, elem) BOOST_PP_ARRAY_PUSH_FRONT_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem) 29 | # endif 30 | # 31 | # define BOOST_PP_ARRAY_PUSH_FRONT_I(size, data, elem) (BOOST_PP_INC(size), (elem BOOST_PP_COMMA_IF(size) BOOST_PP_TUPLE_REM(size) data)) 32 | # 33 | # endif 34 | -------------------------------------------------------------------------------- /test/clipboxes.m: -------------------------------------------------------------------------------- 1 | function [ds, bs, I] = clipboxes(im, ds, bs) 2 | % Clip detection windows to image the boundary. 3 | % [ds, bs, I] = clipboxes(im, ds, bs) 4 | % 5 | % Any detection that is entirely outside of the image (i.e., it is entirely 6 | % inside the padded region of the feature pyramid) is removed. 7 | % 8 | % Return values 9 | % ds Set of detection bounding boxes after clipping 10 | % and (possibly) pruning 11 | % bs Set of filter bounding boxes after clipping and 12 | % (possibly) pruning 13 | % I Indicies of pruned entries in the original ds and bs 14 | % 15 | % Arguments 16 | % im Input image 17 | % ds Detection bounding boxes (see pascal_test.m) 18 | % bs Filter bounding boxes (see pascal_test.m) 19 | 20 | % AUTORIGHTS 21 | % ------------------------------------------------------- 22 | % Copyright (C) 2011-2012 Ross Girshick 23 | % Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick 24 | % 25 | % This file is part of the voc-releaseX code 26 | % (http://people.cs.uchicago.edu/~rbg/latent/) 27 | % and is available under the terms of an MIT-like license 28 | % provided in COPYING. Please retain this notice and 29 | % COPYING if you use this file (or a portion of it) in 30 | % your project. 31 | % ------------------------------------------------------- 32 | 33 | if nargin < 3 34 | bs = []; 35 | end 36 | 37 | if ~isempty(ds) 38 | ds(:,1) = max(ds(:,1), 1); 39 | ds(:,2) = max(ds(:,2), 1); 40 | ds(:,3) = min(ds(:,3), size(im, 2)); 41 | ds(:,4) = min(ds(:,4), size(im, 1)); 42 | 43 | % remove invalid detections 44 | w = ds(:,3)-ds(:,1)+1; 45 | h = ds(:,4)-ds(:,2)+1; 46 | I = find((w <= 0) | (h <= 0)); 47 | ds(I,:) = []; 48 | if ~isempty(bs) 49 | bs(I,:) = []; 50 | end 51 | end 52 | --------------------------------------------------------------------------------