Skip to content

Commit

Permalink
Create download folder for all downloaded datasets/models, added down…
Browse files Browse the repository at this point in the history
…loadModel script
  • Loading branch information
Holger Caesar committed Oct 5, 2016
1 parent 10357d3 commit 51da79a
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 6 deletions.
49 changes: 49 additions & 0 deletions matconvnet-calvin/matlab/setup/downloadModel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
function downloadModel(modelName)
% downloadModel(modelName)
%
% Downloads and unzips a trained model.
%
% Copyright by Holger Caesar, 2016

% Settings
global glBaseFolder;
baseUrl = 'http://groups.inf.ed.ac.uk/calvin/caesar16eccv';
downloadFolder = fullfile(glBaseFolder, 'Downloads');
if strcmp(modelName, 'frcn')
exportName = 'FRCN_VOC2010_model';
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'FRCN', 'VOC2010', 'VOC2010-testRelease');
elseif strcmp(modelName, 'fcn')
exportName = 'FCN_SiftFlow_model';
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'FCN', 'SiftFlow', 'fcn16s-testRelease');
elseif strcmp(modelName, 'e2s2_fast')
exportName = 'E2S2_SiftFlow_model_fast';
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'E2S2', 'SiftFlow', 'Run1', 'SiftFlow_e2s2_run1_exp1');
elseif strcmp(modelName, 'e2s2_full')
exportName = 'E2S2_SiftFlow_model_full';
exportFilesTarget = fullfile(glBaseFolder, 'Features', 'CNN-Models', 'E2S2', 'SiftFlow', 'Run1', 'SiftFlow_e2s2_run1_exp2');
else
error('Error: Unknown model: %s', modelName);
end

% Create folder
if ~exist(downloadFolder, 'dir')
mkdir(downloadFolder);
end

% Download model
url = fullfile(baseUrl, [exportName, '.zip']);
downloadPath = fullfile(downloadFolder, [exportName, '.zip']);
if exist(downloadPath, 'file')
fprintf('Using existing model file: %s\n', downloadPath);
else
fprintf('Downloading model to: %s\n', downloadPath);
websave(downloadPath, url);
end

% Unzip model
if exist(exportFilesTarget, 'dir')
fprintf('Using existing model in: %s\n', exportFilesTarget);
else
fprintf('Unzipping model to: %s\n', exportFilesTarget);
unzip(downloadPath, exportFilesTarget);
end
6 changes: 5 additions & 1 deletion matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function downloadSelectiveSearch()
url = 'http://koen.me/research/downloads/SelectiveSearchCodeIJCV.zip';
rootFolder = calvin_root();
codeFolder = fullfile(rootFolder, 'data', 'Code');
zipFile = fullfile(codeFolder, zipName);
downloadFolder = fullfile(rootFolder, 'data', 'Downloads');
zipFile = fullfile(downloadFolder, zipName);
checkFile = fullfile(codeFolder, 'SelectiveSearchCodeIJCV', 'Image2HierarchicalGrouping.m');

% Download dataset
Expand All @@ -19,6 +20,9 @@ function downloadSelectiveSearch()
if ~exist(codeFolder, 'dir')
mkdir(codeFolder);
end
if ~exist(downloadFolder, 'dir')
mkdir(downloadFolder);
end

% Download zip file
if ~exist(zipFile, 'file')
Expand Down
6 changes: 5 additions & 1 deletion matconvnet-calvin/matlab/setup/downloadSiftFlow.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function downloadSiftFlow()
url = 'http://www.cs.unc.edu/~jtighe/Papers/ECCV10/siftflow/SiftFlowDataset.zip';
rootFolder = calvin_root();
datasetFolder = fullfile(rootFolder, 'data', 'Datasets', 'SiftFlow');
zipFile = fullfile(datasetFolder, zipName);
downloadFolder = fullfile(rootFolder, 'data', 'Downloads');
zipFile = fullfile(downloadFolder, zipName);
semanticLabelFolder = fullfile(datasetFolder, 'SemanticLabels');
metaFolder = fullfile(datasetFolder, 'Meta');

Expand All @@ -20,6 +21,9 @@ function downloadSiftFlow()
if ~exist(datasetFolder, 'dir')
mkdir(datasetFolder);
end
if ~exist(downloadFolder, 'dir')
mkdir(downloadFolder);
end

% Download zip file
if ~exist(zipFile, 'file')
Expand Down
8 changes: 6 additions & 2 deletions matconvnet-calvin/matlab/setup/downloadVOC2010.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ function downloadVOC2010()
urlDevkit = 'http://host.robots.ox.ac.uk/pascal/VOC/voc2010/VOCdevkit_08-May-2010.tar';
rootFolder = calvin_root();
datasetFolder = fullfile(rootFolder, 'data', 'Datasets', 'VOC2010');
zipFileData = fullfile(datasetFolder, zipNameData);
zipFileDevkit = fullfile(datasetFolder, zipNameDevkit);
downloadFolder = fullfile(rootFolder, 'data', 'Downloads');
zipFileData = fullfile(downloadFolder, zipNameData);
zipFileDevkit = fullfile(downloadFolder, zipNameDevkit);
dataFolder = fullfile(datasetFolder, 'VOCdevkit', 'VOC2010', 'JPEGImages');
devkitFolder = fullfile(datasetFolder, 'VOCdevkit', 'VOCcode');

Expand All @@ -23,6 +24,9 @@ function downloadVOC2010()
if ~exist(datasetFolder, 'dir')
mkdir(datasetFolder);
end
if ~exist(downloadFolder, 'dir')
mkdir(downloadFolder);
end

% Download data
if ~exist(dataFolder, 'dir')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function export_model(modelName)
% export_model(modelName)
function exportModel(modelName)
% exportModel(modelName)
%
% Zips a trained model so that it can be uploaded to our homepage.
%
Expand Down

0 comments on commit 51da79a

Please sign in to comment.