File size: 1,636 Bytes
7e3773e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import matplotlib.pyplot as plt
import numpy as np

# 数据
categories = ['DINO-B/8', 'DINO-B/16', 'SAM-B/16', 'SAM-L/16', 'DINOv2-B/14', 'DINOv2-L/14']
x = np.arange(len(categories))
OV_COCO = [42.0, 41.8, 42.6, 42.5, 43.3, 43.3]
VOC21 = [59.7, 61.5, 55.0, 58.9, 64.1, 62.8]
COCO_Obj = [31.2, 32.3, 25.8, 30.7, 38.7, 36.7]

# 设置柱状图宽度
width = 0.25  # 调整宽度以适应更多类别

# 创建图形
fig, ax = plt.subplots(figsize=(12, 6))  # 调整图形大小以适应更多类别

# 绘制柱状图,调整颜色和填充
bars1 = ax.bar(x - width, OV_COCO, width, label=r'OV-COCO (AP_novel)', color='#1f77b4', edgecolor='white', hatch='X')  # 第1组
bars2 = ax.bar(x, VOC21, width, label=r'VOC21 (mIoU)', color='#ff7f0e', edgecolor='white', hatch='X')          # 第2组
bars3 = ax.bar(x + width, COCO_Obj, width, label=r'COCO-Obj (mIoU)', color='#2ca02c', edgecolor='white', hatch='X')  # 第3组

# 添加标题和标签
ax.set_xticks(x)
# ax.set_xticklabels(categories, fontsize=14, rotation=45, ha='center')  # 调整字体大小并居中显示
ax.set_xticklabels(categories, fontsize=14, ha='center')  # 调整字体大小并居中显示

# 自动放置 legend
ax.legend(fontsize=14, loc='best')

# 在柱状图上添加数值
ax.bar_label(bars1, fmt='%.2f', fontsize=12, padding=3)  # 格式化数值显示为小数点后两位
ax.bar_label(bars2, fmt='%.2f', fontsize=12, padding=3)
ax.bar_label(bars3, fmt='%.2f', fontsize=12, padding=3)

# 美化图形
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

# 保存为图片
plt.tight_layout()
plt.savefig('vfm_ablations.pdf', dpi=300)