forked from farrajota/caltech-extract-data-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbInfo.m
84 lines (78 loc) · 3.34 KB
/
dbInfo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
function [pth,setIds,vidIds,skip,ext] = dbInfo( name1, varargin)
% Specifies data amount and location.
%
% 'name' specifies the name of the dataset. Valid options include: 'Usa',
% 'UsaTest', 'UsaTrain', 'InriaTrain', 'InriaTest', 'Japan', 'TudBrussels',
% 'ETH', and 'Daimler'. If dbInfo() is called without specifying the
% dataset name, defaults to the last used name (or 'UsaTest' on first call
% to dbInfo()). Finally, one can specify a subset of a dataset by appending
% digits to the end of the name (eg. 'UsaTest01' indicates first set of
% 'UsaTest' and 'UsaTest01005' indicate first set, fifth video).
%
% USAGE
% [pth,setIds,vidIds,skip,ext] = dbInfo( [name] )
%
% INPUTS
% name - ['UsaTest'] specify dataset, caches last passed in name
% varargin: [1] - path to the dataset directory files.
%
% OUTPUTS
% pth - directory containing database
% setIds - integer ids of each set
% vidIds - [1xnSets] cell of vectors of integer ids of each video
% skip - specify subset of frames to use for evaluation
% ext - file extension determining image format ('jpg' or 'png')
%
% EXAMPLE
% [pth,setIds,vidIds,skip,ext] = dbInfo
%
% See also
%
% Caltech Pedestrian Dataset Version 3.2.1
% Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com]
% Licensed under the Simplified BSD License [see external/bsd.txt]
persistent name; % cache last used name
if(nargin && ~isempty(name1)), name=lower(name1); else
if(isempty(name)), name='usatest'; end; end; name1=name;
vidId=str2double(name1(end-2:end)); % check if name ends in 3 ints
if(isnan(vidId)), vidId=[]; else name1=name1(1:end-3); end
setId=str2double(name1(end-1:end)); % check if name ends in 2 ints
if(isnan(setId)), setId=[]; else name1=name1(1:end-2); end
switch name1
case 'usa' % Caltech Pedestrian Datasets (all)
setIds=0:10; subdir='USA'; skip=30; ext='jpg';
vidIds={0:14 0:5 0:11 0:12 0:11 0:12 0:18 0:11 0:10 0:11 0:11};
case 'usatrain' % Caltech Pedestrian Datasets (training)
setIds=0:5; subdir='USA'; skip=30; ext='jpg';
vidIds={0:14 0:5 0:11 0:12 0:11 0:12};
case 'usatest' % Caltech Pedestrian Datasets (testing)
setIds=6:10; subdir='USA'; skip=30; ext='jpg';
vidIds={0:18 0:11 0:10 0:11 0:11};
case 'inriatrain' % INRIA peds (training)
setIds=0; subdir='INRIA'; skip=1; ext='png'; vidIds={0:1};
case 'inriatest' % INRIA peds (testing)
setIds=1; subdir='INRIA'; skip=1; ext='png'; vidIds={0};
case 'japan' % Caltech Japan data (not publicly avialable)
setIds=0:12; subdir='Japan'; skip=30; ext='jpg';
vidIds={0:5 0:5 0:3 0:5 0:5 0:5 0:5 0:5 0:4 0:4 0:5 0:5 0:4};
case 'tudbrussels' % TUD-Brussels dataset
setIds=0; subdir='TudBrussels'; skip=1; ext='png'; vidIds={0};
case 'eth' % ETH dataset
setIds=0:2; subdir='ETH'; skip=1; ext='png'; vidIds={0 0 0};
case 'daimler' % Daimler dataset
setIds=0; subdir='Daimler'; skip=1; ext='png'; vidIds={0};
case 'pietro'
setIds=0; subdir='Pietro'; skip=1; ext='jpg'; vidIds={0};
otherwise, error('unknown data type: %s',name);
end
% optionally select only specific set/vid if name ended in ints
if(~isempty(setId)), setIds=setIds(setId); vidIds=vidIds(setId); end
if(~isempty(vidId)), vidIds={vidIds{1}(vidId)}; end
% actual directory where data is contained
if ~isempty(varargin)
pth = varargin{1};
else
pth=fileparts(mfilename('fullpath'));
pth=[pth filesep 'data-' subdir];
end
end