Commit 2bf1ea6d authored by Ross Girshick's avatar Ross Girshick
Browse files

fix workflow of the pool5 feature explorer

parent 51511d0c
function [res_test, res_train] = rcnn_exp_train_and_test()
% Runs an experiment that trains an R-CNN model and tests it.
% -------------------- CONFIG --------------------
net_file = './data/caffe_nets/finetune_voc_2007_trainval_iter_70k';
......
......@@ -4,7 +4,7 @@ if exist('selective_search/SelectiveSearchCodeIJCV')
addpath('selective_search/SelectiveSearchCodeIJCV/Dependencies');
else
fprintf('Warning: you will need the selective search IJCV code.\n');
fprintf('Press any key to download it (runs ./selective_search/fetch_selective_search.sh)');
fprintf('Press any key to download it (runs ./selective_search/fetch_selective_search.sh)> ');
pause;
system('./selective_search/fetch_selective_search.sh');
addpath('selective_search/SelectiveSearchCodeIJCV');
......@@ -19,8 +19,9 @@ addpath('bbox_regression');
if exist('external/caffe/matlab/caffe')
addpath('external/caffe/matlab/caffe');
else
warning('Please install caffe in ./external/caffe');
warning('Please install Caffe in ./external/caffe');
end
addpath('experiments');
addpath('imdb');
addpath('vis/pool5-explorer');
fprintf('R-CNN startup done\n');
......@@ -11,11 +11,7 @@ function pool5_explorer(imdb, cache_name)
conf = rcnn_config('sub_dir', imdb.name);
index_file = sprintf('%s/pool5_explorer_index_%s', ...
conf.cache_dir, cache_name);
% load pre-computed index into variable 'index'
load(index_file);
index = pool5_explorer_build_index(imdb, cache_name);
figures = [1 2];
vf_sz = [8 12];
......
function pool5_explorer_build_index(imdb, cache_name)
function index = pool5_explorer_build_index(imdb, cache_name)
% AUTORIGHTS
% ---------------------------------------------------------
% Copyright (c) 2014, Ross Girshick
......@@ -23,24 +23,31 @@ conf = rcnn_config('sub_dir', imdb.name);
save_file = sprintf('%s/pool5_explorer_index_%s', ...
conf.cache_dir, cache_name);
TOP_K = 1000;
try
% Load already computed index
fprintf('trying to load: %s\n', save_file);
load(save_file);
catch
warning('Building the explorer index. This will take a long time.');
ids = imdb.image_ids;
TOP_K = 1000;
% select features
sel_features = 1:(6*6*256);
ids = imdb.image_ids;
index.imdb_name = imdb.name;
index.images = ids;
features = cell(length(sel_features), 1);
% select features
sel_features = 1:(6*6*256);
for i = 1:length(features)
index.imdb_name = imdb.name;
index.images = ids;
features = cell(length(sel_features), 1);
for i = 1:length(features)
features{i}.image_inds = [];
features{i}.scores = [];
features{i}.boxes = zeros(0, 4);
end
end
for i = 1:length(ids)
for i = 1:length(ids)
tic_toc_print('%d/%d', i, length(ids));
th = tic();
d = rcnn_load_cached_pool5_features(cache_name, ...
......@@ -89,7 +96,8 @@ for i = 1:length(ids)
save(save_file, 'index');
fprintf('checkpoint %d\n', i);
end
end
end
index.features = features;
save(save_file, 'index');
index.features = features;
save(save_file, 'index');
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment