| 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)) - 0.6 |
|
|
| |
| 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] |
| OV_COCO = [42.0, 41.8, 42.6, 42.5, 43.3, 43.3] |
|
|
| |
| width = 0.25 |
|
|
| |
| fig, ax = plt.subplots(figsize=(8, 4)) |
|
|
| |
| bars1 = ax.bar(x - width, VOC21, width, label=r'VOC21', color='#1f77b4', edgecolor='white', hatch='X') |
| bars2 = ax.bar(x, COCO_Obj, width, label=r'COCO-Obj', color="#ff7f0e", edgecolor='white', hatch='X') |
| bars3 = ax.bar(x + width, OV_COCO, width, label=r'OV-COCO', color='#2ca02c', edgecolor='white', hatch='X') |
|
|
| |
| ax.set_xticks(x) |
| ax.set_xticklabels(categories, fontsize=16, ha='center') |
|
|
| |
| ax.legend(fontsize=14, loc='upper center', bbox_to_anchor=(0.46, 1.0), ncol=3, frameon=True, |
| handletextpad=0.5, columnspacing=1.0, handlelength=1.5, handleheight=1.3) |
| |
|
|
| |
| highlight_fontsize = 15 |
| for bar, value in zip(bars1, VOC21): |
| if value == max(VOC21): |
| ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), f'{value:.1f}', |
| ha='center', va='bottom', fontsize=highlight_fontsize, color='red', fontweight='bold') |
| else: |
| ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), f'{value:.1f}', |
| ha='center', va='bottom', fontsize=14) |
|
|
| for bar, value in zip(bars2, COCO_Obj): |
| if value == max(COCO_Obj): |
| ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), f'{value:.1f}', |
| ha='center', va='bottom', fontsize=highlight_fontsize, color='red', fontweight='bold') |
| else: |
| ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), f'{value:.1f}', |
| ha='center', va='bottom', fontsize=14) |
|
|
| for bar, value in zip(bars3, OV_COCO): |
| if value == max(OV_COCO): |
| ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), f'{value:.1f}', |
| ha='center', va='bottom', fontsize=highlight_fontsize, color='red', fontweight='bold') |
| else: |
| ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height(), f'{value:.1f}', |
| ha='center', va='bottom', fontsize=14) |
|
|
| |
| ax.spines['top'].set_visible(False) |
| ax.spines['right'].set_visible(False) |
|
|
| |
| plt.tight_layout() |
| plt.savefig('vfm_ablation.png', dpi=300) |