File size: 21,204 Bytes
578663d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"""Build a static HF browser with a full scene catalog and a Franka camera guide."""
from pathlib import Path
import json,re,sys
ROOT=Path(__file__).resolve().parents[1]
DATA=ROOT if (ROOT/'provenance/source.json').exists() else ROOT/'dataset'
OUT=ROOT/'space'

JS=r'''

const DATA=JSON.parse(document.getElementById('catalog').textContent);

const esc=x=>String(x??'').replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));

const media=p=>DATA.media_base+p.split('/').map(encodeURIComponent).join('/');

const file=p=>DATA.file_base+p.split('/').map(encodeURIComponent).join('/');

const link=(u,t)=>`<a href="${esc(u)}" target="_blank" rel="noopener">${esc(t)}</a>`;

const tasks=DATA.tasks,groups=[...new Set(tasks.map(t=>t.category))];

let current=null,query='',group='all',mode='combined';

function drawList(){

 document.getElementById('groups').innerHTML=['all',...groups].map(g=>`<button class="group ${g===group?'active':''}" data-group="${esc(g)}">${g==='all'?'全部':esc(g)}<span>${g==='all'?28:tasks.filter(t=>t.category===g).length}</span></button>`).join('');

 const numeric=/^(C)?\d+$/i.test(query.trim());

 const shown=tasks.filter(t=>(numeric||group==='all'||t.category===group)&&(numeric?t.catalog_number===Number(query.replace(/^C/i,'')):`${t.scene_key} ${t.official_scene_id} ${t.name} ${t.instruction}`.toLowerCase().includes(query.toLowerCase())));

 document.getElementById('listCount').textContent=`${shown.length} / 28`;

 document.getElementById('taskList').innerHTML=shown.map(t=>`<button class="task-link ${current?.scene_key===t.scene_key?'active':''}" data-task="${esc(t.scene_key)}"><span class="id mono">C${String(t.catalog_number).padStart(2,'0')}</span><span class="name">${esc(t.name)}<small>${t.dataset_source?'MULTI-CAMERA DATA':t.gallery?'WEBSITE MP4':'CATALOG ONLY'}</small></span></button>`).join('')||'<div class="no-results">未找到场景。这里的 C01–C28 是官网目录辅助编号,不是 task_index。</div>';

 document.querySelectorAll('[data-group]').forEach(b=>b.onclick=()=>{group=b.dataset.group;drawList()});document.querySelectorAll('[data-task]').forEach(b=>b.onclick=()=>{select(b.dataset.task);window.scrollTo({top:0})});

}

function select(key,historyUpdate=true){document.querySelectorAll('video').forEach(v=>v.pause());if(historyUpdate)history.replaceState({},'',`?task=${encodeURIComponent(key)}`);current=tasks.find(t=>t.scene_key===key);drawList();if(key==='camera-guide')drawCamera();else drawTask();document.querySelector('.task-link.active')?.scrollIntoView({block:'nearest'});}

function player(p,poster='',aspect=''){return `<video controls playsinline preload="metadata" src="${esc(media(p))}" ${poster?`poster="${esc(media(poster))}"`:''} ${aspect?`style="aspect-ratio:${aspect}"`:''}></video>`}

function pageHeader(){return `<div class="topline"><span class="stats"><b>EmbodiedSWE</b> / 28 SCENES / 30 DATA EPISODES / 26 WEBSITE CLIPS</span><div class="toplinks">${link(DATA.repo_url,'HF 数据仓库 ↗')}${link('https://embodiedswe.github.io/#benchmark','官方项目 ↗')}<a href="?task=camera-guide" class="camera-link">腕部相机说明 ↗</a></div></div>`}

function episode(s){

 const n=s.views.length;

 const content=mode==='combined'?`<div class="view-labels" style="grid-template-columns:repeat(${n},1fr)">${s.views.map(v=>`<span>${esc(v.label)}</span>`).join('')}</div><div class="combined">${player(s.composite_path,s.preview_path,`${320*n}/268`)}</div>`:`<div class="views-scroll"><div class="views" style="grid-template-columns:repeat(${n},minmax(220px,1fr));min-width:${n*230}px">${s.views.map(v=>`<div class="view"><div class="camera">${esc(v.label)}</div>${player(v.path,'','4/3')}</div>`).join('')}</div></div>`;

 return `<article class="episode" data-episode="${s.episode_index}"><div class="episode-head"><div><b class="mono">EPISODE ${s.episode_index} · source task_index=${s.task_index}</b><div class="episode-meta">${s.frame_count} frames · ${s.fps} FPS · ${(s.frame_count/s.fps).toFixed(2)} s</div></div><span class="episode-badge">OFFICIAL HF DATA</span></div><div class="episode-instruction"><div class="label">该条数据的原始 instruction</div><p>${esc(s.instruction)}</p><span class="mono">${esc(s.source_repo)}</span></div>${content}<div class="episode-foot"><div class="source-links">${s.views.map(v=>link(file(v.path),v.label+' MP4')).join('')}${link(media(s.trajectory_path),'官方动作 / 状态')}${link(file(s.composite_path),'同步 MP4 ↗')}</div>${mode==='original'?'<div class="sync-actions"><button data-play>同步播放</button><button data-pause>暂停</button><button data-reset>回到开头</button></div>':''}</div><div class="error" hidden></div></article>`;

}

function drawTask(){

 if(!current){document.getElementById('main').innerHTML=pageHeader()+'<h1>请选择官网场景</h1>';bindCameraLinks();return}

 const t=current,idx=tasks.indexOf(t),samples=DATA.samples.filter(s=>s.scene_key===t.scene_key);

 document.title=`C${t.catalog_number} · ${t.name} · EmbodiedSWE`;

 let html=pageHeader()+`<div class="benchmark-note">C01–C28 是本浏览页的官网目录辅助编号。官方任务 ID 使用 <span class="mono">suite.scene</span>;每个 HF 数据库的 task_index / episode_index 单独编号,不能跨库混用。</div><div class="eyebrow">${esc(t.category)} · ${esc(t.difficulty)}</div><div class="task-heading"><span class="big-id mono">C${String(t.catalog_number).padStart(2,'0')}</span><h1>${esc(t.name)}</h1></div><div class="toplinks" style="margin-bottom:19px"><span class="mono">${esc(t.official_scene_id)}</span><div class="nav-buttons"><button class="small-button" id="previous" ${idx===0?'disabled':''}>← 上一个</button><button class="small-button" id="next" ${idx===27?'disabled':''}>下一个 →</button></div><a href="#rubric">评分标准 ↓</a></div><div class="instruction"><div class="label">官网任务目标 / instruction</div><p>${esc(t.instruction)}</p></div><div class="facts"><div class="label">官网列出的 evaluated on<strong>${esc(t.catalog_embodiments)}</strong></div><div class="label">公开示教<strong>${samples.length?samples.length+' 条完整 HF episode':'未找到该场景的公开 HF 训练示教'}</strong></div><div class="label">评分来源<strong>${link(t.grader_url,'当前官方 grader 源码 ↗')}</strong></div></div>`;

 if(samples.length)html+=`<section><div class="section-bar"><div><h2>官方多相机示教</h2><div class="section-note">完整 MP4,保持上游帧数与 FPS。${esc(samples[0].views.map(v=>v.label).join(' → '))}</div></div><div class="mode"><button data-mode="combined" class="${mode==='combined'?'active':''}">同步合并 MP4</button><button data-mode="original" class="${mode==='original'?'active':''}">各路 MP4</button></div></div><div class="data-source-note">单臂 Franka 的 WRIST 是一个腕部相机;没有虚构 LEFT / RIGHT。额外场景相机按实际名称展示。${link('https://huggingface.co/datasets/'+t.dataset_source.repo_id,'完整官方源数据 ↗')}</div>${samples.map(episode).join('')}</section>`;

 if(t.gallery)html+=`<section><div class="section-bar"><h2>官网演示 MP4</h2></div><article class="episode"><div class="episode-head"><b>${esc(t.name)} · WEBSITE DEMO</b><span class="episode-badge">RECORDED RENDER VIEW</span></div><div class="demo-video">${player(t.gallery.path)}</div><div class="episode-foot">${link(file(t.gallery.path),'MP4 文件 ↗')}${link(t.gallery.url,'官网原文件 ↗')}</div><div class="episode-instruction"><p>官网播放器设为 ${t.gallery.website_playback_rate}×;这里默认按公开 MP4 文件的 1× 播放。该片段没有提供配套腕部录像或动作轨迹,不能当成多相机训练 episode。</p></div><div class="error" hidden></div></article></section>`;

 else html+='<div class="empty" style="margin-top:24px"><b>官网暂无该场景的展示 MP4。</b><p>目前未找到对应的公开 HF 示教,因此保留任务说明与评分源码,不放入不相关视频。</p></div>';

 html+=`<section id="rubric"><div class="section-bar"><h2>Rubric · 评分与成功条件</h2></div><div class="instruction"><p style="font-size:15px">${esc(t.grader_summary)}</p></div><table class="scoring"><thead><tr><th>Stage</th><th>权重 / 占比</th><th>记录模式</th></tr></thead><tbody>${t.rubric.map(r=>`<tr><td style="font-size:13px;width:28%">${esc(r.stage)}</td><td>${r.weight} / ${(r.normalized_weight*100).toFixed(1)}%</td><td>${esc(r.mode)}</td></tr>`).join('')}</tbody></table><p class="description">progress 是各阶段值的归一化权重和,范围 [0,1]。live 读当前值;once 记录历史最好值;final 在交付结束时评估。score 根据过程峰值与末端完整评估决定,success 还要满足 check_success() 和 final 阶段要求。</p><div class="warning">这里展示当前公开代码的评分规则,不是本条示教的实测成绩。原始训练库可能使用更早的 grader 版本;示例没有公开逐条 score / success,因此留空。</div><details class="metadata"><summary>阶段定义与源码中的成功检查</summary><pre>${esc(t.grader_description)}</pre><pre>${esc(t.success_source)}</pre></details>${t.rubric_variants?`<details class="metadata"><summary>不同 goal 的 rubric 变体</summary><pre>${esc(JSON.stringify(t.rubric_variants,null,2))}</pre></details>`:''}</section><footer class="source-footer">${link(t.grader_url,'官方评分源码 ↗')}${link(DATA.repo_url,'精选数据仓库 ↗')}<p class="mono">Code revision: ${esc(DATA.source.code_revision)}</p><p>官网的 7 个展示标签与代码的 6 个 suite 并非同一层次:Liquid 演示分布于 deformable / puzzle 代码 suite。数据仅按需读取,不包括 assets 或模型权重。</p></footer>`;

 document.getElementById('main').innerHTML=html;bindCameraLinks();bindVideos();

 for(const [id,step] of [['previous',-1],['next',1]])document.getElementById(id).onclick=()=>{query='';document.getElementById('search').value='';select(tasks[idx+step].scene_key);window.scrollTo({top:0})};

 document.querySelectorAll('[data-mode]').forEach(b=>b.onclick=()=>{const y=scrollY;document.querySelectorAll('video').forEach(v=>v.pause());mode=b.dataset.mode;drawTask();window.scrollTo({top:y})});

}

function bindVideos(){

 document.querySelectorAll('.episode').forEach(el=>{const vs=[...el.querySelectorAll('video')],error=el.querySelector('.error');vs.forEach(v=>v.onerror=()=>{error.hidden=false;error.textContent='当前 MP4 加载失败,可用下方文件链接打开。'});if(!el.querySelector('[data-play]'))return;let timer=null;const pause=()=>{vs.forEach(v=>v.pause());clearInterval(timer);timer=null};el.querySelector('[data-play]').onclick=async()=>{try{vs.forEach(v=>{if(v.readyState)v.currentTime=vs[0].currentTime});await Promise.all(vs.map(v=>v.play()));clearInterval(timer);timer=setInterval(()=>{if(!el.isConnected){clearInterval(timer);return}for(const v of vs.slice(1))if(v.readyState&&Math.abs(v.currentTime-vs[0].currentTime)>.2)v.currentTime=vs[0].currentTime},300)}catch(e){pause();error.hidden=false;error.textContent='请点击各播放器或选择同步合并 MP4。'}};el.querySelector('[data-pause]').onclick=pause;el.querySelector('[data-reset]').onclick=()=>{pause();vs.forEach(v=>{if(v.readyState)v.currentTime=0})};vs[0].addEventListener('pause',pause);vs[0].addEventListener('ended',pause);});

}

function bindCameraLinks(){document.querySelectorAll('.camera-link').forEach(a=>a.onclick=e=>{e.preventDefault();select('camera-guide');window.scrollTo({top:0})})}

function drawCamera(){

 document.title='Franka wrist camera · EmbodiedSWE';

 const codeBase='https://github.com/EmbodiedSWE/EmbodiedSWE/blob/'+DATA.source.code_revision;

 const guide='https://franka.de/hubfs/Setup%20Guide%20for%20Camera%20Mount%20on%20Franka%20Robots_1.1_EN.pdf?hsLang=en';

 document.getElementById('main').innerHTML=pageHeader()+`<div class="eyebrow">CAMERA / SIMULATION & HARDWARE</div><h1 style="margin:17px 0 25px">Franka 腕部相机:需要吗,装在哪?</h1><div class="instruction"><div class="label">先分清使用方式</div><p>机械臂本身不要求必须装腕部相机。EmbodiedSWE 的编码代理可直接操作模拟器状态;已发布的视觉策略数据则包含 wrist,复现这些 VLA 输入时需要匹配原相机配置。</p></div><table class="scoring"><thead><tr><th>使用场景</th><th>腕部相机</th></tr></thead><tbody><tr><td style="font-size:13px">Coding-agent benchmark</td><td>不是原始 env 接口的硬性图像输入。get_states / describe_stage 等可读取模拟器状态,图像观察由包装器决定。</td></tr><tr><td style="font-size:13px">复现已发布 VLA 数据 / 策略</td><td>本次精选的 10 个源库都包含 wrist。闭环评估须匹配训练时的相机名称、外参、分辨率和帧率;去掉 wrist 需要重新适配与验证。</td></tr><tr><td style="font-size:13px">实机自己的新任务</td><td>按感知方案选择外部相机、腕部相机或二者组合。腕部相机随末端移动,适合补充近距离手指 / 工件视角。</td></tr></tbody></table><section><div class="section-bar"><h2>1. EmbodiedSWE 的仿真安装</h2></div><p class="description">官方 Franka 模型是 Panda + 平行夹爪。相机作为子节点挂在 <b>panda_hand</b>,不是挂在指尖或世界坐标中;它随 hand 的位姿一起移动。代码注释将它描述为 D435 支架 / DROID 风格,位于手旁并沿接近方向观察。</p><div class="camera-diagram"><svg viewBox="0 0 850 235" role="img" aria-label="Franka hand wrist camera optical-frame schematic"><defs><marker id="arrow" markerWidth="9" markerHeight="9" refX="7" refY="4" orient="auto"><path d="M0 0L8 4L0 8Z" fill="#c35d35"/></marker></defs><rect x="45" y="59" width="190" height="104" rx="12" fill="#263f35"/><text x="140" y="101" text-anchor="middle" fill="white" font-size="18">panda_hand</text><text x="140" y="131" text-anchor="middle" fill="#b5cfaa" font-size="13">随机器人移动的父 link</text><path d="M235 72H319V39H442" fill="none" stroke="#7a8d7c" stroke-width="9"/><text x="322" y="180" text-anchor="middle" fill="#68746d" font-size="13">手旁的固定支架 / 光学位置</text><rect x="443" y="13" width="131" height="75" rx="8" fill="#e4b291"/><circle cx="548" cy="50" r="15" fill="#263f35"/><text x="489" y="55" text-anchor="middle" font-size="15" fill="#52352c">wrist</text><path d="M578 50H773" fill="none" stroke="#c35d35" stroke-width="3" marker-end="url(#arrow)"/><text x="685" y="82" text-anchor="middle" fill="#b15230" font-size="14">光轴沿 hand 的 +Z</text><text x="685" y="109" text-anchor="middle" fill="#68746d" font-size="12">朝夹爪接近工件的方向</text><text x="50" y="220" fill="#68746d" font-size="12">坐标关系示意;非机械加工图,不代表实机朝向或螺丝孔位。</text></svg></div><table class="scoring"><thead><tr><th>参数</th><th>源码值</th></tr></thead><tbody><tr><td style="font-size:13px">parent link</td><td class="mono">panda_hand</td></tr><tr><td style="font-size:13px">eye(光心,link 局部坐标)</td><td class="mono">(0.0465, -0.0200, 0.0360) m = (46.5, -20, 36) mm</td></tr><tr><td style="font-size:13px">target(局部 look-at 点)</td><td class="mono">(0.0465, -0.0200, 0.3000) m</td></tr><tr><td style="font-size:13px">focal</td><td>10.5 mm;默认 20.955 mm 水平孔径下,约 90° 水平视场。</td></tr><tr><td style="font-size:13px">prim(单臂默认)</td><td class="mono">{ENV_REGEX_NS}/Robot/panda_hand/wrist</td></tr></tbody></table>${link(codeBase+'/robobench/robots/franka.py','Franka 相机声明 ↗')}${link(codeBase+'/data_engine/engine/replay.py','相机挂接与 look-at 实现 ↗')}</section><section><div class="section-bar"><h2>2. 实机安装:Franka 官方支架</h2></div><p class="description">官方 FR3 指南提供 D435/D435i 专用 STL 与通用相机支架。相机通过支架固定在 <b>Franka Hand 与末端法兰附近的一侧</b>,不是装在会开合的手指上。先固定相机到支架,再把支架组件接到 Hand / 末端法兰的指定 M6 安装位置;D435 相机侧使用 M3 螺钉,具体螺钉和扭矩依型号查指南。</p><div class="warning">这份指南的适用型号写明 FR3;EmbodiedSWE 的仿真资产是 Panda。Panda、FR3、Franka Hand、Robotiq 夹爪并非同一套机械接口,不能直接照抄螺钉长度或把仿真 eye 坐标当作安装孔位。</div><p class="description">实机应根据夹爪和相机型号选兼容支架,让镜头覆盖手指间的操作区,并给数据线保留活动余量。安装后的相机内参 / 手眼外参应实际标定;不能直接拿仿真坐标替代。</p><div class="source-links">${link(guide,'官方安装 PDF(图 1 / 图 4)↗')}${link('https://franka.de/models-and-simulation','官方 CAD / STL 下载 ↗')}${link('https://download.franka.de/camera_mount_guide.zip','官方可打印支架 ZIP ↗')}</div></section><footer class="source-footer">${link(codeBase+'/robobench/README.md','编码代理 env 接口 ↗')}${link(codeBase+'/vla/README.md','VLA 训练 / 评估相机契约 ↗')}<p>源码与厂商文档核查日期:2026-10-05。图中示意仅解释位置关系;机械尺寸以对应型号官方资料为准。</p></footer>`;

 bindCameraLinks();

}

document.getElementById('search').oninput=e=>{query=e.target.value;drawList()};

select(new URLSearchParams(location.search).get('task')??'bulb',false);

'''

def build():
    tasks=json.loads((DATA/'provenance/tasks.json').read_text(encoding='utf-8'));samples=json.loads((DATA/'provenance/samples.json').read_text(encoding='utf-8'));source=json.loads((DATA/'provenance/source.json').read_text(encoding='utf-8'))
    preview='--preview' in sys.argv
    pubpath=ROOT/'publication.json' if (ROOT/'publication.json').exists() else DATA/'provenance/media_publication.json'
    pub=json.loads(pubpath.read_text(encoding='utf-8')) if not preview else {'dataset_commit_sha':'preview'}
    revision=pub['dataset_commit_sha']
    payload=dict(tasks=tasks,samples=samples,source=source,repo_url='https://huggingface.co/datasets/Travor278/EmbodiedSWE-Task-Examples',media_base=f'https://huggingface.co/datasets/Travor278/EmbodiedSWE-Task-Examples/resolve/{revision}/',file_base=f'https://huggingface.co/datasets/Travor278/EmbodiedSWE-Task-Examples/blob/{revision}/')
    if preview:payload.update(media_base='http://127.0.0.1:8772/dataset/',file_base='http://127.0.0.1:8772/dataset/')
    template=(ROOT/'browser/base.html').read_text(encoding='utf-8');template=re.sub(r'<script id="catalog".*?</script>','<script id="catalog" type="application/json">__DATA__</script>',template,flags=re.S);template=re.sub(r'<script>.*?</script>',lambda m:'<script>'+JS+'</script>',template,flags=re.S);template=template.replace('RoboDojo','EmbodiedSWE').replace('<a href="?task=reference" id="referenceLink">工具演示</a>','<a href="?task=camera-guide" class="camera-link">相机说明</a>')
    extra='.task-link small{display:block;font-size:8px;color:#8eaa93;letter-spacing:.6px;margin-top:4px}.big-id{font-size:48px;letter-spacing:-2px}.benchmark-note,.data-source-note{font-size:11px;line-height:1.8;padding:13px 16px;background:#e8ece1;color:var(--muted);margin-bottom:20px;border:1px solid var(--line)}.episode-instruction{padding:14px 16px;background:#faf9f1;border-bottom:1px solid var(--line);font-size:12px;line-height:1.65}.episode-instruction p{margin:7px 0}.episode-instruction span{font-size:10px;color:var(--muted);overflow-wrap:anywhere}.metadata{padding:14px 17px;border:1px solid var(--line);background:var(--white);margin:12px 0;font-size:12px}.metadata summary{cursor:pointer}.metadata pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;line-height:1.7}.camera-diagram{margin:18px 0;padding:12px;background:var(--white);border:1px solid var(--line)}.camera-diagram svg{width:100%;height:auto}.toplinks{flex-wrap:wrap}.task-heading{flex-wrap:wrap}.combined video{aspect-ratio:auto}.facts strong{overflow-wrap:anywhere}'
    template=template.replace('</style>',extra+'</style>');encoded=json.dumps(payload,ensure_ascii=False,separators=(',',':')).replace('</','<\\/')
    OUT.mkdir(exist_ok=True);(OUT/'index.html').write_text(template.replace('__DATA__',encoded),encoding='utf-8')
    (OUT/'README.md').write_text('''---

title: EmbodiedSWE Task Examples

emoji: 🦾

colorFrom: green

colorTo: gray

sdk: static

app_file: index.html

fullWidth: true

---



# EmbodiedSWE task and camera browser



28 official catalog scenes, 26 website clips, 30 selected complete multi-camera dataset episodes.

The static app reads MP4s from the curated dataset without duplicating media or running a simulator.



Dataset: https://huggingface.co/datasets/Travor278/EmbodiedSWE-Task-Examples



Task links use `?task=bulb`, `?task=nut_thread`, etc. The Franka wrist-camera research guide is at `?task=camera-guide`.

''',encoding='utf-8')
    print('Built 28-scene browser and Franka camera guide; media revision',revision)

if __name__=='__main__':build()