import matplotlib.pyplot as plt import numpy as np # 层数和数据 layers = ["3", "6", "9", "12"] segmentation_MIoU = [39.58625, 43.8675, 43.6925, 44.1] detection_ap = [31.4, 35.6, 39.5, 43.3] # 曲线样式(继承原风格) curve_configs = [ { "label": "Avg. mIoU", "color": "#2077b4", # 蓝色 "marker": "o", "linestyle": "--", "linewidth": 3, "markersize": 9, "zorder": 3, }, { "label": "mAP (Novel)", "color": "#ff7f0e", # 橙色 "marker": "s", "linestyle": "--", "linewidth": 3, "markersize": 9, "zorder": 2, }, ] plt.figure(figsize=(4, 3)) # 画两条折线 plt.plot( layers, segmentation_MIoU, label=curve_configs[0]["label"], linestyle=curve_configs[0]["linestyle"], marker=curve_configs[0]["marker"], color=curve_configs[0]["color"], linewidth=curve_configs[0]["linewidth"], markersize=curve_configs[0]["markersize"], zorder=curve_configs[0]["zorder"], ) plt.plot( layers, detection_ap, label=curve_configs[1]["label"], linestyle=curve_configs[1]["linestyle"], marker=curve_configs[1]["marker"], color=curve_configs[1]["color"], linewidth=curve_configs[1]["linewidth"], markersize=curve_configs[1]["markersize"], zorder=curve_configs[1]["zorder"], ) # plt.xlabel("Layer Number", fontsize=12) # plt.ylabel("Score", fontsize=12) plt.grid(True, linestyle='--', alpha=0.6) # plt.tick_params(axis='both', which='major', labelsize=12) plt.tick_params(axis='x', labelsize=14) # x轴刻度大 plt.tick_params(axis='y', labelsize=12) # y轴刻度不变 plt.tight_layout() plt.legend(fontsize=14, loc='best') plt.savefig("layers_effect.pdf", dpi=300) plt.close()