Permalink
Browse files

Fixes namespace issues for `Proposal` and `Oversegmentation` (LPO & GOP)

  • Loading branch information...
abhshkdz committed May 28, 2015
1 parent 90b4407 commit ab70b9cef685c5c9c543f6ad3feb0b6125841332
View
@@ -1,7 +1,7 @@
function proposals=calcgopForIm(input, gopconfig )
if ~isfield(gopconfig,'gopdatapath')
fprintf('Path to GOP data does not exist. Please make sure you give a proper full path\n');
return;
return;
else
datapath=gopconfig.gopdatapath;
end
@@ -38,7 +38,7 @@
if ( strcmp(method,'learned'))
% Setup the proposal pipeline (learned)
p = Proposal('max_iou', max_iou,...
p = GopProposal('max_iou', max_iou,...
'seed', [datapath '/seed_final.dat'],...
'unary', NumberOfSeeds, NumberOfSegmentationsPerSeed, ['binaryLearnedUnary("' datapath '/masks_final_0_fg.dat")'], ['binaryLearnedUnary("' datapath '/masks_final_0_bg.dat")'],...
'unary', NumberOfSeeds, NumberOfSegmentationsPerSeed, ['binaryLearnedUnary("' datapath '/masks_final_1_fg.dat")'], ['binaryLearnedUnary("' datapath '/masks_final_1_bg.dat")'],...
@@ -48,12 +48,12 @@
else
% Setup the proposal pipeline (baseline)
p = Proposal('max_iou', max_iou,...
p = GopProposal('max_iou', max_iou,...
'unary', NumberOfSeeds, NumberOfSegmentationsPerSeed, 'seedUnary()', 'backgroundUnary({0,15})',...
'unary', 0, NumberOfSegmentationsPerSeed, 'zeroUnary()', 'backgroundUnary({0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15})' ...
);
end
os = OverSegmentation( im );
os = GopOverSegmentation( im );
props = p.propose( os );
boxes = os.maskToBox( props );
if(isfield(gopconfig.opts,'numProposals'))
@@ -64,7 +64,7 @@
fprintf('Only %d proposals were generated for the input image\n',size(boxes,1));
end
end
proposals.boxes=boxes;
proposals.boxes=boxes;
end
@@ -1,7 +1,7 @@
%{
Copyright (c) 2014, Philipp Krähenbühl
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
@@ -12,7 +12,7 @@
* Neither the name of the Stanford University nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Philipp Krähenbühl ''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
@@ -34,12 +34,12 @@
% os = OverSegmentation( I );
% imagesc( os.s() ) % To visualize the over-segmentation
classdef OverSegmentation
classdef GopOverSegmentation
properties (SetAccess = private, GetAccess = public)
c_s
end
methods
function obj = OverSegmentation( I, NS, thick_bnd, thin_bnd )
function obj = GopOverSegmentation( I, NS, thick_bnd, thin_bnd )
if nargin == 0
error( 'Input image required' );
end
@@ -1,7 +1,7 @@
%{
Copyright (c) 2014, Philipp Krähenbühl
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
@@ -12,7 +12,7 @@
* Neither the name of the Stanford University nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Philipp Krähenbühl ''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
@@ -33,13 +33,13 @@
% );
% props = p.propose( os );
classdef Proposal
classdef GopProposal
properties (SetAccess = private, GetAccess = private)
c_p
end
methods
function obj = Proposal( varargin )
function obj = GopProposal( varargin )
obj.c_p = gop_mex( 'newProposal', varargin{:} );
end
function r = propose(this,os)
View
@@ -1,7 +1,7 @@
%{
Copyright (c) 2014, Philipp Krähenbühl
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
@@ -12,7 +12,7 @@
* Neither the name of the Stanford University nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Philipp Krähenbühl ''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
@@ -33,7 +33,7 @@
gop_mex( 'setDetector', 'MultiScaleStructuredForest("../data/sf.dat")' );
% Setup the proposal pipeline (baseline)
p = Proposal('max_iou', 0.8,...
p = GopProposal('max_iou', 0.8,...
'unary', 130, 5, 'seedUnary()', 'backgroundUnary({0,15})',...
'unary', 0, 5, 'zeroUnary()', 'backgroundUnary({0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15})' ...
);
@@ -50,19 +50,19 @@
images = {'pears.png','peppers.png'};
for it = 1:2
I = imread(images{it});
% Create an over-segmentation
tic();
os = OverSegmentation( I );
os = GopOverSegmentation( I );
t1 = toc();
% Generate proposals
tic();
props = p.propose( os );
t2 = toc();
fprintf( ' %d proposals generated. OverSeg %0.3fs, Proposals %0.3fs. Image size %d x %d.\n', size(props,1), t1, t2, size(I,1), size(I,2) );
% If you just want boxes
boxes = os.maskToBox( props );
figure()
View
@@ -29,8 +29,8 @@
% Set a boundary detector by calling (before creating an OverSegmentation!):
lpo_mex( 'setDetector', [detector '("' datapath 'sf.dat")'] );
p = Proposal( 'model', model );
os = OverSegmentation( im );
p = LpoProposal( 'model', model );
os = LpoOverSegmentation( im );
props = p.propose( os );
boxes = os.maskToBox( props );
if(isfield(lpoconfig.opts,'numProposals'))
@@ -30,12 +30,12 @@
% os = OverSegmentation( I );
% imagesc( os.s() ) % To visualize the over-segmentation
classdef OverSegmentation
classdef LpoOverSegmentation
properties (SetAccess = private, GetAccess = public)
c_s
end
methods
function obj = OverSegmentation( I, NS, thick_bnd, thin_bnd )
function obj = LpoOverSegmentation( I, NS, thick_bnd, thin_bnd )
if nargin == 0
error( 'Input image required' );
end
@@ -33,13 +33,13 @@
% );
% props = p.propose( os );
classdef Proposal
classdef LpoProposal
properties (SetAccess = private, GetAccess = private)
c_p
end
methods
function obj = Proposal( varargin )
function obj = LpoProposal( varargin )
obj.c_p = lpo_mex( 'newProposal', varargin{:} );
end
function r = propose(this,os)
View
@@ -31,7 +31,7 @@
lpo_mex( 'setDetector', 'MultiScaleStructuredForest("../data/sf.dat")' );
% Setup the proposal pipeline (baseline)
p = Proposal( 'model', '../models/lpo_VOC_0.1.dat' );
p = LpoProposal( 'model', '../models/lpo_VOC_0.1.dat' );
% Load in image
images = {'pears.png','peppers.png'};
@@ -41,7 +41,7 @@
% Create an over-segmentation
tic();
os = OverSegmentation( I );
os = LpoOverSegmentation( I );
t1 = toc();
% Generate proposals

0 comments on commit ab70b9c

Please sign in to comment.