-
Notifications
You must be signed in to change notification settings - Fork 15
/
benchmark.m
71 lines (66 loc) · 3.6 KB
/
benchmark.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%==========================================================================
%=========== BENCHMARKING THE REGULARIZATION OF SEMANTIC LABELINGS ========
%========================== OF POINT CLOUDS================================
%==========================================================================
%===================== LOIC LANDRIEU 2017 ==========================
%==========================================================================
%Implementing the methods of the following article
%A structured regularization framework for spatially smoothing semantic
%labelings of 3D point clouds. Landrieu, L., Raguet, H., Vallet, B.,
%Mallet, C., & Weinmann, M. (2017).
%--- dependecies ----------------------------------------------------------
clear all;
addpath('./data')
addpath('./UGM/sub/')
addpath('./UGM/compiled/')
addpath('./UGM/infer/')
addpath('./UGM/decode/')
addpath('./GCMex')
addpath('./PFDR_simplex/mex/bin/')
addpath('./cut_pursuit/bin/')
%----build the adjacency graph from ply file-------------------------------
graph = build_graph_structure('oakland.ply',10,0,0);
%---retrieve labeling with your favorite classifier------------------------
%must be n_point x n _class probability float matrix
load('oakland_RF', 'initial_classif');
%---if available - load the ground truth here------------------------------
%must be n_point x 1 label uint_8 matrix
load('oakland_GT', 'ground_truth'); %MUST BE UINT8
%--------------------------------------------------------------------------
%--------------- BENCHMARKING ---------------------------------------------
%--------------------------------------------------------------------------
%--- baseline approach ----------------------------------------------------
[dump, l_baseline] = max(initial_classif,[],2);
evaluate(ground_truth, uint8(l_baseline));
partial_baseline = evaluate_partial(ground_truth, initial_classif,0.7,50);
%---LBP sum product--------------------------------------------------------
[p_lpb_sp, T] = LBP_sum_product(initial_classif, graph, .5, 10);
[dump, l_lpb_sp] = max(p_lpb_sp,[],2);
evaluate(ground_truth, uint8(l_lpb_sp));
partial_lpb_sp = evaluate_partial(ground_truth,p_lpb_sp ,0.7,50);
%---LBP max product--------------------------------------------------------
[l_lpb_mp, T] = LBP_max_product(initial_classif, graph, .5, 20);
[dump, acc_lbp_max] = evaluate(ground_truth, uint8(l_lpb_mp));
%---Alpha-expansion--------------------------------------------------------
[l_lin_potts, T] = alpha_expansion(initial_classif, graph, 0, 1, 5);
[dump, acc_in_potts] = evaluate(ground_truth, uint8(l_lin_potts));
%---Total Variation--------------------------------------------------------
p_kl_tv = PFDR(initial_classif, graph, 0.5, 2);
[dump, l_kl_tv] = max(p_kl_tv,[],1);
evaluate(ground_truth, uint8(l_kl_tv));
partial_kl_tv = evaluate_partial(ground_truth,p_kl_tv' ,0.7,50);
%---Cut Pursuit------------------------------------------------------------
p_kl_bo = L0_cut_pursuit(initial_classif, graph, 5, 2);
[dump, l_kl_bo] = max(p_kl_bo,[],1);
evaluate(ground_truth, uint8(l_kl_bo));
partial_kl_bo = evaluate_partial(ground_truth,p_kl_bo' ,0.7,50);
%--------------------------------------------------------------------------
%--------------- VIZUALIZATION --------------------------------------------
%--------------------------------------------------------------------------
clf;hold on;
plot(linspace(70,100,50),partial_baseline,'k-');
plot(linspace(70,100,50),partial_lpb_sp,'k--');
plot([70,100],[acc_lbp_max, acc_lbp_max],'k.');
plot([70,100],[acc_in_potts, acc_in_potts],'r-.');
plot(linspace(70,100,50),partial_kl_tv,'g--');
plot(linspace(70,100,50),partial_kl_bo,'b--');