zhaoshiwen's picture
Add files using upload-large-folder tool
195054f verified
Raw
History Blame Contribute Delete
2.34 kB
import numpy as np
import matplotlib.pyplot as plt
def main():
labels = ['R1@0.5', 'R1@0.7', 'mAP@0.5', 'mAP@0.75', 'mAP']
alpha_values = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
data = {
"R1@0.5": [72.06, 72.19, 72.45, 72.58, 73.23, 72.71], # NMS 0.7, alpha=0.6 updated to 2026-03-23
"R1@0.7": [57.16, 57.42, 58.52, 57.74, 57.23, 56.77], # NMS 0.7, alpha=0.6 updated to 2026-03-23
"mAP@0.5": [72.45, 72.53, 73.08, 73.71, 73.41, 72.88], # NMS 0.7, alpha=0.6 updated to 2026-03-23
"mAP@0.75": [54.9, 55.56, 55.77, 56.39, 55.38, 54.76], # NMS 0.7, alpha=0.6 updated to 2026-03-23
"mAP": [52.63, 52.71, 53.08, 54.18, 53.11, 52.52], # NMS 0.7, alpha=0.6 updated to 2026-03-23
}
# 颜色 - 每个指标一个颜色
colors = {
"R1@0.5": (126 / 255, 153 / 255, 244 / 255), # 蓝色
"R1@0.7": (204 / 255, 124 / 255, 113 / 255), # 红色
"mAP@0.5": (122 / 255, 182 / 255, 86 / 255), # 绿色
"mAP@0.75": (146 / 255, 94 / 255, 176 / 255), # 紫色
"mAP": (165 / 255, 174 / 255, 183 / 255), # 灰色
}
# 创建 2x2 子图,最后一个位置放 mAP
fig, axes = plt.subplots(2, 2, figsize=(10, 8))
axes = axes.flatten()
# 选择4个指标展示
metrics_to_show = ["R1@0.5", "mAP@0.5", "mAP@0.75", "mAP"]
# 每个子图使用不同的 marker
markers = ['o', 's', '^', 'D'] # 圆圈、方块、三角、菱形
for idx, metric in enumerate(metrics_to_show):
ax = axes[idx]
values = data[metric]
color = colors[metric]
marker = markers[idx]
ax.plot(alpha_values, values, linewidth=3.0, color=color, marker=marker, markersize=8,
markerfacecolor='white', markeredgecolor=color, markeredgewidth=1.5)
ax.set_xlabel('α', fontsize=14, fontweight='bold')
ax.set_ylabel('Score (%)', fontsize=14, fontweight='bold')
ax.set_title(metric, fontsize=16, fontweight='bold')
ax.set_xticks(alpha_values)
ax.tick_params(axis='both', labelsize=12)
# 去掉网格虚线
plt.tight_layout()
plt.savefig("line_chart.pdf", bbox_inches='tight', pad_inches=0.2)
plt.savefig("line_chart.svg", bbox_inches='tight', pad_inches=0.2)
plt.show()
if __name__ == "__main__":
main()