import fs from "node:fs/promises"; import path from "node:path"; import { Workbook, SpreadsheetFile } from "@oai/artifact-tool"; const [folder, output] = process.argv.slice(2); if (!folder || !output) throw new Error("Pass the benchmark data directory and output XLSX path."); const read = async (f) => JSON.parse(await fs.readFile(path.join(folder, f), "utf8")); const [matrix, overview, methods, development, weights] = await Promise.all( ["matrix.json","overview.json","methods.json","development.json","weights_index.json"].map(read) ); const outputDir = path.dirname(output); await fs.mkdir(outputDir, {recursive:true}); const wb=Workbook.create(); const colors={dark:"#173740",teal:"#16746E",ink:"#243039",pale:"#E4F0ED",muted:"#586D74"}; const letter=(i)=>i<26?String.fromCharCode(65+i):letter(Math.floor(i/26)-1)+String.fromCharCode(65+i%26); const sheets={}; const flat=(s,r,c,values)=>s.getRangeByIndexes(r,c,values.length,values[0].length).values=values; const title=(s,title,sub,last)=>{ for (const [row,text,color,size,height] of [[1,title,colors.dark,16,36],[2,sub,colors.pale,10,30]]) { const end=Math.min(last,6); const r=s.getRange(`A${row}:${letter(end-1)}${row}`);r.merge();r.values=[[text]]; r.format.fill=color;r.format.font={name:"PingFang SC",size,bold:row===1,color:row===1?"#FFFFFF":colors.ink}; r.format.rowHeightPx=height;r.format.verticalAlignment="center"; } }; const column = (key,label,width=108,fmt=null)=>({key,label,width,fmt}); const num=(key,label,width=112,d=4)=>column(key,label,width,d===0?"0":"0."+"0".repeat(d)); function sheet(name,id,sub,cols,data) { if (!data.length) throw new Error("Empty evaluation sheet: "+name); const s=wb.worksheets.add(name);sheets[name]=s;s.showGridLines=false; const w=cols.length,stop=data.length+4; title(s,name,sub,w); flat(s,3,0,[cols.map(c=>c.label),...data.map(r=>cols.map(c=>r[c.key]??null))]); const area=s.getRange(`A4:${letter(w-1)}${stop}`); const t=s.tables.add(area.address.split("!").pop(),true,id); t.style="TableStyleMedium2";t.showFilterButton=true;t.showBandedRows=true; const b=s.getRange(`A5:${letter(w-1)}${stop}`);b.format.font={name:"PingFang SC",size:10,color:colors.ink}; b.format.rowHeightPx=22; const h=s.getRange(`A4:${letter(w-1)}4`);h.format.fill=colors.teal; h.format.font={name:"PingFang SC",size:10,bold:true,color:"#FFFFFF"};h.format.rowHeightPx=29; cols.forEach((c,i)=>{ s.getRange(`${letter(i)}4:${letter(i)}${stop}`).format.columnWidthPx=c.width; if(c.fmt)s.getRange(`${letter(i)}5:${letter(i)}${stop}`).setNumberFormat(c.fmt); }); s.freezePanes.freezeRows(4); s.freezePanes.freezeColumns(name==="对比总表"?2:1); return s; } const mainColumns=[ column("model","模型或配置",249),column("panel","协议",142),column("case","场景或分组",185),column("render","输出或接入方式",212),num("n","样本数¹",85,0),column("unit","计数单位",135), num("mae","画外 MAE ↓",117,6), num("lpips_full","整图 LPIPS ↓"), num("lpips_novel64","画外 LPIPS64 ↓",133),num("lpips_novel96","画外 LPIPS96 ↓",133), num("de00_novel","画外 ΔE00 ↓"),num("ssim_novel","画外 SSIM ↑"),num("ssim_full","整帧 SSIM ↑"),num("psnr_full","整帧 PSNR / dB ↑",149,3), num("psnr_novel","画外 PSNR / dB ↑",149,3),num("hp","归档高频相关 ↑",143),num("hp_novel","复算高频相关 ↑",143), num("edge_f1","边缘 F1@2px ↑",137),num("edge_lift","边缘位移增益 ↑",134),num("gradient","梯度比 ≈1"),num("gmsd_novel","画外 GMSD ↓",125), num("gmsd_full","整图 GMSD ↓",128),num("shadow_mae","暗部误差 ↓"),num("mid_mae","中间调误差 ↓"),num("bright_mae","亮部误差 ↓"), num("shadow_bias","暗部偏差 →0"),num("mid_bias","中间调偏差 →0",136),num("bright_bias","亮部偏差 →0"), num("known_mae","已见区 MAE ↓"),num("tof_px","光流差 / px ↓"),num("temporal_delta","帧差误差 ↓",130,6),num("exposure_flicker","整体曝光跳变误差 ↓",160,6), num("motion_error","补偿运动误差 ↓",140,6),num("depth_rank","伪深度秩相关 ↑",138),num("depth_mae","归一化深度 MAE ↓",157), num("text_cos","图文余弦 ↑"),num("text_real","实拍图文余弦"),num("visual_cosine","空间特征余弦 ↑",142), num("novel_fraction","画外比例"),num("pose_px","参考重投影 / px ↓",151),num("inliers","定位内点",105,0),num("seconds","交付时长 / 秒",127,2), num("angle","路径角度 / °",123,2),num("travel","归一化或场景位移",158),num("path_length","路径长度",105), num("support_s","首图支持至 / 秒",141,2),num("unique_poses","不同姿态数",124,0),num("patch_count","96块数",95,0),num("patch_views","有96块的视图数",140,0), num("narrow_patch_count","64块数",95,0),num("narrow_patch_frames","有64块的帧数",135,0),num("base_mae","该行基线新区 MAE",157), num("fps","fps",85,2),num("width","画幅宽",88,0),num("height","画幅高",88,0),num("cameras","输入相机数",118,0), num("point_count","点数",120,0),num("gaussian_count","Gaussian 数",124,0),num("valid_depth_fraction","有效深度比例",135), num("reprojection_med","匹配重投影中位 px ↓",170),num("reprojection_p90","重投影 P90 px ↓",155), num("identity_med","零运动对照 px",145),num("inlier_3px","误差 ≤3px 比例",140), num("photo_fraction","原图纹理平均占比",152),num("edge_mae","边缘 MAE ↓"),num("luma_bias","亮度偏差 →0"), num("false_bright","误亮比例 ↓"),num("missed_bright","漏亮比例 ↓"),column("note","分母与解释",490),column("source","数据源(仓库相对路径)",540) ]; const cover=wb.worksheets.add("阅读首页");cover.showGridLines=false; cover.getRange("A1:H23").format.font={name:"PingFang SC",size:11,color:colors.ink}; for(const [i,w] of [185,222,150,142,120,115,110,115].entries()) cover.getRange(`${letter(i)}1:${letter(i)}24`).format.columnWidthPx=w; title(cover,"CaveWorld3D · 实拍对照评测","2026.11.30 地下洞场景 | 图像与文本 → 相机可控视频",8); const line=(r,txt,shade=false)=>{ const cell=cover.getRange(`A${r}:H${r}`);cell.merge();cell.values=[[txt]]; cell.format.font={name:"PingFang SC",size:11,bold:shade,color:shade?"#FFFFFF":colors.ink}; if(shade)cell.format.fill=colors.teal;cell.format.rowHeightPx=shade?29:30;cell.format.verticalAlignment="center"; }; line(4,"同条件的项目对照",true); const official=overview.voyager.find(r=>r.model==="原始 Voyager"); const final=overview.voyager.find(r=>r.model==="v8.1 · 1200"); const latest=overview.single.find(r=>r.model==="最新单图光照响应"); const pano=overview.single.find(r=>r.model==="HY-Pano-2 官方"); const previous=overview.site.find(r=>r.panel==="M14" && r.model==="上一轮图库+保色"); const newMap=overview.site.find(r=>r.panel==="M14" && r.model.includes("标准曝光")); const cols=["输入条件","比较对象","计量指标","对照值","候选值","相对变化","优选方向","评价单位"]; const data=[ ["Voyager · 短轨","官方 → v8.1 第 1200 步","画外 RGB MAE",official.mae,final.mae,null,"越低越好","两段等权"], ["陌生位置 · 单图","官方全景 → 最新单图","画外 RGB MAE",pano.face_mae,latest.face_mae,null,"越低越好","裸岩五方向"], ["陌生位置 · 单图","官方全景 → 最新单图","画外 LPIPS96",pano.face_lpips_novel96,latest.face_lpips_novel96,null,"越低越好","裸岩五方向"], ["已建图 · 查询图","上一轮图库 → 最新标准曝光","画外 RGB MAE",previous.mae,newMap.mae,null,"越低越好","14 确认机位"], ["已建图 · 查询图","上一轮图库 → 最新标准曝光","整图 LPIPS",previous.lpips_full,newMap.lpips_full,null,"越低越好","14 确认机位"] ]; flat(cover,5,0,[cols,...data]); cover.getRange("A6:H6").format.font={name:"PingFang SC",bold:true,color:colors.ink};cover.getRange("A6:H6").format.fill=colors.pale; cover.getRange("A6:H11").format.rowHeightPx=27; cover.getRange("D7:E11").setNumberFormat("0.00000"); for(let row=7;row<=11;row++)cover.getRange("F"+row).formulas=[[`=E${row}/D${row}-1`]]; cover.getRange("F7:F11").setNumberFormat("+0.00%;-0.00%;0.00%"); line(13,"怎样使用这份表",true); line(14,"「对比总表」包含全部协议。先按协议、场景和输出方式筛选,再对照同一列。"); line(15,"「Voyager 全系」逐权重比较两条真实轨迹。「固定单图」使用同一随机种子 143。"); line(16,"「同址机位」列出 25 个历史、9 个诊断、14 个确认机位。「配对差值」保留方向与机位级胜数。"); line(17,"「实测观察」保留新计算的原始机位与逐片记录,来源路径、像素摘要与实际裁块数可追溯。"); line(18,"「指标字典」说明方向、实现与缺测条件,「论文」提供原文入口。空白表示该协议缺测或不适用。"); line(19,"开发选型、模型文件、正式成片分表登记。基于同一洞段的多个相机和种子不能当作独立洞室。"); cover.freezePanes.freezeRows(2); sheet("对比总表","AllProtocols","¹ 样本单位随协议变化。参考「阅读首页」与「指标字典」,同协议、同场景、同输出方式下比较。",mainColumns,matrix); sheet("Voyager 全系","VoyagerHistory","同输入与轨迹的首图融合成片。两列 MAE 与 PSNR 按场景,其余指标为两场景等权。",[ column("model","模型或检查点",225),num("rock_mae","裸岩画外 MAE ↓",148,6),num("steel_mae","钢拱画外 MAE ↓",148,6), num("rock_psnr","裸岩 PSNR / dB ↑",153),num("steel_psnr","钢拱 PSNR / dB ↑",153),num("mae","两场景 MAE ↓",155,6), num("lpips","整图 LPIPS ↓"),num("lp64","画外 LPIPS64 ↓",134),num("de00","画外 ΔE00 ↓"),num("tof","光流差 / px ↓"), num("depth","伪深度秩相关 ↑",142),num("text","实际提示词余弦 ↑",153)],overview.voyager); const sc=[column("model","单图模型或配置",265)]; for (const [k,title] of [["wall","岩壁"],["face","裸岩"],["steel","钢筋网"]])for (const [m,l] of [["mae","画外 MAE ↓"],["lpips_novel96","画外 LPIPS96 ↓"],["de00_novel","ΔE00 ↓"],["hp_novel","高频相关 ↑"],["lpips_full","整图 LPIPS ↓"],["text_cos","描述余弦 ↑"]])sc.push(num(k+"_"+m,title+" "+l,160,5)); sheet("固定单图","SinglePhoto","seed 143,岩壁 1 端点、裸岩 5 方向、钢筋网 1 个同图中心裁剪。新视角原图、权重与渲染处理见总表。",sc,overview.single); sheet("同址机位","MappedViews","现场地图与图库可用。不同面板使用同一留出录像的不同帧,5 个预设机位是 25 个固定机位的子集。",mainColumns.filter(c=>["model","panel","n","mae","ssim_novel","lpips_full","lpips_novel96","de00_novel","hp","gradient","edge_f1","shadow_mae","bright_mae","patch_views","source"].includes(c.key)), matrix.filter(r=>["M25","M9","M14","M5"].includes(r.panel))); sheet("配对差值","PairedViews","标准曝光减上一轮图库,同机位比较。胜数根据各指标方向计算,同视频帧具有相关性。",[ column("group","机位组",145),column("metric","指标字段",190),num("n","有效机位",100,0),num("wins","新版更优机位",130,0), ...["mean","median","low","high"].map((k,i)=>num(k,["平均差","中位差","最小差","最大差"][i],125,6))],overview.paired); sheet("指标字典","MetricDefinitions","论文标准实现、项目改写、实测状态与缺失条件均单独注明。",[ column("a","评价维度",155),column("b","指标",295),column("c","方向",112),column("d","单位",155), column("e","状态",120),column("f","定义及限制",690),column("g","依据",205) ],methods.metrics.map(r=>Object.fromEntries(r.map((c,i)=>["abcdefg"[i],c])))); sheet("论文","PrimarySources","原始论文与作者页面。P02 对应 LPIPS 感知评测,P06 对应光流时序诊断。",[ column("id","编号",68),column("author","作者与年份",225),column("title","论文",620),column("use","本项目用途",585),column("url","原文链接",505) ],methods.papers.map(([id,author,title,use,url])=>({id,author,title,use,url}))); const raw=[]; for(const f of ["early","late","smoke","field","pano","fusion","allsite"]){ const text=await fs.readFile(path.join(folder,f+".jsonl"),"utf8"); for (const entry of text.trim().split("\n")) { const obs=JSON.parse(entry); raw.push({...obs,file:f+".jsonl",source:obs.source?.replace(/^\/dev\/shm\//,"")}); } } sheet("实测观察","MeasuredViews","每行一个生成片段或一个机位,RGB 与掩码摘要对应服务器上无损像素;重放与旧图的重叠机位同时保留。",[ column("file","证据文件",105),column("protocol","协议",115),column("method","方法字段",175),column("case","案例",205),column("rendering","输出",105), column("view","机位",110),num("seed","种子",74,0),num("frames","帧数",80,0),num("width","宽",75,0),num("height","高",75,0), num("mae_novel","画外 MAE 帧均 ↓",152,6),num("lpips_full","整图 LPIPS ↓"),num("lpips_novel96","画外 LPIPS96 ↓",139), num("lpips_novel64","画外 LPIPS64 ↓",139),num("de00_novel","ΔE00 ↓"),num("gmsd_novel","画外 GMSD ↓"),num("hp_novel","高频相关 ↑"), num("tof_px","光流差 / px ↓"),num("lpips_patches","96块数/帧均",140,2),num("narrow_patch_count","64块总数",110,0), column("reference","实拍像素 SHA-256",545),column("mask_hash","画外掩码 SHA-256",545),column("source","原始预测路径",700)],raw); sheet("开发检查点","DevelopmentTrials","训练时开发集选择记录。索引可能是步、轮或候选值,原文件规定单位。不同实验的选型目标分别解释。",[ column("experiment","实验",250),column("module","分支",200),column("index","步/轮/索引",150),column("setting","设置",133), num("mae","开发 MAE ↓"),num("ssim","开发 SSIM ↑"),num("cost","选择代价"),num("objective","选择目标"),num("flow_mse","流匹配 MSE ↓"),num("mean","来源均值"),num("value","归档标量"), column("selection","原选型记录",360),column("source","选型文件",520)],development); sheet("权重索引","SavedComponents","服务器实验目录中的权重组件与交付副本,文件数包含同一模型的别名。有成片的模型在「对比总表」登记。",[ column("experiment","实验目录",380),column("path","权重文件/分支",575),num("bytes","字节",155,0)],weights); wb.recalculate(); const verify=await wb.inspect({kind:"table",range:"'阅读首页'!D7:F11",include:"values,formulas",tableMaxRows:5,tableMaxCols:3}); const checkText=JSON.stringify(verify.ndjson??verify); if(checkText.includes("#REF!")||checkText.includes("#DIV/0!"))throw new Error(checkText); const preview=await wb.render({sheetName:"阅读首页",range:"A1:H19",scale:1.15,format:"png"}); await fs.writeFile(path.join(outputDir,"workbook_preview.png"),new Uint8Array(await preview.arrayBuffer())); const file=await SpreadsheetFile.exportXlsx(wb); await file.save(output); console.log(JSON.stringify({sheets:wb.worksheets.items.length,rows:matrix.length,observations:raw.length}));