Skip to content

Commit

Permalink
detector/: replaced ACfCaltech model with AcfCaltech+ model described…
Browse files Browse the repository at this point in the history
… in NIPS14 paper, updated demo setup instructions and data location
  • Loading branch information
pdollar committed Oct 30, 2014
1 parent 8c81f93 commit 795e42f
Show file tree
Hide file tree
Showing 10 changed files with 5,807 additions and 9,760 deletions.
29 changes: 15 additions & 14 deletions detector/acfDemoCal.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
%
% (1) Download data and helper routines from Caltech Peds Website
% www.vision.caltech.edu/Image_Datasets/CaltechPedestrians/
% (1a) Download Caltech files: set*.tar and annotations.zip
% (1b) Copy above files to dataDir/data-USA/ and untar/unzip contents
% (1a) Download Caltech-USA files: videos/set*.tar and annotations.zip
% (1b) Copy above to CaltechPeds/data-USA/ and extract contents
% (1c) Download evaluation code (routines necessary for extracting images)
% (2) Set dataDir/ variable below to point to location of Caltech data.
% Note: for CaltechPeds setup details please see CaltechPeds/readme.txt
% (2) Set dataDir/ variable below to point to location to extract data.
% (3) Launch "matlabpool open" for faster training if available.
% (4) Run demo script and enjoy your newly minted fast ped detector!
%
Expand All @@ -19,25 +20,29 @@
%% extract training and testing images and ground truth
cd(fileparts(which('acfDemoCal.m'))); dataDir='../../data/Caltech/';
for s=1:2
if(s==1), type='train'; else type='test'; end
if(s==1), type='test'; skip=[]; else type='train'; skip=4; end
dbInfo(['Usa' type]); if(s==2), type=['train' int2str2(skip,2)]; end
if(exist([dataDir type '/annotations'],'dir')), continue; end
dbInfo(['Usa' type]); dbExtract([dataDir type],1);
dbExtract([dataDir type],1,skip);
end

%% set up opts for training detector (see acfTrain)
opts=acfTrain(); opts.modelDs=[50 20.5]; opts.modelDsPad=[64 32];
opts.pPyramid.smooth=.5; opts.pPyramid.pChns.pColor.smooth=0;
opts.posGtDir=[dataDir 'train/annotations']; opts.nWeak=[32 128 512 2048];
opts.posImgDir=[dataDir 'train/images']; opts.pJitter=struct('flip',1);
opts.pBoost.pTree.fracFtrs=1/16; opts.name='models/AcfCaltech';
opts.pPyramid.pChns.pColor.smooth=0; opts.nWeak=[64 256 1024 4096];
opts.pBoost.pTree.maxDepth=5; opts.pBoost.discrete=0;
opts.pBoost.pTree.fracFtrs=1/16; opts.nNeg=25000; opts.nAccNeg=50000;
opts.pPyramid.pChns.pGradHist.softBin=1; opts.pJitter=struct('flip',1);
opts.posGtDir=[dataDir 'train' int2str2(skip,2) '/annotations'];
opts.posImgDir=[dataDir 'train' int2str2(skip,2) '/images'];
opts.pPyramid.pChns.shrink=2; opts.name='models/AcfCaltech+';
pLoad={'lbls',{'person'},'ilbls',{'people'},'squarify',{3,.41}};
opts.pLoad = [pLoad 'hRng',[50 inf], 'vRng',[1 1] ];

%% train detector (see acfTrain)
detector = acfTrain( opts );

%% modify detector (see acfModify)
pModify=struct('cascThr',-1,'cascCal',-.005);
pModify=struct('cascThr',-1,'cascCal',.005);
detector=acfModify(detector,pModify);

%% run detector on a sample image (see acfDetect)
Expand All @@ -50,7 +55,3 @@
'gtDir',[dataDir 'test/annotations'],'pLoad',[pLoad, 'hRng',[50 inf],...
'vRng',[.65 1],'xRng',[5 635],'yRng',[5 475]],...
'pModify',pModify,'reapply',0,'show',2);

%% optionally show top false positives ('type' can be 'fp','fn','tp','dt')
if( 0 ), bbGt('cropRes',gt,dt,imgNms,'type','fn','n',50,...
'show',3,'dims',opts.modelDs([2 1])); end
15 changes: 8 additions & 7 deletions detector/acfDemoInria.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
%
% (1) Download data and helper routines from Caltech Peds Website
% www.vision.caltech.edu/Image_Datasets/CaltechPedestrians/
% (1a) Download INRIA files: set00.tar, set01.tar, and annotations.zip
% (1b) Copy above three files to dataDir/ and untar/unzip contents
% (1a) Download INRIA files: videos/set*.tar and annotations.zip
% (1b) Copy above to CaltechPeds/data-INRIA/ and extract contents
% (1c) Download evaluation code (routines necessary for extracting images)
% (2) Set dataDir/ variable below to point to location of INRIA data.
% Note: for CaltechPeds setup details please see CaltechPeds/readme.txt
% (2) Set dataDir/ variable below to point to location to extract data.
% (3) Launch "matlabpool open" for faster training if available.
% (4) Run demo script and enjoy your newly minted fast ped detector!
%
Expand All @@ -18,12 +19,12 @@

%% extract training and testing images and ground truth
cd(fileparts(which('acfDemoInria.m'))); dataDir='../../data/Inria/';
for s=1:2
for s=1:2, pth=dbInfo('InriaTest');
if(s==1), set='00'; type='train'; else set='01'; type='test'; end
if(exist([dataDir type '/posGt'],'dir')), continue; end
seqIo([dataDir 'set' set '/V000'],'toImgs',[dataDir type '/pos']);
seqIo([dataDir 'set' set '/V001'],'toImgs',[dataDir type '/neg']);
V=vbb('vbbLoad',[dataDir 'annotations/set' set '/V000']);
seqIo([pth '/videos/set' set '/V000'],'toImgs',[dataDir type '/pos']);
seqIo([pth '/videos/set' set '/V001'],'toImgs',[dataDir type '/neg']);
V=vbb('vbbLoad',[pth '/annotations/set' set '/V000']);
vbb('vbbToFiles',V,[dataDir type '/posGt']);
end

Expand Down
Binary file added detector/models/AcfCaltech+Detector.mat
Binary file not shown.
Loading

0 comments on commit 795e42f

Please sign in to comment.