UOMOP
Random Activate layer 본문
plot_flops(512, 40);
function plot_flops(dim, snr)
% 데이터 초기화
full_data = [
512, 40, 18, 1, 54, 703, 9242;
512, 40, 19, 5, 184, 1451, 8360;
512, 40, 20, 22, 534, 2429, 7015;
512, 40, 21, 83, 1264, 3206, 5447;
512, 40, 22, 341, 2283, 3493, 3883;
512, 40, 23, 873, 3326, 3214, 2587;
512, 40, 24, 1863, 3968, 2523, 1646;
512, 40, 25, 3356, 3861, 1806, 977;
512, 40, 26, 5051, 3169, 1227, 553;
512, 40, 27, 6632, 2304, 752, 312;
512, 40, 28, 7852, 1570, 414, 164;
512, 40, 29, 8714, 975, 236, 75;
512, 40, 30, 9296, 544, 127, 33;
512, 20, 18, 21, 101, 991, 8887;
512, 20, 19, 77, 343, 1873, 7707;
512, 20, 20, 296, 814, 2703, 6187;
512, 20, 21, 861, 1480, 3102, 4557;
512, 20, 22, 2012, 1922, 2984, 3082;
512, 20, 23, 3632, 2048, 2362, 1958;
512, 20, 24, 5416, 1746, 1662, 1176;
512, 20, 25, 7001, 1225, 1123, 651;
512, 20, 26, 8147, 840, 662, 351;
512, 20, 27, 8924, 533, 365, 178;
512, 20, 28, 9451, 284, 185, 80;
512, 20, 29, 9710, 148, 112, 30;
512, 20, 30, 9867, 80, 38, 15;
256, 40, 18, 17, 108, 716, 9159;
256, 40, 19, 59, 366, 1471, 8104;
256, 40, 20, 245, 934, 2119, 6702;
256, 40, 21, 698, 1704, 2515, 5083;
256, 40, 22, 1692, 2395, 2380, 3533;
256, 40, 23, 3177, 2571, 1970, 2282;
256, 40, 24, 4861, 2312, 1411, 1416;
256, 40, 25, 6461, 1742, 951, 846;
256, 40, 26, 7737, 1231, 584, 448;
256, 40, 27, 8630, 804, 323, 243;
256, 40, 28, 9224, 475, 175, 126;
256, 40, 29, 9583, 246, 109, 62;
256, 40, 30, 9780, 139, 53, 28;
256, 20, 18, 47, 252, 952, 8749;
256, 20, 19, 206, 667, 1587, 7540;
256, 20, 20, 706, 1334, 2049, 5911;
256, 20, 21, 1741, 1890, 2105, 4264;
256, 20, 22, 3251, 2115, 1809, 2825;
256, 20, 23, 5068, 1864, 1334, 1734;
256, 20, 24, 6750, 1340, 883, 1027;
256, 20, 25, 7975, 918, 539, 568;
256, 20, 26, 8820, 568, 311, 301;
256, 20, 27, 9376, 306, 165, 153;
256, 20, 28, 9689, 145, 95, 71;
256, 20, 29, 9839, 86, 45, 30;
256, 20, 30, 9921, 46, 19, 14;
];
% 상수 정의
Lv1_weight = 5.602;
Lv2_weight = 4.789;
Lv3_weight = 3.807;
Lv4_weight = 3.23;
% 주어진 dim과 snr에 해당하는 데이터 필터링
data = full_data(full_data(:,1) == dim & full_data(:,2) == snr, 3:end);
% 데이터 필터링 및 FLOPs 계산
targetPSNR = data(:, 1);
Lv1 = data(:, 2);
Lv2 = data(:, 3);
Lv3 = data(:, 4);
Lv4 = data(:, 5);
Lv4_FLOPs = Lv4 * Lv4_weight;
Lv3_FLOPs = Lv3 * Lv3_weight;
Lv2_FLOPs = Lv2 * Lv2_weight;
Lv1_FLOPs = Lv1 * Lv1_weight;
% 모든 FLOPs를 하나의 행렬로 결합
flopsData = [Lv4_FLOPs, Lv3_FLOPs, Lv2_FLOPs, Lv1_FLOPs];
% Compression Ratio 설정
if dim == 512
cr_text = 'CR: 1/6';
elseif dim == 256
cr_text = 'CR: 1/12';
else
cr_text = 'CR: Unknown';
end
% 스택형 막대 그래프 그리기
figure;
bar(targetPSNR, flopsData, 'stacked');
% 그래프 설정
xlabel('Target PSNR (dB)');
ylabel('FLOPs');
ylim([0, 70000]);
grid on;
legend('Lv4', 'Lv3', 'Lv2', 'Lv1', 'Location','northwest');
title(sprintf('%s, SNR: %d dB', cr_text, snr));
end
% 함수 호출 예시
'DE > Graph' 카테고리의 다른 글
X: FLOPs constraint, Y: Avg PSNR (0) | 2024.09.04 |
---|---|
Feasibility for target PSNR (0) | 2024.09.04 |
TopK Activate layer (0) | 2024.09.03 |
CBS activated layer (0) | 2024.09.03 |
X: Target PSNR, Y: FLOPs, SNR : [40, 20], CR: [1/6, 1/12] (0) | 2024.09.03 |
Comments