| import numpy as np |
| import matplotlib.pyplot as plt |
| from matplotlib.patches import Patch, Wedge |
| import matplotlib.patheffects as PathEffects |
|
|
| |
| labels = [ |
| 'ADE847', 'PC459', 'ADE150', 'PC59', 'VOC20', 'VOC21', |
| 'OV-COCO', 'OV-LVIS', 'Obj365', 'COCO', |
| 'PC60', 'COCO-Obj', 'City', 'PC59', 'ADE', 'COCO-Stf' |
| ] |
|
|
| declip_value = [15.3, 21.4, 36.3, 60.6, 96.6, 81.3, |
| 49.5, 41.5, 20.0, 41.5, |
| 37.9, 38.7, 35.7, 41.6, 23.1, 26.8] |
|
|
| catseg_value = [12.0, 19.0, 31.8, 57.5, 94.6, 77.3, |
| 0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0] |
|
|
| clipself_value = [0, 0, 0, 0, 0, 0, |
| 44.3, 34.9, 19.5, 40.5, |
| 0, 0, 0, 0, 0, 0] |
|
|
| clearclip_value = [0, 0, 0, 0, |
| 0, 0, 0, 0, 0, 0, |
| 32.6, 33.0, 30.0, 35.9, 16.7, 23.9] |
|
|
| declip_target = 40 |
|
|
| |
| def normalize_values(target, base_values, method_values): |
| normalized = [] |
| for base, value in zip(base_values, method_values): |
| if base == 0 or value == 0: |
| normalized.append(0) |
| else: |
| normalized.append((value / base) * target) |
| return normalized |
|
|
| |
| declip_color = '#8c6d53' |
| catseg_color = '#91acdd' |
| clipself_color = '#79b453' |
| clearclip_color = '#c55a11' |
|
|
| declip = normalize_values(declip_target, declip_value, declip_value) |
| catseg = normalize_values(declip_target, declip_value, catseg_value) |
| clipself = normalize_values(declip_target, declip_value, clipself_value) |
| clearclip = normalize_values(declip_target, declip_value, clearclip_value) |
|
|
| |
| num_labels = len(labels) |
| angles = np.linspace(0, 2 * np.pi, num_labels, endpoint=False).tolist() |
| angles += angles[:1] |
|
|
| |
| declip = np.concatenate((declip, [declip[0]])) |
| catseg = np.concatenate((catseg, [catseg[0]])) |
| clipself = np.concatenate((clipself, [clipself[0]])) |
| clearclip = np.concatenate((clearclip, [clearclip[0]])) |
|
|
| fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True)) |
| ax.set_ylim(0, 42) |
|
|
|
|
| |
| ax.plot(angles, declip, color=declip_color, linewidth=3.2, linestyle='solid', zorder=3, |
| path_effects=[PathEffects.withStroke(linewidth=6, foreground="white")]) |
| ax.plot(angles, catseg, color=catseg_color, linewidth=2.0, linestyle='dashed', zorder=2) |
| ax.plot(angles, clipself, color=clipself_color, linewidth=2.0, linestyle='dashed', zorder=2) |
| ax.plot(angles, clearclip, color=clearclip_color, linewidth=2.0, linestyle='dashed', zorder=2) |
|
|
| |
| ax.fill(angles, declip, color=declip_color, alpha=0.1, zorder=1) |
| ax.fill(angles, catseg, color=catseg_color, alpha=0.1, zorder=1) |
| ax.fill(angles, clipself, color=clipself_color, alpha=0.1, zorder=1) |
| ax.fill(angles, clearclip, color=clearclip_color, alpha=0.1, zorder=1) |
|
|
| |
| ax.scatter(angles, declip, facecolors=declip_color, s=65, zorder=4, alpha=0.95, linewidth=1, edgecolors='white') |
| ax.scatter(angles, catseg, facecolors=catseg_color, s=50, zorder=3, alpha=0.85, linewidth=0.5, edgecolors='white') |
| ax.scatter(angles, clipself, facecolors=clipself_color, s=50, zorder=3, alpha=0.85, linewidth=0.5, edgecolors='white') |
| ax.scatter(angles, clearclip, facecolors=clearclip_color, s=50, zorder=3, alpha=0.85, linewidth=0.5, edgecolors='white') |
|
|
| |
| theta = np.linspace(0, 2 * np.pi, 500) |
| ax.plot(theta, [42] * len(theta), color='black', linestyle='-', linewidth=1.5, alpha=0.7, zorder=0) |
| ax.set_yticks([10, 20, 30, 40]) |
| ax.set_yticklabels([]) |
|
|
|
|
| |
| for idx, (angle, val, raw_val) in enumerate(zip(angles, declip, declip_value + [declip_value[0]])): |
| if raw_val > 0: |
| if (idx==0 or idx==len(declip)-1) or idx==8: |
| txt = ax.text(angle+0.05, val, f'{raw_val:.1f}', color=declip_color, fontsize=12.5, fontweight='bold', |
| ha='center', va='center', zorder=5) |
| txt.set_path_effects([PathEffects.withStroke(linewidth=3, foreground="white")]) |
| else: |
| txt = ax.text(angle, val, f'{raw_val:.1f}', color=declip_color, fontsize=12.5, fontweight='bold', |
| ha='center', va='center', zorder=5) |
| txt.set_path_effects([PathEffects.withStroke(linewidth=3, foreground="white")]) |
|
|
| |
| ax.set_xticks(angles[:-1]) |
|
|
| ax.set_xticklabels(labels, fontsize=13, fontweight='bold', |
| path_effects=[PathEffects.withStroke(linewidth=3, foreground="white")]) |
| |
|
|
|
|
|
|
| |
| legend_elements = [ |
| Patch(facecolor=declip_color, edgecolor='white', label='DeCLIP (Ours)'), |
| Patch(facecolor=catseg_color, edgecolor='white', label='CATSeg (OVSS SOTA)'), |
| Patch(facecolor=clipself_color, edgecolor='white', label='CLIPSelf (OVD SOTA)'), |
| Patch(facecolor=clearclip_color, edgecolor='white', label='ClearCLIP (ZSSS SOTA)'), |
| ] |
| ax.legend( |
| handles=legend_elements, |
| frameon=True, |
| fontsize=12, |
| loc='upper center', |
| bbox_to_anchor=(0.5, 1.16), |
| ncol=2, |
| framealpha=0.1, |
| borderaxespad=0.4, |
| handleheight=1.3 |
| ) |
| plt.tight_layout() |
| plt.savefig('radar_chart.png', dpi=300, bbox_inches='tight', transparent=True) |