Skip to content

Commit

Permalink
- Initial commit of UCM segmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorros committed Nov 9, 2016
1 parent 61c12fe commit b21b00b
Show file tree
Hide file tree
Showing 500 changed files with 113,327 additions and 0 deletions.
Binary file added segment-ucm/00.000948.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added segment-ucm/MCG-PreTrained/.DS_Store
Binary file not shown.
Binary file added segment-ucm/MCG-PreTrained/._.DS_Store
Binary file not shown.
Binary file added segment-ucm/MCG-PreTrained/._root_dir.m
Binary file not shown.
32 changes: 32 additions & 0 deletions segment-ucm/MCG-PreTrained/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Copyright (c) 2014
Universitat Politecnica de Catalunya BarcelonaTech (UPC) - Spain
University of California Berkeley (UCB) - USA

Jordi Pont-Tuset <[email protected]>
Pablo Arbelaez <[email protected]>

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
42 changes: 42 additions & 0 deletions segment-ucm/MCG-PreTrained/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
% ------------------------------------------------------------------------
% Copyright (C)
% Universitat Politecnica de Catalunya BarcelonaTech (UPC) - Spain
% University of California Berkeley (UCB) - USA
%
% Jordi Pont-Tuset <[email protected]>
% Pablo Arbelaez <[email protected]>
% June 2014
% ------------------------------------------------------------------------
% This file is part of the MCG package presented in:
% Arbelaez P, Pont-Tuset J, Barron J, Marques F, Malik J,
% "Multiscale Combinatorial Grouping,"
% Computer Vision and Pattern Recognition (CVPR) 2014.
% Please consider citing the paper if you use this code.
% ------------------------------------------------------------------------

MCG_compute is the package to compute MCG object candidates and UCMs, and benchmark object segmentation algorithms.

FIRST INSTALL
- Change root_dir to point to the MCG root folder (the one with the file root_dir.m, instal.m, etc.)
- Change datasets/database_root_dir to point to your PASCAL2012 folder (the one with subfolders ImageSets, JPEGImages, etc.)
- Run install.m from the root dir to add the needed paths and do some checks
- If you need to re-build the library (the script install.m will tell if needed), run build.m

USAGE INSTALL
- Each time you restart your matlab, run install.m
- If you want to avoid this, add the paths permanently

MCG USAGE
- To compute MCG candidates, see im2mcg.m (and scripts/im2mcg_all.m)
- To compute MCG UCMs, see im2ucm.m (and scripts/im2ucm_all.m)
- For demos about how to use these functions, see the 'demos' folder

EVALUATION
- See scripts/benchmark_results.m to see how to evaluate the candidates
and compare them to the state of the art

NOTE
- Very big images (around 10 mega-pixels) make the detection of edges at scale 2
break, so if you really need to handle big images, just use SCG ('fast' mode)

Enjoy!
146 changes: 146 additions & 0 deletions segment-ucm/MCG-PreTrained/build.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
% ------------------------------------------------------------------------
% Copyright (C)
% Universitat Politecnica de Catalunya BarcelonaTech (UPC) - Spain
% University of California Berkeley (UCB) - USA
%
% Jordi Pont-Tuset <[email protected]>
% Pablo Arbelaez <[email protected]>
% June 2014
% ------------------------------------------------------------------------
% This file is part of the MCG package presented in:
% Arbelaez P, Pont-Tuset J, Barron J, Marques F, Malik J,
% "Multiscale Combinatorial Grouping,"
% Computer Vision and Pattern Recognition (CVPR) 2014.
% Please consider citing the paper if you use this code.
% ------------------------------------------------------------------------
%
% This function builds all the MEX files needed.
% Dependencies needed to build: Boost C++ libraries (http://www.boost.org)
%
% ------------------------------------------------------------------------
function build()
% Check that 'root_dir' has been set
if ~exist(root_dir,'dir')
error('Error building MCG, try updating the value of root_dir in the file "root_dir.m"')
end

%% Include the generic paths and files to compile
include{1} = fullfile(root_dir, 'src', 'aux'); % To get matlab_multiarray.hpp
if (strcmp(computer(),'PCWIN64') || strcmp(computer(),'PCWIN32'))
include{2} = 'C:\Program Files\boost_1_55_0'; % Boost libraries (change it if necessary)
else
include{2} = '/opt/local/include/'; % Boost libraries (change it if necessary)
end
include{3} = fullfile(root_dir, 'src', 'external','piotr_toolbox'); % To build Piotr toolbox

include_str = '';
for ii=1:length(include)
include_str = [include_str ' -I''' include{ii} '''']; %#ok<AGROW>
end

build_file{1} = fullfile(root_dir, 'src', 'cands' ,'mex_assess_one_sel.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_base_perimeters.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_fast_features.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_fast_intersections.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_fast_reduction.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_get_tree_cands.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_prune_tree_to_regions.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_max_margin.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'cands' ,'mex_hole_filling.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'aux' ,'mex_intersect_hierarchies.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'aux' ,'mex_ucm2hier.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'aux' ,'mex_cands2masks.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'aux' ,'mex_cands2labels.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'benchmark','mex_eval_masks.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'benchmark','mex_eval_labels.cpp');
build_file{end+1} = fullfile(root_dir, 'src', 'external' ,'paretofront','paretofront.cpp');

%% Build everything
if ~exist(fullfile(root_dir, 'lib'),'dir')
mkdir(fullfile(root_dir, 'lib'))
end

for ii=1:length(build_file)
eval(['mex ''' build_file{ii} ''' -outdir ''' fullfile(root_dir, 'lib') '''' include_str])
end

%% Build random forest files
file1 = fullfile(root_dir, 'src', 'external', 'RF_Reg_C', 'src', 'mex_regressionRF_train.cpp');
file2 = fullfile(root_dir, 'src', 'external', 'RF_Reg_C', 'src', 'mex_regressionRF_predict.cpp');
dep1 = fullfile(root_dir, 'src', 'external', 'RF_Reg_C', 'src', 'cokus.cpp');
dep2 = fullfile(root_dir, 'src', 'external', 'RF_Reg_C', 'src', 'reg_RF.cpp');
o_file1 = fullfile(root_dir, 'lib', 'mexRF_train');
o_file2 = fullfile(root_dir, 'lib', 'mexRF_predict');

eval(['mex ' file1 ' ' dep1 ' ' dep2 ' -output ' o_file1 ' -DMATLAB -O'])
eval(['mex ' file2 ' ' dep1 ' ' dep2 ' -output ' o_file2 ' -DMATLAB -O'])

%% Build structured forest files
eval(['mex ' fullfile(root_dir, 'src', 'external','structured_forest', 'edgesDetectMex.cpp') ' -outdir ' fullfile(root_dir, 'lib') include_str])

%% Build piotr_toolbox files
eval(['mex ' fullfile(root_dir, 'src', 'external','piotr_toolbox', 'convConst.cpp') ' -outdir ' fullfile(root_dir, 'lib') include_str])
eval(['mex ' fullfile(root_dir, 'src', 'external','piotr_toolbox', 'gradientMex.cpp') ' -outdir ' fullfile(root_dir, 'lib') include_str])
eval(['mex ' fullfile(root_dir, 'src', 'external','piotr_toolbox', 'imPadMex.cpp') ' -outdir ' fullfile(root_dir, 'lib') include_str])
eval(['mex ' fullfile(root_dir, 'src', 'external','piotr_toolbox', 'imResampleMex.cpp') ' -outdir ' fullfile(root_dir, 'lib') include_str])
eval(['mex ' fullfile(root_dir, 'src', 'external','piotr_toolbox', 'rgbConvertMex.cpp') ' -outdir ' fullfile(root_dir, 'lib') include_str])


%% Build BSR-related files
% 'ucm_mean_pb'
eval(['mex ' fullfile(root_dir, 'src', 'bsr', 'ucm_mean_pb.cpp') ' -outdir ' fullfile(root_dir, 'lib')])

% 'buildW'
eval(['mex ' fullfile(root_dir, 'src', 'bsr', 'buildW.cpp') ' -outdir ' fullfile(root_dir, 'lib'),...
' -I' fullfile(root_dir,'src','external','BSR','buildW') ' -I' fullfile(root_dir,'src','external','BSR','buildW','util'),...
' ' fullfile(root_dir,'src','external','BSR','buildW','smatrix.cc'),...
' ' fullfile(root_dir,'src','external','BSR','buildW','ic.cc'),...
' ' fullfile(root_dir,'src','external','BSR','buildW','affinity.cc'),...
])

% 'mex_contour_sides'
eval(['mex ' fullfile(root_dir, 'src', 'bsr', 'mex_contour_sides.cpp') ' -outdir ' fullfile(root_dir, 'lib'),...
' -I' fullfile(root_dir,'src','external','BSR','include'),...
' ' fullfile(root_dir,'src','external','BSR','src','concurrent','threads','child_thread.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','concurrent','threads','runnable.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','concurrent','threads','thread.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','concurrent','threads','synchronization','synchronizables','synchronizable.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','concurrent','threads','synchronization','synchronizables','unsynchronized.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','ex_bad_cast.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','ex_not_found.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','ex_not_implemented.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','ex_index_out_of_bounds.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','ex_invalid_argument.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','ex_null_pointer_dereference.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','exception.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','exceptions','throwable.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','lang','array.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','generators','rand_gen_uniform.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','sources','rand_source_default.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','sources','rand_source.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','sources','mersenne_twister_64.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','sources','rand_source_64.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','sources','system_entropy.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','random','util','randperm.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','matrices','matrix.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','matrices','exceptions','ex_matrix_dimension_mismatch.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','libraries','lib_image.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','libraries','lib_signal.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','math.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','exact.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','geometry','point_2D.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','geometry','seg_intersect.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','geometry','triangulation.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','math','geometry','triangle_2D.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','mlearning','clustering','clusterers','abstract','clusterer.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','mlearning','clustering','clusterers','abstract','weighted_clusterer.cc'),...
' ' fullfile(root_dir,'src','external','BSR','src','mlearning','clustering','clusterers','kmeans','basic_clusterer.cc'),...
]);

%% Clear variables
clear build_file file1 file2 dep1 dep2 o_file1 o_file2 ii include include_str

%% Show message
disp('-- Successful compilation of MCG. Enjoy! --')


Binary file added segment-ucm/MCG-PreTrained/datasets/.DS_Store
Binary file not shown.
Binary file added segment-ucm/MCG-PreTrained/datasets/._.DS_Store
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit b21b00b

Please sign in to comment.