diff --git a/figures/_fonts/STIX-Two-Text-Regular.ttf b/figures/_fonts/STIX-Two-Text-Regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..f9ba2150c0377010e1c56658191629a7749fa47d Binary files /dev/null and b/figures/_fonts/STIX-Two-Text-Regular.ttf differ diff --git a/figures/alignment/alignment_reward.pdf b/figures/alignment/alignment_reward.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8fd393c8b7b7d9c05445ab2d882ab182eb757620 Binary files /dev/null and b/figures/alignment/alignment_reward.pdf differ diff --git a/figures/alignment/alignment_reward.png b/figures/alignment/alignment_reward.png new file mode 100644 index 0000000000000000000000000000000000000000..1bd8929370d72453bde2cdc38a0115e7af53aa5b --- /dev/null +++ b/figures/alignment/alignment_reward.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f77139ecf479139ab390976568eac9efb35093b11c15a431774edca18b383d67 +size 462371 diff --git a/figures/alignment/alignment_vqa.pdf b/figures/alignment/alignment_vqa.pdf new file mode 100644 index 0000000000000000000000000000000000000000..78260b1f7d623b048e0bf43527666b3fcbe83f02 Binary files /dev/null and b/figures/alignment/alignment_vqa.pdf differ diff --git a/figures/alignment/alignment_vqa.png b/figures/alignment/alignment_vqa.png new file mode 100644 index 0000000000000000000000000000000000000000..ce25e624b3c992dbaa95c97af9dacbd6253f39a4 --- /dev/null +++ b/figures/alignment/alignment_vqa.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75249120a4ccfd19543bde209d5f6f4145666c62d61e27502cfe7d6c9c1c953b +size 332341 diff --git a/figures/alignment/plot_alignment_correlation.py b/figures/alignment/plot_alignment_correlation.py new file mode 100644 index 0000000000000000000000000000000000000000..1fd09b2ae050683f4c5c85f846c0175bf10e37ec --- /dev/null +++ b/figures/alignment/plot_alignment_correlation.py @@ -0,0 +1,489 @@ +"""Per-benchmark overlay: rewards vs MLLM_Judge in one panel. + +Both axes are min-max normalised to [0,1] per benchmark so all panels share +identical [0,1] x [0,1] axes and a perfect aligner sits on the diagonal. + +Two figures are produced: + Figure 1 (traditional rewards): CLIPScore, HPSv3, PickScore, UnifiedReward-9B, VQAScore-9B + Figure 2 (VQA family): VQAScore-binary-9B, VQAScore-9B + +Each figure is a single row of 4 benchmark panels: +longbencht2i, t2icompbench, t2icorebench_composition, tiifbench. +""" +from __future__ import annotations + +import re +from pathlib import Path + +import matplotlib.colors as mcolors +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +from matplotlib.offsetbox import AnchoredOffsetbox, HPacker, TextArea, VPacker +from matplotlib.patches import Polygon +from scipy.stats import pearsonr + +ROOT = Path(__file__).resolve().parent +SRC = ROOT.parent.parent / "sheet_exports" / "alignment.txt" + +# Register and select the shared STIX Two Text typeface. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, +}) +JUDGE_COL = "MLLM_Judge" + +BENCHMARKS = ["t2icompbench", "tiifbench", "spatialgeneval", "t2icorebench_composition", "longbencht2i"] +BENCHMARK_DISPLAY = { + "t2icompbench": "T2I-CompBench", + "tiifbench": "TIIFBench", + "t2icorebench_composition": "T2I-CoReBench-\nComposition", + "longbencht2i": "LongBench-T2I", + "spatialgeneval": "SpatialGenEval", +} +GROUPS = { + "rewards_classic": ["CLIPScore", "HPSv3", "PickScore", "ImageReward", + "UnifiedReward-9B", "VQAScore-9B"], + "rewards_vqa": ["VQAScore-binary-9B", "VQAScore-Gemma-4-E4B", "VQAScore-9B"], +} +# Google brand colors (+ Google purple for the 5th slot in the classic group) +GOOGLE_BLUE = "#4285F4" +GOOGLE_RED = "#EA4335" +GOOGLE_YELLOW = "#FBBC05" +GOOGLE_GREEN = "#34A853" +GOOGLE_PURPLE = "#A142F4" +# VQAScore-9B kept blue across both figures so the classic figure avoids a +# collision with CLIPScore (also red); the VQA-family figure uses pure +# Google brand colors (blue + red). +GOOGLE_TEAL = "#00ACC1" +GOOGLE_ORANGE = "#FF9800" +COLORS = { + "CLIPScore": GOOGLE_RED, + "HPSv3": GOOGLE_YELLOW, + "PickScore": GOOGLE_GREEN, + "ImageReward": GOOGLE_TEAL, + "UnifiedReward-9B": GOOGLE_PURPLE, + "VQAScore-Gemma-4-E4B": GOOGLE_ORANGE, + "VQAScore-9B": GOOGLE_BLUE, + "VQAScore-binary-9B": GOOGLE_RED, +} +# Distinct marker per reward to disambiguate beyond color. +MARKERS = { + "CLIPScore": "s", # square + "HPSv3": "P", # filled plus + "PickScore": "D", # diamond + "ImageReward": "*", # star + "UnifiedReward-9B": "^", # triangle up + "VQAScore-Gemma-4-E4B": "h", # hexagon + "VQAScore-9B": "o", # circle (highlight) + "VQAScore-binary-9B": "X", # filled x +} +# Per-marker visual scaling (some markers look smaller at the same area). +MARKER_SCALE = { + "s": 1.0, + "P": 1.45, # plus needs more area to read clearly + "D": 0.85, + "*": 1.55, # star looks smaller at same area + "^": 1.35, # triangle reads smaller too + "h": 1.05, # hexagon + "o": 1.0, + "X": 1.15, +} + + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE: 改下面这些数字就能调节图的字号 / 线宽 / 点大小 / 间距等 +# --------------------------------------------------------------------------- +STYLE = { + # ---- 整张图的画布尺寸 (英寸) ---- + # panel_w / panel_h 是单个 panel 的宽 / 高 (一共 2 行 × 3 列). + # right_pad 是图右边留给 legend 的额外空白宽度 (越大空白越多). + "panel_w": 3.8, # 单个 panel 宽 + "panel_h": 2.5, # 单个 panel 高 (想整体拉高就调这个) + "right_pad": 2.6, # 右侧给 legend 留的空白宽度 (英寸) + + # ---- 散点 panel 内, 右下角 benchmark 名字框 (T2I-CompBench 等) ---- + "bench_label_fontsize": 15, # benchmark 名字框文字字号 + "bench_label_x": 0.96, # 名字框水平位置 (1 = panel 最右) + "bench_label_y": 0.07, # 名字框垂直位置 (0 = panel 最下) + + # ---- 散点 panel 坐标轴 ---- + "panel_xlabel_fontsize": 16, # "Reward" 横坐标标题字号 + "panel_ylabel_fontsize": 16, # "Score" 纵坐标标题字号 + "panel_tick_fontsize": 14, # 散点 panel 刻度数字 (0.0 / 0.5 / 1.0) 字号 + + # ---- 散点 panel 内的散点和拟合线 ---- + "scatter_highlight_line_width": 4, # 高亮 reward (VQAScore-9B) 拟合线粗 + "scatter_highlight_point_size": 40, # 高亮 reward 散点大小 + "scatter_other_line_width": 1.5, # 其他 reward 拟合线粗 + "scatter_other_point_size": 32, # 其他 reward 散点大小 + + # ---- 中间下排的 r-vs-benchmark 折线图 ---- + "line_xlabel_fontsize": 16, # "Benchmark" 横坐标标题字号 + "line_ylabel_fontsize": 16, # "Pearson r" 纵坐标标题字号 + "line_tick_fontsize": 14, # 折线图刻度数字字号 + "line_highlight_line_width": 3, # 高亮 reward 折线粗细 + "line_highlight_marker_size": 10, # 高亮 reward 折线上的点大小 + "line_other_line_width": 2, # 其他 reward 折线粗细 + "line_other_marker_size": 8, # 其他 reward 折线上的点大小 + + # ---- 右侧 legend (CLIPScore / HPSv3 / ... 那一列) ---- + "legend_fontsize": 15, # legend 文字字号 + "legend_marker_size": 12, # legend 上点的大小 (会按 MARKER_SCALE 再缩放) + "legend_highlight_line_width": 3, # legend 上高亮 reward 的小线段粗细 + "legend_other_line_width": 2.4, # legend 上其他 reward 的小线段粗细 + "legend_handle_len": 2.4, # legend 上小线段的长度 + "legend_label_spacing": 1.4, # legend 各项之间的垂直距离 (越大越松) + "legend_x_offset": 0.2, # legend 相对 panel 区域右侧的水平偏移 (英寸) + + # ---- 中间下排折线图的 "纵坐标跳跃" (broken y-axis) ---- + # 折线图会被切成上下两段, 中间用斜线断开. 两张图 (reward / vqa) 的范围不一样, + # 所以下面分成两个子字典. main() 里给每张图传 split_key="reward" / "vqa". + # 各字段含义: + # low_min / low_max : 下半段纵坐标的下界 / 上界 + # high_min / high_max: 上半段纵坐标的下界 / 上界 + # height_ratio : (上半高度, 下半高度) 比例 — 写成跟 range 比例一致 + # 画出来上下视觉密度就一样; 上半比下半大就是放大上半段 + # hspace : 上下两段之间的间隙 (越大越分开) + # break_size : 中间斜线小标记的大小 (axes 比例) + # ylabel_x : "r" 标题相对 axes 的水平偏移 (越负越靠左) + "line_split": { + # alignment_reward 用: 上 0~1, 下 -1~-0.5 (中间 -0.5~0 被截掉) + "reward": { + "low_min": -1.0, + "low_max": -0.4, + "high_min": 0.1, + "high_max": 1.1, + "height_ratio": (2.5, 1.0), + "hspace": 0.1, + "break_size": 0.02, + "ylabel_x": -0.13, + }, + # alignment_vqa 用: 上 0.95~1.0, 下 0.7~0.8 (中间 0.8~0.95 被截掉) + "vqa": { + "low_min": 0.7, + "low_max": 0.8, + "high_min": 0.95, + "high_max": 1.0, + "height_ratio": (3, 1.0), + "hspace": 0.2, + "break_size": 0.02, + "ylabel_x": -0.13, + }, + }, +} +# --------------------------------------------------------------------------- + + +def parse_sections(path: Path) -> dict[str, pd.DataFrame]: + text = path.read_text() + sections: dict[str, pd.DataFrame] = {} + for match in re.finditer(r"=== (\S+) ===\n(.*?)(?=\n=== |\Z)", text, re.DOTALL): + name = match.group(1) + body = match.group(2).strip().splitlines() + header = body[0].split("\t") + rows = [line.split("\t") for line in body[1:] if line.strip()] + df = pd.DataFrame(rows, columns=header).set_index("Model") + df = df.apply(pd.to_numeric, errors="coerce") + sections[name] = df + return sections + + +def lighten(color, amount: float = 0.6): + """Mix toward white. amount=0 -> original, amount=1 -> white.""" + r, g, b = mcolors.to_rgb(color) + return (r + (1 - r) * amount, g + (1 - g) * amount, b + (1 - b) * amount) + + +def minmax(x: np.ndarray) -> np.ndarray | None: + if np.nanstd(x) == 0: + return None + return (x - np.nanmin(x)) / (np.nanmax(x) - np.nanmin(x)) + + +HIGHLIGHT = "VQAScore-9B" + +# Display label override (data column name → legend label). +DISPLAY_LABEL = { + "VQAScore-binary-9B": "VQAScore-Binary", + "VQAScore-Gemma-4-E4B": "VQAScore-Gemma", +} + + +def display_name(col: str) -> str: + name = DISPLAY_LABEL.get(col, col) + return re.sub(r"-\d+B$", "", name) + + +def _draw_pearson_lines(ax, xs_idx: np.ndarray, rewards: list[str], + rho_by_bench: dict[str, dict[str, float]]) -> None: + """Draw the per-reward Pearson r line series onto a single axes.""" + for col in rewards: + ys = [rho_by_bench.get(b, {}).get(col, np.nan) for b in BENCHMARKS] + is_hi = col == HIGHLIGHT + base = COLORS[col] + if is_hi: + line_color = base + marker_face = lighten(base, 0.30) + marker_edge = base + lw = STYLE["line_highlight_line_width"] + ms = STYLE["line_highlight_marker_size"] + else: + line_color = (*lighten(base, 0.40), 0.75) + marker_face = (*lighten(base, 0.60), 0.60) + marker_edge = "white" + lw = STYLE["line_other_line_width"] + ms = STYLE["line_other_marker_size"] + ax.plot(xs_idx, ys, color=line_color, lw=lw, + marker=MARKERS[col], + markersize=ms * (MARKER_SCALE[MARKERS[col]] ** 0.5), + markerfacecolor=marker_face, markeredgecolor=marker_edge, + markeredgewidth=0.6, zorder=5 if is_hi else 3) + + +def plot_group(sections: dict[str, pd.DataFrame], rewards: list[str], out_stem: Path, + legend_labels: dict[str, str] | None = None, + split_key: str | None = None) -> None: + """split_key: 如果传 "reward" / "vqa" 这种 STYLE['line_split'] 里的 key, + 就启用 broken y-axis 并用对应那一组数值; 不传 (None) 就不分裂.""" + + split_y = split_key is not None + split_cfg = STYLE["line_split"][split_key] if split_y else {} + + def split(key): + return split_cfg[key] + + # Layout: 2 rows × 3 cols. Row 0 = first 3 benchmarks. Row 1 = [bench3, + # r-vs-benchmark line plot, bench4]. So the middle of row 2 carries the + # cross-benchmark r summary instead of a benchmark scatter panel. + panels_w = STYLE["panel_w"] * 3 + right_pad = STYLE["right_pad"] + fig, axes = plt.subplots(2, 3, + figsize=(panels_w + right_pad, STYLE["panel_h"] * 2)) + panel_positions = [(0, 0), (0, 1), (0, 2), (1, 0), (1, 2)] + benchmark_axes = [axes[r, c] for r, c in panel_positions] + line_ax = axes[1, 1] + _stair_polygons: list[tuple] = [] # (top_packer, bot_packer, polygon, ax) + rho_by_bench: dict[str, dict[str, float]] = {} + + for ax, bench in zip(benchmark_axes, BENCHMARKS): + df = sections[bench] + judge = df[JUDGE_COL].values + y = minmax(judge) + if y is None: + ax.text(0.5, 0.5, "judge has no variance", transform=ax.transAxes, + ha="center", va="center", color="gray") + ax.text(STYLE["bench_label_x"], STYLE["bench_label_y"], + BENCHMARK_DISPLAY[bench], transform=ax.transAxes, + ha="right", va="bottom", + fontsize=STYLE["bench_label_fontsize"], + bbox=dict(boxstyle="round,pad=0.32", facecolor="white", + edgecolor="0.7", linewidth=0.8, alpha=0.9)) + continue + + # Plot non-highlight rewards first (lower zorder, lighter), then the + # highlight reward on top with full saturation. + ordered = [c for c in rewards if c != HIGHLIGHT] + [c for c in rewards if c == HIGHLIGHT] + rho_per_reward: dict[str, float] = {} + for col in ordered: + vals = df[col].values + mask = ~(np.isnan(vals) | np.isnan(judge)) + x_raw = vals[mask] + y_pts = y[mask] + if len(x_raw) < 3: + continue + denom = x_raw.max() - x_raw.min() + constant_x = denom == 0 + if constant_x: + # All values identical (e.g. binary judge collapsed to 0). Place + # the points clustered at x=0 and draw a flat dotted line at + # the y-mean so the reward still appears in the panel. + x = np.zeros_like(x_raw, dtype=float) + else: + x = (x_raw - x_raw.min()) / denom + base = COLORS[col] + is_hi = col == HIGHLIGHT + if is_hi: + line_color = base + pt_color = (*lighten(base, 0.30), 0.90) + pt_edge = base + lw = STYLE["scatter_highlight_line_width"] + pt_size = STYLE["scatter_highlight_point_size"] + z_line = 5 + z_pt = 4 + else: + line_color = (*lighten(base, 0.40), 0.75) + pt_color = (*lighten(base, 0.60), 0.60) + pt_edge = "white" + lw = STYLE["scatter_other_line_width"] + pt_size = STYLE["scatter_other_point_size"] + z_line = 3 + z_pt = 2 + ax.scatter(x, y_pts, color=pt_color, s=pt_size * MARKER_SCALE[MARKERS[col]], + marker=MARKERS[col], + edgecolor=pt_edge, linewidth=0.4, zorder=z_pt) + xs = np.linspace(0, 1, 50) + if constant_x: + # No slope possible — flat dotted reference at the y mean. + y_mean = float(np.nanmean(y_pts)) + ax.plot(xs, np.full_like(xs, y_mean), color=line_color, + lw=lw, linestyle=":", zorder=z_line) + else: + slope, intercept = np.polyfit(x, y_pts, 1) + ax.plot(xs, slope * xs + intercept, color=line_color, lw=lw, zorder=z_line) + rho_per_reward[col] = pearsonr(x_raw, judge[mask])[0] + + ax.text(STYLE["bench_label_x"], STYLE["bench_label_y"], + BENCHMARK_DISPLAY[bench], transform=ax.transAxes, + ha="right", va="bottom", + fontsize=STYLE["bench_label_fontsize"], zorder=10, + bbox=dict(boxstyle="round,pad=0.32", facecolor="white", + edgecolor="0.7", linewidth=0.8, alpha=0.9)) + ax.set_xlim(-0.03, 1.03) + ax.set_ylim(-0.03, 1.03) + ax.set_xticks([0.0, 0.5, 1.0]) + ax.set_yticks([0.0, 0.5, 1.0]) + ax.set_xlabel("Reward", fontsize=STYLE["panel_xlabel_fontsize"]) + ax.set_ylabel("Score", fontsize=STYLE["panel_ylabel_fontsize"]) + ax.tick_params(labelsize=STYLE["panel_tick_fontsize"]) + ax.grid(True, color="0.75", linestyle="--", linewidth=0.7, alpha=0.85) + + rho_by_bench[bench] = rho_per_reward + + + # ── r-vs-benchmark line plot in the middle of row 2 ─────────────────── + xs_idx = np.arange(len(BENCHMARKS)) + if split_y: + # Replace the single cell with two stacked sub-axes (broken y-axis). + gs = line_ax.get_subplotspec() + line_ax.remove() + inner = gs.subgridspec(2, 1, + height_ratios=split("height_ratio"), + hspace=split("hspace")) + top_ax = fig.add_subplot(inner[0]) + bot_ax = fig.add_subplot(inner[1]) + + _draw_pearson_lines(top_ax, xs_idx, rewards, rho_by_bench) + _draw_pearson_lines(bot_ax, xs_idx, rewards, rho_by_bench) + + top_ax.set_ylim(split("high_min"), split("high_max")) + bot_ax.set_ylim(split("low_min"), split("low_max")) + + for ax_part in (top_ax, bot_ax): + ax_part.set_xticks(xs_idx) + ax_part.set_xticklabels([]) + ax_part.tick_params(axis="y", labelsize=STYLE["line_tick_fontsize"]) + ax_part.grid(True, color="0.75", linestyle="--", linewidth=0.7, alpha=0.85) + for side in ("top", "right", "left", "bottom"): + ax_part.spines[side].set_visible(True) + ax_part.spines[side].set_linewidth(0.8) + + # Hide the spines facing the break. + top_ax.spines["bottom"].set_visible(False) + bot_ax.spines["top"].set_visible(False) + top_ax.tick_params(labelbottom=False, bottom=False) + + # Diagonal break marks. + d = split("break_size") + kw = dict(color="black", clip_on=False, lw=1.0) + top_ax.plot((-d, +d), (-d, +d), transform=top_ax.transAxes, **kw) + top_ax.plot((1 - d, 1 + d), (-d, +d), transform=top_ax.transAxes, **kw) + bot_ax.plot((-d, +d), (1 - d, 1 + d), transform=bot_ax.transAxes, **kw) + bot_ax.plot((1 - d, 1 + d), (1 - d, 1 + d), transform=bot_ax.transAxes, **kw) + + bot_ax.set_xlabel("Benchmark", fontsize=STYLE["line_xlabel_fontsize"]) + # Centre the y-label vertically across BOTH sub-axes (and the gap). + # In bot_ax axes-fraction coords: + # bot_ax spans 0..1; gap above bot_ax = hspace * mean_h / h_bot; + # top_ax spans (1+gap) .. (1+gap+h_top/h_bot). + # Centre = average of bot_ax bottom (0) and top_ax top. + bot_ax.set_ylabel("r", fontsize=STYLE["line_ylabel_fontsize"]) + h_top, h_bot = split("height_ratio") + gap_in_bot = split("hspace") * (h_top + h_bot) / (2 * h_bot) + y_centre = (1.0 + gap_in_bot + h_top / h_bot) / 2.0 + bot_ax.yaxis.set_label_coords(split("ylabel_x"), y_centre) + else: + _draw_pearson_lines(line_ax, xs_idx, rewards, rho_by_bench) + line_ax.set_xticks(xs_idx) + line_ax.set_xticklabels([]) + line_ax.set_xlabel("Benchmark", fontsize=STYLE["line_xlabel_fontsize"]) + line_ax.set_ylabel("r", fontsize=STYLE["line_ylabel_fontsize"]) + line_ax.tick_params(axis="y", labelsize=STYLE["line_tick_fontsize"]) + line_ax.grid(True, color="0.75", linestyle="--", linewidth=0.7, alpha=0.85) + for side in ("top", "right", "left", "bottom"): + line_ax.spines[side].set_visible(True) + line_ax.spines[side].set_linewidth(0.8) + + handles = [] + for name in rewards: + is_hi = name == HIGHLIGHT + face = lighten(COLORS[name], 0.30 if is_hi else 0.60) + line_color = COLORS[name] if is_hi else (*lighten(COLORS[name], 0.40), 0.85) + edge = COLORS[name] if is_hi else "white" + handles.append(plt.Line2D( + [0], [0], color=line_color, marker=MARKERS[name], + markerfacecolor=face, + markeredgecolor=edge, + markersize=STYLE["legend_marker_size"] * (MARKER_SCALE[MARKERS[name]] ** 0.5), + lw=STYLE["legend_highlight_line_width"] if is_hi + else STYLE["legend_other_line_width"], + label=(legend_labels or {}).get(name, display_name(name)))) + legend_x = (panels_w + STYLE["legend_x_offset"]) / (panels_w + right_pad) + fig.legend(handles=handles, loc="center left", ncol=1, + bbox_to_anchor=(legend_x, 0.5), fontsize=STYLE["legend_fontsize"], + frameon=False, + labelspacing=STYLE["legend_label_spacing"], + handlelength=STYLE["legend_handle_len"]) + fig.tight_layout(rect=[0, 0, panels_w / (panels_w + right_pad), 1.0]) + + # Compute stair-step polygons after layout settles. + fig.canvas.draw() + renderer = fig.canvas.get_renderer() + pad_px = 4 + for top_p, bot_p, poly, ax in _stair_polygons: + top_bb = top_p.get_window_extent(renderer) + bot_bb = bot_p.get_window_extent(renderer) + # Stair-step polygon (6 corners), clockwise from top-right. + join_y = (top_bb.y0 + bot_bb.y1) / 2 + px = np.array([ + [top_bb.x1 + pad_px, top_bb.y1 + pad_px], # top-right + [bot_bb.x1 + pad_px, bot_bb.y0 - pad_px], # bottom-right + [bot_bb.x0 - pad_px, bot_bb.y0 - pad_px], # bottom-left + [bot_bb.x0 - pad_px, join_y], # step up + [top_bb.x0 - pad_px, join_y], # step right (under top row) + [top_bb.x0 - pad_px, top_bb.y1 + pad_px], # up to top-left of top row + ]) + data_pts = ax.transData.inverted().transform(px) + poly.set_xy(data_pts) + + fig.savefig(out_stem.with_suffix(".png"), dpi=200) + fig.savefig(out_stem.with_suffix(".pdf")) + plt.close(fig) + + +def main() -> None: + sections = parse_sections(SRC) + missing = [b for b in BENCHMARKS if b not in sections] + if missing: + raise SystemExit(f"benchmarks not in source file: {missing}") + + plot_group(sections, GROUPS["rewards_classic"], ROOT / "alignment_reward", + split_key="reward") + plot_group(sections, GROUPS["rewards_vqa"], ROOT / "alignment_vqa", + legend_labels={ + "VQAScore-binary-9B": "Qwen3.5\n(Binary)", + "VQAScore-Gemma-4-E4B": "Gemma", + "VQAScore-9B": "Qwen3.5", + }, + split_key="vqa") + print("wrote alignment_reward.{png,pdf} and alignment_vqa.{png,pdf}") + + +if __name__ == "__main__": + main() diff --git a/figures/alignment/plot_reward_alignment.py b/figures/alignment/plot_reward_alignment.py new file mode 100644 index 0000000000000000000000000000000000000000..8dd0380e4826b3894bc9bab47c5a8fca93c9db93 --- /dev/null +++ b/figures/alignment/plot_reward_alignment.py @@ -0,0 +1,402 @@ +"""How well do the four classic rewards (HPSv3, PickScore, ImageReward, +UnifiedReward) align with each other? + +We pool all (model, benchmark) cells from sheet_exports/alignment.txt, z-score +each (reward, benchmark) so cross-benchmark scales are comparable, then show: + +1. ``reward_alignment_pairgrid.{png,pdf}`` — 4×4 pair grid: + diagonal = KDE of each reward's pooled distribution + lower-tri = pairwise scatter, colour-coded by benchmark + upper-tri = Pearson r (large) + Spearman ρ (small) + +2. ``reward_alignment_density.{png,pdf}`` — single panel overlay of the four + z-scored marginal KDEs. +""" +from __future__ import annotations + +import re +from pathlib import Path + +import matplotlib.colors as mcolors +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +from scipy.stats import gaussian_kde, pearsonr, spearmanr +from sklearn.decomposition import PCA + +ROOT = Path(__file__).resolve().parent +SRC = ROOT.parent.parent / "sheet_exports" / "alignment.txt" + +# Shared STIX Two Text typeface. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, +}) + +REWARDS = ["HPSv3", "PickScore", "ImageReward", "UnifiedReward-9B"] +DISPLAY = { + "HPSv3": "HPSv3", + "PickScore": "PickScore", + "ImageReward": "ImageReward", + "UnifiedReward-9B": "UnifiedReward", +} +# Skip: t2icorebench composite (kept via its split components), +# plus sciencet2i / wise per current scope. +SKIP_BENCHES = {"t2icorebench", "t2icorebench_reasoning", "sciencet2i", "wise"} + +# Two-tone palette: 边缘 (字体 / 条形 / region 边线) 用饱和色,region 内部用浅色。 +# 按色相对应: 蓝 = ImageReward, 橙 = HPSv3, 红 = UnifiedReward-9B, 绿 = PickScore. +EDGE_COLORS = { + "HPSv3": "#e59837", # 橙 + "PickScore": "#5cb360", # 绿 (与 fill 相同) + "ImageReward": "#3a8dde", # 蓝 + "UnifiedReward-9B": "#d94f4f", # 红 +} +FILL_COLORS = { + "HPSv3": "#ffdaae", # 浅橙 + "PickScore": "#bcebbd", # 浅绿 + "ImageReward": "#b1d9ff", # 浅蓝 + "UnifiedReward-9B": "#ffb5b5", # 浅红 +} +# COLORS 保留, 给 bar / label 用饱和色。 +COLORS = EDGE_COLORS + + +def parse_sections(path: Path) -> dict[str, pd.DataFrame]: + text = path.read_text() + out: dict[str, pd.DataFrame] = {} + for m in re.finditer(r"=== (\S+) ===\n(.*?)(?=\n=== |\Z)", text, re.DOTALL): + name = m.group(1) + if name in SKIP_BENCHES: + continue + body = m.group(2).strip().splitlines() + header = body[0].split("\t") + rows = [ln.split("\t") for ln in body[1:] if ln.strip()] + df = pd.DataFrame(rows, columns=header).set_index("Model") + df = df.apply(pd.to_numeric, errors="coerce") + out[name] = df + return out + + +def build_long_df(sections: dict[str, pd.DataFrame]) -> pd.DataFrame: + """One row per (benchmark, model) with z-scored reward columns.""" + frames = [] + for bench, df in sections.items(): + sub = df[REWARDS].copy() + sub = (sub - sub.mean()) / sub.std(ddof=0) + sub["benchmark"] = bench + sub["model"] = df.index + frames.append(sub.reset_index(drop=True)) + return pd.concat(frames, ignore_index=True) + + +def lighten(color, amount: float = 0.5): + r, g, b = mcolors.to_rgb(color) + return (r + (1 - r) * amount, g + (1 - g) * amount, b + (1 - b) * amount) + + +def darken(color, amount: float = 0.35): + r, g, b = mcolors.to_rgb(color) + return (r * (1 - amount), g * (1 - amount), b * (1 - amount)) + + +# Labels / bar fills / region 边框: 纯正 Google 配色, 不做 darken / lighten。 +LABEL_COLORS = dict(COLORS) + +# ─── BAR CHART KNOBS — edit these to tweak the upper-right bar chart ── +# The bar right-edge is anchored at a FIXED data position (right_anchor=1.0), +# so changing bar_length_scale only stretches bars LEFTWARD — the right edge +# stays locked to bar_ax's right spine regardless of scale. +BAR_CHART = dict( + block_rows=(0,), # which 4×4 grid rows the chart spans + block_cols=(1, 2, 3), # which 4×4 grid cols the chart spans + pad_x_left=0.04, # left padding inside the block (room for value text overflow) + pad_x_right=0.15, # right padding (reserved for name text; names right-aligned to matrix right) + pad_top=0.1, # top padding inside the block + pad_bottom=0.06, # bottom padding inside the block + bar_height=0.05, # bar thickness as fraction of FIGURE height; bigger → bar_ax grows taller + bar_gap=0.04, # gap between bars as fraction of FIGURE height; bigger → bar_ax grows taller + baseline_gap=0.02, # smaller = bigger length-difference ratio + bar_length_scale=5.0, # bigger = longer bars (xlim_lo auto-extends to fit) + xlim_pad_left=0.12, # extra data-space left of longest bar (for value text) + value_fontsize=16, # numeric label fontsize + name_fontsize=16, # reward name fontsize + text_offset=0.012, # x gap between bar end and adjacent text +) +# bar_ax height (in figure coords) = 4*bar_height + 3*bar_gap. Top is anchored +# at the top of block_rows; bottom bar moves DOWN as bar_height/bar_gap grow, +# possibly overlapping cells in row 1 / etc. (which is fine — they're empty). +# ───────────────────────────────────────────────────────────────────── + + +# ---------- figure 1: pair grid ---------- + +def _kde_region(ax, coords: np.ndarray, weights: np.ndarray, + edge_color: str, fill_color: str, + xlim: tuple[float, float], ylim: tuple[float, float], + mass_level: float = 0.5, bw: float = 0.45, + grid_n: int = 180, + fill_alpha: float = 0.55) -> None: + """Filled 2D-KDE contour: lighter fill_color inside, saturated edge_color outline.""" + xs = np.linspace(xlim[0], xlim[1], grid_n) + ys = np.linspace(ylim[0], ylim[1], grid_n) + X, Y = np.meshgrid(xs, ys) + grid = np.vstack([X.ravel(), Y.ravel()]) + + w = np.clip(weights, 0, None) + if w.sum() == 0: + return + kde = gaussian_kde(coords.T, weights=w, bw_method=bw) + Z = kde(grid).reshape(X.shape) + + flat = np.sort(Z.ravel())[::-1] + cum = np.cumsum(flat) + cum /= cum[-1] + idx = np.searchsorted(cum, mass_level) + level = flat[min(idx, len(flat) - 1)] + + ax.contourf(X, Y, Z, levels=[level, Z.max() + 1e-9], + colors=[fill_color], alpha=fill_alpha, zorder=2) + ax.contour(X, Y, Z, levels=[level], colors=[edge_color], + linewidths=2.0, zorder=3) + + +def plot_pairgrid(long_df: pd.DataFrame, out_stem: Path) -> None: + """Pair grid where: + diagonal = each reward's PCA-based KDE region + lower triangle = the two rewards' regions overlaid + Pearson r + upper triangle = blank (axes hidden) + """ + n = len(REWARDS) + + # Cells to embed: drop any row missing a reward column. + df = long_df.dropna(subset=REWARDS).reset_index(drop=True) + M = df[REWARDS].to_numpy() + pca = PCA(n_components=2) + coords = pca.fit_transform(M) + + # Crop tightly around where the regions actually live: bounding box of + # cells whose weight (reward z-score) is positive for *any* reward, + # using a generous percentile to ignore far outliers. + # Compute the union bbox of every reward's actual region (where the KDE + # exceeds the 50%-mass level), so the panels are framed by what's drawn + # rather than by where cells happen to land. + full_xlim = (coords[:, 0].min() - 1.0, coords[:, 0].max() + 1.0) + full_ylim = (coords[:, 1].min() - 1.0, coords[:, 1].max() + 1.0) + region_xs, region_ys = [], [] + grid_n = 220 + xs_g = np.linspace(full_xlim[0], full_xlim[1], grid_n) + ys_g = np.linspace(full_ylim[0], full_ylim[1], grid_n) + Xg, Yg = np.meshgrid(xs_g, ys_g) + grid_pts = np.vstack([Xg.ravel(), Yg.ravel()]) + for r in REWARDS: + w = np.clip(df[r].to_numpy(), 0, None) + if w.sum() == 0: + continue + kde = gaussian_kde(coords.T, weights=w, bw_method=0.45) + Z = kde(grid_pts).reshape(Xg.shape) + flat = np.sort(Z.ravel())[::-1] + cum = np.cumsum(flat) / flat.sum() + level = flat[min(np.searchsorted(cum, 0.5), len(flat) - 1)] + mask = Z >= level + if mask.any(): + region_xs.extend(Xg[mask].tolist()) + region_ys.extend(Yg[mask].tolist()) + rxs = np.array(region_xs) + rys = np.array(region_ys) + qx_lo, qx_hi = rxs.min(), rxs.max() + qy_lo, qy_hi = rys.min(), rys.max() + xrange = qx_hi - qx_lo + yrange = qy_hi - qy_lo + xlim = (qx_lo - 0.14 * xrange, qx_hi + 0.14 * xrange) + ylim = (qy_lo - 0.20 * yrange, qy_hi + 0.20 * yrange) + + fig, axes = plt.subplots(n, n, figsize=(13.5, 6.0), + gridspec_kw=dict(wspace=0.0, hspace=0.0)) + + for i, ri in enumerate(REWARDS): + for j, rj in enumerate(REWARDS): + ax = axes[i, j] + if i < j: + ax.axis("off") + continue + + if i == j: + _kde_region(ax, coords, df[ri].to_numpy(), + EDGE_COLORS[ri], FILL_COLORS[ri], xlim, ylim) + ax.text(0.04, 0.95, DISPLAY[ri], transform=ax.transAxes, + fontsize=17, color=LABEL_COLORS[ri], fontweight="bold", + ha="left", va="top") + else: + _kde_region(ax, coords, df[rj].to_numpy(), + EDGE_COLORS[rj], FILL_COLORS[rj], xlim, ylim) + _kde_region(ax, coords, df[ri].to_numpy(), + EDGE_COLORS[ri], FILL_COLORS[ri], xlim, ylim) + xs = df[rj].to_numpy() + ys = df[ri].to_numpy() + r_val = pearsonr(xs, ys)[0] + ax.text(0.04, 0.95, f"r = {r_val:.2f}", + transform=ax.transAxes, ha="left", va="top", + fontsize=17, fontweight="bold", color="0.15") + + ax.set_xlim(xlim) + ax.set_ylim(ylim) + ax.xaxis.set_major_locator( + plt.FixedLocator(np.linspace(xlim[0], xlim[1], 5))) + ax.yaxis.set_major_locator( + plt.FixedLocator(np.linspace(ylim[0], ylim[1], 5))) + ax.tick_params(labelbottom=False, labelleft=False, length=0) + ax.grid(True, color="0.82", linewidth=0.5, alpha=0.8, zorder=1) + for spine in ax.spines.values(): + spine.set_linewidth(0.8) + + fig.tight_layout(pad=0.2) + + # Figure-level PC1 / PC2 labels, centered on the whole 4×4 matrix. + matrix_left = axes[0, 0].get_position().x0 + matrix_right = axes[n - 1, n - 1].get_position().x1 + matrix_bottom = axes[n - 1, 0].get_position().y0 + matrix_top = axes[0, 0].get_position().y1 + fig.text((matrix_left + matrix_right) / 2, matrix_bottom - 0.020, + "PC1", ha="center", va="top", fontsize=20) + fig.text(matrix_left - 0.010, (matrix_bottom + matrix_top) / 2, + "PC2", ha="right", va="center", fontsize=20, rotation=90) + + # Bar chart in the upper-right area — controlled by the BAR_CHART dict. + cfg = BAR_CHART + block_cells = [axes[i, j].get_position() + for i in cfg["block_rows"] for j in cfg["block_cols"]] + bx0 = min(p.x0 for p in block_cells) + bx1 = max(p.x1 for p in block_cells) + by0 = min(p.y0 for p in block_cells) + by1 = max(p.y1 for p in block_cells) + block_w = bx1 - bx0 + block_h = by1 - by0 + mx_left = block_w * cfg["pad_x_left"] + mx_right = block_w * cfg["pad_x_right"] + my_top = block_h * cfg["pad_top"] + # bar_ax PHYSICAL height (figure coords) is driven by bar_height + bar_gap + # so that growing those values pushes the bottom bar downward. + n_bars = len(REWARDS) + bar_ax_h = n_bars * cfg["bar_height"] + (n_bars - 1) * cfg["bar_gap"] + bar_ax_top = by1 - my_top # always anchored to top of block + bar_ax = fig.add_axes([bx0 + mx_left, bar_ax_top - bar_ax_h, + block_w - mx_left - mx_right, + bar_ax_h]) + # Render the bar chart BEHIND every matrix panel so any region/diagonal + # cell the bar passes through cleanly covers the bar. + bar_ax.set_zorder(-1) + for ax_row in axes: + for ax in ax_row: + ax.set_zorder(1) + # Matrix panels need transparent backgrounds where they're "off" + # (upper-tri); for visible cells keep their white fill so they + # fully occlude the bar chart underneath. + + pairs = [] + for r in REWARDS: + others = [pearsonr(df[r].to_numpy(), df[r2].to_numpy())[0] + for r2 in REWARDS if r2 != r] + pairs.append((r, float(np.mean(others)))) + pairs.sort(key=lambda x: -x[1]) # longest bar at top + sorted_rewards = [r for r, _ in pairs] + sorted_means = [m for _, m in pairs] + + # In axis-y (ylim=0..1), bars fill the chart exactly: bar+gap fractions = + # bar_height/total and bar_gap/total of axis height. + bh = cfg["bar_height"] / bar_ax_h + bg = cfg["bar_gap"] / bar_ax_h + spacing = bh + bg + top_y = 1.0 - bh / 2 + y_pos = np.array([top_y - i * spacing for i in range(n_bars)]) + baseline = min(sorted_means) - cfg["baseline_gap"] + widths = [(m - baseline) * cfg["bar_length_scale"] for m in sorted_means] + # Right anchor is FIXED — bars always end at xlim_hi (= bar_ax right spine). + right_anchor = 1.0 + left_anchors = [right_anchor - w for w in widths] + bar_colors = [FILL_COLORS[r] for r in sorted_rewards] + + bar_ax.barh(y_pos, widths, left=left_anchors, color=bar_colors, + edgecolor="white", linewidth=1.0, alpha=1.0, + height=bh, zorder=3) + bar_ax.set_xlim(min(left_anchors) - cfg["xlim_pad_left"], right_anchor) + bar_ax.set_ylim(0, 1) + + # Drawn via fig.text so labels sit ABOVE every matrix panel (axes zorder + # doesn't affect figure-level artists). Values right-aligned at each bar's + # left end; names left-aligned at common x past bar right. + def _to_fig(xd, yd): + disp = bar_ax.transData.transform((xd, yd)) + return fig.transFigure.inverted().transform(disp) + + for y, r, m, lo in zip(y_pos, sorted_rewards, sorted_means, left_anchors, + strict=False): + fx, fy = _to_fig(lo - cfg["text_offset"], y) + fig.text(fx, fy, f"{m:.2f}", ha="right", va="center", + fontsize=cfg["value_fontsize"], color="0.15", + fontweight="bold") + nfx, nfy = _to_fig(right_anchor + cfg["text_offset"], y) + fig.text(nfx, nfy, DISPLAY[r], ha="left", va="center", + fontsize=cfg["name_fontsize"], color=LABEL_COLORS[r], + fontweight="bold") + bar_ax.set_xticks([]) + bar_ax.set_yticks([]) + for spine in bar_ax.spines.values(): + spine.set_visible(False) + fig.savefig(out_stem.with_suffix(".pdf"), bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_stem.name}.pdf") + + +# ---------- figure 2: marginal density overlay ---------- + +def plot_density_overlay(long_df: pd.DataFrame, out_stem: Path) -> None: + fig, ax = plt.subplots(figsize=(8, 4.4)) + + pooled = long_df[REWARDS].to_numpy().ravel() + pooled = pooled[~np.isnan(pooled)] + lo, hi = np.quantile(pooled, [0.005, 0.995]) + pad = (hi - lo) * 0.05 + lo, hi = lo - pad, hi + pad + grid = np.linspace(lo, hi, 300) + + for r in REWARDS: + vals = long_df[r].dropna().to_numpy() + kde = gaussian_kde(vals, bw_method=0.4) + ys = kde(grid) + ax.fill_between(grid, ys, color=COLORS[r], alpha=0.18, zorder=2) + ax.plot(grid, ys, color=COLORS[r], lw=2.5, zorder=3, label=DISPLAY[r]) + + ax.set_xlim(lo, hi) + ax.set_xlabel("Score (z-scored within each benchmark)", fontsize=13) + ax.set_ylabel("Density", fontsize=13) + ax.set_yticks([]) + ax.tick_params(axis="x", labelsize=11) + ax.grid(True, axis="x", linestyle=":", linewidth=0.5, alpha=0.5) + for spine in ("top", "right"): + ax.spines[spine].set_visible(False) + ax.legend(fontsize=12, frameon=False, loc="upper right", handlelength=2.2) + fig.tight_layout() + fig.savefig(out_stem.with_suffix(".png"), dpi=200, bbox_inches="tight") + fig.savefig(out_stem.with_suffix(".pdf"), bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_stem.name}.png / .pdf") + + +def main() -> None: + sections = parse_sections(SRC) + print("benchmarks pooled:", sorted(sections.keys())) + long_df = build_long_df(sections) + print(f"pooled rows: {len(long_df)} (= {len(sections)} benchmarks × ~{long_df['model'].nunique()} models)") + + plot_pairgrid(long_df, ROOT / "reward_alignment_pairgrid") + + +if __name__ == "__main__": + main() diff --git a/figures/alignment/reward_alignment_pairgrid.pdf b/figures/alignment/reward_alignment_pairgrid.pdf new file mode 100644 index 0000000000000000000000000000000000000000..11c06aacbf7f68172c127c89c41d5493722099b3 Binary files /dev/null and b/figures/alignment/reward_alignment_pairgrid.pdf differ diff --git a/figures/benchmark/benchmark_overview.pdf b/figures/benchmark/benchmark_overview.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f360bc749df9f3ee1dd6f3681d053258f85cce22 Binary files /dev/null and b/figures/benchmark/benchmark_overview.pdf differ diff --git a/figures/benchmark/benchmark_overview.png b/figures/benchmark/benchmark_overview.png new file mode 100644 index 0000000000000000000000000000000000000000..552f6e20d4ac9509ed07f0141258d4998b81ce86 --- /dev/null +++ b/figures/benchmark/benchmark_overview.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f22372190a87e0a6c10045bf704a6510a47b1b962a443f673a41a0a9aef1599 +size 79437 diff --git a/figures/benchmark/plot_benchmark_overview.py b/figures/benchmark/plot_benchmark_overview.py new file mode 100644 index 0000000000000000000000000000000000000000..83475aa161e83328f3791330c80f0e87f53a1349 --- /dev/null +++ b/figures/benchmark/plot_benchmark_overview.py @@ -0,0 +1,252 @@ +"""Benchmark overview scatter. + +X-axis: average prompt length (words) per benchmark. +Y-axis: average MLLM-Judge performance across all evaluated models, normalised + to the benchmark's native max score so values land in [0, 1]. +Marker: filled circle whose area is proportional to the benchmark's prompt count. + +Data source: + - sheet_exports/alignment.txt -> per-benchmark MLLM_Judge scores per model + - HuggingFace datasets -> prompt counts and average prompt length +""" +from __future__ import annotations + +import re +from pathlib import Path +from statistics import mean + +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +from datasets import load_dataset + +ROOT = Path(__file__).resolve().parent +SRC = ROOT.parent.parent / "sheet_exports" / "alignment.txt" + +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, +}) + +JUDGE_COL = "MLLM_Judge" + +# Display name, native score max (used to normalise the judge column to [0, 1]). +BENCHMARKS = { + "longbencht2i": {"display": "LongBench-T2I", "score_max": 5.0}, + "spatialgeneval": {"display": "SpatialGenEval", "score_max": 100.0}, + "t2icompbench": {"display": "T2I-CompBench", "score_max": 5.0}, + "t2icorebench_composition": {"display": "T2I-CoReBench", "score_max": 1.0}, + "tiifbench": {"display": "TIIF-Bench", "score_max": 1.0}, +} + +# --------------------------------------------------------------------------- +# Per-benchmark label tweaks. Edit only this block to change how each label +# is rendered. +# fontsize : text size in points +# dx, dy : offset in points from the bubble center +# (positive dy = above, negative = below; positive dx = right) +# ha, va : matplotlib horizontal/vertical alignment ("left"/"center"/"right", +# "top"/"center"/"bottom"). va="auto" places the label just outside +# the bubble's top edge automatically. +# --------------------------------------------------------------------------- +LABEL_STYLE: dict[str, dict] = { + "longbencht2i": {"fontsize": 11, "dx": 40, "dy": -5, "ha": "center", "va": "auto"}, + "spatialgeneval": {"fontsize": 11, "dx": -5, "dy": -60, "ha": "center", "va": "auto"}, + "t2icompbench": {"fontsize": 11, "dx": 0, "dy": -5, "ha": "center", "va": "auto"}, + "t2icorebench_composition": {"fontsize": 11, "dx": 10, "dy": -5, "ha": "center", "va": "auto"}, + "tiifbench": {"fontsize": 11, "dx": 0, "dy": -8, "ha": "center", "va": "auto"}, +} + +# (HF dataset path, callable returning the list of generated prompt strings) +HF_SOURCES = { + "longbencht2i": ("Jialuo21/LongBench-T2I", lambda d: list(d["prompt"])), + "spatialgeneval": ("Jialuo21/SpatialGenEval", lambda d: list(d["prompt"])), + "t2icompbench": ("Jialuo21/T2I_CompBench", lambda d: list(d["prompt"])), + "t2icorebench_composition": ( + "Jialuo21/T2I-CoReBench", + lambda d: [p for p, t in zip(d["Prompt"], d["task"], strict=False) if str(t).startswith("C-")], + ), + # TIIF-Bench's default plan emits both the short and long description per row. + "tiifbench": ("Jialuo21/TIIF-Bench", + lambda d: list(d["short_description"]) + list(d["long_description"])), +} + + +def parse_alignment(path: Path) -> dict[str, dict[str, float]]: + """Return {benchmark_name: {model: judge_score}}.""" + text = path.read_text() + blocks = re.split(r"=== (\w+) ===\n", text) + out: dict[str, dict[str, float]] = {} + for i in range(1, len(blocks), 2): + name = blocks[i].strip() + body = blocks[i + 1].strip().splitlines() + if not body: + continue + header = body[0].split("\t") + try: + judge_idx = header.index(JUDGE_COL) + except ValueError: + continue + scores: dict[str, float] = {} + for row in body[1:]: + cells = row.split("\t") + if len(cells) <= judge_idx: + continue + cell = cells[judge_idx].strip() + if not cell or cell == "-": + continue + try: + scores[cells[0]] = float(cell) + except ValueError: + continue + if scores: + out[name] = scores + return out + + +def benchmark_prompt_stats() -> dict[str, dict[str, float]]: + stats: dict[str, dict[str, float]] = {} + for key, (path, getter) in HF_SOURCES.items(): + ds = load_dataset(path, split="test") + prompts = [str(p).strip() for p in getter(ds) if str(p).strip()] + stats[key] = { + "count": float(len(prompts)), + "avg_words": float(mean(len(p.split()) for p in prompts)), + } + return stats + + +def main() -> None: + judge = parse_alignment(SRC) + prompt_stats = benchmark_prompt_stats() + + rows = [] + for key, meta in BENCHMARKS.items(): + if key not in judge: + continue + avg_score = mean(judge[key].values()) / meta["score_max"] + rows.append({ + "key": key, + "display": meta["display"], + "x": prompt_stats[key]["avg_words"], + "y": avg_score, + "size": prompt_stats[key]["count"], + }) + + # Pastel colors keyed by avg prompt-length bucket. + def bucket_color(x: float) -> str: + if x < 100: + return "#A8D5FF" # short prompts (light blue) + if x <= 500: + return "#FFD6A5" # medium prompts (light orange) + return "#FFADAD" # long prompts (light red) + + fig, ax = plt.subplots(figsize=(7.6, 4.0)) + + sizes = np.array([r["size"] for r in rows]) + # Map prompt count -> marker area (points^2). + s_min, s_max = 600.0, 4200.0 + if sizes.max() > sizes.min(): + size_norm = (sizes - sizes.min()) / (sizes.max() - sizes.min()) + else: + size_norm = np.zeros_like(sizes, dtype=float) + marker_areas = s_min + size_norm * (s_max - s_min) + + for r, area in zip(rows, marker_areas, strict=False): + ax.scatter( + r["x"], r["y"], + s=area, + facecolor=bucket_color(r["x"]), + edgecolor="white", + linewidth=1.2, + alpha=0.9, + zorder=3, + ) + + for r, area in zip(rows, marker_areas, strict=False): + radius_pts = np.sqrt(area / np.pi) + style = LABEL_STYLE.get(r["key"], {}) + fontsize = style.get("fontsize", 11) + ha = style.get("ha", "center") + va = style.get("va", "auto") + dx = style.get("dx", 0) + dy = style.get("dy", 0) + # va="auto" places the label just above the bubble's edge. + if va == "auto": + xytext = (dx, dy + radius_pts + 6) + va_final = "bottom" + else: + xytext = (dx, dy) + va_final = va + ax.annotate( + r["display"], + xy=(r["x"], r["y"]), + xytext=xytext, + textcoords="offset points", + ha=ha, va=va_final, + fontsize=fontsize, + zorder=4, + ) + + ax.set_xscale("log") + ax.set_ylabel("Score", fontsize=15) + ax.tick_params(axis="both", labelsize=13) + ax.grid(True, which="major", linestyle="--", linewidth=0.5, alpha=0.5, zorder=1) + for boundary in (100, 500): + ax.axvline(boundary, color="black", linestyle=(0, (10, 8)), + linewidth=1.0, alpha=0.85, zorder=2) + from matplotlib.ticker import FixedLocator, NullLocator + ax.xaxis.set_minor_locator(NullLocator()) + ax.xaxis.set_major_locator(FixedLocator([10, 100, 500])) + ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda v, _: f"{int(v)}")) + for side in ("top", "left", "right"): + ax.spines[side].set_visible(False) + + xs = np.array([r["x"] for r in rows]) + ys = np.array([r["y"] for r in rows]) + ax.set_xlim(xs.min() * 0.55, xs.max() * 3.0) + pad = 0.02 * (ys.max() - ys.min() + 1e-9) + ax.set_ylim(ys.min() - pad - 0.02, ys.max() + pad + 0.04) + + # Bucket labels centered (geometric mean) inside each region, sitting just + # above the x-axis. Color each label with its bucket's bubble color + # (slightly darkened for legibility against the white background). + xlo, xhi = ax.get_xlim() + bucket_centers = [ + ("short", np.sqrt(xlo * 100), "#3A8DDE", "bottom"), # darker blue, below + ("medium", np.sqrt(100 * 500), "#E59837", "top"), # darker orange, above + ("long", np.sqrt(500 * xhi), "#D94F4F", "top"), # darker red, above + ] + trans = ax.get_xaxis_transform() # x in data coords, y in axes fraction + for label, x_center, color, position in bucket_centers: + if position == "bottom": + y_frac, va = 0.04, "bottom" + else: + y_frac, va = 0.96, "top" + ax.text( + x_center, y_frac, label, + transform=trans, + ha="center", va=va, + fontsize=14, + color=color, + family=["Comic Sans MS", "Chalkboard SE", "DejaVu Sans"], + fontweight="bold", + zorder=5, + ) + + fig.tight_layout() + out_png = ROOT / "benchmark_overview.png" + out_pdf = ROOT / "benchmark_overview.pdf" + fig.savefig(out_png, dpi=200) + fig.savefig(out_pdf) + print(f"saved {out_png}") + print(f"saved {out_pdf}") + + +if __name__ == "__main__": + main() diff --git a/figures/gemini_figures/_gen.py b/figures/gemini_figures/_gen.py new file mode 100644 index 0000000000000000000000000000000000000000..4e575a5c0bb5417a3b952b05409cdade378414b8 --- /dev/null +++ b/figures/gemini_figures/_gen.py @@ -0,0 +1,62 @@ +"""Generate 5 nano banana images for prompt.json keys, save into same dir.""" +from __future__ import annotations + +import json +import os +import sys +import time +from io import BytesIO +from pathlib import Path + +from PIL import Image +from google import genai +from google.genai import types + +HERE = Path(__file__).parent +PROMPTS = json.loads((HERE / "prompt.json").read_text()) +MODEL = "gemini-2.5-flash-image" + +SAFETY = [ + types.SafetySetting(category=c, threshold=types.HarmBlockThreshold.BLOCK_ONLY_HIGH) + for c in ( + types.HarmCategory.HARM_CATEGORY_HARASSMENT, + types.HarmCategory.HARM_CATEGORY_HATE_SPEECH, + types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + ) +] + + +def gen(client, key: str, prompt: str) -> bool: + target = HERE / f"{key}.png" + cfg = types.GenerateContentConfig( + response_modalities=["TEXT", "IMAGE"], + safety_settings=SAFETY, + ) + for attempt in range(8): + try: + r = client.models.generate_content(model=MODEL, contents=[prompt], config=cfg) + for part in (r.parts or []): + if part.inline_data is not None: + Image.open(BytesIO(part.inline_data.data)).convert("RGB").save(target) + print(f" OK {key} -> {target.name}") + return True + except Exception as e: # noqa: BLE001 + print(f" attempt {attempt+1} fail {key}: {str(e)[:120]}") + time.sleep(1 + attempt) + print(f" GAVE UP {key}") + return False + + +def main(): + api_key = os.getenv("GOOGLE_API_KEY") or os.getenv("GEMINI_API_KEY") + if not api_key: + sys.exit("set GOOGLE_API_KEY") + client = genai.Client(api_key=api_key) + for k, p in PROMPTS.items(): + print(f"[{k}] generating ...") + gen(client, k, p) + + +if __name__ == "__main__": + main() diff --git a/figures/gemini_figures/_gen2.py b/figures/gemini_figures/_gen2.py new file mode 100644 index 0000000000000000000000000000000000000000..fe89ad495eca7f07d30eecb63c5e5e4ab257a496 --- /dev/null +++ b/figures/gemini_figures/_gen2.py @@ -0,0 +1,65 @@ +"""Generate 5 nano banana 2 (gemini-3-pro-image) images, save with _v2 suffix.""" +from __future__ import annotations + +import json +import os +import sys +import time +from io import BytesIO +from pathlib import Path + +from PIL import Image +from google import genai +from google.genai import types + +HERE = Path(__file__).parent +PROMPTS = json.loads((HERE / "prompt.json").read_text()) +MODEL = "gemini-3-pro-image-preview" + +SAFETY = [ + types.SafetySetting(category=c, threshold=types.HarmBlockThreshold.BLOCK_ONLY_HIGH) + for c in ( + types.HarmCategory.HARM_CATEGORY_HARASSMENT, + types.HarmCategory.HARM_CATEGORY_HATE_SPEECH, + types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + ) +] + + +def gen(client, key: str, prompt: str) -> bool: + target = HERE / f"{key}_v2.png" + cfg = types.GenerateContentConfig( + response_modalities=["TEXT", "IMAGE"], + safety_settings=SAFETY, + ) + for attempt in range(8): + try: + r = client.models.generate_content(model=MODEL, contents=[prompt], config=cfg) + for part in (r.parts or []): + if part.inline_data is not None: + Image.open(BytesIO(part.inline_data.data)).convert("RGB").save(target) + print(f" OK {key} -> {target.name}") + return True + txts = " ".join(getattr(p, "text", "") or "" for p in (r.parts or [])) + print(f" attempt {attempt+1} no_image {key}: {txts[:120]}") + except Exception as e: # noqa: BLE001 + print(f" attempt {attempt+1} fail {key}: {str(e)[:120]}") + time.sleep(1 + attempt) + print(f" GAVE UP {key}") + return False + + +def main(): + api_key = os.getenv("GOOGLE_API_KEY") or os.getenv("GEMINI_API_KEY") + if not api_key: + sys.exit("set GOOGLE_API_KEY") + client = genai.Client(api_key=api_key) + print(f"model={MODEL}") + for k, p in PROMPTS.items(): + print(f"[{k}] generating ...") + gen(client, k, p) + + +if __name__ == "__main__": + main() diff --git a/figures/gemini_figures/_gen_p2.py b/figures/gemini_figures/_gen_p2.py new file mode 100644 index 0000000000000000000000000000000000000000..8c0800a869aa87f71d86247b6b0ab20fac971e00 --- /dev/null +++ b/figures/gemini_figures/_gen_p2.py @@ -0,0 +1,66 @@ +"""Generate 5 nano banana (gemini-2.5-flash-image) images for prompt2.json, 1024x1024.""" +from __future__ import annotations + +import json +import os +import sys +import time +from io import BytesIO +from pathlib import Path + +from PIL import Image +from google import genai +from google.genai import types + +HERE = Path(__file__).parent +PROMPTS = json.loads((HERE / "prompt2.json").read_text()) +MODEL = "gemini-2.5-flash-image" + +SAFETY = [ + types.SafetySetting(category=c, threshold=types.HarmBlockThreshold.BLOCK_ONLY_HIGH) + for c in ( + types.HarmCategory.HARM_CATEGORY_HARASSMENT, + types.HarmCategory.HARM_CATEGORY_HATE_SPEECH, + types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + ) +] + + +def gen(client, key: str, prompt: str) -> bool: + target = HERE / f"{key}_p2.png" + cfg = types.GenerateContentConfig( + response_modalities=["TEXT", "IMAGE"], + safety_settings=SAFETY, + ) + for attempt in range(8): + try: + r = client.models.generate_content(model=MODEL, contents=[prompt], config=cfg) + for part in (r.parts or []): + if part.inline_data is not None: + img = Image.open(BytesIO(part.inline_data.data)).convert("RGB") + if img.size != (1024, 1024): + img = img.resize((1024, 1024), Image.LANCZOS) + img.save(target) + print(f" OK {key} -> {target.name} size={img.size}") + return True + except Exception as e: # noqa: BLE001 + print(f" attempt {attempt+1} fail {key}: {str(e)[:120]}") + time.sleep(1 + attempt) + print(f" GAVE UP {key}") + return False + + +def main(): + api_key = os.getenv("GOOGLE_API_KEY") or os.getenv("GEMINI_API_KEY") + if not api_key: + sys.exit("set GOOGLE_API_KEY") + client = genai.Client(api_key=api_key) + print(f"model={MODEL}") + for k, p in PROMPTS.items(): + print(f"[{k}] generating ...") + gen(client, k, p) + + +if __name__ == "__main__": + main() diff --git a/figures/gemini_figures/_gen_p3.py b/figures/gemini_figures/_gen_p3.py new file mode 100644 index 0000000000000000000000000000000000000000..9e5b2264857abdaa5dc9e6279dac1493fd9b7483 --- /dev/null +++ b/figures/gemini_figures/_gen_p3.py @@ -0,0 +1,66 @@ +"""Generate 5 nano banana (gemini-2.5-flash-image) images for prompt3.json, 1024x1024.""" +from __future__ import annotations + +import json +import os +import sys +import time +from io import BytesIO +from pathlib import Path + +from PIL import Image +from google import genai +from google.genai import types + +HERE = Path(__file__).parent +PROMPTS = json.loads((HERE / "prompt3.json").read_text()) +MODEL = "gemini-2.5-flash-image" + +SAFETY = [ + types.SafetySetting(category=c, threshold=types.HarmBlockThreshold.BLOCK_ONLY_HIGH) + for c in ( + types.HarmCategory.HARM_CATEGORY_HARASSMENT, + types.HarmCategory.HARM_CATEGORY_HATE_SPEECH, + types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, + types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, + ) +] + + +def gen(client, key: str, prompt: str) -> bool: + target = HERE / f"{key}_p3.png" + cfg = types.GenerateContentConfig( + response_modalities=["TEXT", "IMAGE"], + safety_settings=SAFETY, + ) + for attempt in range(8): + try: + r = client.models.generate_content(model=MODEL, contents=[prompt], config=cfg) + for part in (r.parts or []): + if part.inline_data is not None: + img = Image.open(BytesIO(part.inline_data.data)).convert("RGB") + if img.size != (1024, 1024): + img = img.resize((1024, 1024), Image.LANCZOS) + img.save(target) + print(f" OK {key} -> {target.name} size={img.size}") + return True + except Exception as e: # noqa: BLE001 + print(f" attempt {attempt+1} fail {key}: {str(e)[:120]}") + time.sleep(1 + attempt) + print(f" GAVE UP {key}") + return False + + +def main(): + api_key = os.getenv("GOOGLE_API_KEY") or os.getenv("GEMINI_API_KEY") + if not api_key: + sys.exit("set GOOGLE_API_KEY") + client = genai.Client(api_key=api_key) + print(f"model={MODEL}") + for k, p in PROMPTS.items(): + print(f"[{k}] generating ...") + gen(client, k, p) + + +if __name__ == "__main__": + main() diff --git a/figures/gemini_figures/attribute.png b/figures/gemini_figures/attribute.png new file mode 100644 index 0000000000000000000000000000000000000000..ff06c3a520b827f8a31022f9dcfc8bf19435ff73 --- /dev/null +++ b/figures/gemini_figures/attribute.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6370b8a8f9a9bb33c8d7093f007ce2ee70bbed1b71c6327cb0810ede2af2955 +size 2025171 diff --git a/figures/gemini_figures/attribute_p2.png b/figures/gemini_figures/attribute_p2.png new file mode 100644 index 0000000000000000000000000000000000000000..11db78c9a37e0f8cc3b664b7b8b6a4888b3f940b --- /dev/null +++ b/figures/gemini_figures/attribute_p2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7543c7fe2f6171a311423b6bf0e64d997269275d08b3aee649ee75a082fb1ad8 +size 1730751 diff --git a/figures/gemini_figures/attribute_p3.png b/figures/gemini_figures/attribute_p3.png new file mode 100644 index 0000000000000000000000000000000000000000..cd72187b3f7194b06f65d0722709e65617199c72 --- /dev/null +++ b/figures/gemini_figures/attribute_p3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef82f6aec270ffbef62bb71407e3892c16fe3f7e5c125c432ea6a472e3e69885 +size 1571923 diff --git a/figures/gemini_figures/attribute_v2.png b/figures/gemini_figures/attribute_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..09d92dd78ab872c9b072e9b4fe311091419ddc3e --- /dev/null +++ b/figures/gemini_figures/attribute_v2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82cdf9b1db030bc9aafee1e94c49203e59614ecf3762e169c614cebd1d112bcb +size 2358930 diff --git a/figures/gemini_figures/balance.png b/figures/gemini_figures/balance.png new file mode 100644 index 0000000000000000000000000000000000000000..faabe70a8289f203f55d6ce193df6bcb6bb0579b --- /dev/null +++ b/figures/gemini_figures/balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:173b7759a872e40545041d10a754769fc7234b1f030cac254f57d19c8c218435 +size 1529112 diff --git a/figures/gemini_figures/balance_p2.png b/figures/gemini_figures/balance_p2.png new file mode 100644 index 0000000000000000000000000000000000000000..c60379b31c49f1d10c34e42d37f1a9d454afe5e8 --- /dev/null +++ b/figures/gemini_figures/balance_p2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:091bb7bd5ef12a15950bc52cd672218d27446923c0ec5e8e379b8e7128f32251 +size 1653490 diff --git a/figures/gemini_figures/balance_p3.png b/figures/gemini_figures/balance_p3.png new file mode 100644 index 0000000000000000000000000000000000000000..f181d8f1c5ccfc3bdb30928a13e4935724131475 --- /dev/null +++ b/figures/gemini_figures/balance_p3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:017338aab02bf575e636f299f4350412a4bccb74d82a075041c18ac414c0d79a +size 1525808 diff --git a/figures/gemini_figures/balance_v2.png b/figures/gemini_figures/balance_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..6321185e5df420316634b72d62b7013d5a304654 --- /dev/null +++ b/figures/gemini_figures/balance_v2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e8d67fc0de18c397701b895be5c2082d913774160519ab97dbc781df033a4df +size 2160417 diff --git a/figures/gemini_figures/entity.png b/figures/gemini_figures/entity.png new file mode 100644 index 0000000000000000000000000000000000000000..de5078a0c3e692e4bb00e1389d7c730ce84440c3 --- /dev/null +++ b/figures/gemini_figures/entity.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5fa4fca1d38a88b3e4e4a69374bdb5bb3e230271ef159177c1142c5baf7e7e6 +size 2179404 diff --git a/figures/gemini_figures/entity_p2.png b/figures/gemini_figures/entity_p2.png new file mode 100644 index 0000000000000000000000000000000000000000..ca6b20fe4a4775b683ba16190a3084d68ba9ed7a --- /dev/null +++ b/figures/gemini_figures/entity_p2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:becb0460f656307b6d50ac2933639d3c5ce82bab519466a86f75c80729b47238 +size 2319620 diff --git a/figures/gemini_figures/entity_p3.png b/figures/gemini_figures/entity_p3.png new file mode 100644 index 0000000000000000000000000000000000000000..d12a7c6ee7d661d9e4144d1e5be6a037ea14911c --- /dev/null +++ b/figures/gemini_figures/entity_p3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a5ddeb6a8aaf77fb85a8e7ae3b1dead9c9663dd4e011f84ae3d762144ee8793 +size 1595266 diff --git a/figures/gemini_figures/entity_v2.png b/figures/gemini_figures/entity_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..8187dc8cd77f2cd5b83f81f59fca7147ebfabd1a --- /dev/null +++ b/figures/gemini_figures/entity_v2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7943a8cbb55cbb103f4810c118ad5b99cf73a1e68011c5c3312305645154c7a0 +size 2330342 diff --git a/figures/gemini_figures/origin.png b/figures/gemini_figures/origin.png new file mode 100644 index 0000000000000000000000000000000000000000..298c68ca684b0b635253d9f361d30ee4a392605b --- /dev/null +++ b/figures/gemini_figures/origin.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bcbd56ef715dcae4d6669b8448877671acb4c04dadd36b6302de5a468df7380 +size 1813289 diff --git a/figures/gemini_figures/origin_p2.png b/figures/gemini_figures/origin_p2.png new file mode 100644 index 0000000000000000000000000000000000000000..9297810799ef236e2ebec184e2566f34f66bbaf8 --- /dev/null +++ b/figures/gemini_figures/origin_p2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:caf14b87f6078f408bd584cc089d021149f98ca8599908bbbd407217f3d82676 +size 1337865 diff --git a/figures/gemini_figures/origin_p3.png b/figures/gemini_figures/origin_p3.png new file mode 100644 index 0000000000000000000000000000000000000000..8c5e582aa3fcd0dd7642a6ad4f4a28e4c931f130 --- /dev/null +++ b/figures/gemini_figures/origin_p3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b9053999af99d121f967f08247e6934438c8ba963ed2e7efa98470c5f333497 +size 1546355 diff --git a/figures/gemini_figures/origin_v2.png b/figures/gemini_figures/origin_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..b6a2b7d532c862066ed42a3dc2ec3064c3940ed7 --- /dev/null +++ b/figures/gemini_figures/origin_v2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22fa8c0839fc118d8addc4881b1d7814b70bcae4690f72fce51a13fb533d5cd0 +size 2199967 diff --git a/figures/gemini_figures/prompt.json b/figures/gemini_figures/prompt.json new file mode 100644 index 0000000000000000000000000000000000000000..3eb28bf9d6efa31f388b85818e8846fd0b7da59f --- /dev/null +++ b/figures/gemini_figures/prompt.json @@ -0,0 +1,7 @@ +{ + "origin": "A gopher standing on its hind legs in a lush, green meadow, facing the camera with its front paws held together.", + "balance": "A gray-furred gopher with distinct white facial markings stands upright on its hind legs atop a patch of short, vibrant green grass in a sunlit meadow. The animal's front paws are clasped tightly together at chest level, while its small, rounded ears protrude symmetrically from the sides of its head. Surrounding the gopher, tall wildflowers with yellow and purple petals rise vertically from the soil, their stems leaning slightly against the breeze. A large, weathered oak tree trunk anchors the background directly behind the creature, its rough, dark bark contrasting with the soft texture of the meadow floor. Scattered brown pinecones lie horizontally on the ground near the gopher's feet, partially buried in the grass. A shallow stream of clear water flows diagonally across the lower left quadrant of the scene, reflecting the sky above. The gopher's black eyes are positioned forward, gazing directly toward the viewer, while its short tail remains tucked against its rear legs. Overhead, a few white clouds drift slowly across a pale blue sky, casting soft, shifting shadows across the uneven terrain where the gopher maintains its stationary posture.", + "entity": "A gopher stands on hind legs within a meadow, facing the camera with front paws held together near its chest. The gopher is surrounded by a dense cluster of wildflowers, including daisies, clover, and buttercups, interspersed with tall blades of grass and patches of moss. A small wooden fence runs horizontally behind the gopher, constructed from vertical posts and horizontal rails, with a weathered sign attached to the central post displaying the text 'ZONE 4'. Several rabbits graze near the fence base, while a squirrel perches on a low branch of a nearby oak tree. A blue jay sits on a stone marker to the left, next to a small metal watering can lying on its side. Scattered across the ground are acorns, dried leaves, and a discarded red ribbon. In the background, a wooden barn with a corrugated metal roof stands behind a row of pine trees, with a windmill visible on the horizon. A dirt path winds through the grass, leading toward a stone well with a rope hanging from its pulley. A bicycle leans against a tree trunk nearby, its tires partially buried in the soft earth. Clouds drift above the scene, casting shadows across the meadow floor where a small stream flows under a fallen log.", + "attribute": "A single adult gopher with coarse, mottled brown and gray fur stands rigidly on two thick, clawed hind legs within a dense, low-lying meadow. The gopher's small, rounded ears are pinned slightly back against its skull, while its dark, bead-like eyes reflect the ambient sky, and its short, black nose twitches above a mouth held shut. Its front paws, covered in shorter, lighter tan fur with visible dark claws, are pressed tightly together at chest level, fingers interlocked. The surrounding meadow consists entirely of individual blades of grass varying in height from two to six inches, displaying a spectrum of green hues from deep emerald to pale lime, with some blades bearing translucent water droplets and others showing slight yellowing at the tips. The soil beneath the gopher's feet is a compacted mix of dark brown earth and scattered small, gray pebbles. Sunlight strikes the scene from the upper left, casting distinct, elongated shadows of the grass blades and the gopher's body onto the ground, highlighting the texture of the fur and the moisture on the vegetation without introducing any atmospheric haze or artistic stylization.", + "relation": "A gopher stands vertically on its hind legs, with its lower limbs firmly planted on the soil surface of a meadow, while its upper torso extends upward into the air. The gopher's front paws are pressed together at chest level, creating a closed loop where the digits of the left paw interlock with the digits of the right paw. Surrounding the gopher's feet, individual blades of green grass emerge from the earth, with some stalks leaning against the gopher's ankles and others bending under the weight of the gopher's body. The gopher's head is positioned directly above the torso, facing forward, with its ears protruding laterally from the sides of the skull. Behind the gopher, a dense cluster of grass forms a continuous vertical barrier, with individual stems overlapping one another to create a multi-layered texture. The gopher's nose is located at the frontmost point of its face, protruding slightly beyond the plane of its eyes. The ground beneath the gopher is uneven, with small mounds of dirt supporting the gopher's weight and depressions forming around the base of the grass stalks. The gopher's tail rests against the back of its hind legs, curving slightly to maintain balance. The spatial arrangement places the gopher centrally within the frame, with the grass extending outward in all directions from the gopher's position, creating a radial distribution of vegetation." +} \ No newline at end of file diff --git a/figures/gemini_figures/prompt2.json b/figures/gemini_figures/prompt2.json new file mode 100644 index 0000000000000000000000000000000000000000..2944a6599ebcf268f46f2fb833c20bc516ca11f4 --- /dev/null +++ b/figures/gemini_figures/prompt2.json @@ -0,0 +1,7 @@ +{ + "origin": "A white ptarmigan with a red patch on its head and chest stands on a patch of snow in a field of dried grass, facing left.", + "balance": "A white ptarmigan with dense, fluffy plumage and a distinct crimson patch covering its crown and upper chest stands firmly on a compacted mound of snow situated within a sprawling field of brittle, golden-brown dried grass. The bird faces strictly left, its black beak aligned parallel to the horizon, while its dark, round eye reflects the ambient light. Surrounding the central snow patch, individual stalks of grass lean at various angles, some buried beneath the snow's edge and others rising sharply above it. A thin layer of frost coats the tips of the nearest grass blades, creating a sharp textural contrast against the smooth, undisturbed surface of the snow mound. The ptarmigan's feathered feet are partially submerged in the snow, gripping the icy substrate, while its tail feathers fan slightly behind it, casting a soft, elongated shadow onto the snow to the right. In the immediate background, a cluster of frozen twigs protrudes from the grass, positioned three feet behind the bird, and a small pile of scattered seeds rests on the snow near the bird's left foot. The entire scene is defined by the rigid spatial relationship between the standing bird, the supporting snow mound, and the encroaching field of dried vegetation, with no elements overlapping in a way that obscures their distinct boundaries.", + "entity": "A white ptarmigan with a red patch on its head and chest stands on a patch of snow in a field of dried grass, facing left, surrounded by scattered pinecones, fallen acorns, and small twigs. Near the bird's feet lie three distinct feathers, a broken beetle shell, and a cluster of frost-covered lichen. Behind the ptarmigan, a weathered log rests horizontally, supporting a pile of dry moss, a single red berry, and a shard of ice. To the left, a stone outcrop displays cracks filled with gray lichen, while a small tuft of green moss grows at its base. Further back, a cluster of dried grass stalks sways, interspersed with fallen leaves, a moth wing, and a piece of bark. A shallow puddle reflects the sky, bordered by pebbles, a rusted nail, and a fragment of bone. Above, a low-hanging cloud casts shadows on a nearby rock, a patch of clover, and a cluster of wild thistle. In the distance, a fence post stands beside a tangled vine, a discarded bottle cap, and a small pile of ash. The scene includes a fallen branch, a cluster of mushrooms, a spider web, a piece of glass, and a small bird's nest, all arranged across the terrain with overlapping layers of snow, grass, and debris.", + "attribute": "A single white ptarmigan stands stationary on a compacted patch of granular snow within a field of desiccated, golden-brown grass stalks. The bird's plumage consists of dense, overlapping feathers with a matte, non-reflective surface texture, featuring a distinct, irregular crimson patch covering the crown and extending down the anterior thorax. Its beak is short, conical, and dark grey, positioned in a closed state. The legs are short, scaly, and pale pink, ending in four forward-facing toes covered in white feather tufts that blend with the surrounding snow. The bird faces strictly left, with its head rotated slightly downward. The snow patch exhibits a rough, crystalline surface with minor indentations from the bird's feet and scattered, fine ice shards reflecting diffuse ambient light. Surrounding the snow are upright, brittle grass stems, some bent by wind, displaying a dry, fibrous texture and varying shades of tan and straw. The ground beneath the grass is dark brown earth, partially visible through gaps in the vegetation. No other animals or artificial objects are present in the immediate vicinity, creating a sparse composition focused entirely on the detailed physical interaction between the feathered avian subject and the frozen, vegetated terrain.", + "relation": "A white ptarmigan with a red patch on its head and chest stands on a patch of snow in a field of dried grass, facing left, where its talons grip the icy surface while snowflakes accumulate between its feathers and the ground. The bird's body leans slightly forward, causing its tail feathers to rest against a cluster of dried grass stems that rise vertically from the snow beneath it. A single blade of grass pierces through the snow layer directly behind the ptarmigan's left wing, connecting the ground to the mid-air space near its back. The red patch on its chest overlaps with a shadow cast by its own head, which extends onto the snow to the left. Snow particles bridge the gap between the bird's feet and the surrounding grass, creating a continuous chain of frozen matter. The field of dried grass surrounds the snow patch in concentric rings, with some stalks bending under the weight of accumulated snow, pressing against the bird's lower legs. A small mound of snow sits directly beneath the ptarmigan's beak, forming a physical barrier between its mouth and the grass below. The spatial arrangement creates a layered structure where the bird is embedded within the intersection of snow, grass, and air, with every element physically touching or supporting another in a tightly interlocked network." +} \ No newline at end of file diff --git a/figures/gemini_figures/prompt3.json b/figures/gemini_figures/prompt3.json new file mode 100644 index 0000000000000000000000000000000000000000..893b687babefbd7a21b3475696be9aa7f5c9d21b --- /dev/null +++ b/figures/gemini_figures/prompt3.json @@ -0,0 +1,7 @@ +{ + "origin": "A family of three, consisting of a man, a woman, and a young child, engaged in a playful martial arts demonstration in a modern, well-lit bedroom.", + "balance": "A man wearing a loose gray cotton t-shirt and dark denim jeans stands on a polished oak floor, his left foot planted firmly while his right leg extends in a controlled high kick. Directly opposite him, a woman in a white linen blouse and black trousers adopts a defensive stance, her forearms crossed to block the incoming motion. Between them, a young child in a bright red hoodie and blue shorts mimics the woman's posture, standing slightly behind her right shoulder with small fists raised. The trio occupies the center of a modern bedroom where a large wooden bed with a white duvet rests against the far wall, positioned parallel to a floor-to-ceiling window that floods the room with natural light. A low glass coffee table sits in front of the bed, holding a stack of hardcover books and a ceramic vase. To the left of the man, a tall bookshelf filled with colorful spines reaches the ceiling, while a small potted fern sits on the windowsill between the glass panes. The spatial arrangement places the family in a triangular formation, with the child bridging the gap between the adults, all grounded on the wooden surface beneath the ambient daylight filtering through the sheer curtains.", + "entity": "A man, a woman, and a young child execute synchronized martial arts forms on a hardwood floor within a modern bedroom. The man wears a white gi, black belt, and wrist wraps while blocking a wooden practice sword held by the woman, who wears a red gi, headband, and shin guards. The young child, dressed in a blue gi and knee pads, mimics a low stance near a stack of folded towels and a yoga mat. A large window with sheer curtains frames the scene, casting natural light across a nightstand holding a digital clock, a glass of water, and a small potted plant. Behind the family, a wooden wardrobe stands beside a metal clothing rack draped with jackets and scarves. A plush rug covers part of the floor near a toy box overflowing with plastic blocks, action figures, and a stuffed bear. On the wall, a framed photograph, a calendar, and a string of paper lanterns hang above a bookshelf filled with hardcover books, a globe, and a model airplane. A ceiling fan with four blades rotates slowly above a hanging mobile of wooden stars. A laptop sits open on a desk in the corner next to a pair of headphones, a notebook, and a pen, while a laundry basket filled with clothes rests near the door.", + "attribute": "A man with short dark hair, wearing a white cotton t-shirt with visible weave texture and grey sweatpants featuring elastic cuffs, stands on a polished oak floor with his left foot forward and right arm extended in a high block position. Beside him, a woman with long brown hair tied in a loose ponytail wears a red ribbed knit sweater with frayed cuffs and blue denim jeans showing faded knee patches; her right leg is bent at a forty-five-degree angle while her left hand forms a fist near her chest. Between them, a young child with curly blonde hair wears a yellow striped polo shirt with a small stain on the collar and green cargo shorts with multiple zipped pockets; the child's arms are raised in a defensive stance, fingers splayed, standing on a beige wool rug with a frayed edge. The room contains a wooden bed frame with a metal headboard positioned against a white painted drywall, next to a nightstand made of light maple wood holding a ceramic lamp with a fabric shade. Sunlight streams through a rectangular window with clear glass panes, casting sharp linear shadows across the floorboards, while a silver ceiling fan with four blades rotates slowly above the group, its metallic surface reflecting the ambient light.", + "relation": "A man, a woman, and a young child occupy a modern bedroom where the man stands with feet planted on a rug, his left arm extended to intercept the woman's raised right fist hovering inches from his shoulder. The woman balances on the balls of her feet atop the same rug, her body leaning forward at a sharp angle relative to the man's upright posture, while her left hand grips the child's wrist. The child, suspended mid-air by the woman's grip, has legs bent and feet dangling directly above the man's knee, creating a triangular spatial configuration between the three figures. The man's right hand reaches upward to support the child's ankle, forming a closed loop of physical contact. Behind them, a wooden bed frame runs parallel to the wall, with a mattress resting on slats that intersect the room's floor plane. A bedside lamp sits on a table adjacent to the bed, casting a cone of light that overlaps the man's torso and the child's legs. The rug lies flat on the floorboards, its edges abutting the bed frame, while a window on the far wall allows external light to stream across the floor, intersecting the shadows cast by the trio. The spatial arrangement creates a dense network of supports and intersections, with limbs crossing and bodies offset to form a complex, interlocking structure within the confined room dimensions." +} diff --git a/figures/gemini_figures/relation.png b/figures/gemini_figures/relation.png new file mode 100644 index 0000000000000000000000000000000000000000..084e7817d2be698f48aa4a07867a81a4ade2a123 --- /dev/null +++ b/figures/gemini_figures/relation.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15819f191df849d97f0fafbba1554e72bf63f89e659ac9946897943b2bba5153 +size 1863613 diff --git a/figures/gemini_figures/relation_p2.png b/figures/gemini_figures/relation_p2.png new file mode 100644 index 0000000000000000000000000000000000000000..6998ed289c8590a2ba714f7a207404dc4749e284 --- /dev/null +++ b/figures/gemini_figures/relation_p2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60c60b49dec9b40a031ac58ec01679e12ebff0cbcf3f6b8792b1568ad11466ce +size 1357045 diff --git a/figures/gemini_figures/relation_p3.png b/figures/gemini_figures/relation_p3.png new file mode 100644 index 0000000000000000000000000000000000000000..db3dd12f7cca4e89dfb4308bd4debbc1989b556c --- /dev/null +++ b/figures/gemini_figures/relation_p3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ce0dd857bc65ed3a36bb1b8e267d9dbcb6351e16faccb461298ff4ddeed3413 +size 1338249 diff --git a/figures/gemini_figures/relation_v2.png b/figures/gemini_figures/relation_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..0d0df4f51cd57ebd9b1cf485d23af7a6d4afa14e --- /dev/null +++ b/figures/gemini_figures/relation_v2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be715b7a26ca08a14c8d89c0ca42f0e4d9bc95b1eba84c1ab3bc6ef126bc7ddf +size 2322398 diff --git a/figures/portrait_compare/01_aesthetic_photo/flux2_base.png b/figures/portrait_compare/01_aesthetic_photo/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..7645945644aa5dce5c060dcf643b7f104f4066b3 --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1cfabc71d9b33842a3515ce06d29cca41b189e4afa714a0d091c89d3c970e9da +size 1707996 diff --git a/figures/portrait_compare/01_aesthetic_photo/flux2_lora_clip.png b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..03f9d0c71b220888623544c5b7d76d0f38dbfe70 --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1234896f1a33609c6bba6ea4806807b48aa8c06de2458dc449c87c1ba3721875 +size 1897703 diff --git a/figures/portrait_compare/01_aesthetic_photo/flux2_lora_hpsv3.png b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..e15ad96567a1d31693b3f782fd500e8fd72fd3c0 --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54393b3c67c016e364d9434543848b0e0af6a64e8e99d587830bc9929e4855ae +size 1968891 diff --git a/figures/portrait_compare/01_aesthetic_photo/flux2_lora_unified_9b.png b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..ad80440ccd25872d72235fb8a882eb4280ddc139 --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87821d12712446a0c0214199ea9ef7932971d8c4ee543ba241708708f84ba99b +size 1904224 diff --git a/figures/portrait_compare/01_aesthetic_photo/flux2_lora_vqa_balance.png b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..f5708458a75727a60de7ad9d5336c8795088317b --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:725d79418d849f5b0a164c02a8c3f302d8093601521664d9b08fd09a0ec16e89 +size 1851785 diff --git a/figures/portrait_compare/01_aesthetic_photo/zimage_base.png b/figures/portrait_compare/01_aesthetic_photo/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..28cca4e4ab0b4403c01e03fa2abfed69f010473f --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:157895ee988a4856f49952d45ee6077df085907c48dad3693d2fe1fd1a31c999 +size 1167957 diff --git a/figures/portrait_compare/01_aesthetic_photo/zimage_lora_clip.png b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..d68dccc8aea0e3fead62966f7956ed20533bda9b --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:970d28b8f0536b05da623578e71ba14547ea9659678b28586933fd55450d43a3 +size 1213537 diff --git a/figures/portrait_compare/01_aesthetic_photo/zimage_lora_hpsv3.png b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..5468c06f773e2ed0b55cb393c6d478de1ab361fe --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:096d2cb38ab73a6f0c6bff22f7bda918b6e1246684221015338a58ccd85decfb +size 1681500 diff --git a/figures/portrait_compare/01_aesthetic_photo/zimage_lora_unified_9b.png b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..c20ffbbaad2895670bd8654d404822c936d82968 --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b868863e5d2515431143ad95d23534c49f29a666658a83ccb0cb64b5373d5e60 +size 1400384 diff --git a/figures/portrait_compare/01_aesthetic_photo/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..a5ba2af34b42815c2c73ccd5af37484fcf107eb0 --- /dev/null +++ b/figures/portrait_compare/01_aesthetic_photo/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbf3099d7b38858b0e5e7848de753247f55851748efd793a0c9a14dca4241020 +size 1302283 diff --git a/figures/portrait_compare/02_art_nouveau/flux2_base.png b/figures/portrait_compare/02_art_nouveau/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..3edc926b7ede3f0370aba590c3a377244be223f3 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:489d783f7dc85f3ea29c8482df7a7b568c086e6cab8a4387f6010b42ce0b2e8d +size 2255782 diff --git a/figures/portrait_compare/02_art_nouveau/flux2_lora_clip.png b/figures/portrait_compare/02_art_nouveau/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..2a787b13ccf3e690000d835f2bc9d0dfff40b881 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c08d0ad807af68b0a082a57069026ee7baeea0c7dd5174ec2002c78ad06e09a0 +size 2407052 diff --git a/figures/portrait_compare/02_art_nouveau/flux2_lora_hpsv3.png b/figures/portrait_compare/02_art_nouveau/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..c4396ce2072733e15347cb5ae470e12b965bd84d --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f6fbdb29c67a49e6e276a8b83723dbf4f589a52d15c80a032e94645104a47f0 +size 2455106 diff --git a/figures/portrait_compare/02_art_nouveau/flux2_lora_unified_9b.png b/figures/portrait_compare/02_art_nouveau/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..ad89ddc8cfa33d43bfe66c6bfa367df9ed18e461 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d3f5ea72fa641dcd8e4d1e7ee4afd7c8be692282a83bc847a299282205efbac +size 2534114 diff --git a/figures/portrait_compare/02_art_nouveau/flux2_lora_vqa_balance.png b/figures/portrait_compare/02_art_nouveau/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..6bd1465ea5c0fa222bbd43ab3ede98101285e66a --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09ef30e1a907f6e3d2700c7f9b7f121c1100575aad6c26ab5554118b2bbdc75a +size 2556037 diff --git a/figures/portrait_compare/02_art_nouveau/zimage_base.png b/figures/portrait_compare/02_art_nouveau/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..b605f5e21acb554981b8ad940a262339b985de56 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eecda4661af754ea99a3cdea9eda20315f2516ad895d22ee78599e215381300d +size 2148798 diff --git a/figures/portrait_compare/02_art_nouveau/zimage_lora_clip.png b/figures/portrait_compare/02_art_nouveau/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..594e4d2080032a1ac4657150a81f5458da24a44c --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a5c01a52c7fe954b8623d644d52b91443611038cd66936960eaba602665abb7 +size 2254442 diff --git a/figures/portrait_compare/02_art_nouveau/zimage_lora_hpsv3.png b/figures/portrait_compare/02_art_nouveau/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..80da7dbd7e468639d11e4a93f1d1da3a046e1fe2 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25dcf5a34374d9976a1ee2d81b81f3952a72764767778cc729d4eb6d79358763 +size 1962038 diff --git a/figures/portrait_compare/02_art_nouveau/zimage_lora_unified_9b.png b/figures/portrait_compare/02_art_nouveau/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..852beef356bccd0f25fcba441e1c42b8245480d3 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f45ba090c964c98879dfacefd588ac94a7e36c6541cf61e3153dff4325830a2 +size 2067749 diff --git a/figures/portrait_compare/02_art_nouveau/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/02_art_nouveau/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..f880553ecd1ff1cd35a8eb849c44c452299519c5 --- /dev/null +++ b/figures/portrait_compare/02_art_nouveau/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98cc3e2804d3a20d6dc47b812eafb098484c3724beb5c0e88a0d1856fcf27faa +size 2087843 diff --git a/figures/portrait_compare/03_classical_oil/flux2_base.png b/figures/portrait_compare/03_classical_oil/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..387af5dff03f28510f2640a65b4eea19e0f777b1 --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84dddb2c4e74fa8468c9208d29e22c8b021879933202a0e54e61756bc9d4999f +size 1643382 diff --git a/figures/portrait_compare/03_classical_oil/flux2_lora_clip.png b/figures/portrait_compare/03_classical_oil/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..c5224ca7763b1ce5c5e7628f620efebbe818042b --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45f9ab22a092da1b27668874cb885ba353ed529bb9e81c4c8ce5e5c1de344d60 +size 1942109 diff --git a/figures/portrait_compare/03_classical_oil/flux2_lora_hpsv3.png b/figures/portrait_compare/03_classical_oil/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..7439623c6107c2c42d3f8f243e09b933cdf23e44 --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e26267add00528ac92579d568cc6cfd69fb851eb5ea9866f00574e4d2c4651e +size 1913681 diff --git a/figures/portrait_compare/03_classical_oil/flux2_lora_unified_9b.png b/figures/portrait_compare/03_classical_oil/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..6d8353de4d9b15424ccb859e07368d4d741230bd --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a84221551572821fa8d905304722d033295bfb9fa3534ace4ee3ae37f421db8 +size 1610225 diff --git a/figures/portrait_compare/03_classical_oil/flux2_lora_vqa_balance.png b/figures/portrait_compare/03_classical_oil/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..e56dd637a105825e011011a371c110994e11f92c --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7eb0cf693f94da13504fe7fbfa009094b3a9125e624c0d261cc127c6337a568b +size 1664694 diff --git a/figures/portrait_compare/03_classical_oil/zimage_base.png b/figures/portrait_compare/03_classical_oil/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..e0004f75f9f404b91f59b2ba48eb3de2ad216c93 --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6515663d87a9361baa99d1e04fdba0d67eca992504f8cd27fb22a82b6751db8 +size 1806487 diff --git a/figures/portrait_compare/03_classical_oil/zimage_lora_clip.png b/figures/portrait_compare/03_classical_oil/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..ceaff2532564e6a017024b34029e9476ffd12231 --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:013fd59ee920c13a73216056b023e5b69fdea4cac31974603c669f597c86346e +size 1682489 diff --git a/figures/portrait_compare/03_classical_oil/zimage_lora_hpsv3.png b/figures/portrait_compare/03_classical_oil/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..55812084a9b331fee60756bdd3f33f5ec9a7803c --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3033cf17c3aef4ca230464fabb169d0297bf85c15550d4c9492cb84159490e6e +size 1958776 diff --git a/figures/portrait_compare/03_classical_oil/zimage_lora_unified_9b.png b/figures/portrait_compare/03_classical_oil/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..5ad7d139dd7b87578492910accd2b04a4b526f3e --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb3127c9f448503591c5a57ad7cc34e88c795d3e5ec3b8876819419fd819eed1 +size 1872379 diff --git a/figures/portrait_compare/03_classical_oil/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/03_classical_oil/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..44069485f41cf89330b150173586a7d13f97ea54 --- /dev/null +++ b/figures/portrait_compare/03_classical_oil/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b616063a25328e9c94ca8b8c6e94d56d52a7d1eff695864508890d803bebd66e +size 1882897 diff --git a/figures/portrait_compare/04_watercolor/flux2_base.png b/figures/portrait_compare/04_watercolor/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..cebc82cf815d3100a0059aef52131b95a88f41fa --- /dev/null +++ b/figures/portrait_compare/04_watercolor/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75e98cdd7a739431fd52f359233ddc8120644cf606bd6cc7cd56e5eeff0b7461 +size 1476051 diff --git a/figures/portrait_compare/04_watercolor/flux2_lora_clip.png b/figures/portrait_compare/04_watercolor/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..23d38a01ae0ab334ce360c5ecc6ff8186a83ce0d --- /dev/null +++ b/figures/portrait_compare/04_watercolor/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e3f689d8a48eb7df67a2071bab69d7dc3ca1054ec66f0ec45f967f5fd85376b +size 1912965 diff --git a/figures/portrait_compare/04_watercolor/flux2_lora_hpsv3.png b/figures/portrait_compare/04_watercolor/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..3186a27fd9402182c526d949dda7addc48ab3f70 --- /dev/null +++ b/figures/portrait_compare/04_watercolor/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:026c2af68ebf5fe489095ee0d8799c4426eb6227a5a0c885bd35c203db126e04 +size 1966694 diff --git a/figures/portrait_compare/04_watercolor/flux2_lora_unified_9b.png b/figures/portrait_compare/04_watercolor/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..e892ea2e42c1d289cf0a18e90f90f88ca2158146 --- /dev/null +++ b/figures/portrait_compare/04_watercolor/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a42989ab4a145070f252c33548e30581fb3966601d4dbb712ddb043a95b147d7 +size 1794059 diff --git a/figures/portrait_compare/04_watercolor/flux2_lora_vqa_balance.png b/figures/portrait_compare/04_watercolor/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..2b64cea5f8f5a807fb322f0153f6e2dacde86c9c --- /dev/null +++ b/figures/portrait_compare/04_watercolor/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d440cf03455e25a2a2220948a6507093e6c18125fa6ab58f565b5405565fa203 +size 1727106 diff --git a/figures/portrait_compare/04_watercolor/zimage_base.png b/figures/portrait_compare/04_watercolor/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..2469d38d4773262d9bb2737b005129de9a8077ae --- /dev/null +++ b/figures/portrait_compare/04_watercolor/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7340ac36400d9e0b2249a0263fbe9dde6b49d1d3445f002f1ce4b9dc8e468dd7 +size 1659417 diff --git a/figures/portrait_compare/04_watercolor/zimage_lora_clip.png b/figures/portrait_compare/04_watercolor/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..64720f96717adb7b175eb339bdd968415a9c05b9 --- /dev/null +++ b/figures/portrait_compare/04_watercolor/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdbd7a928b450646efaaef9496116c721123af129ae3d1f86599d7bbc8accb2a +size 1661978 diff --git a/figures/portrait_compare/04_watercolor/zimage_lora_hpsv3.png b/figures/portrait_compare/04_watercolor/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..16610cebc1fba338297a6442e7e4e51502872d70 --- /dev/null +++ b/figures/portrait_compare/04_watercolor/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:369df5e3d98b3c3cdd3d18a361aa450fc0c35f9bdd4655ed4a7be7b52688f53a +size 2034562 diff --git a/figures/portrait_compare/04_watercolor/zimage_lora_unified_9b.png b/figures/portrait_compare/04_watercolor/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..93cee3f1cca559e29c482a2fcb729bc0f9aeeea2 --- /dev/null +++ b/figures/portrait_compare/04_watercolor/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79fec765fcc811d15cfccfa86533b21139f50f6ea920ed36217652057b6a9bc9 +size 1875590 diff --git a/figures/portrait_compare/04_watercolor/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/04_watercolor/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..eeeee79be34aa1d5836769452e5e488ff820f699 --- /dev/null +++ b/figures/portrait_compare/04_watercolor/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:993f516c8fc2d68054bd446d63ecfc97d2554744ba73ca2564deefe568adead2 +size 1737327 diff --git a/figures/portrait_compare/05_steampunk/flux2_base.png b/figures/portrait_compare/05_steampunk/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..1903cf12cbd371cc7c4c53a3746fad53af73ebe1 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2194788c547dc40a49f663b4eedf48a8d7d00a02817c95e45f046e6f860e136b +size 1712515 diff --git a/figures/portrait_compare/05_steampunk/flux2_lora_clip.png b/figures/portrait_compare/05_steampunk/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..6f9a711ad77c2d1b5fef07f1072baec3c834c636 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd74930487109cd06c0081f15846cfe5b67c29f4ac37d7ef86c58239c7fc2dbe +size 2008629 diff --git a/figures/portrait_compare/05_steampunk/flux2_lora_hpsv3.png b/figures/portrait_compare/05_steampunk/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..3ccfa7785918b4baa71ee21dfb6e071ba8e2ce9a --- /dev/null +++ b/figures/portrait_compare/05_steampunk/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0be37f36cd30e15373751247dc91cb9b90cfcbce293b11ff22d9f2e2582e0839 +size 2065203 diff --git a/figures/portrait_compare/05_steampunk/flux2_lora_unified_9b.png b/figures/portrait_compare/05_steampunk/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..ab31cbd20a4efb708a03255cb6700a42de60de32 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6775634f172489e08be1ba5aadd410e5bbc3b426185f689ec4b6559b0f8c705c +size 1690236 diff --git a/figures/portrait_compare/05_steampunk/flux2_lora_vqa_balance.png b/figures/portrait_compare/05_steampunk/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..6235f5ac4bfc7f2d72a2635cfca8e7677d77350b --- /dev/null +++ b/figures/portrait_compare/05_steampunk/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f93427f193d67486c385fd3680eed69c11197971d554db8ebce303db7418d4a1 +size 1791838 diff --git a/figures/portrait_compare/05_steampunk/zimage_base.png b/figures/portrait_compare/05_steampunk/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..047e3179dddc219b349b08fa58b2bedd41226b33 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca23625f681db23dc771311d871be759864e9046a589398bab907110febea3f6 +size 1598757 diff --git a/figures/portrait_compare/05_steampunk/zimage_lora_clip.png b/figures/portrait_compare/05_steampunk/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..b9bb54254aa729c662e2e93b31ff873209d0764e --- /dev/null +++ b/figures/portrait_compare/05_steampunk/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26b7951cfcd283145eac760136b4ea2056bd68c884619973ad2b496ba8b68fae +size 1675252 diff --git a/figures/portrait_compare/05_steampunk/zimage_lora_hpsv3.png b/figures/portrait_compare/05_steampunk/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..704662741875d1aef3e196152b816247a09c5184 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0443db2905c31d711bdda6a99fd0f78c919146fad4b0a8bb3c353ca05eb05c07 +size 1684721 diff --git a/figures/portrait_compare/05_steampunk/zimage_lora_unified_9b.png b/figures/portrait_compare/05_steampunk/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..a73ce03311d35b81ca8b3a60aa68d812ce99be46 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7979064d322849869e44556e92920c3884a18011e0caa6b540894fc05741d071 +size 1603255 diff --git a/figures/portrait_compare/05_steampunk/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/05_steampunk/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..b0aa6b5a6e0660a709e444debf5874f2b7157167 --- /dev/null +++ b/figures/portrait_compare/05_steampunk/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dfa7bbc3b62400241fa9de4a9883d2c09935380121503ae4f76ed4e3190c28e +size 1524266 diff --git a/figures/portrait_compare/06_anime/flux2_base.png b/figures/portrait_compare/06_anime/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..ae115ef2a91f999c3a1cdae440f32db1f2112386 --- /dev/null +++ b/figures/portrait_compare/06_anime/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83dfa04cca17a6799a2f12fb98648da1ed6e8680a30a6cca6eb059eb4c7aade3 +size 1445802 diff --git a/figures/portrait_compare/06_anime/flux2_lora_clip.png b/figures/portrait_compare/06_anime/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..f79d3d8ef9017119ae87b2e83241696d0e32ef31 --- /dev/null +++ b/figures/portrait_compare/06_anime/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57f11fdaf1e48b7044abeba8bb35f5f6c66f3983ce85c1b21be94c1bf8609788 +size 1812866 diff --git a/figures/portrait_compare/06_anime/flux2_lora_hpsv3.png b/figures/portrait_compare/06_anime/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..719d71bf4a1dc8bca6a5f4890419aa26d3f9fd8e --- /dev/null +++ b/figures/portrait_compare/06_anime/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ea260eadb5d1a6a91cb34382b414538e62ec7c228276ff1484ecf85de7f6d08 +size 1830493 diff --git a/figures/portrait_compare/06_anime/flux2_lora_unified_9b.png b/figures/portrait_compare/06_anime/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..2978f8b92ed9af789c6aa2a1b13715b2b3df9df9 --- /dev/null +++ b/figures/portrait_compare/06_anime/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a70c9e22952d503850fd9c65efa260126399c362cbdbc156ce6c0e04328700d +size 1612223 diff --git a/figures/portrait_compare/06_anime/flux2_lora_vqa_balance.png b/figures/portrait_compare/06_anime/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..7786afcb9977989a57720484dce4d4e423f77204 --- /dev/null +++ b/figures/portrait_compare/06_anime/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bc81195b80f25a0c5b7771c641af5f8fdd91f703259518b9a7ee331cd2499b9 +size 1651630 diff --git a/figures/portrait_compare/06_anime/zimage_base.png b/figures/portrait_compare/06_anime/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..ca2c80c9f84ed9c05a33d92fe2becac1b02aab04 --- /dev/null +++ b/figures/portrait_compare/06_anime/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76f53e1bef485e054755076f7c19806b586e8340d5f8686e1c01147dc0e81857 +size 1488037 diff --git a/figures/portrait_compare/06_anime/zimage_lora_clip.png b/figures/portrait_compare/06_anime/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..832932bf662faf69dd4b212dd57913d89ca7cc1e --- /dev/null +++ b/figures/portrait_compare/06_anime/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e721a474e9c379d84b74b2b64b44a8632c4ad00bd209fee935d5762f09f1ec1 +size 1569035 diff --git a/figures/portrait_compare/06_anime/zimage_lora_hpsv3.png b/figures/portrait_compare/06_anime/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..7a3fd115eb10ccd2cf3cbd2ac937fcc6e169dbaf --- /dev/null +++ b/figures/portrait_compare/06_anime/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55f56eff7eb3ec71528e2df0bc644d1f4d937a93259be63ce6da2ea6bd356f67 +size 1612775 diff --git a/figures/portrait_compare/06_anime/zimage_lora_unified_9b.png b/figures/portrait_compare/06_anime/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..11387a0fd804bd1d8173339a57550c65e83fe4bd --- /dev/null +++ b/figures/portrait_compare/06_anime/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b1bc845461952c3e9aa1e06befe4373b9403bb11cae2d57197e95974b43f096 +size 1566426 diff --git a/figures/portrait_compare/06_anime/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/06_anime/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..d01678d7b4e185964f83be5c527a7b75f555a9ae --- /dev/null +++ b/figures/portrait_compare/06_anime/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4917cc0397238dc0a86634ef5d4d7507eb82c2d6c7dddda45af1e132caa05c0b +size 1465162 diff --git a/figures/portrait_compare/07_cyberpunk/flux2_base.png b/figures/portrait_compare/07_cyberpunk/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..d9f387e6456ebf11829a766f5505539fed4d2a5c --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d105fb319422607a8975c327acae9fad095a106c3b7f0bca19fcc2dc259b886 +size 1801514 diff --git a/figures/portrait_compare/07_cyberpunk/flux2_lora_clip.png b/figures/portrait_compare/07_cyberpunk/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..a57be08f2cec198e62313ae1a00d58d7b00801c7 --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30b0240b7b66998394d9ba21ee7422e2678e1c22082c05265e787ec3f5a0d38b +size 2267549 diff --git a/figures/portrait_compare/07_cyberpunk/flux2_lora_hpsv3.png b/figures/portrait_compare/07_cyberpunk/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..0239e5bb0a55cc3e58e072dc2650c91ebe2b3933 --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e424ba18e074e2afb264d75a93b08cc264f7becc4ac1384b245ac5833f51036c +size 1976738 diff --git a/figures/portrait_compare/07_cyberpunk/flux2_lora_unified_9b.png b/figures/portrait_compare/07_cyberpunk/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..5db9d0eb565f7fae7f9348a359e82eab41fa14c8 --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94527fa7681cba8b515f4d461d7727a1533f891a7d67a4056f5f301cc11f2a0e +size 2062023 diff --git a/figures/portrait_compare/07_cyberpunk/flux2_lora_vqa_balance.png b/figures/portrait_compare/07_cyberpunk/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..e78ed66b6b46da1af23d19895eddf51fba4127bc --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3553dcffa7a22a92c23d4aa926fff86484f08e6a7c0bcddb7de86ecef99cbe04 +size 2061589 diff --git a/figures/portrait_compare/07_cyberpunk/zimage_base.png b/figures/portrait_compare/07_cyberpunk/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..aa5dfb16cbabc88bf37c78d7bdcdedb31a0c0a20 --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f2cf0383336be8a17750b22511464decb70c5fe9c98b955bc4dccac5a6d823d +size 1817329 diff --git a/figures/portrait_compare/07_cyberpunk/zimage_lora_clip.png b/figures/portrait_compare/07_cyberpunk/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..62f50222c0cb549412760e857c30a42c127ab28c --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3197766c6c862fb0b1bc9e5a35691fde75c661ec40107591ff5cdbd9e649202e +size 1805149 diff --git a/figures/portrait_compare/07_cyberpunk/zimage_lora_hpsv3.png b/figures/portrait_compare/07_cyberpunk/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..943c0319125a1b6a4a6ccad23ae34b4b72a0988a --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:750f49aefae627fc630bddcacf022585ba03be90f090da14fb09191c76daf1ef +size 2028101 diff --git a/figures/portrait_compare/07_cyberpunk/zimage_lora_unified_9b.png b/figures/portrait_compare/07_cyberpunk/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..5da4e937f1c684da6e80c6e9f737d297a08f6772 --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd5e33ee6188e019a8d89fc0e90b67efa2a90d4963f8a2ee53f97e234fbc1e5c +size 1939869 diff --git a/figures/portrait_compare/07_cyberpunk/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/07_cyberpunk/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..1249627f7c6eac15e434936d293a70899aad398b --- /dev/null +++ b/figures/portrait_compare/07_cyberpunk/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6576d04dc31acba10eed126ac1dca9d3ddcad708d2a6cf3c21ac5c86a04d0414 +size 1917574 diff --git a/figures/portrait_compare/08_mountain/flux2_base.png b/figures/portrait_compare/08_mountain/flux2_base.png new file mode 100644 index 0000000000000000000000000000000000000000..403188ac42685036ccc4d27e1b8e01c0078951d9 --- /dev/null +++ b/figures/portrait_compare/08_mountain/flux2_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e15bc3c06f7b28b01a92cf491e866e4c785c420527109c1eb96b928e02f6096a +size 1793269 diff --git a/figures/portrait_compare/08_mountain/flux2_lora_clip.png b/figures/portrait_compare/08_mountain/flux2_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..cb8e510468d35d5dcf6357873ff9aaf1c98b0e2a --- /dev/null +++ b/figures/portrait_compare/08_mountain/flux2_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b7ce32ae273708bd539625f38689e1fa0501568a368533b1e3d65c4e2403332 +size 2194601 diff --git a/figures/portrait_compare/08_mountain/flux2_lora_hpsv3.png b/figures/portrait_compare/08_mountain/flux2_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..1abc91053c40fff8386b3f07fa499e9a7d995add --- /dev/null +++ b/figures/portrait_compare/08_mountain/flux2_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5c5014df2b2be6429903014c4fbc24ecad30a08ee28a8dcd1affc396c6fbe8c +size 1974949 diff --git a/figures/portrait_compare/08_mountain/flux2_lora_unified_9b.png b/figures/portrait_compare/08_mountain/flux2_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..ac62e2e17df2e07fce6d8cd509c2b698e5acd5a0 --- /dev/null +++ b/figures/portrait_compare/08_mountain/flux2_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19e30f6b09f0cbf251f2ace343bf377f2f18e8a1b12b5f83a8a306b472103fab +size 1795935 diff --git a/figures/portrait_compare/08_mountain/flux2_lora_vqa_balance.png b/figures/portrait_compare/08_mountain/flux2_lora_vqa_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..55d980f38a4a76d0c8952b12774721de404c6303 --- /dev/null +++ b/figures/portrait_compare/08_mountain/flux2_lora_vqa_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:562fe1d65497643f779101d23ea8962eacbf8c25a92cc062a36ef1bb04c096cf +size 1819006 diff --git a/figures/portrait_compare/08_mountain/zimage_base.png b/figures/portrait_compare/08_mountain/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..db656197da1d11e5a9694a065c370a1865397796 --- /dev/null +++ b/figures/portrait_compare/08_mountain/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78c2fffdc2e44fbc6de5a35e83a4bf47250bddf89a28c959b2cf29912609301d +size 1818582 diff --git a/figures/portrait_compare/08_mountain/zimage_lora_clip.png b/figures/portrait_compare/08_mountain/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..e04ab8df4d159bf3912ba91a2bf3e37a4228a64d --- /dev/null +++ b/figures/portrait_compare/08_mountain/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:049dc5f63d888d5da8dead3910cc302ff03f5f4320d56474b906a5ad69c5be52 +size 1853680 diff --git a/figures/portrait_compare/08_mountain/zimage_lora_hpsv3.png b/figures/portrait_compare/08_mountain/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..751b824e6fbcfe113e5e6ccb746a5256c819cfe7 --- /dev/null +++ b/figures/portrait_compare/08_mountain/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73a4dc68baf6c402e90a5ed2340516f618b4fd6e21a4fa62e8194d1ff384ab1e +size 1912329 diff --git a/figures/portrait_compare/08_mountain/zimage_lora_unified_9b.png b/figures/portrait_compare/08_mountain/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..910098804dc7cc427ff0ba12d3fe9e876b7d1852 --- /dev/null +++ b/figures/portrait_compare/08_mountain/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f47c6527956f9460b62aede1ab7e19436721fb6cf31a77f921f439f177d881e +size 1708121 diff --git a/figures/portrait_compare/08_mountain/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/08_mountain/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..eb8d48a59b981ce1be321254436f374a8f5cc6da --- /dev/null +++ b/figures/portrait_compare/08_mountain/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53e10ba32548146208d16094693c60bb72df65e9c3566954372bea8f688dfafc +size 1701773 diff --git a/figures/portrait_compare/09_fox/zimage_base.png b/figures/portrait_compare/09_fox/zimage_base.png new file mode 100644 index 0000000000000000000000000000000000000000..141a10ecbbef9d5b5c1a2deb3f011adbe5bbf7a6 --- /dev/null +++ b/figures/portrait_compare/09_fox/zimage_base.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b088c03cfeadbdf1bf276a64527fadd3c28574943c1d762c58c793cf10f6eef6 +size 1137729 diff --git a/figures/portrait_compare/09_fox/zimage_lora_clip.png b/figures/portrait_compare/09_fox/zimage_lora_clip.png new file mode 100644 index 0000000000000000000000000000000000000000..4df17bd012def30d97b452709ab76b9bd0bfe533 --- /dev/null +++ b/figures/portrait_compare/09_fox/zimage_lora_clip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:954ff1b61eb279db0c0617131b8264ec0e9d249ad7ffda9751a436a2cb62f2fa +size 1221379 diff --git a/figures/portrait_compare/09_fox/zimage_lora_hpsv3.png b/figures/portrait_compare/09_fox/zimage_lora_hpsv3.png new file mode 100644 index 0000000000000000000000000000000000000000..9aa95b8e06f46e617caee1c93310ecaea4601a2f --- /dev/null +++ b/figures/portrait_compare/09_fox/zimage_lora_hpsv3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:851b66ddb9087f2a1d890439c16992cba688753ae0e414d69adec48bdb0a0713 +size 1495872 diff --git a/figures/portrait_compare/09_fox/zimage_lora_unified_9b.png b/figures/portrait_compare/09_fox/zimage_lora_unified_9b.png new file mode 100644 index 0000000000000000000000000000000000000000..f52917350eacce2b74a72cf31f459eb7473c5f90 --- /dev/null +++ b/figures/portrait_compare/09_fox/zimage_lora_unified_9b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:829536d5b87433ab1fc7efac02caa621c694e1db8d0193fff3c655de55fa4e51 +size 1382452 diff --git a/figures/portrait_compare/09_fox/zimage_lora_vqa_balance_30st.png b/figures/portrait_compare/09_fox/zimage_lora_vqa_balance_30st.png new file mode 100644 index 0000000000000000000000000000000000000000..36111f1072a52162adb22650f64a83cb41d1d33a --- /dev/null +++ b/figures/portrait_compare/09_fox/zimage_lora_vqa_balance_30st.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73589c2e9672c6f6f563e07f1818bdd04b08c502f45b6799ec0bb4bf610d0f12 +size 1221745 diff --git a/figures/prompt_ablation/plot_relative_gain.py b/figures/prompt_ablation/plot_relative_gain.py new file mode 100644 index 0000000000000000000000000000000000000000..84b0baaea2806ce2a1ef208abf477d52e4c95d43 --- /dev/null +++ b/figures/prompt_ablation/plot_relative_gain.py @@ -0,0 +1,440 @@ +"""Relative performance gain vs. average prompt length. + +Four panels in a row. + Panel 1, 2: Joint-Training comparison (FLUX.2-4B / Z-Image). + Panel 3, 4: our Sequential-Training method (FLUX.2-4B / Z-Image). + +X-axis: average prompt length per benchmark (linear). +Y-axis: relative gain (%) over the Base model, computed dynamically as + (strategy_score - base_score) / base_score * 100. +Marker shape encodes the benchmark; line color encodes the strategy. +""" +from __future__ import annotations + +from pathlib import Path + +import matplotlib.colors as mcolors +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.collections import LineCollection +from matplotlib.lines import Line2D +from matplotlib.offsetbox import (AnchoredOffsetbox, DrawingArea, HPacker, + TextArea, VPacker) +from matplotlib.ticker import FixedLocator, MaxNLocator +from matplotlib.transforms import blended_transform_factory + +ROOT = Path(__file__).resolve().parent + +# Times-like serif (STIX) — consistent with the rest of the figures. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, + "axes.facecolor": "white", + "axes.edgecolor": "0.6", + "axes.linewidth": 0.8, + "axes.grid": True, + "grid.color": "0.85", + "grid.linestyle": "-", + "grid.linewidth": 0.7, + "axes.spines.top": False, + "axes.spines.right": False, +}) + + +# ── Data ─────────────────────────────────────────────────────────────────── +BENCHMARKS = ["T2I-CompBench", "TIIF-Bench", "SpatialGenEval", + "T2I-CoReBench", "LongBench-T2I"] +PROMPT_LEN = [8.7, 50.3, 65.6, 149.7, 538.5] + +# ─── 符号对齐: 想让 legend 里上下两行 "Long" 完全对齐, 调这两个 hspace 值. ─── +# 单位是 em (fontsize 的倍数). 数学符号 ∪ 比 → 窄, 所以 ∪ 一般要补更多. +# 思路: cup 总宽 (∪ + cup_left + cup_right) ≈ arrow 总宽 (→ + arrow_left + arrow_right). +# 调到上下两行 "Long" 字头位置完全一样为止. +SYMBOL_PAD_EM = { + "cup": {"left": 0.19, "right": 0.19}, # ∪ 左右各补的 hspace (em) + "arrow": {"left": -0.5, "right": -2.1}, # → 左右各补的 hspace (em) +} + + +def _math_symbol(name: str) -> str: + """根据 SYMBOL_PAD_EM 生成带 hspace 的 mathtext 片段 (含 $$).""" + tex = {"cup": r"\cup", "arrow": r"\rightarrow"}[name] + pad = SYMBOL_PAD_EM[name] + parts = [] + if pad["left"] > 0: + parts.append(rf"\hspace{{{pad['left']}}}") + parts.append(tex) + if pad["right"] > 0: + parts.append(rf"\hspace{{{pad['right']}}}") + return "$" + "".join(parts) + "$" + + +# 两个主方法的 legend 标签 (后面 DATA / STRATEGY_STYLE / PANELS / legend 都用这两个变量). +JOINT_LABEL = f"Imago-Short {_math_symbol('cup')} Long" # ∪ 版本 +SEQUENTIAL_LABEL = f"Imago-Short {_math_symbol('arrow')} Long" # → 版本 + + +DATA = { + "FLUX.2-Klein-4B": { + "Base": [3.983, 78.24, 74.51, 66.51, 3.385], + "Imago-Short": [4.110, 82.78, 77.58, 73.68, 3.759], + "Imago-Long": [4.041, 80.87, 78.00, 72.41, 3.808], + JOINT_LABEL: [4.124, 82.65, 78.00, 72.96, 3.812], + SEQUENTIAL_LABEL: [4.077, 81.87, 77.88, 73.11, 3.931], + }, + "Z-Image": { + "Base": [4.087, 86.44, 78.79, 85.16, 3.848], + "Imago-Short": [4.135, 87.76, 80.97, 89.69, 4.086], + "Imago-Long": [4.152, 87.56, 80.98, 88.56, 4.125], + JOINT_LABEL: [4.150, 87.69, 80.94, 89.12, 4.051], + SEQUENTIAL_LABEL: [4.164, 87.67, 81.16, 88.47, 4.179], + }, +} + +# Marker shapes per benchmark (consistent across panels). +MARKERS = { + "T2I-CompBench": "o", + "TIIF-Bench": "s", + "SpatialGenEval": "^", + "T2I-CoReBench": "D", + "LongBench-T2I": "*", +} +# 不同 marker 形状视觉大小不一致, 这个 dict 把它们统一到差不多大. 1.0 = 基准 (圆形). +# 这套数值在 figure 里和 legend 里都用, 改一处就两边都同步. +MARKER_SCALE = { + "o": 1.00, # 圆 (基准) + "s": 0.95, # 方形 (实际看起来略大, 略缩) + "^": 1.20, # 三角 (实际看起来偏小) + "D": 0.90, # 菱形 (实际看起来略大, 略缩) + "*": 1.55, # 星 (实际看起来明显偏小, 大幅放大) +} + +# Google brand palette (matches the other figures in this directory). +GOOGLE_BLUE = "#4285F4" +GOOGLE_YELLOW = "#F4B400" +GOOGLE_GREEN = "#34A853" +GOOGLE_RED = "#EA4335" + + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE: 所有可以调的字号 / 线粗 / 点大小 / 间距 / 位置都在这里. +# 改下面这些数字就能微调出图, 不需要看其他地方. +# --------------------------------------------------------------------------- +STYLE = { + # ---- 整张图的画布尺寸 (英寸): 4 个 panel 横向并排 + 右边一栏 legend ---- + "fig_size": (26.0, 5.4), + # 想拉开 legend 和最右侧 panel 的距离: 让 panel_area_width 变小, 或把 + # legend_left_pad 调大. 二选一即可 (也可同时调). + "panel_area_width": 0.82, # 4 个 panel 占整张图水平方向多少 (越小越靠左) + "legend_left_pad": 0.005, # legend 左边和 panel 区域之间的额外空白 (figure 分数) + + # ---- 横坐标 (线性, 单位是 word) ---- + "x_ticks": [0, 100, 200, 300, 400, 500], # 横坐标显示的刻度 + "xlabel": "Average Prompt Length", # 横坐标标题 + "xlabel_fontsize": 24, + "tick_fontsize": 22, # 横/纵坐标刻度数字字号 + + # ---- 纵坐标 ---- + "ylabel": "Relative Gain (%)", + "ylabel_fontsize": 24, + "y_max_ticks": 4, # 纵坐标最多多少个刻度数字 (越小越稀) + + # ---- 每个 panel 内的小标题框 (FLUX.2-4B / Z-Image), 放在右下角 ---- + "panel_title_fontsize": 24, + "panel_title_x": 0.97, # 标题框水平位置 (1=panel 最右) + "panel_title_y": 0.26, # 标题框垂直位置 (0=panel 最下) + "panel_title_pad": 0.45, # 标题框内边距 (越大框越大) + + # ---- 每个 panel 内的 "Base Model" 标记 (画在 y=0 虚线正上方一点点) ---- + "baseline_label": "Base Model", + "baseline_label_x": 0.6, # 标签水平位置 (axes 分数, 0.5=panel 中心) + "baseline_label_fontsize": 25, + "baseline_label_color": "#5A5A5A", + + # ---- 折线和数据点 ---- + # A-Short / A-Long 是参考虚线, Joint 和 Sequential 是要对比的两个主方法, + # 后两者的线粗 / 数据点大小都用 "main_*", 看起来一样重. + "ref_line_width": 3.0, # A-Short / A-Long (虚线参考) 的线粗 + "main_line_width": 6.6, # Joint / Sequential (主方法) 的线粗 + "marker_size": 16, # 折线上数据点的基准大小 (按 MARKER_SCALE 调整) + "marker_edge_width": 0.9, # 数据点白色描边粗细 + # ---- 数据线 / 点颜色随 prompt 长度由浅到深 (整条线连续渐变) ---- + # shade_range = (最左端 amount, 最右端 amount), 中间任何 x 都是按 x 线性插值. + # amount = 0 -> 基色 (Google 那 4 个原色) + # amount > 0 -> 比基色更暗 (混黑); 越大越暗, 1 = 纯黑 + # amount < 0 -> 比基色更浅 (混白); 越小越浅, -1 = 纯白 + # "浅端再浅, 深端保持基色" 就把第二个数设成 0, 第一个数设成负的. + # 例: (-0.55, 0.0) = 最左 (短 prompt) 比基色浅约 55%, 最右 (长 prompt) 就是基色. + "shade_range": (-0.55, 0.0), + "gradient_resolution": 200, # 把线插成多少个小段做渐变 (越大越平滑) + + # ---- Y=0 基线 (Base Model) ---- + "baseline_color": "#7A7A7A", + "baseline_lw": 1.2, + + # ---- legend (放在最右边一个框里, 上下排布: 4 strategy + 5 benchmark) ---- + # 这个 legend 是手搓的 (VPacker), 所有间距都直接生效, 单位都是 "点 (point)". + "legend_fontsize": 24, + "legend_marker_size": 18, # legend 上数据点的基准大小 + "legend_line_width": 5.0, # legend 上线段的粗细 + "legend_handle_len_pt": 40, # legend 上小线段的长度 (point) + "legend_handle_text_gap_pt": 18, # 小线段和文字之间的间距 (point) + "legend_row_gap_pt": 16, # 同一组内行与行之间的距离 (point) + "legend_section_gap_pt": 24, # strategy 组和 benchmark 组之间的距离 (point) + "legend_y_anchor": 0.5, # legend 垂直位置 (0.5=中间) + "legend_frame_edge": "0.65", # legend 边框颜色 (灰) + "legend_frame_lw": 0.9, # legend 边框线粗 + "legend_frame_pad_pt": 18, # legend 边框内边距 (point) + + # ---- 每个 panel 的坐标轴线 / 刻度小杠 / 网格线 粗细 ---- + "axis_spine_lw": 3.0, # 坐标轴线 (左 / 下) 粗细 + "axis_tick_width": 1.0, # 刻度小杠粗细 + "axis_tick_length": 4.5, # 刻度小杠长度 + "grid_lw": 0.7, # 网格线粗细 + "grid_alpha": 0.6, # 网格透明度 + "grid_color": "0.85", # 网格颜色 (越接近 0 越深) +} +# --------------------------------------------------------------------------- + + +# Strategy line/color style (built from STYLE so width edits propagate). +STRATEGY_STYLE = { + "Imago-Short": {"color": GOOGLE_GREEN, "ls": "--", + "lw": STYLE["ref_line_width"], + "alpha": 0.85, "z": 3}, + "Imago-Long": {"color": GOOGLE_YELLOW, "ls": "--", + "lw": STYLE["ref_line_width"], + "alpha": 0.85, "z": 3}, + JOINT_LABEL: {"color": GOOGLE_BLUE, "ls": "-", + "lw": STYLE["main_line_width"], + "alpha": 0.95, "z": 5}, + SEQUENTIAL_LABEL: {"color": GOOGLE_RED, "ls": "-", + "lw": STYLE["main_line_width"], + "alpha": 1.0, "z": 6}, +} + +# (axis index, model, strategies plotted on this panel, panel title text) +PANELS = [ + (0, "FLUX.2-Klein-4B", ["Imago-Short", "Imago-Long", JOINT_LABEL], "FLUX.2-Klein-Base-4B"), + (1, "Z-Image", ["Imago-Short", "Imago-Long", JOINT_LABEL], "Z-Image"), + (2, "FLUX.2-Klein-4B", ["Imago-Short", "Imago-Long", SEQUENTIAL_LABEL], "FLUX.2-Klein-Base-4B"), + (3, "Z-Image", ["Imago-Short", "Imago-Long", SEQUENTIAL_LABEL], "Z-Image"), +] + + +def relative_gain(strat: list[float], base: list[float]) -> list[float]: + return [(s - b) / b * 100.0 for s, b in zip(strat, base)] + + +def _marker_size(marker: str) -> float: + """matplotlib scatter 的 s 参数是面积 (point^2), 所以这里平方一下.""" + base = STYLE["marker_size"] * MARKER_SCALE.get(marker, 1.0) + return base ** 2 + + +def _shade(color, amount: float) -> tuple[float, float, float]: + """amount > 0 -> 混黑 (变暗); amount < 0 -> 混白 (变浅); 0 -> 原色.""" + r, g, b = mcolors.to_rgb(color) + if amount >= 0: + return (r * (1 - amount), g * (1 - amount), b * (1 - amount)) + a = -amount + return (r + (1 - r) * a, g + (1 - g) * a, b + (1 - b) * a) + + +def _amount_at_x(x: float) -> float: + """根据 x (prompt 长度) 在 shade_range 之间线性插值.""" + x_min = float(min(PROMPT_LEN)) + x_max = float(max(PROMPT_LEN)) + lo, hi = STYLE["shade_range"] + if x_max == x_min: + return lo + t = (x - x_min) / (x_max - x_min) + t = max(0.0, min(1.0, t)) + return lo + (hi - lo) * t + + +def _gradient_segments(xs, ys, base_color, lw, ls, alpha, zorder): + """把折线插成很多个小段, 每段一个独立的 shade, 视觉上呈连续渐变.""" + xs_arr = np.asarray(xs, dtype=float) + ys_arr = np.asarray(ys, dtype=float) + n_dense = max(STYLE["gradient_resolution"], 2) + # 用累计弧长做参数化; 这样在折点处不会出现颜色 "跳变". + seg_lens = np.hypot(np.diff(xs_arr), np.diff(ys_arr)) + cum = np.concatenate([[0.0], np.cumsum(seg_lens)]) + if cum[-1] == 0: + return LineCollection([], colors=[], linewidths=lw) + t_orig = cum / cum[-1] + t_dense = np.linspace(0.0, 1.0, n_dense) + xs_d = np.interp(t_dense, t_orig, xs_arr) + ys_d = np.interp(t_dense, t_orig, ys_arr) + + pts = np.stack([xs_d, ys_d], axis=1).reshape(-1, 1, 2) + segs = np.concatenate([pts[:-1], pts[1:]], axis=1) + # 每段颜色 = 段中点 x 对应的 shade amount. + mid_x = (xs_d[:-1] + xs_d[1:]) / 2.0 + seg_colors = [_shade(base_color, _amount_at_x(x)) for x in mid_x] + return LineCollection( + segs, colors=seg_colors, linewidths=lw, + linestyles=ls, alpha=alpha, zorder=zorder, + capstyle="round", joinstyle="round") + + +def plot_panel(ax, model: str, strategies: list[str], title: str) -> None: + base = DATA[model]["Base"] + + ax.axhline(0, color=STYLE["baseline_color"], ls="--", + lw=STYLE["baseline_lw"], zorder=2) + # "Base Model" 文字直接画在虚线上方一点点 (x 用 axes 分数, y 用数据坐标 0). + ax.text(STYLE["baseline_label_x"], 0, STYLE["baseline_label"], + transform=blended_transform_factory(ax.transAxes, ax.transData), + ha="center", va="bottom", + fontsize=STYLE["baseline_label_fontsize"], + color=STYLE["baseline_label_color"], + zorder=8) + + for strat in strategies: + gains = relative_gain(DATA[model][strat], base) + s = STRATEGY_STYLE[strat] + if s["ls"] == "-": + # 实线 (Joint / Sequential): 用 LineCollection 做连续渐变. + lc = _gradient_segments(PROMPT_LEN, gains, s["color"], + lw=s["lw"], ls=s["ls"], + alpha=s["alpha"], zorder=s["z"]) + ax.add_collection(lc) + else: + # 虚线参考 (A-Short / A-Long): 保留虚线纹理, 不做渐变, 用基色. + ax.plot(PROMPT_LEN, gains, color=s["color"], ls=s["ls"], + lw=s["lw"], alpha=s["alpha"], zorder=s["z"]) + # 数据点颜色用该 x 位置对应的 shade, 视觉上跟线一致. + for x, y, b in zip(PROMPT_LEN, gains, BENCHMARKS): + face = _shade(s["color"], _amount_at_x(x)) + ax.scatter(x, y, marker=MARKERS[b], s=_marker_size(MARKERS[b]), + facecolor=face, edgecolor="white", + linewidth=STYLE["marker_edge_width"], + alpha=s["alpha"], zorder=s["z"] + 1) + + ax.set_xscale("linear") + ax.xaxis.set_major_locator(FixedLocator(STYLE["x_ticks"])) + ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda v, _: f"{int(v)}")) + ax.yaxis.set_major_locator(MaxNLocator(nbins=STYLE["y_max_ticks"], + integer=True)) + ax.set_xlabel(STYLE["xlabel"], fontsize=STYLE["xlabel_fontsize"]) + ax.tick_params(axis="both", labelsize=STYLE["tick_fontsize"], + width=STYLE["axis_tick_width"], + length=STYLE["axis_tick_length"]) + for side in ("left", "bottom"): + ax.spines[side].set_linewidth(STYLE["axis_spine_lw"]) + ax.grid(True, axis="both", + color=STYLE["grid_color"], + linewidth=STYLE["grid_lw"], + alpha=STYLE["grid_alpha"]) + + ax.text(STYLE["panel_title_x"], STYLE["panel_title_y"], title, + transform=ax.transAxes, ha="right", va="bottom", + fontsize=STYLE["panel_title_fontsize"], + bbox=dict(boxstyle=f"round,pad={STYLE['panel_title_pad']}", + facecolor="white", edgecolor="0.7", + linewidth=0.8, alpha=0.95), + zorder=10) + + +def _legend_row(handle: Line2D, label: str) -> HPacker: + """构造 legend 单行: 左边一段小线段或单个 marker, 右边一段文字.""" + line_w = STYLE["legend_handle_len_pt"] + line_h = max(STYLE["legend_marker_size"], STYLE["legend_line_width"]) + 4 + da = DrawingArea(line_w, line_h, 0, 0) + if handle.get_linewidth() > 0: + # 线 (strategy 行): 一条横线, 不带 marker. + proxy = Line2D( + [2, line_w - 2], [line_h / 2, line_h / 2], + color=handle.get_color(), + linestyle=handle.get_linestyle(), + linewidth=handle.get_linewidth()) + else: + # 纯 marker (benchmark 行): 居中画一个点, 没有线. + proxy = Line2D( + [line_w / 2], [line_h / 2], + color=handle.get_color(), + linestyle="", + marker=handle.get_marker(), + markersize=handle.get_markersize(), + markerfacecolor=handle.get_markerfacecolor(), + markeredgecolor=handle.get_markeredgecolor()) + da.add_artist(proxy) + ta = TextArea(label, + textprops=dict(fontsize=STYLE["legend_fontsize"], + family=_FAMILY)) + return HPacker(children=[da, ta], align="center", + pad=0, sep=STYLE["legend_handle_text_gap_pt"]) + + +def _build_legend(fig) -> None: + """手搓 legend: 每个分组是一个 VPacker, 两组再放进一个外层 VPacker, 中间 + 用 STYLE['legend_section_gap_pt'] 控制间距 (单位: point, 任意值都生效).""" + strategy_proxies = [ + Line2D([0], [0], color=STRATEGY_STYLE[s]["color"], + ls=STRATEGY_STYLE[s]["ls"], + lw=STYLE["legend_line_width"]) + for s in ["Imago-Short", "Imago-Long", JOINT_LABEL, SEQUENTIAL_LABEL] + ] + strategy_labels = ["Imago-Short", "Imago-Long", JOINT_LABEL, + SEQUENTIAL_LABEL] + benchmark_proxies = [ + Line2D([0], [0], marker=MARKERS[b], color="0.32", lw=0, + markerfacecolor="0.32", markeredgecolor="white", + markersize=STYLE["legend_marker_size"] * MARKER_SCALE[MARKERS[b]]) + for b in BENCHMARKS + ] + + strat_rows = [_legend_row(h, lbl) + for h, lbl in zip(strategy_proxies, strategy_labels)] + bench_rows = [_legend_row(h, lbl) + for h, lbl in zip(benchmark_proxies, BENCHMARKS)] + + strat_pack = VPacker(children=strat_rows, align="left", + pad=0, sep=STYLE["legend_row_gap_pt"]) + bench_pack = VPacker(children=bench_rows, align="left", + pad=0, sep=STYLE["legend_row_gap_pt"]) + combined = VPacker(children=[strat_pack, bench_pack], align="left", + pad=0, sep=STYLE["legend_section_gap_pt"]) + + # legend 左边对齐到 panel 区域右侧 + 一个可调间隔. + legend_x = STYLE["panel_area_width"] + STYLE["legend_left_pad"] + box = AnchoredOffsetbox( + loc="center left", child=combined, + pad=STYLE["legend_frame_pad_pt"] / 10, # AnchoredOffsetbox.pad 是 fontsize 倍数 + borderpad=0, frameon=True, + bbox_to_anchor=(legend_x, STYLE["legend_y_anchor"]), + bbox_transform=fig.transFigure) + box.patch.set_edgecolor(STYLE["legend_frame_edge"]) + box.patch.set_linewidth(STYLE["legend_frame_lw"]) + fig.add_artist(box) + + +def main() -> None: + fig, axes = plt.subplots(1, 4, figsize=STYLE["fig_size"], sharey=False) + for idx, model, strategies, title in PANELS: + plot_panel(axes[idx], model, strategies, title) + axes[0].set_ylabel(STYLE["ylabel"], fontsize=STYLE["ylabel_fontsize"]) + + # Reserve right-side space for the legend, then place it. + fig.tight_layout(rect=(0, 0, STYLE["panel_area_width"], 1.0)) + _build_legend(fig) + + out_pdf = ROOT / "relative_gain.pdf" + out_png = ROOT / "relative_gain.png" + fig.savefig(out_pdf, dpi=300, bbox_inches="tight") + fig.savefig(out_png, dpi=200, bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_pdf}") + print(f"wrote {out_png}") + + +if __name__ == "__main__": + main() diff --git a/figures/prompt_ablation/plot_summary.py b/figures/prompt_ablation/plot_summary.py new file mode 100644 index 0000000000000000000000000000000000000000..1c1e52e8fd6520a9886ceaa16e652ba11899f2eb --- /dev/null +++ b/figures/prompt_ablation/plot_summary.py @@ -0,0 +1,256 @@ +"""Plot the Part-1 Summary of prompt_ablation.txt as a line+marker chart. + +Two panels (one per base model: FLUX.2-4B and Z-Image). Each variant gets one +line connecting its score across the 5 benchmarks. Balance is rendered in +saturated Google blue (thick line, large markers) to highlight it; the other +three variants share their Google brand colours but lightened. + +Y-axis is normalised per benchmark to [0, 100] using each benchmark's +theoretical bounds, then the panel's y range is auto-clipped around the data +so meaningful differences are visible: + + T2I-CoReBench-Composition: 0 - 100 + TIIF-Bench : 0 - 100 + SpatialGenEval : 0 - 100 + T2I-CompBench : 1 - 5 + LongBench-T2I : 1 - 5 +""" +from __future__ import annotations + +import re +from pathlib import Path + +import matplotlib.colors as mcolors +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +from matplotlib.offsetbox import AnchoredText +from matplotlib.ticker import MaxNLocator + +# Register and select the shared STIX Two Text typeface. +_FONT = Path(__file__).resolve().parent.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, +}) + +ROOT = Path(__file__).resolve().parent +SRC = ROOT.parent.parent / "sheet_exports" / "prompt_ablation.txt" + +# Ordered by mean prompt length (short -> long), measured on each test split. +# T2I-CompBench ~9 words, TIIF-Bench ~50, SpatialGenEval ~66, +# T2I-CoReBench-Composition ~129, LongBench-T2I ~539. +BENCHMARKS = [ + "T2I-CompBench", + "TIIF-Bench", + "SpatialGenEval", + "T2I-CoReBench-Composition", + "LongBench-T2I", +] +BOUNDS = { + "T2I-CoReBench-Composition": (0.0, 100.0), + "TIIF-Bench": (0.0, 100.0), + "T2I-CompBench": (1.0, 5.0), + "LongBench-T2I": (1.0, 5.0), + "SpatialGenEval": (0.0, 100.0), +} +DISPLAY = { + "T2I-CompBench": "T2I-\nCompBench", + "TIIF-Bench": "TIIF-\nBench", + "SpatialGenEval": "Spatial-\nGenEval", + "T2I-CoReBench-Composition": "T2I-CoReBench-\nComposition", + "LongBench-T2I": "LongBench-\nT2I", +} + +VARIANTS = ["Balance", "Attribute", "Entity", "Relation"] +COLORS = { + "Balance": "#4285F4", + "Attribute": "#EA4335", + "Entity": "#FBBC05", + "Relation": "#34A853", +} +MARKERS = { + "Balance": "o", + "Attribute": "s", + "Entity": "D", + "Relation": "^", +} +HIGHLIGHT = "Balance" +BASES = [("FLUX.2-Klein-Base-4B", "FLUX.2-4B"), ("Z-Image", "Z-Image")] + +LEGEND_LABELS = { + "Balance": "Balanced", + "Attribute": "Attribute-Centric", + "Entity": "Entity-Centric", + "Relation": "Relation-Centric", +} + + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE: 改下面这些数字就能调节图的字号 / 线宽 / 点大小 / 间距等 +# --------------------------------------------------------------------------- +STYLE = { + # 整张图的画布尺寸 (英寸): (宽, 高). 想把图整体拉高/拉宽就改这里. + "fig_size": (20.5, 6.0), + + # ---- 顶部 legend (Omni-Centric / Attribute-Centric / ...) ---- + "legend_fontsize": 25, # 顶部 legend 文字字号 + "legend_marker_size": 20, # 顶部 legend 上的点 (圆/方/菱形/三角) 大小 + "legend_line_width": 5.0, # 顶部 legend 上小线段的粗细 + "legend_handle_len": 3.0, # 顶部 legend 上小线段的长度 + "legend_col_spacing": 3.0, # 顶部 legend 各项之间的水平距离 (越小越挤) + "legend_text_pad": 0.8, # 顶部 legend 里 "线条" 和 "文字" 之间的间隙 + "legend_y_anchor": 1.06, # 顶部 legend 的垂直位置 (>1 即在画布顶部之上) + + # ---- 每个 panel 内的标题框 (FLUX.2-Klein-Base-4B / Z-Image) ---- + "panel_title_fontsize": 30, # panel 内白色标题框里的文字字号 + + # ---- 坐标轴文字 ---- + "ylabel_fontsize": 26, # 左边 "Score" 这个纵坐标标题字号 + "ytick_fontsize": 23, # 纵坐标刻度数字 (10, 20, ...) 字号 + "xtick_fontsize": 23, # 横坐标 benchmark 名字 (TIIF-Bench 等) 字号 + + # ---- 折线图本体 (panel 里的曲线和数据点) ---- + "highlight_line_width": 7, # 高亮变体 (Balance/Omni-Centric) 的线粗 + "highlight_marker_size": 25, # 高亮变体的数据点大小 + "other_line_width": 3.5, # 其他变体 (Attribute/Entity/Relation) 的线粗 + "other_marker_size": 18, # 其他变体的数据点大小 + "marker_edge_width": 1.0, # 数据点白色描边的粗细 +} +# --------------------------------------------------------------------------- + + +def load_part1_summary(path: Path) -> pd.DataFrame: + text = path.read_text() + part1 = re.search(r"=== Part 1:.*?\n(.*?)(?:\n=== Part 2:|\Z)", text, re.DOTALL).group(1) + summary = re.search(r"=== Summary ===\n(.*?)(?:\n=== |\Z)", part1, re.DOTALL).group(1) + lines = [ln for ln in summary.strip().splitlines() if ln.strip()] + header = lines[0].split("\t") + rows = [ln.split("\t") for ln in lines[1:]] + df = pd.DataFrame(rows, columns=header).set_index("Models") + return df.apply(pd.to_numeric, errors="coerce") + + +def normalise(value: float, bench: str) -> float: + lo, hi = BOUNDS[bench] + return (value - lo) / (hi - lo) * 100.0 + + +def lighten(color, amount: float = 0.55): + r, g, b = mcolors.to_rgb(color) + return (r + (1 - r) * amount, g + (1 - g) * amount, b + (1 - b) * amount) + + +def main() -> None: + df = load_part1_summary(SRC) + + fig, axes = plt.subplots(1, 2, figsize=STYLE["fig_size"], sharey=False) + x = np.arange(len(BENCHMARKS)) + + for ax, (base_label, base_prefix) in zip(axes, BASES): + per_v_norm: dict[str, np.ndarray] = {} + for v in VARIANTS: + row = f"{base_prefix}-{v}" + raw = np.array([df.loc[row, b] if row in df.index else np.nan for b in BENCHMARKS]) + per_v_norm[v] = np.array([normalise(r, b) for r, b in zip(raw, BENCHMARKS)]) + + # Draw non-highlight variants first (light), then Balance on top. + ordered = [v for v in VARIANTS if v != HIGHLIGHT] + [HIGHLIGHT] + for v in ordered: + base = COLORS[v] + is_hi = v == HIGHLIGHT + if is_hi: + line_c = base + pt_face = base + pt_edge = "white" + lw = STYLE["highlight_line_width"] + ms = STYLE["highlight_marker_size"] + alpha = 1.0 + z = 5 + else: + line_c = lighten(base, 0.50) + pt_face = lighten(base, 0.45) + pt_edge = "white" + lw = STYLE["other_line_width"] + ms = STYLE["other_marker_size"] + alpha = 0.85 + z = 3 + ax.plot(x, per_v_norm[v], color=line_c, lw=lw, alpha=alpha, zorder=z) + ax.scatter(x, per_v_norm[v], color=pt_face, marker=MARKERS[v], + s=ms ** 2, edgecolor=pt_edge, + linewidth=STYLE["marker_edge_width"], + alpha=alpha, zorder=z + 1) + + # Auto y range: clip tightly around the data so the lines fill the panel. + all_vals = np.concatenate(list(per_v_norm.values())) + all_vals = all_vals[~np.isnan(all_vals)] + lo, hi = float(np.min(all_vals)), float(np.max(all_vals)) + pad = max((hi - lo) * 0.08, 0.5) + ax.set_ylim(lo - pad, hi + pad) + + ax.set_xticks(x) + ax.set_xticklabels([DISPLAY[b] for b in BENCHMARKS], + fontsize=STYLE["xtick_fontsize"], + rotation=0, ha="center") + + # Title rendered as a small framed legend-style box in the upper-left. + title_box = AnchoredText( + base_label, loc="upper right", + prop=dict(size=STYLE["panel_title_fontsize"]), + pad=0.4, borderpad=0.6, frameon=True, + ) + title_box.patch.set_edgecolor("0.7") + title_box.patch.set_linewidth(0.8) + title_box.patch.set_facecolor("white") + title_box.patch.set_alpha(0.95) + ax.add_artist(title_box) + ax.tick_params(axis="y", labelsize=STYLE["ytick_fontsize"]) + ax.tick_params(axis="x", labelsize=STYLE["xtick_fontsize"], + length=5, width=0.9, direction="out") + ax.grid(True, axis="both", linestyle=":", linewidth=0.8, color="0.55", alpha=1.0) + ax.set_axisbelow(True) + # Sparser, integer-only y ticks. + # Use the auto locator to pick nice integer ticks, then keep only + # those strictly inside the data range so neither the very bottom + # nor the very top of the panel is labelled. + ax.yaxis.set_major_locator(MaxNLocator(nbins=4, integer=True)) + fig.canvas.draw() + ax.set_yticks([t for t in ax.get_yticks() if lo < t < hi]) + # Keep only the bottom spine. + for side in ("top", "left", "right"): + ax.spines[side].set_visible(False) + ax.spines["bottom"].set_linewidth(0.8) + + axes[0].set_ylabel("Score", fontsize=STYLE["ylabel_fontsize"]) + + handles = [] + for v in VARIANTS: + is_hi = v == HIGHLIGHT + line_c = COLORS[v] if is_hi else lighten(COLORS[v], 0.50) + face = COLORS[v] if is_hi else lighten(COLORS[v], 0.45) + handles.append(plt.Line2D([0], [0], color=line_c, marker=MARKERS[v], + markerfacecolor=face, markeredgecolor="white", + markersize=STYLE["legend_marker_size"], + lw=STYLE["legend_line_width"], + label=LEGEND_LABELS[v])) + fig.legend(handles=handles, loc="upper center", ncol=len(VARIANTS), + bbox_to_anchor=(0.5, STYLE["legend_y_anchor"]), + fontsize=STYLE["legend_fontsize"], + frameon=False, + handlelength=STYLE["legend_handle_len"], + columnspacing=STYLE["legend_col_spacing"], + handletextpad=STYLE["legend_text_pad"]) + fig.tight_layout(rect=(0, 0, 1, 0.95)) + fig.savefig(ROOT / "prompt_type.png", dpi=200, bbox_inches="tight") + fig.savefig(ROOT / "prompt_type.pdf", bbox_inches="tight") + plt.close(fig) + print(f"wrote {ROOT / 'prompt_type.png'} and .pdf") + + +if __name__ == "__main__": + main() diff --git a/figures/prompt_ablation/prompt_type.pdf b/figures/prompt_ablation/prompt_type.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a4c7a921dd5ef5db648418206bf9365e91fb3e52 Binary files /dev/null and b/figures/prompt_ablation/prompt_type.pdf differ diff --git a/figures/prompt_ablation/prompt_type.png b/figures/prompt_ablation/prompt_type.png new file mode 100644 index 0000000000000000000000000000000000000000..bbb1eae6aa0163df7e624370231b1a0bb9c005da --- /dev/null +++ b/figures/prompt_ablation/prompt_type.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6cc90dde73a7b7b4bf16a7eb156b3f58ec27d93fd92a8a3caf3004bce137548 +size 424756 diff --git a/figures/prompt_ablation/relative_gain.pdf b/figures/prompt_ablation/relative_gain.pdf new file mode 100644 index 0000000000000000000000000000000000000000..59a5cb9920c32b553d49f32d1ee14b5641a13336 Binary files /dev/null and b/figures/prompt_ablation/relative_gain.pdf differ diff --git a/figures/prompt_ablation/relative_gain.png b/figures/prompt_ablation/relative_gain.png new file mode 100644 index 0000000000000000000000000000000000000000..3e7e2ba88ab9225d88978a323f4342f42b6ee71c --- /dev/null +++ b/figures/prompt_ablation/relative_gain.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5e9581cf3ddaf84bf53d8a1968da81105a315d66c9d6576650591efb56dba97 +size 444906 diff --git a/figures/reward_ablation/plot_vqa_size_box.py b/figures/reward_ablation/plot_vqa_size_box.py new file mode 100644 index 0000000000000000000000000000000000000000..ec484bc8a6813b3e2fc80620ab9610d857ce6d05 --- /dev/null +++ b/figures/reward_ablation/plot_vqa_size_box.py @@ -0,0 +1,305 @@ +"""VQA reward-model size ablation - box plot. + +每个 panel: 横坐标是 Base / 4B / 9B / 27B (四个 box),每个 box 概括 5 个 +benchmark 的 normalised score (0~100)。FLUX 用红色渐变,Z-Image 用蓝色渐变。 + +要调样式只改下面 CONFIG dict 即可,其它代码逻辑不用动。 +""" +from __future__ import annotations + +import re +from pathlib import Path + +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +from matplotlib.ticker import MaxNLocator + +# ============================================================ +# 全部可调参数都在这里 (CONFIG)。改这里就行。 +# ============================================================ +CONFIG = { + # ---------- 整体布局 ---------- + "figsize": (12.0, 4.8), # 整张图尺寸 (宽, 高)。当前 2.5:1。常用: 2:1 -> (12,6), 4:3 -> (12,9) + "dpi": 200, # 输出 PNG 的分辨率 + "out_stem": "reward_vqa_size_box", # 输出文件名 (不含扩展名),会同时写 .png 和 .pdf + "tight_layout": True, # 是否调用 tight_layout 自动收紧白边 + + # ---------- 字体 ---------- + "font_path": "../_fonts/STIX-Two-Text-Regular.ttf", # 字体 ttf 路径 (相对本脚本) + "math_fontset": "stix", # 数学公式字体 ("stix" / "cm" / "dejavusans" 等) + + # ---------- X 轴 ---------- + "x_step": 0.50, # 相邻 box 中心的水平间距,越小越挤 + "x_margin": 0.30, # 第一个 / 最后一个 box 离 panel 边的留白 + "x_labels": ["Base", "4B", "9B", "27B"], # 横坐标显示的文字 + "xtick_fontsize": 20, # 横坐标字号 + "tick_length": 7, # 刻度线长度 + "tick_width": 1.6, # 刻度线粗细 + "tick_direction": "out", # 刻度朝向: "in" / "out" / "inout" + + # ---------- Y 轴 ---------- + "ylabel": "Score", # 纵坐标标题 + "ylabel_fontsize": 20, # 纵坐标标题字号 + "ytick_fontsize": 20, # 纵坐标刻度字号 + "y_pad_frac": 0.10, # 上下留白 = 数据 range 的比例 + "y_pad_min": 0.5, # 上下留白的最小值 (绝对单位) + "y_nbins": 5, # Y 轴刻度数量上限 (matplotlib 自动取整) + "y_integer_ticks": True, # Y 轴刻度是否强制为整数 + + # ---------- Box 形状 ---------- + "box_width": 0.26, # 每个 box 的宽度,越大越胖 + "show_fliers": False, # 是否画离群点 (5 个 benchmark 一般用不到) + + # ---------- Box 黑色框线 / whisker / 中位数 ---------- + "outline_color": "black", # box 边、whisker、cap、中位数线的颜色 + "box_edge_width": 2, # box 矩形边框粗细 + "median_linewidth": 2, # 中位数横线粗细 + "whisker_linewidth": 1.8, # 上下竖线 (whisker) 粗细 + "cap_linewidth": 1.8, # whisker 顶端短横线粗细 + + # ---------- Box 填充颜色 (每个 panel 一个 Google 渐变, 浅→深 = Base→27B) ---------- + # FLUX = 红色系, Z-Image = 蓝色系。Key 必须和下面 BASES 的 row 前缀一致。 + "panel_colors": { + "FLUX.2-4B": { + "label": "FLUX.2-Klein-Base-4B", # 右下角 panel 名 + "box_colors": ["#FAD2CF", "#F28B82", "#E04A3C", "#A50E0E"], # 4 个 box 的填充 + "box_alpha": 0.90, # 填充透明度 + "point_color": "black", # 散点颜色 (开启时) + }, + "Z-Image": { + "label": "Z-Image", + "box_colors": ["#E8F0FE", "#A0C2F5", "#4285F4", "#174EA6"], + "box_alpha": 0.90, + "point_color": "black", + }, + }, + + # ---------- 散点叠加 (show_points=True 时显示 5 个 benchmark 的实际值) ---------- + "show_points": False, # 是否叠加散点 + "point_size": 24, # 散点大小 + "point_alpha": 0.75, # 散点透明度 + "point_jitter": 0.06, # 散点水平抖动幅度 + "point_edge": "white", # 散点描边颜色 + "point_edge_w": 0.5, # 散点描边粗细 + "point_zorder": 4, # 散点层级 (数字越大越在上层) + "point_jitter_seed": 0, # 散点抖动随机种子 + + # ---------- 右下角 panel 名 (FLUX.2-4B / Z-Image) ---------- + "panel_label_fontsize": 22, # 字号 + "panel_label_xy": (0.95, 0.07), # 位置 (axes 坐标 0~1) + "panel_label_ha": "right", # 水平对齐: "left" / "center" / "right" + "panel_label_va": "bottom", # 竖直对齐: "top" / "center" / "bottom" + "panel_label_weight": "normal", # 字重: "normal" / "bold" + + # ---------- panel 名外面的框 ---------- + "panel_label_box": True, # 是否给 panel 名加框 + "panel_label_box_style": "round,pad=0.3", # 框样式: "square,pad=0.3" / "round,pad=0.4" 等 + "panel_label_box_face": "white", # 框填充色 ("none" = 透明) + "panel_label_box_edge": "black", # 框边线颜色 + "panel_label_box_lw": 1.6, # 框边线粗细 + "panel_label_box_alpha": 1.0, # 框填充透明度 + + # ---------- 边框 (spines) ---------- + "show_all_spines": True, # True = 四边都显示, False = 只显示底边 + "spine_linewidth": 2.0, # 边框粗细 + "spine_color": "black", # 边框颜色 + + # ---------- 背景网格 ---------- + "show_grid": True, # 是否显示网格 (True / False) + "grid_axis": "both", # 网格方向: "y" / "x" / "both" + "grid_linestyle": "--", # 网格线型: ":" 点线 / "--" 虚线 / "-" 实线 / "-." 点划线 + "grid_linewidth": 2.0, # 网格粗细 + "grid_color": "0.7", # 网格颜色 (灰阶 "0"~"1" 或 hex; 越接近 1 越浅) + "grid_alpha": 0.5, # 网格透明度 0~1 + "grid_zorder": 0, # 网格层级 (越小越在底层, 0 = box 后面) +} + + +# ============================================================ +# 数据 layout (一般不用改 — 改了会影响数据加载)。 +# ============================================================ +ROOT = Path(__file__).resolve().parent +SRC = ROOT.parent.parent / "sheet_exports" / "reward_ablation.txt" + +BENCHMARKS = [ + "TIIF-Bench", + "T2I-CompBench", + "SpatialGenEval", + "T2I-CoReBench-Composition", + "LongBench-T2I", +] +BOUNDS = { # 每个 benchmark 的理论上下界 (用来归一化到 0~100) + "T2I-CoReBench-Composition": (0.0, 100.0), + "TIIF-Bench": (0.0, 100.0), + "T2I-CompBench": (1.0, 5.0), + "LongBench-T2I": (1.0, 5.0), + "SpatialGenEval": (0.0, 100.0), +} +VARIANTS = ["Base", "VQA-4B", "VQA-9B", "VQA-27B"] # 每个 panel 的 4 个 box (从左到右) +BASES = [("FLUX.2-Klein-4B-Base", "FLUX.2-4B"), # (展示名, row 前缀) + ("Z-Image", "Z-Image")] + + +# ============================================================ +# 字体注册 (rcParams) +# ============================================================ +_font_path = (ROOT / CONFIG["font_path"]).resolve() +fm.fontManager.addfont(str(_font_path)) +_FAMILY = fm.FontProperties(fname=str(_font_path)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": CONFIG["math_fontset"], + "axes.unicode_minus": False, +}) + + +# ============================================================ +# 数据加载 + 归一化 (一般不用改) +# ============================================================ +def load_summary(path: Path, table: str) -> pd.DataFrame: + text = path.read_text() + block = re.search(rf"=== {re.escape(table)} ===\n(.*?)(?:\n=== |\Z)", text, re.DOTALL) + if block is None: + raise SystemExit(f"could not locate {table!r} in {path}") + lines = [ln for ln in block.group(1).strip().splitlines() if ln.strip()] + header = lines[0].split("\t") + rows = [ln.split("\t") for ln in lines[1:]] + df = pd.DataFrame(rows, columns=header).set_index("Models") + return df.apply(pd.to_numeric, errors="coerce") + + +def normalise(value: float, bench: str) -> float: + lo, hi = BOUNDS[bench] + return (value - lo) / (hi - lo) * 100.0 + + +# ============================================================ +# 绘图主流程 (基本只是把 CONFIG 套到 matplotlib API 上) +# ============================================================ +def main() -> None: + cfg = CONFIG + df1 = load_summary(SRC, "Table 1.Summary") + df2 = load_summary(SRC, "Table 2.Summary") + + panel_norm: dict[str, np.ndarray] = {} + for _, base_prefix in BASES: + mat = np.full((len(VARIANTS), len(BENCHMARKS)), np.nan) + for i, v in enumerate(VARIANTS): + row = f"{base_prefix}-{v}" + src = df1 if v == "Base" else df2 + for j, bench in enumerate(BENCHMARKS): + if row in src.index: + mat[i, j] = normalise(float(src.loc[row, bench]), bench) + panel_norm[base_prefix] = mat + + fig, axes = plt.subplots(1, 2, figsize=cfg["figsize"], sharey=False) + rng = np.random.default_rng(cfg["point_jitter_seed"]) + x_positions = 1.0 + np.arange(len(VARIANTS)) * cfg["x_step"] + + for ax, (_, base_prefix) in zip(axes, BASES): + scheme = cfg["panel_colors"][base_prefix] + mat = panel_norm[base_prefix] + data = [mat[i, :][~np.isnan(mat[i, :])] for i in range(len(VARIANTS))] + + # ---- box ---- + bp = ax.boxplot( + data, positions=x_positions, widths=cfg["box_width"], + patch_artist=True, showfliers=cfg["show_fliers"], + medianprops={"color": cfg["outline_color"], + "linewidth": cfg["median_linewidth"]}, + whiskerprops={"color": cfg["outline_color"], + "linewidth": cfg["whisker_linewidth"]}, + capprops={"color": cfg["outline_color"], + "linewidth": cfg["cap_linewidth"]}, + boxprops={"edgecolor": cfg["outline_color"], + "linewidth": cfg["box_edge_width"]}, + ) + for patch, fc in zip(bp["boxes"], scheme["box_colors"]): + patch.set_facecolor(fc) + patch.set_alpha(scheme["box_alpha"]) + + # ---- 可选: 散点叠加 ---- + if cfg["show_points"]: + for i, vals in enumerate(data): + jitter = rng.uniform(-cfg["point_jitter"], cfg["point_jitter"], size=len(vals)) + ax.scatter( + np.full(len(vals), x_positions[i]) + jitter, vals, + s=cfg["point_size"], color=scheme["point_color"], + alpha=cfg["point_alpha"], + edgecolor=cfg["point_edge"], linewidth=cfg["point_edge_w"], + zorder=cfg["point_zorder"], + ) + + # ---- 坐标轴范围 ---- + flat = mat[~np.isnan(mat)] + lo, hi = float(np.min(flat)), float(np.max(flat)) + pad = max((hi - lo) * cfg["y_pad_frac"], cfg["y_pad_min"]) + ax.set_ylim(lo - pad, hi + pad) + ax.set_xlim(x_positions[0] - cfg["x_margin"], + x_positions[-1] + cfg["x_margin"]) + + # ---- 刻度 / 字号 ---- + ax.set_xticks(x_positions) + ax.set_xticklabels(cfg["x_labels"], fontsize=cfg["xtick_fontsize"]) + ax.tick_params(axis="y", labelsize=cfg["ytick_fontsize"], + length=cfg["tick_length"], width=cfg["tick_width"], + direction=cfg["tick_direction"]) + ax.tick_params(axis="x", labelsize=cfg["xtick_fontsize"], + length=cfg["tick_length"], width=cfg["tick_width"], + direction=cfg["tick_direction"]) + ax.yaxis.set_major_locator( + MaxNLocator(nbins=cfg["y_nbins"], integer=cfg["y_integer_ticks"]) + ) + + # ---- 网格 ---- + if cfg["show_grid"]: + ax.grid(True, axis=cfg["grid_axis"], + linestyle=cfg["grid_linestyle"], linewidth=cfg["grid_linewidth"], + color=cfg["grid_color"], alpha=cfg["grid_alpha"], + zorder=cfg["grid_zorder"]) + else: + ax.grid(False) + ax.set_axisbelow(True) + + # ---- 边框 (spines) ---- + for side in ("top", "right", "left", "bottom"): + ax.spines[side].set_visible(cfg["show_all_spines"] or side == "bottom") + ax.spines[side].set_linewidth(cfg["spine_linewidth"]) + ax.spines[side].set_color(cfg["spine_color"]) + + # ---- 右下角 panel 名 (可选加框) ---- + bbox = None + if cfg["panel_label_box"]: + bbox = dict( + boxstyle=cfg["panel_label_box_style"], + facecolor=cfg["panel_label_box_face"], + edgecolor=cfg["panel_label_box_edge"], + linewidth=cfg["panel_label_box_lw"], + alpha=cfg["panel_label_box_alpha"], + ) + ax.text( + cfg["panel_label_xy"][0], cfg["panel_label_xy"][1], + scheme["label"], + transform=ax.transAxes, + ha=cfg["panel_label_ha"], va=cfg["panel_label_va"], + fontsize=cfg["panel_label_fontsize"], + fontweight=cfg["panel_label_weight"], + bbox=bbox, + ) + + axes[0].set_ylabel(cfg["ylabel"], fontsize=cfg["ylabel_fontsize"]) + + if cfg["tight_layout"]: + fig.tight_layout() + out_stem = ROOT / cfg["out_stem"] + fig.savefig(out_stem.with_suffix(".png"), dpi=cfg["dpi"], bbox_inches="tight") + fig.savefig(out_stem.with_suffix(".pdf"), bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_stem.with_suffix('.png').name} / .pdf") + + +if __name__ == "__main__": + main() diff --git a/figures/reward_ablation/reward_vqa_size_box.pdf b/figures/reward_ablation/reward_vqa_size_box.pdf new file mode 100644 index 0000000000000000000000000000000000000000..89b37604ac8bff8ce18603484e52b6d830191a11 Binary files /dev/null and b/figures/reward_ablation/reward_vqa_size_box.pdf differ diff --git a/figures/reward_ablation/reward_vqa_size_box.png b/figures/reward_ablation/reward_vqa_size_box.png new file mode 100644 index 0000000000000000000000000000000000000000..22cb62dea626a17d0d442b1e8165f7f47c8ce985 --- /dev/null +++ b/figures/reward_ablation/reward_vqa_size_box.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2db1a77009b662d25109b4e58e38a4feec4fc783c7bb5505bb3de3b77f6bb78e +size 87776 diff --git a/figures/univision/.omc/state/agent-replay-653d91aa-65f6-47ac-90e7-3679b45fe395.jsonl b/figures/univision/.omc/state/agent-replay-653d91aa-65f6-47ac-90e7-3679b45fe395.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..4510324582b3acb2e2bf2e5d2289e61b3fd6a76a --- /dev/null +++ b/figures/univision/.omc/state/agent-replay-653d91aa-65f6-47ac-90e7-3679b45fe395.jsonl @@ -0,0 +1,129 @@ +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aec5a80","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac94411","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa642a8","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a602f8d","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"adde875","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"afa7743","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a31f736","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a447af4","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aaf352c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"af9f65b","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a591d0f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a19e1b6","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"aa3b44f","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a1c4ad3","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab426c5","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ac1178c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab98a24","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"af86bd6","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a0cbd14","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a7c6fda","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a3a6c65","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a35239c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a75ef48","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a75ef48","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"a71342c","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ab4cf7b","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} +{"t":0,"agent":"ace25ea","agent_type":"unknown","event":"agent_stop","success":true} diff --git a/figures/univision/.omc/state/idle-notif-cooldown.json b/figures/univision/.omc/state/idle-notif-cooldown.json new file mode 100644 index 0000000000000000000000000000000000000000..929ed0d20244253f03767d562b9ffb1cd38adb40 --- /dev/null +++ b/figures/univision/.omc/state/idle-notif-cooldown.json @@ -0,0 +1,5 @@ +{ + "lastSentAt": "2026-09-26T07:14:18.311Z", + "repoSignature": "{\"repo\":\"Jialuo-Li/T2I-Eval\",\"headSha\":\"328fb243f922ae96470494f881c74073879ccc2d\",\"dirty\":true,\"openPrNumbers\":[],\"openIssueNumbers\":[],\"failingRunIds\":[26139094951,26249856486,26259454927,26260076153,26261716251,26262757466,26263193893,26265094360]}", + "backlogZero": false +} \ No newline at end of file diff --git a/figures/univision/.omc/state/last-tool-error.json b/figures/univision/.omc/state/last-tool-error.json new file mode 100644 index 0000000000000000000000000000000000000000..8b78c74304b89ee49ad762e7499f43981989906a --- /dev/null +++ b/figures/univision/.omc/state/last-tool-error.json @@ -0,0 +1,7 @@ +{ + "tool_name": "Bash", + "tool_input_preview": "{\"command\":\"python - <<'PY'\\nimport re, importlib.util, zlib\\nfrom pathlib import Path\\nraw = Path(\\\"b.txt\\\").read_text()\\ntex = []\\nfor m in re.finditer(r\\\"\\\\\\\\addplot\\\\[(\\\\w+)\\\\]\\\\s*coordinates\\\\s*\\...", + "error": "Exit code 1\nb.txt data: EXACT MATCH ✅\nguidance titles: ['Metric depth: $\\\\delta_1$ (%) $\\\\uparrow$', 'Metric depth: AbsRel $\\\\downarrow$', 'Relative depth: $\\\\delta_1$ (%) $\\\\uparrow$', 'Normal: Mean ($^\\\\circ$) $\\\\downarrow$', 'Semantic: mIoU (%) $\\\\uparrow$', 'Instance: cgF$_1$ (%) $\\\\uparrow$']\nTraceback (most recent call last):\n File \"\", line 19, in \n File \"\", line 19, in \nNameError: name '_try' is not defined", + "timestamp": "2026-09-25T21:13:14.999Z", + "retry_count": 1 +} \ No newline at end of file diff --git a/figures/univision/.omc/state/subagent-tracking.json b/figures/univision/.omc/state/subagent-tracking.json new file mode 100644 index 0000000000000000000000000000000000000000..76a4886f1557f563bd4e4d15b06c897bebde4f2b --- /dev/null +++ b/figures/univision/.omc/state/subagent-tracking.json @@ -0,0 +1,7 @@ +{ + "agents": [], + "total_spawned": 0, + "total_completed": 0, + "total_failed": 0, + "last_updated": "2026-09-26T07:15:10.912Z" +} \ No newline at end of file diff --git a/figures/univision/a.csv b/figures/univision/a.csv new file mode 100644 index 0000000000000000000000000000000000000000..304cb2df5fac042527460e781adf6ca9392b4f31 --- /dev/null +++ b/figures/univision/a.csv @@ -0,0 +1,134 @@ +model,model_order,reference_count,fully_successful_cases,evaluated_cases,benchmark_cases,missing_cases,eligible_references,omitted_references,fully_success_rate,fully_success_rate_percent,evaluation_coverage,source_run +GPT-Image-2,0,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,4,7,7,7,0,28,0,1.0000000000,100.00,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,5,36,38,38,0,190,2,0.9473684211,94.74,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,6,95,101,101,0,602,6,0.9405940594,94.06,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,7,110,122,123,1,837,16,0.9016393443,90.16,0.9918699187,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,8,101,125,127,2,965,27,0.8080000000,80.80,0.9842519685,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,9,106,126,126,0,1083,21,0.8412698413,84.13,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,10,99,125,126,1,1206,31,0.7920000000,79.20,0.9920634921,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,11,57,66,67,1,695,10,0.8636363636,86.36,0.9850746269,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,12,41,68,68,0,788,34,0.6029411765,60.29,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,13,19,39,39,0,495,36,0.4871794872,48.72,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,14,16,34,34,0,456,26,0.4705882353,47.06,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,15,13,31,31,0,449,28,0.4193548387,41.94,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,16,11,25,25,0,388,22,0.4400000000,44.00,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,17,7,24,24,0,396,35,0.2916666667,29.17,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,18,6,25,25,0,430,30,0.2400000000,24.00,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,19,4,23,23,0,431,47,0.1739130435,17.39,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +GPT-Image-2,0,20,3,19,19,0,380,42,0.1578947368,15.79,1.0000000000,1k_full_evaluation_20260909 (seed=gpt_image_2) +Nano Banana Pro,1,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,4,7,7,7,0,28,0,1.0000000000,100.00,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,5,37,38,38,0,190,1,0.9736842105,97.37,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,6,92,101,101,0,602,9,0.9108910891,91.09,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,7,107,123,123,0,844,16,0.8699186992,86.99,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,8,102,126,127,1,973,28,0.8095238095,80.95,0.9921259843,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,9,100,126,126,0,1083,30,0.7936507937,79.37,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,10,84,126,126,0,1216,48,0.6666666667,66.67,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,11,50,67,67,0,706,24,0.7462686567,74.63,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,12,42,68,68,0,788,36,0.6176470588,61.76,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,13,21,39,39,0,495,30,0.5384615385,53.85,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,14,17,34,34,0,456,25,0.5000000000,50.00,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,15,12,31,31,0,449,27,0.3870967742,38.71,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,16,5,25,25,0,388,41,0.2000000000,20.00,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,17,3,24,24,0,396,44,0.1250000000,12.50,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,18,8,25,25,0,430,28,0.3200000000,32.00,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,19,4,23,23,0,431,43,0.1739130435,17.39,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Nano Banana Pro,1,20,4,19,19,0,380,42,0.2105263158,21.05,1.0000000000,1k_full_evaluation_20260909 (seed=nano_banana_pro) +Cosmos3 8B + RefTree,2,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,4,7,7,7,0,28,0,1.0000000000,100.00,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,5,35,38,38,0,190,3,0.9210526316,92.11,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,6,80,101,101,0,602,24,0.7920792079,79.21,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,7,90,123,123,0,844,39,0.7317073171,73.17,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,8,88,127,127,0,981,56,0.6929133858,69.29,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,9,80,126,126,0,1083,63,0.6349206349,63.49,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,10,65,126,126,0,1216,77,0.5158730159,51.59,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,11,39,67,67,0,706,39,0.5820895522,58.21,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,12,23,68,68,0,788,79,0.3382352941,33.82,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,13,5,39,39,0,495,70,0.1282051282,12.82,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,14,5,34,34,0,456,72,0.1470588235,14.71,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,15,4,31,31,0,449,57,0.1290322581,12.90,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,16,3,25,25,0,388,53,0.1200000000,12.00,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,17,1,24,24,0,396,63,0.0416666667,4.17,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,18,2,25,25,0,430,76,0.0800000000,8.00,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,19,1,23,23,0,431,101,0.0434782609,4.35,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +Cosmos3 8B + RefTree,2,20,0,19,19,0,380,91,0.0000000000,0.00,1.0000000000,reference_to_image_bench_ablation_dv2_public_ours_older_ga_lance_iter_000040500_16x9 +FLUX2-Klein 8B + RefTree,3,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,4,7,7,7,0,28,0,1.0000000000,100.00,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,5,35,38,38,0,190,4,0.9210526316,92.11,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,6,81,101,101,0,602,21,0.8019801980,80.20,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,7,85,123,123,0,844,51,0.6910569106,69.11,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,8,95,127,127,0,981,39,0.7480314961,74.80,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,9,85,126,126,0,1083,48,0.6746031746,67.46,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,10,59,126,126,0,1216,84,0.4682539683,46.83,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,11,39,67,67,0,706,41,0.5820895522,58.21,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,12,32,68,68,0,788,64,0.4705882353,47.06,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,13,13,39,39,0,495,45,0.3333333333,33.33,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,14,6,34,34,0,456,64,0.1764705882,17.65,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,15,8,31,31,0,449,38,0.2580645161,25.81,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,16,4,25,25,0,388,52,0.1600000000,16.00,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,17,1,24,24,0,396,56,0.0416666667,4.17,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,18,1,25,25,0,430,68,0.0400000000,4.00,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,19,0,23,23,0,431,81,0.0000000000,0.00,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +FLUX2-Klein 8B + RefTree,3,20,1,19,19,0,380,94,0.0526315789,5.26,1.0000000000,0918-flux2-ref2img-iter14000-bg-or-16x9-rel-nopad-max1024 +HiDream-O1,4,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,4,6,7,7,0,28,1,0.8571428571,85.71,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,5,33,38,38,0,190,5,0.8684210526,86.84,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,6,71,101,101,0,602,34,0.7029702970,70.30,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,7,71,123,123,0,844,72,0.5772357724,57.72,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,8,56,127,127,0,981,99,0.4409448819,44.09,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,9,60,126,126,0,1083,100,0.4761904762,47.62,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,10,35,126,126,0,1216,150,0.2777777778,27.78,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,11,23,67,67,0,706,82,0.3432835821,34.33,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,12,20,68,68,0,788,107,0.2941176471,29.41,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,13,6,39,39,0,495,83,0.1538461538,15.38,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,14,2,34,34,0,456,109,0.0588235294,5.88,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,15,4,31,31,0,449,101,0.1290322581,12.90,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,16,0,25,25,0,388,118,0.0000000000,0.00,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,17,0,24,24,0,396,106,0.0000000000,0.00,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,18,1,25,25,0,430,113,0.0400000000,4.00,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,19,0,23,23,0,431,110,0.0000000000,0.00,1.0000000000,HiDream-O1__input-fallback +HiDream-O1,4,20,0,19,19,0,380,136,0.0000000000,0.00,1.0000000000,HiDream-O1__input-fallback +FireRed-Image-Edit-1.1,5,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,4,7,7,7,0,28,0,1.0000000000,100.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,5,29,38,38,0,190,9,0.7631578947,76.32,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,6,61,101,101,0,602,61,0.6039603960,60.40,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,7,49,123,123,0,844,118,0.3983739837,39.84,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,8,42,127,127,0,981,145,0.3307086614,33.07,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,9,33,126,126,0,1083,196,0.2619047619,26.19,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,10,21,126,126,0,1216,263,0.1666666667,16.67,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,11,11,67,67,0,706,176,0.1641791045,16.42,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,12,7,68,68,0,788,199,0.1029411765,10.29,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,13,2,39,39,0,495,138,0.0512820513,5.13,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,14,3,34,34,0,456,174,0.0882352941,8.82,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,15,0,31,31,0,449,169,0.0000000000,0.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,16,1,25,25,0,388,146,0.0400000000,4.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,17,0,24,24,0,396,167,0.0000000000,0.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,18,0,25,25,0,430,194,0.0000000000,0.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,19,0,23,23,0,431,200,0.0000000000,0.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FireRed-Image-Edit-1.1,5,20,0,19,19,0,380,212,0.0000000000,0.00,1.0000000000,FireRed-Image-Edit-1.1-AgentThenDeterministic3__input-fallback +FLUX2-Klein-9B,6,2,1,1,1,0,2,0,1.0000000000,100.00,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,3,2,2,2,0,6,0,1.0000000000,100.00,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,4,6,7,7,0,28,1,0.8571428571,85.71,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,5,35,38,38,0,190,3,0.9210526316,92.11,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,6,71,101,101,0,602,35,0.7029702970,70.30,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,7,76,123,123,0,844,59,0.6178861789,61.79,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,8,68,127,127,0,981,82,0.5354330709,53.54,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,9,59,126,126,0,1083,91,0.4682539683,46.83,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,10,34,126,126,0,1216,144,0.2698412698,26.98,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,11,25,67,67,0,706,77,0.3731343284,37.31,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,12,15,68,68,0,788,109,0.2205882353,22.06,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,13,7,39,39,0,495,92,0.1794871795,17.95,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,14,3,34,34,0,456,104,0.0882352941,8.82,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,15,3,31,31,0,449,93,0.0967741935,9.68,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,16,0,25,25,0,388,88,0.0000000000,0.00,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,17,1,24,24,0,396,102,0.0416666667,4.17,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,18,0,25,25,0,430,120,0.0000000000,0.00,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,19,0,23,23,0,431,154,0.0000000000,0.00,1.0000000000,FLUX2-Klein-9B__input-fallback +FLUX2-Klein-9B,6,20,0,19,19,0,380,153,0.0000000000,0.00,1.0000000000,FLUX2-Klein-9B__input-fallback diff --git a/figures/univision/a.py b/figures/univision/a.py new file mode 100644 index 0000000000000000000000000000000000000000..fd979734e5c5e06ac7e854d63d887b765cf0caa4 --- /dev/null +++ b/figures/univision/a.py @@ -0,0 +1,50 @@ +import matplotlib.pyplot as plt + +# 数据准备 +categories = ['≤5', '(5,10]', '(10,15]', '(15,20]'] +values = [32.90, 35.29, 18.29, 13.52] + +# 颜色配置(提取自原图) +# 柱子从左到右: 浅蓝 → 深蓝 +bar_colors = ['#CDE3EF', '#9EC5DA', '#71A5C3', '#4E88AB'] +text_color = '#0e344d' # 深藏青色文字与基准线 + +# 创建画布 +fig, ax = plt.subplots(figsize=(4.2, 5.5), dpi=300) + +# 绘制柱状图 +bars = ax.bar(categories, values, color=bar_colors, width=0.62) + +# 柱顶数值标注(两行显示:数字与%) +for bar, val in zip(bars, values): + height = bar.get_height() + ax.text( + bar.get_x() + bar.get_width() / 2, + height + 1.0, + f"{val:.2f}%", + ha='center', + va='bottom', + color=text_color, + fontsize=16, + linespacing=0.9 + ) + +# 坐标轴与边框样式 +ax.set_ylim(0, 42) +ax.spines['top'].set_visible(False) +ax.spines['right'].set_visible(False) +ax.spines['left'].set_visible(False) + +# 底部轴线及刻度 +ax.spines['bottom'].set_color(text_color) +ax.spines['bottom'].set_linewidth(1.5) +ax.yaxis.set_visible(False) +ax.tick_params(axis='x', length=0, pad=10) + +plt.xticks(color=text_color, fontsize=16) +plt.tight_layout() + +# 保存或展示 +plt.savefig('reproduced_chart.pdf', bbox_inches='tight') +plt.savefig('reproduced_chart.png', dpi=300, bbox_inches='tight') +plt.show() \ No newline at end of file diff --git a/figures/univision/a.txt b/figures/univision/a.txt new file mode 100644 index 0000000000000000000000000000000000000000..468bff4aeb7358aae9bd58078beff58d25308189 --- /dev/null +++ b/figures/univision/a.txt @@ -0,0 +1,75 @@ +% Semantic/instance data: Google Doc 1zk1LZ3CRKfaldQzKkZNxciQ80pZJ9KGqifAk05cM3-Y, +% tab t.l3nc0xwy9mgb, read 2026-09-23. Fixed prefixes of seeds 0 through 9. +% Checkpoint: 50K EMA; UniPC, 50 steps; updated task configurations. +% Depth: CFG 2, shift 3; equal-weight NYUv2/KITTI/ETH3D/iBims means. +% Semantic: CFG 4, shift 7, 1536x768. Instance: CFG 2, shift 3, native 2M cap. +% Semantic/instance run: 50k-bestcfg-20260922-multiseed-n10-6748f7528d18. +% Semantic/instance series come from the source document's prefix tables. +% Depth update: author-supplied Macro-four results, 2026-09-24. +% The complete depth table below retains the supplied six-decimal precision. +% Source snapshot: .vscode/depth_aggregation_macro_four_20260924.csv. +% N,fused_metric_d1_percent,individual_metric_d1_percent,fused_abs_rel,individual_abs_rel,fused_relative_d1_percent,individual_relative_d1_percent +% 1,84.181902,84.181902,0.242146,0.242146,97.807439,97.807439 +% 2,83.432304,82.105019,0.206860,0.214254,98.225685,97.855319 +% 3,86.508906,83.593073,0.165890,0.180834,98.342992,97.832790 +% 4,86.495916,83.067531,0.191570,0.208909,98.350201,97.797015 +% 5,86.068467,81.881833,0.179422,0.204381,98.385822,97.783363 +% 6,86.762738,82.519757,0.164763,0.189237,98.453834,97.829382 +% 7,85.131927,81.547125,0.171561,0.197767,98.431072,97.803906 +% 8,86.187286,81.931604,0.173546,0.203518,98.463448,97.812208 +% 9,86.537384,82.096980,0.184174,0.213423,98.487023,97.842091 +% 10,85.671573,81.396669,0.214927,0.243890,98.514508,97.854483 +% Seed 0 is the N=1 mean-individual score in those tables. +% No random-subset average, uncertainty interval, or measured runtime is implied. +% Native-size vector plots; all panels share seed count and line-style meanings. +\begingroup +\begin{tikzpicture}[font=\rmfamily\fontsize{8}{9.5}\selectfont] + \definecolor{aggregateBlue}{HTML}{286A8C} + \pgfplotsset{ + aggregation axis/.style={ + width=2.34cm, height=2.25cm, scale only axis, + xmin=0.7, xmax=10.3, xtick={1,4,7,10}, + minor tick num=0, tick align=inside, tick pos=left, + tick label style={font=\rmfamily\fontsize{8}{9}\selectfont, inner sep=1.4pt}, + label style={font=\rmfamily\fontsize{8}{9.5}\selectfont}, + ylabel style={at={(axis description cs:-0.24,0.5)}, anchor=south}, + title style={font=\rmfamily\bfseries\fontsize{9}{10.5}\selectfont, + at={(0,1)}, anchor=south west, inner sep=0pt, yshift=-2pt}, + axis lines=box, axis line style={black!75, line width=0.4pt}, + tick style={black!75, line width=0.4pt}, major tick length=2pt, + ymajorgrids=true, xmajorgrids=false, grid style={black!13, line width=0.25pt}, + every axis plot/.append style={line cap=round, line join=round}, + legend style={draw=none, fill=none, font=\rmfamily\fontsize{8}{10}\selectfont, + /tikz/every even column/.append style={column sep=5pt}}, + legend cell align=left, legend image post style={xscale=1.2}, + }, + agg/.style={aggregateBlue, line width=0.95pt, mark=*, mark size=1.55pt, + mark options={solid, fill=white, line width=0.7pt}}, + individual/.style={black!60, dashed, line width=0.7pt, mark=square*, mark size=1.25pt, + mark options={solid, fill=white, line width=0.6pt}}, + seedzero/.style={black!40, densely dotted, line width=0.85pt, mark=none}, + } + \begin{groupplot}[group style={group size=4 by 1, horizontal sep=1.20cm}, aggregation axis] + \nextgroupplot[title={(a) Metric depth}, ylabel={$\delta_1$ (\%)}, ymin=81, ymax=88, ytick={82,84,86,88}, legend to name=aggregationlegend, legend columns=3, legend entries={Fused score,Mean individual score,Seed 0}] + \addplot[agg] coordinates {(1,84.181902) (2,83.432304) (3,86.508906) (4,86.495916) (5,86.068467) (6,86.762738) (7,85.131927) (8,86.187286) (9,86.537384) (10,85.671573)}; + \addplot[individual] coordinates {(1,84.181902) (2,82.105019) (3,83.593073) (4,83.067531) (5,81.881833) (6,82.519757) (7,81.547125) (8,81.931604) (9,82.096980) (10,81.396669)}; + \addplot[seedzero] coordinates {(1,84.181902) (2,84.181902) (3,84.181902) (4,84.181902) (5,84.181902) (6,84.181902) (7,84.181902) (8,84.181902) (9,84.181902) (10,84.181902)}; + \nextgroupplot[title={(b) Relative depth}, ylabel={$\delta_1$ (\%)}, ymin=97.7, ymax=98.7, ytick={97.8,98.1,98.4,98.7}] + \addplot[agg] coordinates {(1,97.807439) (2,98.225685) (3,98.342992) (4,98.350201) (5,98.385822) (6,98.453834) (7,98.431072) (8,98.463448) (9,98.487023) (10,98.514508)}; + \addplot[individual] coordinates {(1,97.807439) (2,97.855319) (3,97.832790) (4,97.797015) (5,97.783363) (6,97.829382) (7,97.803906) (8,97.812208) (9,97.842091) (10,97.854483)}; + \addplot[seedzero] coordinates {(1,97.807439) (2,97.807439) (3,97.807439) (4,97.807439) (5,97.807439) (6,97.807439) (7,97.807439) (8,97.807439) (9,97.807439) (10,97.807439)}; + \nextgroupplot[title={(c) Semantic}, ylabel={mIoU (\%)}, ymin=66.3, ymax=71.3, ytick={67,68,69,70,71}] + \addplot[agg] coordinates {(1,67.6500) (2,68.5768) (3,69.5655) (4,69.8286) (5,70.3094) (6,70.2672) (7,70.6498) (8,70.7798) (9,70.9270) (10,70.7929)}; + \addplot[individual] coordinates {(1,67.6500) (2,67.4429) (3,66.8557) (4,67.0492) (5,66.9959) (6,66.9295) (7,67.0055) (8,66.9118) (9,66.9338) (10,67.0384)}; + \addplot[seedzero] coordinates {(1,67.6500) (2,67.6500) (3,67.6500) (4,67.6500) (5,67.6500) (6,67.6500) (7,67.6500) (8,67.6500) (9,67.6500) (10,67.6500)}; + \nextgroupplot[title={(d) Instance}, ylabel={cgF$_1$ (\%)}, ymin=44.2, ymax=52.4, ytick={45,47,49,51}] + \addplot[agg] coordinates {(1,45.1356) (2,45.5605) (3,50.6080) (4,49.0068) (5,51.3508) (6,50.0416) (7,51.6078) (8,50.5089) (9,51.8090) (10,50.9069)}; + \addplot[individual] coordinates {(1,45.1356) (2,44.8869) (3,44.9885) (4,45.0736) (5,45.0519) (6,45.0005) (7,44.9906) (8,44.9486) (9,44.9722) (10,44.9684)}; + \addplot[seedzero] coordinates {(1,45.1356) (2,45.1356) (3,45.1356) (4,45.1356) (5,45.1356) (6,45.1356) (7,45.1356) (8,45.1356) (9,45.1356) (10,45.1356)}; + \end{groupplot} + \node[anchor=north, inner sep=0pt, font=\rmfamily\fontsize{9}{10.5}\selectfont] + (samplelabel) at ($(current bounding box.south) + (0,-0.18cm)$) {Generations $N$}; + \node[anchor=north, inner sep=0pt] at ($(samplelabel.south) + (0,-0.13cm)$) + {\pgfplotslegendfromname{aggregationlegend}}; +\end{tikzpicture} +\endgroup diff --git a/figures/univision/b.txt b/figures/univision/b.txt new file mode 100644 index 0000000000000000000000000000000000000000..42bd3496353901bcf07a865cf19b89f9e0db82f7 --- /dev/null +++ b/figures/univision/b.txt @@ -0,0 +1,97 @@ +% Source: the complete tables in sec/appendix_experiments.tex. +% 50K EMA, fixed seed 0, 50 UniPC steps. No values are normalized or interpolated. +% Resolution sweep: CFG 4; guidance sweep: task-specific resolution and shift. +\begingroup +\begin{tikzpicture}[font=\rmfamily\fontsize{8}{9}\selectfont] + \definecolor{inferenceBlue}{HTML}{286A8C} + \definecolor{inferenceOrange}{HTML}{C77732} + \definecolor{inferenceGreen}{HTML}{397B67} + \definecolor{inferencePurple}{HTML}{805A98} + \pgfplotsset{ + inference axis/.style={ + scale only axis, width=2.4cm, height=1.2cm, + anchor=south west, axis lines=left, + axis line style={black!65, line width=0.35pt}, + tick align=outside, tick pos=left, major tick length=1.4pt, + tick style={black!65, line width=0.35pt}, minor tick num=0, + tick label style={font=\rmfamily\fontsize{7}{8}\selectfont, inner sep=1pt}, + scaled ticks=false, /pgf/number format/1000 sep={}, + title style={font=\rmfamily\fontsize{8}{9}\selectfont, + align=center, at={(0.5,1)}, anchor=south, inner sep=0pt, yshift=1.5pt}, + label style={font=\rmfamily\fontsize{7}{8}\selectfont}, + xlabel style={at={(axis description cs:0.5,-0.25)}, anchor=north, inner sep=0pt}, + ymajorgrids=true, grid style={black!13, line width=0.25pt}, + every axis plot/.append style={line cap=round, line join=round}, + clip=true, + }, + resolution axis/.style={inference axis, width=2.85cm}, + guidance axis/.style={inference axis, xmin=0.75, xmax=6.25, xtick={1,2,4,6}}, + shiftthree/.style={inferenceBlue, line width=0.75pt, mark=*, mark size=1.25pt, + mark options={solid, fill=white, line width=0.6pt}}, + shiftfour/.style={inferenceOrange, dashed, line width=0.75pt, mark=square*, mark size=1.2pt, + mark options={solid, fill=white, line width=0.6pt}}, + shiftfive/.style={inferenceGreen, densely dotted, line width=0.85pt, mark=triangle*, mark size=1.45pt, + mark options={solid, fill=white, line width=0.6pt}}, + shiftseven/.style={inferencePurple, dashdotted, line width=0.75pt, mark=diamond*, mark size=1.5pt, + mark options={solid, fill=white, line width=0.6pt}}, + guidance/.style={inferenceBlue, line width=0.85pt, mark=*, mark size=1.3pt, + mark options={solid, fill=white, line width=0.65pt}}, + } + \node[font=\rmfamily\bfseries\fontsize{8}{9}\selectfont, inner sep=0pt] + at (2.05cm,4.55cm) {(a) Resolution and shift}; + \node[font=\rmfamily\bfseries\fontsize{8}{9}\selectfont, inner sep=0pt] + at (9.3cm,4.55cm) {(b) Guidance scale}; + + \begin{axis}[resolution axis, at={(0.65cm,2.3cm)}, + title={Semantic: mIoU (\%) $\uparrow$}, + xmin=1505, xmax=2015, xtick={1536,1728,1984}, xlabel={Width (px)}, + ymin=65.5, ymax=67.9, ytick={66,67}, + legend to name=inferenceshiftlegend, legend columns=4, + legend style={draw=none, fill=none, font=\rmfamily\fontsize{7}{8}\selectfont, + inner sep=0pt, /tikz/every even column/.append style={column sep=2pt}}, + legend cell align=left, legend image post style={xscale=0.75}] + \addplot[shiftthree] coordinates {(1536,67.57) (1728,67.24) (1984,65.76)}; \addlegendentry{3} + \addplot[shiftfour] coordinates {(1536,67.54) (1728,67.37) (1984,66.05)}; \addlegendentry{4} + \addplot[shiftfive] coordinates {(1536,67.63) (1728,67.00) (1984,66.35)}; \addlegendentry{5} + \addplot[shiftseven] coordinates {(1536,67.65) (1728,67.20) (1984,66.01)}; \addlegendentry{7} + \end{axis} + \node[inner sep=0pt] at (2.05cm,4.20cm) {\pgfplotslegendfromname{inferenceshiftlegend}}; + \begin{axis}[resolution axis, at={(0.65cm,0cm)}, + title={Instance: cgF$_1$ (\%) $\uparrow$}, + xmin=0.94, xmax=2.06, xtick={1,1.5,2}, xticklabels={1.0,1.5,2.0}, xlabel={Cap (MP)}, + ymin=43.25, ymax=44.12, ytick={43.4,43.7,44.0}, + yticklabel style={/pgf/number format/fixed, /pgf/number format/precision=1}] + \addplot[shiftthree] coordinates {(1.0,43.58) (1.5,43.83) (2.0,44.01)}; + \addplot[shiftfour] coordinates {(1.0,43.52) (1.5,43.70) (2.0,43.93)}; + \addplot[shiftfive] coordinates {(1.0,43.49) (1.5,43.70) (2.0,43.93)}; + \addplot[shiftseven] coordinates {(1.0,43.38) (1.5,43.55) (2.0,43.69)}; + \end{axis} + + \begin{axis}[guidance axis, at={(4.9cm,2.3cm)}, title={Metric depth\\$\delta_1$ (\%) $\uparrow$}, + ymin=78.8, ymax=85.2, ytick={80,82,84}] + \addplot[guidance] coordinates {(1,79.43) (2,82.85) (4,84.54) (6,84.47)}; + \end{axis} + \begin{axis}[guidance axis, at={(8.1cm,2.3cm)}, title={Metric depth\\AbsRel $\downarrow$}, + ymin=0.12, ymax=0.40, y dir=reverse, ytick={0.15,0.25,0.35}] + \addplot[guidance] coordinates {(1,0.158) (2,0.141) (4,0.252) (6,0.381)}; + \end{axis} + \begin{axis}[guidance axis, at={(11.3cm,2.3cm)}, title={Relative depth\\$\delta_1$ (\%) $\uparrow$}, + ymin=97.88, ymax=98.16, ytick={97.9,98.0,98.1}] + \addplot[guidance] coordinates {(1,98.01) (2,98.13) (4,98.03) (6,97.91)}; + \end{axis} + \begin{axis}[guidance axis, at={(4.9cm,0cm)}, title={Normal\\Mean ($^\circ$) $\downarrow$}, + ymin=18.65, ymax=20.02, y dir=reverse, ytick={18.8,19.3,19.8}] + \addplot[guidance] coordinates {(1,18.79) (2,18.93) (4,19.46) (6,19.87)}; + \end{axis} + \begin{axis}[guidance axis, at={(8.1cm,0cm)}, title={Semantic\\mIoU (\%) $\uparrow$}, + ymin=64.9, ymax=67.95, ytick={65,66,67}] + \addplot[guidance] coordinates {(1,65.20) (2,67.18) (4,67.65) (6,66.95)}; + \end{axis} + \begin{axis}[guidance axis, at={(11.3cm,0cm)}, title={Instance\\cgF$_1$ (\%) $\uparrow$}, + ymin=41.5, ymax=45.55, ytick={42,43.5,45}] + \addplot[guidance] coordinates {(1,43.23) (2,45.14) (4,44.01) (6,41.89)}; + \end{axis} + \node[font=\rmfamily\fontsize{7}{8}\selectfont, inner sep=0pt] + at (9.3cm,-0.6cm) {CFG}; +\end{tikzpicture} +\endgroup diff --git a/figures/univision/c.txt b/figures/univision/c.txt new file mode 100644 index 0000000000000000000000000000000000000000..aed8a37cf1e3aa0390eda104cf8b34e692902dd1 --- /dev/null +++ b/figures/univision/c.txt @@ -0,0 +1,121 @@ +% Data source: Google Doc 1zk1LZ3CRKfaldQzKkZNxciQ80pZJ9KGqifAk05cM3-Y, +% tab t.rnpkhl7hx658, tables read on 2026-09-21, checked against +% cosmosvision/training/ladder_v2/eval/ladder_results.json (120 passed final/task gates). +% Local snapshots: .vscode/ladder_reference_tables_2026-09-21.json and +% .vscode/ladder_results_2026-09-21.json; derived coordinates in +% .vscode/ladder_plot_series_2026-09-21.json. Tokens = steps * 2.368M, rounded to 0.1B. +% Semantic = v2 Cityscapes single-attempt (@1) mIoU averaged over five seeds; +% instance = v2 SA-Co/Gold cgF1. No v1 semantic/instance values are plotted. +% Depth and normal are macro-averages from full-precision metrics, rounded below. +% Print design: Times serif at native size, fine boxed axes, open markers, +% aligned panel headings, and metric labels on the axes. No raster content. +% Layout: three columns by two rows; horizontal shared legend below all six panels. +% The figure fits the paper's 139.7 mm text width without resizebox/scalebox. +% Palette: restrained red / ochre / green / purple, from least to most data. +% Circle / square / triangle / diamond markers also identify curves in grayscale. +% Normal error is reversed, so up means better throughout. +% Deliberately absent: subtitles, takeaways, annotations, and production references. +% Every task has all 24 passed checkpoints; depth contributes two metrics from the same predictions. +% Relative depth: updated Google Doc table read 2026-09-22; full-precision source +% cosmosvision/training/ladder_v2/eval/plots/ladder_depth_relative.json. +% All 24 values agree with the document and passed raw depth reports. +% Relative depth is per-image least-squares scale and shift alignment in linear depth, +% with equal weighting of NYUv2, KITTI, ETH3D, DIODE indoor, and iBims. +% DIODE uses the frozen main-pack diagnostic variant, not the official-focal arm. +% Source SHA256: 41a748f27e5cdc794c2bfa00f4ec4d2e494639cf504112bc63fc499d225477ad +% Hyphens inside proper names (SA-Co) are allowed; no dashes elsewhere. +% All main text is 8 or 9 pt; ordinary TeX math supplies proper metric subscripts. +\begingroup +\begin{tikzpicture}[ + font=\rmfamily\fontsize{8}{9.5}\selectfont, + every node/.style={text=black} +] + \definecolor{rungA}{HTML}{B3473D} + \definecolor{rungB}{HTML}{BE842C} + \definecolor{rungC}{HTML}{39765A} + \definecolor{rungD}{HTML}{6A428A} + \pgfplotsset{ + scaling axis/.style={ + width=3.40cm, height=1.68cm, scale only axis, + xmode=log, log basis x=10, xmin=1, xmax=30, + xtick={1,3,10,30}, xticklabels={1,3,10,30}, + minor tick num=0, tick align=inside, tick pos=left, + tick label style={font=\rmfamily\fontsize{8}{9}\selectfont, inner sep=1.5pt}, + label style={font=\rmfamily\fontsize{8}{9.5}\selectfont}, + ylabel style={at={(axis description cs:-0.23,0.5)}, anchor=south}, + title style={font=\rmfamily\bfseries\fontsize{9}{10.5}\selectfont, + at={(0,1)}, anchor=south west, inner sep=0pt, xshift=0pt, yshift=-2pt}, + axis lines=box, axis line style={black!75, line width=0.4pt}, + axis on top=false, + tick style={black!75, line width=0.4pt}, major tick length=2pt, + ymajorgrids=true, xmajorgrids=false, + grid style={black!13, line width=0.25pt}, + every axis plot/.append style={line width=0.8pt, mark size=1.45pt, + line cap=round, line join=round, + mark options={solid, fill=white, line width=0.65pt}}, + legend style={draw=none, fill=none, font=\rmfamily\fontsize{9}{11}\selectfont, + row sep=4pt, /tikz/every even column/.append style={column sep=6pt}}, + legend cell align=left, + legend image post style={xscale=1.35}, + }, + r0/.style={rungA, mark=*}, + r1/.style={rungB, mark=square*}, + r10/.style={rungC, mark=triangle*}, + r100/.style={rungD, mark=diamond*}, + } + \begin{groupplot}[group style={group size=3 by 2, horizontal sep=1.20cm, vertical sep=0.90cm}, + scaling axis] + % Metric depth: mean d1 over NYUv2, KITTI, ETH3D, DIODE indoor, iBims-1 (focal protocol) + \nextgroupplot[title={(a) Metric depth}, ylabel={Mean $\delta_1$}, + ymin=0.31, ymax=0.75, ytick={0.4,0.5,0.6,0.7}, yticklabels={0.4,0.5,0.6,0.7}] + \addplot[r0] coordinates {(1.2,0.3690) (2.4,0.4649) (7.1,0.5735) (11.8,0.5679)}; + \addplot[r1] coordinates {(1.2,0.3255) (2.4,0.4712) (3.6,0.5442) (4.7,0.5685) (7.1,0.6039) (11.8,0.5961)}; + \addplot[r10] coordinates {(2.4,0.5104) (4.7,0.6203) (7.1,0.6517) (9.5,0.6726) (11.8,0.6763) (14.2,0.6947) (16.6,0.6896)}; + \addplot[r100] coordinates {(2.4,0.4832) (5.9,0.6351) (9.5,0.7102) (13.0,0.7200) (16.6,0.7273) (20.1,0.7276) (23.7,0.7356)}; + % Relative depth: mean scale-and-shift-aligned d1 on the same depth predictions + \nextgroupplot[title={(b) Relative depth}, ylabel={Mean aligned $\delta_1$}, + ymin=0.92, ymax=0.98, ytick={0.92,0.94,0.96,0.98}, yticklabels={0.92,0.94,0.96,0.98}] + \addplot[r0] coordinates {(1.2,0.9248) (2.4,0.9514) (7.1,0.9633) (11.8,0.9631)}; + \addplot[r1] coordinates {(1.2,0.9241) (2.4,0.9523) (3.6,0.9585) (4.7,0.9645) (7.1,0.9649) (11.8,0.9654)}; + \addplot[r10] coordinates {(2.4,0.9381) (4.7,0.9594) (7.1,0.9632) (9.5,0.9650) (11.8,0.9684) (14.2,0.9680) (16.6,0.9692)}; + \addplot[r100] coordinates {(2.4,0.9444) (5.9,0.9616) (9.5,0.9671) (13.0,0.9706) (16.6,0.9713) (20.1,0.9726) (23.7,0.9732)}; + % Surface normal: mean angular error averaged over NYUv2, ScanNet, VKITTI2 + \nextgroupplot[title={(c) Surface normal}, ylabel={Mean error ($^\circ$)}, + ymin=18.95, ymax=20.8, y dir=reverse, + ytick={19,19.5,20,20.5}, yticklabels={19,19.5,20,20.5}] + \addplot[r0] coordinates {(1.2,20.68) (2.4,20.45) (7.1,20.31) (11.8,20.25)}; + \addplot[r1] coordinates {(1.2,20.46) (2.4,19.88) (3.6,19.71) (4.7,19.63) (7.1,19.40) (11.8,19.33)}; + \addplot[r10] coordinates {(2.4,19.86) (4.7,19.42) (7.1,19.28) (9.5,19.20) (11.8,19.15) (14.2,19.16) (16.6,19.09)}; + \addplot[r100] coordinates {(2.4,19.89) (5.9,19.47) (9.5,19.26) (13.0,19.21) (16.6,19.12) (20.1,19.07) (23.7,19.03)}; + % Semantic: v2 Cityscapes single-attempt (@1) mIoU, mean over five seeds, no voting + \nextgroupplot[title={(d) Semantic}, ylabel={Cityscapes mIoU}, ymin=50, ymax=68, + ytick={50,55,60,65}, yticklabels={50,55,60,65}] + \addplot[r0] coordinates {(1.2,55.55) (2.4,57.90) (7.1,55.99) (11.8,51.31)}; + \addplot[r1] coordinates {(1.2,59.52) (2.4,62.47) (3.6,61.73) (4.7,62.88) (7.1,62.87) (11.8,61.70)}; + \addplot[r10] coordinates {(2.4,63.42) (4.7,65.21) (7.1,65.21) (9.5,65.59) (11.8,66.18) (14.2,65.74) (16.6,66.11)}; + \addplot[r100] coordinates {(2.4,64.19) (5.9,65.13) (9.5,65.58) (13.0,65.44) (16.6,66.22) (20.1,66.60) (23.7,66.71)}; + % Instance: v2 SA-Co/Gold cgF1, shown on the 0--1 scale + \nextgroupplot[title={(e) Instance}, ylabel={SA-Co cgF$_1$}, + ymin=0.27, ymax=0.42, ytick={0.3,0.35,0.4}, yticklabels={0.30,0.35,0.40}] + \addplot[r0] coordinates {(1.2,0.2957) (2.4,0.3267) (7.1,0.3374) (11.8,0.3253)}; + \addplot[r1] coordinates {(1.2,0.3082) (2.4,0.3518) (3.6,0.3620) (4.7,0.3662) (7.1,0.3727) (11.8,0.3788)}; + \addplot[r10] coordinates {(2.4,0.3437) (4.7,0.3676) (7.1,0.3931) (9.5,0.4026) (11.8,0.4052) (14.2,0.4019) (16.6,0.4042)}; + \addplot[r100] coordinates {(2.4,0.3479) (5.9,0.3712) (9.5,0.3944) (13.0,0.4018) (16.6,0.4126) (20.1,0.4046) (23.7,0.4046)}; + % Referring: RefCOCOg-UMD cIoU under the unchanged B-agent protocol + \nextgroupplot[title={(f) Referring}, ylabel={RefCOCOg cIoU}, ymin=69.3, ymax=75.6, + ytick={70,72,74}, yticklabels={70,72,74}, + legend to name=scalinglegend, legend columns=4, + legend entries={0.1\%, 1\%, 10\%, 100\%}] + \addplot[r0] coordinates {(1.2,69.66) (2.4,70.48) (7.1,71.32) (11.8,69.97)}; + \addplot[r1] coordinates {(1.2,71.60) (2.4,72.26) (3.6,72.03) (4.7,71.63) (7.1,71.84) (11.8,71.20)}; + \addplot[r10] coordinates {(2.4,73.13) (4.7,73.52) (7.1,74.26) (9.5,73.60) (11.8,73.54) (14.2,73.89) (16.6,73.69)}; + \addplot[r100] coordinates {(2.4,72.91) (5.9,73.81) (9.5,74.85) (13.0,75.00) (16.6,75.14) (20.1,74.56) (23.7,74.91)}; + \end{groupplot} + % Shared x-axis label and one horizontal legend below the six data panels. + \node[anchor=north, inner sep=0pt, font=\rmfamily\fontsize{9}{10.5}\selectfont] + (tokenlabel) at ($(current bounding box.south) + (0,-0.2cm)$) + {Training tokens (B)}; + \node[anchor=north, inner sep=0pt] at ($(tokenlabel.south) + (0,-0.14cm)$) + {\pgfplotslegendfromname{scalinglegend}}; +\end{tikzpicture} +\endgroup diff --git a/figures/univision/plot_success_rate.py b/figures/univision/plot_success_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..d400c705c5d62dd86bfa25874b9b68df56c6447a --- /dev/null +++ b/figures/univision/plot_success_rate.py @@ -0,0 +1,193 @@ +"""Fully-success rate vs. number of references, per model (data from ``a.csv``). + +Line chart in the house style of this ``figures/`` directory: open axes with +thick spines, a light grid, STIX serif type, saturated solid markers, and a +framed legend. One line per model (7 total). + +x-axis is binned: reference_count <=5 is merged into one point and >=15 into one +point (both by summing fully_successful_cases / evaluated_cases across the bin +and recomputing the rate); 6..14 stay individual. RefTree is our method, so its +two variants are drawn thicker/larger, on top, and listed last in the legend. + +Outputs ``success_rate.pdf`` (+ .png) next to this script. +""" +from __future__ import annotations + +import csv +from collections import defaultdict +from pathlib import Path + +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D +from matplotlib.ticker import FixedLocator + +ROOT = Path(__file__).resolve().parent + +# Times-like serif (STIX) — consistent with the rest of the figures. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, + "axes.facecolor": "white", + "axes.edgecolor": "0.6", + "axes.grid": True, + "grid.color": "0.85", + "grid.linestyle": "-", + "axes.spines.top": False, + "axes.spines.right": False, +}) + +# Per-model styling, keyed by model_order (0..6). Color + marker shape. +SERIES_STYLE = { + # 参考模型 (蓝色, 实线) + 0: {"color": "#245484", "marker": "o", "ls": "-"}, # GPT-Image-2 + 1: {"color": "#5496cc", "marker": "s", "ls": "-"}, # Nano Banana Pro + # 我们的方法 RefTree (绿色, 实线, 加粗) + 2: {"color": "#12784e", "marker": "^", "ls": "-"}, # Cosmos3 8B + RefTree (ours) + 3: {"color": "#42a278", "marker": "D", "ls": "-"}, # FLUX2-Klein 8B + RefTree (ours) + # 其余基线 (灰/棕浅色, 虚线, 弱化) + 4: {"color": "#B5895F", "marker": "v", "ls": (0, (5, 2.5))}, # HiDream-O1 (brown, dashed) + 5: {"color": "#9AA0A6", "marker": ">", "ls": (0, (1.6, 2.2))}, # FireRed-Image-Edit-1.1 (gray, dotted) + 6: {"color": "#CBB994", "marker": "X", "ls": (0, (6, 2, 1.5, 2))}, # FLUX2-Klein-9B (tan, dash-dot) +} + +# x-axis bins: <=5 merged, 6..14 individual, >=15 merged. +X_LABELS = [r"$\leq$5", "6", "7", "8", "9", "10", "11", "12", "13", "14", r"$\geq$15"] +X_POS = list(range(len(X_LABELS))) + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE +# --------------------------------------------------------------------------- +STYLE = { + "fig_size": (10.6, 6.2), + "xlabel": "Number of references", + "ylabel": "Fully-success rate (%)", + "xlim": (-0.4, 10.4), + "y_ticks": [0, 20, 40, 60, 80, 100], + "ylim": (-3, 103), + + "xlabel_fs": 22, + "ylabel_fs": 22, + "tick_fs": 18, + "legend_fs": 20, + + # 普通模型 + "lw": 2.6, + "marker_size": 6.8, + # 我们的方法 (RefTree): 加大加粗 + "lw_ours": 5.4, + "marker_size_ours": 12.5, + "mew": 1.0, + + "spine_lw": 2.6, + "tick_width": 1.4, + "tick_length": 5.5, + "grid_lw": 1.0, + "grid_alpha": 0.6, + + # 右侧图例: 高度撑到和折线图等高 (labelspacing 调竖直间距) + "legend_labelspacing": 1.32, + "legend_borderpad": 1.1, + "legend_frame_edge": "0.65", + "legend_frame_lw": 1.0, +} +# --------------------------------------------------------------------------- + + +def _is_ours(model: str) -> bool: + return "RefTree" in model + + +def load_binned_series() -> list[tuple[int, str, list[float]]]: + """[(order, model, ys)] with ys aligned to X_POS (<=5, 6..14, >=15).""" + by_model: dict[tuple[int, str], dict[int, tuple[float, float]]] = defaultdict(dict) + with open(ROOT / "a.csv", newline="") as fh: + for r in csv.DictReader(fh): + key = (int(r["model_order"]), r["model"]) + by_model[key][int(r["reference_count"])] = ( + float(r["fully_successful_cases"]), float(r["evaluated_cases"])) + + def rate(d: dict[int, tuple[float, float]], refs: range) -> float: + fully = sum(d[k][0] for k in refs if k in d) + evald = sum(d[k][1] for k in refs if k in d) + return fully / evald * 100.0 if evald else float("nan") + + out = [] + for (order, model) in sorted(by_model): + d = by_model[(order, model)] + ys = [rate(d, range(2, 6))] # <=5 + ys += [rate(d, range(k, k + 1)) for k in range(6, 15)] # 6..14 + ys += [rate(d, range(15, 21))] # >=15 + out.append((order, model, ys)) + return out + + +def main() -> None: + series = load_binned_series() + fig, ax = plt.subplots(figsize=STYLE["fig_size"]) + + # Draw non-ours first, then ours on top. + for order, model, ys in sorted(series, key=lambda s: (_is_ours(s[1]), s[0])): + st = SERIES_STYLE[order] + ours = _is_ours(model) + ax.plot(X_POS, ys, color=st["color"], linestyle=st["ls"], + linewidth=STYLE["lw_ours"] if ours else STYLE["lw"], + marker=st["marker"], + markersize=STYLE["marker_size_ours"] if ours else STYLE["marker_size"], + markerfacecolor=st["color"], markeredgecolor=st["color"], + markeredgewidth=STYLE["mew"], solid_capstyle="round", + solid_joinstyle="round", zorder=(20 + order) if ours else (3 + order)) + + ax.set_xlim(*STYLE["xlim"]) + ax.xaxis.set_major_locator(FixedLocator(X_POS)) + ax.set_xticklabels(X_LABELS) + ax.set_ylim(*STYLE["ylim"]) + ax.set_yticks(STYLE["y_ticks"]) + ax.grid(True, axis="both", color="0.85", linewidth=STYLE["grid_lw"], + alpha=STYLE["grid_alpha"], zorder=0) + ax.set_axisbelow(True) + for side in ("left", "bottom"): + ax.spines[side].set_linewidth(STYLE["spine_lw"]) + ax.spines[side].set_color("0.45") + ax.tick_params(axis="both", labelsize=STYLE["tick_fs"], + width=STYLE["tick_width"], length=STYLE["tick_length"], + color="0.45") + ax.set_xlabel(STYLE["xlabel"], fontsize=STYLE["xlabel_fs"], labelpad=4) + ax.set_ylabel(STYLE["ylabel"], fontsize=STYLE["ylabel_fs"], labelpad=5) + + # Legend: non-ours first, ours (RefTree) last (at the bottom). + legend_order = ([s for s in series if not _is_ours(s[1])] + + [s for s in series if _is_ours(s[1])]) + handles = [] + for order, model, _ in legend_order: + st = SERIES_STYLE[order] + ours = _is_ours(model) + handles.append(Line2D( + [0], [0], color=st["color"], linestyle=st["ls"], + linewidth=(STYLE["lw_ours"] if ours else STYLE["lw"]) + 0.3, + marker=st["marker"], + markersize=(STYLE["marker_size_ours"] if ours else STYLE["marker_size"]) + 1, + markerfacecolor=st["color"], markeredgecolor=st["color"], + label=model + (" (Ours)" if ours else ""))) + leg = ax.legend(handles=handles, loc="upper left", bbox_to_anchor=(1.02, 1.0), + frameon=True, fancybox=True, fontsize=STYLE["legend_fs"], + handlelength=2.0, borderpad=STYLE["legend_borderpad"], + labelspacing=STYLE["legend_labelspacing"]) + frame = leg.get_frame() + frame.set_edgecolor(STYLE["legend_frame_edge"]) + frame.set_linewidth(STYLE["legend_frame_lw"]) + frame.set_facecolor("white") + + fig.savefig(ROOT / "success_rate.pdf", bbox_inches="tight") + fig.savefig(ROOT / "success_rate.png", dpi=200, bbox_inches="tight") + plt.close(fig) + print("wrote success_rate.pdf and .png") + + +if __name__ == "__main__": + main() diff --git a/figures/univision/plot_univision.py b/figures/univision/plot_univision.py new file mode 100644 index 0000000000000000000000000000000000000000..912a01552bad410ff3578565398148b93e1b6558 --- /dev/null +++ b/figures/univision/plot_univision.py @@ -0,0 +1,257 @@ +"""Aggregation-vs-N figure for the UniVision multi-seed sweep. + +Re-plot of the raw numbers in ``a.txt`` in the house style of this ``figures/`` +directory (cf. ``prompt_ablation/relative_gain.pdf``): open axes with thick +spines, a light grid, STIX serif type, white-edged markers on saturated lines, +rounded in-panel title cards, and a single framed legend parked on the right. + +Four panels, one per task. Each panel shows how a metric evolves as the number +of generations ``N`` grows from 1 to 10, with three series: + + Fused score -- aggregate over the N generations (blue, solid) + Mean individual score -- per-generation mean (orange, dashed) + Seed 0 -- the single N=1 reference (gray, dotted) + +Data provenance (a.txt header): 50K EMA checkpoint, UniPC 50 steps; depth panels +are author-supplied Macro-four means (NYUv2/KITTI/ETH3D/iBims); Semantic/Instance +come from the source prefix tables; Seed 0 == the N=1 value of each table. + +Outputs ``univision_aggregation.pdf`` (+ .png) next to this script. +""" +from __future__ import annotations + +from pathlib import Path + +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.lines import Line2D +from matplotlib.ticker import FixedLocator + +ROOT = Path(__file__).resolve().parent + +# Times-like serif (STIX) — consistent with the rest of the figures. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, + "axes.facecolor": "white", + "axes.edgecolor": "0.6", + "axes.grid": True, + "grid.color": "0.85", + "grid.linestyle": "-", + "axes.spines.top": False, + "axes.spines.right": False, +}) + +# --------------------------------------------------------------------------- +# 原始数据 DATA: 逐点抄自 a.txt 的 pgfplots 坐标 (六位小数原样保留). +# N = 1..10; 每个 panel 三条线: fused / individual / seed0(常数, = N=1 的值). +# --------------------------------------------------------------------------- +N = np.arange(1, 11) + +PANELS = [ + { + "title": "(a) Metric depth", + "ylabel": r"$\delta_1$ (%)", + "ylim": (81.0, 88.0), + "yticks": [82, 84, 86, 88], + "fused": [84.181902, 83.432304, 86.508906, 86.495916, 86.068467, + 86.762738, 85.131927, 86.187286, 86.537384, 85.671573], + "individual": [84.181902, 82.105019, 83.593073, 83.067531, 81.881833, + 82.519757, 81.547125, 81.931604, 82.096980, 81.396669], + "seed0": 84.181902, + }, + { + "title": "(b) Relative depth", + "ylabel": r"$\delta_1$ (%)", + "ylim": (97.7, 98.7), + "yticks": [97.8, 98.1, 98.4, 98.7], + "fused": [97.807439, 98.225685, 98.342992, 98.350201, 98.385822, + 98.453834, 98.431072, 98.463448, 98.487023, 98.514508], + "individual": [97.807439, 97.855319, 97.832790, 97.797015, 97.783363, + 97.829382, 97.803906, 97.812208, 97.842091, 97.854483], + "seed0": 97.807439, + }, + { + "title": "(c) Semantic", + "ylabel": "mIoU (%)", + "ylim": (66.3, 71.3), + "yticks": [67, 68, 69, 70, 71], + "fused": [67.6500, 68.5768, 69.5655, 69.8286, 70.3094, + 70.2672, 70.6498, 70.7798, 70.9270, 70.7929], + "individual": [67.6500, 67.4429, 66.8557, 67.0492, 66.9959, + 66.9295, 67.0055, 66.9118, 66.9338, 67.0384], + "seed0": 67.6500, + }, + { + "title": "(d) Instance", + "ylabel": r"cgF$_1$ (%)", + "ylim": (44.2, 52.4), + "yticks": [45, 47, 49, 51], + "fused": [45.1356, 45.5605, 50.6080, 49.0068, 51.3508, + 50.0416, 51.6078, 50.5089, 51.8090, 50.9069], + "individual": [45.1356, 44.8869, 44.9885, 45.0736, 45.0519, + 45.0005, 44.9906, 44.9486, 44.9722, 44.9684], + "seed0": 45.1356, + }, +] + +# Three series, drawn back-to-front (seed0 first, fused on top). +SERIES = [ + {"key": "seed0", "label": "Seed 0", "color": "#9AA0A6", + "ls": (0, (3, 4)), "lw_key": "lw_seed0", "marker": None, "z": 2}, + {"key": "individual", "label": "Mean individual\nscore", "color": "#E8710A", + "ls": "-", "lw_key": "lw_ref", "marker": "s", "z": 3}, + {"key": "fused", "label": "Fused score", "color": "#3B78E7", + "ls": "-", "lw_key": "lw_main", "marker": "o", "z": 5}, +] + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE: 所有能调的字号 / 线粗 / 点大小 / 间距 / 位置都在这里. +# --------------------------------------------------------------------------- +STYLE = { + "fig_size": (16.6, 3.9), # 画布 (宽, 高) 英寸: 4 panel 一行 + 右侧 legend + "panel_area_width": 0.855, # 4 个 panel 占水平方向多少 (剩下给右侧 legend) + "legend_left_pad": 0.012, # legend 与 panel 区之间的额外空白 (figure 分数) + "wspace": 0.24, # panel 之间的水平间距 (调小; 配合缩小的刻度/标题字号避免与左侧 panel 重叠) + + # ---- 横坐标 (Generations N) ---- + "xlabel": r"Generations $N$", + "x_ticks": [2, 4, 6, 8, 10], + "xlim": (0.6, 10.4), + + # ---- 字号 ---- + "tick_fs": 14, + "xlabel_fs": 20, + "ylabel_fs": 16, + "title_fs": 15.5, # panel 内圆角标题卡 (缩小) + "legend_fs": 19, + + # ---- 折线 / 数据点 ---- + "lw_main": 4.0, # Fused (主线) + "lw_ref": 2.7, # Mean individual (虚线参考) + "lw_seed0": 1.9, # Seed 0 (虚线基准) + "marker_main": 10.5, # Fused 圆点直径 + "marker_ref": 8.5, # 方点直径 + "mew": 1.3, # marker 描边宽 (与填充同色) + + # ---- 坐标轴 / 网格 ---- + "spine_lw": 2.2, + "tick_width": 1.1, + "tick_length": 4.5, + "grid_lw": 0.9, + "grid_alpha": 0.6, + + # ---- panel 内圆角标题卡 (左上角, 往右挪了一点) ---- + "title_xy": (0.11, 0.955), + "title_pad": 0.38, + "title_edge": "0.70", + + # ---- 右侧 legend 框 (左右收窄) ---- + "legend_y": 0.5, + "legend_handlelen": 1.6, + "legend_handletextpad": 0.5, + "legend_labelspacing": 1.15, + "legend_frame_edge": "0.65", + "legend_frame_lw": 1.0, + "legend_border_pad": 0.7, +} +# --------------------------------------------------------------------------- + + +def _style_axes(ax, panel: dict) -> None: + ax.set_xlim(*STYLE["xlim"]) + ax.xaxis.set_major_locator(FixedLocator(STYLE["x_ticks"])) + ax.set_ylim(*panel["ylim"]) + ax.set_yticks(panel["yticks"]) + + ax.grid(True, axis="both", color="0.85", + linewidth=STYLE["grid_lw"], alpha=STYLE["grid_alpha"], zorder=0) + ax.set_axisbelow(True) + + for side in ("left", "bottom"): + ax.spines[side].set_linewidth(STYLE["spine_lw"]) + ax.spines[side].set_color("0.45") + ax.tick_params(axis="both", labelsize=STYLE["tick_fs"], + width=STYLE["tick_width"], length=STYLE["tick_length"], + color="0.45") + + ax.set_xlabel(STYLE["xlabel"], fontsize=STYLE["xlabel_fs"], labelpad=3) + ax.set_ylabel(panel["ylabel"], fontsize=STYLE["ylabel_fs"], labelpad=3) + + # Rounded title card in the (empty) upper-left corner. + ax.text(*STYLE["title_xy"], panel["title"], transform=ax.transAxes, + ha="left", va="top", fontsize=STYLE["title_fs"], + bbox=dict(boxstyle=f"round,pad={STYLE['title_pad']}", + facecolor="white", edgecolor=STYLE["title_edge"], + linewidth=1.0, alpha=0.96), + zorder=10) + + +def _plot_series(ax, panel: dict) -> None: + for s in SERIES: + y = (np.full_like(N, panel["seed0"], dtype=float) + if s["key"] == "seed0" else np.asarray(panel[s["key"]])) + ax.plot(N, y, color=s["color"], linestyle=s["ls"], + linewidth=STYLE[s["lw_key"]], + marker=s["marker"], + markersize=(STYLE["marker_main"] if s["key"] == "fused" + else STYLE["marker_ref"]), + markerfacecolor=s["color"], markeredgecolor=s["color"], + markeredgewidth=STYLE["mew"], + solid_capstyle="round", dash_capstyle="butt", + solid_joinstyle="round", zorder=s["z"]) + + +def _build_legend(fig) -> None: + handles = [ + Line2D([0], [0], color=s["color"], linestyle=s["ls"], + linewidth=STYLE[s["lw_key"]] + 0.6, + marker=s["marker"], + markersize=(STYLE["marker_main"] if s["key"] == "fused" + else STYLE["marker_ref"]) + 1, + markerfacecolor=s["color"], markeredgecolor=s["color"], + markeredgewidth=STYLE["mew"], label=s["label"]) + for s in reversed(SERIES) # fused first, seed0 last + ] + legend_x = STYLE["panel_area_width"] + STYLE["legend_left_pad"] + leg = fig.legend(handles=handles, loc="center left", + bbox_to_anchor=(legend_x, STYLE["legend_y"]), + frameon=True, fancybox=True, fontsize=STYLE["legend_fs"], + handlelength=STYLE["legend_handlelen"], + handletextpad=STYLE["legend_handletextpad"], + labelspacing=STYLE["legend_labelspacing"], + borderpad=STYLE["legend_border_pad"], + borderaxespad=0.0) + frame = leg.get_frame() + frame.set_edgecolor(STYLE["legend_frame_edge"]) + frame.set_linewidth(STYLE["legend_frame_lw"]) + frame.set_facecolor("white") + + +def main() -> None: + fig, axes = plt.subplots(1, 4, figsize=STYLE["fig_size"]) + for ax, panel in zip(axes, PANELS, strict=True): + _style_axes(ax, panel) + _plot_series(ax, panel) + + fig.tight_layout(rect=(0, 0, STYLE["panel_area_width"], 1.0)) + fig.subplots_adjust(wspace=STYLE["wspace"]) + _build_legend(fig) + + out_pdf = ROOT / "univision_aggregation.pdf" + out_png = ROOT / "univision_aggregation.png" + fig.savefig(out_pdf, bbox_inches="tight") + fig.savefig(out_png, dpi=200, bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_pdf}") + print(f"wrote {out_png}") + + +if __name__ == "__main__": + main() diff --git a/figures/univision/plot_univision_inference.py b/figures/univision/plot_univision_inference.py new file mode 100644 index 0000000000000000000000000000000000000000..d979a0eaf77a480b5ff558df88a94126e985cf05 --- /dev/null +++ b/figures/univision/plot_univision_inference.py @@ -0,0 +1,322 @@ +"""Inference-setting sweeps for UniVision (data from ``b.txt``). + +Re-plot in the house style of this ``figures/`` directory +(cf. ``prompt_ablation/relative_gain.pdf``): open axes with thick spines, a +light grid, STIX serif type, white-edged markers on saturated lines, and framed +legends. Two logical groups: + + (a) Resolution and shift -- two stacked panels (Semantic, Instance). Each holds + four series, one per shift value (3/4/5/7), swept over generation size. + (b) Guidance scale -- six panels, one metric each, swept over CFG. A + single fixed-seed series per panel; two panels use a reversed y-axis + because lower is better (AbsRel, Normal mean angular error). + +Data provenance (b.txt header): 50K EMA, fixed seed 0, 50 UniPC steps. Values +are verbatim from the appendix tables (no normalization / interpolation). + +Outputs ``univision_inference.pdf`` (+ .png) next to this script. +""" +from __future__ import annotations + +from pathlib import Path + +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.lines import Line2D +from matplotlib.ticker import FixedLocator + +ROOT = Path(__file__).resolve().parent + +# Times-like serif (STIX) — consistent with the rest of the figures. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, + "axes.facecolor": "white", + "axes.edgecolor": "0.6", + "axes.grid": True, + "grid.color": "0.85", + "grid.linestyle": "-", + "axes.spines.top": False, + "axes.spines.right": False, +}) + +# --------------------------------------------------------------------------- +# 原始数据 DATA: 逐点抄自 b.txt 的 pgfplots 坐标 (原样保留精度). +# --------------------------------------------------------------------------- +# (a) Resolution and shift: 每个 panel 四条 shift 线, x = 分辨率/尺寸档位. +RES_PANELS = [ + { + "title": r"Semantic: mIoU (%) $\uparrow$", + "card_xy": (0.045, 0.055), "card_ha": "left", "card_va": "bottom", + "xlabel": "Width (px)", + "xlim": (1505, 2015), "xticks": [1536, 1728, 1984], + "xticklabels": ["1536", "1728", "1984"], + "ylim": (65.4, 67.95), "yticks": [66, 67], + "x": [1536, 1728, 1984], + "series": { + 3: [67.57, 67.24, 65.76], + 4: [67.54, 67.37, 66.05], + 5: [67.63, 67.00, 66.35], + 7: [67.65, 67.20, 66.01], + }, + }, + { + "title": r"Instance: cgF$_1$ (%) $\uparrow$", + "card_xy": (0.045, 0.945), "card_ha": "left", "card_va": "top", + "xlabel": "Cap (MP)", + "xlim": (0.94, 2.06), "xticks": [1.0, 1.5, 2.0], + "xticklabels": ["1.0", "1.5", "2.0"], + "ylim": (43.24, 44.13), "yticks": [43.4, 43.7, 44.0], + "yticklabels": ["43.4", "43.7", "44.0"], + "x": [1.0, 1.5, 2.0], + "series": { + 3: [43.58, 43.83, 44.01], + 4: [43.52, 43.70, 43.93], + 5: [43.49, 43.70, 43.93], + 7: [43.38, 43.55, 43.69], + }, + }, +] + +# (b) Guidance scale: 单条线, x = CFG. reverse=True 的 panel "越低越好". +GUID_X = [1, 2, 4, 6] +GUID_PANELS = [ + {"title": r"Metric depth: $\delta_1$ (%) $\uparrow$", + "ylim": (78.8, 85.2), "yticks": [80, 82, 84], "reverse": False, + "y": [79.43, 82.85, 84.54, 84.47]}, + {"title": r"Metric depth: AbsRel $\downarrow$", + "ylim": (0.12, 0.40), "yticks": [0.15, 0.25, 0.35], + "yticklabels": ["0.15", "0.25", "0.35"], "reverse": True, + "y": [0.158, 0.141, 0.252, 0.381]}, + {"title": r"Relative depth: $\delta_1$ (%) $\uparrow$", + "ylim": (97.88, 98.16), "yticks": [97.9, 98.0, 98.1], + "yticklabels": ["97.9", "98.0", "98.1"], "reverse": False, + "y": [98.01, 98.13, 98.03, 97.91]}, + {"title": r"Normal: Mean ($^\circ$) $\downarrow$", + "ylim": (18.65, 20.02), "yticks": [18.8, 19.3, 19.8], + "yticklabels": ["18.8", "19.3", "19.8"], "reverse": True, + "y": [18.79, 18.93, 19.46, 19.87]}, + {"title": r"Semantic: mIoU (%) $\uparrow$", + "ylim": (64.9, 67.95), "yticks": [65, 66, 67], "reverse": False, + "y": [65.20, 67.18, 67.65, 66.95]}, + {"title": r"Instance: cgF$_1$ (%) $\uparrow$", + "ylim": (41.5, 45.55), "yticks": [42, 43.5, 45], + "yticklabels": ["42", "43.5", "45"], "reverse": False, + "y": [43.23, 45.14, 44.01, 41.89]}, +] + +# Shift series styling (color + linestyle + marker), brightened palette. +SHIFT_STYLE = { + 3: {"color": "#3B78E7", "ls": "-", "marker": "o", "mscale": 1.00}, + 4: {"color": "#E8710A", "ls": (0, (5, 2.2)), "marker": "s", "mscale": 0.92}, + 5: {"color": "#1F9E64", "ls": (0, (1, 1.3)), "marker": "^", "mscale": 1.18}, + 7: {"color": "#8E5FBF", "ls": (0, (6, 2, 1, 2)), "marker": "D", "mscale": 0.86}, +} +GUID_COLOR = "#3B78E7" + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE: 字号 / 线粗 / 点大小 / 布局位置 全在这里. +# 布局用 figure 分数 (0-1) 手工摆放, 方便对齐两个 group. +# --------------------------------------------------------------------------- +STYLE = { + "fig_size": (17.0, 5.6), + + # ---- 布局 (figure 分数): 压缩留白, 子图更宽、间距更小 ---- + "left_x": 0.052, "left_w": 0.212, # 左侧 resolution 两个 panel + "right_xs": [0.336, 0.566, 0.796], "right_w": 0.185, # 右侧 guidance 三列 (更宽, 更挤) + "row_y": [0.480, 0.110], "row_h": 0.250, # 上/下两行的底边 y 和高度 + + # 第一列 (resolution) 与右侧 guidance 之间的虚线竖直分隔 + "divider_x": 0.288, "divider_y": (0.105, 0.735), + "divider_dash": (0, (5, 9)), # (dash, gap): 间距拉大, 明显虚线 + "divider_lw": 1.5, "divider_color": "0.55", + + # 组标题 / shift legend / CFG 标签 的位置 (figure 分数); 标题贴近子图 + "grp_a_xy": (0.158, 0.820), + "grp_b_xy": (0.658, 0.820), + # shift 图例框: 左右宽度和下方 resolution 子图对齐 (mode=expand 撑满 left_w) + "shift_leg_y0": 0.71, "shift_leg_h": 0.050, + "cfg_xy": (0.658, 0.032), + + # ---- 字号 ---- + "grp_title_fs": 18, + "panel_title_fs": 14, # 单行标题, 略缩小以适应窄 panel + "tick_fs": 15, # 坐标轴刻度字号 (调大) + "xlabel_fs": 16.5, # Width/Cap 轴标题 (调大) + "cfg_fs": 17, # 共享 CFG 轴标题 (调大) + "legend_fs": 12, # shift 图例 3/4/5/7 (缩小) + "legend_marker": 6.2, # shift 图例数据点直径 + + # ---- 折线 / 点 ---- + "lw_shift": 2.4, # (a) 四条 shift 线 + "lw_guid": 3.2, # (b) 单条 guidance 线 + "marker_shift": 7.6, # (a) 数据点基准直径 (再乘 mscale) + "marker_guid": 9.2, # (b) 数据点直径 + "mew": 1.2, # marker 白色描边粗细 + + # ---- 坐标轴 / 网格 ---- + "spine_lw": 2.0, + "tick_width": 1.0, + "tick_length": 3.8, + "grid_lw": 0.85, + "grid_alpha": 0.6, + + # ---- panel 标题 pad ---- + "title_pad": 5.0, + + # ---- shift legend 框 ---- + "legend_handlelen": 3.0, + "legend_colspacing": 1.0, + "legend_frame_edge": "0.65", + "legend_frame_lw": 1.0, +} +# --------------------------------------------------------------------------- + + +def _marker_size(base: float, mscale: float) -> float: + return base * mscale + + +def _add_axes(fig, x, y, w, h): + ax = fig.add_axes((x, y, w, h)) + return ax + + +def _style_common(ax) -> None: + ax.grid(True, axis="both", color="0.85", + linewidth=STYLE["grid_lw"], alpha=STYLE["grid_alpha"], zorder=0) + ax.set_axisbelow(True) + for side in ("left", "bottom"): + ax.spines[side].set_linewidth(STYLE["spine_lw"]) + ax.spines[side].set_color("0.45") + ax.tick_params(axis="both", labelsize=STYLE["tick_fs"], + width=STYLE["tick_width"], length=STYLE["tick_length"], + color="0.45") + + +def _plot_res_panel(ax, panel: dict) -> None: + _style_common(ax) + ax.set_xlim(*panel["xlim"]) + ax.xaxis.set_major_locator(FixedLocator(panel["xticks"])) + ax.set_xticklabels(panel["xticklabels"]) + ax.set_ylim(*panel["ylim"]) + ax.set_yticks(panel["yticks"]) + if "yticklabels" in panel: + ax.set_yticklabels(panel["yticklabels"]) + + for shift in (7, 5, 4, 3): # draw shift=3 (hero blue) on top + st = SHIFT_STYLE[shift] + ax.plot(panel["x"], panel["series"][shift], color=st["color"], + linestyle=st["ls"], linewidth=STYLE["lw_shift"], + marker=st["marker"], + markersize=_marker_size(STYLE["marker_shift"], st["mscale"]), + markerfacecolor=st["color"], markeredgecolor=st["color"], + markeredgewidth=STYLE["mew"], solid_capstyle="round", + dash_capstyle="round", solid_joinstyle="round", + zorder=5 if shift == 3 else 4) + # Metric label as a rounded card inside the panel's empty corner. + ax.text(*panel["card_xy"], panel["title"], transform=ax.transAxes, + ha=panel["card_ha"], va=panel["card_va"], + fontsize=STYLE["panel_title_fs"], + bbox=dict(boxstyle="round,pad=0.34", facecolor="white", + edgecolor="0.70", linewidth=1.0, alpha=0.96), + zorder=10) + ax.set_xlabel(panel["xlabel"], fontsize=STYLE["xlabel_fs"], labelpad=2.5) + + +def _plot_guid_panel(ax, panel: dict, show_xticklabels: bool) -> None: + _style_common(ax) + ax.set_xlim(0.75, 6.25) + ax.xaxis.set_major_locator(FixedLocator(GUID_X)) + ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda v, _: f"{int(v)}")) + ax.set_ylim(*panel["ylim"]) + ax.set_yticks(panel["yticks"]) + if "yticklabels" in panel: + ax.set_yticklabels(panel["yticklabels"]) + if panel["reverse"]: + ax.invert_yaxis() + if not show_xticklabels: + ax.tick_params(axis="x", labelbottom=False) + + ax.plot(GUID_X, panel["y"], color=GUID_COLOR, linestyle="-", + linewidth=STYLE["lw_guid"], marker="o", + markersize=STYLE["marker_guid"], markerfacecolor=GUID_COLOR, + markeredgecolor=GUID_COLOR, markeredgewidth=STYLE["mew"], + solid_capstyle="round", solid_joinstyle="round", zorder=5) + ax.set_title(panel["title"], fontsize=STYLE["panel_title_fs"], + pad=STYLE["title_pad"], linespacing=1.15) + + +def _build_shift_legend(fig) -> None: + handles = [ + Line2D([0], [0], color=SHIFT_STYLE[s]["color"], linestyle=SHIFT_STYLE[s]["ls"], + linewidth=STYLE["lw_shift"] + 0.4, marker=SHIFT_STYLE[s]["marker"], + markersize=_marker_size(STYLE["legend_marker"], SHIFT_STYLE[s]["mscale"]), + markerfacecolor=SHIFT_STYLE[s]["color"], markeredgecolor=SHIFT_STYLE[s]["color"], + markeredgewidth=STYLE["mew"], label=str(s)) + for s in (3, 4, 5, 7) + ] + box = (STYLE["left_x"], STYLE["shift_leg_y0"], STYLE["left_w"], STYLE["shift_leg_h"]) + leg = fig.legend(handles=handles, loc="lower left", ncol=4, mode="expand", + bbox_to_anchor=box, bbox_transform=fig.transFigure, + frameon=True, fancybox=True, fontsize=STYLE["legend_fs"], + handlelength=STYLE["legend_handlelen"], + columnspacing=STYLE["legend_colspacing"], + borderpad=0.45, handletextpad=0.4) + frame = leg.get_frame() + frame.set_edgecolor(STYLE["legend_frame_edge"]) + frame.set_linewidth(STYLE["legend_frame_lw"]) + frame.set_facecolor("white") + + +def main() -> None: + fig = plt.figure(figsize=STYLE["fig_size"]) + + # (a) Resolution panels — left column, two rows. + for row, panel in enumerate(RES_PANELS): + ax = _add_axes(fig, STYLE["left_x"], STYLE["row_y"][row], + STYLE["left_w"], STYLE["row_h"]) + _plot_res_panel(ax, panel) + + # (b) Guidance panels — right block, 2 rows x 3 cols. + for idx, panel in enumerate(GUID_PANELS): + row, col = divmod(idx, 3) + ax = _add_axes(fig, STYLE["right_xs"][col], STYLE["row_y"][row], + STYLE["right_w"], STYLE["row_h"]) + _plot_guid_panel(ax, panel, show_xticklabels=(row == 1)) + + # Dashed vertical divider between the resolution column and the guidance block. + div = Line2D([STYLE["divider_x"], STYLE["divider_x"]], list(STYLE["divider_y"]), + transform=fig.transFigure, color=STYLE["divider_color"], + linestyle=STYLE["divider_dash"], linewidth=STYLE["divider_lw"], + dash_capstyle="butt", zorder=1) + fig.add_artist(div) + + # Group titles. + fig.text(*STYLE["grp_a_xy"], "(a) Resolution and shift", ha="center", + va="center", fontsize=STYLE["grp_title_fs"], fontweight="bold") + fig.text(*STYLE["grp_b_xy"], "(b) Guidance scale", ha="center", + va="center", fontsize=STYLE["grp_title_fs"], fontweight="bold") + # Shared CFG axis label under the guidance block. + fig.text(*STYLE["cfg_xy"], "CFG", ha="center", va="center", + fontsize=STYLE["cfg_fs"]) + + _build_shift_legend(fig) + + out_pdf = ROOT / "univision_inference.pdf" + out_png = ROOT / "univision_inference.png" + fig.savefig(out_pdf, bbox_inches="tight") + fig.savefig(out_png, dpi=200, bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_pdf}") + print(f"wrote {out_png}") + + +if __name__ == "__main__": + main() diff --git a/figures/univision/plot_univision_scaling.py b/figures/univision/plot_univision_scaling.py new file mode 100644 index 0000000000000000000000000000000000000000..4df2fbf9e2bd6bc9b597015d2885a0c65acfa80e --- /dev/null +++ b/figures/univision/plot_univision_scaling.py @@ -0,0 +1,274 @@ +"""Data-scaling sweeps for UniVision (data from ``c.txt``). + +Re-plot in the house style of this ``figures/`` directory: open axes with thick +spines, a light grid, STIX serif type, saturated solid markers, and a single +framed legend. Six panels (3x2), one metric each, every panel showing four +curves -- one per training-data fraction (0.1% / 1% / 10% / 100%) -- as a +function of training tokens on a log x-axis. + +Curves have different token ranges / lengths because each data budget reaches a +different number of passed checkpoints. Panel (c) Surface normal uses a reversed +y-axis (lower angular error is better, so "up = better" throughout). + +Data provenance (c.txt header): CosmosVision ladder_v2 eval, tokens = steps * +2.368M (rounded to 0.1B); Semantic = v2 Cityscapes @1 mIoU (5-seed mean); +Instance = v2 SA-Co/Gold cgF1; depth/normal are macro-averages. Values verbatim. + +Outputs ``univision_scaling.pdf`` (+ .png) next to this script. +""" +from __future__ import annotations + +from pathlib import Path + +import matplotlib.font_manager as fm +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.lines import Line2D +from matplotlib.ticker import FixedLocator, NullLocator + +ROOT = Path(__file__).resolve().parent + +# Times-like serif (STIX) — consistent with the rest of the figures. +_FONT = ROOT.parent / "_fonts" / "STIX-Two-Text-Regular.ttf" +fm.fontManager.addfont(str(_FONT)) +_FAMILY = fm.FontProperties(fname=str(_FONT)).get_name() +plt.rcParams.update({ + "font.family": _FAMILY, + "font.serif": [_FAMILY, "DejaVu Serif"], + "mathtext.fontset": "stix", + "axes.unicode_minus": False, + "axes.facecolor": "white", + "axes.edgecolor": "0.6", + "axes.grid": True, + "grid.color": "0.85", + "grid.linestyle": "-", + "axes.spines.top": False, + "axes.spines.right": False, +}) + +# --------------------------------------------------------------------------- +# 原始数据 DATA: 逐点抄自 c.txt 的 pgfplots 坐标 (原样保留精度). +# 每个 panel 四条曲线 (0.1% / 1% / 10% / 100%), 每条曲线 x 是训练 tokens (B), +# 各条长度/范围不同 (不同数据预算跑到的 checkpoint 数不同). +# --------------------------------------------------------------------------- +PANELS = [ + { + "title": "(a) Metric depth", "ylabel": r"Mean $\delta_1$", + "ylim": (0.31, 0.85), "yticks": [0.4, 0.5, 0.6, 0.7], "reverse": False, + "series": { + "0.1%": [(1.2, 0.3690), (2.4, 0.4649), (7.1, 0.5735), (11.8, 0.5679)], + "1%": [(1.2, 0.3255), (2.4, 0.4712), (3.6, 0.5442), (4.7, 0.5685), (7.1, 0.6039), (11.8, 0.5961)], + "10%": [(2.4, 0.5104), (4.7, 0.6203), (7.1, 0.6517), (9.5, 0.6726), (11.8, 0.6763), (14.2, 0.6947), (16.6, 0.6896)], + "100%": [(2.4, 0.4832), (5.9, 0.6351), (9.5, 0.7102), (13.0, 0.7200), (16.6, 0.7273), (20.1, 0.7276), (23.7, 0.7356)], + }, + }, + { + "title": "(b) Relative depth", "ylabel": r"Mean aligned $\delta_1$", + "ylim": (0.92, 0.987), "yticks": [0.92, 0.94, 0.96, 0.98], "reverse": False, + "series": { + "0.1%": [(1.2, 0.9248), (2.4, 0.9514), (7.1, 0.9633), (11.8, 0.9631)], + "1%": [(1.2, 0.9241), (2.4, 0.9523), (3.6, 0.9585), (4.7, 0.9645), (7.1, 0.9649), (11.8, 0.9654)], + "10%": [(2.4, 0.9381), (4.7, 0.9594), (7.1, 0.9632), (9.5, 0.9650), (11.8, 0.9684), (14.2, 0.9680), (16.6, 0.9692)], + "100%": [(2.4, 0.9444), (5.9, 0.9616), (9.5, 0.9671), (13.0, 0.9706), (16.6, 0.9713), (20.1, 0.9726), (23.7, 0.9732)], + }, + }, + { + "title": "(c) Surface normal", "ylabel": r"Mean error ($^\circ$)", + "ylim": (18.55, 20.8), "yticks": [19, 19.5, 20, 20.5], "reverse": True, + "series": { + "0.1%": [(1.2, 20.68), (2.4, 20.45), (7.1, 20.31), (11.8, 20.25)], + "1%": [(1.2, 20.46), (2.4, 19.88), (3.6, 19.71), (4.7, 19.63), (7.1, 19.40), (11.8, 19.33)], + "10%": [(2.4, 19.86), (4.7, 19.42), (7.1, 19.28), (9.5, 19.20), (11.8, 19.15), (14.2, 19.16), (16.6, 19.09)], + "100%": [(2.4, 19.89), (5.9, 19.47), (9.5, 19.26), (13.0, 19.21), (16.6, 19.12), (20.1, 19.07), (23.7, 19.03)], + }, + }, + { + "title": "(d) Semantic", "ylabel": "Cityscapes mIoU", + "ylim": (50, 71), "yticks": [50, 55, 60, 65], "reverse": False, + "series": { + "0.1%": [(1.2, 55.55), (2.4, 57.90), (7.1, 55.99), (11.8, 51.31)], + "1%": [(1.2, 59.52), (2.4, 62.47), (3.6, 61.73), (4.7, 62.88), (7.1, 62.87), (11.8, 61.70)], + "10%": [(2.4, 63.42), (4.7, 65.21), (7.1, 65.21), (9.5, 65.59), (11.8, 66.18), (14.2, 65.74), (16.6, 66.11)], + "100%": [(2.4, 64.19), (5.9, 65.13), (9.5, 65.58), (13.0, 65.44), (16.6, 66.22), (20.1, 66.60), (23.7, 66.71)], + }, + }, + { + "title": "(e) Instance", "ylabel": r"SA-Co cgF$_1$", + "ylim": (0.27, 0.45), "yticks": [0.30, 0.35, 0.40], "reverse": False, + "series": { + "0.1%": [(1.2, 0.2957), (2.4, 0.3267), (7.1, 0.3374), (11.8, 0.3253)], + "1%": [(1.2, 0.3082), (2.4, 0.3518), (3.6, 0.3620), (4.7, 0.3662), (7.1, 0.3727), (11.8, 0.3788)], + "10%": [(2.4, 0.3437), (4.7, 0.3676), (7.1, 0.3931), (9.5, 0.4026), (11.8, 0.4052), (14.2, 0.4019), (16.6, 0.4042)], + "100%": [(2.4, 0.3479), (5.9, 0.3712), (9.5, 0.3944), (13.0, 0.4018), (16.6, 0.4126), (20.1, 0.4046), (23.7, 0.4046)], + }, + }, + { + "title": "(f) Referring", "ylabel": "RefCOCOg cIoU", + "ylim": (69.3, 76.5), "yticks": [70, 72, 74], "reverse": False, + "series": { + "0.1%": [(1.2, 69.66), (2.4, 70.48), (7.1, 71.32), (11.8, 69.97)], + "1%": [(1.2, 71.60), (2.4, 72.26), (3.6, 72.03), (4.7, 71.63), (7.1, 71.84), (11.8, 71.20)], + "10%": [(2.4, 73.13), (4.7, 73.52), (7.1, 74.26), (9.5, 73.60), (11.8, 73.54), (14.2, 73.89), (16.6, 73.69)], + "100%": [(2.4, 72.91), (5.9, 73.81), (9.5, 74.85), (13.0, 75.00), (16.6, 75.14), (20.1, 74.56), (23.7, 74.91)], + }, + }, +] + +# Data-fraction series styling (color + marker), consistent with the other 4-way +# figure. Order = least to most data. +RUNGS = ["0.1%", "1%", "10%", "100%"] +RUNG_STYLE = { + "0.1%": {"color": "#3B78E7", "marker": "o", "mscale": 1.00}, + "1%": {"color": "#E8710A", "marker": "s", "mscale": 0.92}, + "10%": {"color": "#1F9E64", "marker": "^", "mscale": 1.18}, + "100%": {"color": "#8E5FBF", "marker": "D", "mscale": 0.86}, +} + +# --------------------------------------------------------------------------- +# 视觉调节区 STYLE: 字号 / 线粗 / 点大小 / 间距 / legend 位置 全在这里. +# --------------------------------------------------------------------------- +STYLE = { + "fig_size": (15.0, 6.0), + + # ---- 子图排布 (subplots_adjust); 标题移入子图后上方/行间收紧, 子图更矮 ---- + "left": 0.062, "right": 0.99, "top": 0.965, "bottom": 0.215, + "wspace": 0.27, "hspace": 0.24, + + # ---- x 轴 (log, Training tokens B) ---- + "xlim": (1, 30), + "x_ticks": [1, 3, 10, 30], + + # ---- 共享 x 标题 + 底部 legend 的位置 (figure 分数) ---- + "xlabel_xy": (0.526, 0.108), + "legend_xy": (0.526, 0.02), + + # ---- panel 内圆角标题卡 (左上角) ---- + "title_xy": (0.04, 0.955), + + # ---- 字号 ---- + "title_fs": 19, + "ylabel_fs": 20, + "tick_fs": 18, + "xlabel_fs": 21, + "legend_fs": 18, + + # ---- 折线 / 点 ---- + "lw": 3.0, + "marker_base": 8.8, # 数据点基准直径 (再乘 mscale) + "mew": 0.8, # marker 边宽 (与填充同色, 不留白边) + + # ---- 坐标轴 / 网格 ---- + "spine_lw": 2.4, + "tick_width": 1.2, + "tick_length": 4.5, + "grid_lw": 1.0, + "grid_alpha": 0.6, + + # ---- 底部 legend 框 ---- + "legend_handlelen": 2.4, + "legend_colspacing": 1.7, + "legend_frame_edge": "0.65", + "legend_frame_lw": 1.0, +} +# --------------------------------------------------------------------------- + + +def _marker_size(mscale: float) -> float: + return STYLE["marker_base"] * mscale + + +def _style_axes(ax, panel: dict, show_xticklabels: bool) -> None: + ax.set_xscale("log") + ax.set_xlim(*STYLE["xlim"]) + ax.xaxis.set_major_locator(FixedLocator(STYLE["x_ticks"])) + ax.xaxis.set_minor_locator(NullLocator()) + ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda v, _: f"{int(v)}")) + if not show_xticklabels: + ax.tick_params(axis="x", labelbottom=False) + + ax.set_ylim(*panel["ylim"]) + ax.set_yticks(panel["yticks"]) + if panel["reverse"]: + ax.invert_yaxis() + + ax.grid(True, axis="y", color="0.85", linewidth=STYLE["grid_lw"], + alpha=STYLE["grid_alpha"], zorder=0) + ax.grid(False, axis="x") + ax.set_axisbelow(True) + + for side in ("left", "bottom"): + ax.spines[side].set_linewidth(STYLE["spine_lw"]) + ax.spines[side].set_color("0.45") + ax.tick_params(axis="both", labelsize=STYLE["tick_fs"], + width=STYLE["tick_width"], length=STYLE["tick_length"], + color="0.45") + + # Panel label as a rounded card inside the (empty) top-left corner. + ax.text(STYLE["title_xy"][0], STYLE["title_xy"][1], panel["title"], + transform=ax.transAxes, ha="left", va="top", fontweight="bold", + fontsize=STYLE["title_fs"], + bbox=dict(boxstyle="round,pad=0.26", facecolor="white", + edgecolor="0.70", linewidth=1.0, alpha=0.96), zorder=10) + ax.set_ylabel(panel["ylabel"], fontsize=STYLE["ylabel_fs"], labelpad=6) + + +def _plot_panel(ax, panel: dict) -> None: + for i, rung in enumerate(RUNGS): + st = RUNG_STYLE[rung] + xs = [p[0] for p in panel["series"][rung]] + ys = [p[1] for p in panel["series"][rung]] + ax.plot(xs, ys, color=st["color"], linestyle="-", linewidth=STYLE["lw"], + marker=st["marker"], markersize=_marker_size(st["mscale"]), + markerfacecolor=st["color"], markeredgecolor=st["color"], + markeredgewidth=STYLE["mew"], solid_capstyle="round", + solid_joinstyle="round", zorder=3 + i) + + +def _build_legend(fig) -> None: + handles = [ + Line2D([0], [0], color=RUNG_STYLE[r]["color"], linestyle="-", + linewidth=STYLE["lw"] + 0.4, marker=RUNG_STYLE[r]["marker"], + markersize=_marker_size(RUNG_STYLE[r]["mscale"]) + 1, + markerfacecolor=RUNG_STYLE[r]["color"], + markeredgecolor=RUNG_STYLE[r]["color"], label=r) + for r in RUNGS + ] + leg = fig.legend(handles=handles, loc="center", ncol=4, + bbox_to_anchor=STYLE["legend_xy"], frameon=True, + fancybox=True, fontsize=STYLE["legend_fs"], + handlelength=STYLE["legend_handlelen"], + columnspacing=STYLE["legend_colspacing"], + borderpad=0.6, handletextpad=0.5) + frame = leg.get_frame() + frame.set_edgecolor(STYLE["legend_frame_edge"]) + frame.set_linewidth(STYLE["legend_frame_lw"]) + frame.set_facecolor("white") + + +def main() -> None: + fig, axes = plt.subplots(2, 3, figsize=STYLE["fig_size"]) + fig.subplots_adjust(left=STYLE["left"], right=STYLE["right"], + top=STYLE["top"], bottom=STYLE["bottom"], + wspace=STYLE["wspace"], hspace=STYLE["hspace"]) + + for idx, panel in enumerate(PANELS): + row, col = divmod(idx, 3) + ax = axes[row][col] + _style_axes(ax, panel, show_xticklabels=True) + _plot_panel(ax, panel) + + fig.text(*STYLE["xlabel_xy"], "Training tokens (B)", ha="center", + va="center", fontsize=STYLE["xlabel_fs"]) + _build_legend(fig) + + out_pdf = ROOT / "univision_scaling.pdf" + out_png = ROOT / "univision_scaling.png" + fig.savefig(out_pdf, bbox_inches="tight") + fig.savefig(out_png, dpi=200, bbox_inches="tight") + plt.close(fig) + print(f"wrote {out_pdf}") + print(f"wrote {out_png}") + + +if __name__ == "__main__": + main() diff --git a/figures/univision/reproduced_chart.pdf b/figures/univision/reproduced_chart.pdf new file mode 100644 index 0000000000000000000000000000000000000000..37385be4d23a416bfbe438c2dfe75429dd811a04 Binary files /dev/null and b/figures/univision/reproduced_chart.pdf differ diff --git a/figures/univision/reproduced_chart.png b/figures/univision/reproduced_chart.png new file mode 100644 index 0000000000000000000000000000000000000000..482d9c5d72a04376fedaa28845244b2fec797525 --- /dev/null +++ b/figures/univision/reproduced_chart.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11d91547ecb4944bf6631631c9650ed4bf2919ced7f9b391a110951b617b4c87 +size 60066 diff --git a/figures/univision/success_rate.pdf b/figures/univision/success_rate.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9f12e1237fe989ccff900a15d2a076feb7d09bc9 Binary files /dev/null and b/figures/univision/success_rate.pdf differ diff --git a/figures/univision/success_rate.png b/figures/univision/success_rate.png new file mode 100644 index 0000000000000000000000000000000000000000..ef37a042aa4c7f7c0fa0f14c5246718cbae3ac24 --- /dev/null +++ b/figures/univision/success_rate.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca89931efa7ff0ad7da3b675530fbf1c8815249ba661701bfd817eeab351ea3 +size 352482 diff --git a/figures/univision/univision_aggregation.pdf b/figures/univision/univision_aggregation.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1d24f34faed777f8d4f0ddd142d85300bad1a3b7 Binary files /dev/null and b/figures/univision/univision_aggregation.pdf differ diff --git a/figures/univision/univision_aggregation.png b/figures/univision/univision_aggregation.png new file mode 100644 index 0000000000000000000000000000000000000000..59781649657f2db233b56f0e1eb02fb2189ea477 --- /dev/null +++ b/figures/univision/univision_aggregation.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b97c2033cbe08040ae42144cc3a78bf7dc57aa13809d054bcf3b87480b4ef616 +size 221131 diff --git a/figures/univision/univision_inference.pdf b/figures/univision/univision_inference.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ff398c0b4c257136fe7b3b9ffa60a83ebe0f3210 Binary files /dev/null and b/figures/univision/univision_inference.pdf differ diff --git a/figures/univision/univision_inference.png b/figures/univision/univision_inference.png new file mode 100644 index 0000000000000000000000000000000000000000..298e8abcd9c9e945084a0434fc2d7ab3167742f8 --- /dev/null +++ b/figures/univision/univision_inference.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:899c58f3f0ee3286fe711c286e2b8916b795930e1ad15f561ca5e14063e9e8d6 +size 290466 diff --git a/figures/univision/univision_scaling.pdf b/figures/univision/univision_scaling.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d35db82d5ea3ace88164a612ed5f9a50fb259488 Binary files /dev/null and b/figures/univision/univision_scaling.pdf differ diff --git a/figures/univision/univision_scaling.png b/figures/univision/univision_scaling.png new file mode 100644 index 0000000000000000000000000000000000000000..3515ccca6a3ae73805b57b932b2c9f39cff39894 --- /dev/null +++ b/figures/univision/univision_scaling.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b124cbd8c65f443e2320e8221dc08d47dcdf86576f5e8b9b1df8414f29b36fd +size 354612