-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathplot_horizontal_bars.asv
More file actions
230 lines (178 loc) · 7.19 KB
/
plot_horizontal_bars.asv
File metadata and controls
230 lines (178 loc) · 7.19 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
%% Initialize
clc
close all;
clear all;
%% Colors
color_grad = [254 194 96;
63 167 150;
42 9 68]./255;
color_grad = [color_grad ;
%[0.3804, 0.1804, 0.2157];
%[0.0, 0.4549, 0.8941];
[0.9059, 0.4706, 0.0902];
[0.84, 0.15, 0.16]];
xaxis_size = 25;
yaxis_size = 22;
%% DeepLabv3
figure('Position', [500, 50, 1200, 450]);
set(groot, 'defaultAxesTickLabelInterpreter', 'latex');
common_fontsize = 32;
baseline = 77.0;
y = [baseline 2.39; baseline 1.22; baseline 1.15];
% Create a horizontal stacked bar chart
b = barh(y,'stacked', 'BarWidth', 0.8);
ax = gca;
ax.YAxis.FontSize = common_fontsize;
linecolors = linspecer(6, 'qualitative');
LineColors = flipud(linecolors);
baseline_color = [0 0.2980 0.4275];
sota_colors = [LineColors(4, :);
0.9451 0.9255 0.7843;
0.5216 0.6706 0.8118];
set(b(1), 'FaceColor', baseline_color);
% Assign individual colors to FPS bars
b(2).FaceColor = 'flat';
b(2).CData = sota_colors;
% Set axis labels and formatting
yticklabels({'W/ Ours', 'W/ Contextrast [51]', 'W/ Multi [50]'});
ax.YAxis.FontSize = yaxis_size;
xlabel("mIoU\,(\%)\,$\uparrow$ ", 'interpreter', 'latex', "FontSize", 28);
xlim([76.5 79.5]);
% --- Add legend for each FPS color ---
hold on;
legend_labels = {'DeepLabV3 [18]$\;$', 'Multi [50]$\;$', 'Contextrast [51]$\;$', 'Contextrast++ (Ours)'}; % Legend labels
% Create dummy bars for the legend
legend_handles = gobjects(1, length(legend_labels)); % Empty object array
legend_handles(1) = barh(nan, nan, 'FaceColor', baseline_color); % Geom. bootstr.
% Create dummy patches for FPS legend colors
for i = 1:size(sota_colors, 1)
legend_handles(i+1) = patch(NaN, NaN, sota_colors(4-i, :)); % Dummy patches for legend
end
% Add the legend at the bottom
legend(legend_handles, legend_labels, 'Location', 'southoutside', 'NumColumns', 4, 'FontSize', 23, 'Interpreter', 'latex');
hold off;
print(gcf, "imgs/horizontal_bar_w_deeplabv3.png",'-dpng','-r300');
print -depsc 'imgs/horizontal_bar_w_deeplabv3.eps'
%% HRNet
figure('Position', [500, 550, 1200, 450]);
set(groot, 'defaultAxesTickLabelInterpreter', 'latex');
common_fontsize = 32;
baseline = 76.2;
y = [baseline 3.14; baseline 2.26; baseline 2.14];
% Create a horizontal stacked bar chart
b = barh(y,'stacked', 'BarWidth', 0.8);
ax = gca;
ax.YAxis.FontSize = common_fontsize;
linecolors = linspecer(6, 'qualitative');
LineColors = flipud(linecolors);
baseline_color = [0.1647 0.0353 0.26670];
sota_colors = [LineColors(4, :);
0.9451 0.9255 0.7843;
0.5216 0.6706 0.8118];
set(b(1), 'FaceColor', baseline_color);
% Assign individual colors to FPS bars
b(2).FaceColor = 'flat';
b(2).CData = sota_colors;
% Set axis labels and formatting
yticklabels({'W/ Ours', 'W/ Contextrast [51]', 'W/ Multi [50]'});
ax.YAxis.FontSize = 25;
ax.XAxis.FontSize = 25;
xlabel("mIoU\,(\%)\,$\uparrow$ ", 'interpreter', 'latex', "FontSize", 28);
xlim([75.5 79.5]);
% --- Add legend for each FPS color ---
hold on;
legend_labels = {'HRNet [27]$\;$', 'Multi [50]$\;$', 'Contextrast [51]$\;$', 'Contextrast++ (Ours)'}; % Legend labels
% Create dummy bars for the legend
legend_handles = gobjects(1, length(legend_labels)); % Empty object array
legend_handles(1) = barh(nan, nan, 'FaceColor', baseline_color); % Geom. bootstr.
% Create dummy patches for FPS legend colors
for i = 1:size(sota_colors, 1)
legend_handles(i+1) = patch(NaN, NaN, sota_colors(4-i, :)); % Dummy patches for legend
end
% Add the legend at the bottom
legend(legend_handles, legend_labels, 'Location', 'southoutside', 'NumColumns', 4, 'FontSize', 23, 'Interpreter', 'latex');
hold off;
print(gcf, "imgs/horizontal_bar_w_hrnet.png",'-dpng','-r300');
print -depsc 'imgs/horizontal_bar_w_hrnet.eps'
%% OCRNet
figure('Position', [500, 1050, 1200, 450]);
set(groot, 'defaultAxesTickLabelInterpreter', 'latex');
common_fontsize = 32;
baseline = 79.2;
y = [baseline 1.17; baseline 1.01; baseline-0.33 0.33];
% Create a horizontal stacked bar chart
b = barh(y,'stacked', 'BarWidth', 0.8);
ax = gca;
ax.YAxis.FontSize = common_fontsize;
linecolors = linspecer(6, 'qualitative');
LineColors = flipud(linecolors);
baseline_color = [0.26670 0.1647 0.0353]; %[0.8314 0.6275 0.0902];
sota_colors = [LineColors(4, :);
0.9451 0.9255 0.7843;
0.5216 0.6706 0.8118];
set(b(1), 'FaceColor', baseline_color);
% Assign individual colors to FPS bars
b(2).FaceColor = 'flat';
b(2).CData = sota_colors;
% Set axis labels and formatting
yticklabels({'W/ Ours', 'W/ Contextrast [51]', 'W/ Multi [50]'});
ax.YAxis.FontSize = 25;
ax.XAxis.FontSize = 25;
xlabel("mIoU\,(\%)\,$\uparrow$ ", 'interpreter', 'latex', "FontSize", 28);
xlim([78.75 80.5]);
% --- Add legend for each FPS color ---
hold on;
legend_labels = {'OCRNet [30]$\;$', 'Multi [50]$\;$', 'Contextrast [51]$\;$', 'Contextrast++ (Ours)'}; % Legend labels
% Create dummy bars for the legend
legend_handles = gobjects(1, length(legend_labels)); % Empty object array
legend_handles(1) = barh(nan, nan, 'FaceColor', baseline_color); % Geom. bootstr.
% Create dummy patches for FPS legend colors
for i = 1:size(sota_colors, 1)
legend_handles(i+1) = patch(NaN, NaN, sota_colors(4-i, :)); % Dummy patches for legend
end
% Add the legend at the bottom
legend(legend_handles, legend_labels, 'Location', 'southoutside', 'NumColumns', 4, 'FontSize', 23, 'Interpreter', 'latex');
hold off;
print(gcf, "imgs/horizontal_bar_w_ocrnet.png",'-dpng','-r300');
print -depsc 'imgs/horizontal_bar_w_ocrnet.eps'
%% UperNet
figure('Position', [500, 1550, 1200, 450]);
set(groot, 'defaultAxesTickLabelInterpreter', 'latex');
common_fontsize = 32;
baseline = 75.2;
y = [baseline 1.01; baseline 0.79; baseline 0.61];
% Create a horizontal stacked bar chart
b = barh(y,'stacked', 'BarWidth', 0.8);
ax = gca;
ax.YAxis.FontSize = common_fontsize;
linecolors = linspecer(6, 'qualitative');
LineColors = flipud(linecolors);
baseline_color = [0.0353 0.26670 0.0353];
sota_colors = [LineColors(4, :);
0.9451 0.9255 0.7843;
0.5216 0.6706 0.8118];
set(b(1), 'FaceColor', baseline_color);
% Assign individual colors to FPS bars
b(2).FaceColor = 'flat';
b(2).CData = sota_colors;
% Set axis labels and formatting
yticklabels({'W/ Ours', 'W/ Contextrast [51]', 'W/ Multi [50]'});
ax.YAxis.FontSize = 25;
ax.XAxis.FontSize = 25;
xlabel("mIoU\,(\%)\,$\uparrow$ ", 'interpreter', 'latex', "FontSize", 28);
xlim([75.0 76.25]);
% --- Add legend for each FPS color ---
hold on;
legend_labels = {'UperNet [22]$\;$', 'Multi [50]$\;$', 'Contextrast [51]$\;$', 'Contextrast++ (Ours)'}; % Legend labels
% Create dummy bars for the legend
legend_handles = gobjects(1, length(legend_labels)); % Empty object array
legend_handles(1) = barh(nan, nan, 'FaceColor', baseline_color); % Geom. bootstr.
% Create dummy patches for FPS legend colors
for i = 1:size(sota_colors, 1)
legend_handles(i+1) = patch(NaN, NaN, sota_colors(4-i, :)); % Dummy patches for legend
end
% Add the legend at the bottom
legend(legend_handles, legend_labels, 'Location', 'southoutside', 'NumColumns', 4, 'FontSize', 23, 'Interpreter', 'latex');
hold off;
print(gcf, "imgs/horizontal_bar_w_upernet.png",'-dpng','-r300');
print -depsc 'imgs/horizontal_bar_w_upernet.eps'