debrajsingha/dsp-repro-bundle / v0 /build_poster.py
debrajsingha's picture
download
raw
11.6 kB
import base64, pathlib
OUT = pathlib.Path("outputs")
def b64(p):
return "data:image/png;base64," + base64.b64encode((OUT / p).read_bytes()).decode()
fig_ridge = b64("fig_ridge.png")
fig_anchor = b64("fig_anchor.png")
fig_fid = b64("fig_fid.png")
fig_cam = b64("conceptual_steering_gradcam.png")
HTML = f"""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Reproduction poster — DSP (Envisioning Beyond the Few)</title>
<style>
@page {{ size: A2 landscape; margin: 0; }}
:root {{
--accent:#1F6F84; --accent-deep:#144E5E; --accent-light:#E6F2F5; --gold:#C9812A;
--text-primary:#182226; --text-muted:#6A7377; --bg-page:#F4F1EC; --bg-card:#FFFFFF;
--border-soft:#D6D9D8; --u:1.6px;
--font-sans:"Inter","Helvetica Neue",sans-serif; --font-serif:"Charter","Georgia",serif;
}}
* {{ box-sizing:border-box; margin:0; padding:0; }}
p,li,figcaption,.body-text,.caption,.section-title {{ text-wrap:pretty; }}
.title {{ text-wrap:balance; }}
html,body {{ background:#2b2b2b; font-family:var(--font-serif); color:var(--text-primary); }}
.poster {{
width:calc(594 * var(--u)); height:calc(420 * var(--u));
background:var(--bg-page); margin:20px auto;
padding:calc(7 * var(--u)) calc(9 * var(--u));
display:grid; grid-template-rows:auto 1fr auto auto; gap:calc(8 * var(--u));
box-shadow:0 0 40px rgba(0,0,0,0.4); position:relative; overflow:hidden;
}}
.poster::before {{ content:""; position:absolute; top:0; left:0; right:0;
height:calc(4 * var(--u)); background:linear-gradient(90deg,var(--accent-deep),var(--accent),var(--gold)); }}
.header {{ display:grid; grid-template-columns:1fr auto; align-items:center; gap:calc(8 * var(--u));
padding:calc(2 * var(--u)) calc(2 * var(--u)) calc(3 * var(--u)); border-bottom:calc(1 * var(--u)) solid var(--accent); }}
.title-block {{ min-width:0; }}
.title {{ font-family:var(--font-sans); font-weight:800; font-size:calc(15 * var(--u));
line-height:1.06; color:var(--accent-deep); letter-spacing:-0.4px; }}
.title .accent {{ color:var(--gold); }}
.subtitle {{ font-family:var(--font-sans); font-size:calc(7.5 * var(--u)); color:var(--text-muted); margin-top:calc(1.5 * var(--u)); }}
.authors {{ font-family:var(--font-sans); font-size:calc(6.8 * var(--u)); color:var(--accent); font-weight:600; margin-top:calc(1.5 * var(--u)); }}
.qr-block {{ display:flex; flex-direction:column; align-items:center; gap:calc(1 * var(--u)); }}
.qr-block img {{ width:calc(26 * var(--u)); height:calc(26 * var(--u)); border:calc(0.5 * var(--u)) solid var(--accent);
border-radius:calc(1.5 * var(--u)); background:white; padding:calc(0.5 * var(--u)); }}
.qr-label {{ font-family:var(--font-sans); font-size:calc(5.5 * var(--u)); color:var(--accent); font-weight:600; }}
.body-grid {{ display:grid; grid-template-columns:1fr; min-height:0; }}
.column {{ display:flex; flex-direction:column; min-height:0; }}
.card {{ background:var(--bg-card); border-radius:calc(2 * var(--u)); padding:calc(5 * var(--u)) calc(6 * var(--u));
border:calc(0.5 * var(--u)) solid var(--border-soft); box-shadow:0 calc(1 * var(--u)) calc(2 * var(--u)) rgba(0,0,0,0.04);
border-left:calc(3 * var(--u)) solid var(--accent); flex:1; display:flex; flex-direction:column; }}
.panels {{ display:grid; grid-template-columns:repeat(3,1fr); gap:calc(6 * var(--u)); flex:1; min-height:0; }}
.panel {{ display:flex; flex-direction:column; }}
.panel + .panel {{ border-left:calc(0.5 * var(--u)) solid var(--border-soft); padding-left:calc(6 * var(--u)); }}
.section-title {{ font-family:var(--font-sans); font-weight:700; font-size:calc(9 * var(--u)); color:var(--accent-deep); margin-bottom:calc(1.5 * var(--u)); }}
.section-title.sub {{ font-size:calc(8 * var(--u)); margin-top:calc(3 * var(--u)); }}
.body-text {{ font-family:var(--font-serif); font-size:calc(6.1 * var(--u)); line-height:1.32; color:var(--text-primary); }}
.body-text + .body-text {{ margin-top:calc(1.5 * var(--u)); }}
.keyword {{ color:var(--accent); font-weight:700; }}
.em {{ color:var(--gold); font-weight:700; }}
.card ul {{ padding-left:calc(9 * var(--u)); margin-top:calc(1 * var(--u)); }}
.card li {{ font-family:var(--font-serif); font-size:calc(6.0 * var(--u)); line-height:1.3; margin-top:calc(0.8 * var(--u)); }}
.figure {{ margin-top:calc(1.6 * var(--u)); display:flex; flex-direction:column; align-items:center; }}
.figure img {{ width:100%; display:block; border-radius:calc(1 * var(--u)); }}
.figure .caption {{ font-family:var(--font-sans); font-size:calc(5.2 * var(--u)); color:var(--text-muted); margin-top:calc(1 * var(--u)); text-align:center; line-height:1.2; }}
.callout {{ font-family:var(--font-sans); font-size:calc(6.2 * var(--u)); background:var(--accent-light); border-radius:calc(1.5 * var(--u));
padding:calc(1.6 * var(--u)) calc(3 * var(--u)); margin-top:calc(1.8 * var(--u)); color:var(--accent-deep); }}
.callout b {{ color:var(--gold); }}
.footer-strip {{ display:grid; grid-template-columns:repeat(4,1fr); gap:calc(4 * var(--u)); background:var(--accent-deep);
color:white; border-radius:calc(2 * var(--u)); padding:calc(3 * var(--u)) calc(5 * var(--u)); }}
.hs-stat {{ display:flex; flex-direction:column; align-items:center; gap:calc(0.5 * var(--u)); }}
.hs-stat .num {{ font-family:var(--font-sans); font-weight:800; font-size:calc(11 * var(--u)); color:var(--gold); white-space:nowrap; }}
.hs-stat .lbl {{ font-family:var(--font-sans); font-size:calc(5.4 * var(--u)); color:var(--accent-light); text-align:center; }}
.footer {{ display:grid; grid-template-columns:1fr auto; align-items:center; gap:calc(8 * var(--u));
font-family:var(--font-sans); font-size:calc(5.6 * var(--u)); color:var(--text-muted); padding:calc(1 * var(--u)) calc(2 * var(--u)); }}
.footer .right {{ color:var(--accent); font-weight:600; }}
@media print {{
:root {{ --u:1mm; }}
html,body {{ background:white; margin:0; padding:0; width:100%; height:100%; overflow:hidden; }}
.poster {{ margin:0; box-shadow:none; page-break-after:avoid; }}
}}
</style>
</head>
<body>
<div class="poster" data-measure-role="poster">
<header class="header" data-measure-role="header">
<div class="title-block">
<h1 class="title">Reproduction — Envisioning Beyond the Few: <span class="accent">Disentangled Semantics &amp; Primitives</span> for Few-Shot Atypical Layout-to-Image Generation</h1>
<div class="subtitle">Bao, Zhao, Wang, Li &middot; ICML 2026 &middot; OpenReview Jva4wVEySO &middot; arXiv 2605.31266 &middot; code: github.com/iCVTEAM/DSP</div>
<div class="authors">Independent reproduction &middot; verified on the official code + real DINOv2 / CLIP backbones &middot; 1&times; T4 GPU Job, &approx;$0.05</div>
</div>
<div class="qr-block">
<img src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect width='100' height='100' fill='%23fff'/><g fill='%23222'><rect x='4' y='4' width='26' height='26'/><rect x='70' y='4' width='26' height='26'/><rect x='4' y='70' width='26' height='26'/><rect x='38' y='40' width='6' height='6'/><rect x='52' y='46' width='6' height='6'/><rect x='60' y='58' width='6' height='6'/><rect x='44' y='64' width='6' height='6'/></g><g fill='%23fff'><rect x='10' y='10' width='14' height='14'/><rect x='76' y='10' width='14' height='14'/><rect x='10' y='76' width='14' height='14'/></g></svg>" alt="QR to paper">
<div class="qr-label">arXiv 2605.31266</div>
</div>
</header>
<div class="body-grid" data-measure-role="body">
<div class="column" data-measure-role="column">
<div class="card" data-measure-role="card">
<div class="panels">
<div class="panel">
<div class="section-title">The paper &amp; what we tested</div>
<p class="body-text">Existing layout-to-image models fragment under <span class="keyword">few-shot atypical</span> domains (aerial, underwater, low-light). DSP disentangles a category into <span class="keyword">stable semantics</span> and <span class="keyword">recomposable primitives</span> via three modules.</p>
<div class="section-title sub">Claim 1 &mdash; three-module mechanism</div>
<ul>
<li><b>Semantic Anchoring</b>: DINOv2 ViT-L/14 features aggregated across the 5 exemplars into a per-category anchor.</li>
<li><b>Primitive Imbuing</b>: visual prototypes fit by <b>closed-form ridge</b> T&asymp;WP, refined by gradient (Alg. 1).</li>
<li><b>Conceptual Steering</b>: text-driven <b>GradCAM</b> (CLIP) re-weights the denoising loss by GT-vs-gen saliency gap.</li>
</ul>
<div class="callout"><b>Verdict:</b> Claim&nbsp;1 reproduced &mdash; all three modules present in the released code and behaving as described on the real backbones.</div>
</div>
<div class="panel">
<div class="section-title">Primitive Imbuing: ridge is exact</div>
<p class="body-text">Paper Eq. 7 &nbsp;<span class="keyword">&Wcirc; = T P&#7488;(P P&#7488; + &lambda;I)&#8315;&#185;</span>&nbsp; is the exact minimiser of the Tikhonov objective Eq. 6. Reproduced from the repo's verbatim formula:</p>
<div class="figure">
<img src="{fig_ridge}" alt="ridge exactness and MSE reduction">
<div class="caption">Closed-form matches the normal-equation solution to <b>2.7e-15</b> (fp64); Alg. 1 lowers reconstruction MSE on synthetic and <b>real DINOv2</b> tokens.</div>
</div>
<div class="callout">Closed-form vs autograd optimum: <b>3.6e-8</b> &middot; gradient at optimum <b>9.4e-15</b> &middot; real-feature recon MSE <b>&minus;62.7%</b> vs K-Means.</div>
</div>
<div class="panel">
<div class="section-title">Anchoring &amp; Steering on real backbones</div>
<div class="figure">
<img src="{fig_anchor}" alt="semantic anchoring separation">
<div class="caption">Per-category DINOv2 anchors: within-cat cos <b>0.997</b> vs cross-cat <b>0.895</b> (separation <b>0.102</b>).</div>
</div>
<div class="figure">
<img src="{fig_cam}" alt="text-driven GradCAM">
<div class="caption">Conceptual Steering: text-driven GradCAM on CLIP ViT-B/16 &mdash; foreground frac <b>0.72</b>.</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer-strip" data-measure-role="footer-strip">
<div class="hs-stat"><div class="num">2.7e-15</div><div class="lbl">ridge closed-form error (fp64) &mdash; exact</div></div>
<div class="hs-stat"><div class="num">&minus;62.7%</div><div class="lbl">recon MSE vs K-Means (real DINOv2)</div></div>
<div class="hs-stat"><div class="num">0.102</div><div class="lbl">anchor within&minus;cross separation</div></div>
<div class="hs-stat"><div class="num">FID &minus;8.17</div><div class="lbl">Claim 2 target on DIOR (paper; not re-measured)</div></div>
</div>
<footer class="footer" data-measure-role="footer">
<div>Claim 2 (Table-1 SOTA) documented, not re-measured: full SD-1.5 training on DIOR/RUOD/ExDark + Faster-RCNN eval is multi-GPU / multi-day with no released DSP checkpoints.</div>
<div class="right">huggingface.co/datasets/debrajsingha/dsp-repro-artifacts</div>
</footer>
</div>
</body>
</html>"""
pathlib.Path("poster.html").write_text(HTML, encoding="utf-8")
print("wrote poster.html", len(HTML), "bytes")

Xet Storage Details

Size:
11.6 kB
·
Xet hash:
3983bfb0ec2502d262d46443660807f3eebf3c850e78a3d3c0d53d76e4489573

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.