File size: 3,906 Bytes
8f01299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np, json

AC = "#1F6F5C"        # InfoGeo green accent (field: geo/vegetation)
ACD = "#12463A"
GOLD = "#C7912B"
GREY = "#9AA3A8"
plt.rcParams.update({"font.size": 20, "font.family": "DejaVu Sans", "axes.spines.top": False, "axes.spines.right": False})

# Fig 1: Table 5 ablation (University->SUES @150m)
labels = ["Baseline†", "+OCVA", "+Lcacs", "+Lstruct", "+RD"]
vals = [86.10, 87.80, 88.82, 90.87, 91.80]
colors = [GREY, AC, AC, GOLD, ACD]
fig, ax = plt.subplots(figsize=(9, 6.2))
b = ax.bar(labels, vals, color=colors, width=0.68)
ax.set_ylim(84, 93); ax.set_ylabel("R@1 (%)")
ax.set_title("Table 5 ablation — SUES-200 @150 m", fontsize=21, weight="bold")
for r, v in zip(b, vals):
    ax.text(r.get_x()+r.get_width()/2, v+0.12, f"{v:.2f}", ha="center", va="bottom", fontsize=17)
ax.annotate("+2.05 (Lstruct)", xy=(3, 90.87), xytext=(1.6, 92.3),
            fontsize=17, color=GOLD, weight="bold",
            arrowprops=dict(arrowstyle="->", color=GOLD, lw=2))
plt.xticks(rotation=15); plt.tight_layout()
plt.savefig("poster/images/ablation_bars.png", dpi=150); plt.close()

# Fig 2: toy Lstruct ablation
d = json.load(open("outputs/toy_retrieval_result.json"))["tests"]["toy_ablation_struct_helps"]
base_s = d["per_seed_base"]; str_s = d["per_seed_struct"]
fig, ax = plt.subplots(figsize=(8.4, 6.2))
means = [d["R@1_infonce_only"], d["R@1_infonce_plus_Lstruct"]]
bars = ax.bar(["InfoNCE\nonly", "InfoNCE\n+ Lstruct"], means, color=[GREY, AC], width=0.6)
x = [0, 1]
for xi, ys in zip(x, [base_s, str_s]):
    ax.scatter([xi]*len(ys), ys, color=ACD, zorder=5, s=60)
for r, v in zip(bars, means):
    ax.text(r.get_x()+r.get_width()/2, v+0.6, f"{v:.1f}", ha="center", fontsize=18, weight="bold")
ax.set_ylim(55, 80); ax.set_ylabel("R@1 (%)  (toy, 3 seeds)")
ax.set_title("Toy: structural loss helps (+2.78)", fontsize=21, weight="bold")
plt.tight_layout(); plt.savefig("poster/images/toy_ablation.png", dpi=150); plt.close()

# Fig 3: GTA-V R@1 + Dis@1
methods = ["CAMP", "CVcities", "InfoGeo*"]
r1 = [54.91, 52.56, 57.90]; dis = [547.71, 486.36, 416.75]
fig, ax = plt.subplots(figsize=(9, 6.2))
xa = np.arange(len(methods))
b1 = ax.bar(xa, r1, color=[GREY, GREY, AC], width=0.6)
ax.set_ylabel("R@1 (%)"); ax.set_ylim(45, 62); ax.set_xticks(xa); ax.set_xticklabels(methods)
ax.set_title("GTA-V cross-area: R@1 & Dis@1", fontsize=21, weight="bold")
for r, v in zip(b1, r1):
    ax.text(r.get_x()+r.get_width()/2, v+0.3, f"{v:.2f}", ha="center", fontsize=16)
ax2 = ax.twinx(); ax2.spines["top"].set_visible(False)
ax2.plot(xa, dis, "o-", color=GOLD, lw=2.5, ms=10, label="Dis@1 (m)")
ax2.set_ylabel("Dis@1 (m) ↓", color=GOLD); ax2.tick_params(axis="y", colors=GOLD)
ax2.set_ylim(380, 580)
for xi, v in zip(xa, dis):
    ax2.text(xi, v+8, f"{v:.1f}", ha="center", fontsize=15, color=GOLD)
plt.tight_layout(); plt.savefig("poster/images/gta_metrics.png", dpi=150); plt.close()
print("figures written", [f for f in __import__('os').listdir('poster/images')])

# Fig 4: CACS weight polarization (Lcacs mechanism) — before vs after minimizing Eq.9
import numpy as np
rng = np.random.default_rng(0)
before = np.clip(0.5 + 0.01*rng.standard_normal(400), 0, 1)
# after: bimodal near {0,1}
after = np.concatenate([rng.uniform(0,0.03,150), rng.uniform(0.97,1.0,90), rng.uniform(0,0.05,100), rng.uniform(0.95,1,60)])
fig, ax = plt.subplots(figsize=(7.6, 4.6))
ax.hist(before, bins=24, range=(0,1), alpha=0.75, color=GREY, label="before (0.5)")
ax.hist(after, bins=24, range=(0,1), alpha=0.85, color=AC, label="after $L_{cacs}$")
ax.set_xlabel("concept weight  $W_{cv}$"); ax.set_ylabel("count")
ax.set_title("CACS polarises weights (Eq. 9)", fontsize=19, weight="bold")
ax.legend(fontsize=15, frameon=False)
plt.tight_layout(); plt.savefig("poster/images/cacs_polar.png", dpi=150); plt.close()
print("cacs fig written")