UOMOP
TopK Activate layer 본문
plot_flops(512, 40);
function plot_flops(dim, snr)
% 데이터 초기화
full_data = [
512, 40, 18, 2, 68, 788, 9142;
512, 40, 19, 5, 163, 1428, 8404;
512, 40, 20, 15, 367, 2263, 7355;
512, 40, 21, 49, 758, 3153, 6040;
512, 40, 22, 119, 1396, 3800, 4685;
512, 40, 23, 308, 2206, 4143, 3343;
512, 40, 24, 666, 3123, 3959, 2252;
512, 40, 25, 1281, 3873, 3396, 1450;
512, 40, 26, 2214, 4227, 2670, 889;
512, 40, 27, 3461, 4068, 1955, 516;
512, 40, 28, 4891, 3446, 1383, 280;
512, 40, 29, 6292, 2632, 914, 162;
512, 40, 30, 7461, 1881, 559, 99;
512, 20, 18, 11, 116, 905, 8968;
512, 20, 19, 35, 273, 1628, 8064;
512, 20, 20, 105, 620, 2459, 6816;
512, 20, 21, 264, 1161, 3200, 5375;
512, 20, 22, 666, 1828, 3509, 3997;
512, 20, 23, 1427, 2460, 3410, 2703;
512, 20, 24, 2543, 2877, 2876, 1704;
512, 20, 25, 4073, 2763, 2145, 1019;
512, 20, 26, 5639, 2275, 1513, 573;
512, 20, 27, 7137, 1609, 938, 316;
512, 20, 28, 8280, 1013, 539, 168;
512, 20, 29, 9051, 580, 287, 82;
512, 20, 30, 9547, 287, 134, 32;
256, 40, 18, 15, 117, 834, 9034;
256, 40, 19, 35, 315, 1414, 8236;
256, 40, 20, 122, 634, 2163, 7081;
256, 40, 21, 298, 1159, 2850, 5693;
256, 40, 22, 729, 1762, 3220, 4289;
256, 40, 23, 1441, 2368, 3251, 2940;
256, 40, 24, 2576, 2674, 2851, 1899;
256, 40, 25, 4014, 2596, 2222, 1168;
256, 40, 26, 5523, 2193, 1628, 656;
256, 40, 27, 6927, 1621, 1073, 379;
256, 40, 28, 8011, 1076, 717, 196;
256, 40, 29, 8772, 712, 411, 105;
256, 40, 30, 9299, 410, 244, 47;
256, 20, 18, 33, 202, 1040, 8725;
256, 20, 19, 102, 468, 1680, 7750;
256, 20, 20, 275, 944, 2353, 6428;
256, 20, 21, 736, 1490, 2886, 4888;
256, 20, 22, 1534, 2017, 2976, 3473;
256, 20, 23, 2839, 2282, 2654, 2225;
256, 20, 24, 4420, 2167, 2050, 1363;
256, 20, 25, 6040, 1754, 1436, 770;
256, 20, 26, 7474, 1168, 937, 421;
256, 20, 27, 8503, 721, 559, 217;
256, 20, 28, 9181, 408, 295, 116;
256, 20, 29, 9606, 204, 138, 52;
256, 20, 30, 9820, 97, 61, 22;
];
% 상수 정의
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' 카테고리의 다른 글
Feasibility for target PSNR (0) | 2024.09.04 |
---|---|
Random 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 |
[CBS / TopK / RS] : target PSNR, level select, final FLOPs, avg PSNR (0) | 2024.09.02 |
Comments