diff --git a/matconvnet-calvin/matlab/setup/downloadModel.m b/matconvnet-calvin/matlab/setup/downloadModel.m new file mode 100644 index 0000000..7e6688a --- /dev/null +++ b/matconvnet-calvin/matlab/setup/downloadModel.m @@ -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 \ No newline at end of file diff --git a/matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m b/matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m index 8c11173..a149665 100644 --- a/matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m +++ b/matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m @@ -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 @@ -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') diff --git a/matconvnet-calvin/matlab/setup/downloadSiftFlow.m b/matconvnet-calvin/matlab/setup/downloadSiftFlow.m index 8279c21..f7fb8fa 100644 --- a/matconvnet-calvin/matlab/setup/downloadSiftFlow.m +++ b/matconvnet-calvin/matlab/setup/downloadSiftFlow.m @@ -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'); @@ -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') diff --git a/matconvnet-calvin/matlab/setup/downloadVOC2010.m b/matconvnet-calvin/matlab/setup/downloadVOC2010.m index 2d78ea1..9621a95 100644 --- a/matconvnet-calvin/matlab/setup/downloadVOC2010.m +++ b/matconvnet-calvin/matlab/setup/downloadVOC2010.m @@ -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'); @@ -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') diff --git a/matconvnet-calvin/matlab/export/export_model.m b/matconvnet-calvin/matlab/setup/exportModel.m similarity index 97% rename from matconvnet-calvin/matlab/export/export_model.m rename to matconvnet-calvin/matlab/setup/exportModel.m index 4056633..95f8f86 100644 --- a/matconvnet-calvin/matlab/export/export_model.m +++ b/matconvnet-calvin/matlab/setup/exportModel.m @@ -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. %