DeCLIP-TPAMI / tools /plot_hyperv3.py
xiaomoguhzz's picture
Add files using upload-large-folder tool
7e3773e verified
import matplotlib.pyplot as plt
import numpy as np
# 数据集
datasets = {
"COCO-Stuff": [25.44, 26.07, 26.64, 26.82, 26.91, 27.05, 27.0, 27.13, 27.17, 27.21],
"ADE": [21.88, 22.54, 23.03, 23.14, 23.16, 23.24, 23.17, 23.24, 23.24, 23.22],
"CityScape": [34.53, 35.62, 35.81, 35.75, 35.71, 35.59, 35.37, 35.37, 35.36, 35.38],
"COCO-Obj": [37.01, 37.9, 38.55, 38.7, 38.71, 38.76, 38.58, 38.79, 38.79, 38.82],
"Context 60": [35.82, 36.71, 37.69, 37.9, 38.05, 38.25, 38.48, 38.53, 38.59, 38.65],
"Context 59": [39.64, 40.46, 41.41, 41.63, 41.75, 41.94, 42.2, 42.2, 42.25, 42.32],
"VOC 20": [83.53, 84.57, 85.29, 85.33, 85.43, 85.58, 85.17, 85.62, 85.63, 85.58],
"VOC 21": [61.44, 62.58, 63.74, 64.1, 64.39, 64.74, 64.91, 65.19, 65.33, 65.44],
"OV-COCO": [41.7, 42.8, 43.3, 42.7, 42.4, 42.0, 42.2, 41.8, 42.0, 41.5],
}
hyperparams = np.linspace(0.1, 1.0, 10)
# 获取除OV-COCO外的所有分割数据集
seg_datasets = [k for k in datasets if k != "OV-COCO"]
# 计算每个超参下的平均mIoU
seg_results = np.array([datasets[k] for k in seg_datasets])
avg_miou = np.mean(seg_results, axis=0)
plt.figure(figsize=(4, 3)) # 将高度压缩
# avg mIoU 曲线
plt.plot(
hyperparams, avg_miou,
label="DeCLIP Avg. mIoU",
color="#2077b4",
marker="o",
linestyle='--',
linewidth=3,
markersize=6,
zorder=5
)
# OV-COCO 曲线
plt.plot(
hyperparams, datasets["OV-COCO"],
label="DeCLIP mAP (Novel)",
color="#d62728",
marker="s",
linestyle='--',
linewidth=3,
markersize=6,
zorder=10
)
# 添加14.1的横虚线(CLIP avg baseline)
plt.axhline(14.1, color="#2ca02c", linestyle="--", linewidth=2, label="CLIP Avg. mIoU")
# 添加17.5的横虚线(CLIP OV-COCO baseline)
plt.axhline(17.5, color="#d62728", linestyle="--", linewidth=2, label="CLIP mAP (Novel)")
# plt.xlabel("Hyperparameter Value", fontsize=13)
# plt.ylabel("mIoU (%)", fontsize=13)
plt.grid(True, linestyle='--', alpha=0.6)
plt.tick_params(axis='x', labelsize=14) # x轴刻度大
plt.tick_params(axis='y', labelsize=12) # y轴刻度不变
plt.legend(fontsize=14, loc='best')
plt.tight_layout()
plt.savefig("hyperparameter.pdf", dpi=300)
plt.close()