fast_lio_time_log_analysis.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. clear
  2. close all
  3. Color_red = [0.6350 0.0780 0.1840];
  4. Color_blue = [0 0.4470 0.7410];
  5. Color_orange = [0.8500 0.3250 0.0980];
  6. Color_green = [0.4660 0.6740 0.1880];
  7. Color_lightblue = [0.3010 0.7450 0.9330];
  8. Color_purple = [0.4940 0.1840 0.5560];
  9. Color_yellow = [0.9290 0.6940 0.1250];
  10. fast_lio_ikdtree = csvread("./fast_lio_time_log.csv",1,0);
  11. timestamp_ikd = fast_lio_ikdtree(:,1);
  12. timestamp_ikd = timestamp_ikd - min(timestamp_ikd);
  13. total_time_ikd = fast_lio_ikdtree(:,2)*1e3;
  14. scan_num = fast_lio_ikdtree(:,3);
  15. incremental_time_ikd = fast_lio_ikdtree(:,4)*1e3;
  16. search_time_ikd = fast_lio_ikdtree(:,5)*1e3;
  17. delete_size_ikd = fast_lio_ikdtree(:,6);
  18. delete_time_ikd = fast_lio_ikdtree(:,7) * 1e3;
  19. tree_size_ikd_st = fast_lio_ikdtree(:,8);
  20. tree_size_ikd = fast_lio_ikdtree(:,9);
  21. add_points = fast_lio_ikdtree(:,10);
  22. fast_lio_forest = csvread("fast_lio_time_log.csv",1,0);
  23. fov_check_time_forest = fast_lio_forest(:,5)*1e3;
  24. average_time_forest = fast_lio_forest(:,2)*1e3;
  25. total_time_forest = fast_lio_forest(:,6)*1e3;
  26. incremental_time_forest = fast_lio_forest(:,3)*1e3;
  27. search_time_forest = fast_lio_forest(:,4)*1e3;
  28. timestamp_forest = fast_lio_forest(:,1);
  29. % Use slide window to calculate average
  30. L = 1; % Length of slide window
  31. for i = 1:length(timestamp_ikd)
  32. if (i<L)
  33. average_time_ikd(i) = mean(total_time_ikd(1:i));
  34. else
  35. average_time_ikd(i) = mean(total_time_ikd(i-L+1:i));
  36. end
  37. end
  38. for i = 1:length(timestamp_forest)
  39. if (i<L)
  40. average_time_forest(i) = mean(total_time_forest(1:i));
  41. else
  42. average_time_forest(i) = mean(total_time_forest(i-L+1:i));
  43. end
  44. end
  45. f = figure;
  46. set(gcf,'Position',[80 433 600 640])
  47. tiled_handler = tiledlayout(3,1);
  48. tiled_handler.TileSpacing = 'compact';
  49. tiled_handler.Padding = 'compact';
  50. nexttile;
  51. hold on;
  52. set(gca,'FontSize',12,'FontName','Times New Roman')
  53. plot(timestamp_ikd, average_time_ikd,'-','Color',Color_blue,'LineWidth',1.2);
  54. plot(timestamp_forest, average_time_forest,'--','Color',Color_orange,'LineWidth',1.2);
  55. lg = legend("ikd-Tree", "ikd-Forest",'location',[0.1314 0.8559 0.2650 0.0789],'fontsize',14,'fontname','Times New Roman')
  56. title("Time Performance on FAST-LIO",'FontSize',16,'FontName','Times New Roman')
  57. xlabel("time/s",'FontSize',16,'FontName','Times New Roman')
  58. yl = ylabel("Run Time/ms",'FontSize',15,'Position',[285.7 5.5000 -1]);
  59. xlim([32,390]);
  60. ylim([0,23]);
  61. ax1 = gca;
  62. ax1.YAxis.FontSize = 12;
  63. ax1.XAxis.FontSize = 12;
  64. grid on
  65. box on
  66. % print('./Figures/fastlio_exp_average','-depsc','-r600')
  67. index_ikd = find(search_time_ikd > 0);
  68. search_time_ikd = search_time_ikd(index_ikd);
  69. index_forest = find(search_time_forest > 0);
  70. search_time_forest = search_time_forest(index_forest);
  71. t = nexttile;
  72. hold on;
  73. boxplot_data_ikd = [incremental_time_ikd,total_time_ikd];
  74. boxplot_data_forest = [incremental_time_forest,total_time_forest];
  75. Colors_ikd = [Color_blue;Color_blue;Color_blue];
  76. Colors_forest = [Color_orange;Color_orange;Color_orange];
  77. % xticks([3,8,13])
  78. h_search_ikd = boxplot(search_time_ikd,'Whisker',50,'Positions',1,'Colors',Color_blue,'Widths',0.3);
  79. h_search_forest = boxplot(search_time_forest,'Whisker',50,'Positions',1.5,'Colors',Color_orange,'Widths',0.3);
  80. h_ikd = boxplot(boxplot_data_ikd,'Whisker',50,'Positions',[3,5],'Colors',Color_blue,'Widths',0.3);
  81. h_forest = boxplot(boxplot_data_forest,'Whisker',50,'Positions',[3.5,5.5],'Colors',Color_orange,'Widths',0.3);
  82. ax2 = gca;
  83. ax2.YAxis.Scale = 'log';
  84. xlim([0.5,6.0])
  85. ylim([0.0008,100])
  86. xticks([1.25 3.25 5.25])
  87. xticklabels({'Nearest Search',' Incremental Updates','Total Time'});
  88. yticks([1e-3,1e-2,1e-1,1e0,1e1,1e2])
  89. ax2.YAxis.FontSize = 12;
  90. ax2.XAxis.FontSize = 14.5;
  91. % ax.XAxis.FontWeight = 'bold';
  92. ylabel('Run Time/ms','FontSize',14,'FontName','Times New Roman')
  93. box_vars = [findall(h_search_ikd,'Tag','Box');findall(h_ikd,'Tag','Box');findall(h_search_forest,'Tag','Box');findall(h_forest,'Tag','Box')];
  94. for j=1:length(box_vars)
  95. if (j<=3)
  96. Color = Color_blue;
  97. else
  98. Color = Color_orange;
  99. end
  100. patch(get(box_vars(j),'XData'),get(box_vars(j),'YData'),Color,'FaceAlpha',0.25,'EdgeColor',Color);
  101. end
  102. Lg = legend(box_vars([1,4]), {'ikd-Tree','ikd-Forest'},'Location',[0.6707 0.4305 0.265 0.07891],'fontsize',14,'fontname','Times New Roman');
  103. grid on
  104. set(gca,'YMinorGrid','off')
  105. nexttile;
  106. hold on;
  107. grid on;
  108. box on;
  109. set(gca,'FontSize',12,'FontName','Times New Roman')
  110. plot(timestamp_ikd, alpha_bal_ikd,'-','Color',Color_blue,'LineWidth',1.2);
  111. plot(timestamp_ikd, alpha_del_ikd,'--','Color',Color_orange, 'LineWidth', 1.2);
  112. plot(timestamp_ikd, 0.6*ones(size(alpha_bal_ikd)), ':','Color','black','LineWidth',1.2);
  113. lg = legend("\alpha_{bal}", "\alpha_{del}",'location',[0.7871 0.1131 0.1433 0.069],'fontsize',14,'fontname','Times New Roman')
  114. title("Re-balancing Criterion",'FontSize',16,'FontName','Times New Roman')
  115. xlabel("time/s",'FontSize',16,'FontName','Times New Roman')
  116. yl = ylabel("\alpha",'FontSize',15, 'Position',[285.7 0.4250 -1])
  117. xlim([32,390]);
  118. ylim([0,0.85]);
  119. ax3 = gca;
  120. ax3.YAxis.FontSize = 12;
  121. ax3.XAxis.FontSize = 12;
  122. % print('./Figures/fastlio_exp_combine','-depsc','-r1200')
  123. % exportgraphics(f,'./Figures/fastlio_exp_combine_1.pdf','ContentType','vector')