Datasets:
Download code/evaluation-code/v0.2-0c2690ae/apps/console/web/src/FactsPanel.tsx from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 3.46 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/src/FactsPanel.tsx
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/apps/console/web/src/FactsPanel.tsx
-
curl -L -o FactsPanel.tsx https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/src/FactsPanel.tsx
3.46 kB
| import {useEffect, useState} from 'react'; | |
| import {getFacts} from './api.ts'; | |
| import {boundaryRows, factRows} from './facts-view.ts'; | |
| import type {FactRow, SegmentFacts} from './facts-view.ts'; | |
| // 接入-9:证明器看到的(每路录像对主体、门洞、房间边界的可见量,过门、进出房间),审剧本时对照用 | |
| export function FactsPanel({segmentId, onSeek}: {segmentId: string; onSeek: (time: number) => void}) { | |
| const [view, setView] = useState<string | undefined>(), [facts, setFacts] = useState<SegmentFacts | null>(null), [error, setError] = useState(''); | |
| useEffect(() => { | |
| const c = new AbortController(); setError(''); | |
| getFacts(segmentId, view, c.signal).then(setFacts, e => {if (!c.signal.aborted) {setFacts(null); setError(String(e?.message || e));}}); | |
| return () => c.abort(); | |
| }, [segmentId, view]); | |
| if (error) return <p className="review-empty">读不到证明器事实:{error}</p>; | |
| if (!facts) return <p className="review-empty">正在读证明器事实…</p>; | |
| const th = facts.thresholds, at = (t: number | null) => t == null ? '没有' : `${t.toFixed(1)} s`; | |
| const strip = (cells: (boolean | number)[]) => <span className="facts-strip">{cells.map((x, i) => | |
| <i key={i} className={x ? 'on' : ''} title={`${facts.t_s[i]?.toFixed(1)} s`} onClick={() => onSeek(facts.t_s[i])}/>)}</span>; | |
| const table = (caption: string, rows: FactRow[]) => <table className="facts-table"><caption>{caption}</caption> | |
| <thead><tr><th>id</th><th>过门槛约</th><th>首次</th><th>时间条</th></tr></thead> | |
| <tbody>{rows.map(r => <tr key={r.id}><td>{r.id}</td><td>{r.seconds.toFixed(1)} s</td><td>{at(r.first_s)}</td><td>{strip(r.cells)}</td></tr>)}</tbody></table>; | |
| return <section aria-label="证明器事实" className="facts-panel"> | |
| <div className="aside-actors" aria-label="选择录像">{facts.videos.map(v => <button key={v} aria-pressed={facts.view.video === v} onClick={() => setView(v)}>{v}</button>)}</div> | |
| <p className="aside-summary">录像 {facts.view.video} · {facts.view.frame_count} 帧 · 每格 {(1 / facts.hz).toFixed(1)} s。门槛(方法卡):投影高至少 {th.min_projected_height}、遮挡至多 {th.max_occlusion_fraction}</p> | |
| <small className="aside-situation-note">每格取格内最清楚的一刻,高和遮挡可能不在同一帧,所以过门槛的秒数是上界;判题以证明器为准。点时间条跳到那一刻。</small> | |
| {table('主体', factRows(facts.entities, facts))} | |
| {table('门洞', factRows(facts.doorways, facts))} | |
| <table className="facts-table"><caption>房间边界(看见的米数)</caption><thead><tr><th>房间</th><th>最多</th><th>首次</th><th>时间条</th></tr></thead> | |
| <tbody>{boundaryRows(facts.room_boundary_visible_m, facts).map(r => <tr key={r.id}><td>{r.id}</td><td>{r.max_m.toFixed(1)} m</td><td>{at(r.first_s)}</td><td>{strip(r.cells)}</td></tr>)}</tbody></table> | |
| <details><summary>过门 {facts.events.door.length} 次 · 进出房间 {facts.events.room.length} 次</summary> | |
| <ul className="facts-events">{[...facts.events.door.map(e => ({t: e.t_s, text: `${e.actor} 过 ${e.door}(到 ${e.side} 侧)`})), | |
| ...facts.events.room.map(e => ({t: e.t_s, text: `${e.actor} ${e.kind} ${e.room}`}))].sort((a, b) => a.t - b.t).map((e, i) => | |
| <li key={i}><button onClick={() => onSeek(e.t)}>{e.t.toFixed(1)} s</button> {e.text}</li>)}</ul></details> | |
| </section>; | |
| } | |