|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | +<title>CVPR 2026 Explorer — SPECTER2 Semantic Map</title> |
| 7 | +<meta name="description" content="A 2D semantic map of all CVPR 2026 papers, built from SPECTER2 embeddings."> |
| 8 | +<script src="https://cdn.plot.ly/plotly-gl2d-2.35.2.min.js" charset="utf-8"></script> |
| 9 | +<style> |
| 10 | + :root { color-scheme: dark; } |
| 11 | + * { box-sizing: border-box; } |
| 12 | + body { |
| 13 | + margin: 0; background: #111; color: #eee; |
| 14 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; |
| 15 | + } |
| 16 | + header { |
| 17 | + display: flex; flex-wrap: wrap; gap: 12px; align-items: center; |
| 18 | + padding: 12px 16px; border-bottom: 1px solid #2a2a2a; |
| 19 | + } |
| 20 | + h1 { font-size: 18px; margin: 0; font-weight: 600; } |
| 21 | + h1 small { color: #888; font-weight: 400; } |
| 22 | + #search { |
| 23 | + flex: 1 1 220px; max-width: 380px; padding: 7px 10px; |
| 24 | + background: #1c1c1c; color: #eee; border: 1px solid #3a3a3a; border-radius: 6px; |
| 25 | + font-size: 14px; |
| 26 | + } |
| 27 | + #search:focus { outline: none; border-color: #6ea8fe; } |
| 28 | + #hits { color: #888; font-size: 13px; min-width: 90px; } |
| 29 | + header a { color: #9ab; font-size: 13px; text-decoration: none; } |
| 30 | + header a:hover { text-decoration: underline; } |
| 31 | + main { display: flex; flex-wrap: wrap; } |
| 32 | + #plot { flex: 1 1 620px; height: calc(100vh - 130px); min-height: 420px; } |
| 33 | + #panel { |
| 34 | + flex: 0 1 380px; max-height: calc(100vh - 130px); overflow-y: auto; |
| 35 | + padding: 16px; border-left: 1px solid #2a2a2a; font-size: 14px; line-height: 1.5; |
| 36 | + } |
| 37 | + #panel h2 { font-size: 16px; margin: 0 0 8px; } |
| 38 | + #panel .authors { color: #9a9a9a; font-size: 13px; margin-bottom: 12px; } |
| 39 | + #panel .abstract { color: #ccc; } |
| 40 | + #panel a.pdf { |
| 41 | + display: inline-block; margin-bottom: 12px; padding: 6px 12px; |
| 42 | + background: #2b6cb0; color: #fff; border-radius: 6px; text-decoration: none; font-size: 13px; |
| 43 | + } |
| 44 | + #panel .hint { color: #777; } |
| 45 | + footer { padding: 10px 16px; color: #777; font-size: 12px; border-top: 1px solid #2a2a2a; } |
| 46 | + footer a { color: #9ab; } |
| 47 | + @media (max-width: 800px) { |
| 48 | + #plot { height: 60vh; } |
| 49 | + #panel { border-left: none; border-top: 1px solid #2a2a2a; max-height: none; } |
| 50 | + } |
| 51 | +</style> |
| 52 | +</head> |
| 53 | +<body> |
| 54 | +<header> |
| 55 | + <h1>CVPR 2026 Explorer <small>— SPECTER2 semantic map</small></h1> |
| 56 | + <input id="search" type="search" placeholder="Search titles & abstracts…" autocomplete="off" disabled> |
| 57 | + <span id="hits"></span> |
| 58 | + <a href="https://github.com/flecomet/cvpr-explorer" target="_blank" rel="noopener">GitHub</a> |
| 59 | +</header> |
| 60 | +<main> |
| 61 | + <div id="plot"></div> |
| 62 | + <aside id="panel"><p class="hint">Loading 4000+ papers…</p></aside> |
| 63 | +</main> |
| 64 | +<footer> |
| 65 | + Fork of <a href="https://github.com/dataplayer12/cvpr-explorer" target="_blank" rel="noopener">dataplayer12/cvpr-explorer</a>. |
| 66 | + Nearby points are semantically similar papers. Click a point for details. |
| 67 | +</footer> |
| 68 | + |
| 69 | +<script> |
| 70 | +const panel = document.getElementById("panel"); |
| 71 | +const search = document.getElementById("search"); |
| 72 | +const hits = document.getElementById("hits"); |
| 73 | +let D = null, traces = null, haystack = null; |
| 74 | + |
| 75 | +// Golden-angle hue rotation: distinct colors for an arbitrary cluster count. |
| 76 | +function clusterColor(i) { |
| 77 | + return "hsl(" + ((i * 137.508) % 360).toFixed(1) + ",65%,60%)"; |
| 78 | +} |
| 79 | + |
| 80 | +function buildTraces(data) { |
| 81 | + const byCluster = new Map(); |
| 82 | + data.c.forEach((cid, i) => { |
| 83 | + if (!byCluster.has(cid)) byCluster.set(cid, []); |
| 84 | + byCluster.get(cid).push(i); |
| 85 | + }); |
| 86 | + // -1 ("unclustered") first so it renders underneath everything else. |
| 87 | + const ids = [...byCluster.keys()].sort((a, b) => (a === -1 ? -1 : b === -1 ? 1 : a - b)); |
| 88 | + return ids.map((cid, n) => ({ |
| 89 | + type: "scattergl", |
| 90 | + mode: "markers", |
| 91 | + // Labels are "term · term · term"; the first two keep the legend narrow. |
| 92 | + name: data.clusters[String(cid)].split(" · ").slice(0, 2).join(" · "), |
| 93 | + x: byCluster.get(cid).map(i => data.x[i]), |
| 94 | + y: byCluster.get(cid).map(i => data.y[i]), |
| 95 | + text: byCluster.get(cid).map(i => data.title[i]), |
| 96 | + customdata: byCluster.get(cid), |
| 97 | + marker: { size: 6, color: cid === -1 ? "#666" : clusterColor(n) }, |
| 98 | + hovertemplate: "<b>%{text}</b><extra></extra>", |
| 99 | + })); |
| 100 | +} |
| 101 | + |
| 102 | +const LAYOUT = { |
| 103 | + margin: { l: 40, r: 20, b: 40, t: 20 }, |
| 104 | + paper_bgcolor: "#111", plot_bgcolor: "#111", |
| 105 | + font: { color: "#eee" }, |
| 106 | + xaxis: { showgrid: false, zeroline: false, showticklabels: false }, |
| 107 | + // scaleanchor keeps the map's true aspect ratio: distance means the same on both axes. |
| 108 | + yaxis: { showgrid: false, zeroline: false, showticklabels: false, scaleanchor: "x" }, |
| 109 | + legend: { font: { size: 10 }, itemsizing: "constant", itemwidth: 30 }, |
| 110 | + dragmode: "pan", |
| 111 | + hovermode: "closest", |
| 112 | +}; |
| 113 | + |
| 114 | +function showPaper(i) { |
| 115 | + panel.innerHTML = ""; |
| 116 | + const h2 = document.createElement("h2"); |
| 117 | + h2.textContent = D.title[i]; |
| 118 | + const au = document.createElement("p"); |
| 119 | + au.className = "authors"; |
| 120 | + au.textContent = D.authors[i]; |
| 121 | + const a = document.createElement("a"); |
| 122 | + a.className = "pdf"; |
| 123 | + a.href = D.pdf[i]; |
| 124 | + a.target = "_blank"; |
| 125 | + a.rel = "noopener"; |
| 126 | + a.textContent = "Open PDF"; |
| 127 | + const ab = document.createElement("p"); |
| 128 | + ab.className = "abstract"; |
| 129 | + ab.textContent = D.abstract[i]; |
| 130 | + panel.append(h2, au, a, ab); |
| 131 | + panel.scrollTop = 0; |
| 132 | +} |
| 133 | + |
| 134 | +// Search dims non-matching points instead of hiding them, so the map keeps its shape. |
| 135 | +function applySearch(q) { |
| 136 | + q = q.trim().toLowerCase(); |
| 137 | + if (!q) { |
| 138 | + Plotly.restyle("plot", { "marker.opacity": 1, selectedpoints: [null] }); |
| 139 | + hits.textContent = ""; |
| 140 | + return; |
| 141 | + } |
| 142 | + let n = 0; |
| 143 | + const selected = traces.map(t => { |
| 144 | + const sel = []; |
| 145 | + t.customdata.forEach((i, k) => { if (haystack[i].includes(q)) { sel.push(k); n++; } }); |
| 146 | + return sel; |
| 147 | + }); |
| 148 | + Plotly.restyle("plot", { selectedpoints: selected, "marker.opacity": 1 }); |
| 149 | + Plotly.restyle("plot", { |
| 150 | + "selected.marker.opacity": 1, |
| 151 | + "unselected.marker.opacity": 0.06, |
| 152 | + }); |
| 153 | + hits.textContent = n + " match" + (n === 1 ? "" : "es"); |
| 154 | +} |
| 155 | + |
| 156 | +fetch("data.json").then(r => r.json()).then(data => { |
| 157 | + D = data; |
| 158 | + traces = buildTraces(data); |
| 159 | + haystack = data.title.map((t, i) => (t + " " + data.abstract[i]).toLowerCase()); |
| 160 | + Plotly.newPlot("plot", traces, LAYOUT, { |
| 161 | + responsive: true, displaylogo: false, scrollZoom: true, |
| 162 | + modeBarButtonsToRemove: ["select2d", "lasso2d", "toggleSpikelines"], |
| 163 | + }); |
| 164 | + document.getElementById("plot").on("plotly_click", e => showPaper(e.points[0].customdata)); |
| 165 | + panel.innerHTML = '<p class="hint">A 2D semantic map of all ' + data.x.length + |
| 166 | + " CVPR 2026 papers, built from SPECTER2 embeddings.<br><br>" + |
| 167 | + "Click any point to read its title, authors and abstract, and to open the PDF. " + |
| 168 | + "Scroll to zoom, drag to pan.</p>"; |
| 169 | + search.disabled = false; |
| 170 | + let timer; |
| 171 | + search.addEventListener("input", () => { |
| 172 | + clearTimeout(timer); |
| 173 | + timer = setTimeout(() => { |
| 174 | + applySearch(search.value); |
| 175 | + // Keep the URL shareable without adding history entries per keystroke. |
| 176 | + const url = new URL(location); |
| 177 | + if (search.value.trim()) url.searchParams.set("q", search.value); |
| 178 | + else url.searchParams.delete("q"); |
| 179 | + history.replaceState(null, "", url); |
| 180 | + }, 150); |
| 181 | + }); |
| 182 | + |
| 183 | + const q = new URLSearchParams(location.search).get("q"); |
| 184 | + if (q) { search.value = q; applySearch(q); } |
| 185 | +}).catch(err => { |
| 186 | + panel.innerHTML = '<p class="hint">Failed to load data.json: ' + err + "</p>"; |
| 187 | +}); |
| 188 | +</script> |
| 189 | +</body> |
| 190 | +</html> |
0 commit comments