Skip to content

Commit 51da79a

Browse files
author
Holger Caesar
committed
Create download folder for all downloaded datasets/models, added downloadModel script
1 parent 10357d3 commit 51da79a

File tree

5 files changed

+67
-6
lines changed

5 files changed

+67
-6
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
function downloadModel(modelName)
2+
% downloadModel(modelName)
3+
%
4+
% Downloads and unzips a trained model.
5+
%
6+
% Copyright by Holger Caesar, 2016
7+
8+
% Settings
9+
global glBaseFolder;
10+
baseUrl = 'http://groups.inf.ed.ac.uk/calvin/caesar16eccv';
11+
downloadFolder = fullfile(glBaseFolder, 'Downloads');
12+
if strcmp(modelName, 'frcn')
13+
exportName = 'FRCN_VOC2010_model';
14+
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'FRCN', 'VOC2010', 'VOC2010-testRelease');
15+
elseif strcmp(modelName, 'fcn')
16+
exportName = 'FCN_SiftFlow_model';
17+
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'FCN', 'SiftFlow', 'fcn16s-testRelease');
18+
elseif strcmp(modelName, 'e2s2_fast')
19+
exportName = 'E2S2_SiftFlow_model_fast';
20+
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'E2S2', 'SiftFlow', 'Run1', 'SiftFlow_e2s2_run1_exp1');
21+
elseif strcmp(modelName, 'e2s2_full')
22+
exportName = 'E2S2_SiftFlow_model_full';
23+
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'E2S2', 'SiftFlow', 'Run1', 'SiftFlow_e2s2_run1_exp2');
24+
else
25+
error('Error: Unknown model: %s', modelName);
26+
end
27+
28+
% Create folder
29+
if ~exist(downloadFolder, 'dir')
30+
mkdir(downloadFolder);
31+
end
32+
33+
% Download model
34+
url = fullfile(baseUrl, [exportName, '.zip']);
35+
downloadPath = fullfile(downloadFolder, [exportName, '.zip']);
36+
if exist(downloadPath, 'file')
37+
fprintf('Using existing model file: %s\n', downloadPath);
38+
else
39+
fprintf('Downloading model to: %s\n', downloadPath);
40+
websave(downloadPath, url);
41+
end
42+
43+
% Unzip model
44+
if exist(exportFilesTarget, 'dir')
45+
fprintf('Using existing model in: %s\n', exportFilesTarget);
46+
else
47+
fprintf('Unzipping model to: %s\n', exportFilesTarget);
48+
unzip(downloadPath, exportFilesTarget);
49+
end

matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ function downloadSelectiveSearch()
1010
url = 'http://koen.me/research/downloads/SelectiveSearchCodeIJCV.zip';
1111
rootFolder = calvin_root();
1212
codeFolder = fullfile(rootFolder, 'data', 'Code');
13-
zipFile = fullfile(codeFolder, zipName);
13+
downloadFolder = fullfile(rootFolder, 'data', 'Downloads');
14+
zipFile = fullfile(downloadFolder, zipName);
1415
checkFile = fullfile(codeFolder, 'SelectiveSearchCodeIJCV', 'Image2HierarchicalGrouping.m');
1516

1617
% Download dataset
@@ -19,6 +20,9 @@ function downloadSelectiveSearch()
1920
if ~exist(codeFolder, 'dir')
2021
mkdir(codeFolder);
2122
end
23+
if ~exist(downloadFolder, 'dir')
24+
mkdir(downloadFolder);
25+
end
2226

2327
% Download zip file
2428
if ~exist(zipFile, 'file')

matconvnet-calvin/matlab/setup/downloadSiftFlow.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ function downloadSiftFlow()
1010
url = 'http://www.cs.unc.edu/~jtighe/Papers/ECCV10/siftflow/SiftFlowDataset.zip';
1111
rootFolder = calvin_root();
1212
datasetFolder = fullfile(rootFolder, 'data', 'Datasets', 'SiftFlow');
13-
zipFile = fullfile(datasetFolder, zipName);
13+
downloadFolder = fullfile(rootFolder, 'data', 'Downloads');
14+
zipFile = fullfile(downloadFolder, zipName);
1415
semanticLabelFolder = fullfile(datasetFolder, 'SemanticLabels');
1516
metaFolder = fullfile(datasetFolder, 'Meta');
1617

@@ -20,6 +21,9 @@ function downloadSiftFlow()
2021
if ~exist(datasetFolder, 'dir')
2122
mkdir(datasetFolder);
2223
end
24+
if ~exist(downloadFolder, 'dir')
25+
mkdir(downloadFolder);
26+
end
2327

2428
% Download zip file
2529
if ~exist(zipFile, 'file')

matconvnet-calvin/matlab/setup/downloadVOC2010.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ function downloadVOC2010()
1212
urlDevkit = 'http://host.robots.ox.ac.uk/pascal/VOC/voc2010/VOCdevkit_08-May-2010.tar';
1313
rootFolder = calvin_root();
1414
datasetFolder = fullfile(rootFolder, 'data', 'Datasets', 'VOC2010');
15-
zipFileData = fullfile(datasetFolder, zipNameData);
16-
zipFileDevkit = fullfile(datasetFolder, zipNameDevkit);
15+
downloadFolder = fullfile(rootFolder, 'data', 'Downloads');
16+
zipFileData = fullfile(downloadFolder, zipNameData);
17+
zipFileDevkit = fullfile(downloadFolder, zipNameDevkit);
1718
dataFolder = fullfile(datasetFolder, 'VOCdevkit', 'VOC2010', 'JPEGImages');
1819
devkitFolder = fullfile(datasetFolder, 'VOCdevkit', 'VOCcode');
1920

@@ -23,6 +24,9 @@ function downloadVOC2010()
2324
if ~exist(datasetFolder, 'dir')
2425
mkdir(datasetFolder);
2526
end
27+
if ~exist(downloadFolder, 'dir')
28+
mkdir(downloadFolder);
29+
end
2630

2731
% Download data
2832
if ~exist(dataFolder, 'dir')

matconvnet-calvin/matlab/export/export_model.m renamed to matconvnet-calvin/matlab/setup/exportModel.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
function export_model(modelName)
2-
% export_model(modelName)
1+
function exportModel(modelName)
2+
% exportModel(modelName)
33
%
44
% Zips a trained model so that it can be uploaded to our homepage.
55
%

0 commit comments

Comments
 (0)